iOS应用上的自定义字体 - 在模拟器中工作,但不是iPad [英] Custom fonts on iOS app - working in Simulator but not iPad

查看:153
本文介绍了iOS应用上的自定义字体 - 在模拟器中工作,但不是iPad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里遇到一个奇怪的问题。我为我的学校项目(非商业)开发游戏,并使用自定义字体 Black Chancery (在GNU GPL下免费)。我遵循了多个来源的说明,包括:
$ b $ ul
  • 将字体添加到项目中(TTF)。
  • 修改 app-Info.plist 以将字体添加到它(由应用程序提供的字体)。
  • 使用 [UIFont fontWithName:@BlackChancerysize:30]



  • 我可以在模拟器中显示字体,但是当我将它加载到我的iPad中时,会使用默认的系统字体。我很确定这个字体本身没有问题,因为它在模拟器中显示,我用FontForge打开字体没有任何警告(从 This Question )。



    不胜感激。谢谢! :)

    解决方案

    我只能猜测,因为你还没有发布你的plist的内容或者一个目录列表,但很多情况下资源在模拟器上工作,但不在设备上是由于OS X文件系统通常配置为不区分大小写,而设备上的文件系统区分大小写。例如,如果您的文件被命名为BlackChancery.TTF,而您的plist将其称为BlackChancery.ttf,则可以在模拟器上找到该文件,但不会在设备上找到。


    Encountering a weird problem here. I'm developing a game for my school project (non-commercial), and I'm using a custom font Black Chancery (free under GNU GPL). I followed the instructions from multiple sources, which includes:

    • Add the font to the project (TTF).
    • Modify app-Info.plist to add the font to it ("Fonts provided by application").
    • Using [UIFont fontWithName:@"BlackChancery" size:30] when the font is needed.

    I could get the font displayed in the Simulator, however when I load it into my iPad, the default system font is used. I'm pretty sure there isn't a problem with the font itself as it displays in the simulator, and I've used FontForge to open the font without any warnings (following from This Question).

    Any help is greatly appreciated. Thanks! :)

    解决方案

    I can only guess as you haven't posted the contents of your plist or a directory listing of the bundle, but many cases of "resource works on the simulator but not on the device" are caused by the fact that the OS X filesystem is normally configured to be case-insensitive while the filesystem on the device is case sensitive. For example, if your file is named "BlackChancery.TTF" and your plist refers to it as "BlackChancery.ttf", it will be found on the simulator but not on the device.

    这篇关于iOS应用上的自定义字体 - 在模拟器中工作,但不是iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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