Repository navigation
feat(fonts): give imported fonts a fallback of their own kind - #1680
Merged
gregpriday merged 6 commits intoNov 28, 2026
Merged
gregpriday merged 6 commits into
gregpriday merged 6 commits into
Conversation
…, re-imports and the brand tool - asset.update keeps a category the update omits; a re-imported duplicate gets a missing category alone - update_site_brand keeps the stack of the font a token already uses - PANOSE serif style is read only for Latin text; double-quoted fallback tails are recognised - the font select keeps one wrapper so focus survives the fallback row, and asks nothing for a bare keyword
… backfill - update_site_brand keeps a style's stack only for an imported font of unknown kind it already leads with - asset.update keeps the saved kind when the update gives none, even as an explicit undefined - a re-imported duplicate no longer rewrites its face (pre-release: no backfill of older records)
gregpriday
force-pushed
the
feature/issue-1490-imported-serif-and-monospace-fonts-fall
branch
from
November 28, 2026 10:23
cf4d5b0 to
f2bf9a1
Compare
gregpriday
deleted the
feature/issue-1490-imported-serif-and-monospace-fonts-fall
branch
November 28, 2026 10:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #1490
An imported font's stack always ended in
system-ui, sans-serif, so a serif display face or a monospace body face fell back to the system sans while its file loaded and for any glyph it lacked. The importer now reads what kind of face the file is, and the stack ends in a fallback of that kind. Where the file doesn't say, the font select lets the author choose.Changes
src/main/project/media.ts,fontCategory):post.isFixedPitchor a monospaced PANOSE proportion means monospace. Otherwise the OS/2 IBM family class decides serif or sans, then the PANOSE serif style (Latin text only) when the class is 0. Script, ornamental and symbol classes, and all-zero tables (as most Google/Fontsource fonts ship), leave it unknown. The proportion byte is also read when the PANOSE family kind is 0: Fontsource's Roboto Mono sets only that. A short or unreadableposttable never refuses a font.FontFace.category(operation schema included). A family's kind is the one kind its faces agree on: an italic that says nothing takes its upright's, and faces that disagree leave it unknown, in any order. Editing a face's family, weight or style keeps its kind.src/shared/fonts.ts): serif ends inGeorgia, 'Times New Roman', serifand monospace inui-monospace, 'SF Mono', Menlo, Consolas, monospace(the built-in fonts' own). Sans-serif and unknown keepsystem-ui, sans-serif. The font select's options, import-and-choose, a bare imported name typed into a style (resolveFontStack),update_site_brand, and the Fonts tab preview all use it.update_site_brandnaming again an imported font of unknown kind that a style already leads with keeps that style's stack, so an author's chosen fallback survives.Testing
tests/unit/media.test.ts(kind detection across WOFF and WOFF2, short tables, conflicting signals),tests/unit/fonts.test.ts(schema, stacks, family agreement, a bare name into generatedtokens.css, removal, face edits, fallback read and swap),tests/unit/agent-tools.test.ts(brand tool by kind, a kept author fallback, built-in font restacked), and a new real-browsertests/unit/font-select-browser.test.ts(options by kind, choosing a fallback, custom tail, follows, keyword, focus).@fontsourcefiles: IBM Plex Mono, JetBrains Mono and Roboto Mono read as monospace, and Source Serif 4 as serif. Lora, Fraunces, Inter, DM Sans and others read as unknown.develop.npm run typecheck:changedgreen.tests/e2e/fonts.mjswas not run or extended.