[vector-draw] Fix SVG show-extents: flush path before next glyph

Free-form draw ops (extents overlay rectangles/circles) emitted
via hb_vector_draw_get_funcs() accumulate in draw->path.  But
the SVG glyph emission clears draw->path when drawing each new
glyph outline, discarding the overlay from the previous glyph.

Flush any accumulated path data to body (wrapped in the Y-flip
<g>) before clearing for the next glyph outline, so overlays
for all glyphs survive to the final SVG.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Behdad Esfahbod committed 2026-04-16 17:17:58 -06:00
1 parent d1bb9a595c
commit 8ed9cc3ff5
1 file changed
+8
+8
View File
@@ -647,6 +647,14 @@ hb_vector_draw_glyph_or_fail (hb_vector_draw_t *draw,
case HB_VECTOR_FORMAT_SVG:
{
if (draw->path.length)
{
hb_buf_append_str (&draw->body, "<g transform=\"scale(1,-1)\"><path d=\"");
hb_buf_append_len (&draw->body, draw->path.arrayZ, draw->path.length);
hb_buf_append_str (&draw->body, "\"/></g>\n");
draw->path.shrink (0);
}
if (!hb_set_has (draw->defined_glyphs, glyph))
{
draw->path.clear ();