mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-15 00:09:41 +00:00
An absolutely placed character starts its own text chunk, anchored on its own x (SVG 1.1 text chunks). In a right-to-left line the import kerned the character before each placed one as if kerning moved the placed character right, but a right-to-left glyph takes its kerning at its left, so the correction moved the wrong glyph. In <text direction="rtl" font-size="20">, <tspan x="100 160" y="80 80">אב</tspan> on a second line put the right edge of א at 393.48 instead of 100. The placement now works in drawing order: each kerning is a cut after its character (before it when it runs right to left), each gap between two placed neighbors takes one cut, and the line's left edge is measured again every round. Corrections are divided by the character's horizontal scale, so text stretched with lengthAdjust="spacingAndGlyphs" lands on its x too. A left-to-right character drawn between two placed right-to-left ones has no kerning slot before the next one, which then keeps its place in the line; the import warns about it.