Inkscape does not correctly render square linecaps of zero-length paths
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Invalid
|
Undecided
|
Unassigned |
Bug Description
When defining a zero length path like
<path d="m0 0 0 0" stroke="black" stroke-
Inkscape fails to render the linecap (it should result in a small square with 1x1 px²).
The same issue existed for round linecaps but was fixed at some point, see bug #166298.
Related (but also only talking about round linecaps): bug #689562.
Find attached a testcase showing the three types of linecaps applied to zero-width strokes:
- butt
- round
- square
While butt should result in no visual output, square and round should result in a visible dot or square respectively [1].
Sample renderings will also be attached for
- Inkscape (fails to render square)
- Firefox (renders the testcase correctly)
- librsvg (fails to render square, too)
[1] https:/
Seems this is a cairo limitation. As PS/PDF do not render square linecaps on zero-length paths (as the direction would be undefined) cairo followed this behavior, see [1].
This obviously makes it hard for applications using cairo to render SVGs to conform with the SVG spec. For example Firefox had the same issue and worked around it by manipulating zero-length paths to have a really short length, see [2,3].
Just for reference: Find the relveant test from the SVG 1.1 testsuite at [4].
[1] https:/ /www.cairograph ics.org/ manual/ cairo-cairo- t.html# cairo-stroke /api-dev. bugzilla. mozilla. org/show_ bug.cgi? id=589648 /api-dev. bugzilla. mozilla. org/show_ bug.cgi? id=1187770 /dev.w3. org/SVG/ profiles/ 1.1F2/test/ harness/ htmlObjectMiniA pproved/ painting- control- 04-f.html
[2] https:/
[3] https:/
[4] https:/