macOS App 如何配置自定义字体。具体参考 https://stackoverflow.com/a/57412354
- Create a folder named Fonts.
- Add fonts to the
Fonts
folder. UncheckAdd to targets
and checkCopy items if needed
.
- Add
Application fonts resource path
to Info.plist and enterFonts
.
- Go to
Build Phases
and create aNew Copy Files Phase
.
- Set the
Destinations
toResources
andSubpath
toFonts
. Then add your font files to the list.
-
获取字体名称
for family: String in NSFontManager.shared.availableFontFamilies { print("\(family)") for name in NSFontManager.shared.availableMembers(ofFontFamily: family)! { print("== \(name[0])") } }