Sub topic 3
Where kerning lives: pair tables inside the font
This chapter assumes you know what a glyph and a sidebearing are, and that kerning means adjusting the space between specific letter pairs. Here you will see where those adjustments are stored and how they reach the screen.
Kerning is data in the font
A font file does not only hold letter shapes. It also holds a list of spacing exceptions. Each entry names two glyphs and gives a number. That list is the kerning pair table.
A pair entry has three parts:
- The left glyph, for example
A. - The right glyph, for example
V. - An adjustment in font units, for example
-80.
Font units are a grid set by the font's units per em (UPM). Many fonts use 1000 and many TrueType fonts use 2048. At 1000 UPM, -80 means 0.08 em tighter. A negative value pulls the pair together. A positive value pushes it apart.
GPOS and the legacy kern table
Modern fonts store kerning in the GPOS table (glyph positioning). It holds pair adjustment lookups that the kern feature switches on. Older TrueType fonts used a separate table, also named kern. Current text engines read GPOS first. Many fonts still ship both tables for compatibility.
The browser or design app does this at layout time. The font never moves glyphs itself. It only supplies the numbers.
Pairs and classes
A font with 500 letters would need 250,000 possible pairs. Designers avoid listing them all by grouping glyphs into classes. A, Á, Â, and Ä share the same left and right shapes, so they can sit in one class. A single class-to-class rule then covers every accented version of A followed by V.
Specific pairs override class rules. A designer can set a class value and then correct one troublesome pair by hand. Because of this layering, the same two letters can kern differently in two fonts, or even in two weights of one family.
Seeing the table at work
You cannot edit a font's table from CSS, but you can switch it on or off. This makes the effect visible.
body {
font-kerning: normal;
}
.kerning-off {
font-kerning: none;
}Put the same word in two elements, one with each class. Pairs such as AV, To, and Ty will look looser with kerning off. If nothing changes, either the font has no kerning data for that pair or the browser applies kerning regardless of the setting. A font-kerning: auto value lets the browser decide, and many browsers kern by default. You can also address the feature directly:
.kerning-off-low-level {
font-feature-settings: "kern" 0;
}What the table cannot do
The table only knows glyph pairs. It cannot see a word's overall shape, and it cannot adapt to size. A value tuned at text size can look too loose in a 120 px headline. Kerning also stops at word spaces, so it does not help the gap between words. Later chapters cover optical and manual kerning, which fill these gaps.
Exercise
A font has 1000 UPM and its kern feature gives the pair "T" followed by "o" a value of -60. What is that adjustment in em, and does it tighten or loosen the pair?
Show answer
-60 / 1000 = -0.06 em. The value is negative, so it tightens the pair, pulling "o" closer to "T".