Remove support for rendering glyphs whose source is the OpenType
SVG table, in both hb-raster and hb-vector. SVG is a large format
and our in-tree parser/renderer was half-finished; the complexity
was not justified by the partial coverage.
This is source-side only: hb-vector's SVG *output* backend (used
to serialize outline / COLR glyphs to SVG) is unaffected. Fonts
that have an SVG table will still load; glyphs served only by that
table will not render from these libraries.
hb-raster:
- Delete the hb-raster-svg-* file cluster (11 .cc/.hh files plus
hb-raster-svg.hh: parse, base, bbox, clip, color, defs,
defs-scan, fill, gradient, parse, render, use, context).
- Drop svg_glyph/svg_font/svg_palette state from
hb_raster_paint_t and the HB_PAINT_IMAGE_FORMAT_SVG branch in
the image callback.
- Drop hb_raster_paint_push_clip_path + hb_raster_svg_path_func_t
(only used from the SVG renderer).
- Drop zlib dependency (gzip decompression was only used for the
SVG table reader; libpng brings its own zlib linkage for PNGs).
hb-vector:
- Delete hb-vector-svg-subset.{cc,hh} (extracted font-SVG glyph
for embedding in SVG output).
- Remove the HB_TAG('s','v','g',' ') branch from the image paint
callback; PNG embedding remains.
- Drop svg_image tracking state from hb_vector_paint_t
(current_color_glyph_has_svg_image, current_svg_image_glyph,
current_face, svg_image_counter, subset_body_scratch).
- Simplify the color-glyph cache to store just def_id instead of
packed (def_id, image_like).
- Drop hb_svg_append_image_instance_translate.
Build wiring: src/meson.build, CMakeLists.txt, harfbuzz-world.cc
updated to match. Test suite: remove SVG-specific cases from
test/api/test-raster.cc and the handwriting-{svg,picosvg} vector
tests + expected fixtures.
~5700 LOC deleted, ~10 LOC added. Full test suite (240 tests)
passes.
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adding tests
test/vector validates hb-vector CLI output by comparing exact stdout with
golden files.
Test file format (data/tests/*.tests)
Each non-empty, non-comment line has 4 semicolon-separated fields:
font-file;options;unicodes;expected-file
font-file: relative to the.testsfile (or absolute path).options: shell-split arguments passed tohb-vector.unicodes: Unicode sequence, using shape-style codepoint format (for exampleU+0061,U+0062,U+0063).expected-file: path to golden output, relative to the.testsfile. This is also used as the TAP test name.
Example:
../../../api/fonts/Roboto-Regular.abc.ttf;--font-size=64;U+0061,U+0062,U+0063;../expected/basic/reuse-svg.svg
Running vector tests
In an in-tree build:
meson test -C build-default -v --suite vector
Updating expected output
Regenerate a golden file with the current hb-vector binary and replace the
file under data/expected/.
Recording a new test case
Use record-test.sh:
./record-test.sh -o data/tests/basic.tests --test-name reuse-svg ../../build-default/util/hb-vector ../api/fonts/Roboto-Regular.abc.ttf --font-size=64 abc
It subsets the input font, verifies subset-vs-original rendering with
hb-view, stores the subset font under ../fonts/<sha1>.ttf (relative to the target
.tests file), writes expected output under
../expected/<tests-stem>/<test-name>.<ext> by default (unless
--expected-dir or --expected-file is provided), and
appends one test line to the target .tests file. hb-shape, hb-view, and
hb-subset are resolved as sibling executables next to the provided
hb-vector binary. The emitted test line uses Unicode codepoint input in the
unicodes field.