Wednesday, March 29, 2017

Custom Fonts on iOS

Curtis Clifton:

There’s just one more configuration step before we can start using our custom fonts. We have to tell iOS about the fonts by editing the app’s Info.plist.

Add the UIAppFonts key with an array of strings as the value. Each string should be the relative path to a custom font file in your app bundle.

[…]

The name of the font is not necessarily the font’s file name. Instead, it’s the font’s PostScript name. You can find the PostScript name by double clicking the font file to install it on your Mac. Then launch the FontBook app, find the font, and look at its info pane as shown below.

Update (2017-03-29): FontBlaster (via Arthur A. Sabintsev):

Say goodbye to importing custom fonts via property lists as FontBlaster automatically imports and loads all fonts in your app’s NSBundles with one line of code.

Previously: Installing Fonts on iOS.

Update (2017-04-05): Curt Clifton:

With this in place, you can delete the UIAppFonts key and value from your Info.plist. Now whenever you want to change the fonts embedded in your app, it’s as simple as changing the files in the Fonts group of your Xcode project and recompiling.

Update (2020-01-10): Quentin Zervaas:

[It] looks like Xcode now auto-populates the UIAppFonts if you use a custom font in your storyboards. Not sure when this started.

Comments RSS · Twitter

Leave a Comment