[subset] Drop degenerate VariationDevice records (#6286)

After instancing, GDEF maps all-zero delta rows to
HB_OT_LAYOUT_NO_VARIATIONS_INDEX. copy() still emitted a device with
the out-of-range varidx (0xFFFFFFFF), even though the delta is
already folded into the base value.

Drop the device in that case. gdef_partial_instance is marked
no_fonttools since fonttools keeps the dead device; the
empty_region_vardata and update_def_wght expected outputs are
regenerated.

Tested with: meson test -C build

Assisted-by: opencode
This commit is contained in:
artemkulyk authored and GitHub committed 2026-09-29 18:09:44 -06:00
1 parent 897f2e0e2c
commit 82ec48207b
10 files changed
+10

No files matched your search

+5
View File
@@ -5291,6 +5291,11 @@ struct VariationDevice
hb_pair_t<unsigned, int> *v;
if (!layout_variation_idx_delta_map->has (varIdx, &v))
return_trace (nullptr);
/* The varidx was mapped to "no variations" during instancing (e.g. the
* instantiated row is all zeros). Drop the device instead of emitting one
* with an out-of-range varidx. */
if (hb_first (*v) == HB_OT_LAYOUT_NO_VARIATIONS_INDEX)
return_trace (nullptr);
c->start_zerocopy (this->static_size);
auto *out = c->embed (this);
@@ -13,3 +13,8 @@ wght=300
IUP_OPTIONS:
Yes
No
# fonttools keeps variation devices whose instantiated delta row is all zeros
# as devices with an out-of-range varidx (0xFFFFFFFF); HarfBuzz drops them.
OPTIONS:
no_fonttools