Re: [svgwg] Rect decomposition is invalid (#753)

In my interpretation of the standard, the two following path representations are strictly equivalent, that is, they should be rendered the same, and editing tools should behave the same:

```
"M 0,0 H 1 V 1 H 0 V 0 z"
"M 0,0 H 1 V 1 H 0 z"
```

I just tried in Inkscape for example. If I create a rect and convert to a path, it gives the second form (shorter). If I explicitly add the final "V 0" with the XML editor to, then Inkscape automatically removes it to go back to the shorter form. This means that Inkscape considers them equivalent, but by default prefers to use the shorter representation.

In other words, my opinion is that the shorter form is indeed nothing else but a shorthand for the longest form. In particular, using editing tools, both should only make 4 control points available to the user for manipulation (not 5 in the case of the longer form). A compelling reason is that otherwise, in SVG 1.1 (that is, without the segment-completing closing-path operation), it would be impossible to represent, say, a 4-sided shape where each side is a cubic (C), with only 4 control points instead of  5: 

![image](https://user-images.githubusercontent.com/4809739/69441449-0e30aa00-0d4b-11ea-9807-aa05f0ba4d36.png)

That is, it makes no sense to *actually add a zero-length segment* (manipulable by the users into a non-zero-length segment) when the last position of a closed subpath coincides with the first position. If for some reasons you do explicitly want a 5th control point with a zero-length segment, then you could do it like this:

```
"M 0,0 H 1 V 1 H 0 V 0 0 z"
```

That being said, Inkscape does also simplify the above to `"M 0,0 H 1 V 1 H 0 z"`... and after more testing I can see that it removes any `"... l 0 0 ..."` in the middle of a path. So Inkscape behavior isn't really an indication of how it interprets closing paths, but rather a side-effect of always removing zero-length segments in general.

But the other argument still stand:
1. **If the two forms were not equivalent**, then when using this interpretation to non-linear segments (beziers, arcs), you wouldn't be able to create a closed path without duplicated control points at the start/end.
2. Therefore, since we do want to allow such closed paths, this means that we should consider the two forms equivalent.

I hope it makes sense.

-- 
GitHub Notification of comment by dalboris
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/753#issuecomment-557603289 using your GitHub account

Received on Friday, 22 November 2019 16:38:23 UTC