Custom font is not working in my App? - iphone

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.

Related

"Swanky and Moo Moo" font is not working in ios

I am using "Swanky and Moo Moo" in my application, but it displays the font style as like of system font..
Here my code....
myLabel.font=[UIFont fontWithName:#"Swanky and Moo Moo" size:16];
I have refer the following links..
iOS: How can i set a non system font family, style, size of UILabel?
http://kgriff.posterous.com/45359635
But thats are not useful for me.......
Can antone tell me that how to set the myLabel font style as Swanky and Moo Moo??
Add your custom font files into your project using XCode as
resources.
Add key font provided by application to your info plist.(array key)
For each font add the full font file name along with extension as
item into the key.
Now you can use the font as UIFont *customFont = [UIFont
fontWithName:fontName size:fontSize];
The catch the font name is not the font file name every time.....
you can install the font file to check its font name....use that
name and you are sorted....
Note:- If it still dosent work go to build phases ->copy bundle resources and add all your font files
Beside the solution you will find on SO you need to make sure you provide the exact name you will see for the Full name or 'Postscript name tag in fontbook. Try SwankyandMooMoo or Swanky and Moo Moo.

Load TTF font from external path

I was wondering that how to load a TTF font from a absolute file path, not relative, which is usually done with
[UIFont fontWithName:#"xyz"];
In cocos2d we can do it by using CCLabelBMFont that takes file as parameter, but when use CCLabelTTF it takes the name of font, not the file name.
Is there any workaround to load an external font not embedded with the application but downloaded from some resource as per need ?
Yes, you can do this.
Just copy the font to your project and add this reference in your info.plist. Then you can reference the font name just like any other system font.
if I did well understand your question, maybe this post Can I embed a custom font in an iPhone application? will give you an answer.

Font not loading in XCode

Well, I want to import a new Font to my application but without success. I have the Fonts provided by application key in my .plist , I have my font in the Item 0 as a String and the value AdelleBasic_Bold.otf, I have added that Font to my project, and I am trying to use it with:
_myTextField.font = [UIFont fontWithName:#"Adelle Basic" size:15];
Adelle Basic is the header of the Font when I open it. I have also tried without any success:
_myTextField.font = [UIFont fontWithName:#"AdelleBasic_Bold" size:15];
Any suggestion?
This may well not true for all fonts, but in my experience, Xcode can be fussy, & I've never been able to get it to use otf fonts (anyone who has please post!), so I've always converted my fonts using this really excellent website - Online Font Converter
I convert them to ttf fonts, and they always seem to work fine - make sure you use the exact name (changing the filename of the font seems to stop it working too).
Hope this helps.
Below is the proper way to add fonts to your XCODE app (.otf fonts work fine):
Include your fonts in your XCode project
Make sure that they’re included in the target
Double check that your fonts are included as Resources in your bundle
Include your iOS custom fonts in your application plist
Find the name of the font
Credits and better explaination with images here
you can use only the third party fonts which have extension as ttf and the fonts which have otf extension will not work effectively and mostly doesn't work
Apart from assuring the 5 points, you could also try out the following snippet of code that prints out the installed fonts:
for (NSString* family in [UIFont familyNames])
{
NSLog(#"%#", family)
for (NSString* name in [UIFont fontNamesForFamilyName: family])
{
NSLog(#" %#", name);
}
}
If the font that you want to use is not listed, then you missed in some of the 5 steps.
I just add font into project, check if font will copy inside bundle. Set up it on my Mac and directly use font inside Interface Builder. If you will have any problems solve they here.
I've seen some comments about tff and otf and I wouldn't agree, it could be that you are not using the correct font name, this doesn't mean the file name
to find the fonts you have installed in xcode run the
for family: String in UIFont.familyNames{
print(family)
for names: String in UIFont.fontNames(forFamilyName: family){
print("== \(names)")
}
}

Using custom fonts

So I'm able to use custom fonts by adding them to my Xcode project and info.plist like so:
http://iosdevelopertips.com/user-interface/load-and-access-custom-fonts.html
However, I tried adding another in the same way, but that UIFont doesn't seem to work for some reason. The UILabel just shows the default font setting. Is there a particular reason why one .ttf would work and another wouldn't?
As EmilioPelaez commented, font family names can sometimes be different from the file names. Using the NSLog technique NSLog(#"Fonts: %#", [UIFont familyNames]); can help to find out what the family name of added fonts is.

How to use FUTURA-Bold font in my iPhone app

I am trying to use FUTURA-BOld in my app but its not working as it should be. I installed the font in my system, copied the font in my code resource. Edited the info.plist with the font name. And choosing the same font but it is just giving me simple font.
Any idea ???
Thanks,
1) Have you made the plist entry UIAppFonts of type array, putting your (ttf) filename as a member value?
2) Are you using the actual internal font name? This may differ from the ttf filename. Use
NSLog(#"fonts: %#",[UIFont familyNames]);
to get a list of fonts. Lookup your font and use that name exactly.