Search code examples
macoscocoafontscore-text

MacOS: How can I activate fonts programmatically, systemwide?


I'm trying to make something that behaves very similarly to a font manager, but I simply can't find any documentation on how I can, for example, add an OpenType font to the list NSFontManager provides. I see even Font Book shows fonts activated through a font manager app, so I want to understand what's happening under the hood. What libraries are being called?

Thank you!


Solution

  • It took me quite some time, but here's the way to go.

    CTFontManagerRegisterFontURLs does exactly what I was looking for on macOS. Also, session 227 from 2019's WWDC has more info on it, albeit focused on iOS.