Measuring Text

Typography Fundamentals

Course 1 ยท Chapter 3 ยท Measuring and Setting Text

In Typography Fundamentals 2 you learned to sort typefaces into families and classes. Choosing a typeface is only half the job, though: the same font can look elegant or exhausting depending on how it is set. Setting text means deciding how big the letters are, how long each line runs, how far apart the lines sit, and how tightly the letters are packed. Those four dials are what make a paragraph feel comfortable. This chapter gives you the units to measure them, the names of the dials, and sensible starting values for body text.

What was run, and what was not
The four Python scripts in this chapter were run on Windows with Python 3.14.0 and fontTools 4.63.0, reading the fonts that come with Windows. The output shown is exactly what they printed. The wrapping script uses a simple greedy line-breaker, not a real browser layout engine, so treat its line counts as estimates. The CSS snippets and live samples were not measured across several browsers.

The Units: Points, Picas, Pixels, Ems and Rems

Type has been measured since long before screens existed, so you meet two families of units. Print units come from metal type: the point (pt) and the pica (pc), where 1 pica is 12 points. Screen units are the CSS ones: the pixel (px), and the two relative units em and rem that scale with a font size rather than being fixed.

CSS defines these so that they fit together: 1 inch is 96px, and also 72pt, so 1pt is 1.333px and 1pc is 16px (check on MDN for the precise wording). Note that a CSS "pixel" is a reference unit and not always one physical dot on the screen, because high-density displays squeeze several device dots into one CSS pixel (check). So "16px" means a consistent, readable size across devices rather than a number of dots.

UnitKindWhat it is relative toTypical use
ptAbsolute1/72 inch (CSS: 1.333px)Print stylesheets, word processors
pcAbsolute12pt (CSS: 16px)Page layout, column widths in print
pxAbsolute (reference)The CSS reference pixelBorders, hairlines, fine details
emRelativeThe font size of the element itself (and, for font-size, the parent's)Spacing that should scale with the text
remRelativeThe font size of the root elementFont sizes and layout widths that follow the user's setting
chRelativeThe width of the digit 0 in the element's fontLine length (the measure)
%RelativeThe parent's valueFluid widths; line-height and font-size percentages

A small script prints the same sizes in several units, and shows the one trap with em: it compounds. If each nested element says font-size: 1.2em, every level is 20 percent bigger than its parent, so the sizes grow quickly.

"""CSS absolute units side by side, and rem/em against a root size. py units.py """ PX_PER = {"in": 96, "pc": 16, "pt": 96 / 72, "px": 1} # CSS fixes these ratios ROOT_PX = 16 # browser default for 1rem print(f"{'size':<10}{'px':>8}{'pt':>8}{'pc':>8}{'rem':>8}") for px in (12, 14, 16, 18, 20, 24, 32, 48): pt = px / PX_PER["pt"] pc = px / PX_PER["pc"] rem = px / ROOT_PX print(f"{str(px) + 'px':<10}{px:>8}{pt:>8.1f}{pc:>8.2f}{rem:>8.3f}") print() print("Nested em: each level multiplies the parent's size") size = float(ROOT_PX) for level in range(1, 5): size *= 1.2 print(f" level {level}: font-size 1.2em -> {size:.2f}px")
size px pt pc rem 12px 12 9.0 0.75 0.750 14px 14 10.5 0.88 0.875 16px 16 12.0 1.00 1.000 18px 18 13.5 1.12 1.125 20px 20 15.0 1.25 1.250 24px 24 18.0 1.50 1.500 32px 32 24.0 2.00 2.000 48px 48 36.0 3.00 3.000 Nested em: each level multiplies the parent's size level 1: font-size 1.2em -> 19.20px level 2: font-size 1.2em -> 23.04px level 3: font-size 1.2em -> 27.65px level 4: font-size 1.2em -> 33.18px

A browser's default root size is 16px (check), so 1rem is 16px unless the user has changed it. That last point is the reason to prefer rem for font sizes: if a reader raises their browser's default size to 20px because their eyes tire, 1rem becomes 20px and your whole page follows. A px font size ignores that preference. Compare the two:

/* Follows the reader's settings */ body { font-size: 1rem; } /* 16px by default, bigger if the user asked */ small { font-size: 0.875rem; } /* 14px by default, still scales */ h1 { font-size: 2.25rem; } /* 36px by default */ /* Ignores the reader's settings: avoid for text */ .fixed { font-size: 14px; }
Common mistake
Setting html { font-size: 62.5%; } so that 1rem equals 10px for easy sums. It is a popular trick, but it works against a reader who has chosen a larger default, and it makes every rem value that is not set explicitly look tiny (check). Keep the root at 100% and do the arithmetic once, in a stylesheet comment.

Dial 1: Font Size

There is no universal "right" size, because apparent size depends on the typeface. Remember the x-height from Typography Fundamentals 1: two fonts set at 16px can look quite different because one has a taller x-height and so looks bigger. Georgia and Times New Roman at the same size are a good example; Georgia looks larger. For web body text, 16px to 20px is a common comfortable range (check), and print body text is often set between 9pt and 12pt (check). Treat these as starting points, then judge by eye, at the real reading distance, on the real device.

Times New Roman, 18px

Hamburgefonstiv: the same size on paper, a different size to the eye.

Georgia, 18px

Hamburgefonstiv: the same size on paper, a different size to the eye.

Arial, 18px

Hamburgefonstiv: the same size on paper, a different size to the eye.

Dial 2: Line Length (the Measure)

The measure is the length of a line of text. If it is too long, the eye struggles to find the start of the next line after finishing one; too short, and the reader is forced to jump from line to line constantly, breaking the rhythm. A widely quoted guideline is about 45 to 75 characters per line, with around 66 as the ideal for single-column body text (check). The guideline is in characters, not pixels, because the number of pixels needed for 66 characters depends on the font and size.

The next script measures this for four fonts. It adds up the real advance widths (the hmtx table from Typography Fundamentals 2) for a sample sentence, divides by the number of characters to get the average letter width in ems, and works out how many pixels 66 characters need at 18px, and what that would be in ch units.

"""How wide is a comfortable line? Average letter width measured from real fonts. py measure.py """ from pathlib import Path from fontTools.ttLib import TTFont TEXT = ("Good typography is mostly invisible: readers notice the story, " "not the letters that carry it.") FONTS = {"Times New Roman": "times.ttf", "Georgia": "georgia.ttf", "Arial": "arial.ttf", "Consolas": "consola.ttf"} FONT_DIR = Path("C:/Windows/Fonts") SIZE_PX = 18 TARGET_CHARS = 66 # a common rule of thumb for body text (check) print(f"{'font':<16}{'avg em/char':>12}{'chars/540px':>13}{'px for 66':>11}{'~ch for 66':>12}") for name, filename in FONTS.items(): font = TTFont(FONT_DIR / filename) cmap = font.getBestCmap() hmtx = font["hmtx"] upm = font["head"].unitsPerEm total = sum(hmtx[cmap[ord(c)]][0] for c in TEXT) avg_em = total / len(TEXT) / upm zero_em = hmtx[cmap[ord("0")]][0] / upm # CSS "ch" is the width of 0 chars_in_540 = 540 / (avg_em * SIZE_PX) px_for_target = TARGET_CHARS * avg_em * SIZE_PX ch_for_target = px_for_target / (zero_em * SIZE_PX) print(f"{name:<16}{avg_em:>12.3f}{chars_in_540:>13.1f}{px_for_target:>11.0f}{ch_for_target:>12.1f}")
font avg em/char chars/540px px for 66 ~ch for 66 Times New Roman 0.382 78.6 453 50.4 Georgia 0.420 71.5 499 45.1 Arial 0.417 71.9 496 49.5 Consolas 0.550 54.6 653 66.0

Read the table row by row. A letter in Times New Roman averages 0.382 em, so 66 characters need only about 453px at 18px; Georgia, with its wider letters, needs about 499px. Consolas, a monospace font with a fixed 0.550 em per character, needs 653px. The lesson: the same character count takes different pixel widths in different fonts, so a fixed pixel width is a poor way to control the measure.

One more detail from the last column: ch is the width of the digit 0, and in Georgia that digit is unusually narrow because Georgia uses old-style figures (check), which is why the Georgia row says 45 ch and not 66. In a font where 0 is about as wide as an average letter, 66ch is a good rough starting point; in Georgia the digit is narrow and so 66ch would give noticeably fewer than 66 characters. This is another case where you should test with real text.

/* Let the text decide the width, not a magic pixel number */ .article { max-width: 66ch; /* around 66 characters per line, on wide screens */ margin-inline: auto; /* centre the column */ padding-inline: 1rem; /* breathing room on narrow screens */ }

max-width rather than width matters: on a phone the column simply fills the screen, and the line length falls to whatever fits (often around 35 to 45 characters, which is acceptable (check)). We return to small screens in Typography Fundamentals 7.

Dial 3: Leading (Line-Height)

Leading (pronounced "ledding") is the vertical distance from one baseline to the next. The name comes from the strips of lead that compositors placed between lines of metal type (check). In CSS it is the line-height property. The distance is not the gap between lines but the whole step, so a 16px font with line-height: 1.5 advances 24px per line; the extra 8px is split above and below each line.

line-height16px text steps byFeelWhere it fits
1.0 to 1.216 to 19pxTight, compactLarge headings, short labels
1.4 to 1.622 to 26pxComfortableBody paragraphs
1.8 and up29px and upLoose, airyLarge pull-quotes; can make a paragraph fall apart

Two rules of thumb help. First, longer lines need more leading, because the eye has further to travel back to the next line start. Second, bigger type needs less, because the gaps grow in proportion with the letters. A heading at 40px with 1.5 looks detached; at 1.15 it holds together.

Use a unitless number
Write line-height: 1.5, not 1.5em or 150%. A unitless value is inherited as a multiplier, so a child element with a different font size calculates its own line height. An em or percentage value is computed once on the parent and inherited as a fixed length, which can squash larger child text (check).

Does changing these dials really change the shape of a page? Here is a script that wraps a paragraph with real Georgia glyph widths, using a simple greedy rule (put each word on the current line if it fits, otherwise start a new line), and reports how many lines and how much height results for five different settings.

"""Estimate how tall a paragraph will be: greedy line wrap with real glyph widths. py wrap.py """ from pathlib import Path from fontTools.ttLib import TTFont PARAGRAPH = ("Typography is the craft of arranging type so that written language is " "legible, readable and pleasing when displayed. The size of the letters, " "the length of each line and the space between the lines all work together, " "and changing one of them changes the feel of the others.") FONT = TTFont(Path("C:/Windows/Fonts/georgia.ttf")) CMAP = FONT.getBestCmap() HMTX = FONT["hmtx"] UPM = FONT["head"].unitsPerEm def text_width(text, size): return sum(HMTX[CMAP[ord(c)]][0] for c in text) / UPM * size def wrap(text, size, measure): lines, current = [], "" for word in text.split(): trial = (current + " " + word).strip() if text_width(trial, size) <= measure: current = trial else: lines.append(current) current = word lines.append(current) return lines print(f"{'size':>5}{'measure':>9}{'line-h':>8}{'lines':>7}{'avg chars':>11}{'height px':>11}") for size, measure, lh in [(16, 640, 1.2), (16, 640, 1.5), (16, 400, 1.5), (16, 280, 1.5), (20, 400, 1.6)]: lines = wrap(PARAGRAPH, size, measure) avg = sum(len(l) for l in lines) / len(lines) height = len(lines) * size * lh print(f"{size:>5}{measure:>9}{lh:>8}{len(lines):>7}{avg:>11.1f}{height:>11.0f}")
size measure line-h lines avg chars height px 16 640 1.2 4 67.5 77 16 640 1.5 4 67.5 96 16 400 1.5 5 53.8 120 16 280 1.5 8 33.2 192 20 400 1.6 7 38.1 224

Compare the rows. Going from line-height 1.2 to 1.5 on the same 640px measure leaves the paragraph at four lines but grows its height from 77px to 96px. Narrowing the measure from 640px to 280px at the same 16px size turns four lines into eight, and the paragraph doubles in height (96px to 192px), with only 33 characters per line, below the guideline. The last row, bigger text at 20px, shows how size, measure and leading are linked: raising one changes how much room the others need. You will rarely change just one dial.

Dial 4: Tracking and Kerning

The last two dials work on the horizontal space between letters, and they are often confused.

Tracking (letter-spacing)Kerning
What it changesThe space between all letters in a run of text, evenlyThe space between one specific pair of letters
Who sets itYou, in the stylesheetThe font designer, stored in the font file; the browser applies it
CSSletter-spacingfont-kerning (and font-feature-settings: "kern")
Example pairsNot applicable: it affects everythingAV, To, Te, LT (the shapes leave a hole that looks like extra space)

Compare a few settings on live text. Notice how pairs such as "AV" and "To" fit together when kerning is on, and how the headline in capitals reads better with a little added tracking:

Kerning off

AVATAR Toy

Kerning on (the default, usually)

AVATAR Toy

Capitals, tracking 0.12em

Quiet Harbour

Guidelines that hold up well: keep kerning on and leave it alone; use no tracking change on lowercase body text; add a little tracking (around 0.05em to 0.15em (check)) to all-capitals and to very small text; and avoid negative tracking on small text because the letters begin to touch. Specify tracking in em so it scales with the size. Never track out lowercase text to make it "look designed": it breaks the word shapes that readers recognise (check).

Does your font even have kerning data? A font file can hold kerning in the older kern table or, more commonly now, as a kern feature inside the GPOS table. This script checks four installed fonts.

"""Does this font file carry kerning data, and which tracking-style features does it offer? py kern.py """ from pathlib import Path from fontTools.ttLib import TTFont FILES = ["times.ttf", "arial.ttf", "georgia.ttf", "consola.ttf"] FONT_DIR = Path("C:/Windows/Fonts") print(f"{'file':<14}{'old kern table':>16}{'GPOS kern feature':>20}{'GPOS features (first 6)':>26}") for filename in FILES: font = TTFont(FONT_DIR / filename, lazy=True) has_kern_table = "kern" in font features = [] if "GPOS" in font: features = sorted({r.FeatureTag for r in font["GPOS"].table.FeatureList.FeatureRecord}) print(f"{filename:<14}{str(has_kern_table):>16}{str('kern' in features):>20} {', '.join(features[:6])}")
file old kern table GPOS kern feature GPOS features (first 6) times.ttf True True cpsp, kern, mark, mkmk arial.ttf True True cpsp, kern, mark, mkmk georgia.ttf False True cpsp, kern consola.ttf False False mark, mkmk

Times New Roman and Arial carry both; Georgia keeps its kerning only as a GPOS feature; and Consolas has none at all. That is sensible: in a monospace font every letter sits in an identical box, so there is nothing to adjust between pairs. It also shows kerning is a property of the font, not something the page adds. (The feature list also includes cpsp, capital spacing, which tells the browser it may add space automatically around capitals (check).)

Putting the Dials Together: A Body-Text Recipe

Here is a sensible starting stylesheet for a column of body text that applies everything so far. It is a starting point: change one value at a time and look.

body { font-family: Georgia, "Times New Roman", serif; font-size: 1.125rem; /* 18px by default: follows the reader's setting */ line-height: 1.55; /* unitless multiplier */ font-kerning: normal; /* keep the font's kerning on */ } .article { max-width: 62ch; /* about 60 to 66 characters per line (test it) */ margin-inline: auto; padding-inline: 1rem; } h1, h2 { line-height: 1.2; /* headings are bigger, so tighter */ } .kicker { /* small capitals label above a heading */ font-size: 0.8rem; letter-spacing: 0.1em; /* capitals and small text want a little tracking */ text-transform: uppercase; }
Change one dial at a time
If a paragraph "feels wrong", the cause is usually one dial out of balance rather than a bad typeface. Check in this order: measure (too wide?), leading (too tight for that measure?), size (too small to read comfortably?), then tracking. Fix the first problem, then look again before touching the next.

Hands-On Exercises

Three exercises: a code task that judges text settings, a written design task that diagnoses three problem paragraphs, and a CSS task that builds a complete text style. Each has a solution file that opens in a new tab.

Exercise 1

Write a script that takes a paragraph and a list of text settings (font, size in px, measure in px, line-height multiplier), wraps the paragraph with real glyph widths from Windows fonts (as the wrapping script above does), and prints for each setting the number of lines, the average characters per line, and a verdict: is the line length within 40 to 80 characters on average, and is the line-height between 1.3 and 1.8? Try it on three settings: one too wide and tight, one balanced, one too narrow and loose.

๐Ÿ“„ View solution
Exercise 2

Diagnose three paragraphs, and say which dial to turn and in which direction. (a) A news article set at 14px across a 1100px column with line-height: 1.1; readers lose their place at the end of each line. (b) A museum caption set at 22px in a narrow 200px column with line-height: 2, so each line holds only a few words. (c) A heading in capitals, 12px, with letter-spacing: -0.05em, on a leaflet; the letters seem to collide. Also convert two sizes by hand: 9pt to px, and 1.25rem to px with the default root.

๐Ÿ“„ View solution
Exercise 3

Write a stylesheet for a long-form article page. Use rem for font sizes, a measure in ch with max-width, a unitless line-height for body text and a tighter one for headings, a small-capitals label with added tracking, and kerning left on. Add a comment beside each line that says which of the four dials it controls and why you chose that value. Then add a media query that raises the body font size a little on very wide screens and say in a comment what else must change with it.

๐Ÿ“„ View solution

Chapter 3 Quick Reference

  • Units: 1in = 96px = 72pt; 1pc = 12pt = 16px; em is relative to the element's font size, rem to the root, ch to the width of the digit 0
  • Font sizes in rem so they follow the reader's browser setting; em compounds when nested
  • Size: apparent size depends on x-height; roughly 16 to 20px for web body text (check)
  • Measure: aim for about 45 to 75 characters per line (about 66 ideal (check)); control it with max-width in ch, and test with real text
  • Leading: line-height as a unitless number; about 1.4 to 1.6 for body, 1.0 to 1.2 for big headings; longer lines need more
  • Tracking (letter-spacing) changes all letters evenly: none for lowercase body text, a little for capitals and small text
  • Kerning adjusts specific pairs and lives in the font file: leave it on
  • The dials are linked: change one at a time and look again