Can someone explain CCLabelBMFont to me?

I’ve heard that it supported word wrapping but I can’t seem to get it to work, what am I doing wrong?

CCLabelBMFont::create(<#const char *str#>, <#const char *fntFile#>, <#float width#>, <#CCTextAlignment alignment#>, <#cocos2d::CCPoint imageOffset#>);

Is <#float width#> involved with text wrapping at all?
Am I right to say that <#CCTextAlignment alignment#> aligns the text to either left/ center /top depending on which kCCTextAlignmentPosition is set?
What does <#cocos2d::CCPoint imageOffset#> do exactly?

I’ve tried looking at the TestCpp but that only got me more confused, if anyone can help it’s greatly appreciated!

I’m in the same boat as you, I’m bumping this.
If it supports word wrapping, it doesn’t do it the same way CCLabelTTF does it (the constructors are different, no CCSize arg :frowning: )
Hoping a cocos2d-x guru can help

  1. It determines the maximum width of the font. If the text exceeds the width, it is automatically wrapped.
  2. Yes, Text alignment does exactly that.
  3. I haven’t used image offset but it seems to add X and Y points to whatever you set position it to.

Hi lance, thanks for confirming, I tried setting the width parameter to a dozen different numbers, but the text I have doesn’t wrap.
The text wraps if I use a newline character ‘’ though, do you think that this is a bug?

What version are you using? On 2.1.4 it wraps properly.

Thanks for your help, I was using 2.1.3, I’ll try to finish up some other things then upgrade to 2.1.4 by today to see if it works.

I’ve not had any success after updating to 2.1.4, this is the code I used, everything but the text wrapping works:

CCLabelBMFont::create("Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong", "west_england-64.fnt", dialogBox->boundingBox().size.width);

Any example of working text wrapping code would help a lot in debugging!

Edit:
Figured it out, word wrapping only works on entire words, it does not wrap a really long continuous word, but it will put new words on a new line if there are spaces in between!