diff --git a/src/hb-vector-draw.cc b/src/hb-vector-draw.cc index 6c99a3ef5..be2e48399 100644 --- a/src/hb-vector-draw.cc +++ b/src/hb-vector-draw.cc @@ -484,15 +484,6 @@ hb_vector_draw_glyph_or_fail (hb_vector_draw_t *draw, hb_vector_extents_mode_t extents_mode) { - switch (draw->format) - { - case HB_VECTOR_FORMAT_SVG: - case HB_VECTOR_FORMAT_PDF: - break; - case HB_VECTOR_FORMAT_INVALID: default: - return false; - } - if (extents_mode == HB_VECTOR_EXTENTS_MODE_EXPAND) { hb_glyph_extents_t ge; @@ -517,69 +508,12 @@ hb_vector_draw_glyph_or_fail (hb_vector_draw_t *draw, } } - /* Flush any pending free-form path the caller accumulated - * via hb_draw_*() on hb_vector_draw_get_funcs() before this - * glyph clobbers the scratch buffer. Wrap the SVG case in - * the same scale(1,-1) Y-flip per-glyph applies, so - * the free-form coords share the glyph's coord system. */ draw->flush_path (); - - switch (draw->format) - { - case HB_VECTOR_FORMAT_PDF: - { - /* PDF: always inline. Pen and font coords are both Y-up. */ - hb_transform_t<> saved = draw->transform; - draw->transform = {1, 0, 0, 1, 0, 0}; - - hb_font_draw_glyph (font, glyph, hb_vector_draw_funcs_get (draw->format), draw); - draw->transform = saved; - - if (!draw->path.length) - return false; - - draw->flush_path (); - return true; - } - - case HB_VECTOR_FORMAT_SVG: - { - draw->flush_path (); - - draw->path.clear (); - { - hb_vector_path_sink_t sink = {&draw->path, draw->get_precision (), - draw->x_scale_factor, draw->y_scale_factor}; - hb_font_draw_glyph (font, glyph, hb_vector_svg_path_draw_funcs_get (), &sink); - } - if (!draw->path.length) - return false; - - float xx = draw->transform.xx; - float yx = draw->transform.yx; - float xy = draw->transform.xy; - float yy = draw->transform.yy; - float tx = draw->transform.x0; - float ty = draw->transform.y0; - - draw->body.append_str ("body.append_len (draw->path.arrayZ, draw->path.length); - draw->body.append_str ("\" transform=\""); - hb_vector_svg_append_instance_transform (&draw->body, - draw->get_precision (), - draw->x_scale_factor, - draw->y_scale_factor, - xx, yx, xy, yy, tx, ty); - draw->body.append_str ("\" fill=\""); - draw->body.append_svg_color (draw->foreground, true); - draw->body.append_str ("\"/>\n"); - draw->path.clear (); - return true; - } - - case HB_VECTOR_FORMAT_INVALID: default: - return false; - } + hb_font_draw_glyph (font, glyph, hb_vector_draw_get_funcs (draw), draw); + if (!draw->path.length) + return false; + draw->flush_path (); + return true; } /** diff --git a/test/vector/data/expected/basic/cff1.svg b/test/vector/data/expected/basic/cff1.svg index be4131b42..7f95e4387 100644 --- a/test/vector/data/expected/basic/cff1.svg +++ b/test/vector/data/expected/basic/cff1.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/vector/data/expected/basic/cff2-var-cntr.svg b/test/vector/data/expected/basic/cff2-var-cntr.svg index 197ca6844..549452ca7 100644 --- a/test/vector/data/expected/basic/cff2-var-cntr.svg +++ b/test/vector/data/expected/basic/cff2-var-cntr.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/vector/data/expected/basic/cff2-var-wght900.svg b/test/vector/data/expected/basic/cff2-var-wght900.svg index 4e2cd00bd..0ceb849d6 100644 --- a/test/vector/data/expected/basic/cff2-var-wght900.svg +++ b/test/vector/data/expected/basic/cff2-var-wght900.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/vector/data/expected/basic/default.svg b/test/vector/data/expected/basic/default.svg index 7da5392cc..3ae7671a8 100644 --- a/test/vector/data/expected/basic/default.svg +++ b/test/vector/data/expected/basic/default.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/vector/data/expected/basic/glyf-var-wght900.svg b/test/vector/data/expected/basic/glyf-var-wght900.svg index 1bdb94536..fd1be40f1 100644 --- a/test/vector/data/expected/basic/glyf-var-wght900.svg +++ b/test/vector/data/expected/basic/glyf-var-wght900.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/vector/data/expected/basic/glyf-vvar-ttb-wght900.svg b/test/vector/data/expected/basic/glyf-vvar-ttb-wght900.svg index 8d04b20a6..7637ec48d 100644 --- a/test/vector/data/expected/basic/glyf-vvar-ttb-wght900.svg +++ b/test/vector/data/expected/basic/glyf-vvar-ttb-wght900.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/vector/data/expected/basic/iran-nastaliq-y-offsets.svg b/test/vector/data/expected/basic/iran-nastaliq-y-offsets.svg index 4c1c05f68..7e652b183 100644 --- a/test/vector/data/expected/basic/iran-nastaliq-y-offsets.svg +++ b/test/vector/data/expected/basic/iran-nastaliq-y-offsets.svg @@ -1,10 +1,10 @@ - - - - - - - + + + + + + + diff --git a/test/vector/data/expected/basic/multiline.svg b/test/vector/data/expected/basic/multiline.svg index 30aade0d2..488e74b34 100644 --- a/test/vector/data/expected/basic/multiline.svg +++ b/test/vector/data/expected/basic/multiline.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/vector/data/expected/basic/ttb.svg b/test/vector/data/expected/basic/ttb.svg index faa56b403..b6c6f99e3 100644 --- a/test/vector/data/expected/basic/ttb.svg +++ b/test/vector/data/expected/basic/ttb.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/vector/data/expected/basic/upem-default.svg b/test/vector/data/expected/basic/upem-default.svg index 7da5392cc..3ae7671a8 100644 --- a/test/vector/data/expected/basic/upem-default.svg +++ b/test/vector/data/expected/basic/upem-default.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/vector/data/expected/varc/conditional-default.svg b/test/vector/data/expected/varc/conditional-default.svg index fcf59132c..9e0cac683 100644 --- a/test/vector/data/expected/varc/conditional-default.svg +++ b/test/vector/data/expected/varc/conditional-default.svg @@ -1,4 +1,4 @@ - + diff --git a/test/vector/data/expected/varc/conditional-wght840p3.svg b/test/vector/data/expected/varc/conditional-wght840p3.svg index 69b040a6f..0c1339d9e 100644 --- a/test/vector/data/expected/varc/conditional-wght840p3.svg +++ b/test/vector/data/expected/varc/conditional-wght840p3.svg @@ -1,4 +1,4 @@ - + diff --git a/test/vector/data/expected/varc/default.svg b/test/vector/data/expected/varc/default.svg index 7a81c91a5..9d4d057e6 100644 --- a/test/vector/data/expected/varc/default.svg +++ b/test/vector/data/expected/varc/default.svg @@ -1,5 +1,5 @@ - - + + diff --git a/test/vector/data/expected/varc/wght840p3.svg b/test/vector/data/expected/varc/wght840p3.svg index f0e6beb74..201339f79 100644 --- a/test/vector/data/expected/varc/wght840p3.svg +++ b/test/vector/data/expected/varc/wght840p3.svg @@ -1,5 +1,5 @@ - - + +