// fixtures/sizes.mjs — the font-size vocabulary, in one place. // // fonts.mjs's counterpart, and it follows that module's shape // deliberately: a closed list, a default that carries NO mark, and a // pair of functions mapping between a chosen value and the mark that // says it. Read fonts.mjs's head comment for the reasoning; what // follows is only what is different about size. // // WHY POINTS AND NOT FOUR NAMED STEPS. This control used to offer // Small / Normal / Large / Extra large, stored as three marks whose CSS // was a multiplier of the body size (0.85em, 1.25em, 1.5em). That is a // perfectly good way to build a text editor and a poor way to build a // word processor: people arrive knowing what 12pt is, documents specify // point sizes, and "Large" does not survive a conversation with someone // holding a printout. The ladder below is Google Docs' own. // // WHY A CLOSED ENUMERATION AND NOT A NUMBER ON A MARK. This is the // constraint that shaped the whole feature, and it is not a stylistic // preference. core/src/fragment.rs renders the CRDT to HTML that // internal/docs/store.go returns as template.HTML and views/show.html // writes into the page UNESCAPED. That is safe only because no byte // from a document ever reaches attribute position: every mark is // attribute-free, and its markup is a compile-time literal chosen by // lookup. A mark carrying "14pt" would be a valued mark — and // POST /d/{sqid}/updates accepts arbitrary Yjs bytes that never went // through ProseMirror's schema, so the value would be genuinely // arbitrary. Eleven more attribute-free marks spend no new safety // property at all; a single sized mark would spend the one the whole // renderer rests on. // // So the ladder is not "the sizes we happened to pick". It is the set // of sizes this design can express, and adding 13pt later is a row in // four places rather than a schema change. // The sizes a person can choose, in the order the control shows them. // // DEFAULT FIRST, for the reason internal/docs/export.go's own comment // records having learned the hard way: a