Skip to content

Commit

Permalink
Remove support for segment-completing close path
Browse files Browse the repository at this point in the history
Segment-completing close path commands, where coordinates are omitted
and implicitly replaced with the initial point of the subpath,
lack implementations and have been removed from the spec.

Discussed in #385
  • Loading branch information
Eric Willigers authored and ericwilligers committed Aug 13, 2018
1 parent df0dbd4 commit 9565700
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 93 deletions.
4 changes: 0 additions & 4 deletions master/changes.html
Expand Up @@ -433,10 +433,6 @@ <h3 id="coords">Coordinate Systems, Transformations and Units chapter (owner: Bo
<h3 id="paths">Paths chapter (owner: ericwilligers)</h3>

<ul>
<li>Allow <strong>Z</strong> or <strong>z</strong> to fill in
missing path coordinate data in the previous command with the
coordinate of the initial point in the subpath.</li>

<li>Define <a>'path'</a>, <a>'polygon'</a> and <a>'polyline'</a> elements with no data set (empty or zero valid commands) to not render.</li>

<!--
Expand Down
101 changes: 12 additions & 89 deletions master/paths.html
Expand Up @@ -340,33 +340,13 @@ <h3 id="PathDataMovetoCommands">The <strong>"moveto"</strong> commands</h3>
<h3 id="PathDataClosePathCommand">The <strong>"closepath"</strong> command</h3>

<p>The "closepath" (<strong>Z</strong> or <strong>z</strong>)
must end the current subpath by connecting it back to its <a>initial point</a>
in either of two ways:
ends the current subpath by connecting it back to its <a>initial point</a>.
An automatic
straight line is drawn from the current point to the <a>initial point</a>
of the current subpath. This <a>path segment</a> may be of zero
length.
</p>

<ol>
<li>
If the previous command is <q>complete</q>, that is that all the
required coordinate data has been supplied, then an automatic
straight line must be drawn from the current point to the <a>initial point</a>
of the current subpath. This <a>path segment</a> may be of zero
length.
</li>
<li class='ready-for-wider-review'>
If the previous command is a <a href="paths.html#PathDataLinetoCommands">"lineto"</a>,
<a href="paths.html#PathDataCubicBezierCommands">"curveto"</a>,
<a href="paths.html#PathDataCubicBezierCommands">"smooth curveto"</a>,
<a href="paths.html#PathDataQuadraticBezierCommands">"quadratic Bézier curveto"</a>,
<a href="paths.html#PathDataQuadraticBezierCommands">"smooth quadratic Bézier curveto"</a>,
or <a href="paths.html#PathDataEllipticalArcCommands">"elliptical arc"</a>,
that is missing required coordinate data,
then this is a <dfn id="TermSegment-CompletingClosePath">segment-completing close path command</dfn>.
No additional path segment is generated by the command; instead,
the <a>initial point</a> for this subpath must be used
in place of each missing <var>(x,y)</var> coordinate to complete the previous segment.
</li>
</ol>

<table class="PathDataTable">
<tr>
<th>Command</th>
Expand All @@ -386,22 +366,6 @@ <h3 id="PathDataClosePathCommand">The <strong>"closepath"</strong> command</h3>
</tr>
</table>

<p class="note">
SVG 2 adds the ability to fill in missing coordinate data with
the <strong>Z</strong> or <strong>z</strong> command to avoid the
need to add a zero length (or very short in the case of relative
paths with rounding errors) <a>path segment</a> to close a subpath. This
can effect the number of markers drawn and their orientation at
the beginning/end of a closed subpath.
</p>
<p class="annotation">
The use of <strong>Z</strong> or <strong>z</strong> to replace
missing coordinate data with the coordinate of the <a>initial point</a> in
a subpath was resolved at the
<a href="http://www.w3.org/2015/02/12-svg-minutes.html#item04">Sydney
(2015)</a> meeting.
</p>

<p>A <dfn id="TermClosedSubpath">closed subpath</dfn> must be closed with a
"closepath" command, this "joins" the first and last <a>path segments</a>.
Any other path is an <dfn id="TermOpenSubpath">open subpath</dfn>.</p>
Expand All @@ -421,39 +385,6 @@ <h3 id="PathDataClosePathCommand">The <strong>"closepath"</strong> command</h3>
other command, then the next subpath must start at the same <a>initial point</a>
as the current subpath.</p>

<p>Examples:</p>
<ul>
<li>
m 100,100 50,0 0,50 z:

Implicit <strong>l</strong> command complete, <strong>z</strong> causes a
straight line to be drawn resulting in a closed triangular path.
</li>
<li>
m 100,100 a 50,50 0 0 1 100,0 z:

<strong>a</strong> command complete, <strong>z</strong> causes a
straight line to be drawn resulting in a closed semi-circular path.
</li>
<li>
m 100,100 a 50,50 0 0 1 100,0 50,50 0 0 1 z:

Second set of coordinates for the <strong>a</strong> command
missing final point, <strong>z</strong> causes <a>initial point</a> to
be used as final point resulting in a closed circular path.
</li>
<li>
m 100,100 a 50,50 0 0 1 100,0 c z:

<strong>c</strong> command missing three coordinates,
<strong>z</strong> causes <a>initial point</a> to be used as coordinate
data for all <strong>c</strong> coordinates resulting in a
closed semi-circle. Visually <strong>c</strong>
<strong>z</strong> is the same as <strong>z</strong> but may be
useful in animating path data.
</li>
</ul>

<h3 id="PathDataLinetoCommands">The <strong>"lineto"</strong> commands</h3>

<p>The various "lineto" commands draw straight lines from the
Expand Down Expand Up @@ -833,13 +764,13 @@ <h3 id="PathDataBNF">The grammar for path data</h3>
| elliptical_arc

moveto::=
( "M" | "m" ) wsp* coordinate_pair_sequence wsp* closepath?
( "M" | "m" ) wsp* coordinate_pair_sequence

closepath::=
("Z" | "z")

lineto::=
("L"|"l") wsp* (coordinate_pair_sequence | closepath)
("L"|"l") wsp* coordinate_pair_sequence

horizontal_lineto::=
("H"|"h") wsp* coordinate_sequence
Expand All @@ -848,35 +779,31 @@ <h3 id="PathDataBNF">The grammar for path data</h3>
("V"|"v") wsp* coordinate_sequence

curveto::=
("C"|"c") wsp* (curveto_coordinate_sequence | (coordinate_pair_sequence? closepath))
("C"|"c") wsp* curveto_coordinate_sequence

curveto_coordinate_sequence::=
coordinate_pair_triplet
| (coordinate_pair_triplet comma_wsp? curveto_coordinate_sequence)

smooth_curveto::=
("S"|"s") wsp* (smooth_curveto_coordinate_sequence
| (coordinate_pair_sequence? closepath))
("S"|"s") wsp* smooth_curveto_coordinate_sequence

smooth_curveto_coordinate_sequence::=
coordinate_pair_double
| (coordinate_pair_double comma_wsp? smooth_curveto_coordinate_sequence)

quadratic_bezier_curveto::=
("Q"|"q") wsp*
(quadratic_bezier_curveto_coordinate_sequence | (coordinate_pair_sequence? closepath))
("Q"|"q") wsp* quadratic_bezier_curveto_coordinate_sequence

quadratic_bezier_curveto_coordinate_sequence::=
coordinate_pair_double
| (coordinate_pair_double comma_wsp? quadratic_bezier_curveto_coordinate_sequence)

smooth_quadratic_bezier_curveto::=
("T"|"t") wsp* (coordinate_pair_sequence | closepath)
("T"|"t") wsp* coordinate_pair_sequence

elliptical_arc::=
( "A" | "a" ) wsp*
(elliptical_arc_argument_sequence
| (elliptical_arc_argument_sequence? elliptical_arc_closing_argument))
( "A" | "a" ) wsp* elliptical_arc_argument_sequence

elliptical_arc_argument_sequence::=
elliptical_arc_argument
Expand All @@ -886,10 +813,6 @@ <h3 id="PathDataBNF">The grammar for path data</h3>
number comma_wsp? number comma_wsp? number comma_wsp
flag comma_wsp? flag comma_wsp? coordinate_pair

elliptical_arc_closing_argument::=
number comma_wsp? number comma_wsp? number comma_wsp
flag comma_wsp? flag comma_wsp? closepath

coordinate_pair_double::=
coordinate_pair comma_wsp? coordinate_pair

Expand Down

0 comments on commit 9565700

Please sign in to comment.