Issue 126104 - Problem with Text align in SVG
Summary: Problem with Text align in SVG
Status: UNCONFIRMED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: 4.0.0
Hardware: All All
: P3 Normal (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: needmoreinfo
Depends on:
Blocks:
 
Reported: 2015-02-13 16:55 UTC by Clive
Modified: 2015-10-28 16:50 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
test SVG file (282 bytes, image/svg+xml)
2015-10-26 00:38 UTC, briggs.daniel.r
no flags Details
svg showing alignment issue (257 bytes, image/svg+xml)
2015-10-26 21:15 UTC, briggs.daniel.r
no flags Details
svg with misaligned text with & without line breaks (647 bytes, application/xml)
2015-10-28 16:50 UTC, Clive
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Clive 2015-02-13 16:55:17 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.
Comment 1 Regina Henschel 2015-02-15 11:43:34 UTC
Please attach such a .svg picture.
Comment 2 briggs.daniel.r 2015-10-26 00:38:02 UTC
Created attachment 85079 [details]
test SVG file

This is the svg file I used in my testing.
Comment 3 briggs.daniel.r 2015-10-26 00:39:43 UTC
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)
Comment 4 briggs.daniel.r 2015-10-26 21:15:47 UTC
Created attachment 85081 [details]
svg showing alignment issue
Comment 5 briggs.daniel.r 2015-10-26 21:17:25 UTC
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/.
Comment 6 Clive 2015-10-28 16:50:04 UTC
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.