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?

7
  • you should use font name not file name Commented Mar 11, 2013 at 11:52
  • you have to add the custom font file into your application..... Commented Mar 11, 2013 at 11:52
  • Refer my following link, stackoverflow.com/questions/14355985/… Hope it will helps you.... Commented Mar 11, 2013 at 11:53
  • How can I get font name from font file? Commented Mar 11, 2013 at 12:04
  • 1
    Add this font to your Font Book (OS X application), select this font in the list, and press Command+I, you will see font information, check if you use in application correct PostScript name. Commented Mar 11, 2013 at 12:05

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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]); } } 

Comments

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/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.