mirror of https://github.com/axmolengine/axmol.git
Merge pull request #13044 from fusijie/fix_10763
set minimum display length to 1.
This commit is contained in:
commit
96007b2793
|
@ -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