Hey, I ran into a bug with with cocos builder and the new 2.0.4 release.
It works fine on android, however on ios, since you have to register your font and refer to it without the extension, it simply doesn’t work.
I’m not sure it has been reported yet. I couldn’t find it in the forum.
However, i made a liitle fix in order ot make it work by just removing the extension of the ttf file:
CCString * CCNodeLoader::parsePropTypeFontTTF(CCNode * pNode, CCNode * pParent, CCBReader * pCCBReader) {
CCString * fontTTF = pCCBReader->readCachedString();
std::string tmp(fontTTF->getCString());
if (tmp.find_last_of(".ttf") > 0) {
return CCString::create(tmp.substr(0, tmp.find_last_of(".ttf") - 3));
}
// CCString * ttfEnding = CCString::create(".ttf");
// TODO Fix me if it is wrong
/* If the fontTTF comes with the ".ttf" extension, prepend the absolute path.
* System fonts come without the ".ttf" extension and do not need the path prepended. */
/*
if(CCBReader::endsWith(CCBReader::toLowerCase(fontTTF), ttfEnding)){
fontTTF = CCBReader::concat(pCCBReader->getCCBRootPath(), fontTTF);
}
*/
return fontTTF;
}
I am using cocos 3.0 alpha2 and coco2d-x-2.1beta3. Le Yang’s fix doesn’t work. I see my custom font in cocosbuilder but on device I can’t. Do I have do something with project or plist file to support custom fonts from Cocosbuilder ?
I am using cocosbuilder 3 alpha 5. I have tried different combinations of including ttf extension and not in plist files, in actual file names etc… None of them work.
However, I do not get any logs about not finding a file or unable to load the files….
I tried searching about it, but couldn’t find anything. How do I go about debugging what the issue is?
I see that CCNodeLoader simply returns the entire path as provided in the CCB to setFontName with the full path. This will not work on iOS as iOS needs fonts to be mentioned in the plist file beforehand and just the font name for setFontName - is there a possible way in which I can get this working without having to edit source files (CCNodeLoader) ?