[svgwg] Issue: BIDI reordering across multiple 'tspan' (#635) marked as Agenda+

dirkschulze has just labeled an issue for https://github.com/w3c/svgwg as "Agenda+":

== BIDI reordering across multiple 'tspan' ==
https://www.w3.org/TR/SVG11/text.html#TextLayoutIntroduction

According to the SVG spec, BIDI reordering should be done for a whole text chunk. But it doesn't explain the details.

>Reordering of characters due to bidirectionality only occurs within a text chunk.

```xml
<svg id="svg1" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg" font-family="Arial" font-size="32">
    <linearGradient id="lg1">
        <stop offset="0" stop-color="white"/>
        <stop offset="1" stop-color="green"/>
    </linearGradient>

    <rect fill="url(#lg1)" stroke="gray" x="80" y="40" width="93" height="10"/>

    <text id="text1" x="30" y="90">Hel<tspan fill="url(#lg1)">lo مرح</tspan>با.</text>
    <text id="text2" x="30" y="140">Hello مرحبا.</text>

    <rect id="frame" x="1" y="1" width="198" height="198" fill="none" stroke="black"/>
</svg>

```

![test14](https://user-images.githubusercontent.com/725494/51473886-4dd2e200-1d86-11e9-952d-4e44de398827.png)

As you can see, everything is pretty much broken.

1. Before writing this test, I thought that librsvg behavior is correct. Meaning that the `tspan` span doesn't affected by reordering.
1. Mainly because this leads to the next problem: what is the correct bbox in that case? That's why I'm filling it with a gradient.
   As you can see, Qt thinks that there are two separate objects. librsvg, in my opinion, has the right result (kinda). And the others have a stretched gradient without a white part, for some reasons (rect for the reference).
1. This is also affected by the https://github.com/w3c/svgwg/issues/634

What is the correct behavior?

See https://github.com/w3c/svgwg/issues/635

Received on Monday, 20 May 2019 20:01:11 UTC