oficina / docs Public

worktree-sans: sans-serif by default, and serif made expressible closed

On branch worktree-sans

The default body font becomes sans-serif. Opening before the first commit.

Paul asked for this after noticing Google Docs defaults to Arial these days; Word now defaults to Aptos, also sans. He agreed to it as its own branch because it restyles every document that already exists.

Why it is not a one-line default swap

Three things make this bigger than changing a font-family.

1. The font set is the measurement baseline. The faces are self-hosted from internal/fonts and the PDF exporter measures with those exact font programs, so a document paginates the same on screen and in its own export only while both use them. The names are private ("Docs Serif", not "Liberation Serif") precisely so a locally installed copy cannot win the match and quietly change the measurements. Changing which face is the default changes the metrics every unmarked paragraph is laid out with — line breaks, and therefore page breaks, move.

2. The mark vocabulary is a closed set where "no mark" means serif. docs-font-sans and docs-font-mono exist; there is no docs-font-serif. Flip the default and there is no way to express serif at all until a fourth mark is added — and that is the same five-place vocabulary the alignment work just used: the Rust renderer's MARKS table, the editor schema, the stylesheet, the PDF's own scale, and the toolbar.

3. Every existing document changes appearance. They carry no font mark, so they render in whatever the default is. That includes the seeded samples and anything anyone has written. This is a restyle of existing content, not a change to new documents.

The plan

  • Add docs-font-serif to the closed set, in all five places, so serif stays expressible.
  • Make sans the default for unmarked text, on screen and in the PDF, with the same value in both.
  • Keep the toolbar's font control showing the truth: with sans as the default, an unmarked paragraph should read as "Sans", not as whatever the control used to say.
  • Pin the default in a test that fails if the stylesheet and the exporter disagree — the geometry test that already pins page metrics is the right home, and it caught exactly this class of drift on the last branch.

What I will watch for

The PDF and the screen must agree on which face is default, not merely both be sans. They are separate constants in separate languages, and nothing today forces them to name the same thing.

Existing documents will re-paginate. That is the point of the change rather than a bug, but it means the PDF pagination tests that sit close to their page-count thresholds may move; if one flips, the honest fix is a longer fixture, not a looser assertion.

Not in this branch

The three alignment labels still need Paul's copy pass, including "Align centre" against the center attribute value. That is a decision, not work, and it is recorded on the alignment thread.

Merged as 84c906c and deployed; docs.bds.oncarlos.com is serving it. Landing recorded.

Review found one real defect and two smaller things, all fixed. The defect: the toolbar resolved a run carrying two font marks in the opposite order to both renderers — mono wins the cascade on screen and in the PDF, so a dual-marked run drew mono while the control read 'Sans serif' — and a test pinned that wrong answer, making the disagreement doctrine rather than an oversight. Only reachable through a hand-crafted update, which is exactly the case the surrounding comments claim to have considered. Also fixed: a guard that could not throw for any input, and a comment arguing the right decision from a backwards fact (the old default was serif, which carried no mark, so no pre-move document contains fontserif — what they carry is fontsans).

Recorded, not fixed: the three surfaces now agree on dual-mark order but only fonts.test.mjs pins it, so changing MARKS order or styleFor's switch would fail nothing. Closing that needs a fixture carrying a combination the editor cannot produce, and a cross-language render-and-diff — real scope, and the current behaviour is verified correct by hand against both renderers' source.

Screen and PDF defaults are now pinned against each other by a test that was verified by flipping the stylesheet back to serif and watching it fail. Page counts were measured before and after: four pages and two either way, nothing loosened.