Skip to content

Follow HarfBuzz for the font metrics, and fix vhea and empty glyphs - #419

Merged
blikblum merged 2 commits into
foliojs:masterfrom
lineto:fix/vertical-and-typo-metrics
Oct 26, 2026
Merged

blikblum merged 2 commits into
foliojs:masterfrom
lineto:fix/vertical-and-typo-metrics

Conversation

@lehni

@lehni lehni commented Oct 26, 2026

Copy link
Copy Markdown
Contributor
  • Takes over vhea and glyf fixes #305 and Respect useTypoMetrics #306 by @StLyn4, rebased onto master in one commit with them as author; their glyf fix is left out, as master has its own
  • Take the ascent, descent and line gap from the typo metrics only when the font sets useTypoMetrics and from hhea otherwise, as HarfBuzz does, which also gives the vertical advance in fonts without vmtx
  • Read the vhea version as 32 bits, so the vertical metrics after it are no longer off by two bytes, and the maxp, post and vhea versions as 16.16 numbers, so post 2.5 decodes
  • Give empty glyph paths an empty box instead of an infinite one
  • Tests compare with HarfBuzz's values; Open Sans's space now gets HarfBuzz's vertical advance of 2789 instead of 2059

Vsevolod Volkov and others added 2 commits November 19, 2024 17:26
- Fix the vhea table structure
- Give empty glyphs zero coordinates instead of infinite ones
- Read the maxp, post and vhea versions as 16.16 version numbers
- Respect the useTypoMetrics flag for the font's ascent, descent and line gap, and add lineHeight
- Fix an undefined control box in the glyph metrics
- Use the typo metrics only when the font sets useTypoMetrics and the hhea metrics otherwise, with a positive ascent and a negative descent, as HarfBuzz does, instead of FreeType's fallbacks
- Drop lineHeight, which HarfBuzz doesn't have and clients can derive
- Expect HarfBuzz's vertical advance for Open Sans's space, which has no vmtx and doesn't set useTypoMetrics
- Add tests for the typo metrics, the vertical advance without vmtx, the vhea and maxp versions, and empty CFF glyph boxes, with HarfBuzz's values
@blikblum
blikblum merged commit 20418ac into foliojs:master Oct 26, 2026
3 checks passed
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