Sub topic 8
Why the typeface changes the answer
This chapter assumes you know the guideline values from the earlier chapters. Those are a measure of roughly 45 to 75 characters and body leading of roughly 1.4 to 1.6 times the font size. You should also be comfortable with font-family, font-size and line-height in CSS.
Those ranges are starting points. Two fonts set at the same size, on the same measure, with the same line-height, can look quite different on the page. One looks airy and the other looks cramped. This chapter explains why, and how to adjust for it.
Font size is not the size of the letters
The font-size property sets the height of the em box. That is the box the designer drew each glyph inside. It does not set how tall the letters look. Each typeface draws its letters at its own proportion inside that box.
Leading is measured from baseline to baseline. A line-height of 1.5 at 16px gives 24px between baselines in every typeface. How much white space that leaves between the lines depends on how much of the 24px the letters fill.
The features that change how leading looks
Several features of a typeface change the apparent density of a line.
x-height
The x-height is the height of lowercase letters such as x, a and e, measured from the baseline. Most of a paragraph is lowercase, so x-height controls how much of each line is filled with ink.
- A large x-height gives a dense, tall band of text. The gap between one line's descenders and the next line's tops of letters gets narrow. These faces usually need more leading.
- A small x-height leaves more room above and below the main body of the letters. The same
line-heightlooks looser, and slightly less leading often works.
x-height is usually given as a ratio of the font size. Verdana is around 0.55, Georgia around 0.48 and Times New Roman around 0.45. These values are approximate and vary by font version.
Ascenders and descenders
Ascenders are the strokes that rise above the x-height, as in b, d and l. Descenders drop below the baseline, as in g, p and y. In some faces these strokes are long. With tight leading, the descender of one line can almost touch the ascender of the line below. This is a second reason a face with long extenders needs more room, even if its x-height is modest.
Letter width
Wide faces such as Verdana fit fewer characters into a given width than narrow faces such as Times New Roman. Wide faces also have long horizontal runs of letters. Long horizontal runs make it harder for the eye to track back to the start of the next line, so wide faces usually benefit from more leading. The ch unit helps with measure. One ch is the width of the zero glyph in the current font. A max-width of 65ch therefore adapts to the typeface in use. It does not adapt leading, though.
Weight and stroke contrast
Heavy strokes make a line look darker, and a darker line needs more space around it. Light and thin strokes look paler, so tighter leading holds together better. High-contrast faces, which mix very thick and very thin strokes, can break up at small sizes. Their hairline strokes may nearly vanish, so extra leading does not rescue them. A sturdier face or a larger size does.
Summary table
| Typeface feature | Effect on the page | Leading adjustment |
|---|---|---|
| Large x-height | Dense, tall lines | Add leading |
| Small x-height | Open, light lines | Reduce slightly |
| Long ascenders and descenders | Extenders come close to neighbouring lines | Add leading |
| Wide letterforms | Long horizontal runs, harder return sweep | Add leading |
| Heavy weight | Dark texture | Add leading |
| Light weight | Pale texture | Reduce slightly |
A decision flow
The flow gives a first estimate only. The final step, checking by eye, is the one that decides the value.
Setting leading per typeface in CSS
Keep one shared default, then override it where the typeface differs. Use unitless values, as covered earlier, so the leading scales with each element's own font size.
:root {
--leading-base: 1.5;
}
body {
font-family: Georgia, serif;
font-size: 1rem;
line-height: var(--leading-base);
}
/* Wide, large x-height sans serif: open it up. */
.ui-text {
font-family: Verdana, sans-serif;
line-height: 1.6;
}
/* Small x-height, light serif: slightly tighter. */
.essay {
font-family: "Times New Roman", Times, serif;
line-height: 1.45;
}Define the override next to the font-family it belongs to. If someone changes the font and forgets the leading, the mismatch is easy to see in one place.
Fallback fonts change the density too
A web page rarely uses a single font. If your preferred font is still loading, or fails, the browser uses the next font in the stack. If the fallback has a different x-height, the paragraph changes appearance, even though your CSS has not changed. Your carefully tuned leading is now applied to a face with different proportions.
The font-size-adjust property helps. It scales each font in the stack so that its x-height matches a given ratio of the font size. Browser support has varied, so treat it as an enhancement and test in the browsers you target.
body {
font-family: "Source Serif 4", Georgia, serif;
font-size: 1rem;
font-size-adjust: 0.48;
line-height: 1.5;
}With this rule, a fallback that would normally look larger or smaller is scaled so that its lowercase letters are closer to 0.48 of the font size. Fallbacks then look more consistent, and one leading value fits them better. Note that font-size-adjust changes the used glyph size. The line box height still follows line-height, so check results in both the primary font and the fallback.
Other conditions that change the answer
- Small text. At small sizes, such as captions, a typeface with a small x-height becomes harder to read. Letters crowd together, and extra leading cannot fix that. Use a larger size or a face with a larger x-height first.
- All capitals. Capital letters have no descenders and few ascenders in the usual sense. The gaps between lines look large, so all-caps text often needs less leading. Long passages in all caps are still hard to read.
- Light text on a dark background. Light text on dark often looks bolder than the same text in dark on light. Many designers add a little leading or reduce weight for dark mode. Judge this by eye on your own screens.
- Variable fonts. If you adjust weight with
font-weighton a variable font, the apparent density changes with it. Re-check the leading at each weight you use.
A practical procedure
- Set the typeface, size and measure first.
- Start at
line-height: 1.5. - Look at the tallest letters and the descenders. If they nearly touch the next line, add 0.05 to 0.1.
- If the lines look like separate strips with gaps between them, reduce by 0.05 to 0.1.
- Test the fallback font, either by temporarily removing the primary font or by using the browser's font override tools.
- Repeat for each distinct weight or size you use for body text.
Small steps of 0.05 are enough. Changes smaller than that are rarely visible.
Exercise
A page uses a font with a large x-height at line-height: 1.5, and the lines look crowded. A teammate proposes switching to a light, small x-height font and keeping the 1.5 value unchanged. What should you expect, and what should you do?
Show answer
Expect the new font to look looser at 1.5, because its small x-height and light weight leave more white space between lines. Try a slightly lower value, such as 1.4 or 1.45, and check by eye. Also check the fallback font, since its x-height may differ, and consider font-size-adjust so the stack looks consistent.
Exercise
Why does a max-width: 65ch rule adapt to the typeface, while line-height: 1.5 does not?
Show answer
The ch unit is the width of the zero glyph in the element's current font, so a wider font makes the ch wider and the line holds fewer characters in the same number of pixels. Unitless line-height is only a multiple of the font size, and it knows nothing about x-height, weight or extender length, so you must adjust it for each typeface yourself.