Saving as plain svg adds spaces between tspans
Steps to reproduce:
- open Orig.svg in Inkscape and save it as plain-svg
<?xml version="1.0" encoding="UTF-8"?>
<svg font-family="Arial" text-anchor="end" viewBox="5.27 8.72 17.427 9.6355" xmlns="http://www.w3.org/2000/svg">
<text><tspan x="23" y="16" font-size="10px">H</tspan><tspan dy="2.26" font-size="7.5px">3</tspan><tspan dy="-2.26" font-size="10px">C</tspan></text>
</svg>
What happened?
Save it as plain-svg Plain.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg10"
version="1.1"
viewBox="5.27 8.72 17.427 9.6355"
text-anchor="end"
font-family="Arial">
<metadata
id="metadata16">
</metadata>
<defs
id="defs14" />
<text
id="text8">
<tspan
id="tspan2"
font-size="10px"
y="16"
x="23">H</tspan>
<tspan
id="tspan4"
font-size="7.5px"
dy="2.26">3</tspan>
<tspan
id="tspan6"
font-size="10px"
dy="-2.26">C</tspan>
</text>
</svg>
What should have happened?
no space, no linebreak between </tspan>
and <tspan
, otherwhise the text-anchor="end"
will lead to a trailing space
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg10"
version="1.1"
viewBox="5.27 8.72 17.427 9.6355"
text-anchor="end"
font-family="Arial">
<metadata
id="metadata16">
</metadata>
<defs
id="defs14" />
<text
id="text8">
<tspan
id="tspan2"
font-size="10px"
y="16"
x="23">H</tspan><tspan
id="tspan4"
font-size="7.5px"
dy="2.26">3</tspan><tspan
id="tspan6"
font-size="10px"
dy="-2.26">C</tspan>
</text>
</svg>
Defintion of text chunks
According to https://www.w3.org/TR/SVG/text.html#Definitions:
text chunk An independent block of text in which all characters are positioned together. Each new absolute positioning adjustment (due to an ‘x’ or ‘y’ attribute, or forced line break) creates a new text chunk. Ligature substitution and bidi-reordering only occur within a text chunk. Text chunks are only relevant to pre-formatted text.
This was already disscused at: https://commons.wikimedia.org/wiki/User_talk:JoKalliauer#Is_this_a_known_bug? I still do not fully understand it.
Inkscape Version and Operating System:
- Inkscape Version: Inkscape 0.92.4 (5da689c313, 2019-01-14)
- Operating System version: Windows 10
Copyright
source: https://commons.wikimedia.org/wiki/File:2-methylaziridine.svg Author: Hbf878 license: CC0