W3C home > Mailing lists > Public > public-svg-issues@w3.org > September 2021

[svgwg] Is "M0,0L100,0ZL100,50L200,200ZL,0,200Z" 1 subpath or 3? (#866)

From: tatarize via GitHub <sysbot+gh@w3.org>
Date: Sun, 19 Sep 2021 23:50:52 +0000
To: public-svg-issues@w3.org
Message-ID: <issues.opened-1000453495-1632095451-sysbot+gh@w3.org>
tatarize has just created a new issue for https://github.com/w3c/svgwg:

== Is "M0,0L100,0ZL100,50L200,200ZL,0,200Z" 1 subpath or 3? ==
> 9.3.3. The "moveto" commands
> The "moveto" commands (M or m) must establish a new initial point and a new current point. The effect is as if the "pen" were lifted and moved to a new location. A path data segment (if there is one) must begin with a "moveto" command. Subsequent "moveto" commands (i.e., when the "moveto" is not the first command) represent the start of a new subpath

Here it is clearly laid out that move to establishes the new initial point and starts a subpath. This appears to be rather unambiguous.


> 9.3.4. The "closepath" command
> The "closepath" (Z or z) ends the current subpath by connecting it back to its initial point. ...
> If a "closepath" is followed immediately by a "moveto", then the "moveto" identifies the start point of the next subpath. If a "closepath" is followed immediately by any other command, then the next subpath starts at the same initial point as the current subpath.

Then 9.3.4 says closepath if followed by a moveto then the moveto identifies the start of the next subpath. But, this would have already been established by the definition of moveto that it *always* starts a subpath. This seems to open the question of what happens when a closepath is followed by something *other* than a moveto. 


> If a "closepath" is followed immediately by a "moveto", then the "moveto" identifies the start point of the next subpath. If a "closepath" is followed immediately by any other command, then the next subpath must start at the same initial point as the current subpath.

Now, this explanation of what closepath followed by a non-moveto command is increasingly confusing. The next subpath? So did the Z start that subpath or is it still in the subpath that started with the initial moveto. Does a subsequent `closepath` point to the previous `closepath`'s destination or the previous `moveto`'s destination. 

Keep in mind the first `closepath` destination is the *same* as the previous `moveto` destination. The implementations here do not make any functional difference for Chrome. Markers, stroke-linejoin, and fills do not reveal functional differences. The utility of the `moveto` with compound paths is draw donut-like shapes but without moving a self-intersecting shape is drawn identically. 

If z does not start a new path and were seen as merely a lineto initial point when followed by non-move commands, then the language in 9.3.4 would seem to be a problem since the next subpath could start anywhere your next `moveto` says it starts, and would not start "at the same initial point as the current subpath". Also if `closepath` doesn't actually close the path then some other language is problematic. 

"A closed subpath must be closed with a "closepath" command, this "joins" the first and last path segments. Any other path is an open subpath." -- Would imply you could close the path then reopen it with a different lineto, unless the first Z marks the end of that subpath.

Please view or discuss this issue at https://github.com/w3c/svgwg/issues/866 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Sunday, 19 September 2021 23:50:55 UTC

This archive was generated by hypermail 2.4.0 : Sunday, 19 September 2021 23:50:57 UTC