![](https://secure.gravatar.com/avatar/c9af522fc39d5de90f21119543c2b9ab.jpg?s=120&d=mm&r=g)
Steve Litt said on Wed, 16 Jun 2021 16:24:22 -0400
Hi all,
I'm using Inkscape 1.1 (c68e22c387, 2021-05-23), and running into unexpected behavior with text, as explained below:
My drawing has a text item with hard newlines and specific spacing between baselines (1.1). I save it as plain SVG, close the file, then reopen it. The text item's baseline to baseline appears to have reverted to 1.0, but the text now appears to be on one line, and if I insert newlines, everything just gets jumbled together on the same line. If I add material, different lines have different baseline to baseline distances.
The bottom line is I have to completely recreate the text item from scratch on every edit, which slows things to say the least.
This is probably intermittent, because I have another text item that so far, from minimal investigation, appears not to have this problem.
I can also tell you that I seem to remember problems like this (rarely) in earlier versions, but I can't remember any details.
Has anybody else encountered this?
Can anybody tell me what I'm doing wrong, and how to do it right?
I've looked into this a little more. What appears to be happening is that, at least when saved as plain SVG, re-editing that file with Inkscape does not recalculate the x and y values of the <tspan/> subelements. Even if you change the baseline spread. Thus the unrecoverable line spacing.
So the x and y coordinates of each <tspan/> must be recalculated, whether or not the file under edit was Plain SVG or Inkscape SVG. Otherwise using multiline text is useless, and instead of having a 4 line piece of text, you'd just use 4 text elements and space and align them, which is a pain the petunias, but not half as bad these multiline texts that, once saved as Plain SVG, must be recreated from scratch.
Recalculation is needed. I can tell you a method to make such recalculation quite a bit easier. Instead of using the x and y properties of a <tspan/>, use the dx and dy values. Then the <text/>'s baseline spread value can be assigned to the <tspan/>'s dy value. The dx value of <tspan/> would be a simple equation based on line length, and in fact would be zero for left justified text.
Until this thing's fixed I'll use one text item per line desired, but I can tell you this is a slowdown and a workflow productivity problem.
Thanks,
SteveT
Steve Litt Spring 2021 featured book: Troubleshooting Techniques of the Successful Technologist http://www.troubleshooters.com/techniques