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…
Related
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.
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
I added a font file (.ttf) to my Xcode project, to resources. Also, I added it to the UIAppFonts in my info.plist.
When I want to use this font though, I don't even see it as a choice in IB.
After installing the font on my system, I started seeing it in IB, but still - changing to it doesn't change anything - some default system font is displayed in the Interface Builder as well as in iPhone emulator.
Are there any steps more I should do to be able to use my own font?
To use custom fonts with iOS you have to set them programmatically.
For example, suppose you have a font file called swellfont.ttf that you add to your project.
You then would go into your App-Info.plist file and add the full name of the file to the next index of the array keyed by UIAppFonts, as you mention.
<key>UIAppFonts</key>
<array>
<string>swellfont.ttf</string>
</array>
Then, to use the font:
label.font = [UIFont fontWithName:#"swellfont" size:12];
Assuming that label is a UILabel and that swellfont.ttf is not protected. It's important to note that UIFont's fontWithName is not referring to the filename, instead its wanting the actual name of the font. If you open the font with FontForge you can see this information by selecting Element > Font Info from the menu bar. There are probably cleverer ways to find this information out.
I use 2 fonts in an APP. The first one was automatically added to the "Copy Bundle Resources", the other was not. I had to add that one myself.
Call in code:
[labelName setFont:[UIFont fontWithName:#"OneGreatBigFont" size:40]];
How to use custom font?(font that doesn't exist in iphone)
Since you mention iphone-sdk-4.0 as one of your tags, it means that you can use the UIAppFonts key on your app. UIAppFonts was introduced on iOS 3.2.
The key to be added on your property list: http://developer.apple.com/library/ios/#documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW3
UIAppFonts description.
Ex.
Add the font files to your resource files
Edit your Info.plist: Add a new entry with the key Fonts provided by application.
For each of your files, add the file name to this array
First you can install a custom font in your app pick original font name
then rename your font file name.
[LblTwitter setFont:[UIFont fontWithName:#"The Great Escape" size:12]];
Note: this is available in iOS 4.0 and later.
You will have to include your font file in your project and update the keys in info.plist after that you can use that font by name see this link
is it possible to bring another language font in iphone sdk and to insert that font value (for example,chinese) in UILabel value? any help please?
You can include the font as a resource in the project, then load the font using CoreText but it's not trivial.
The main step is to create a CTFontDescriptor that will load the font. There is sample code in the iPhone SDK documentation that I can't quote, the name of the section I found useful is...
CoreText Listing 2-9 "Creating a font from serialized data"