Fonts in Cocos2d-x 2.0

Fonts in Cocos2d-x 2.0
0.0 0



I recently migrated my project from 1.x to 2.x of cocos2d-x native. After the migration the fonts reverted to the default and I found in a dark corner of the web that you have to refer to them as without the “.ttf” ending and add them to the Info.plist under the entry “Fonts provided by application” as for example Item0 “font.ttf” and then use it as simply “font”. This worked for my iOS project but doesn’t for my Android project. I have temporarily created a macro that is defined as “font” for iOS and “font.ttf” for Android. I’m however not happy with this fix and think it’s dirty. What am I missing here? How is this problem solved properly?

Thanks. :slight_smile:

<3 cocos2d-x :slight_smile:


Bug #1396 is created. Thanks for your report.


I think you should add .ttf for iOS and android.
You can refer to tests/FontTest for detail information.