Fix SVG tag closing for OT font glyphs

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
This commit is contained in:
3dnikita 2023-06-22 04:13:03 +03:00
parent b6ba664830
commit 1247c9e64f
2 changed files with 12 additions and 2 deletions

View File

@ -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));
}
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) {

View File

@ -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));
}
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) {