SVG closepath-Command

Bug #399381 reported by hefee
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Krzysztof Kosinski

Bug Description

Hello,

I read the W3C SVG 1.1 Specification from 14 January 2003 [http://www.w3.org/TR/2003/REC-SVG11-20030114/paths.html#PathDataClosePathCommand] and think I found a bug in the svg implementation. If an path is closed to the beginning point an close-path command "Z" is added. Inkscape creates another line-to command "L" to the beginning point is added:

Inkscape makes:
M 0,0 L 1,0 L 0,1 L 0,0 Z

from svg standard i think it should be:
M 0,0 L 1,0 L 0,1 Z

Dear
hefee

Related branches

su_v (suv-lp)
tags: added: extensions-plugins
removed: closepath
Revision history for this message
su_v (suv-lp) wrote :

Closing as 'Fix released' based on: Release notes 0.47 - No more explicit closing line segment
<http://wiki.inkscape.org/wiki/index.php/Release_notes/0.47#No_more_explicit_closing_line_segment>

«Inkscape used to always explicitly write the closing line segment to SVG for closed paths. For example: "M 0,0 L 1,0 L 1,1 L 0,1 L 0,0 z". With the improved SVG path data writing, Inkscape no longer generates this closing line segment, resulting in "M 0,0 L 1,0 L 1,1 L 0,1 z".»

Changed in inkscape:
status: New → Fix Released
tags: removed: extensions-plugins
Revision history for this message
su_v (suv-lp) wrote :

Sorry, I prematurely closed this bug as fixed without proper testing. The optimized path data writing doesn't work at the moment…
<http://wiki.inkscape.org/wiki/index.php?title=Release_notes%2F0.47&diff=54139&oldid=54137>

Changed in inkscape:
importance: Undecided → Low
status: Fix Released → Confirmed
Revision history for this message
Johan Engelen (johanengelen) wrote :

It is a bit strange.. it *used* to work (which is why I added it to the release notes), however, I don't think it has high priority. Inkscape 0.46 also has this behavior, so maybe we can fix it / optimize for 0.48. I'm not too sure about the differences between "M 0,0 L 1,0 L 0,1 L 0,0 Z" and "M 0,0 L 1,0 L 0,1 Z". Perhaps mid-markers will show differently for both paths...

Revision history for this message
Johan Engelen (johanengelen) wrote :

Ok I just checked it again.
Inkscape still generates new paths like "M 0,0 L 1,0 L 0,1 L 0,0 Z". However, if you start with "M 0,0 L 1,0 L 0,1 Z", it is kept that way (without explicit closing segment to the beginning of the path). It is kept in this form when doing transforms and maybe when doing other things. However, when you use the node tool, Inkscape will add the explicit closing segment (like "M 0,0 L 1,0 L 0,1 L 0,0 Z"). This is probably because the nodetool converts 2geom path to its own path representation and then back to 2geom. Maybe the new nodetool by Krzystof will not have this problem.

Revision history for this message
hefee (hefee) wrote :

If I understand the w3c correct, the Z command draws a straight line from the actual Point to the starting Point.

Here the important sentence from w3c: "The "closepath" (Z or z) ends the current subpath and causes an automatic straight line to be drawn from the current point to the initial point of the current subpath."

So M 0,0 L 1,0 L 0,1 L 0,0 Z is a polygon with 5 lines ( 0,0-1,0; 1,0-0,1; 0,1:0,0; 0,0:0,0) and 4 points ( 0,0; 0,1; 1,0; 0,0) ( two times the point 0,0).

and M 0,0 L 1,0 L 0,1 Z has 4 lines (0,0-1,0; 1,0-0,1; 0,1:0,0) and 3 points (0,0; 0,1; 1,0)

Revision history for this message
su_v (suv-lp) wrote :

@Johan - yes, I "re-visited" the release notes and this bug after testing bug #403445 “polygons with mid markers show 1 too many [Regression]” with a current build.

tags: added: node-editing
Revision history for this message
Krzysztof Kosinski (tweenk) wrote :

This is fixed in the new node tool. There is no extra linear segment appended if the last segment is linear.

Changed in inkscape:
assignee: nobody → Krzysztof Kosiński (tweenk)
status: Confirmed → In Progress
Changed in inkscape:
status: In Progress → Fix Committed
jazzynico (jazzynico)
Changed in inkscape:
milestone: none → 0.48
jazzynico (jazzynico)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.