iPad的自定义字体 - iOS 3.2无效 [英] Custom font for iPad - iOS 3.2 isn't working
问题描述
我正在构建一个仅限iPad的应用程序。我需要使用带有一些标签的自定义字体,所以我将它们添加到我的项目中。它们出现在我的复制包资源的应用程序目标中。我还将他们的名字添加到我的App的-Info.plist文件中:
I'm building an iPad-Only application. I need to use a custom font with some labels, so I added them to my project. They appear in my application target for "Copy Bundle Resources". I also added their names to my App's -Info.plist file:
<key>UIAppFonts</key>
<array>
<string>font1.ttf</string>
<string>font2.ttf</string>
<string>font3.ttf</string>
<string>font4.ttf</string>
</array>
即便如此,当我尝试设置标签的字体时,它似乎只是使用默认值。我无法弄清楚如何克服这个问题。非常感谢任何帮助。
Even so, when I try to set the font of my labels, it seems to just use the default. I haven't been able to figure out how to overcome this issue. Any assistance would be greatly appreciated.
- (void)debug {
NSLog(@"fonts: %@", [UIFont familyNames]);
UIFont *f1 = [UIFont fontWithName:@"Helvetica" size:20];
UIFont *f2 = [UIFont fontWithName:@"font1" size:5];
NSLog(@"f1:%@ f2:%@", f1, f2);
}
推荐答案
解决方案已结束要使用不同的字体。我用FontForge打开字体并收到此警告:
The solution ended up being to use a different font. I opened the font with FontForge and got this warning:
此字体标有FSType为2(限制许可证)。这意味着未经合法所有者许可,它不可编辑。
This font is marked with an FSType of 2 (Restricted License). That means it is not editable without the permission of the legal owner.
这似乎是我的问题的原因。我下载了我试图使用的免费版本的字体(幸运的是它可以免费使用),一切都开始完美。
This seems to be the cause of my issues. I downloaded a free version of the font I was trying to use (luckily it was available for free) and everything started working perfectly.
这篇关于iPad的自定义字体 - iOS 3.2无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!