Home > iOS SDK > Custom fonts since iPhone OS 3.2

Custom fonts since iPhone OS 3.2

Finally iPhone OS 3.2 supports custom fonts. Here is a short summary what you have to do..

Supported font formats are ..

  • TrueType-flavoured OpenType (extension .ttf) and
  • PostScript-flavoured OpenType (extension .otf).

Ok what you have to do is simple ..

  1. just add the key UIAppFonts as array to your Info.plist
  2. add the *.ttf or *.otf files to your bundle
  3. insert the filenames as values to your UIAppFonts array
  4. Load the fonts with ..
// use the font name here, not the filename
UIFont *myCustomFont = [UIFont fontWithName:@"AnnabelScript" size:30];

Note: You can also use the fonts in your UIWebViews with font-tags or CSS.

Do you need the sample project?

Just ask me on twitter: @andidol

About these ads
  1. IHSAN KHAN
    August 9, 2010 at 11:47 am

    Thanks man u have saved me alot of my time.really useful

  2. August 13, 2010 at 9:40 am

    Thanks a lot man,I am very tensed from this topic and But from you I solved it very simply
    THanks again man

  3. Sal
    November 20, 2010 at 7:57 pm

    Great tutorial! You also saved me lots of time. A couple of notes if you can’t get this to work (if you follow the tutorial exactly, it will work):
    1) When you’re adding the .ttf or .otf file name to the UIAppFonts make sure you include the full name of the font. If the fonts name is “BubbleFont.ttf” you write “BubbleFont.ttf”
    2) When you write the code to get the font “[UIFont font...]” you have to make sure you EXCLUDE the .ttf or .otf extension. (I stumbled with this a little bit).

    Thanks Andreas! I’ll be following you on twitter.

  4. amy
    July 22, 2011 at 6:37 am

    HI can i have the sample proj? preferrably for ipad. thanks. btw ur twitter username @erazorx is not valid…did you change it? if so what is it? would like to follow u on twitter. thx :D

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: