iPhone中非系统字体的名称

发布于 2024-10-01 12:34:11 字数 331 浏览 0 评论 0原文

我想向我的 iPhone/iPad 应用程序添加非系统字体。

我已将字体文件添加到项目中,并将字体添加到 info.plist 的 UIAppFonts 属性中。

要加载字体,我使用 UIFontfontWithName。但字体的名称似乎不是文件名(带或不带扩展名),也不是字体书中出现的名称。

UIFont* font = [UIFont fontWithName:@"What goes here?" size:10];

我在哪里可以找到字体的名称

I want to add a non-system font to my iPhone/iPad app.

I have added the font file to the project and also added the font to the UIAppFonts property of the info.plist.

To load the font I'm using fontWithName of UIFont. But the name of the font does not seem to be the file name, with or without extension, nor the name that appears in Font Book.

UIFont* font = [UIFont fontWithName:@"What goes here?" size:10];

Where do I find out the name of the font?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

记忆之渊 2024-10-08 12:34:11

UIFont+familyNames+fontNamesForFamilyName: 应该可以解决问题。

UIFont's +familyNames and then +fontNamesForFamilyName: should do the trick.

夏日浅笑〃 2024-10-08 12:34:11

如果您在 Mac 上的“字体册”中打开 ttf 文件,窗口的标题也是 iOS 使用的名称。 (在我的例子中,AvantGarde Bk BT)

在此处输入图像描述

If you open the ttf file in Font Book on your Mac, the title of the window is the name iOS uses too. (In my case, AvantGarde Bk BT)

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文