One idea at a time · 3

The baseline is measured, never computed.

Browsers quantise font metrics. A baseline computed from fontBoundingBoxAscent lands a fraction of a pixel out — the same fraction on every line, which is precisely the error a baseline grid cannot absorb. On this machine it measured 0.505 px per line before we stopped computing.

So the library renders one hidden probe per font, asks the browser where it actually put the baseline, and caches the answer. Below, live text is set on a baseline grid drawn in red, and each line's true baseline is measured back out of the DOM. The number is the worst deviation found, right now, in your browser.

Every red hairline is a slot in the lattice; every line of text stands on one. This is the page's own self-test, not a screenshot of one — select the text if you doubt it.

Next: what chooses among the good pages →