How to include and use new fonts in iOS app?

ghz 1years ago ⋅ 5646 views

Question

I want to use font "MgOpen Modata" in my iOS App. But I don't see it in the font list in Property inspector.

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


Answer

  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.