resvg icon indicating copy to clipboard operation
resvg copied to clipboard

Nested `tspan` positioning is weird

Open si14 opened this issue 1 year ago • 2 comments

SVG:

<svg xmlns="http://www.w3.org/2000/svg" width="1500" height="600" viewBox="0 0 1500 600">
    <text x="50" y="550" text-anchor="start" dominant-baseline="text-after-edge"
          font-family="Nunito" fill="white"
          style="filter:drop-shadow(0 3px 7px black)">
        <tspan x="50" dy="-190" font-size="120px" font-weight="800">Every Time ✅</tspan>
        <tspan x="50" dy="113" font-size="66px" font-weight="800">
            <tspan>hello</tspan>
            world
        </tspan>
    </text>
</svg>

Render (notice how "hello" got shifted):

Screenshot 2024-12-17 at 21 28 08

My understanding is that it should be still in line.

si14 avatar Dec 17 '24 21:12 si14

Hm yeah, seems like a bug.

LaurenzV avatar Dec 18 '24 08:12 LaurenzV

Looks like a dominant-baseline bug, but this is a super undocumented feature, so who knows how it should work exactly.

RazrFalcon avatar Dec 18 '24 08:12 RazrFalcon