| 1321 | } |
| 1322 | |
| 1323 | bool 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 | |
| 1347 | void RichText::initRenderer() {} |
| 1348 |
no test coverage detected