Using fonts in a MonoTouch app

Inspired by Dave Addey's post on using font's in your iOS app - and having a general love of the Google Web Font library - I thought "so, how do I do this in MonoTouch?"

Turn out, using a custom font in MonoTouch is really, really easy.

  • First, go and grab a font or 2 from somewhere. I used the Google Web Fonts, which are free to use, but you DO have to show their license in your app. Not a big deal.
  • Drop the .TTF files into a location in your project - I put them in the root, but you can put them in /fonts/ if you want, too. Add them into the project like any other file, and set their Build Action to be Bundled Resource
  • Open info.plist, and under advanced, add a new key called Fonts provided by application. This is an array. Make a new array element for each one of the font's you use. I suspect if you put them into folders, you need to put in fonts/MyFont.ttf there.

  • Use the font!

myLabel.Font = UIFont.FromName("Skranji-Bold", 20f);

Turns out it's trivial to use any of the lovely fonts that are available. Just be a bit careful with licensing, and above all, make sure your app looks great - too many random fonts just make a mess.

And don't use Comic Sans, unless you are writing a comic app. That'd just be wrong.

(I found Dave's post via the excellent iOS Dev Weekly, produced by another Dave - Dave Verwer. Sign up - it's worth it.)

Nic Wise

Nic Wise

Auckland, NZ