oficina / slides Public

Docs: custom fonts

AGENTS.md: the font library, how a deck's uploaded fonts are served, and
which faces pictures and PDF use. docs/api.md: where a deck's font
files are served from.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 025fbfa4a3dec01cfe9d3c16f8434188da0f121a parent dcc278d
2 files changed, +24 −4
  • AGENTS.md +20 −2
  • docs/api.md +4 −2
diff --git a/AGENTS.md b/AGENTS.md
index 8228ddd..7402981 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -154,14 +154,32 @@ seeded on first sign-in — and comes back out as a PDF.
`0008_create_asset_uploads.sql`): one deck, one actor, single use, two
hours. A ref alone registers nothing, and no PUT is ever signed for an
address something is already served from (spec §2.7, codex 1 and 2).
+- **The font library** (`library.go`, `fonts.html`, estilo's `typeface`
+ package): `/fonts` is a person's own set of fonts, uploaded through
+ the app (TTF, OTF, WOFF, WOFF2; `typeface.Inspect` reads the family,
+ weight, italic and whether a face may go in a picture or PDF, as
+ `Pictures()`). Limits: 10 MiB a file, 16 faces to a family, 32
+ families. A name a catalog family or a CSS generic keyword holds gets
+ a number. Uploads and deletes take `fontMu`, so the limits hold under
+ two at once. A file lives in the object store under its own hash, and
+ `typeface.Headers` serves it with private caching. Deck settings
+ picks a library family (`POST /d/{sqid}/fonts`: `DeckFont` rows and
+ the `meta.fontFiles` set_meta). Agents can write `meta.fontFiles` but
+ cannot upload bytes: a ref is served only through a deck that
+ recorded it **and** lists it (`/d`, `/s`, `/p` `.../fonts/{ref}`; `/d`
+ also serves a recorded ref to its library owner, so a pick loads
+ before its set_meta lands). The TrueType parser in `fonts/` reads
+ untrusted bytes, so every offset and count is bounds-checked.
- **The layout engine and thumbnails** (`layout/`, `svg/`, `fonts/`,
`thumbs.go`): every slide measured into a paint list with the same
embedded Liberation faces the browser sets it in, written as an SVG,
and served as `{surface}/slides/{id}.svg` from all four capabilities.
A deck stack that names an uploaded family first is set in its static
- TrueType faces (`meta.fontFiles` faces marked `pictures`), read from
+ TrueType faces (`meta.fontFiles` faces marked `pictures`: static TrueType whose
+ flags allow subsetting), read from
the object store (`fontstore.go`) and parsed once per render through
- `layout.New`; anything else falls back down the stack, and the export
+ `layout.New`; anything else (variable, CFF, no subsetting) falls
+ back down the stack, and the export
hands the PDF module those faces renamed to the deck's CSS name
(`fonts.Renamed`), because the module matches the name inside a font.
The editor strip and the remote are that picture. The presenter
diff --git a/docs/api.md b/docs/api.md
index 8d988d3..330287d 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -415,8 +415,10 @@ styles it by, and each face gives its file's `ref`, `format` (`ttf`,
`pictures` flags. It is left out of the document when the deck has none.
A `set_meta` can set `fontFiles` or clear it with `null`, but the API
can't upload font bytes, and the server serves a font only through a deck
-that recorded it from its owner's library. A `ref` you write by hand
-loads nothing until then. A list that doesn't check out (more than 32
+that recorded it from its owner's library (`GET /d/{sqid}/fonts/{ref}`,
+and the same under `/s/{token}` and `/p/{session}`; a ref the deck
+doesn't list is a 404). A `ref` you write by hand loads nothing until
+then. A list that doesn't check out (more than 32
families or 16 faces to a family, a `css` used twice, a bad `ref`,
`format` or `weight`) is refused like any other bad op.