2

In my iPhone app,

I have included two custom fonts and by referring this steps by stackoverflow questions....

How to include and use new fonts in iPhone SDK?

And Coded ....

 [lbl setFont:[UIFont fontWithName:@"glyphish.ttf" size:[lbl minimumFontSize]]];

I am building this app for Base SDK 5.0

The answer is,

[lbl setFont:[UIFont fontWithName:@"glyphish" size:[lbl minimumFontSize]]];

Thanks to all.

Community
  • 1
  • 1
Arpit B Parekh
  • 1,932
  • 5
  • 36
  • 57

8 Answers8

8

First find that font in your available fonts list:

NSLog(@"fonts: %@", [UIFont familyNames]);

Then find and input the appropriate name.

Eugene
  • 10,006
  • 4
  • 37
  • 55
4

You have passed a filename (glyphish.ttf) instead of the actual font name. Most likely, the font name is Glyphish, but you need to query it somehow: either using the Mac's "Font Book.app" or via code: first, you need to query the family names via [UIFont familyNames]. Then, use [UIFont fontNamesForFamilyName:] to get the actual font names to load. For example, if your font contains a bold variant its family name would be Glyphish but font name would likely be Glyphish-Bold.

DarkDust
  • 90,870
  • 19
  • 190
  • 224
3

You should correct name. It should not contain ttf in glyphish.ttf. For exact reference refer following image for that. Dakota is font name in my case.

enter image description here

Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
2

The font name is not the name of the file. Thus glyphish.ttf is not a valid font name.

rckoenes
  • 69,092
  • 8
  • 134
  • 166
1

You need to check the font name it may be different then the font file name...try this link

Go to your application build phases and add your font files in copy bundle resources

amar
  • 4,285
  • 8
  • 40
  • 52
1

you have to use the font name, not the filename. you can check the name by opening the font file on yout mac.

calimarkus
  • 9,955
  • 2
  • 28
  • 48
1

Most probably the actual font name to be put in the app might be something else than glyphish.ttf .. i suggest opening font book and there checking the name of the font .and using that.

Shubhank
  • 21,721
  • 8
  • 65
  • 83
0

Double click on the font file to open it in font book. Now see the name of the font on the top bar. Use this name in your code.

gaurish.salunke
  • 1,059
  • 10
  • 18