- From: Tom Shinnick via GitHub <sysbot+gh@w3.org>
- Date: Fri, 09 Jun 2017 05:28:41 +0000
- To: public-svg-issues@w3.org
tshinnic has just created a new issue for https://github.com/w3c/svgwg: == grammar for "closepath can substitute for final coordinate" is broken == Change https://github.com/w3c/svgwg/commit/7cce3e3f80d703660b95a3d3dc13529d9c417932 made many updates to the grammar, also including [allowing a 'Z' closepath command to substitute for the final coordinate pair](https://www.w3.org/TR/SVG2/paths.html#PathDataClosePathCommand) of a curve/arc command. However, in addition to accidentally dropping scientific notation, I believe that change doesn't create a correct grammar to support the intention of the "closepath replaces coordinates" update. For instance, the `curveto` command has arguments "(x1 y1 x2 y2 x y)+". The grammar has ``` curveto::= ("C"|"c") wsp* (curveto_coordinate_sequence | (coordinate_pair_sequence? closepath)) curveto_coordinate_sequence::= coordinate_pair_triplet | (coordinate_pair_triplet comma_wsp? curveto_coordinate_sequence) coordinate_pair_triplet::= coordinate_pair comma_wsp? coordinate_pair comma_wsp? coordinate_pair coordinate_pair_sequence::= coordinate_pair | (coordinate_pair comma_wsp? coordinate_pair_sequence) ``` Example data strings for `curveto` can be found in test `paths-data-19-f.svg` ``` d="M50 150 C50 50 200 50 200 150 C200 50 350 50 350 150" d="M50 150 C50 50 200 50 200 150 200 50 350 50 350 150" d="M50, 200 c0,-100 150,-100 150,0 c0,-100 150,-100 150,0" d="M50, 200 c0,-100 150,-100 150,0 0,-100 150,-100 150,0" ``` showing separate curve commands and single commands coding for multiple curves. Note that `C50 50 200 50 200 150 200 50 350 50 350 150` draws two curves and ending at (350,150). It has two coordinate pair triples. My understanding of the `closepath` change is that the *last* coordinate, the end point for the *last* curve coded, can be omitted if followed directly by a closepath command. The last curve's end point is then the initial point of the segment. But if I'm reading the grammar correctly, one cannot specify `d="C50 50 200 50 200 150 200 50 350 50 Z"`, omitting the previous final "350 150". Here there would be a triple pair, followed by a double pair. The grammar would seem to insist on any number of triple pairs, or any number of double pairs followed by a closepath, e.g. `d="... C200 50 350 50 Z"`. The command above, a triple pair and a double pair, would be invalid for this grammar. Note that the formulation of `elliptical_arc` employing `elliptical_arc_closing_argument` *seems* to be a correct recipe, though offputting. The `curveto`, `smooth_curveto`, `quadratic_bezier` **grammars look wrong**. The `smooth_quadratic_bezier` and `elliptical_arc` grammars might be correct. All this deserves another hard look. Please view or discuss this issue at https://github.com/w3c/svgwg/issues/325 using your GitHub account
Received on Friday, 9 June 2017 05:28:48 UTC