diff options
author | 3dnikita <blog@3dnikita.com> | 2023-06-22 04:13:03 +0300 |
---|---|---|
committer | 3dnikita <blog@3dnikita.com> | 2023-06-22 17:50:24 +0300 |
commit | 1247c9e64fe658b64d28531f241f184d0e10c4d6 (patch) | |
tree | 8e44562348212fd70c46f38cc58f2ff9f5fb7be4 /modules/text_server_fb | |
parent | b6ba664830d9ff1bd7eeb72294fa1e7a3827e42e (diff) | |
download | redot-engine-1247c9e64fe658b64d28531f241f184d0e10c4d6.tar.gz |
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
Diffstat (limited to 'modules/text_server_fb')
-rw-r--r-- | modules/text_server_fb/thorvg_svg_in_ot.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/text_server_fb/thorvg_svg_in_ot.cpp b/modules/text_server_fb/thorvg_svg_in_ot.cpp index cd0ecd9b90..773b103c01 100644 --- a/modules/text_server_fb/thorvg_svg_in_ot.cpp +++ b/modules/text_server_fb/thorvg_svg_in_ot.cpp @@ -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) { |