Bug 336436 - Switch to webkit or blink when rendering SVG files
Summary: Switch to webkit or blink when rendering SVG files
Status: RESOLVED UPSTREAM
Alias: None
Product: gwenview
Classification: Applications
Component: general (show other bugs)
Version: 20.08.3
Platform: Gentoo Packages Linux
: VHI wishlist
Target Milestone: ---
Assignee: Gwenview Bugs
URL:
Keywords:
: 307331 353085 359550 364534 405660 417815 423655 432330 448110 451554 478505 487398 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-06-19 13:30 UTC by rgb.mldc
Modified: 2024-06-15 16:00 UTC (History)
28 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Sample SVG with complet layout (75.08 KB, image/svg+xml)
2014-06-19 13:34 UTC, rgb.mldc
Details
Gwenview renedering issue of a SVG. (154.28 KB, image/png)
2019-12-06 13:28 UTC, postix
Details
Sample file of the above post. (211.75 KB, image/svg+xml)
2019-12-06 13:29 UTC, postix
Details
SVG file produced by LibreOffice Draw (127.54 KB, application/zip)
2023-03-20 15:02 UTC, medin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rgb.mldc 2014-06-19 13:30:21 UTC
On this document 

http://qt-project.org/doc/qt-5/svgrendering.html

you can read "Qt supports the static features of SVG 1.2 Tiny. ECMA scripts and DOM manipulation are currently not supported."

That means that several SVG features like text on paths are not rendered by Qt based applications. On several Qt bug reports like this one 

https://bugreports.qt-project.org/browse/QTBUG-12588

(closed as "out of scope") is recommended to use webkit when rendering complex SVG files. 

Maybe Gwenview needs to switch to webkit or blink when rendering SVG files.

Reproducible: Always




I do not see a way to attach a sample SVG file now, so I'll attach one on the comments. That file opens without a problem on rekonq, inkscape, chromium and OpenOffice, but display several problems on Gwenview and karbon14, like missing text, lines that should be invisible are displayed, etc.
Comment 1 rgb.mldc 2014-06-19 13:34:12 UTC
Created attachment 87279 [details]
Sample SVG with complet layout

The attached SVG file opens fine on webkit based applications like rekonq and on other applications like inkscape or OpenOffice is displayed without errors too, but shows several problems on Gwenview and karbon14 due to non complete SVG support.
Comment 2 Christoph Feck 2016-06-27 23:18:00 UTC
*** Bug 307331 has been marked as a duplicate of this bug. ***
Comment 3 Christoph Feck 2016-06-27 23:18:25 UTC
*** Bug 353085 has been marked as a duplicate of this bug. ***
Comment 4 Christoph Feck 2016-06-27 23:18:50 UTC
*** Bug 359550 has been marked as a duplicate of this bug. ***
Comment 5 Christoph Feck 2016-06-27 23:19:16 UTC
*** Bug 364534 has been marked as a duplicate of this bug. ***
Comment 6 Holger 2018-10-07 10:42:45 UTC
*** This bug has been confirmed by popular vote. ***
Comment 7 Christoph Feck 2019-03-19 21:43:24 UTC
*** Bug 405660 has been marked as a duplicate of this bug. ***
Comment 8 postix 2019-12-06 13:28:17 UTC
Created attachment 124338 [details]
Gwenview renedering issue of a SVG.

I guess I experience the same bug(s).

KDE Plasma Version: 5.17.4
KDE Frameworks Version: 5.65.0
Qt Version: 5.13.2
Comment 9 postix 2019-12-06 13:29:28 UTC
Created attachment 124339 [details]
Sample file of the above post.
Comment 10 Nate Graham 2020-02-18 05:24:29 UTC
*** Bug 417815 has been marked as a duplicate of this bug. ***
Comment 11 ebray187 2020-11-12 14:54:56 UTC
And more than 10 years after, the same bug persist... Is there any plan so that KDE's default image viewer can properly render SVG images in 2020?

 OS: Gentoo 
 Kernel: x86_64 Linux 5.4.72-gentoo
 DE: KDE 5.74.0 / Plasma 5.19.5
 WM: KWin

kde-apps/gwenview-20.08.3:5::gentoo  USE="X activities handbook kipi mpris semantic-desktop -debug -fits -raw -share -test"
Comment 12 Madhav Kanbur 2021-02-04 08:17:29 UTC
*** Bug 432330 has been marked as a duplicate of this bug. ***
Comment 13 Madhav Kanbur 2021-02-04 08:24:28 UTC
(In reply to ebray187 from comment #11)
> And more than 10 years after, the same bug persist... Is there any plan so
> that KDE's default image viewer can properly render SVG images in 2020?
> 
>  OS: Gentoo 
>  Kernel: x86_64 Linux 5.4.72-gentoo
>  DE: KDE 5.74.0 / Plasma 5.19.5
>  WM: KWin
> 
> kde-apps/gwenview-20.08.3:5::gentoo  USE="X activities handbook kipi mpris
> semantic-desktop -debug -fits -raw -share -test"

I'm gonna take a shot at switching over to Qt WebEngine (based on Chromium/Blink). I'm still getting acquainted with Gwenview's code base so I can't make any promises but I'm definitely going to give it a try.
Comment 14 Christoph Feck 2021-02-04 16:44:33 UTC
No need to look at Gwenview's source, check kimageformats/qimageformats instead. These have code to load a file into a QImage.
Comment 15 Madhav Kanbur 2021-02-04 18:17:28 UTC
(In reply to Christoph Feck from comment #14)
> No need to look at Gwenview's source, check kimageformats/qimageformats
> instead. These have code to load a file into a QImage.

I'll have a look at it. Thanks a ton.
Comment 16 Bug Janitor Service 2021-02-19 11:45:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/gwenview/-/merge_requests/41
Comment 17 postix 2021-07-10 15:12:35 UTC
Is this still assigned?
Is the solution to switch to webkit or blink still considered to be the best choice after the discussion at https://invent.kde.org/graphics/gwenview/-/merge_requests/41 ? 
Are there any smaller alternative libraries which could be used and are easier to maintain?
Comment 18 postix 2021-07-10 15:25:54 UTC
*** Bug 270838 has been marked as a duplicate of this bug. ***
Comment 19 postix 2021-07-10 15:27:00 UTC
*** Bug 423655 has been marked as a duplicate of this bug. ***
Comment 20 Shlomi Fish 2021-07-18 08:06:49 UTC
(In reply to postix from comment #17)
> Is this still assigned?
> Is the solution to switch to webkit or blink still considered to be the best
> choice after the discussion at
> https://invent.kde.org/graphics/gwenview/-/merge_requests/41 ? 
> Are there any smaller alternative libraries which could be used and are
> easier to maintain?

just FYI: there are librsvg and cairo, and we can try piggybacking on CLI inkscape - with a fallback.
Comment 21 Holger 2022-01-09 19:03:01 UTC
*** Bug 448110 has been marked as a duplicate of this bug. ***
Comment 22 Nate Graham 2022-03-25 18:42:32 UTC
*** Bug 451554 has been marked as a duplicate of this bug. ***
Comment 23 medin 2023-03-20 15:02:09 UTC
Created attachment 157447 [details]
SVG file produced by LibreOffice Draw

For now, even SVG files produced by LibreOffice Draw (7.5) cannot be viewed correctly with Gwenview while LibreOffice Writer, Firefox, Scribus and Inkscape show them perfectly.
Comment 24 Holger 2023-06-26 00:00:09 UTC
Will KSVG be a valid alternative library to properly draw fullscreen pictures, or can it only display icons?
Will KSVG support e.g. SVG 2 features in development since 2018 (or anything newer than 1.2 tiny from 2008)?
Is version 1.0 production ready and suitable for inclusion in Gwenview?

https://invent.kde.org/frameworks/ksvg
https://www.w3.org/TR/SVG2/
https://www.w3.org/TR/SVGTiny12/
Comment 25 Nate Graham 2023-07-25 19:25:41 UTC
No, because KSvg sits on top of the Qt SVG renderer, which is what suffers from this problem.

The solutions are:
1. Improve the Qt SVG renderer
2. Use different SVG renderer
Comment 26 Nate Graham 2023-12-14 17:36:55 UTC
*** Bug 478505 has been marked as a duplicate of this bug. ***
Comment 27 Christoph Feck 2024-05-08 22:19:19 UTC
Qt 6.7 has improved SVG rendering by adding support for elements that go beyond the SVG Tiny spec, see https://www.qt.io/blog/qt-svg-not-so-1.2-tiny-any-more
Comment 28 Prajna Sariputra 2024-05-08 22:37:45 UTC
As discussed in bug 448234, Qt 6.7 unfortunately does not address all (or even most?) of the problematic SVGs people have encountered, and even in this bug report Gwenview still has trouble rendering the SVGs in comment 1 (the graph lines end up going outside of the box) and comment 27 (the text in the diagram is missing).

Although at least Qt is no longer against going beyond the Tiny spec at all now, so hopefully future Qt releases will have more of an impact.
Comment 29 Nate Graham 2024-05-09 19:47:33 UTC
Indeed, QtSvg just got support for Gaussian blurs for 6.8: https://bugreports.qt.io/browse/QTBUG-123138

That plus clipping paths should make a big difference.
Comment 30 Antonio Rojas 2024-05-23 06:32:06 UTC
*** Bug 487398 has been marked as a duplicate of this bug. ***
Comment 31 Nate Graham 2024-06-15 16:00:40 UTC
So I think it's time to close this as RESOLVED UPSTREAM. The Qt folks have put work into improving their SVG renderer, with some improvements landing in 6.7, and others in 6.8, with still more to come.

So far no feasible alternative to waiting for these fixes has emerged. That makes it, in all practicality, purely an upstream issue, and thankfully our upstream appears to be working to address it.