mirror of https://github.com/axmolengine/axmol.git
set minimum display length to 1.
This commit is contained in:
parent
3fb45f28f5
commit
651d877e28
|
@ -283,6 +283,8 @@ void RichText::handleTextRenderer(const std::string& text, const std::string& fo
|
|||
std::string curText = text;
|
||||
size_t stringLength = StringUtils::getCharacterCountInUTF8String(text);
|
||||
int leftLength = stringLength * (1.0f - overstepPercent);
|
||||
//The minimum cut length is 1, otherwise will cause the infinite loop.
|
||||
if (0 == leftLength) leftLength = 1;
|
||||
std::string leftWords = Helper::getSubStringOfUTF8String(curText,0,leftLength);
|
||||
std::string cutWords = Helper::getSubStringOfUTF8String(curText, leftLength, stringLength - leftLength);
|
||||
if (leftLength > 0)
|
||||
|
|
Loading…
Reference in New Issue