UIFont fontWithName: limited to loading 2 variations per family

后端 未结 2 728
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-10 06:58

This question is extremely similar to UILabel with custom font displays *wrong* custom font, except I need to use three fonts from this family simultaneously. I am using Myriad

相关标签:
2条回答
  • 2021-02-10 07:26

    Open Font Book application. If you installed the fonts yourself, go to user, look for the fonts you want and use the PostScript name of the font in your xcode project.

    It should work even for different font variations of the same family.

    0 讨论(0)
  • 2021-02-10 07:27

    In a bizarre but somewhat anticipated workaround, I found that I could actually use a third variation by opening the font up in an editor (I just grabbed the first one I found) and changing the family name, repackaging it as an otf, and adding the new file to the application plist. I left the fontName the same.

    The bizarre part is that it still loads with the same font name and shows up under the +fontNamesForFamilyName: response for Myriad Pro.

    0 讨论(0)
提交回复
热议问题