Common Mistakes With Adding Custom Fonts to Your iOS App

Last updated: August 14 2015

Custom fonts can make all the difference in the world when you’re trying to convey a specific user experience. Luckily, it’s pretty easy to add your own fonts in your iOS app but there are some common pitfalls to watch out for.

Let’s walk through how to add custom fonts to your iOS application and I’ll highlight the common mistakes as we go.


ARTICLE CONTENTS
1. Include your fonts in your XCode project
2. Make sure that they’re included in the target
3. Double check that your fonts are included as Resources in your bundle
4. Include your iOS custom fonts in your application plist
5. Find the name of the font
6. Use UIFont and specify the name of the font


 

Make sure you have a proper font license for mobile/app embedding.
A commenter in the discussion below, Stephen, brought up this valid point. The license can usually be found with your font download or on the site where you bought/downloaded it. Taking a minute to check it ensures you won’t get into legal trouble down the road.

Step 1: Include your fonts in your XCode project

Most commonly, you’ll have a TTF or OTF font that you’ll want to use with all of your UILabels or UITextViews in your app. Well, the first step is to include these fonts into your XCode project.

I commonly keep all of my app resources such as images or fonts in their own directory called “Resources”. I find that this helps me stay organized as projects get much more complex and there are a lot of files. Whatever your case may be, either drag and drop your font file(s) into your XCode file tree or right click and “Add Files To…” to select your fonts.

Adding Custom Fonts to XCode Dialog Box
Make sure that the target you want to use your font in is checked!

Step 2: Make sure that they’re included in the target

The next thing to do is to make sure that they’re resources and included in your build target that you want to use the fonts in.

Checking That Your Custom Font Is Included In Your Target
Make sure that the target you want to use your font in is checked under “Target Membership”

Step 3: Double check that your fonts are included as Resources in your bundle

This should not be a problem but sometimes when you’re having trouble getting your font face to show up, this can be a source of headache so let’s double check now to rule it out as a potential pitfall.

this can be a source of headache

Go to your project Build Phases pane by highlighting the XCode project file in your solution explorer and on the right hand side, select “Build Phases”. You’ll see that one of the sections you can expand is “Copy Bundle Resources”. Open that list and make sure that your fonts are included in that list.

Checking That Your iOS Custom Font Is a Resource In The Bundle
Ensure that your fonts are in the “Copy Bundle Resources” list

Step 4: Include your iOS custom fonts in your application plist

The next thing to do is to modify your app’s plist to include these font faces. By default, your plist will be named as Info.plist and will reside in the “Supporting Files” folder if you haven’t moved it.

Open it and add a new row called “Fonts provided by application” which will be an array that you need to add all the filenames of the fonts you want to use. In my case, it was seven of the Quicksand fonts as you can see in the screenshot below. Be careful to include the extension and make sure that you don’t perform any typos here. That’s another common problem, as simple as it may seem.

Adding Your Custom iOS Fonts To Your App Plist
See the above screenshot on the key that you need to add, followed by the filenames of the fonts you want to include in your iOS app

…make sure that you don’t perform any typos here. That’s another common problem

Step 5: Find the name of the font

This is a common pitfall for many people trying to include custom fonts into their iOS app. This was something that eluded me before as well and it’s the fact that when you specify which font you want to use, you’re not specifying the file name but rather, the font name. The tricky part is that the font name may not be what you expect. It could be very different than any of the visible font names that you can see.

So in order to easily find the name of the font that you want to use, you can output something to the console window and see for yourself.

The tricky part is that the font name may not be what you expect

Add this snippet of code to log all the fonts available to your app in the console. Choose either the Swift or Objective-C snippet depending on which language your project uses.

Swift:

Objective-C:

Once you run your app, you’ll get the list of fonts displayed in your console log. Then its just a matter of finding your custom font in the list and getting the font names.

Finding The Font Names For Your Custom Fonts
Logging all fonts and finding the font names for your custom font

In the screenshot above, as you can see the font name I needed was QuicksandDash-Regular. This font name was no where to be found in the font properties or from the OSX font viewer. Remember to get rid of that code snippet after you find the font name that you need!

Step 6: Use UIFont and specify the name of the font

And finally, you can simply display your custom font using UIFont and whatever UILabel or text view you want.

Choose either the Swift or Objective-C snippet depending on which language your project uses.

Swift:

Objective-C:

Sample of Displaying The Custom Font in the iOS Simulator
Sample of using custom fonts in your iOS App!

I hope that this iOS custom fonts tutorial was helpful to you. Let me know in the comments below!

  • Robin

    Thanks, I didn’t see step 2 mentioned on any other tutorial ! Helped a lot. Also, I knew about step 5 but couldn’t remember the code, so thanks for that two !

  • Pablo

    I followed this example(and the rest of the internet) to a T. My .ttf files are being copied to the target resources, I have added the ‘Fonts provided by application’. I even ran your sample code, but when I do, my added font is not included. I don’t see it in the list. I was wondering if you’ve ever seen this hiccup? I’m about to restart and try again.

    • Chris Ching

      Hello Pablo,

      Yes! It’s caused me a lot of headaches before as well, even when you think you know what you’re doing! Does your project have multiple build targets? If so, make sure that the expected info.plist (the one you added “fonts provided by application”) is read by your project. One way to check is to change some settings in the info.plist and see if it takes effect in the app. If so, then you’ll know you’re modifying the proper one.

      Also, when you try to use your font, it’s important to get the proper font name and you can follow the technique in my post to find the proper name to use. Usually those are the hiccups for me.

      Hope that helps!

  • http://www.redixbit.com Bhavin

    Chris..Thanks…Your post really helpful for me.

  • Khang Hoang

    Great tutorial, it works like charm.

  • Ofir Malachi

    Thank You !!
    Perfect.

  • Shashikant

    Thanks a lot. because i was missing step-3 , no one cal telling about that, except you. so thanks a lot.

  • Violet

    Thanks for such a clear guide! Just the right amount of detail.

  • Sergii

    Cool. Very clear totorial!

  • Shan Shan

    Can i do it on windows or pc?

    • Chris Ching

      Hello Shan Shan, you can use something called Xamarin or PhoneApp/Appcelerator to build iOS apps on Windows, but XCode won’t run on Windows unfortunately!

  • http://www.coreyhaines.com corey haines

    Thanks a lot for this. Worked the first time!

  • IdolEnvy

    After find many solution. Step 5 of yours help me in the end.
    Sometime file name cannot use in code but have to find from application support font.
    Thank you very much.

  • http://www.knightling.com Noah

    This is a great tutorial. I looked through the iOS documentation for a while and could not find any of this information. Thank you for explaining this concept in a highly accessible manner.

    • Chris Ching

      Thank you for reading Noah. I really appreciate it!

  • Eloy

    Very useful! Added to my bookmarks!
    Thanks

    • Chris Ching

      Thank you for reading!

  • Bagu

    Thanks a lot, great tutorial. Very helpful!

    • Chris Ching

      Thank you, i really appreciate the comment ๐Ÿ™‚

  • http://pdjapps.com Pavel Doichev

    Thanks, good man! Didn’t realize the font name isn’t the file name… should have known that I suppose.

    • Chris Ching

      Yeah, this caused me a lot of wasted time when i first ran into it too!

  • Ankur

    Thank You so much , quite straight forward and really easy to follow.

    • Chris Ching

      Thanks for reading, Ankur!

  • Juan

    Step 5 was my problem. Thanks for making this work for me ๐Ÿ™‚

    • Chris Ching

      I’m glad that it helped Juan! Thanks for taking the time to comment. I really appreciate it!

  • Rene

    Hi Chris Ching,
    I’m new to xcode… followed all your steps, but where do I actually enter the code in step 6? When I use the storyboard for creating labels, I can’t find the code that describes the characteristics of that label… many thanks!

    • Chris Ching

      Hey Rene, i had to look this one up because i haven’t specified custom fonts through storyboards before. From what I read, there’s no supported way through Interface Builder but you can use the user defined custom key/value attributes to do so (http://bit.ly/17cbnpE). Hope that helps!

  • Imam

    Great, i never knew i was missing familyname and fontname difference

    • Chris Ching

      It stumped me when i didn’t know about it too! Thanks for reading!

  • Andy

    Brilliant, thanks.

    • Chris Ching

      Thanks for reading, Andy!

  • http://jayproductions.se Johannes

    Awesome! Thanks!

    • Chris Ching

      Thanks for reading, Johannes!

  • Steve Nguyen

    Thank a lot! step5 is helpfull for me ^^

    • Chris Ching

      Thanks for reading, Steve and i’m glad it helped!

  • srinu

    Really nice tutorial Chiris keep going with this type of tutorials

    • Chris Ching

      Definitely will, thanks Srinu!

  • http://www.pbrady.org Paul Brady

    Thank you Chris! Thorough, yet to-the-point. Nicely done!

    • Chris Ching

      Thanks for the great feedback, Paul! ๐Ÿ™‚

  • shahid

    thanks for this detail artical its very help full. i just follow the steps and complete my task
    thanks alot

    • Chris Ching

      Thanks for reading, Shahid!

  • Abhishek

    Awesome it worked for me..Kuddos..!

  • Nice work

    i missed step 4.

  • http://www.andreasoverland.no/ Andreas ร˜verland

    Very nice, short and concise writeup. Great help. Thanks!

    • http://codewithchris.com/ Chris Ching

      Thanks for reading Andreas! ๐Ÿ™‚

  • http://stephencoles.org Stephen Coles

    If this is about common mistakes, Step 1 should be “Make sure you have a proper font license for mobile/app embedding.” Neutraface, for instance, cannot be embedded without a special license. This stuff is commonly overlooked but can get you in legal trouble, so it’s just as important as the technical details.

    • http://codewithchris.com/ Chris Ching

      Thanks Stephen! oh the irony! I’m going to update this article in the coming week with this and I’ll follow up.

  • Darren Leak

    This is an awesome tutorial Chris! tbh I haven’t used many of your tutorials but when I do they are awesome! Keep up the good work.

    • http://codewithchris.com/ Chris Ching

      Thanks for reading!

  • http://www.isaced.com/ isaced

    Thank You !!

    • http://codewithchris.com/ Chris Ching

      Thanks isaced!

  • http://overbythere.co.uk/ Dan Clarke

    Thanks for this, just used to include a font in my app, nice clear instructions, will bookmark! Thanks!

    • http://codewithchris.com/ Chris Ching

      Thanks for reading Dan and I’m glad it helped!

  • John Erck

    Thank you. Great way to get started with custom fonts.

    • http://codewithchris.com/ Chris Ching

      Glad it helped ๐Ÿ™‚ Thanks for reading John!

  • kart

    this is the the best article for the font confusion..thank you..!

    • http://codewithchris.com/ Chris Ching

      Thanks for reading Kart!

  • Etay
    • http://codewithchris.com/ Chris Ching

      Thanks Etay ๐Ÿ™‚

  • http://www.rahuljiresal.com Rahul Jiresal

    Hi Chris! I keep coming back to this post because I keep forgetting all the steps I need to do! Thanks for the post, it was really helpful!

    • http://codewithchris.com/ Chris Ching

      Then the article is working as expected! ๐Ÿ™‚ Thanks for using it Rahul!

  • Andrรฉs Portillo

    GREAT ARTICLE DUDE, THANKS FOR TAKING THE TIME

    • http://codewithchris.com/ Chris Ching

      Thanks Andrรฉs ๐Ÿ™‚

  • Vaishali Modi

    Thanks ! nice one… ๐Ÿ™‚

  • Rรฉmy Tauziac

    Cool, prevents me to look inside huge and unhandy iOS doc.
    It works well with a recursive loop fetching children and setting font each view at a time.

  • http://isafad.tumblr.com Sadaoui Abderrahim

    I love you man!
    I looked all around the web and not even a single mention of your second mistake!
    You are a life saver, kudos!

  • ever21

    Chris, I love you.

  • http://imgnry.com Fille

    Awesome tutorial! Thanks!

  • F.Alonso123

    Thanks for all the tutorials, Chris! One would think that the internet is full of helpful tutorials, but in reality only about 0.01% are properly comprehendible to first time developers such as myself. Your resources make up most of that 0.01%! I honestly struggled to understand programming before I stumbled upon your website. This is a comprehensive, easy to understand resource which is a must for any first-timer! I just can’t imagine life before your tutorials. Your explanations are so well thought-out, and premeditated. They make any first time developer feel on top of things. Keep up the outstanding work!

    • http://codewithchris.com/ Chris Ching

      Thank you for the kind words! I really appreciate it and thank you for reading ๐Ÿ™‚

  • Chris Chuter

    Good article! Even iOS pro’s will find this useful. Also, a good source for open source fonts is https://www.google.com/fonts

    • http://jaymayu.com/ Jay Mayu

      Open Sans is one of my favs.

  • Jambal

    Great article. Thanks for sharing the information.

  • Kuba Henryk Ratajczak

    Thanks for this clear and coherent list. Every time I swap a font on iOS and something goes wrong, I double check on your list and most often find that I’ve missed a thing or two.

  • http://imgnry.com Fille

    This time I followed this guide it didnt show up in the iteration over the fonts, but when I removed the file from “Copy bundle resources” and added it again, then it showed up. Just a tip for peeps out there.

  • Javi

    Thanks!

  • RedWagon

    When I add a bunch of fonts to the application memory becomes an issue. Seems like over 100 fonts the issue appears. Any way to dynamically load the fonts as needed instead of placing them each in the plist? Seems like they are all loaded at the start incase needed causing a huge memory suck.

  • http://richarmstrong.co.za Richard Armstrong

    Super duper – thank you

  • http://www.rededits.com Robert Del Valle

    Will this let me use my font across other apps? like Copy and Pasting into a text message or comment field on instagram? an App called Better Font does this and I can’t seem to make it work.

  • Falemar

    Great tutorial! Here’s the code for listing the available fonts in the log converted for Swift:

    for family: AnyObject in UIFont.familyNames() {

    println(“(family)”)

    for font: AnyObject in UIFont.fontNamesForFamilyName(family as NSString) {

    println(” (font)”)

    }

    }

    Just thought I’d share it since I converted it.

    • Alex Navarro

      Hey Falemar.. Thanks for your code snippet ๐Ÿ™‚
      Im having difficulties in adding my custom font .. i dragged and dropped it and it is found in the list of custom fonts but when i run the app the font isn’t changed.. any ideas?

    • cihadturhan

      Oh yeah. That’s what I’m looking for. I’m starter to Swift and trying to convert the code to swift but second loop gives me error. After seeing your post I understood where I was wrong.

  • http://www.tienny.com/ Tienny The

    Chris, thank you. Why does โ€œFonts provided by applicationโ€ change into รœIAppFonts”? And I type in the last UILabel coding into my ViewController.m, but why it doesn’t show the รผsing Custom Fonts”? Please guide me. Thank you

  • Anita Agrawal

    Thanks for this tutorial.

  • Guest

    hi! can i use these fonts on ios7 http://www.google.com/fonts/specimen/Hind ? if not how should i know if fonts are compatible with ios7 or not? hint: im not a programmer ๐Ÿ™‚

  • http://pokono.me/ Ivan Carosati

    Awesome.
    The snippet to list all the fonts is very useful!
    Thanks for sharing.

  • Supertecnoboff

    Superb tutorial Chris. You are simply a legend! I can’t thank you enough. Just out of interest, do you have any Sprite Kit tutorials, such as how to constantly move objects in a for loop and collision detection??? Thanks, Dan.

  • Adrian Edwards

    Thank you for this tutorial! it was very useful!

  • Ford Davis

    Has anyone else tried adding their custom font to font book and using the font from the interface builder? I added the font to both the app and fontbook and it seems to be working well

  • Scott Olson

    Step 5 – I always surround this with an ifdef DEBUG and put it in the AppDelegate’s didFinishLaunchingWithOptions method.

  • jayproductions

    Great post! Thanks alot!

  • Shane Rogers

    In 60 seconds I found out everything I needed to know about how to implement & manage custom fonts. Thanks for this

  • shivam

    Its good post…… but any idea how many font add in one app?

  • stationstops

    Step 6a: UIFont initializer failover for Swift 1.1:

    private let heinemannFont = UIFont(name: “HeinemannRomanSpecial-Rm”, size: 18.0) ?? UIFont.systemFontOfSize(18.0)

  • Salar N (Dr Bongo)

    Chris! Number 5 was what had gotten me. The actual font name was different than the file name. Thanks for this great post! (fyi you can check the file name by double clicking it in Finder window and the name displays in the navigation bar of the opened window.)

  • Rajesh Pardeshi

    Nice tutorial….. Really helps keep posting… (y)

  • adamgroom

    Cheers ๐Ÿ™‚

  • http://www.meteorfury.com/ Meteor Fury

    Exactly what I needed. Thank you!

  • Filipe Alvarenga

    Thanks for this post Chris! I’m from Brazil, and here is 2:00 AM. After 2 hours of headache I solve my issue with the snnipet of the step 5 :D.

  • Fabio Nakane

    Hey Chris, nice tutorial as usual.
    But i have a problem that i can’t solve. If i add a custom font and i set two diferents sizes, for example wAnyhAny = 10 and wRegularhRegular = 20, the custom fonts just dont show. Instead it shows a system font. It seams its a xcode bug. Any workaround for this?
    Thanks and nice job.

  • ar

    thank you very much !!

  • Kerry Washington

    Good refresher Chris. Thanks…..I recalled your notes and found the problem within seconds.

  • Linus G.

    cool, thanks a lot ๐Ÿ™‚

  • Jona Christopher Sahnwaldt

    Thanks! Nice write-up. Very useful code snippets. Worked like a charm.

  • Benny Chew

    Thanks for your article, very helpful! I got custom fonts to work in Xcode 6. ๐Ÿ™‚

  • prince

    this is what i am looking for.. You are awesome… ๐Ÿ™‚ you make my day..:)

  • Eugene Yee

    Lol, i’m always missing one of these. Nice guide—it really saves me the trouble of having to think.

  • Nicholas Reeder

    Seriously…Thank you. I’m with Eugene…I’m always missing one of these

  • Gaurav Bhati

    Thank you so much. The build phases thing was missing for me

  • http://www.habdas.org/ Josh Habdas

    That little script to output the name of the fonts in the app. Genius! This post was both well-written and a pleasure to read. Helped me get a custom font set-up in a React Native app I’m working on. A++

  • alino91

    /*
    In Swift:
    Print the names of all fonts available for this app.
    */
    class func printAllFontNames() {
    for fontFamilyName: String in UIFont.familyNames() as! [String] {
    println(fontFamilyName)
    for fontName: String in UIFont.fontNamesForFamilyName(fontFamilyName) as! [String] {
    println(“t(fontName)”)
    }
    }
    }

  • Frank Garcia

    @CodeWithChris:disqus looks like you need to update the name for the plist key. It should be “UIAppFonts”. Aside from that, nice tutorial. Thanks.

  • omkarjadhav

    Swift Code To Get The List Of Fonts :

    var fontFamilies = UIFont.familyNames()

    for (var i:Int = 0; i < fontFamilies.count; i++) {

    var fontFamily: NSString = fontFamilies[i] as! NSString

    var fontNames: NSArray = UIFont.fontNamesForFamilyName(fontFamilies[i] as! String) as NSArray

    println("Family:(fontFamily)")

    println("nName:(fontNames)")

    }

    • Gabo Lugo

      Thank you so much! ๐Ÿ™‚

  • orthorim

    Very nice tutorial thanks. I have to look this up every time because I simply can’t believe it’s that complicated. But… it is.. so there we go ๐Ÿ˜‰

    Especially that font names and font filenames are different. That’s bizarre. You’d think the people coming up with these could just, you know, use the font name as filename too. But no. They sometimes do, sometimes not.

  • NN

    Coolio Thank you!

  • Manish Kumar

    Thanks man.. Grt tutorial ๐Ÿ™‚

  • Supertecnoboff

    Superb tutorial thanks a lot Chris! Two things to point out though:

    1) You need to remember to add the font to all the different targets in your app (not just the main app). Otherwise you won;t be able to use it in extensions/widgets/etc…
    2) You can find out the actual font names by using Font Book, you don’t have to use the code snippet and go through the list of names.

    • http://codewithchris.com/ Chris Ching

      Thanks for the pointers and thanks for reading!!

    • blwinters

      We can also find the font name by selecting the font file in Finder, pressing Command-I for info, and see it in the Full Name property.

  • Adam Farah

    In addition to what Supertechnobuff said, you have to look for the Postscript name in Font book.

  • Potsky Mac

    Hi ! Thank you for this tutorial, I have followed it but something is missing… When you update a TTF file (to add more awesome icons for example), it seems genuine devices do not update the font file on the device. And then some icons are missing. Does somebody know how to force iOS to update the font file ?

  • Ben Rose

    Excellent tutorial, thanks for your efforts.

  • blwinters

    Thanks a bunch. “Target membership” was the issue for me.

  • George Marchant

    I tried these steps and ran into issues. I could not get the font family to show up at all. It’s possible though that my font file is bad or incompatible (its a .ttf). But that’s not my comment right now. I want to know if anyone has seen issues with Xcode? I removed my font and all the entries in the info.plist file. But now, interface builder shows all my labels and buttons listed as “no font”. When I try to modify them it says the type is “custom” but has “No family” for the family and won’t let me change the family. I created a new project to experiment with and that has the same issue so it looks like something in my installation was hosed. Any thoughts as to how to fix that?

  • George Marchant

    Have you seen this before: I followed all the steps and couldn’t get it see the new font family. My font was being used only programmatically, not in a xib or storyboard file. Creating the font with the correct name was returning nil. I added an empty label with a font from that family to my launch screen and all the sudden it was showing up in my code. It seems like it wasn’t registering the font or recognizing that it needed to be used. Any thoughts on the correct way to fix this issue? An empty/hidden label seems kind of hacky.

    • Tyler Slater

      I had the same issue. Did you figure it out at all?

  • Ahmed Hosny Sayed

    Great tutorial , thanks a lot , but it would be better to use font in code this way ->>>> if let font = UIFont(your custom font) {control.font=font} //This avoids Swift issues of unwrapping an optional , that it may suspect if your custom font already found or not. thanks again for your helpful tutorial.

  • Alonso Lavado

    Very useful! thanks a lot for this tutorial.

  • Gal keidar

    Thanks a LOT Chris!!!
    Great tutorial, really appreciated!

  • SDVZonEarth

    Thanks, Chris. Very useful and well-written.

  • Ali Saeed

    Love how you put this list together. Superb!

  • anubhav jain

    hey thank you very mush

  • Gaz Long

    Great tutorial!

  • Samuel Behrens

    Great tute! Thanks 4 saving headache

  • Pablo

    Great Tutorial ๐Ÿ™‚

  • Devon

    Great tutorial! I just ran into this problem this week and after going through all of these steps and tearing out some hair, I finally found the culprit: my app target was referencing the TEST target’s plist file instead. I had done some rearranging of files in a template project to start this one and apparently Xcode updates the plist property for the app target if it can’t find one. Under your target’s Build Settings > Packaging tab there is a plist attribute that must be correct:

  • Prajna Shetty

    Awesome tutorial. I really love all your tutorials. Thank you so much for sharing ๐Ÿ™‚

  • Dave Kliman

    That was very helpful, indeed. I’m wondering why you wouldn’t recommend this syntax:

    gameOverLabel = SKLabelNode(fontNamed: “LastNinja”)

  • Zachary Boland

    Hello, I downloaded a font I made onto anyfont on my ipod but i wonder how i could use the font in notes or other apps like if it was a keyboard. I couldnt understand the article since you cant code on an unjailbroken device. please help

  • Rob Nash

    Thanks a lot.

  • Mark Moeykens

    Here’s another tip: Your custom font won’t work on your launch screen. When I put a label on there with my custom font it never worked and I was pulling out my hair going through this guide trying to figure out why. Then I discovered it worked on my non-launch screens. Apple doesn’t recommend text on the launch screen.

  • http://www.prettyitgirl.com/ PrettyITGirl.com

    Adding and using custom fonts in iOS development is really a pain in the ass. :3 ughh.

    • Nagendran

      yes pretty

  • Michael McKenna

    That awesome moment when you found a tutorial and you just happeend to be used the exact same font package…