swiftfontscore-textuifont

How to get an array of all installed fonts on iOS


iOS 16 allows to install custom fonts. They are listed in SettingsGeneralFonts.

I too want to display a list of the installed fonts in my app.

I did try using UIFont.familyNames as well as CTFontManagerCopyAvailableFontFamilyNames() but both return what seems to me like a list of fonts that are shipped with iOS itself, without the custom installed ones.

In other words: I do have installed custom fonts that show up in the Settings.app but did not appear when calling one of the mentioned functions.

How can I get a list of all installed fonts on iOS?


Solution

  • I found out two ways to access custom fonts.

    Accessing all fonts on iOS is possible when using UIFontPickerViewController. The downside of this approach is that the picker itself is barely customizable.

    Alternatively if you do know the postscript names of the required custom fonts you can request them directly using CTFontManagerRequestFonts(_:_:)

    Please note that you’ll also need to add the Font entitlement to your Xcode project as described here.