M4.27: area type and rich text in SVG export

Every laid-out line of type is written at its own position (wraps,
indents, tabs, hyphenation and all caps as on the canvas): a positioned
tspan per style run and, on justified lines, per word. Centred and
right-aligned lines are anchored at their centre or right end, so they
stay aligned in a viewer whose font differs. Leading comes from the
layout's baselines, baseline shift is written as dy, horizontal scale as
textLength, vertical scale as the size, tracking and manual kerning as
letter-spacing. The fewerTspans option (engine and dialog) writes one
positioned tspan per line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bflatastic
2026-10-05 07:56:32 +07:00
co-authored by Claude Opus 5.5
parent 4a3859c69b
commit 1982ecf98d
9 changed files with 402 additions and 118 deletions
+1 -1
View File
@@ -126,7 +126,7 @@ SVG Options: `export` to SVG takes them in `options`, flat or as `{"svg": {…}}
`style`, `entities`, `css`), `outlineText`, `images` (`embed`, or `link`: embedded images are written next to the
SVG, or returned as `linked`), `objectIds` (`layerNames`, `minimal`, `unique`), `decimals` (1–7), `minify`,
`responsive`, `useArtboards`, `range: "all"` (one SVG per artboard, listed in `files`), `preserveEditing` (the SVG
reopens as the full document) and `metadata`. Unknown keys inside `svg` are rejected; `run_command document.formats`
reopens as the full document), `metadata` and `fewerTspans` (one `<tspan>` per line of type). Unknown keys inside `svg` are rejected; `run_command document.formats`
lists every option with its default. `run_command document.save {path: "x.svg", svg: {…}}` saves as SVG.
## Resources