cocos2d 自定义字体

I couldnt find relevant information on this, so had to experiment to find this out. So thought i'll just share it here.

If anyone is using custom fonts with CCLabelTTF, please ensure the following:

1) Make sure you have included the .ttf into the project (not just adding it into the project folder, but actually include it in the project "Add->Existing Files"

2) The filename has to be the same as the font FAMILY NAME. eg, I have two fonts, Rock.ttf with a font name of "Rockwell" and family name of "Rockwell", also Rockb.ttf of font name "Rockwell Bold" and a family name of "Rockwell" (you can check the info using windows font viewer). The first file had to be renamed "Rockwell.ttf" for it to work, but the second one needs to be edited because they share the same family name, so changing it to "Rockwell Bold.ttf" will not work unless you use some software to edit the font family name to "Rockwell Bold" as well.

The above applies to development on Win8 RTM for Win8 Metro app. May or may not apply to other versions (untested)

posted @ 2013-07-14 15:21  alsky  阅读(250)  评论(0编辑  收藏  举报