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

Method textHandler

core/ui/UIRichText.cpp:1132–1170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1130}
1131
1132void MyXMLVisitor::textHandler(void* /*ctx*/, const char* str, size_t len)
1133{
1134 std::string text(str, len);
1135 auto color = getColor();
1136 auto face = getFace();
1137 auto fontSize = getFontSize();
1138 auto italics = getItalics();
1139 auto underline = getUnderline();
1140 auto strikethrough = getStrikethrough();
1141 auto bold = getBold();
1142 auto url = getURL();
1143 auto outline = getOutline();
1144 auto shadow = getShadow();
1145 auto glow = getGlow();
1146 auto name = getName();
1147
1148 uint32_t flags = 0;
1149 if (italics)
1150 flags |= RichElementText::ITALICS_FLAG;
1151 if (bold)
1152 flags |= RichElementText::BOLD_FLAG;
1153 if (underline)
1154 flags |= RichElementText::UNDERLINE_FLAG;
1155 if (strikethrough)
1156 flags |= RichElementText::STRIKETHROUGH_FLAG;
1157 if (!url.empty())
1158 flags |= RichElementText::URL_FLAG;
1159 if (std::get<0>(outline))
1160 flags |= RichElementText::OUTLINE_FLAG;
1161 if (std::get<0>(shadow))
1162 flags |= RichElementText::SHADOW_FLAG;
1163 if (std::get<0>(glow))
1164 flags |= RichElementText::GLOW_FLAG;
1165
1166 auto element = RichElementText::create(0, color, 255, text, face, fontSize, flags, url, std::get<1>(outline),
1167 std::get<2>(outline), std::get<1>(shadow), std::get<2>(shadow),
1168 std::get<3>(shadow), std::get<1>(glow), name);
1169 _richText->pushBackElement(element);
1170}
1171
1172void MyXMLVisitor::pushBackFontElement(const MyXMLVisitor::Attributes& attribs)
1173{

Callers

nothing calls this directly

Calls 7

getURLFunction · 0.85
createFunction · 0.85
pushBackElementMethod · 0.80
getColorFunction · 0.50
getFontSizeFunction · 0.50
getNameFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected