Skip to content

Commit

Permalink
Fix SVG tag closing for OT font glyphs
Browse files Browse the repository at this point in the history
Prevent ThorVG "Failed to create SVG canvas" errors
by self-closing empty SVG tags in OpenType fonts,
so the glyphs are renderred correctly in Controls.

Fixes #78374
  • Loading branch information
3dnikita committed Jun 22, 2023
1 parent b6ba664 commit fad4135
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/text_server_adv/thorvg_svg_in_ot.cpp
Expand Up @@ -121,7 +121,12 @@ FT_Error tvg_svg_in_ot_preset_slot(FT_GlyphSlot p_slot, FT_Bool p_cache, FT_Poin
for (int i = 0; i < parser->get_attribute_count(); i++) {
xml_body += vformat(" %s=\"%s\"", parser->get_attribute_name(i), parser->get_attribute_value(i));
}
xml_body += ">";

if (parser->is_empty()) {
xml_body += "/>";
} else {
xml_body += ">";
}
} else if (parser->get_node_type() == XMLParser::NODE_TEXT) {
xml_body += parser->get_node_data();
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END) {
Expand Down

0 comments on commit fad4135

Please sign in to comment.