Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use custom fonts in iPhone SDK? [duplicate]

I Want to implement custom font in my app. So i have added that in my Project Source code. I don't want to set that programatically. Is this possible that I can do this with setting properties in xib?

like image 832
Patel Manthan Avatar asked Jan 17 '13 10:01

Patel Manthan


People also ask

Can you install custom fonts on iPhone?

You can download fonts from the App Store app , then use them in documents you create on iPhone. After you download an app containing fonts from the App Store, open the app to install the fonts. To manage installed fonts, go to Settings > General, then tap Fonts.

How use OTF font in iOS?

Add the Font File to Your Xcode Project To add a font file to your Xcode project, select File > Add Files to “Your Project Name” from the menu bar, or drag the file from Finder and drop it into your Xcode project. You can add True Type Font (. ttf) and Open Type Font (. otf) files.

How do I make my own iPhone font?

In Pages, tap the paintbrush icon at the top and select the name of the current font from the formatting pane at the bottom. Browse through the list of fonts and you should see both the built-in system fonts and the custom fonts you installed. Tap the font you want to use and then close the formatting pane.


2 Answers

  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

    enter image description here

  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:

enter image description here

Now set font to your label

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

Follow this to get more

like image 178
Rajneesh071 Avatar answered Oct 01 '22 07:10

Rajneesh071


I think you had not searched well.

How to add CUSTOM fonts:- Steps:-   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 theUIAppFonts array   5.  Save info.plist   6.  Now call UIFont *fontCustom = [UIFont fontWithName:@"CustomFontName" size:12];  to get the custom fonts. 

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

For example:- If you want to use "Nexa Light" font in your app, then add "Nexa Light.otf" into your project and call in this way.

UIFont *fontCustom = [UIFont fontWithName:@"Nexa Light" size:14]; lblName.font = fontCustom; 
like image 37
Piyush Dubey Avatar answered Oct 01 '22 06:10

Piyush Dubey