azer89 / pysvg

A Python library to parse and render SVG
1 stars 0 forks source link

Newlines inserted after XML opening tags alter content #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a text element with xml:space="preserve" attribute (used for 
preformatted monospace text labels).
2. Examine output XML and/or import SVG in eg Inkscape

Example code snippet:

label = text('Hello', 10, 10)
label.setAttribute('xml:space', 'preserve')
label.getXML()

What is the expected output? What do you see instead?

Expected XML is:

<text xml:space="preserve" y="10" x="10"  >Hello</text>\n

Actual XML is:

<text xml:space="preserve" y="10" x="10"  >
Hello</text>\n

The linebreak inserted after the opening text tag affects the displayed 
content. In Inkscape, for example, the label appears 6 characters long instead 
of the intended 5.

What version of the product are you using? On what operating system?

PySVG 0.2.1; Linux Mint

Please provide any additional information below.

Resolved by removing the \n from line 63 of src/pysvg/core.py. So, now the 
content of that line reads:

            xml+=' >'

rather than:

            xml+=' >\n'

Original issue reported on code.google.com by Jim.DeV...@gmail.com on 3 Feb 2015 at 6:42