iOS Font Name Problem

I wanted to followup my previous post about iOS font positioning with something else I came across yesterday.

While adding a custom font to a new app there was a problem with the font not appearing in the simulator or on device. It had been added correctly to the .plist, included in the project and i’d checked Font Book to make sure I was using the correct name in the ‘[UIFont fontWithName:name size:size]’ command. Even though everything seemed correct the font just would not show.

I decided to find out what fonts were installed (to check it was there) by adding the following code to my app delegate:

for (NSString *familyName in [UIFont familyNames])
    NSLog(@"FAMILY: %@", familyName);
    for(NSString *fontName in [UIFont fontNamesForFamilyName:familyName])
        NSLog(@"  %@", fontName);

This outputs into the debug window the name of all the fonts included in the app, including the name of my custom font. As it turns out from the debug window the font wasn’t called ‘Frutiger CE 65 Bold’ as was reported in Font Book but was actually called  ‘FrutigerCE-Bold’ (at least as far as iOS is concerned) as such I changed the code to the following and the font worked perfectly!

[UIFont fontWithName:@"FrutigerCE-Bold" size:16.0f]

So if you add a custom font and it doesn’t seem to work then i’d recommend the above method to solve it. If anybody else knows why this is the case (I didn’t have time to look in it) please leave a comment.



  1. #1 by GoldenJoe on September 30, 2012 - 8:35 pm

    Awesome. Very useful piece of code. Thanks!

  2. #2 by Pirkka Esko on October 16, 2012 - 1:18 pm

    nice one, helped me out!

(will not be published)