0

Hai i have using already custom font ,But now i try to add font file it wont work properly ,i will try to use angry bird font file to add my application its not working.Remaining font file also not supporting i don't know i am doing correctly r not.My reference links http://refactr.com/blog/2012/09/ios-tips-custom-fonts/ https://wiki.appcelerator.org/display/guides/Custom+Fonts#CustomFonts-Sampleapp

Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
Balaji
  • 17
  • 1
  • 2

2 Answers2

1

Custom Fonts are easy as pie in iOS. If you use the Approach from http://refactr.com/blog/2012/09/ios-tips-custom-fonts/ like in your question you are read to go. But there is a really great difference in the font family name that you get from the font explorer from OSX and the actual family name in iOS.

You can get the family name via [UIFont familyNames] in your code. Now you have a Family name. Log this to your console via NSLog and then simply use [UIFont fontNamesForFamilyName:@"the_family_name_of_the_font"].

More information for familyNames and fontNamesForFamilyName:

mariusLAN
  • 1,195
  • 1
  • 12
  • 26
  • +1 in my experience embedding them is quite easy. As said you just have to take into account that filename != family name != font name and you have to make sure you use the correct names later – Daij-Djan Jun 01 '13 at 10:24
1

Here are the steps transcribed:

1) Add your custom font files into your project using Xcode as a resource
2) Add a key to your Info.plist file called Fonts provided by application.
3) Make this key an array
4) For each font you have, enter the full name of your font file (including the extension) as items to the Fonts provided by application array
5) Save Info.plist
Now in your application you can simply call

 [myLabel setFont:[UIFont fontWithName:@"Swis721 Lt BT" size:[lbl minimumFontSize]]]; //use font name not file name.
SAMIR RATHOD
  • 3,512
  • 1
  • 20
  • 45