How to Use Custom TTF Font on iOS
Cocos2d-x uses FontLabel to draw customer ttf font before v2.0.3(including v2.0.3). Now it uses UIFont directly to draw system fonts and customer ttf fonts.
Now, inorder to use customer ttf font, you should do some more work. I will use TestCpp as example to describe the steps.-
Add your custom font files into your project using XCode as a resource

-
Add full name of customer ttf into your application's info.plist

-
Use ttf file in codes(only use font name without directory and .ttf)
Please refer to samples/TestCpp/Classes/FontTest/FontTest.cpp for detail information.
On iOS, use just pass font name(without relative path to Resources and file extension) to CCLabelTTF create an instance of CCLabelTTF. On other platforms, you should use full name(including relative path to Resources and file extension).
本文介绍如何在iOS应用中使用自定义TTF字体。通过Cocos2d-x的FontLabel或UIFont可以直接绘制系统及自定义字体。具体步骤包括:在Xcode中将字体文件作为资源添加到项目中;在info.plist中添加完整字体名;在代码中使用不含目录和.ttf的ttf文件。
2537

被折叠的 条评论
为什么被折叠?



