Apache OpenOffice (AOO) Bugzilla – Issue 126104
Problem with Text align in SVG
Last modified: 2015-10-28 16:50:04 UTC
When inserting a .svg picture, a <text> element with text-anchor="middle" parameter only centres text the final <tspan> element- all prior <tspan> elements are placed left of centre.
Please attach such a .svg picture.
Created attachment 85079 [details] test SVG file This is the svg file I used in my testing.
I was unable to reproduce this issue on an alternate configuration of Windows 8.1 Enterprise with Writer version: AOO420m1(Build:9800) - Rev. 1692551 I used the attached .svg file and tried with various x values for the text node and its tspan elements. I used: 0 and 10 for x in text and tspan. 0 and 10 for dx in tspan. No x or dx for either text or tspan. It is a simple file, but it does use text-anchor=”middle” and has multiple tspan elements. It is possible that a more complex SVG file is needed with another attribute in combination with text-anchor=”middle” to reproduce the issue, but I was not able to test for it. For all the variations I used of this file Writer displays the text for each line of the image as expected: while using text-anchor=”middle” the center of the text is anchored to the position defined by the x attribute (without an x attribute 0 is used for the first line and subsequent lines use the end of the previous line)
Created attachment 85081 [details] svg showing alignment issue
I have now reproduced this issue on my configuration (Win8, AOO420) After my last update I received an email from Clive (original reporter). He said he was unable to get into Bugzilla, and gave me more information on his issue. From Clive: “You can exaggerate the effect on your example if you 1) shorten the text in each part to a single letter such as I, H or O, and 2) increase the font-size. My original problem stemmed from a ‘pretty’ layout of tspan elements: a line-break between them acted as a space and screwed up the cantering. You can overcome this by having line-breaks only within parameter attributes or not at all. But Writer still persists to misalign the characters, except for the last tspan in a text element.” The issue is a little more subtle than I originally thought, and it is present in my text.svg file. To make it more obvious I: Created Letters.svg with 3 lines of the letter H at 48 pt font In Writer I inserted Letters.svg through the menu (Insert->Picture->From File…) My viewing in Writer shows all but the last line to be ~1/4th the character width to the left of center. He also suggested using more images at http://chordography.blogspot.com/.
Created attachment 85084 [details] svg with misaligned text with & without line breaks Top (red) image shows misaligned text with line-breaks between tspan elements. Lower (green) image is identical except line-breaks occur only within the parameter sections, which should not interfere with spacing. All major browsers, even IE, show misaligned text only in the red image (with line-breaks), while Writer produces similar misalignment in both red and green images.