CCLabelTTF: alignment error on Android

CCLabelTTF: alignment error on Android
0.0 0



when we display a text in a CCLabelTTF that is wider than the label width, the sentence is wrapped. On Android, however, the wrapped sentences indent to the right (s. screenshot).
Is this a bug or a feature?

We are using version cocos2d-2.1rc0-x-2.1.2 and we tried it on a Galaxy Tab and on the latest Kindle Fire.


SC20130416-103010.png (210.2 KB)


After a bit of code digging I found out that the problem is in where a sentence with spaces is wrapped if possible after a word and before the space. The space is then the first character of the following line, which causes the indent.



The problem is in lines 298-300

while (pString.indexOf(i) == ' ') {

This should be changed to

while (pString.charAt(i) == ' ') {




Yep, you are right.
Thank you.