scour-project / scour

Scour - An SVG Optimizer / Cleaner
Apache License 2.0
770 stars 60 forks source link

comments lead to added spaces #226

Open JoKalliauer opened 5 years ago

JoKalliauer commented 5 years ago

Prozessing File:McCree-Kurve_1_DE.svg with scour leads to misplacement of text

scour -i Input.svg.txt -o Output.svg.txt

Input

Input.svg.txt

<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 16300 10100" xmlns="http://www.w3.org/2000/svg" font-family="DejaVu Sans,sans-serif" font-size="450px">
 <text transform="rotate(-90)" x="-4500" y="15800" text-anchor="middle">relative Quantenausbeute [%]</text>
 <text><!-- -
 - --><tspan x="14500" y="1120">100</tspan><!-- -
 - --><tspan x="14500" y="1840">90</tspan><!-- -
 - --><tspan x="14500" y="2560">80</tspan><!-- -
 - --><tspan x="14500" y="3280">70</tspan><!-- -
 - --><tspan x="14500" y="4000">60</tspan><!-- -
 - --><tspan x="14500" y="4720">50</tspan><!-- -
 - --><tspan x="14500" y="5440">40</tspan><!-- -
 - --><tspan x="14500" y="6160">30</tspan><!-- -
 - --><tspan x="14500" y="6880.0005">20</tspan><!-- -
 - --><tspan x="14500" y="7600">10</tspan><!-- -
- --></text>
 <text x="8200" y="9700" text-anchor="middle">Wellenlänge [nm]</text>
 <text transform="rotate(-90)" text-anchor="end"><!-- -
 - --><tspan x="-8400" y="2150">300</tspan><!-- -
 - --><tspan x="-8400" y="4600">400</tspan><!-- -
 - --><tspan x="-8400" y="7050">500</tspan><!-- -
 - --><tspan x="-8400" y="9520">600</tspan><!-- -
 - --><tspan x="-8400" y="11980">700</tspan><!-- -
 - --><tspan x="-8400" y="14450">800</tspan><!-- -
- --></text>
 <text x="3200" y="8700" text-anchor="middle">UV</text>
 <text x="13000" y="8700" text-anchor="middle">IR</text>
 <text transform="rotate(-90)" x="-4500" y="800" text-anchor="middle">relative Energie [%]</text>
 <text text-anchor="end"><!-- -
 - --><tspan x="1700" y="1120">100</tspan><!-- -
 - --><tspan x="1700" y="1840">90</tspan><!-- -
 - --><tspan x="1700" y="2560">80</tspan><!-- -
 - --><tspan x="1700" y="3280">70</tspan><!-- -
 - --><tspan x="1700" y="4000">60</tspan><!-- -
 - --><tspan x="1700" y="4720">50</tspan><!-- -
 - --><tspan x="1700" y="5440">40</tspan><!-- -
 - --><tspan x="1700" y="6160">30</tspan><!-- -
 - --><tspan x="1700" y="6880.0005">20</tspan><!-- -
 - --><tspan x="1700" y="7600">10</tspan><!-- -
- --></text>
</svg>

Output

Output.svg.txt

<?xml version="1.0" encoding="UTF-8"?>
<svg font-family="DejaVu Sans,sans-serif" font-size="450px" viewBox="0 0 16300 10100" xmlns="http://www.w3.org/2000/svg">
 <text transform="rotate(-90)" x="-4500" y="15800" text-anchor="middle">relative Quantenausbeute [%]</text>
 <text>
  <!-- -
 - --><tspan x="14500" y="1120">100</tspan>
  <!-- -
 - --><tspan x="14500" y="1840">90</tspan>
  <!-- -
 - --><tspan x="14500" y="2560">80</tspan>
  <!-- -
 - --><tspan x="14500" y="3280">70</tspan>
  <!-- -
 - --><tspan x="14500" y="4000">60</tspan>
  <!-- -
 - --><tspan x="14500" y="4720">50</tspan>
  <!-- -
 - --><tspan x="14500" y="5440">40</tspan>
  <!-- -
 - --><tspan x="14500" y="6160">30</tspan>
  <!-- -
 - --><tspan x="14500" y="6880.0005">20</tspan>
  <!-- -
 - --><tspan x="14500" y="7600">10</tspan>
  <!-- -
- --></text>
 <text x="8200" y="9700" text-anchor="middle">Wellenlänge [nm]</text>
 <text transform="rotate(-90)" text-anchor="end">
  <!-- -
 - --><tspan x="-8400" y="2150">300</tspan>
  <!-- -
 - --><tspan x="-8400" y="4600">400</tspan>
  <!-- -
 - --><tspan x="-8400" y="7050">500</tspan>
  <!-- -
 - --><tspan x="-8400" y="9520">600</tspan>
  <!-- -
 - --><tspan x="-8400" y="11980">700</tspan>
  <!-- -
 - --><tspan x="-8400" y="14450">800</tspan>
  <!-- -
- --></text>
 <text x="3200" y="8700" text-anchor="middle">UV</text>
 <text x="13000" y="8700" text-anchor="middle">IR</text>
 <text transform="rotate(-90)" x="-4500" y="800" text-anchor="middle">relative Energie [%]</text>
 <text text-anchor="end">
  <!-- -
 - --><tspan x="1700" y="1120">100</tspan>
  <!-- -
 - --><tspan x="1700" y="1840">90</tspan>
  <!-- -
 - --><tspan x="1700" y="2560">80</tspan>
  <!-- -
 - --><tspan x="1700" y="3280">70</tspan>
  <!-- -
 - --><tspan x="1700" y="4000">60</tspan>
  <!-- -
 - --><tspan x="1700" y="4720">50</tspan>
  <!-- -
 - --><tspan x="1700" y="5440">40</tspan>
  <!-- -
 - --><tspan x="1700" y="6160">30</tspan>
  <!-- -
 - --><tspan x="1700" y="6880.0005">20</tspan>
  <!-- -
 - --><tspan x="1700" y="7600">10</tspan>
  <!-- -
- --></text>
</svg>

Difference

The text on the left vertical axis ist moved to the left (except for 10) according to rendering in Chrome/Firefox

screenshot 2019-02-27 18 35 26

Copyright Lizense: CC0 source: https://commons.wikimedia.org/wiki/File:McCree-Kurve_1_DE.svg