# font-contrast Measured typographic metrics for 54 open-source font families — x-height, cap height and real lowercase advance width, read out of the font binaries rather than taken from vendor metadata. Google Fonts' API tells you a family's name and which weights exist. It does not tell you how large the letters actually are. That is the number you need to decide whether 16px of one face is comparable to 16px of another, and it is the number this dataset provides. **[Interactive version →](https://imgcolorpicker.org/font-contrast/)** — check any of these families against your own foreground and background colours. --- ## Findings ### 1. `OS/2.xAvgCharWidth` should not be trusted Fonts declare an average character width in their `OS/2` table. Compared against the mean advance over `a–z` measured from `cmap` → `hmtx`, that declared figure is frequently wrong: | family | declared | measured | off by | |---|---|---|---| | Poppins | 0.851 em | 0.561 em | **52%** | | Lobster | 0.594 em | 0.443 em | 34% | | Pacifico | 0.615 em | 0.459 em | 34% | | Roboto Condensed | 0.567 em | 0.441 em | 28% | | Dancing Script | 0.497 em | 0.389 em | 28% | It is also not discriminating. Five groups of families in this set declare an **identical** `xAvgCharWidth` while their real widths differ: | declared | families | real width differs by | |---|---|---| | 594 | Domine, Lobster | 0.113 em | | 540 | Cormorant Garamond, DM Sans | 0.087 em | | 513 | Barlow, Source Serif 4 | 0.023 em | If you are estimating how much text fits on a line, measure `hmtx`. Do not read `xAvgCharWidth`. ### 2. x-height varies by 74% across text faces Among the 47 non-display families, x-height as a fraction of the em runs from **0.332** (Dancing Script) to **0.578** (Oswald), median **0.506**. A CSS `font-size` is the em box, not the letters. Two faces set at the same px size can differ by nearly three quarters in the size of the lowercase a reader actually sees. ### 3. WCAG's large-text exemption is granted on the wrong number WCAG 2.x lets text drop from 4.5:1 to 3:1 — a third less contrast — once it reaches 24px at normal weight. That threshold reads the stylesheet, not the font. - Inter at 16px → **8.73px** of lowercase, and must meet the full 4.5:1 - EB Garamond at 24px → **9.60px** of lowercase, and is allowed 3:1 The Garamond letters are 10% larger, and for that they are permitted a third less contrast. The exemption is doing something other than what it appears to. ### 4. Seven families ship no true bold Abril Fatface, Anton, Bebas Neue, Lobster, Monoton, Pacifico, Righteous. Setting `font-weight: 700` on any of these gets a synthetic bold smeared by the browser, not a drawn one. 40 of the 54 families are variable fonts, so their weight range comes from the `fvar` axis rather than from separate files. --- ## The data [`data/fonts.json`](data/fonts.json) · [`data/fonts.csv`](data/fonts.csv) — 54 records. | field | meaning | |---|---| | `unitsPerEm` | `head.unitsPerEm`; every ratio below is normalised by it | | `xHeight`, `xHeightRatio` | `OS/2.sxHeight`, raw and per em | | `capHeight`, `capHeightRatio` | `OS/2.sCapHeight`, raw and per em | | `lcWidthMeasured`, `lcWidthMeasuredRatio` | mean advance over `a–z` from `cmap` → `hmtx` | | `xAvgCharWidthDeclared` | what the font claims in `OS/2`, for comparison | | `os2Version`, `usWidthClass` | `sxHeight` and `sCapHeight` require `OS/2` version 2+ | | `ascender`, `descender`, `glyphCount` | | | `variable`, `weightMin`, `weightMax`, `weights`, `axes` | weight range from `fvar` where present | | `hasTrueBold` | whether a real 700 exists, rather than a synthesised one | | `designer`, `category`, `licence`, `added`, `woff2Bytes` | | ## Method [`scripts/extract.py`](scripts/extract.py). Metrics come from the binaries: `head.unitsPerEm`, `OS/2.sxHeight` and `sCapHeight`, the `fvar` weight axis, and `cmap` format 4/12 resolved through `hmtx` for advance widths. Ratios are normalised to the em, since raw font units are not comparable across families with different `unitsPerEm`. ## Limits - 54 families, all OFL, all from Google Fonts. A sample, not a census. - One representative file per family. Optical sizes and italics are not covered separately. - `sxHeight` and `sCapHeight` are what the font declares. They are reliable in a way `xAvgCharWidth` is not, but they are still declared values — unlike `lcWidthMeasured`, which is measured here. - Findings describe this set. Treat them as a strong prior, not a law. ## Licence Data is [CC0 1.0](LICENSE) — public domain, no attribution required, though a link back is welcome. The measurements are facts about publicly available fonts. The font files themselves are **not** redistributed here. Each is OFL and available from [Google Fonts](https://fonts.google.com/). ## Citation > font-contrast: measured typographic metrics for 54 open-source families. > Tech Interval LLC. https://imgcolorpicker.org/font-contrast/