Skip to content

Fix broken test fixtures: Bold instances missing weightClass#1963

Merged
anthrotype merged 1 commit intomainfrom
fix-test-fixtures-missing-weightclass
Apr 16, 2026
Merged

Fix broken test fixtures: Bold instances missing weightClass#1963
anthrotype merged 1 commit intomainfrom
fix-test-fixtures-missing-weightclass

Conversation

@anthrotype
Copy link
Copy Markdown
Member

@anthrotype anthrotype commented Apr 16, 2026

Several test fixtures have Bold instances with isBold = 1 but no explicit weightClass. Without it, the heuristic in Instance::new defaults the wght user-space value to 400 — same as Regular — so both instances claim the same user coordinate. However, when building these with fontmake/glyphsLib the fonts are malformed with the wght axis collapsing to min=max=400, and the Bold master effectively discarded.

fontc's add_if_new happens to mask the problem by silently dropping the conflicting entry, but that's not how fontmake and glyphsLib do.

I noticed this while working on a fix for #1866.
The fix I am working on (where I match glyphsLib's last-win overwrite semantics) surfaces these malformed test fonts, and I wanted to fix these separately to make the diff less noisy in the next PR.

To recap the changes:

  • Added the correct weightClass to all affected Bold instances in:

    • WghtVar_Instances.glyphs
    • InstancePostscript.glyphs
    • InstanceNoPostscript.glyphs
  • Also fixed IntermediateLayer.glyphs where "Tall Caps Black" had interpolationWidth=700 (wght design) but weightClass=Black (wght user=900), conflicting with "Black" which also maps user=900 -> design=900. glyphsLib would overwrite the mapping to {900: 700}, breaking the axis. Changed to interpolationWidth=900 for consistency.

Several test fixtures have Bold instances with `isBold = 1` but no
explicit `weightClass`. Without it, the heuristic in Instance::new
defaults the wght user-space value to 400 — same as Regular — so both
instances claim the same user coordinate. This makes the fonts
malformed: fontmake/glyphsLib produce degenerate output for them too
(e.g. wght axis collapses to min=max=400, Bold master effectively
discarded). fontc's `add_if_new` happened to mask the problem by
silently dropping the conflicting entry.

Add the correct weightClass to all affected Bold instances:
- WghtVar_Instances.glyphs (g2, g3, g2-pkg, g3-pkg)
- InstancePostscript.glyphs (g2, g3)
- InstanceNoPostscript.glyphs (g3)

Also fix IntermediateLayer.glyphs where "Tall Caps Black" had
interpolationWidth=700 (wght design) but weightClass=Black (wght
user=900), conflicting with "Black" which maps user=900→design=900.
glyphsLib overwrites the mapping to {900: 700}, breaking the axis.
Changed to interpolationWidth=900 for consistency.
@anthrotype anthrotype added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit a328ec6 Apr 16, 2026
13 checks passed
@anthrotype anthrotype deleted the fix-test-fixtures-missing-weightclass branch April 16, 2026 13:42
anthrotype added a commit that referenced this pull request Apr 16, 2026
Same issue as 2c2ad47 — Bold instances with `isBold = 1` but no
explicit `weightClass`, causing wght user-space value to default to 400.
These were missed in the first pass on #1963 because I didn't run
the full test suite...
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.

2 participants