Bug 131085 - SVG cross-hatch pattern appears with spurious mosaic of squares
Summary: SVG cross-hatch pattern appears with spurious mosaic of squares
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
4.0.0.3 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: SVG-Import
  Show dependency treegraph
 
Reported: 2020-03-03 09:09 UTC by Daniel Neville
Modified: 2023-11-11 21:35 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
python script to generate fairly minimal test SVG with x-hatching (206 bytes, text/plain)
2020-03-03 09:15 UTC, Daniel Neville
Details
SVG test image produced by badhatch.py (1.52 KB, image/svg+xml)
2020-03-03 09:19 UTC, Daniel Neville
Details
lo-sad.svg: Minimalistic SVG which triggers pattern anomaly (1018 bytes, image/svg+xml)
2020-03-03 09:28 UTC, Daniel Neville
Details
LibreOffice Writer screenshot (annotated) (51.88 KB, image/png)
2020-03-03 09:36 UTC, Daniel Neville
Details
sample SVG without defs tags (999 bytes, image/svg+xml)
2023-11-10 18:04 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Neville 2020-03-03 09:09:51 UTC
Description:
The output of any diagonal cross-hatch pattern from matplotlib, specifically the 14 (geometric) lines in the "d" attribute of the "path" tag of the SVG pattern definition matplotlib generates causes Writer, Impress, Draw etc. on my Ubuntu 18.04 and 19.10->20.04rc systems to generate spurious solid filled squared between some of the hatch lines. Removing, adding or editing line segments of the pattern line path data suppresses the appearance of this bug in an unpredictable manner.

Steps to Reproduce:
1. Have matplotlib.pyplot plot a bar graph, say, using the "x" hatch pattern.
2. Save the plot with plt.savefig("badhatch.svg", dpi=50)
3. (optional) Edit the SVG to include only the pattern and the hatched polygon.
4. Drag the SVG file into Writer, Impress or Draw.

Actual Results:
The hatching in the image appears with some of the squares bounded by crossing diagonal lines filled with spurious squares, appearing as a giant 45 degree mosaic of light and dark squares.

Expected Results:
The hatching should appear only as 45 degree crossing lines.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.0.7.3
Build ID: 1:6.0.7-0ubuntu0.18.04.10
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-NZ (en_AU.UTF-8); Calc: group

Version: 6.3.4.2
Build ID: 1:6.3.4-0ubuntu0.19.10.1
CPU threads: 2; OS: Linux 5.3; UI render: default; VCL: gtk3; 
Locale: en-NZ (en_AU.UTF-8); Calc: group
Comment 1 Daniel Neville 2020-03-03 09:15:41 UTC
Created attachment 158329 [details]
python script to generate fairly minimal test SVG with x-hatching

Though the output of this script is fairly small, please see the hand-pruned test SVG also attached. (It is the path data in the pattern definition for the hatch which triggers the SVG importing bug.)
Comment 2 Daniel Neville 2020-03-03 09:19:57 UTC
Created attachment 158330 [details]
SVG test image produced by badhatch.py

The bug-triggering SVG test image produced by the python script via matplotlib. (There is a hand simplified version also.)
Comment 3 Daniel Neville 2020-03-03 09:28:25 UTC
Created attachment 158331 [details]
lo-sad.svg: Minimalistic SVG which triggers pattern anomaly

This SVG is pruned to pretty much the bare minimum that triggers the appearance of spurious filled regions in the rendering of the x-hatch pattern. The appearance of the SVG import bug is very sensitive to the move-to, line-to data in the pattern's line path. Seven right-oblique lines are drawn successively from the top-left corner followed by seven left-oblique lines drawn successively from the lower-left corner.
Comment 4 Daniel Neville 2020-03-03 09:36:09 UTC
Created attachment 158332 [details]
LibreOffice Writer screenshot (annotated)

V6.0.7.3 and V6.3.4.2 both fail to properly import SVGs with hatching of the "x" style from matpltlib. The later version of LibreOffice Writer displays the same spurious filled squares for both lo-sad.svg and badhatch.svg, the output of badhatch.py.
Comment 5 Xisco Faulí 2020-03-03 13:52:08 UTC
Reproduced in

Version: 7.0.0.0.alpha0+
Build ID: 37b4784ca722aa0496cda95191869c2086223e24
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded
Comment 6 Xisco Faulí 2020-03-03 13:53:49 UTC Comment hidden (obsolete)
Comment 7 Xisco Faulí 2020-03-03 14:02:27 UTC Comment hidden (obsolete)
Comment 8 Regina Henschel 2020-03-03 21:26:54 UTC
Reverting the patch does not solve the problem. I still see the filled squares in file "SVG test image produced by badhatch.py" (=badhatch.svg) after I have reverted the patch.

You get the same problem, if you remove all def-elements and g-elements, so that my patch is not involved.

So I suspect a different reason.

The hatching is OK, if the right-oblique lines are put into one path-element and left-oblique lines are put into a second path-element. So it seems to be a rendering problem.
Comment 9 QA Administrators 2022-04-14 03:41:00 UTC Comment hidden (obsolete)
Comment 10 Daniel Neville 2022-04-17 02:29:22 UTC
The spurious hatch rendering bug (revealed by dragging lo-sad.svg into a LibreWriter document) persists in Version 7.2.6.2 (the latest normally available for my fresh install of Ubuntu 21.10)

Adding ppa:libreoffice/ppa and and installing the updates, I now have:

Version: 7.3.2.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: en-NZ (en_AU.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.2~rc2-0ubuntu0.21.10.1~lo1
Calc: threaded

The bug still appears exactly as pictured in the "LibreOffice Writer screenshot (annotated)" attachment above.
Comment 11 BogdanB 2023-11-04 19:03:34 UTC
Also in
Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: dabedcaf27b0af1e38a611b8d8e48444f848e01d
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 12 Stéphane Guillou (stragu) 2023-11-10 18:04:37 UTC
Created attachment 190786 [details]
sample SVG without defs tags

Sample document with <defs> tags removed.
Using this sample document, one can see the issue predate Regina's commit, as in comment 8. For example when inserting into a Writer document in LO 4.0.0.3.
Comment 13 Daniel Neville 2023-11-11 21:35:39 UTC
Prompted by the e-mail notice of a version 7.6.2 of LibreOffice
to try, I installed that and found the hatch rendering bug persists.
(Stéphane Guillou’s super-minimalistic, defs-free test SVG also
reveals the bug.)

The version information copied from Libre Writer:
Version: 7.6.2.1 (X86_64) / LibreOffice Community
Build ID: 56f7684011345957bbf33a7ee678afaf4d2ba333
CPU threads: 4; OS: Linux 6.2; UI render: default; VCL: gtk3
Locale: en-NZ (en_AU.UTF-8); UI: en-US
Calc: threaded

System: Ubuntu 22.04 LTS on a NUC7i5BNH.