Outdated Docs > Cocos2D-X Built-in GUI Controls > Text Labels > How to Use Custom TTF Font on iOS

How to Use Custom TTF Font on iOS

Overview

Cocos2d-x v3.x uses FreeType to draw customer TTF font . But it also supports system TTF font.
But we highly recommend your to create a Label With TTF font support by using:

Label::createWithTTF

Instead of :

Label::createWithSystemFont

The system way is much slower than FreeType, So when you are using custom TTF font, be sure to call the correct functions.

How to use

In order to use customer TTF font in your project, you should do some extra work. I will take TestCpp as an example.

  • Add your custom font files into your project with XCode:

  • Using the TTF font name to create a Label instance, then you could start to manipulate the TTF Label now.

Please refer to tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp for detail information.

add-ttf-into-plist.png (126.7 kB) zhangxm, 2012-10-15 07:52

add-ttf-into-xcode.png (190.5 kB) zhangxm, 2012-10-15 07:57

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.