Blog

From 63 font sizes to 14: a design system the build enforces

Nobody decides to ship 63 font sizes. Each screen picks whatever looks right that day, and a year later your app has a dozen sizes no one can tell apart. Here's how Nemi got down to 14 whole-pixel steps, why the gaps widen above 20px, and why the build enforces the rule instead of a doc.

DesignUpdated 7 min read

Fig. 014 font size classes the build allows

When we counted, Nemi was using 63 different font sizes. Twelve of them were half pixels like 12.5px, 11.5px, and 13.5px. Nobody planned any of them. They crept in one screen at a time, each reasonable on the day it was written, leaving an interface where labels that should have matched almost did.

Today the app's font size classes are locked to 14 steps, and a build with anything else fails. This post covers both halves: the scale itself, and the small script that makes it stick. The script is what actually matters. We'd written down style preferences before, and a preference in a doc lasts about a month.

How does a product end up with 63 font sizes?

Nobody does it on purpose. Someone builds a sidebar and 13px looks a bit big, so they use 12.5px. A month later, someone builds a table next to it and eyeballs 12px. A dialog borrows from both. Every choice feels reasonable in isolation, yet none of them is a real design decision.

Colour had already escaped this trap because Nemi's colours come from one palette that each theme redefines. A component asks for a role, and the theme answers. Size, corner radius, and shadow had no system like that, so they drifted.

When the scale shipped, docs/DESIGN_SYSTEM.md recorded 63 font sizes, 33 corner radii, 20 one-off shadows, and 1,183 hand-written buttons.

For this post, we wrote a script to recount directly from commit e4912003, the last commit before the scale existed. It scans the exact same component files with the guard's own patterns, counting only explicit pixel classes so the measurement is repeatable. By that narrower count, there were 55 distinct sizes (13 of them half pixels), used 3,263 times. The button count matches the original tally exactly, confirming we're on the right commit.

Fourteen steps, and what they replaced

Selected step

14px

Line height
21px, which is 1.5 times the size
Step up from the one below
1.08 times 13px
What it is for
The default: everything unmarked

The highlighted band behind the letters is the line height: the space one line of this size takes up. Watch it get proportionally tighter as the type grows.

The ladder is read from app/globals.css, the sizes before from commit e4912003. Switch views, then drag through the old sizes to see which step each one became.
How we measured

scripts/blog-bench/design-scale/count.ts lists every .tsx file under components/ and app/ at commit e4912003 with git ls-tree, reads each with git show, and collects every text-[Npx] class with the guard's own regular expression. It found 378 files. Sizes written another way (inline styles, CSS files) are not counted, so this is not the same tally as the 63 recorded at the time.

The after state is the working tree on 2026-10-03. The ladder is every --nm-text-* and --nm-lh-* pair parsed from the stylesheet.

Why whole pixels only?

Because a half pixel buys nothing a reader can actually see. At normal weights, 12.5px text is indistinguishable from 12px or 13px on any screen we ship to: hinting and antialiasing swallow the difference.

All a half pixel really does is let a developer nudge one label without touching the label beside it. That's convenient while writing code, and irritating for everyone reading the screen, who sees two elements that almost match.

Removing them was also the easiest part of the cleanup. Every half step sits between two obvious whole numbers, and the guard prints the nearest valid step when it rejects a size. Fixing a violation is a one-word edit.

Why do the steps widen above 20px?

Because small type and large type do different jobs. Below 20px, adjacent steps sit 1.08 to 1.14 times apart. That tight ladder is deliberate: in a dense UI, a timestamp, a table cell, and a button label sit side by side and need to look distinct without shouting. A wider ratio down there turns a toolbar into a poster.

From 20px up, steps jump to 1.2 to 1.29 times apart. Display type isn't competing with a neighbouring label. It sets the hierarchy for the whole page, often over a photograph, and needs room to breathe. The ladder tops out at 88px for the main page headline.

Line height works the same way in reverse. Body text is 14px on a 21px line (a 1.5 ratio), matching the WCAG text spacing criterion and the sweet spot for running text. As type gets larger, the ratio tightens down to 86px on 88px at the top. Line spacing helps your eye find the start of the next line, and a short headline needs far less help than a paragraph of body copy.

How does the build enforce a design system?

With about 250 lines of TypeScript that run before every production build. The guard scans every component file and fails on four real problems we found in the codebase: an off-scale font size, an arbitrary corner radius, a raw shadow instead of an elevation token, and a hard-coded hex colour that duplicates our themed palette. The entire type rule is a single set:

scripts/check-design-tokens.ts
const TYPE_SCALE = new Set([11, 12, 13, 14, 16, 18, 20, 24, 30, 36, 44, 56, 72, 88]);

We made it a build failure instead of a lint warning because warnings only get read by people who already plan to ignore them. We use the same pattern for more serious rules too, like a build check that every write is role checked. You can't ignore a failing build, and it catches the issue in the exact file you're editing, naming the step to use instead.

A documented preference decays in a month. A build failure doesn't.

Real exceptions are allowed, with one rule: each one goes into a baseline file with a written reason. Today there are 9 entries, including 6 for type. Every type exception is a miniature picture of an interface rather than a real UI, like marketing mockups or tiny template previews where text is scaled down on purpose. An allowlist without reasons becomes a rubber stamp; having to justify an exception in writing usually convinces you to just fix the file instead.

55

font sizes at e4912003, by the narrow recount

14

font sizes in the interface today, outside the exempt mockups

13

half pixel sizes before

0

half pixel sizes now

What about corner radii and shadows?

They got the same treatment for different reasons. Corner radius is now a nine-step scale (2, 4, 6, 8, 12, 16, 24, and 32 pixels, plus fully round), designed to fix nested shapes. A rounded box inside another rounded box only looks right when the inner radius equals the outer radius minus the padding between them. With dozens of random radii, that only worked by luck. With the scale, it works by simple math: a 12px card with 4px of padding holds an 8px child, and a 16px panel with 4px of padding holds a 12px card.

Shadows became five elevation tokens, each pairing a tight dark contact shadow with a wide soft shadow lit from straight above. A single blur looks like a sticker; the pair looks like an object lifted off a surface. The same overhead lighting shades the ring around every profile photo. Because the tokens are theme-aware, raised cards stay visible in dark mode instead of vanishing.

At e4912003

  • 30 distinct arbitrary radii
  • 37 distinct hand written drop shadows
  • 205 uses of Tailwind's stock shadows

Today, outside the exempt files

  • 1 arbitrary radius, a per corner shape built from scale values, and a named step everywhere else
  • 0 hand written drop shadows
  • 0 stock shadows: five elevation tokens instead

What has the type scale not fixed?

Three things, plainly stated. First, exempt mockups still use their own scaled-down sizes, so the entire codebase (exceptions included) uses 28 sizes rather than 14. That's intentional, though it isn't zero.

Second, buttons: the design system includes a button component with focus rings, disabled states, and hit targets built in, yet raw button elements still appear 1,149 times. The guard doesn't block them because a raw button isn't wrong the way an off-scale size is, so we're migrating them screen by screen. Third, one hard-coded near-black ink still appears in several places and needs manual review.

None of that weakens the point. A scale is a vocabulary, and a vocabulary only works when it's the only one available. Every page on this site outside the product mockups and press kit uses these 14 steps, including the pricing page and the Docs page, enforced by the same script as the app. And if you need larger text than the scale provides, Nemi scales everything up together; see reading comfort and accessibility.

Questions people ask

How many font sizes should a design system have?

There's no universal number, but every size should have a clear job, and neighbouring sizes should look visibly different. Nemi uses 14 steps from 11 to 88 pixels. Before the scale existed, the app had 63 accidental sizes.

What is a type scale?

A type scale is a fixed set of font sizes, usually paired with line heights, that every screen picks from instead of inventing its own numbers. Nemi's steps are 11, 12, 13, 14, 16, 18, 20, 24, 30, 36, 44, 56, 72, and 88 pixels.

What ratio should a type scale use?

One ratio rarely works for both UI labels and big headlines. Below 20 pixels, Nemi's steps are 1.08 to 1.14 times apart so labels, table cells, and buttons stay distinct without shouting. From 20 pixels up, they widen to 1.2 to 1.29 times apart so display type has enough contrast to anchor a page.

Should I use half pixel font sizes?

There's little reason to. At normal weights, 12.5px text is almost impossible to tell apart from 12px or 13px because hinting and antialiasing swallow the difference. Half pixels mostly create labels that were meant to match and almost do, so Nemi uses whole pixels only.

What line height should body text have?

Around 1.5 times the font size is a solid starting point for running text, and it matches the WCAG text spacing criterion. Nemi's body text is 14 pixels on a 21 pixel line. Larger headings need less space, so our biggest headline sits on a line slightly shorter than its font size.

How do you enforce a design system in code?

Make breaking it fail the build instead of printing a warning. Nemi runs a script before every production build that rejects off-scale font sizes, arbitrary corner radii, raw shadows, and hard-coded colours already in the theme. Real exceptions go in a baseline file with a written reason.

Where the numbers come from

  • The scales, with the reasoning next to eachapp/globals.css (THE NEMI SCALES)
  • The short version, and the counts recorded when the scale shippeddocs/DESIGN_SYSTEM.md
  • The guard that fails the buildscripts/check-design-tokens.ts, run by scripts/ci-prebuild.ts
  • The exceptions and their written reasonsscripts/design-baseline.json
  • The recount in this postscripts/blog-bench/design-scale/count.ts, output in lib/blog/data/design-scale.json
  • The commit before the scalee4912003, parent of dc37de4d

Use the thing we write about.

Files, docs, sheets, mail, photos, calendar and meetings in one account, built the way this post describes. Nemi is opening in groups: put your name down and we tell you when yours is up.

15 GB free when you get in. No card needed.