字体(Marion字体)不在XCode

时间:2018-06-05 11:45:26

标签: ios xcode fonts custom-font

我在XCode中包含了Marion.otf格式。

它复制并包含在目标中也如此图所示:

img 1

休息其他字体otf格式正确可见&所有字体都包含在Build Phases,info.plist中。我也尝试添加ttf格式,但这些格式太不可见了。

enter image description here

enter image description here

图像描绘字体安装在机器上:

enter image description here

顺便说一下,在尝试在调试器中打印字体系列时,我无法在那里看到这些包含的字体。使用此代码打印字体:

for family: String in UIFont.familyNames
{
    print("\(family)")
    for names: String in UIFont.fontNames(forFamilyName: family)
    {
        print("== \(names)")
    }
}

每当我试图打开尺寸检查器时,Marion字体也不会显示在那里。可能的原因是什么?

enter image description here

3 个答案:

答案 0 :(得分:0)

在项目.plist中添加新添加的字体,如下面的键:

Fonts provided by application

enter image description here

答案 1 :(得分:0)

  • 在您的计算机上安装字体。

  • Info.plist文件中添加字体。

  • 确保它们已包含在目标

enter image description here

  • 仔细检查您的字体是否包含在捆绑包中的Resources

enter image description here

该字体将在文件检查器中可用。

  

如果您仍然遇到问题,请关闭xcode并删除派生数据,然后重新启动xcode。这个技巧对我有用。

答案 2 :(得分:0)

MacOS High Sierra不正确支持Marion字体。如doc

所示