Re: marker-pattern syntax

On Nov 21, 2012, at 10:54 PM, Dirk Schulze <dschulze@adobe.com> wrote:

> Hi SVG folks,
> 
> Just looked at the syntax of maker-pattern and think that there is a mistake[1]:
> 
> 	[ none | <length> | <percentage> | <funciri> ]+
> 
> "A bar (|) separates two or more alternatives: exactly one of them must occur."[2]
> 
> Means that just one in the list can occur, which is may or may not be correct.
> 
> <percentage>,<length> "Indicates the length of a gap in the repeated pattern of markers."
> 
> In this case it seems correct. But looking at the example, the values do not define the length of a gap but the distance between two markers (which makes more sense IMO). But in this case the syntax is wrong (and the wording can be improved). It depends on the needs of 'marker' shorthand, but I have two syntax proposals:
> 
> 	none | [ <funciri> || [<length> | <percentage>] ]#
> 
> or
> 
> 	none | [ <funciri> [<length> | <percentage>] ]#

To get back to it: sometimes you want a marker follow a pseudo irregular pattern. It should be possible to define multiple distances:

	marker-pattern: url(#marker1) 20px 40px, url(#marker2) 20% 40px;

The first marker pattern draws a marker after 20px, then after 40px from the first marker position, then after 20px of the second marker position and so on. Same for the second marker pattern. That is why I  would suggest the following change now :)

	marker-pattern: none | [ <url> <distance>+ ]#

with
	<url> as a replacement for <funciri>, like in newer specs (Filter Effects and CSS Masking). The CSS WG agreed to support IRI for <url> as well.
	<distance> = <length> | <percentage> - to make our code more readable.


> 
> The difference is the order of <funciri> and the distance. In the first proposal the order doesn't matter (I would prefer this), in the second the <funciri> must be first.
> 
> I changed the + with a #, because it seems to be more consistent with other CSS properties to comma separate sequences:
> 
> 	marker-pattern: url(#marker1) 20px, url(#marker2) 20%;
> 
> But I did not check if that works well with 'marker' shorthand. But I would expect that marker-patterns will be used more often once they are implemented. Therefore, they should have higher priority in the syntax (means no / separator if possible).
> 
> 
> [1] https://svgwg.org/svg2-draft/painting.html#RepeatingMarkers
> [2] http://www.w3.org/TR/css3-values/

Greetings,
Dirk

Received on Thursday, 22 November 2012 14:45:14 UTC