OhDoh
OhDoh

Reputation: 433

Custom font is not added to project

I have the same issue as described here

I have a font called ANTIQUAA.TTF. This font is added to Supporting Files of the project. In my app plist I have entry Fonts provided by application and ANTIQUAA.TTF is added there.

I can't use this font in the app. When I run this method I can't see the font.

 NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
    NSArray *fontNames;
    NSInteger indFamily, indFont;
    for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
    {
        NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
        fontNames = [[NSArray alloc] initWithArray:
                     [UIFont fontNamesForFamilyName:
                      [familyNames objectAtIndex:indFamily]]];
        for (indFont=0; indFont<[fontNames count]; ++indFont)
        {
            NSLog(@"    Font name: %@", [fontNames objectAtIndex:indFont]);
        }
        [fontNames release];
    }
    [familyNames release];

What am I missing ?

Upvotes: 0

Views: 1367

Answers (2)

Floris497
Floris497

Reputation: 1406

push the add button in "Copy Bundle Resources" and click on the font files.

enter image description here

Upvotes: 4

Jeshua Lacock
Jeshua Lacock

Reputation: 6658

Looks like you just need to add the font resource to your .plist file.

Open your plist as text and paste:

<key>UIAppFonts</key>
<array>
        <string>ANTIQUAA.TTF</string>
</array>

Upvotes: 2

Related Questions