Fwd: marker-pattern has a weird grammar

On 11 November 2014 09:56, Tab Atkins Jr. <jackalmage@gmail.com> wrote:
[...]

>
> > An odd number of gaps confuses the repeat pattern.


> Why?  You just... keep repeating.  If you both start and end with a
> gap, or with a marker, it just means that the gaps get added together,
> or the markers get stacked.
>
> > If an author wants to place multiple markers at the same point, just use
> a
> > gap of zero.
>
> This simplifies the grammar, but complicates the authoring experience,
> which is an inversion of the priority of constituencies.  If we think
> it's reasonable to allow multiple markers at a given spot (and I think
> it is) then allowing that to be specified directly is simpler.
>

Fair enough, but if we can have gaps at both the beginning and end of a
repeat pattern, then why not two gaps in a row?  And if any arrangement of
any number of gaps or markers is possible, then I think the grammar in the
existing draft encompasses all the possibilities.

It could, however, be cleaned up to re-use the <marker-ref> data type
defined earlier in the specs, and to clearly emphasize that lengths and
percentages are both ways of measuring "gaps" or spacing between markers.
The grammar would then be:

[<marker-ref> | <marker-gap>]+ | none

where
<marker-gap> = <length> | <percentage>
<marker-ref> = none | <url> | child | <child-selector>

The implementation instructions would be:

- Start from the beginning of the path (or path-equivalent for basic
shapes).
- Process the marker pattern one token at a time.
- For each marker gap token, proceed along the path that distance.
- For each marker reference token, draw that marker at the current point on
the path; if the marker reference is "none", skip to next token.
- Continue until you reach the end of the path, recycling the pattern as
necessary.

To avoid infinite loops, it would need to be clearly specified that a
marker pattern with a total length (sum of all <marker-gap> values) of
zero, or with a negative length, would be in error and would be treated as
`marker-pattern:none`.  A value of none would instruct that no marker
pattern is drawn, although of course there could still be markers from the
other marker properties.

One further thing that needs to be clarified: are percentages defined in
the user coordinate system or relative to path length?  Some of the past
discussions have seemed to assume that percentages would be relative to
path length.  But dash array percentages are calculated relative to the
coordinate system definition of 100%.  I think for consistency the marker
gaps should be defined the same way.  As much as I'd love to have a way of
specifying dashes relative to path length, that's another discussion.

[...]


> > After simplifying that much, I couldn't help complicating it up again...
> [snip]
>
> Keep these ideas around, but we're trying to get the initial version
> of SVG2 locked down and solidified first, before complicating it too
> much further. ^_^
>
> Fair enough for that, too.  The basic, un-adjusted pattern repeating the
entire length of the path would still be the same, so that's what we can
start out with.

--ABR

Received on Wednesday, 12 November 2014 00:26:30 UTC