CCLabelBMFont::labelWithString crash

CCLabelBMFont::labelWithString crash
0.0 0

#1

Hi,

I’m trying to display some latin characters like ‘è’ ‘ò’ ‘à’ using CCLabelBMFont::labelWithString.

Unfortunately I’m getting a crash when I call labelWithString due to a CCAssert which says “FontDefinition could not be found![](”

If I use ASCII fonts everything works fine.
The .fnt file I’m using is created with BMFont and includes latin characters.

Do you what might be the cause?

Many thanks)


#2

You can change the following:

cocos2dx/support/ccUTF8.cpp

#define UTF8_COMPUTE(Char, Mask, Len)        \
if (Char < 128)                \
{                        \
Len = 1;                    \
Mask = 0x7f;                \
}   

to:

#define UTF8_COMPUTE(Char, Mask, Len)        \
if (Char < 256)                \
{                        \
Len = 1;                    \
Mask = 0xff;                \
}          

Not yet tested if there are any issues with this.