ttf issue

if we use a long path as font name, program crashes in CCImage_win32.cpp:

strcpy_s(tNewFont.lfFaceName, LF_FACESIZE, fontName.c_str());

fix:
change “/” to “” in this line:

int nFindPos = fontName.rfind("/");

The source is :

int nFindttf = fontName.find(".ttf"); int nFindTTF = fontName.find(".TTF"); if (nFindttf >= 0 || nFindTTF >= 0) { fontPath = CCFileUtils::sharedFileUtils()->fullPathForFilename(fontName.c_str()); int nFindPos = fontName.rfind("/"); fontName = &fontName[nFindPos+1]; nFindPos = fontName.rfind("."); fontName = fontName.substr(0,nFindPos); } tNewFont.lfCharSet = DEFAULT_CHARSET; strcpy_s(tNewFont.lfFaceName, LF_FACESIZE, fontName.c_str());
If I can’t find the .ttf file, how can I solve the problem?
The error reason is the buffer is too small.
The length of tNewFont.lfFaceName si 32, but the .ccbi file that i read has a fontname named American…solid(I can’t remember the whole name).
How can I solve this problem?