iOS 中无法使用 Maestro 字体

Can't use the Maestro font in iOS

我们目前正在 iOS 中开发音乐创作应用程序。但是我不能使用我从互联网上获得的 .ttf 格式的名为 "Maestro" 的字体。

我也试过使用 macOS 自带的 .suit,但没用。

我按照这个问题中的步骤导入了我的自定义字体: custom font not working programetically in swift

打印存在的字体也会显示 Maestro 字体:

print(UIFont.familyNames)

结果:(Maestro在最后一个元素中找到)

["Copperplate", "Heiti SC", "Apple SD Gothic Neo", "Thonburi", "Gill Sans", "Marker Felt", "Hiragino Maru Gothic ProN", "Courier New", "Kohinoor Telugu", "Heiti TC", "Avenir Next Condensed", "Tamil Sangam MN", "Helvetica Neue", "Gurmukhi MN", "Georgia", "Times New Roman", "Sinhala Sangam MN", "Arial Rounded MT Bold", "Kailasa", "Kohinoor Devanagari", "Kohinoor Bangla", "Chalkboard SE", "Apple Color Emoji", "PingFang TC", "Gujarati Sangam MN", "Geeza Pro", "Damascus", "Noteworthy", "Avenir", "Mishafi", "Academy Engraved LET", "Futura", "Party LET", "Kannada Sangam MN", "Arial Hebrew", "Farah", "Arial", "Chalkduster", "Kefa", "Hoefler Text", "Optima", "Palatino", "Malayalam Sangam MN", "Al Nile", "Lao Sangam MN", "Bradley Hand", "Hiragino Mincho ProN", "PingFang HK", "Helvetica", "Courier", "Cochin", "Trebuchet MS", "Devanagari Sangam MN", "Oriya Sangam MN", "Snell Roundhand", "Zapf Dingbats", "Bodoni 72", "Verdana", "Maestro Wide", "American Typewriter", "Avenir Next", "Baskerville", "Khmer Sangam MN", "Didot", "Savoye LET", "Bodoni Ornaments", "Symbol", "Menlo", "Noto Nastaliq Urdu", "Bodoni 72 Smallcaps", "Papyrus", "Hiragino Sans", "PingFang SC", "Myanmar Sangam MN", "Zapfino", "Telugu Sangam MN", "Bodoni 72 Oldstyle", "Euphemia UCAS", "Bangla Sangam MN", "Maestro"]

我发现 Maestro.ttf 字体用于音乐符号,如果您将标签设置为 label.text = "hello world" 那么它将正常显示,但是如果您从字体中复制符号并将其粘贴到字符串,然后它将在 运行 时间显示。

复制下面的文字并将其粘贴到您的代码中,此处的 ? 符号是因为该网站(以及 xcode)不支持 Maestro 字体

label.text = " "

模拟器截图:

要显示 Maestro 字体的符号,您不能简单地输入 1234 hello 文本 (0-9, a-z,A-Z) 并期望它被转换。您需要从字体(下面的屏幕截图)中复制符号并将其粘贴到 xcode,尽管它会显示为 ?在 xcode 但是当你 运行 它会显示 Maestro 字体符号。

使 xcode 显示 Maestro 字体

  1. 在字体书中安装字体
  2. 重启 xcode
  3. 进行如下设置