Skip to content

[instantiator] Fix assertion error in instantiator with sparse/virtual masters#983

Merged
anthrotype merged 2 commits into
mainfrom
fix-instantiator-sparse-master-assertion
May 19, 2026
Merged

[instantiator] Fix assertion error in instantiator with sparse/virtual masters#983
anthrotype merged 2 commits into
mainfrom
fix-instantiator-sparse-master-assertion

Conversation

@anthrotype
Copy link
Copy Markdown
Member

Fix AssertionError in _generate_instance_info when generating instances at non-default locations in designspaces with sparse or virtual masters (where collect_info_masters can yield a single default info master despite multiple non-default sources)
Gate the single-master fontinfo inheritance path on both is_static_font() and is_at_default, so that non-default instances fall through to the multi-master path, which correctly skips instance-specific attributes

Fixes #981

Designspaces with sparse or virtual masters can have multiple sources
at different locations but only the default source carries fontinfo.
collect_info_masters() skips non-default layer-only sources, so
info_mutator ends up with a single master and is_static_font() returns
True. Generating an instance at any non-default location then trips
`assert all(v == 0.0 for v in location_normalized.values())` in
_generate_instance_info.

This commit only adds the regression test; the fix follows in the
next commit.

#981
…ation

The single-master path in _generate_instance_info copies ALL
fontinfo.plist attributes (including instance-specific ones like
postscriptFontName, styleName, openTypeNameUniqueID) from the default
source. That's only safe when the instance is actually at the default
location. Designspaces with sparse or virtual masters can have a single
info master but generate instances at non-default locations, which used
to trip the assertion guarding this branch.

Tighten the gate to require both is_static_font() AND
location_normalized == default. Sparse-master cases at non-default
locations now fall through to the multi-master path, which correctly
skips instance-specific attributes; VariationModel with one master at
the origin returns the master's values at any location, so the
extractInfo call is a no-op there.

Fixes #981
@anthrotype anthrotype requested a review from simoncozens May 19, 2026 14:13
@anthrotype anthrotype merged commit aed50f0 into main May 19, 2026
10 checks passed
@anthrotype anthrotype deleted the fix-instantiator-sparse-master-assertion branch May 19, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

info_mutator and sparse/virtual masters

2 participants