Configuring custom fonts
Register your app as a provider or consumer of systemwide custom fonts.
Overview
In iOS 13 and later, your iOS app can contribute fonts for systemwide use and leverage fonts that other apps install.
When an app attempts the install one or more fonts systemwide, iOS prompts the user for their permission. If the user agrees, the installed fonts become accessible in Settings > General > Fonts. If your app provides installable fonts, include a UI that allows the user to browse those fonts and manage their registration.
You must store installable fonts in the app bundle or deliver them using On-Demand Resources, because the system prohibits an app from installing arbitrary fonts. Provide fonts in the TTF, OTF, or TTC formats or any of their modern variants, and package large font libraries as asset catalogs.
The system limits the number of installed fonts, and it derives that limit from the available system resources. If the user deletes your app, the system automatically removes any of the app’s installed fonts.
To register your app as a provider or consumer of systemwide custom fonts, follow the steps in Add a capability to add the Fonts capability to your app’s target.
[Image]
Select the required privileges
Before your iOS app can install one or more custom fonts or use fonts that other apps provide, you must enable the necessary privileges by performing the following:
Select your project in Xcode’s Project navigator.
Select the iOS app’s target from the Targets list.
Click the Signing & Capabilities tab in the project editor.
Find the Fonts capability.
Select the required privileges using the corresponding checkboxes.
[Image]
Xcode adds the com.apple.developer.user-fonts array to your app’s entitlements file, if not already present, and uses the privileges you enable to populate that array with the corresponding values.
After enabling the required privileges, update your app to perform one or more of the following:
Register fonts systemwide using one of these registration methods:
Remove installed fonts using one of these unregister methods:
Query all installed fonts using CTFontManagerRequestFonts(_:_:)
Listen for font change notifications using kCTFontManagerRegisteredFontsChangedNotification
For more information, see the WWDC session video Font Management and Text Scaling.