{"canonical_url":"https://engineer.company/glossary/font/","content_markdown":"# Font\n\n## What it is\n\nA font is a file holding glyphs, the drawn forms of characters, plus tables\nthat map characters to glyphs and provide spacing and layout metrics. A font\nserved by a site is a webfont. CSS selects a font face by properties such as\nfamily, weight and style; that face need not correspond to a separate file for\nevery combination. A static font file normally holds one weight and style,\nwhile a variable font file can cover ranges of weights and styles.\n\nTypographers keep the design and its files apart. Ubuntu is a typeface; Ubuntu\nLight and Ubuntu Bold Italic are fonts of it. CSS keeps the same split. A font\nfamily groups faces under one name, and each `@font-face` rule describes a\nsingle face: the family it joins, where to fetch it, the weight and style it\ncovers, the characters it can draw and what to show while it loads.\n\n```css\n@font-face {\n    font-family: \"Reading Serif\";\n    src:\n        local(\"Reading Serif Regular\"),\n        local(\"ReadingSerif-Regular\"),\n        url(\"/fonts/reading-serif-400.woff2\") format(\"woff2\");\n    font-weight: 400;\n    font-style: normal;\n    font-display: swap;\n}\n\nbody {\n    font-family: \"Reading Serif\", Georgia, serif;\n}\n```\n\nThe `font-family` property on an element is a list read from left to right. The\nspecification chooses a family and a face for each character in a run of text,\ntaking the first face that matches the requested weight and style and contains a\nglyph for that character. One line can therefore be set in two fonts when the\nfirst lacks a letter, and the generic name at the end of the list, `serif`,\n`sans-serif`, `monospace` or `system-ui`, means some installed font always takes\nthe remainder.\n\nOn the web the file is almost always WOFF2: the same OpenType or TrueType\noutlines and tables, repackaged for transfer and compressed with Brotli. Inside,\nthe `cmap` table maps each character code to a glyph, and other tables carry the\nnumbers a layout engine needs, such as ascent, descent, line gap and where an\nunderline sits and how thick it is. Those numbers decide line height and spacing\nas much as the letterforms decide the look.\n\n## Why it matters\n\nWith static fonts, each weight and style is normally a separate download. A\ndesign using regular, italic and bold static faces puts three files between a\nreader and the text set in them, and each adds bytes to the first visit. A\nvariable font may combine weights and styles in one file, but whether that\nreduces the bytes transferred depends on the files and faces needed.\nThe `unicode-range` descriptor lets a family\nbe split into pieces by script, and the specification forbids a browser from\ndownloading a piece for characters outside its range, so a page fetches only the\npieces its text uses.\n\nText in a webfont cannot be drawn before the file arrives, so the browser needs\na policy for the wait. The `font-display` descriptor sets it. With `block`, the\nspecification recommends a block period of 3s, during which the text is laid out\nbut drawn invisibly. With `swap`, the block period is 100 ms or less, the\nfallback font appears almost at once, and the webfont replaces it whenever it\nlands. With `fallback`, the swap window is short, with 3s recommended, after\nwhich the page keeps the fallback. With `auto`, the browser decides, and many\ntreat it like `block`.\n\nWhere the file lives matters too. Font requests use CORS, so a font on another\norigin loads only when that server allows it, and every request to another\ncompany's server tells it the reader's address and which site they are on.\nServing fonts from the site's own host removes both the extra connection and the\nobserver.\n\nA font is software under a licence. The SIL Open Font License allows use, study,\nmodification and redistribution as long as the fonts are not sold by themselves,\nand bars a modified version from using a reserved font name without permission.\nA font bought for print may carry different terms for the web, so read the\nlicence before the file goes on a server.\n\nCoverage is the last concern. A font draws only the characters its `cmap` lists.\nMost of the Cyrillic alphabet sits in the run U+0400–045F, but the Ukrainian\nletter ґ lives at U+0490–0491, so a subset or a range written for Russian text\nleaves it to whatever fallback comes next.\n\n## What it looks like in practice\n\nThe site's [credits page](/credits/) names the typefaces delivered to a\nreader's browser. Ubuntu, by Dalton Maag for\nCanonical, is under the Ubuntu Font Licence. Ubuntu Mono, the same family's\nfixed-width cut, sets the code. Shantell Sans, based on the artist Shantell\nMartin's felt-marker handwriting, is under the SIL Open Font License and writes\nthe margin notes. All three come from the site's own machine, and the page says\nwhy: a webfont from someone else's CDN is a third party watching you read.\nUbuntu Mono and Shantell Sans load only on the pages that carry code or a margin\nnote.\n\nSplitting one typeface by script is what\n[the Safari underline note](/notes/safari-underline-font-subset/) is about. The\nnote records an earlier Ubuntu arrangement with six pieces: three Latin weights\nand three Cyrillic weights, each declaring its character coverage. In that\narrangement, English and Danish prose used the Latin faces, while Ukrainian\nprose used the Cyrillic faces. All six\nshared one family name, and in Safari a face with a non-Latin range degrades\nskip-ink, the gap an underline leaves around a descender, for every character in\nits family, Latin text included. Deleting the three Cyrillic declarations at\nruntime took the measured gaps from 1.8/1.0/1.0px to 4.5/11.0/5.0px. The fix\ngave the Cyrillic faces a family name of their own and put it in the stack after\nUbuntu: three renamed declarations and one stack entry, with Chrome untouched\nand Ukrainian still set in Ubuntu at identical widths. The same note shows how\nmuch a font's own numbers vary: Ubuntu declares an underline thickness of\n0.056em for Light, 0.020em for Medium and 0.120em for Bold.\n\nThe landing page in front of the company's\n[own git forge](/portfolio/your-code-on-your-own-hardware/) had been a\nhand-maintained copy of the main site's design, and every difference found\nbetween the two was an accident rather than a decision. Two of the five were\nabout fonts: a font declaration that collapsed two weights to one on any machine\nwith the family installed, and a weight used with no font shipped for it. None\nof the five was visible in a screenshot. The copy was deleted, and the landing\npage is now built by the main site's own templates.\n\n## Where it goes wrong\n\n- **Text stays invisible while the file loads.** Under `block`, and often under\n  `auto`, a slow connection shows a laid-out page with no words in it for up to\n  the block period. Use `swap` for body text and preload the one or two files\n  the first screen needs. A font preload needs the `crossorigin` attribute even\n  for a same-origin file, because the preload has to match the CORS request it\n  stands in for.\n- **The page jumps when the font arrives.** A fallback with different widths and\n  line heights breaks lines in other places, and the swap reflows them. The\n  specification advises fallbacks whose metrics closely match the webfont. Where\n  none does, a `local()` face for the fallback with `ascent-override`,\n  `descent-override` and `line-gap-override` brings its vertical metrics into\n  line, so the swap changes letterforms rather than layout.\n- **Bold and italic nobody drew.** When a family has no bold face, the browser\n  may thicken the regular one, and it may slant the regular one when there is no\n  italic. Strokes smear and roman letters lean. Ship every face the design uses,\n  or set `font-synthesis` to `none` so a missing face shows up in review as\n  upright, regular-weight text rather than a fake.\n- **`local()` takes a face, not a family.** The name inside `local()` matches a\n  single face by its full name or its PostScript name. Writing the family name\n  there for every weight can match one installed face for all of them, so bold\n  renders as regular on exactly the machines that have the family installed.\n  Name each face, both ways, or leave `local()` out.\n- **A missing glyph mixes typefaces.** A face that lacks a character hands it to\n  the next family, so one word can show two designs. A subset cut too tightly\n  does the same for a whole script. Check coverage against the text the site\n  actually publishes, in every language it publishes.\n\n## Further reading\n\n- [CSS Fonts Module Level 4](https://www.w3.org/TR/css-fonts-4/) — `@font-face`,\n  the matching algorithm, `unicode-range`, `font-display` and the synthesis\n  controls.\n- [WOFF File Format 2.0](https://www.w3.org/TR/WOFF2/) — how OpenType and\n  TrueType fonts are packaged and compressed for the web.\n- [OpenType cmap table](https://learn.microsoft.com/en-us/typography/opentype/spec/cmap)\n  — the table that decides which characters a font can draw.\n- [SIL Open Font License](https://openfontlicense.org/open-font-license-official-text/)\n  — the licence itself, with its conditions on copies, modified versions and\n  reserved names.\n- [WebKit bug 255159](https://bugs.webkit.org/show_bug.cgi?id=255159) — the\n  Safari report on underline skip-ink behind the site's note.\n\n\u003chttps://engineer.company/glossary/font/\u003e\n","date_modified":"2026-11-12T05:34:23Z","description":"How browsers pick, fetch and swap webfonts, how static and variable files differ, and where invisible text, faux bold and stray glyphs come from.","formats":{"gemtext":"https://engineer.company/glossary/font/index.gmi","gopher":"https://engineer.company/glossary/font/gophermap","html":"https://engineer.company/glossary/font/","json":"https://engineer.company/glossary/font/index.json","markdown":"https://engineer.company/glossary/font/index.md","pdf":"https://engineer.company/glossary/font/index.pdf"},"kind":"page","language":"en","title":"What is a font?","url":"https://engineer.company/glossary/font/","version":1}