Bug 434863 - SVG thumbnails are corrupt for Adwaita icons
Summary: SVG thumbnails are corrupt for Adwaita icons
Status: RESOLVED UPSTREAM
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 20.12.3
Platform: Arch Linux Linux
: NOR minor
Target Milestone: ---
Assignee: Dolphin Bug Assignee
URL: https://bugreports.qt.io/browse/QTBUG...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-24 04:39 UTC by Fredrick Brennan
Modified: 2021-03-30 14:51 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot (279.54 KB, image/png)
2021-03-24 04:39 UTC, Fredrick Brennan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fredrick Brennan 2021-03-24 04:39:45 UTC
Created attachment 137011 [details]
Screenshot

SUMMARY
SVG files in the directory /usr/share/icons/Adwaita/scalable/mimetypes/ are corrupt, but they appear correctly in Inkscape, Firefox, etc.

Example broken SVGS:

audio-x-generic-symbolic.svg
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M5 1v7.344A3.574 3.574 0 003.5 8 3.515 3.515 0 000 11.5C0 13.421 1.579 15 3.5 15A3.517 3.517 0 007 11.531v-7.53h6v4.343A3.574 3.574 0 0011.5 8 3.515 3.515 0 008 11.5c0 1.921 1.579 3.5 3.5 3.5 1.9 0 3.465-1.546 3.5-3.437V1z" style="line-height:normal;-inkscape-font-specification:Sans;text-indent:0;text-align:start;text-decoration-line:none;text-transform:none;marker:none" color="#000" font-weight="400" font-family="Sans" overflow="visible" fill="#474747"/></svg>

application-rss+xml-symbolic.svg:
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#474747"><path d="M6 12a2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2 2 2 0 012 2z" style="marker:none" color="#000" overflow="visible"/><path d="M2 6h1.014v1.014H2zm7.014 7.014H10V14h-.986zm4 0H14V14h-.986zM2 2h1.014v1.014H2z"/><path d="M3.014 8.014c2.774 0 5 2.227 5 5h2c0-3.854-3.145-7-7-7z" style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal;marker:none" color="#000" font-weight="400" font-family="sans-serif" overflow="visible"/><path d="M3.014 4.028a8.972 8.972 0 018.987 8.986h2C14 6.96 9.07 2.028 3.014 2.028z" style="line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;shape-padding:0;isolation:auto;mix-blend-mode:normal;marker:none" color="#000" font-weight="400" font-family="sans-serif" overflow="visible"/><path d="M4 7a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1zm0-4a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1zm6 10a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1zm4 0a1 1 0 01-1 1 1 1 0 01-1-1 1 1 0 011-1 1 1 0 011 1z" style="marker:none" color="#000" overflow="visible"/></g></svg>

OBSERVED RESULT
Glitchy thumbnails; see screenshot.

EXPECTED RESULT
Correct rendering as in Inkscape, Firefox. I also observed that the program `convert` from ImageMagick handles them fine.


SOFTWARE/OS VERSIONS
Linux: 5.11.7-zen1-1-zen (Arch Linux)
(available in About System)
KDE Plasma Version: 5.21.3
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2
Comment 1 Nate Graham 2021-03-24 17:08:49 UTC
This is caused by the intersection of two issues:

1. The Qt SVG renderer which is used by all KDE software only supports the TinySVG subset of the full SVG spec, in order to save memory and be more performant. Accordingly in KDE, we make sure to only use TinySVG-compliant elements in our SVGs.
2. Adwaita SVGs do not follow the TinySVG spec, because they do not need to; the GTK SVG renderer supports a wider set of SVG, at the cost of some performance and higher memory use.

So one of three things would have to happen here in order for this to get better:
1. KDE ditches the Qt SVG render in all software in favor of librsvg or some other one
2. The Qt SVG renderer supports more than just TinySVG
3. Adwaita's icons are re-done to conform to TinySVG

Options 2 and 3 are out of KDE's control, which leaves option 1. We periodically discuss it but generally have not done so because it would add a rust dependency to our software and rust is horrible for distros to package, and it would amount to abandoning a thing provided by our upstream, which could damage our relationship with them,

So sadly this is going to have to be one of those "we all know why it sucks but nobody can fix it" things, sorry. :(
Comment 2 Fredrick Brennan 2021-03-24 17:54:00 UTC
Sorry, what part of those SVG's violates the TinySVG spec?
Comment 3 Alois Wohlschlager 2021-03-24 18:22:10 UTC
As an example, the Adwaita icons make use of elliptic paths, which are not supported in SVG Tiny.
Comment 4 Fredrick Brennan 2021-03-25 06:44:30 UTC
Update: Elliptic paths don't seem to have anything to do with these failures. This path messed up svg.path (a Python module), and the maintainer of it found the problem: https://github.com/regebro/svg.path/issues/69#issuecomment-806400936

I think this should be fixed in Qt's SVG renderer.
Comment 5 Nate Graham 2021-03-25 16:28:31 UTC
Interesting. Feel free to submit a Qt bug at https://bugreports.qt.io/.
Comment 6 Fredrick Brennan 2021-03-26 17:31:15 UTC
This is now QTBUG-92184.

https://bugreports.qt.io/browse/QTBUG-92184
Comment 7 Nate Graham 2021-03-30 14:51:39 UTC
Thanks!