您的位置:首页 > 移动开发 > IOS开发

How to Use Custom TTF Font on iOS

2013-11-23 17:32 543 查看
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).
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: