scour-project / scour

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

removing 0 0 in pathdata leads to not rending marker-start="url(#a)" in chrome #282

Open JoKalliauer opened 3 years ago

JoKalliauer commented 3 years ago

Input

<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 6.33 22.08" xmlns="http://www.w3.org/2000/svg">
 <marker id="a" transform="translate(-11.44 101.6)" stroke="#000" markerHeight="5.3200002" markerUnits="userSpaceOnUse" markerWidth="5.3200002" refX="2.6600001" refY="2.6600001" viewBox="0,0,5.32,5.32">
  <path width="100%" height="100%" d="m1.33 1.33h2.66v2.66h-2.66z" stroke="#000" stroke-linejoin="round" stroke-width=".74"/>
 </marker>
 <marker id="b" transform="translate(-11.44 101.6)" fill="#f00" stroke="#f00" markerHeight="5.3200002" markerUnits="userSpaceOnUse" markerWidth="5.3200002" refX="2.6600001" refY="2.6600001" viewBox="0,0,5.32,5.32">
  <circle cx="2.66" cy="2.66" r="1.6" fill="#f00" stroke="#f00" stroke-linejoin="round" stroke-width=".74"/>
 </marker>
 <marker id="c" transform="translate(-11.44 101.6)" fill="#92d050" stroke="#92d050" markerHeight="5.3200002" markerUnits="userSpaceOnUse" markerWidth="5.3200002" refX="2.6600001" refY="2.6600001" viewBox="0,0,5.32,5.32">
  <path width="100%" height="100%" d="m1.06 1.06h3.2l-1.6 3.2z" fill="#92d050" stroke="#92d050" stroke-linejoin="round" stroke-width=".74"/>
 </marker>
 <marker id="d" transform="translate(-11.44 101.6)" fill="#ffc000" stroke="#ffc000" markerHeight="5.3200002" markerUnits="userSpaceOnUse" markerWidth="5.3200002" refX="2.6600001" refY="2.6600001" viewBox="0,0,5.32,5.32">
  <path width="100%" height="100%" d="m-1.33-1.33h2.66v2.66h-2.66z" fill="#ffc000" stroke="#ffc000" stroke-linejoin="round" stroke-width=".74"/>
 </marker>
 <g transform="translate(-11.44 101.6)" fill="none" stroke="#000">
  <path d="m15.8-100.92 0 0" marker-start="url(#a)"/>
  <path d="m15.8-94.23 0 0" marker-start="url(#b)"/>
  <path transform="matrix(-1 0 0 -1 31.6 -175.08)" d="m15.8-87.54 0 0" marker-start="url(#c)"/>
  <path d="m15.8-80.85 0 0" marker-start="url(#d)"/>
 </g>
</svg>

Output

<?xml version="1.0" encoding="UTF-8"?>
<svg viewBox="0 0 6.33 22.08" xmlns="http://www.w3.org/2000/svg">
 <marker id="a" transform="translate(-11.44 101.6)" stroke="#000" markerHeight="5.3200002" markerUnits="userSpaceOnUse" markerWidth="5.3200002" refX="2.6600001" refY="2.6600001" viewBox="0,0,5.32,5.32">
  <path width="100%" height="100%" d="m1.33 1.33h2.66v2.66h-2.66z" stroke="#000" stroke-linejoin="round" stroke-width=".74"/>
 </marker>
 <marker id="b" transform="translate(-11.44 101.6)" fill="#f00" stroke="#f00" markerHeight="5.3200002" markerUnits="userSpaceOnUse" markerWidth="5.3200002" refX="2.6600001" refY="2.6600001" viewBox="0,0,5.32,5.32">
  <circle cx="2.66" cy="2.66" r="1.6" fill="#f00" stroke="#f00" stroke-linejoin="round" stroke-width=".74"/>
 </marker>
 <marker id="c" transform="translate(-11.44 101.6)" fill="#92d050" stroke="#92d050" markerHeight="5.3200002" markerUnits="userSpaceOnUse" markerWidth="5.3200002" refX="2.6600001" refY="2.6600001" viewBox="0,0,5.32,5.32">
  <path width="100%" height="100%" d="m1.06 1.06h3.2l-1.6 3.2z" fill="#92d050" stroke="#92d050" stroke-linejoin="round" stroke-width=".74"/>
 </marker>
 <marker id="d" transform="translate(-11.44 101.6)" fill="#ffc000" stroke="#ffc000" markerHeight="5.3200002" markerUnits="userSpaceOnUse" markerWidth="5.3200002" refX="2.6600001" refY="2.6600001" viewBox="0,0,5.32,5.32">
  <path width="100%" height="100%" d="m-1.33-1.33h2.66v2.66h-2.66z" fill="#ffc000" stroke="#ffc000" stroke-linejoin="round" stroke-width=".74"/>
 </marker>
 <g transform="translate(-11.44 101.6)" fill="none" stroke="#000">
  <path d="m15.8-100.92" marker-start="url(#a)"/>
  <path d="m15.8-94.23" marker-start="url(#b)"/>
  <path transform="matrix(-1 0 0 -1 31.6 -175.08)" d="m15.8-87.54" marker-start="url(#c)"/>
  <path d="m15.8-80.85" marker-start="url(#d)"/>
 </g>
</svg>

Difference

Screenshot from 2021-06-15 18-05-27

compare in Chrome

input output
Input.svg Output.svg

Copyright

source https://commons.wikimedia.org/wiki/File:2014_West_Africa_Ebola_Epidemic_-_New_Cases_per_Week.svg

author https://commons.wikimedia.org/wiki/User:Delphi234

license https://creativecommons.org/publicdomain/zero/1.0