AIR移动:在运行时加载自定义字体中的iOS [英] AIR Mobile: Loading custom fonts in iOS at runtime

查看:192
本文介绍了AIR移动:在运行时加载自定义字体中的iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的应用程序下载,并呈现外,自定义内容,其中包括定制的专用字体。对于Web,桌面和Android只需使用具有嵌入字体的外部SWF文件。它使技术意义上说,为什么这种方法不会对iOS的工作,但我一直没能找到任何替代品。这是根本不可能的?我希望这不是因为这意味着我们的应用程序的情况下是不可能的使用AIR移动技术的iOS。

Our application downloads and renders external, custom content which includes custom, proprietary fonts. For web, desktop, and Android we simply use external SWF files that have the fonts embedded. It makes technical sense why this method wouldn't work for iOS, but I haven't been able to find any alternatives. Is this simply not possible? I hope that's not the case as it would mean our application isn't possible for iOS using the AIR mobile technologies.

埃里克

编辑的详细信息:

让我进入一个更详细一点关于这个过程。在服务器上一个PDF上传。然后我们分析和从PDF,包括字体的每一页中提取的内容。这些字体往往是完全自定义的,并prioprietary给内容所有者,因为它们存储的数学和其他非标准字符符号。当我们提取这些字体,我们分配的字体为唯一标识符,嵌入它,并把它编译成SWF。当该内容从客户端请求的,我们有字体为它的列表。我们下载包含这些字体,然后加载和注册字体的所有SWF文件。这里是我们所拉下的SWF的一个例子。这是在编译的SWF的全部被推倒。

Let me go into a bit more detail on this process. On the server a PDF is uploaded. We then parse and extract content from the PDF, including fonts for each page. These fonts are often completely custom and prioprietary to the content owner, as they store symbols for math and other non-standard characters. When we extract these fonts, we assign the font to a unique identifier, embed it, and compile it into a SWF. When that content is requested from the client, we have a list of fonts for it. We download all SWF files that contain those fonts and then load and register the fonts. Here is an example of the SWF we are pulling down. This is the entirety of the compiled SWF being pulled down.

package {
    import flash.display.Sprite;
    import flash.text.Font;
    import flash.system.Security;

    public class F9471cf2d10924f87820ae61a30dd4b8f extends Sprite
    {

      [Embed(source='TempF9471cf2d10924f87820ae61a30dd4b8f.swf',symbol='F9471cf2d10924f87820ae61a30dd4b8f')]
      public static var F9471cf2d10924f87820ae61a30dd4b8f:Class;



      public function F9471cf2d10924f87820ae61a30dd4b8f()
      {
          Security.allowDomain("*");
          Security.allowInsecureDomain("*");

          Font.registerFont(F9471cf2d10924f87820ae61a30dd4b8f);
      }
    }
}

我们没有这些字体集合前手在任何库来存储。这一切都是动态生成的内容,所以我们需要能够下载并注册按需字体,没有字体的任何事先了解。

We don't have a collection of these fonts to store in any libraries before hand. This is all dynamically generated content, so we need to be able to download and register fonts on demand, without any beforehand knowledge of the font.

推荐答案

如果我理解正确的话,你要处理自定义字体在运行时。检查了这一点: https://github.com/zynga/FontLabel

If I understand it correctly, you want to handle custom fonts at runtime. Check this out: https://github.com/zynga/FontLabel.

这篇关于AIR移动:在运行时加载自定义字体中的iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆