How to use custom fonts in a mac application?

前端 未结 6 1403
天涯浪人
天涯浪人 2020-12-16 18:35

I try to use custom fonts in my swift app, but they don\'t load.

I copy the fonts.ttf in my resources folder, and I added the names in Info.plist under \"Fonts pro

6条回答
  •  北海茫月
    2020-12-16 19:03

    First add the desired font you want to embed to your OSX app to your project:

    enter image description here

    Then click project > Info, then click the plus sign and add a new key "Application fonts resource path" and type the name of your fonts there creating an array of strings:

    enter image description here

    Now you can select custom font and the name of the font will show there, you still need to use the Font Book to make it available inside Xcode.

    enter image description here

提交回复
热议问题