This article was reproduced from: http://quick.cocoachina.com/wiki/doku.php?id=ios%E7%89%88%E6%9C%AC%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A% E4%b9%89%e5%ad%97%e4%bd%93%e6%ad%a5%e9%aa%a4
For example, the font file named Abc.ttf, the Mac font tool to find the name of the font:
PostScript name fzyhjw--gb1-0 full name founder Art Black Simplified
This PostScript name is the name of our font, to be used in the code
Assuming your project is named Project, the current directory is the following steps in the project:
- Copy the Abc.ttf to the Res directory of the project
- modify proj.ios/project/resources/info.plist
<key>UIAppFonts</key> <array> <string >res/abc.ttf</string > </array> If you want to add more than one font, copy the string node
- It is possible to specify the font name in the LUA code, such as:
Local label = Ui.newttflabel ({ "1234", " fzyhjw--gb1-0", " ):p os (d.cx,d.cy-MB): AddTo (self)
The font name here is not related to the file name of the font, it must be preceded by the Mac font tool to open the displayed font name consistent
Now the iOS custom font is OK, look at the simulator and the real machine, not in the player.