FontMetrics
FontMetrics copied to clipboard
A lightweight JavaScript library for computing accurate font metrics such as x-height, cap height, ascent, descent and tittle for any loaded web font.
By default `S` is chosen for measuring cap height, but in fact `S` height includes overshoot:  `H` or `I` would be more reliable default.
Take 48px Roboto font. `fontMetrics` gives `74` pixels line-height (or `top - bottom`) value: ```js let fontMetrics = require('fontmetrics') let m = fontMetrics({ origin: 'top', fontFamily: 'Roboto', fontSize: 48 })...
Would be nice to have canvas2d baselines values: `hanging`, `middle`, `alphabetical`, from https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textBaseline. For `median`/`middle`, see https://en.wikipedia.org/wiki/Baseline_(typography).
https://en.wikipedia.org/wiki/Overshoot_(typography) Would be nice to have its value too