Convert to dashes bug if stroke-dasharray has 0
Summary:
If the first value in stroke-dasharray
is 0
such as when drawing a line of dots (e.g. stroke-dasharray:0,1
), then the 'Extensions -> Modify path -> Convert to dashes' operation fails to convert each dot into a subpath.
Steps to reproduce:
- Open Inkscape
- Draw dotted line
- Draw line segment (
B
, click two points,Enter
) - Open 'Object -> Fill and Stroke -> Stroke style'
- Select the first dashed line in 'Dashes'
- Change 'Pattern' from
1 1
to0 4
- Change 'Cap' from 'Butt Cap' to 'Round Cap'
- Draw line segment (
- Convert each dot into a subpath
- Open 'Extensions -> Modify path -> Convert to dashes'
What happened?
Dotted line segment disappears completely in both Inkscape's GUI and in exported PDFs. XML Editor shows the path object exists with some subpath info but nothing is displayed. Note: Firefox 91.6.0esr
still displays the line segment.
What should have happened?
The dotted line segment should have stayed visible.
A kludgey workaround I found is to change the 0
to something small but non-zero (e.g. in 'Stroke style -> Pattern', change 0 4
to 0.01 4
).
example | example-failed | example-kludge |
---|---|---|
![]() |
![]() |
![]() |
Example state before Convert to dashes | Convert to dashes result | Convert do dashes result if using 0 4 -> 0.01 4 kludge |
example.svg, example.pdf | example-failed.svg, example-failed.pdf | example-kludge.svg, example-kludge.pdf |
Note: I have encountered several instances of Inkscape importing .eps
files from academic sources with stroke-dasharray
containing 0
values for dotted lines. I suspect there is a divide-by-zero error in extensions/convert2dashes.py
when parsing stroke-dasharray
values. This bug could be ignored if you argue a dot can't technically be made a path since paths need at least two points, but I'd argue a normal user shouldn't be expected to care too much about this difference; I still think it's a bug.
Version info
Inkscape 1.2-alpha1 (9465ba4, 2022-02-23)
GLib version: 2.64.6
GTK version: 3.24.20
glibmm version: 2.64.2
gtkmm version: 3.24.2
libxml2 version: 2.9.10
libxslt version: 1.1.34
Cairo version: 1.17.4
Pango version: 1.44.7
HarfBuzz version: 2.6.4
OS version: Debian GNU/Linux 10 (buster)