I was following the instructions on this website but I didn’t manage to get the custom fonts working. After trying for a while I found out the problem.
Here’s the updated details of how to use custom fonts in iPhone. This is only available for SDK 4.0 and above.
- Add your custom font files into your project using XCode as resources.
- Add a key to your info.plist file called “Fonts provided by application” ( Used to be called UIAppFonts).
- It’s an array key.
- For each font you have, enter the full name of your font file (including the extension).
- Save info.plist.
- Now in your application you can simply call [UIFont fontWithName:@"CustomFontName" size:12] to get the custom font to use with your UILabels and UITextView.
- “CustomFontName” is not the font’s file name. It is the font name registered in the operating system. For example, if you try to use “Bauhaus Medium BT.ttf”, the “CustomFontName” should be “Bauhaus Md BT”, no extension “.ttf” is needed. You need to install the font in your system to find out what name it is. Some fonts have 2 names, you may need FontForge to find out and try which one works.
- So far I found out that both ttf and otf format work out of the box. I haven’t tested other font formats yet.
*Points 1-6 credit to http://blog.beefyapps.com/
I can’t get this to work in IOS 3.2.5, IOS 4.2
It works. thx!!
Step7 instruction brought great help to me for progress!
Thanks for the post. Really saved my time.
Pingback: czcionki na iOS
I am doing everything you mentioned and it is not working, but i think there is something I am missing, what do yo mean when you say “using XCode as resources” in step 1 above
@Farah Haddad, It’s normal procedure of adding an existing file into a project.
This a very helpful article thanks you, worked for me
I couldn’t get this method to work for custom arabic fonts. it works for english fonts but doesn’t work for arabic
iOS just uses default arabic font
Thank you so much, your blog is the only one on the internet that highlighted that font names can differ from the file name. You helped solve my three hours problem!
Thanks again
!!! Yes !!! Thank you this solved my problem. Make sure you are using the correct font name:
“CustomFontName” is not the font’s file name. It is the font name registered in the operating system. For example, if you try to use “Bauhaus Medium BT.ttf”, the “CustomFontName” should be “Bauhaus Md BT”, no extension “.ttf” is needed. You need to install the font in your system to find out what name it is. Some fonts have 2 names, you may need FontForge to find out and try which one works.
Does anyone know how to add facefont in iOS using CSS Style?