Bug 78232 - Embedding PyGal SVG gives black box, but inkscape has no trouble
Summary: Embedding PyGal SVG gives black box, but inkscape has no trouble
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.2.4.1 rc
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.2.0 target:7.6.0.0.beta2
Keywords:
Depends on:
Blocks: SVG-Import
  Show dependency treegraph
 
Reported: 2014-05-03 21:30 UTC by tim-libreoffice
Modified: 2023-06-27 08:05 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
PyGal generated chart, SVG test file (20.89 KB, image/svg)
2014-05-03 21:30 UTC, tim-libreoffice
Details
Inkscape converted to "Plain SVG" (22.15 KB, image/svg+xml)
2014-05-03 21:30 UTC, tim-libreoffice
Details
Both files inserted into a document (PyGal's first, InkScape's second) (37.78 KB, image/png)
2014-05-03 21:31 UTC, tim-libreoffice
Details
How it looks in LibreOffice 24.2 master (6.33 KB, image/png)
2023-06-21 07:31 UTC, Xisco Faulí
Details
simplify document (620 bytes, image/svg+xml)
2023-06-23 15:42 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tim-libreoffice 2014-05-03 21:30:04 UTC
Created attachment 98387 [details]
PyGal generated chart, SVG test file

I'm generating charts using the PyGal library which can be found here:
  http://pygal.org/

I like the ability to build scalable images that can work in both LibreOffice and the web.  Unfortunately, LibreOffice is failing to display the charts I generate.  

When I insert a PyGal generated SVG image (in either calc or write), I get just a black box.  If I instead open the SVG in inkscape, the chart looks fine.  From inkscape I can then save the image as "Plain SVG" in a second file, and then LibreOffice can handle the output of that.

I'm attaching 3 files:
- A PyGal generated SVG
- The Inkscape converted version of the SVG
- A screenshot of what both versions of the SVG look like in calc file


I have compared the SVG source of the two files a bit to see what is different.  The PyGal one has some JavaScript, but stripping this out has no effect on the display in either program.  One big difference is that the PyGal SVG seems to define most styles in a <style> tag and then applies those via classes to the XML file's elements.  The Inkscape "Plain SVG" version seems to have copied all of those style specifications down to each element individually.  So perhaps there are bugs in LibreOffice's interpretation of styles.

Note that I have tested for this issue in several recent versions of LibreOffice.  It exists in all.
Comment 1 tim-libreoffice 2014-05-03 21:30:57 UTC
Created attachment 98388 [details]
Inkscape converted to "Plain SVG"
Comment 2 tim-libreoffice 2014-05-03 21:31:46 UTC
Created attachment 98389 [details]
Both files inserted into a document (PyGal's first, InkScape's second)
Comment 3 steve 2014-10-28 00:52:28 UTC
Download SVG test file. Insert SVG into writer > black box.

Confirmed -> NEW with LO 4.3.3.1 on OSX 10.10, thus OS -> ALL.
Comment 4 Xisco Faulí 2015-11-16 15:54:47 UTC
The problem is that SVG filter doesn't support styles defined inside <style type="text/css">

*** This bug has been marked as a duplicate of bug 94765 ***
Comment 5 Xisco Faulí 2019-09-19 08:39:57 UTC
Not a dupe of bug 94765
Comment 6 QA Administrators 2021-09-20 03:41:27 UTC Comment hidden (noise)
Comment 7 Xisco Faulí 2023-06-21 07:31:23 UTC
Created attachment 188032 [details]
How it looks in LibreOffice 24.2 master
Comment 8 Xisco Faulí 2023-06-21 07:35:21 UTC
The document contains a couple of "&gt;". if they are removed, then it works
Comment 9 Xisco Faulí 2023-06-23 15:42:04 UTC
Created attachment 188066 [details]
simplify document
Comment 10 Commit Notification 2023-06-26 20:46:15 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/930eb99a712a3ad9b76e9edb68bbcea68af36656

tdf#156038, tdf#78232: support css child combinator

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2023-06-27 08:05:19 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/11746198e46909913a5085907dc9d1a8593a0b90

tdf#156038, tdf#78232: support css child combinator

It will be available in 7.6.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.