Description
Return xHeight/capHeight and scale both design-unit heights by fontPixels/unitsPerEm.
Typography combines several distinct scales: font size describes an em scale, cap height describes a font metric, leading describes baseline spacing, and variable-font axes select design coordinates. Ratios between them require an explicit convention.
Return xHeight/capHeight and scale both design-unit heights by fontPixels/unitsPerEm.
When to use this tool
Use Type Cap Height Xheight Ratio when you need to compare supplied type metrics or font-axis values on a consistent basis.
How to use the tool and how it works
- Enter capHeight, xHeight, unitsPerEm, fontPixels. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read xCapRatio, capPixels, xPixels. Use the output convention below.
Require positive capHeight and unitsPerEm and nonnegative xHeight and fontPixels. Return xHeight/capHeight and scale both design-unit heights by fontPixels/unitsPerEm.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| capHeight | Cap Height | Required. Finite number; strictly above 0. |
| xHeight | X Height | Required. Finite number; minimum 0. |
| unitsPerEm | Units Per Em | Required. Finite number; strictly above 0. |
| fontPixels | Font Pixels | Required. Finite number; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| xCapRatio | X Cap Ratio | Required. Finite number. |
| capPixels | Cap Pixels | Required. Finite number. |
| xPixels | X Pixels | Required. Finite number. |
{
"input": {
"capHeight": 700,
"xHeight": 500,
"unitsPerEm": 1000,
"fontPixels": 20
},
"output": {
"xCapRatio": 0.7142857142857143,
"capPixels": 14,
"xPixels": 10
}
} Limitations and assumptions
- Font pixels describe the em size, not the cap height; metrics are supplied without reading a font, hinting, rasterization, or optical measurement.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Read actual font metrics and variation tables when available, then proof the text in its intended renderer. A metric calculation cannot replace shaping, glyph inspection, or an actual layout test.
References
Similar or alternative tools
- Type Size Leading Ratio
Convert both to points and return reciprocal type-size/leading ratios.
- Type Capheight Lineheight Share
Return cap/line share, ascender+descender occupiedHeight, and lineHeight minus that total.