[instantiator] Fix assertion error in instantiator with sparse/virtual masters#983
Merged
Merged
Conversation
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
simoncozens
approved these changes
May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix
AssertionErrorin_generate_instance_infowhen generating instances at non-default locations in designspaces with sparse or virtual masters (wherecollect_info_masterscan yield a single default info master despite multiple non-default sources)Gate the single-master fontinfo inheritance path on both
is_static_font()andis_at_default, so that non-default instances fall through to the multi-master path, which correctly skips instance-specific attributesFixes #981