How to Embed a Custom Font in an Iphone Application

Can I embed a custom font in an iPhone application?

iOS 3.2 and later support this. Straight from the What's New in iPhone OS 3.2 doc:

Custom Font Support

Applications that want to use custom fonts can now include those fonts in their application bundle and register those fonts with the system by including the UIAppFonts key in their Info.plist file. The value of this key is an array of strings identifying the font files in the application’s bundle. When the system sees the key, it loads the specified fonts and makes them available to the application.

Once the fonts have been set in the Info.plist, you can use your custom fonts as any other font in IB or programatically.

There is an ongoing thread on Apple Developer Forums:

https://devforums.apple.com/thread/37824 (login required)

And here's an excellent and simple 3 steps tutorial on how to achieve this (broken link removed)

  1. Add your custom font files into your project using Xcode as a resource
  2. Add a key to your Info.plist file called UIAppFonts.
  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 UIAppFonts array
  5. Save Info.plist
  6. Now in your application you can simply call [UIFont fontWithName:@"CustomFontName" size:12] to get the custom font to use with your UILabels and UITextViews, etc…

Also: Make sure the fonts are in your Copy Bundle Resources.

How do i add in a custom font into my iOS app?

From here you can download the font
http://www.free-fonts.com/heiti-tc-light..
After downloading add the folder(.ttf format) to supporting files in the project.
Then Edit info.Plist like this

Fonts provided by Application take as array

Item 0 as Heiti SC.ttf

now you can set
label.font = [UIFont fontWithName:@"Heiti SC" size:15];

Are custom fonts that I add to my iOS app available to other apps on the device?

No. As the other apps can't access your app's bundle resources, they can't use your custom font.

Since It's not possible to access other app bundle details, there is no document available since now.

But you can learn more about NSBundle here and about Accessing a Bundle's Content here.

How to add custom fonts to an iPhone app?

To add a custom font to your application, you can add them to the XCode project. Then, modify the application-info.plist file. Add the key Fonts provided by application to a new row. Add one item for each font you have added.

It supports both TTF and OpenType fonts. One caveat is that it loads and parses all fonts in the startup of your app, so it will slow down the initial load time.

I believe this is only available in iOS 3.2 or later.

Can I embed a custom font in a bundle and access it from an ios framework?

This is a new method that lets you load fonts dynamically without putting them in your Info.plist: http://www.marco.org/2012/12/21/ios-dynamic-font-loading

Can I embed a custom font in an iPhone application?

iOS 3.2 and later support this. Straight from the What's New in iPhone OS 3.2 doc:

Custom Font Support

Applications that want to use custom fonts can now include those fonts in their application bundle and register those fonts with the system by including the UIAppFonts key in their Info.plist file. The value of this key is an array of strings identifying the font files in the application’s bundle. When the system sees the key, it loads the specified fonts and makes them available to the application.

Once the fonts have been set in the Info.plist, you can use your custom fonts as any other font in IB or programatically.

There is an ongoing thread on Apple Developer Forums:

https://devforums.apple.com/thread/37824 (login required)

And here's an excellent and simple 3 steps tutorial on how to achieve this (broken link removed)

  1. Add your custom font files into your project using Xcode as a resource
  2. Add a key to your Info.plist file called UIAppFonts.
  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 UIAppFonts array
  5. Save Info.plist
  6. Now in your application you can simply call [UIFont fontWithName:@"CustomFontName" size:12] to get the custom font to use with your UILabels and UITextViews, etc…

Also: Make sure the fonts are in your Copy Bundle Resources.

How can we use custom font in an iOS app?

Try the steps below:

1. Make configuration in the info.plist as shown in Image

Sample Image

2. Now you should use that added file

UIFont *customFont = [UIFont fontWithName:@"fontName" size:size];

// further you may set That Font to any Label etc.

EDIT: Make Sure you have added that file in your resources Bundle.

Sample Image

How to use custom fonts in iPhone SDK?

  1. Add your custom font into your project , i.e. Dragged the font file(CALIBRIZ_0.TTF) into XCode project.

  2. Edit 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

    Sample Image

  4. Opened the font in font book(double click on your font in finder) to see what the real filename is and
    I see this:

Sample Image

Now set font to your label

yourLabel.font = [UIFont fontWithName:@"Calibri" size:15];

Follow this to get more

Adding custom fonts to my iphone application

Thanks for the response, I found the error. Basically what happened was that the file I used for my font had a white space in the file name. So when I tried to load it in the plist file it gave the error of file not found, once I removed the space out of the filename everything worked perfecty.

How do I add a custom font to my app?

I just got it working!!! Thanks to JSD for steering me in the right direction. Apparently the issue is how XCode renames font variants that are in the same family.

Using the Font Book name doesn't work!!!

You actually have to see how Xcode names the fonts. In order to do that you have to run a log command:

NSLog(@"%@", [UIFont fontNamesForFamilyName:@"Source Sans Pro"]);

gave me this:

Sample Image

This code worked:

cellTitle.font = [UIFont fontWithName:@"SourceSansPro-Black" size:50];


Related Topics



Leave a reply



Submit