Repository navigation
Bug fixes for RTL text and dx/dy - #1145
Merged
Merged
Conversation
`dx` and `dy` shift a character and every character after it in logical order, but the shifts were accumulated while positioning the clusters in visual order. In right-to-left text, the first character is the last cluster, so a `dy` on a `tspan` only moved its first character, and a multi-line text collapsed onto its first line. Accumulate the shifts in logical order before positioning the clusters. Left-to-right text is unchanged. Fixes linebender#1093
`text-anchor` positioned a chunk by the sum of its advances, ignoring how `dx` and `textLength` move the characters. Anchor it by the actual extent of its characters instead, as described by the SVG 2 text layout algorithm. `textLength` spacing only moves characters, so it isn't part of the extent. Text on a path also accumulated `dx` and `dy` in visual order. Share the logical order shift resolution with horizontal text. Text decorations were split at the cluster that owns a `dx` or `dy`, which is only where the shift changes in left-to-right text. Split them wherever neighboring clusters have a different shift instead.
LaurenzV
force-pushed
the
fix-rtl-relative-shift
branch
from
October 9, 2026 14:28
cfb199a to
b1ce728
Compare
dx and dy in logical order in right-to-left texttx/ty
tx/tydx/dy
Collaborator
|
Oh man text is complicated... I looked into it a bit more and found some more issues, it's probably still not 100% correctly but we have more passing tests now, so hopefully this is an improvement. |
Collaborator
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right-to-left text with
dyshifts collapsed onto one line. The shifts are now applied in logical order instead of screen order.Fixes #1093
LLM Contributions: investigation, implementation and tests with Claude Code, reviewed by me. The description is my own, edited for grammar.