skip to Main Content

I’m trying to add a custom font to my app but it doesn’t appear when the app is running:

  1. Added the files to the project

enter image description here

  1. Checked the font is within the Target Membership

enter image description here

  1. Added the fonts to the app plist under the "Fonts provided by application":

enter image description here

  1. Checked the fonts are within the Target/ Build Phases/ Copy Bundle Resources:

enter image description here

  1. Installed the fonts in the Font Book

After that, when I run the app:

for (NSString* family in [UIFont familyNames])
{
    NSLog(@"FONT FAMILY: %@", family);
    
    for (NSString* name in [UIFont fontNamesForFamilyName: family])
    {
        NSLog(@"FONT:  %@", name);
    }
}

All fonts except the JetBrains ones are available. What am I missing?

2

Answers


  1. Chosen as BEST ANSWER

    Found the answer.

    Changed the "Fonts provided by application" key in the .plist file with "UIAppFonts" and the font started to work


  2. This code [UIFont familyNames] searches in the system fonts , while the font you added is a custom one which for sure doesn’t exist inside them ,you can access it through UIFont‘s fontWithName initializer

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search