M4: text.refit: auto-sizing text measures its box again once its font is there

A text box keeps the size it was measured at, so text laid out while its
family was missing kept the fallback font's box after the font arrived (a
hugging chip clipped its label).

- text.refit {ids?} measures auto-sizing text again (whole document by
  default) → {refitted}
- text.rescanFonts and text.loadFont refit the open document's text in the
  families they add, as one undo step

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Attila Valentin Németh
2026-10-18 17:35:31 +02:00
co-authored by Claude Opus 5.5
parent 972e228f41
commit ba4c502ada
4 changed files with 145 additions and 17 deletions
+3
View File
@@ -237,6 +237,9 @@ Or in a project's `.mcp.json`:
(`{families: [{family, layers}]}`); their text draws in a fallback font. Fonts are indexed once
per process: after installing one, `text.rescanFonts` picks it up (`{added: [families]}`), and
`text.loadFont {path | data (base64)}` adds a font file without installing it (`{families}`).
Text boxes keep the size they were measured at: both refit the open document's auto-sizing text
in the new families (`refitted: [ids]`), and `text.refit {ids?}` does it for any text, e.g. a
file saved while its fonts were missing.
OpenType features: `features {"liga": false, "tnum": true}`.
Decorations: `textDecorationStyle` (`solid`, `dotted`, `wavy`), `textDecorationThickness` and
`textDecorationOffset` (`auto`, px, or `"10%"` of the font size; the offset runs from the baseline