Adding a custom font to macOS app using Swift

前端 未结 5 2002
梦谈多话
梦谈多话 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:37

    Xcode 12 to add custom fonts you have to exclude extension name from the string provided.

    i.e.

    .font(.custom("your font name", size:xx)) // works every time

    .font(.custom("your font name.extension",size:xx)) // always fails

    same is not true with Xcode 11.xx there fontname.extension is working.

提交回复
热议问题