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).
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).
相关文章推荐
- How to Use Custom TTF Font on iOS
- [ios] how to findout the language you use on ios devices.
- How to use Facebook iOS SDK on iOS 10
- Core Data on iOS 5 Tutorial: How To Use NSFetchedResultsController
- How To: Compile and Use Tesseract (3.01) on iOS (SDK 5)
- Magento How To Display Product Custom Option On list.phtml
- HOW TO USE MPS ON SINGLE GPU
- How to Use ADE to Get Benchmark on Linux
- How to use "mount.cifs" on ESX
- How to use Ruijie to contact to the Internet on Ubuntu
- How to use Display Zoom on your iPhone 6 or iPhone 6 Plus
- 如何使用ODB(How to use odb On windows)
- How to use ActiveSync Remote Display on Windows Embedded CE 6
- How to deploy a .Net assmebly for COM use through CAB on Web Page (转)
- How to Turn on iOS Diagnostics and Send Crash Reports
- How to use freely resizable font in in Java ME
- Notes on how to use Webots, especially how to make a robot fly in the air
- How to use custom delegates in Objective-C
- How to Configure, Install and Use libnefilter_queue on Linux
- How to use Screen on Linux