tibold / svg-explorer-extension

Extension module for Windows Explorer to render SVG thumbnails, so that you can have an overview of your SVG files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some SVGs not render correctly

User756675678 opened this issue · comments

I use v1.0.19 x64
1.
<svg width="68" height="48" xmlns="http://www.w3.org/2000/svg"><path d="M66.5 7.7c-.8-2.9-2.5-5.4-5.4-6.2C55.8.1 34 0 34 0S12.2.1 6.9 1.6c-3 .7-4.6 3.2-5.4 6.1a89.6 89.6 0 000 32.5c.8 3 2.5 5.5 5.4 6.3C12.2 47.9 34 48 34 48s21.8-.1 27.1-1.6c3-.7 4.6-3.2 5.4-6.1C68 35 68 24 68 24s0-11-1.5-16.3z"/><path fill="#fff" d="M45 24L27 14v20"/></svg>
Must be
изображение
But rendered as
изображение

<svg viewBox="0 0 20 22" xmlns="http://www.w3.org/2000/svg"><path d="M12.08 0H7.92A7.92 7.92 0 000 7.91v3.76c0 3.25 2 6.17 5 7.36v2.43a.42.42 0 00.7.31l2.41-2.19h3.97A7.92 7.92 0 0020 11.67V7.9A7.92 7.92 0 0012.08 0z"/><path d="M10.95 6.77a.42.42 0 10-.23.8 1.9 1.9 0 011.3 1.3.42.42 0 00.8-.23 2.72 2.72 0 00-1.87-1.87z" fill="#fff"/><path d="M14.12 9.26c.04 0 .08 0 .12-.02a.4.4 0 00.28-.51A5.3 5.3 0 0010.9 5.1a.42.42 0 10-.23.8 4.45 4.45 0 013.05 3.05c.05.19.22.3.4.3z" fill="#fff"/><path d="M10.72 3.16a.42.42 0 10-.23.8 7.54 7.54 0 015.17 5.17.42.42 0 00.8-.22 8.38 8.38 0 00-5.74-5.75zm4.52 10.22c-.03-.1-.24-.25-.62-.44a18.77 18.77 0 00-.98-.54 17.47 17.47 0 01-.94-.58.54.54 0 00-.23-.06c-.11 0-.25.08-.42.24-.16.16-.31.33-.45.51-.14.19-.28.36-.44.51-.15.16-.28.24-.38.24a.56.56 0 01-.18-.04 1.93 1.93 0 01-.53-.28c-.75-.42-1.4-.9-1.94-1.44A8.68 8.68 0 016.6 9.4a2.98 2.98 0 01-.19-.37.56.56 0 01-.04-.18c0-.1.08-.23.24-.38.15-.16.32-.3.5-.44.2-.14.36-.29.52-.45.16-.17.24-.3.24-.42a.54.54 0 00-.06-.23 19.62 19.62 0 00-1.12-1.91c-.19-.4-.34-.6-.44-.63a.46.46 0 00-.17-.03 3.27 3.27 0 00-1.15.26c-.27.11-.56.45-.87 1a3.2 3.2 0 00-.17 2.84 31.96 31.96 0 00.32.87c.19.54.42 1.02.68 1.44.44.7 1.03 1.44 1.78 2.19s1.48 1.34 2.19 1.78a7.5 7.5 0 001.85.83 32.92 32.92 0 00.85.3 3.6 3.6 0 00.9.12 3.2 3.2 0 001.54-.42c.56-.3.9-.6 1.01-.87a3.25 3.25 0 00.23-1.32z" fill="#fff"/></svg>
Must be:
изображение
But rendered as
изображение

<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M14.3 1c-.7.1-3 .7-3.3 4a5.2 5.2 0 011.8 9.8A5.3 5.3 0 014.7 11c-1-6 4-10.2 9.5-10A10 10 0 000 10a10 10 0 1014.3-9z" fill="#F91600"/></svg>
Must be:
изображение
But rendered as
изображение

<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M10 0A10 10 0 000 10.4C2.6 6 6 5.3 6.2 5.3V5a2.2 2.2 0 11.5 1.4c-4 2.5-5 8.1-4.9 9.2l1.5 1.8A15 15 0 0113.3 9a2.2 2.2 0 11.5 1.4 11.5 11.5 0 00-6.7 9A10 10 0 0020 10 10 10 0 0010 0z" fill="#FBB616"/></svg>
Must be:
изображение
But rendered as
изображение

I can provide more examples if need, but I think reason is same for all.

how I can fix render of this svg?
I use SVGOMG for build it.

I get the same wrong results here. The sample svg look fine in Inkscape, Firefox and Chrome.

Thanks for the examples.
I'll see if there is anything we can do about it. My initial guess is that we'll need to report these to the Qt guys as bugs.

Possible reason not in render, Maybe in some options for it.
If such options exists of course.
IDK have you render files and exists some options or not.

I found cause. QT bug.
If EllipticalArcCommands written in short form then it is buggy. For example bugged svg:
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M14.3 1c-.7.1-3 .7-3.3 4a5.2 5.2 0 011.8 9.8A5.3 5.3 0 014.7 11c-1-6 4-10.2 9.5-10A10 10 0 000 10a10 10 0 1014.3-9z" fill="#F91600"/></svg>
Fixed svg:
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M14.3 1c-.7.1-3 .7-3.3 4a5.2 5.2 0 0 1 1.8 9.8A5.3 5.3 0 0 1 4.7 11c-1-6 4-10.2 9.5-10A10 10 0 0 0 0 10a10 10 0 1 0 14.3-9z" fill="#F91600"/></svg>
I add spaces for flags in A command.
before:
a5.2 5.2 0 011.8 9.8
after:
a5.2 5.2 0 0 1 1.8 9.8
So you can easy fix it use some regular expression for find this commands and add spaces if it is not there. After that pass fixed svg to render until QT not fix a bug.
As dirty fix it can be done via some simple regexp.
As proper solution you need carefully read SVG path definition docs, because duplicate of same commands can be written in short form without command name.
Maybe exists some another pitfalls.

Also need report to QT about this bug.

Simple regex for fix:
([Aa][\x09\x20\x0A\x0C\x0D,]*(?:[0-9]+(?:[.][0-9]+)?|[.][0-9]+)[\x09\x20\x0A\x0C\x0D,]*(?:[0-9]+(?:[.][0-9]+)?|[.][0-9]+)[\x09\x20\x0A\x0C\x0D,]*(?:[0-9]+(?:[.][0-9]+)?|[.][0-9]+)[\x09\x20\x0A\x0C\x0D,]*)([01])[\x09\x20\x0A\x0C\x0D,]*([01])
replace with:
$1 $2 $3
Pay attention for ending space.
$n for capture group number. In some regex need use \n syntax instead.

Search can be done for entire svg code. But more proper way - search path attributes and fix only this.

Any progress here?
Also I try find issue on QT tracker and do not find it. You did not create yet?

New release 1.1.0 but issue still here.