1

I added "kaligraf_latin.ttf" to "Fonts provided by application" in the info.plist

Then I use UIFont *font = [UIFont fontWithName:@"kaligraf_latin" size:17] and font = nil

I tried kaligraf_latin.otf. The result is the same.

Then I tried another font MyriadPro-BoldCond.otf, and font becomes != nil.

Does it mean, that the problem is in the font kaligraf_latin.ttf?

Here is printscreen of info.plist enter image description here

May be the problem is in the name of the font. Because in fontWithName I should use font name, not font file name. How can I get font name from font file?

Paul T.
  • 4,938
  • 7
  • 45
  • 93

3 Answers3

4

Using the following two methods you can check if custom fonts or also the sub fonts are installed

[UIFont familyNames];
[UIFont fontNamesForFamilyName:<font family name>];

hope it will help you a little.

Exploring
  • 925
  • 6
  • 18
0

Use this to list all the font available (include the one you add) and there font name :

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]);
    }
}
Alak
  • 1,329
  • 3
  • 11
  • 18
0

The problem was in the font name It was Kaligraf Latin, not kaligraf_latin I got font name using this website http://www.font2web.com/

Paul T.
  • 4,938
  • 7
  • 45
  • 93