Sub topic 1
How Letters Are Spaced by Default: Advance Widths and Sidebearings
Every font ships with built-in spacing. Before you adjust kerning or tracking, you need to know what that default is made of. This chapter covers the two numbers behind it: the advance width of each glyph and the sidebearings around its outline.
Prerequisites
This chapter assumes you already know these terms: typeface, font, glyph, baseline, and point size. It also assumes you have used a design tool such as Figma, Illustrator, or InDesign, or have written basic CSS. You do not need to have used a font editor. The chapter defines em, units per em, and the metric names as they come up.
The em square and font units
A font is drawn on an invisible grid. The height of that grid is the em square, and the number of grid units along one em is the font's units per em (UPM).
- Fonts with PostScript-style outlines (CFF, common in .otf files) usually use 1000 units per em.
- Many TrueType fonts use 2048 or 1024 units per em.
All glyph measurements are stored as whole numbers on this grid. To convert to a real size, divide by UPM and multiply by the font size:
size in px = units / UPM * font-sizeAn em is not a fixed length. At 16px type, 1em is 16px. At 64px type, 1em is 64px. This is why spacing described in em scales with the text.
Advance width: how far the pen moves
A text engine lays out a line by keeping an imaginary pen position on the baseline. It places each glyph with its origin at the pen. Then it moves the pen right by that glyph's advance width before placing the next glyph.
The advance width is not the width of the visible shape. It is the width of the glyph's whole slot, including empty space on both sides. In a TrueType or OpenType font this value is stored per glyph in the hmtx (horizontal metrics) table.
In a proportional font, each glyph has its own advance width. An "i" is narrow and an "m" is wide. In a monospaced font, every glyph has the same advance width, so a narrow "i" gets a lot of padding.
Sidebearings: the space built into each glyph
The empty space inside the slot has two parts:
- The left sidebearing (LSB) is the distance from the glyph's origin to the left edge of its ink.
- The right sidebearing (RSB) is the distance from the right edge of its ink to the end of the advance.
The three measurements always add up:
advance = LSB + ink width + RSBHere the ink width is xMax - xMin, the horizontal extent of the outline. If the glyph's origin sits at x = 0, then LSB = xMin and RSB = advance - xMax.
| Term | Meaning | Stored or derived |
|---|---|---|
| Advance width | Distance the pen moves after the glyph | Stored per glyph |
| Left sidebearing | Origin to left edge of ink | Stored (and equals `xMin`) |
| Right sidebearing | Right edge of ink to end of advance | Derived from advance and `xMax` |
| Ink width | `xMax - xMin` | Derived from the outline |
How the visible gap between two letters arises
The gap you see between two neighboring letters is the sum of two sidebearings:
gap = RSB of the left glyph + LSB of the right glyphNeither glyph knows about the other. Each carries its own padding, and the gap appears when the two slots sit next to each other. A type designer adjusts these numbers glyph by glyph until common combinations look evenly spaced.
Designers usually set the sidebearings against a reference shape:
- Straight-sided letters such as H, n, and l get larger sidebearings, because two vertical stems side by side need clear room.
- Round letters such as o and c get smaller sidebearings. A curve touches its bounding box only at a point, so the white space at the sides is larger than the numbers suggest, and less padding is needed to look balanced.
- Letters with open or diagonal sides, such as A, V, and T, get very small or even negative sidebearings.
This is a compromise. A fixed pair of sidebearings per glyph cannot be perfect for every neighbor. That limit is the reason pair-specific kerning exists, which the next chapters cover.
A worked calculation
The numbers below are made up to illustrate the idea. They are not taken from a real font. The font uses 1000 units per em.
const UPM = 1000;
const glyphs = {
H: { advance: 720, xMin: 80, xMax: 640 },
o: { advance: 560, xMin: 35, xMax: 525 },
};
function sidebearings(glyph) {
return { lsb: glyph.xMin, rsb: glyph.advance - glyph.xMax };
}
function gapUnits(left, right) {
return sidebearings(left).rsb + sidebearings(right).lsb;
}
function unitsToPx(units, fontSizePx) {
return (units / UPM) * fontSizePx;
}
const pairs = [
["H", "H"],
["H", "o"],
["o", "o"],
];
for (const [a, b] of pairs) {
const units = gapUnits(glyphs[a], glyphs[b]);
const px = unitsToPx(units, 16).toFixed(2);
console.log(`${a}${b}: ${units} units = ${units / UPM}em = ${px}px at 16px`);
}
// HH: 160 units = 0.16em = 2.56px at 16px
// Ho: 115 units = 0.115em = 1.84px at 16px
// oo: 70 units = 0.07em = 1.12px at 16pxTwo things stand out. The gaps differ between pairs, because sidebearings differ between glyphs. The gaps also scale with font size, because they are fixed fractions of the em. At 64px, the "HH" gap would be 10.24px.
Edge cases in sidebearings
Negative sidebearings
A sidebearing can be negative. The ink then extends past the edge of the advance slot. An italic "f" often has a descender or a hook that reaches over its neighbor, so its RSB is negative. Capital "T" and "V" in some fonts have a small or negative LSB and RSB. The glyph outline can overlap the neighbor's slot without the glyphs colliding.
Glyphs with no ink
A space glyph has an advance width but no outline. Its xMin and xMax do not exist, so its whole advance acts as empty space. The same is true of other invisible glyphs. Word spacing, covered later in this tutorial, builds on this fact.
Origins that are not at the left edge
The formulas LSB = xMin and RSB = advance - xMax hold only when the outline is positioned relative to an origin at x = 0. Font editors and font files use this convention. Some design tools show sidebearings using their own reference points, so check which edge a tool measures from before comparing numbers across tools.
Pixel rounding
Font units are exact, but screens are made of pixels. Some rendering systems round each advance width to a whole pixel at small sizes. Others use subpixel positioning and keep fractional advances. The same text can therefore be a little wider or narrower in different browsers and operating systems. If you compare spacing numbers, compare them at a large size or in font units, not in rounded pixels.
Why the defaults matter for your work
- Spacing is relative. Because the gap is a fixed fraction of the em, a font looks the same at any size until you intervene. Small and large text often need different spacing, which later chapters address.
- Default spacing is a compromise. Each glyph's sidebearings are tuned for an average neighbor, so some pairs look too open or too tight. Kerning corrects those pairs.
- Fonts differ. A font with a tight design has small sidebearings, and a font made for small sizes has generous ones. Two fonts at the same point size can look differently spaced even with no adjustments.
- Monospaced fonts hide the issue. All advance widths are equal, so the sidebearings of narrow letters absorb the difference. This is why monospaced text looks gappy around "i" and "l".
Summary of the model
- A glyph is drawn on an em grid with a fixed number of units per em.
- The advance width says how far the pen moves after the glyph.
- The left and right sidebearings are the padding between the origin and the ink, and between the ink and the end of the advance.
- The visible gap between two letters is the left glyph's RSB plus the right glyph's LSB.
- These numbers are fixed per glyph, so they cannot fit every pair equally well.
Exercise
A font has 2048 units per em. The glyph "n" has an advance width of 1200, xMin of 160, and xMax of 1040. Find its left and right sidebearings, its ink width, and the gap between two "n" glyphs in em and in pixels at 16px.
Show answer
LSB = xMin = 160 units. RSB = 1200 - 1040 = 160 units. Ink width = 1040 - 160 = 880 units, and 160 + 880 + 160 = 1200 confirms the advance. The gap between two "n" glyphs is RSB + LSB = 320 units. In em that is 320 / 2048 = 0.15625em. At 16px it is 0.15625 * 16 = 2.5px.
Exercise
The left sidebearing of "o" is 35 units and its right sidebearing is 35 units in a 1000-unit font, while "H" has sidebearings of 80 units on each side. Why is the "o" given smaller sidebearings than the "H", and why does this mean no single pair of values suits every neighbor?
Show answer
The round shape of "o" touches its bounding box only at the extremes, so the space beside the curve is already visually larger than the number suggests, and a small sidebearing looks balanced. The "H" has flat vertical stems that fill the full height, so it needs more padding to look evenly spaced. Because each glyph carries one fixed LSB and one fixed RSB regardless of its neighbor, pairs such as "H" next to "o" or "A" next to "V" cannot all look even. That is the problem pair kerning addresses.