Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 5 Custom Fonts

Tags:

ios

uifont

I have added custom fonts to my resources and bundle resources and also to my plist. Everything works fine in iOS5 but when I try the iOS 4.3 simulator, none of the custom fonts work.

Any idea why?

Here is a sample of how I am accessing the fonts:

lblWait.font = [UIFont fontWithName:@"AvenirNextLTPro-Medium" size:22];
like image 852
Jesse Avatar asked Feb 14 '12 17:02

Jesse


2 Answers

The names in that NSString in the first parameter have to be spot on and what's weird is that it's not consistent. It depends on if it's a .otf file or a .ttf file. I've found that a .otf file uses the postscript name and .ttf uses the full name. A good way to find these is to open the font file in Font Book and find it's information (cmd-I). I would try either to see what sticks.

enter image description here

Edit:

It's not always that the TTF uses the FULLNAME and the OTF uses the POSTSCRIPT name, you should try both.

like image 200
SushiGrass Jacob Avatar answered Oct 26 '22 18:10

SushiGrass Jacob


Many times the source of this problem is that the font file is added to the project but not to the target.

Click on the font and make sure it's ticked in "Target Membership", in the right hand column.

like image 30
Eric Avatar answered Oct 26 '22 19:10

Eric