foliojs/fontkit

OS/2 vs hhea font metrics for ascender/descender

null77 opened this issue · 0 comments

Quite a while ago this change:

9d1ffe4

Moved from using OS/2 to hhea metrics for ascender/descender/etc. I'm wondering if there's any record of what motivated this change?

For context, I'm trying to align the rendering output from PDFKit with a WebGL font library (https://www.npmjs.com/package/troika-three-text) and during my investigation I found that PDFKit and the troika text library disagree on these font metrics. This only affects some fonts, e.g. Trirong Regular (https://fonts.google.com/specimen/Trirong?query=trirong).

More context at protectwise/troika#320 . In particular the maintainer noted the library is consistent with the CSS spec and the MS OpenType format docs. Is fontkit potentially doing the wrong thing? Is there a different spec that fontkit uses for its metrics init?