在 iOS 上,我可以访问系统提供的字体的 TTF 文件吗
我正在尝试 FTGLES 在 iOS 上的 OpenGL-ES 上动态显示任意字体的文本(参见我的问题这里)。该库似乎需要直接访问 TTF 文件才能使用该字体。使用 kosher 方法,可以通过路径直接访问 iOS 上的系统字体文件吗?我已经RTFM了,但找不到任何东西。
除此之外,有谁知道苹果是否批准将系统字体复制到您的应用程序中(在提交之前)。
I'm trying out FTGLES to dynamically display text in arbitrary fonts on OpenGL-ES on iOS (cf. my SO question here). That library seems to require direct access to the TTF file to use the font. Using kosher methods, can one directly access -- by path -- the system font files on iOS? I've RTFM'd and couldn't find anything.
Barring that, does anyone know if it is Apple-approved to copy the system fonts into your app (before submission).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我的解决方案受到了skia的启发。
虽然不能直接访问系统内置的字体文件,但我们还有一个间接的方法:
用你想要的字体名称创建一个CGFont,只需调用CGFontCopyTableTags()和CGFontCopyTableForTag()就可以访问该CGFont的SFNT表的所有内容。
然后可以使用这些表构建 ttf/otf 字体数据,将新创建的字体保存到磁盘,稍后可以在 FTGL ES 中使用它。
My solution was inspired by skia.
Though cannot access system built-in font files directly, we still have an indirect way:
Create a CGFont with your wanted font name, all contents of SFNT table of this CGFont can be accessed by simply calling CGFontCopyTableTags() and CGFontCopyTableForTag().
A ttf/otf font data can then be constructed by using these tables, save the new created font to disk, you can use it in FTGL ES later.
不可以,您无法访问 iOS 设备上系统安装的 TTF 文件。因此,您必须嵌入您想要使用的字体。
免责声明:我不是律师,在 iOS 应用程序中使用 Apple 提供的系统字体的可接受性是一个有关解释软件许可证的法律问题,因此您可能需要寻求专业建议。
您希望在您的应用程序中嵌入 Apple 提供的字体。 “嵌入”的定义有点模糊,因此将字体添加到 iOS 应用程序可能符合也可能不符合版权所有者对“嵌入”的定义。某些类型的公司将“嵌入”定义为仅查看所包含字体中的预定内容;其他意味着以该字体查看和编辑内容。显示在应用程序运行期间发生变化的内容介于这两种情况之间。
根据 Mac OS X Lion 10.7.2 ELUA:
如果在 iOS 应用程序中使用字体确实是“嵌入”,您只需在字体簿中检查您希望使用的特定字体即可。
在这种情况下,我会找到一种或一组字体,并且我已明确许可将这些字体包含在 iOS 应用程序中。我首先会在各种类型的房屋中寻找明确允许这种用途的许可方案。这可能会变得昂贵,因此另一个策略是寻找具有允许这种使用的许可证的开源字体。或者,对于非常有限的字符集(例如只有数字),我什至会考虑绘制自己的字体。
No, you can't access the system installed TTF files on iOS devices. So you'll have to embed the typefaces you'd like to use.
Disclaimer: I'm not a lawyer, and the acceptability of using Apple supplied system fonts in an iOS app is a legal question about interpreting software licenses, so you may want to seek professional advice.
You wish to embed an Apple supplied font in your app. The definition of "embed" is a bit nebulous, so adding the font to an iOS app may or may not fit within the copyright holder's definition of "embed". Some type houses define "embed" to mean just viewing predetermined content in the included font; other mean viewing and editing content in that font. Displaying content that changes during the running of your app is somewhere between these two cases.
According to the Mac OS X Lion 10.7.2 ELUA:
If using the fonts in an iOS app is indeed "embedding", you just need to check the particular fonts you wish to use in Font Book.
In this situation I would find a font or set of fonts where I had explicit permission to include the fonts in the iOS app. I would start by shopping around the various type houses for a licensing scheme that explicitly allowed this use. This may get expensive, so another tack would be to seek out open source typefaces with a license that would allow this use. Or, for a very limited set of characters (e.g. only numbers) I would even consider drawing my own typeface.
不可以。您的应用程序无法访问应用程序沙箱之外的文件。期间(好吧,除非它已越狱;)。但你确实可以捆绑字体文件。现在,我认为苹果没有理由拒绝你的应用程序,因为它使用的是设备上已有的文件,而你只需将本地文件包含到其中即可。就版权而言,苹果已经获得了在其设备上使用它的许可,因此您将其包含在内应该没有问题。
我说应该是因为我不需要这种功能,也没有用我自己的提交来测试它,但基于我过去看到的法律本能和字体版权问题,我预计它不会成为一个问题。
No. Your app cannot access files outside the sandbox of your app. Period (well, unless it's jailbroken ;). But you can indeed bundle the font file. Now, I see no reason why Apple would reject your app, as it's using a file already available on the device, and you're just including your local file to it. In terms of copyright, Apple already has that permission to use it on their device, so your inclusion of it should be no problem.
I say should because I haven't needed this capability and haven't tested it with a submission of my own, but based on legal instinct and font copyright issues I've seen in the past, I'd expect that it wouldn't be a problem.