1. Add the appropriate font (. ttf or. odf) to the resurce of project, such as My.ttf.
2. In Info.plist, add a Fonts provided by application (item0 corresponding value My.ttf, adding multiple fonts in turn to be able to).
3. When using alabel.font=[uifontfontwithname:@ "XXX" size:30]; Note that XXX is not necessarily my, this is return to CASTLE.
You can view familyname and FontName in the following ways, for example:
Nsarray *familynames = [Uifont familynames]; for (NSString *familynameinfamilynames) {printf ("Family:%s \ n", [familynameutf8string]); Nsarray *fontnames = [Uifont fontnamesforfamilyname:familyname]; for (NSString *fontnameinfontnames) {printf ("\tfont:%s \ n", [fontnameutf8string]); } }
Scenario 2:
The answer is discussed in iOS3.2 once and after the practice, now 5.1, is expected to support 3.2 once the app is very few bar.
So I attached the iOS3.2 to the following.
In simple terms. is iOS3.2 Apple supports its own definition of the font, only need to set the Info.plist file uiappfonts related information. Procedures such as the following:
- Add your own definition font to your project resource file
- Add a key to uiappfonts in the Info.plist file
- Change this key into an array
- The name of all the fonts you will use. As the value of this array, an entry is entered (with the extension)
- Save Info.plist
- Now you can use [Uifont fontwithname:@ "Customfontname" size:12] in your code to get your own defined font.
Source: Http://stackoverflow.com/questions/360751/can-i-embed-a-custom-font-in-an-iphone-application
iOS uses its own font definition