We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.富文本控件参数的设置: 1)允许使用UBB语法 2)默认设置的大小是,w->900,h->136 3)自动大小方式是适配高度 4)字体大小48,字体使用苹方粗体ttf字体库
2.测试字符串“They[color=#d94e29] stole[/color] all my money! “the woman screamed.
3.测试结果现象
4.使用的引擎是coco2dx 3.17,使用xcode在debug模式下查看在下面方法内 void FUIRichText::handleTextRenderer(FUIRichElement* element, const TextFormat& format, const std::string& text) { FUILabel* textRenderer = FUILabel::create(); textRenderer->setCascadeOpacityEnabled(true); textRenderer->getTextFormat()->setFormat(format); textRenderer->applyTextFormat(); textRenderer->setString(text); textRenderer->setUserData(element);
float textRendererWidth = textRenderer->getContentSize().width; _leftSpaceWidth -= textRendererWidth; if (_leftSpaceWidth >= 0) { _elementRenders.back().push_back(textRenderer); return; } int leftLength = findSplitPositionForWord(textRenderer, text); //The minimum cut length is 1, otherwise will cause the infinite loop. if (0 == leftLength) leftLength = 1;
//测试下面这条语句leftWords显示的是 " all my money! “the w",但不知道怎么修改 std::string leftWords = getSubStringOfUTF8String(text, 0, leftLength); int rightStart = leftLength; if (std::isspace(text[rightStart], std::locale())) rightStart++; std::string cutWords = getSubStringOfUTF8String(text, rightStart, text.length() - leftLength); if (leftLength > 0) { FUILabel* leftRenderer = FUILabel::create(); leftRenderer->setCascadeOpacityEnabled(true); leftRenderer->getTextFormat()->setFormat(format); leftRenderer->applyTextFormat(); leftRenderer->setString(getSubStringOfUTF8String(leftWords, 0, leftLength)); leftRenderer->setUserData(element); _elementRenders.back().push_back(leftRenderer); }
if (cutWords.length() > 0) { addNewLine(); handleTextRenderer(element, format, cutWords); }
}
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1.富文本控件参数的设置:
1)允许使用UBB语法
2)默认设置的大小是,w->900,h->136
3)自动大小方式是适配高度
4)字体大小48,字体使用苹方粗体ttf字体库
2.测试字符串“They[color=#d94e29] stole[/color] all my money! “the woman screamed.
3.测试结果现象
4.使用的引擎是coco2dx 3.17,使用xcode在debug模式下查看在下面方法内
void FUIRichText::handleTextRenderer(FUIRichElement* element, const TextFormat& format, const std::string& text)
{
FUILabel* textRenderer = FUILabel::create();
textRenderer->setCascadeOpacityEnabled(true);
textRenderer->getTextFormat()->setFormat(format);
textRenderer->applyTextFormat();
textRenderer->setString(text);
textRenderer->setUserData(element);
//测试下面这条语句leftWords显示的是 " all my money! “the w",但不知道怎么修改
std::string leftWords = getSubStringOfUTF8String(text, 0, leftLength);
int rightStart = leftLength;
if (std::isspace(text[rightStart], std::locale()))
rightStart++;
std::string cutWords = getSubStringOfUTF8String(text, rightStart, text.length() - leftLength);
if (leftLength > 0)
{
FUILabel* leftRenderer = FUILabel::create();
leftRenderer->setCascadeOpacityEnabled(true);
leftRenderer->getTextFormat()->setFormat(format);
leftRenderer->applyTextFormat();
leftRenderer->setString(getSubStringOfUTF8String(leftWords, 0, leftLength));
leftRenderer->setUserData(element);
_elementRenders.back().push_back(leftRenderer);
}
}
The text was updated successfully, but these errors were encountered: