* [instancer] Don't dedup VarStore rows when not optimizing
as_item_varstore dropped duplicate delta rows even with optimize=false,
where varidx_map is left empty and callers rely on original
VariationIndex values staying valid. HVAR/VVAR subsetting uses that
mode when the source table has an implicit (map-less) advance mapping:
any two glyphs sharing identical deltas shifted every following row, so
the synthesized identity map pointed at wrong rows and past the end of
the VarData — advances silently froze or took neighbors' deltas when
partially instancing such fonts (e.g. Source Han fonts).
Fixes https://github.com/harfbuzz/harfbuzz/issues/6068
* [subset] Drop identity advance maps for map-less HVAR/VVAR sources
When the source table uses implicit glyph-id indexing, the subsetter
synthesized an advance DeltaSetIndexMap whose content was the identity
over every output glyph — equivalent to the implicit indexing it
replaced, just bigger. Recognize that case in is_identity () and keep
the output map-less, like fontTools does. Sources that carry a real
map keep one, preserving their form; truncated maps don't qualify since
glyphs past their end share the last value.
retain-num-glyphs expected files regenerated: NotoSansJP-VF.subset.otf
is map-less, and its redundant identity map is now dropped (verified
against fontTools output).
* [test/subset] Test partial instancing of map-less HVAR
ImplicitHVAR.ttf carries an HVAR with implicit (map-less) advance
indexing and deliberately duplicated delta rows, the combination that
broke before the row-dedup fix: rows shifted or fell off the end of the
rebuilt VarData and advances silently froze. Expected outputs are
cross-checked against fontTools varLib.instancer + subset.
Add AdobeVFPrototype_vsindex.otf (already used by test/api): two
VarData subtables with distinct region sets and a charstring-level
vsindex, covering VarData pruning/renumbering, vsindex remapping and
the re-emitted charstring prefix.
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.
Used in conjunction with retain gids, when set the num glyphs from the input font will be preserved. Empty glyphs will be inserted as necessary to maintain the num glyphs value. Put under experimental for now.
The test file has been stripped of most tables to avoid checking in a very large font (since it has a high number of codepoints), which causes OTS to fail on missing required tables.
Fixes#5281. Does the closure by default, but I've introduced a new flag and option to disable this behaviour since some users may want to get the minimal set if they know they don't need the mirrored variants.
cmap14 subsetting code was not considering variation selectors in the input unicode set when deciding which variant glyphs to keep. This updates subsetting to only keeps variant glyphs if their variation selector code point is in the input unicodes set.
For https://github.com/harfbuzz/harfbuzz/issues/4911
When enabled the output subset conforms to the requirements for a base font to be patched by IFTB patches. IFTB is a proposed incremental font transfer patch. This new flag is set as experimental. Currently, setting this flag causes the output subset to also use long offsets for outline data in loca/glyf, gvar, CFF, and CFF2.
This change is a version of https://github.com/skef/harfbuzz/commit/3ae2fe2084d96f61d8ad1bbe42a6ef4e62ec830a rebased onto head w/ tests added.
ItemVariationStore is relying on the assumption that the inner_map is populated for all output glyphs, this is not true for subsetting operations with retain gids enabled. Fixes fuzzer timeout: https://oss-fuzz.com/testcase-detail/4575222591520768.