Rounding relative charstring operands independently accumulates errors,
opening contours and displacing stem hints after instancing. Track
absolute outline coordinates and stem edges, round their defaults and
surviving variation deltas, then emit relative operands again.
Preserve compact path operators. Conservatively retain relative rounding
for every glyph containing flex1, avoiding variation-dependent direction
analysis. Leave charstrings without blends unchanged.
Add a generated regression font covering closed contours, compact curves,
flexes, masks, and fractional static operands. Check full and partial
instances, contour closure, point accuracy, and the flex1 fallback. Refresh
the existing serialized CFF expectations.
Testing: the complete Meson suite passes (294 passed, one skipped), as do
the CFF2 API tests under ASan and UBSan.
See-also: https://github.com/fonttools/fonttools/pull/4338
Assisted-by: OpenAI Codex
The scalar cache stores floats, so computing uncached tuple scalars and
instancer deltas as doubles made results depend on whether the cache was
used. Restore single-precision calculations throughout the instancer and
update the affected CFF2 partial-instancing fixtures.
The current glyf partial-instancing comparison still matches fontTools,
so it does not need a new no_fonttools opt-out.
Fixes: https://github.com/harfbuzz/harfbuzz/issues/6423
Assisted-by: OpenAI Codex <codex@openai.com>
- Dissolve private-dict blends of VarDatas unused by any retained
charstring: under retain-gids, fdmap keeps FDs of hole glyphs the
usage pass never scanned, and their dicts were rewritten against a
dead transform.
- Take the partial path even when the store has regions but no
VarData subtables; the verbatim-copy fallback emitted a region list
whose axisCount contradicted the subsetted fvar (OTS-rejected).
- Make the usage pass honor drop-hints, so VarDatas referenced only by
hint blends don't survive as bloat.
- Require an actual instancing request for the pinned path: a face
without fvar plus a reused subset input made all_axes_pinned
spuriously true.
- Error-compensate the fold rounding across private-dict operators:
most blended dict values are delta-encoded, so independently rounded
folds accumulated in the decoded absolutes (blue zones drifted by
~0.5 per element); now every absolute is within 0.5 of exact.
- Clarify HB_SUBSET_FLAGS_DOWNGRADE_CFF2 doc: it applies to fully
pinned instancing.
Expected test outputs regenerated for the private-dict rounding
change.
Range limiting, pin-one-keep-one, a moved default, and axis dropping,
on AdobeVFPrototype. Expected outputs are hb-subset's own (fontTools
TTX comparison does not apply to CFF2 charstring encodings); they were
verified geometrically against both the original font and fontTools
varLib.instancer output at a grid of locations in the kept ranges.