- From: therahedwig via GitHub <sysbot+gh@w3.org>
- Date: Sun, 30 Oct 2022 12:52:48 +0000
- To: public-svg-issues@w3.org
therahedwig has just created a new issue for https://github.com/w3c/svgwg: == Bidi reordering and textchunks give odd results when following SVG 2.0 text algorithm == I've been doing some tests, and found that if the following SVG gives different results in different browsers. ``` <text fill="#0000ff" stroke="none" direction="rtl" style="font-family: DejaVu Sans;font-size: 10;"><tspan x="250" y="34">aa bb <tspan style="text-decoration: underline;">حادثتا</tspan> السفينتين بسين cc dd </tspan><tspan fill="#000000" text-anchor="middle" x="250" dy="10">aa bb <tspan style="text-decoration: underline;">حادثتا</tspan> السفينتين بسين cc dd </tspan></text> ``` Chromium 106: ![image](https://user-images.githubusercontent.com/1759191/198879032-fb7d2fc7-81f1-491d-b8f7-beaee53b21f4.png) Firefox 105: ![image](https://user-images.githubusercontent.com/1759191/198879113-b1f3e8b0-6dc2-4c90-87b3-4a18f371038e.png) Now, SVG 2.0 spec right now says that text chunks should always have their own shaping and reordering, however, that means joined scripts might break, discussed in #631, which then suggests it's undefined. However, the [SVG 2.0 text layout algorithm](https://svgwg.org/svg2-draft/text.html#TextLayoutAlgorithm) also says "For all other text (SVG 1.1 compatible text and SVG 1.1 like multi-line text), layout the text in a CSS content box that is unconstrained in width and height. " Which means that the following happens: ![image](https://user-images.githubusercontent.com/1759191/198878173-dd271891-d575-4af3-a543-bea236779fce.png) The top being the text as it rolls out of the CSS-based renderer, and the bottom being the SVG text layout algorithm adjusting the positions. Which means that spec-wise, technically the behaviour *is defined* and Firefox is implementing it correctly. So, there's the following options: 1. Layout every text chunk as a separate paragraph. Confuses the idea of a text element being a paragraph, though, and that will affect paragraph-based CSS properties like text-indent. 2. Insert bidi-controls around each text chunk. I know too little of the bidi algorithm what kind of effect this has. 3. Recalculate the advances of each glyph so they'll sit snug together. In theory this could have odd results caused by shaping, but I don't know enough of the related algorithms to tell you whether this is a serious issue. 4. Somehow figure out a way to have each text chunk laid out as a wrapping-line. 5. Do nothing? I mostly wanted to make sure people would know that this is what happens if you follow the spec precisely. I am glad SVG 2.0 has proper text-wrapping when as the basic positioning of SVG 1.1 leads to a lot of questions. Please view or discuss this issue at https://github.com/w3c/svgwg/issues/897 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 30 October 2022 12:52:50 UTC