oficina / docs Public

Sans is what a document is set in, and serif is now something you can ask for

Google Docs defaults to Arial and Word to Aptos; ours defaulted to a
serif, which was a reasonable identity and not what anyone expects when
they open a document editor. The default is now sans.

The reason this took a branch of its own rather than a changed
font-family is that "no mark" used to mean serif. There was
docs-font-sans and docs-font-mono and nothing for serif, so moving the
default would have made serif inexpressible. So serif becomes a mark of
its own first, across the five places that vocabulary spans — the Rust
renderer's MARKS table, the editor schema, the stylesheet, the PDF's own
handling and the toolbar — and only then does the default move.

The font set is also the measurement baseline: the faces are self-hosted
and the PDF exporter measures with those exact font programs, so screen
and export paginate alike only while both use them. The screen's default
and the exporter's are separate constants in separate languages and
nothing structurally forces them to agree, so a test now reads both and
fails if they diverge — verified by flipping the stylesheet back to
serif and watching it say so. Page counts were measured before and after
rather than assumed: four pages and two, either way, with no assertion
loosened.

Every document that already exists changes appearance, because none
carries a font mark. That is the point of the change rather than a
side effect of it.

Reviewed by Fable, which found the toolbar resolving a run carrying two
font marks in the opposite order to both renderers — mono wins the
cascade on screen and in the PDF, and the control would have read
"Sans serif" while drawing mono, with a test pinning that wrong answer
as doctrine. Reachable only through a hand-crafted update, which is
exactly the case the surrounding comments claim to have thought about.
Fixed, along with a guard that could not throw for any input and a
comment arguing the right decision from a backwards fact.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Paul Campbell pushed by paul@keymail.dev 84c906c35f62c8a7ac752f87ed755ead0732390b parent f4bc155
19 files changed, +698 −49
  • .amadan/ci.d/10-gate +14 −0
  • core/src/fragment.rs +15 −5
  • core/tests/fragment.rs +47 −0
  • fixtures/browser-drive.mjs +11 −4
  • fixtures/editor-entry.js +16 −0
  • fixtures/fonts.mjs +143 −0
  • fixtures/fonts.test.mjs +94 −0
  • fixtures/generate-fragment.mjs +25 −1
  • fixtures/toolbar.mjs +49 −4
  • fixtures/vectors/fragment/fonts.bin binary
  • internal/core/testdata/docs_core.wasm binary
  • internal/docs/export.go +11 −1
  • internal/docs/export_test.go +103 −5
  • internal/docs/static/{editor.98a16ab4d0c731c1.js => editor.5b869295084ed7fb.js} +13 −13
  • internal/docs/views/show.html +31 −4
  • internal/export/pdf.go +39 −1
  • internal/export/pdf_test.go +50 −0
  • internal/export/sample_pdf_test.go +1 −1
  • internal/fonts/fonts.go +36 −10

CI passed — run details

.amadan/ci.d/10-gate

Loading diff…

core/src/fragment.rs

Loading diff…

core/tests/fragment.rs

Loading diff…

fixtures/browser-drive.mjs

Loading diff…

fixtures/editor-entry.js

Loading diff…

fixtures/fonts.mjs

Loading diff…

fixtures/fonts.test.mjs

Loading diff…

fixtures/generate-fragment.mjs

Loading diff…

fixtures/toolbar.mjs

Loading diff…

fixtures/vectors/fragment/fonts.bin

Loading diff…

internal/core/testdata/docs_core.wasm

Loading diff…

internal/docs/export.go

Loading diff…

internal/docs/export_test.go

Loading diff…

internal/docs/static/{editor.98a16ab4d0c731c1.js => editor.5b869295084ed7fb.js}

Loading diff…

internal/docs/views/show.html

Loading diff…

internal/export/pdf.go

Loading diff…

internal/export/pdf_test.go

Loading diff…

internal/export/sample_pdf_test.go

Loading diff…

internal/fonts/fonts.go

Loading diff…