Alignment change is only applied to a tspan instead of the text element when text is selected

Steps to reproduce:

  • open Inkscape
  • create a flowed text
  • type two lines
  • select all and align it at the center (text-alignment)
  • save the file and view it in a browser

What happened?

The text is displaced.

The red dot indicates the center of the text and is at the coordinate of the first tspan: x=35.9.

example file Inkscape Firefox Chrome
bad-alignment.svg bad-alignment image image

What should have happened?

The text should not be displaced.

Eliminating the text-anchor=middle attribute of the tspans creates a file which is rendered identically in Inkscape and browsers:

example file Inkscape Firefox Chrome
bad-alignment_fix.svg bad-alignment_fix image image

Not sure if the Inkscape or the browsers violate the standard. Pinging @Tavmjong who probably knows more about that. In any case, this looks like an easy fix to make the rendering more consistent.

PS: The example https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/text-anchor is rendered correctly in Inkscape.

Inkscape Version and Operating System:

  • Inkscape Version: 1.1-dev (1bfe461, 2020-02-06)
  • Operating System: Windows 10
  • Operating System version: 10.0.18362
Edited by Jonathan Neuhauser