CCLabelBMFont

There is a sample to use CCLabelBMFont class? And, How can create the “fnt” font file?

Thanks!

LabelTest uses CCLabelBMFont.
And there are urls of tools to make fnt font file in LabelTest.cpp.

thanks!

now I have integrate CCLabelBMFont on game, but I have a problem… the string, have a carriage return for every space :expressionless:

any idea?

bool font::load(const char* file, FontAlign align, float size)
{
if(strstr(file, “.fnt”) == 0)
{
_ERROR (“load a FNT!”);
return false;
}

size *= frw::dsp::screen::getInstance()->getRatioPosition().x;
bool ret = initWithString(“”, file, (CCTextAlignment)align, size);
autorelease();
return ret;
}

Minggo Zhang wrote:

LabelTest uses CCLabelBMFont.
And there are urls of tools to make fnt font file in LabelTest.cpp.

ah ok, I have bad interpreted of initWithString parameters. The last parameter is the width of the render box for the string.

Stefano Campodall’Orto wrote:

thanks!
>
now I have integrate CCLabelBMFont on game, but I have a problem… the string, have a carriage return for every space :expressionless:
>
any idea?
>
bool font::load(const char* file, FontAlign align, float size)
{
if(strstr(file, “.fnt”) == 0)
{
_ERROR (“load a FNT!”);
return false;
}
>
size *= frw::dsp::screen::getInstance()->getRatioPosition().x;
bool ret = initWithString(“”, file, (CCTextAlignment)align, size);
autorelease();
return ret;
}
>
>
>
>
Minggo Zhang wrote:
> LabelTest uses CCLabelBMFont.
> And there are urls of tools to make fnt font file in LabelTest.cpp.

Now, I have a new problem… the sentence is without the carriage return… this is the memory:

45 68 69 21 20 54 6F 63 63 61 [0A] 75 6E 61 20 73 63 61 74 6F 6C 61 20 70 65 72 [0A] 73 63 65 67 6C 69 65 72 65 20 75 6E 20 6C 69 76 65 6C 6C 6F 21 00 00 00 00 25 00 00 00 25 00 00 00 00 00 00 00 45 68 69 21 0A 48 61 69 20 73

0A is the carriage return… CCLabelBMFont is not interpreted?

Regards!

Stefano

Stefano Campodall’Orto wrote:

ah ok, I have bad interpreted of initWithString parameters. The last parameter is the width of the render box for the string.
>
Stefano Campodall’Orto wrote:
> thanks!
>
> now I have integrate CCLabelBMFont on game, but I have a problem… the string, have a carriage return for every space :expressionless:
>
> any idea?
>
> bool font::load(const char* file, FontAlign align, float size)
> {
> if(strstr(file, “.fnt”) == 0)
> {
> _ERROR (“load a FNT!”);
> return false;
> }
>
> size *= frw::dsp::screen::getInstance()->getRatioPosition().x;
> bool ret = initWithString(“”, file, (CCTextAlignment)align, size);
> autorelease();
> return ret;
> }
>
>
>
>
> Minggo Zhang wrote:
> > LabelTest uses CCLabelBMFont.
> > And there are urls of tools to make fnt font file in LabelTest.cpp.