Re: [svgwg] SVG2 path data coordinates are currently spec'd as integers.

Yeah, that's an "interesting" way to define Catmull-Rom curves. Still, I've added them, as is, to the PR. (Not that I would know how to make a separate PR, even if I wanted to.) 

The only differences with the above are the extra productions:

```
catmull_rom                     ::= [Rr] wsp* catmull_rom_argument 
catmull_rom_argument            ::= coordpair_triplet (delimiter? coordpair)* `
```
And the addition of a `catmull_rom` clause to `command`. Hopefully that's correct -- it passes some rudimentary tests.

State dump of my brain:
- The existing grammar uses hyphens in the name. I've normalised them to underscores.
- I've not used the `_sequence` suffix for `catmull_rom_argument` because it's a single, variable-length argument, rather than a repeated series of fixed-length arguments. (And, it's shorter.)
- The existing grammar doesn't allow whitespace or commas between coordinate pairs, so the spaces in `"M0,0R1,1 2,1 3,0"` are illegal as are the commas in `"M0 0 R1 1,2 1,3 0"`. (You can actually write a curve, but only with minus signs: `"M0,0 R1 1-2 1-3 0"`) Obviously, the above fixes that.
- I've used `coordpair_triplet` because, at heart, the argument is three points that can be extended. Also, it's shorter.
- I've not provided a `closepath` option, although, as currently spec'd, two points and a `Z` would make sense _and_ need explicit grammar. Once you have three points you can rely on the normal `closepath` and handle it semantically. (If we did add an optional `closepath` to every `catmull_rom_argument`, we'd be relying on the note about greedy parsing to resolve ambiguity. For example, without greedy parsing `"M0,0 R1,2 2,4, 3,3Z"` could be resolved as `moveto catmull_rom closepath` or as `moveto catmull_rom`. Although, even there, if both had the same semantics, it would only be an issue for purists )


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

Received on Friday, 22 September 2017 14:21:51 UTC