c++windows-phone-8.1cocos2d-x-3.0cclabelttf

CCLabelTTF::setString not accepting white space at start and end of string


I'm trying to set value of a label in cocos2d-x. It's not showing spaces if I add them on start or end of string, like

label->setString("10 10");

working correctly. But if I use

label->setString(" 10");
label->setString("10 ");

it only show "10" , spaces are trimmed.


Solution

  • I figure out the problem, label->setString() function is ok. Problem is with label->getContentSize().width , it does not include white spaces at start and end of string while calculating width of label(this problem occurs while working in windows phone 8.1).And labels were overwriting in my case because of incorrect positioning.