MCPcopy Create free account
hub / github.com/axmolengine/axmol / setString

Method setString

core/ui/UIRichText.cpp:1323–1345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1321}
1322
1323bool RichText::setString(std::string_view text)
1324{
1325 if (_text != text)
1326 {
1327 _formatTextDirty = true;
1328
1329 _richElements.clear();
1330 _text = text;
1331
1332 // solves to issues:
1333 // - creates defaults values
1334 // - makes sure that the xml well formed and starts with an element
1335 _xmlText.clear();
1336 fmt::format_to(std::back_inserter(_xmlText), FMT_COMPILE(R"(<font face="{}" size="{}" color="{}">{}</font>)"),
1337 this->getFontFace(), this->getFontSize(), this->getFontColor(), _text);
1338
1339 MyXMLVisitor visitor(this);
1340 SAXParser parser;
1341 parser.setDelegator(&visitor);
1342 return parser.parseIntrusive(&_xmlText.front(), _xmlText.length(), SAXParser::ParseOption::HTML);
1343 }
1344 return true;
1345}
1346
1347void RichText::initRenderer() {}
1348

Callers 5

initWithXMLMethod · 0.95
findSplitPositionForWordFunction · 0.45
findSplitPositionForCharFunction · 0.45
handleTextRendererMethod · 0.45

Calls 9

getFontFaceMethod · 0.95
getFontColorMethod · 0.95
setDelegatorMethod · 0.80
parseIntrusiveMethod · 0.80
format_toFunction · 0.50
clearMethod · 0.45
getFontSizeMethod · 0.45
frontMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected