RazrFalcon / svgcleaner

svgcleaner could help you to clean up your SVG files from the unnecessary data.
GNU General Public License v2.0
1.62k stars 93 forks source link

font-size an thickness changes when removing CSS (maybe Chrome-bug) #151

Closed JoKalliauer closed 6 years ago

JoKalliauer commented 6 years ago

Prozessing File:Dzia%C5%82anie_d%C5%82awika_przeciwzwarciowego_1.svg leads to differences in Chrome, most likely bug in Chrome?

Input: input.svg.txt

<svg height="223.88" style="color-interpolation-filters:sRGB;fill:none;fill-rule:evenodd;stroke-linecap:square;stroke-miterlimit:3" viewBox="0 0 269.385 167.912" width="359.18" xmlns="http://www.w3.org/2000/svg" class="st14">
<style type="text/css"> 
   .st14 {font-size:12} </style>
 <text fill="#000" font-family="Times New Roman" font-size="1em" x="15.38" y="10.8">G</text>
</svg>

Output: output.svg.txt

<svg height="223.88" style="font-size:12;color-interpolation-filters:sRGB;fill:none;fill-rule:evenodd;stroke-linecap:square;stroke-miterlimit:3" viewBox="0 0 269.385 167.912" width="359.18" xmlns="http://www.w3.org/2000/svg">
 <text fill="#000" font-family="Times New Roman" font-size="1em" x="15.38" y="10.8">G</text>
</svg>
RazrFalcon commented 6 years ago

Looks like a chrome bug to me. All other applications render it correctly.

RazrFalcon commented 6 years ago

It can be simplified down to:

<svg width="100" height="200" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
    <text font-family="Arial" font-size="1em" x="15" y="15">Text</text>
</svg>

Looks like Chrome treats an unproportional viewbox differently.

JoKalliauer commented 6 years ago

Maybe someone should make a Chrome-bug-report, but I personally would avoid unproportional viewbox anyway.