custom fonts is not work in my iOS app [duplicate] - iphone

This question already has answers here:
Custom font is not working in my App?
(8 answers)
Closed 9 years ago.
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

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:

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.

Related

How can we use custom font in an iOS app? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Can I embed a custom font in an iPhone application?
How can I customize font in my iPhone app?
Is it possible?
How can I use this custom font in a UILabel?
I am trying to add MYRIADPRO-SEMIBOLD.OTF font in my App.
and the code is
UIFont *customFont = [UIFont fontWithName:#"MYRIADPRO-SEMIBOLD" size:35];
titleLbl.font = customFont;
And the Plist is
Try the steps below:
1. Make configuration in the info.plist as shown in 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.
Copy your font file into Resources.
In your application .plist create (if it exists just create a row) a row called Fonts provided by application and then in item 0 copy your font name for example Ciutadella-Bold.otf
Then you can define this font in your application:
UIFont *CiutadellaBold = [UIFont fontWithName:#"Ciutadella-Bold" size:17.0f];
And use it in for instance in UILabel:
[uiLabel setFont:CiutadellaBold];
It is totally possible. Please check the following links to implement your solution.
iPhone Development: how to use custom fonts?
How to add custom fonts to an iPhone app?
how to use custom font in iphone application
Can I embed a custom font in an iPhone application?
I hope these links help.

Custom font in interface builder [duplicate]

This question already has answers here:
Using custom fonts in interface builder
(6 answers)
Closed 9 years ago.
I want to install custom font and used in UIlabel from ibterface builder,xcode4.2?I tried the Google ways but its not showing in the Interface builder?
Add the font file in your project and use the following to set the font.
self.font = [UIFont fontWithName:#"yourFontName" size:yourFontSize];
First save your custom font file in your project folder and then you have to add it to Your_Project_name-Info.plist file which might be located in your supporting files folder
click on Your_Project_name-Info.plist
Add new object(array)=>type Fonts provided by application on key field.
Add an object in that array with name of your font
As of now, Xcode 4.6, you cannot have Interface Builder display a custom font that it did not already come with. In order to have a label use a custom font you will have to display it programmatically. Which means that you will be unable to use IB to determine how long to make a label or anything like that.

iPhone muliti laanguage support application

I wanna create my iPhone app in three languages. English & Punjabi & Gujarai.
"Gujarati" & "Punjabi" is not available in locale list of languages. so i can't able to create values folder like values-fr(french) and value-rs(russia).. like dat.. How can i develop this app with "Punjabi" & "Gujarati"?
IOS 4.3 onwards these fonts are supported : http://iosfonts.com/
If don't find the fonts then you can use custom fonts. Steps listed below
Just follow these 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 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…

Custom font is not working in my App?

In my iPhone app,
I have included two custom fonts and by referring this steps by stackoverflow questions....
How to include and use new fonts in iPhone SDK?
And Coded ....
[lbl setFont:[UIFont fontWithName:#"glyphish.ttf" size:[lbl minimumFontSize]]];
I am building this app for Base SDK 5.0
The answer is,
[lbl setFont:[UIFont fontWithName:#"glyphish" size:[lbl minimumFontSize]]];
Thanks to all.
First find that font in your available fonts list:
NSLog(#"fonts: %#", [UIFont familyNames]);
Then find and input the appropriate name.
You have passed a filename (glyphish.ttf) instead of the actual font name. Most likely, the font name is Glyphish, but you need to query it somehow: either using the Mac's "Font Book.app" or via code: first, you need to query the family names via [UIFont familyNames]. Then, use [UIFont fontNamesForFamilyName:] to get the actual font names to load. For example, if your font contains a bold variant its family name would be Glyphish but font name would likely be Glyphish-Bold.
You should correct name. It should not contain ttf in glyphish.ttf. For exact reference refer following image for that. Dakota is font name in my case.
The font name is not the name of the file. Thus glyphish.ttf is not a valid font name.
you have to use the font name, not the filename. you can check the name by opening the font file on yout mac.
Most probably the actual font name to be put in the app might be something else than glyphish.ttf .. i suggest opening font book and there checking the name of the font .and using that.
You need to check the font name it may be different then the font file name...try this link
Go to your application build phases and add your font files in copy bundle resources
Double click on the font file to open it in font book. Now see the name of the font on the top bar. Use this name in your code.

Custom font in iphone not being displayed properly

I installed a custom font called "modern no. 20" (already installed in my mac) into my iphone project .
I copied the modernno20.ttf into my resources.
Now in my app-info.plist i added this font name in "Fonts provided by application".
Then i added
cell.textLabel.font=[UIFont fontWithName:#"modernno20.ttf" size:14.0];
in my tableviewcode .
i dont know why but this font is not properly displayed.is there any thing i missed?
In order to call the font in your fontWithName call, the string should be the name of the font as it is displayed in the Mac's 'Font Book' app, and not the actual filename of the referenced font file.
There hasn’t been an easy way to add custom fonts to your iPhone applications. As of iOS 4 it has become very easy to do. there could be possibility you would have missed some of the step to get custom font work.
Here is what you need to do in order to add custom fonts,
Check How to include ttf fonts to iOS app