A bug of CCLabelTTF in 2.0.X.

When I use this code to create a CCLabelTTF.
CCLabelTTF* pLabel = CCLabelTTF::create("HelloWorldHelloWorldHelloWorldHelloWorldHelloWorld", "Arial", 24, CCSize(100.f, 0.f), kCCTextAlignmentCenter);
And run it on an android mobile. The first character would be erase when turn to a new line. I check the code and finally find the matter. In method “divideStringWithMaxWidth” of file “Cocos2dxBitmap.java”.
I change this code:
while (pString.indexOf(i++) == ' ') { ; }
to this code:
while (pString.indexOf(i) == ' ') { ++i; }
And problem solved.

No one pay attention to this?

I found this bug too, and more further. There’s a busy loop when tempWidth is larger then pMaxWidth with only one character. So I added a (i-1)>start check to accept this single character. patch as attachment.

for (int i = 1; i <= charLength; **i) {
tempWidth = FloatMath.ceil);
if {
final int lastIndexOfSpace = pString.substring.lastIndexOf;
if {
/* Should wrap the word. /
strList.add);
i = lastIndexOfSpace;
} else {
/
Should not exceed the width. /
if >start && tempWidth > pMaxWidth) {
strList.add);
/
Compute from previous char. /
—i;
} else {
strList.add);
}
}
/
Remove spaces at the beginning of a new line. */
while == ‘’) {
**i;
}
start = i;
}
}