Bug 155211 - Regression: dashed lines become solid when breaking imported SVG / exporting to SVG
Summary: Regression: dashed lines become solid when breaking imported SVG / exporting ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.1.4.2 release
Hardware: All All
: high normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:svg, regression
: 146527 148179 156160 157821 (view as bug list)
Depends on:
Blocks: SVG-Import SVG-Save Technical
  Show dependency treegraph
 
Reported: 2023-05-09 10:03 UTC by Roland Baudin
Modified: 2023-11-22 08:31 UTC (History)
10 users (show)

See Also:
Crash report or crash signature:


Attachments
SVG image with dashed lines (17.19 KB, image/svg+xml)
2023-05-09 10:03 UTC, Roland Baudin
Details
New example document for Impress (12.48 KB, application/vnd.oasis.opendocument.presentation)
2023-05-14 11:11 UTC, Roland Baudin
Details
SVG simple image (980 bytes, image/svg+xml)
2023-05-14 11:12 UTC, Roland Baudin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Baudin 2023-05-09 10:03:34 UTC
Description:
In Draw, when trying to break or convert an SVG imported image, dashed lines become solid lines. This issue was introduced in LibreOffice 7.1 and is still there in LibreOffice 7.5.

Steps to Reproduce:
1. In Draw (7.1.x or later), open the attached file test.svg (or use Insert / Image) 

2. Select the imported (or inserted) image and right click on it, then select one of the following menu items: Break, Convert / To Curve, To Polygon, To Contour


Actual Results:
The dashed lines become solid lines.

Expected Results:
The dashed lines should not change to solid lines.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
I tested with LibreOffice 7.0.6.2 and the issue is not there. So the bug was introduced somewhere in the 7.1.x versions.

The issue is present in LibreOffice 7.5.3.2.

The issue affects TexMaths users that create tikz / pstricks drawings. 


LibreOffice version:

Version: 7.1.8.1 / LibreOffice Community
Build ID: e1f30c802c3269a1d052614453f260e49458c82c
CPU threads: 48; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: CL

System:
Ubuntu 22.04.2 LTS, 64 bits
Comment 1 Roland Baudin 2023-05-09 10:03:56 UTC
Created attachment 187163 [details]
SVG image with dashed lines
Comment 2 Stéphane Guillou (stragu) 2023-05-09 14:35:05 UTC
Confirmed with in recent master:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: b10417eb1e5a4a6959e7fc1cdd9819e5b09d39a4
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Original SVG shows 4 dashed segments, as shown in Firefox, GNOME Image Viewer and Inkscape.
Inkscape shows a custom dashed line styles using 7.5002 / 7.5002 pattern.
LO's imported SVG looks correct, until using Break, which converts to solid lines.

Bibisected with linux-64-7.1 repo to first bad commit a8c7987e61bdb4f12f3a84f5df92c1315525f6f7 which points to core commit b71d9a6d15cfb8a50afdea5ac064f40d84c561f8 which is a cherrypick of:

commit b71d9a6d15cfb8a50afdea5ac064f40d84c561f8
author	Luboš Luňák <l.lunak@collabora.com>	Tue Apr 27 11:44:48 2021 +0200
committer	Luboš Luňák <l.lunak@collabora.com>	Thu Apr 29 16:05:53 2021 +0200
do not apply line dashing in drawinglayer (tdf#136957)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114710

Miklos, do you know by any chance someone who might be able to look at this?
Comment 3 Roland Baudin 2023-05-14 11:11:28 UTC
I did some investigations with the faulty patch. For that, I added a more interesting example document for Impress, that is impress-test.odp.

In that document, I simply inserted the SVG image lines.svg (produced using Inkscape) that contains a line with a solid part and a dash part.

Looking at the patch https://git.libreoffice.org/core/commit/b71d9a6d15cfb8a50afdea5ac064f40d84c561f8, I found the following:


1. In Impress, opening impress-test.odp and breaking the line makes the dashed part solid.

Looking at the patch (the vclmetafileprocessor2d.c part), we see that the graphic object is analyzed in processPolygonStrokePrimitive2D() and the LineInfo structure is set up with dash properties.

A comment in the patch says for the LineInfo structure that "// This will be used by setupStrokeAttributes() in cppcanvas."

But setupStrokeAttributes() in implrenderer.cxx is not called. So the line dashing is not done.


2. In Impress, opening impress-test.odp and doing Slideshow / Start From First Slide makes the dashed part of the line correctly appearing as dashed. This was indeed the purpose of the patch to fix the issue with wrong line dashing in slideshow mode (see bug #136957).

In that case, I found that processPolygonStrokePrimitive2D() is also called and the LineInfo structure is set with dash properties. But now, setupStrokeAttributes() in implrenderer.cxx is called, and the line dashing is correctly done.


So, to sum up:

- when breaking / converting a dashed line (from an SVG imported image) setupStrokeAttributes() is not called and dashed lines are rendered as solid

- when showing the SVG imported image in a slideshow setupStrokeAttributes() is called and dashed lines are correctly rendered


I don't have the skills to fix the bug myself, but perhaps these findings could help some developer to fix it?
Comment 4 Roland Baudin 2023-05-14 11:11:50 UTC
Created attachment 187264 [details]
New example document for Impress
Comment 5 Roland Baudin 2023-05-14 11:12:26 UTC
Created attachment 187265 [details]
SVG simple image
Comment 6 Roland Baudin 2023-05-18 10:58:48 UTC
Perhaps the author of the patch could solve this bug? Could someone contact him?

This bug has an impact on the TexMaths extension (LaTeX equations in LibreOffice).

Thanks!
Comment 7 Stéphane Guillou (stragu) 2023-07-01 19:22:47 UTC
Increasing the priority as it's a regression that affects a long-standing, currently maintained extension.

Xisco, with Roland's pointers, do you know who might be able to help? Or are you interested yourself?
Comment 8 Stéphane Guillou (stragu) 2023-07-04 15:45:23 UTC
Export to SVG also affected, which can be tested with attachment 184620 [details].
Comment 9 Stéphane Guillou (stragu) 2023-07-04 15:52:09 UTC
*** Bug 146527 has been marked as a duplicate of this bug. ***
Comment 10 Stéphane Guillou (stragu) 2023-07-04 15:53:21 UTC
Dotted line export affected too, see duplicate bug 146527. (Marked older one as dupe because there's more info here.)
Comment 11 Stéphane Guillou (stragu) 2023-07-04 21:35:39 UTC
*** Bug 148179 has been marked as a duplicate of this bug. ***
Comment 12 Miklos Vajna 2023-07-05 14:35:27 UTC
(In reply to Stéphane Guillou (stragu) from comment #2)
> Miklos, do you know by any chance someone who might be able to look at this?

Sorry, I didn't notice this question earlier. I'll ask around.
Comment 13 Kira Tubo 2023-10-28 01:20:57 UTC
*** Bug 157821 has been marked as a duplicate of this bug. ***
Comment 14 Stéphane Guillou (stragu) 2023-10-30 11:05:50 UTC
(In reply to Stéphane Guillou (stragu) from comment #2)
> Bibisected with linux-64-7.1 repo to first bad commit
> a8c7987e61bdb4f12f3a84f5df92c1315525f6f7 which points to core commit
> b71d9a6d15cfb8a50afdea5ac064f40d84c561f8 which is a cherrypick of [...]
The 7.1 commit is actually 57595773df9f89245457443a3def786fa0e70a69.

Bug 156160 has the same cause.
Comment 15 Timur 2023-11-22 08:31:12 UTC
*** Bug 156160 has been marked as a duplicate of this bug. ***