fix richText UTF8

This commit is contained in:
andyque 2014-07-17 18:34:54 +08:00
parent f8ecceff25
commit 7ff78c61ba
2 changed files with 3 additions and 3 deletions

View File

@ -319,7 +319,7 @@ void RichText::handleTextRenderer(const std::string& text, const std::string& fo
size_t stringLength = StringUtils::getCharacterCountInUTF8String(text);
int leftLength = stringLength * (1.0f - overstepPercent);
std::string leftWords = utf8_substr(curText,0,leftLength);
std::string cutWords = utf8_substr(curText, leftLength, curText.length()-1);
std::string cutWords = utf8_substr(curText, leftLength, curText.length() - leftLength);
if (leftLength > 0)
{
Label* leftRenderer = nullptr;

View File

@ -42,9 +42,9 @@ bool UIRichTextTest::init()
_richText->ignoreContentAdaptWithSize(false);
_richText->setContentSize(Size(100, 100));
RichElementText* re1 = RichElementText::create(1, Color3B::WHITE, 255, "中国中国中国中国中国中国中国中国中国中国中国中国中国中国中国", "Marker Felt", 10);
RichElementText* re1 = RichElementText::create(1, Color3B::WHITE, 255, "中国中国中国中国中国中国中国中国中国中国", "Marker Felt", 10);
RichElementText* re2 = RichElementText::create(2, Color3B::YELLOW, 255, "And this is yellow. ", "Helvetica", 10);
RichElementText* re3 = RichElementText::create(3, Color3B::BLUE, 255, "This one is blue. ", "Helvetica", 10);
RichElementText* re3 = RichElementText::create(3, Color3B::BLUE, 255, "ご静聴ありがとうございました!!ご静聴ありがとうございました!!", "Helvetica", 10);
RichElementText* re4 = RichElementText::create(4, Color3B::GREEN, 255, "And green. ", "Helvetica", 10);
RichElementText* re5 = RichElementText::create(5, Color3B::RED, 255, "Last one is red ", "Helvetica", 10);