mirror of https://github.com/axmolengine/axmol.git
fix richText UTF8
This commit is contained in:
parent
f8ecceff25
commit
7ff78c61ba
|
@ -319,7 +319,7 @@ void RichText::handleTextRenderer(const std::string& text, const std::string& fo
|
||||||
size_t stringLength = StringUtils::getCharacterCountInUTF8String(text);
|
size_t stringLength = StringUtils::getCharacterCountInUTF8String(text);
|
||||||
int leftLength = stringLength * (1.0f - overstepPercent);
|
int leftLength = stringLength * (1.0f - overstepPercent);
|
||||||
std::string leftWords = utf8_substr(curText,0,leftLength);
|
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)
|
if (leftLength > 0)
|
||||||
{
|
{
|
||||||
Label* leftRenderer = nullptr;
|
Label* leftRenderer = nullptr;
|
||||||
|
|
|
@ -42,9 +42,9 @@ bool UIRichTextTest::init()
|
||||||
_richText->ignoreContentAdaptWithSize(false);
|
_richText->ignoreContentAdaptWithSize(false);
|
||||||
_richText->setContentSize(Size(100, 100));
|
_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* 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* 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);
|
RichElementText* re5 = RichElementText::create(5, Color3B::RED, 255, "Last one is red ", "Helvetica", 10);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue