mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 17:56:50 -06:00
Area type was written as one <tspan> per paragraph at the frame's top-left: SVG text never wraps, so every SVG viewer (and VectorCraft's own import) showed each paragraph as a single line running out of the frame. Centred and right-aligned area type also got text-anchor="middle"/"end" at the frame's left edge, so it was centred on (or ended at) that edge instead of inside the frame. The exporter now asks the text layout for the lines: each line is a <tspan x y> at its baseline, at the line's left edge, centre or right edge to match the text-anchor, with hyphenated breaks written with their hyphen and the spaces at soft breaks dropped. The <text> carries the first line's position too, so importers that place text by its own x/y (ours included) start at the first line. Re-importing an exported file now reproduces the area type pixel for pixel as point type with the same line breaks (justified lines lose their extra word spacing). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>