// create the font
id font;
font = [UIFont fontWithName:fntName size:nSize];
//
the font is always null and my code logic is as same as the test project and my res path is correct.
besides, i have a question about the test project, why doesn’t the ttf font res ends with a .ttf suffix and begins with a /font prefix?
thank you~
on ios, the font name param mustn’t follow with .ttf subfix. Use just like
CCLabelTTF* pLabel = CCLabelTTF::labelWithString(“Hello World”, “Paint Boy”, 34); // Paint Boy is the ttf file name, Paint Boy.ttf
locate your custom ttf file at the root of resources
In your case, your custom ttf obviously cannot be created by UIFont, go through it, your font will be created by line 353 in cocos2dx/platform/ios/CCImage_ios.mm
font = [[FontManager sharedManager] zFontWithName: fntName pointSize: nSize];