Adding a custom font to macOS app using Swift

前端 未结 5 2034
梦谈多话
梦谈多话 2021-02-20 10:46

I followed a bunch of tutorials but it doesn’t work: I simply want to add a custom font to a macOS app.

What I tried essentially:

  1. Added the .
5条回答
  •  名媛妹妹
    2021-02-20 11:32

    I had a hard time getting this to work based on the previous answers, so I decided to write up an answer myself. This is based on previous answers by @ixany and @rob-keniger.

    1. Create a folder named Fonts

    1. Add fonts to the Fonts folder. Uncheck Add to targets and check Copy items if needed.

    1. Add Application fonts resource path to Info.plist and enter Fonts.

    1. Go to Build Phases and create a New Copy Files Phase.

    1. Set the Destinations to Resources and Subpath to Fonts. Then add your font files to the list.

提交回复
热议问题