Custom fonts in IOS4

I was following the instructions on this website but I didn’t manage to get the custom fonts working. After trying for a while I found out the problem.

Here’s the updated details of how to use custom fonts in iPhone. This is only available for SDK 4.0 and above.

  1. Add your custom font files into your project using XCode as resources.
  2. Add a key to your info.plist file called “Fonts provided by application” ( Used to be called UIAppFonts).
  3. It’s an array key.
  4. For each font you have, enter the full name of your font file (including the extension).
  5. Save info.plist.
  6. Now in your application you can simply call [UIFont fontWithName:@"CustomFontName" size:12] to get the custom font to use with your UILabels and UITextView.
  7. “CustomFontName” is not the font’s file name. It is the font name registered in the operating system. For example, if you try to use “Bauhaus Medium BT.ttf”, the “CustomFontName” should be “Bauhaus Md BT”, no extension “.ttf” is needed. You need to install the font in your system to find out what name it is. Some fonts have 2 names, you may need FontForge to find out and try which one works.
  8. So far I found out that both ttf and otf format work out of the box. I haven’t tested other font formats yet.

*Points 1-6 credit to http://blog.beefyapps.com/

11 thoughts on “Custom fonts in IOS4

  1. Pingback: czcionki na iOS

  2. I am doing everything you mentioned and it is not working, but i think there is something I am missing, what do yo mean when you say “using XCode as resources” in step 1 above

  3. Thank you so much, your blog is the only one on the internet that highlighted that font names can differ from the file name. You helped solve my three hours problem!

    Thanks again

  4. !!! Yes !!! Thank you this solved my problem. Make sure you are using the correct font name:

    “CustomFontName” is not the font’s file name. It is the font name registered in the operating system. For example, if you try to use “Bauhaus Medium BT.ttf”, the “CustomFontName” should be “Bauhaus Md BT”, no extension “.ttf” is needed. You need to install the font in your system to find out what name it is. Some fonts have 2 names, you may need FontForge to find out and try which one works.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

For spam filtering purposes, please copy the number 4702 to the field below: