Skip to content

Add MVAR support - #420

Open
lehni wants to merge 2 commits into
foliojs:masterfrom
lineto:feature/mvar
Open

lehni wants to merge 2 commits into
foliojs:masterfrom
lineto:feature/mvar

Conversation

@lehni

@lehni lehni commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
  • Read the MVAR table and vary the ascent, descent, line gap, cap height, x-height and underline metrics of a variation by their deltas, whichever table each metric comes from, as HarfBuzz does
  • Pierre-Henri Toussaint wrote the MVAR support; the last commit is my follow-up
  • Tests use HarfBuzz's values for Playwrite and Recursive, two OFL fonts from HarfBuzz's test suite, and Mada

ptoussai and others added 2 commits October 18, 2026 22:16
- Read the MVAR table and compute its adjustments for a variation of the font
- Apply them to the typo ascent, descent and line gap, the cap height and the x-height
- Vary each metric by its MVAR delta whichever table it comes from, so fonts without useTypoMetrics also vary their ascent, descent and line gap, as HarfBuzz does
- Vary the underline position and thickness too
- Fall back to the ascent for the cap height without calling the metrics again, which recursed in fonts without OS/2
- Add tests with Playwrite, Recursive and Mada, with HarfBuzz's values, and one that variations don't share glyphs requested with other code points
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