How to include and use new fonts in iPhone SDK?

meetpd picture meetpd · Feb 11, 2011 · Viewed 64.1k times · Source

I want to use font "MgOpen Modata" in my iphone App. But I dont see it in the font list in Property inspector.

How do I include that font so that I can use it?

Answer

Jilouc picture Jilouc · Feb 11, 2011
  1. Add the font files to your resource files
  2. Edit your Info.plist: Add a new entry with the key Fonts provided by application.
  3. For each of your files, add the file name to this array

On the example below, I've added the font "DejaVu Sans Mono":

Info.plist: adding custom fonts

In your application you can the use [UIFont fontWithName:@"DejaVuSansMono-Bold" size:14.f].

Or if you want to use it in html/css, just use font-family:DejaVu Sans Mono;

Note: this is available in iOS 3.2 and later.