W3C home > Mailing lists > Public > www-svg@w3.org > November 2011

Re: Clarification on SVG stroke implementation

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 21 Nov 2011 14:22:59 -0800
Message-ID: <CAAWBYDA57ZBpPUvFrNs9b8nxTRsv=hkvbBCX41pudsQuaKbwzA@mail.gmail.com>
To: Stephen Chenney <schenney@chromium.org>
Cc: www-svg@w3.org
On Mon, Nov 21, 2011 at 1:08 PM, Stephen Chenney <schenney@chromium.org> wrote:
> The SVG spec is ambiguous in two areas of path stroke specification and I
> would like clarification in order to implement the correct behavior.
> First: strokes and zero length lines. The spec is explicit.
> http://www.w3.org/TR/SVG/painting.html#StrokeProperties
>
> A subpath (see Paths) consisting of a single moveto shall not be stroked.
> Any zero length subpath shall not be stroked if
> the ‘stroke-linecap’ property has a value of butt but shall be stroked if
> the ‘stroke-linecap’ property has a value of round or square, producing
> respectively a circle or a square centered at the given point. Examples of
> zero length subpaths include 'M 10,10 L 10,10', 'M 20,20 h 0', 'M 30,30
> z' and 'M 40,40 c 0,0 0,0 0,0'.
>
> Does the path 'M 10 10 M 20 20' define any stroked subpaths? I believe not,
> as there is no "pen-down" drawing in the path. I believe the spec should
> explicitly discuss this case.

It does.  If you follow the reference to the chapter on paths, it
states that every moveto operation starts a new subpath.  The example
path you provide above, then, consists of two zero-length subpaths,
and so nothing is stroked.

> Second: Markers and the definition of "applicable vertex", as in
> http://www.w3.org/TR/SVG/implnote.html#PathElementImplementationNotes
>
> If markers are specified, then a marker is drawn on every applicable vertex,
> even if the given vertex is the end point of a zero-length path segment and
> even if "moveto" commands follow each other.
>
> Specifically, should 'M 10 10' result in the drawing of a marker? Should 'M
> 10 10 M 20 20' produce 2 markers? I believe so in both cases. A point
> plotting application provides a use case, in which a natural way to draw the
> points is to define a marker and any number of move-to, one for each point
> to draw. Such code should work sensibly for just a single point.
> The easiest way to resolve this would be for the spec to define "applicable
> vertex" and provide examples as with the zero length path case.

"applicable vertex" just refers to the starting, ending, or middle
vertexes that markers can sit on.  It's not meant to actually be a new
significant term.

The spec specifically states in the section you quote that zero-length
path segments still receive markers.  The first example path you
provide will thus draw a start marker and an end marker, both at the
same point, but no mid markers.  The second example path you provide
will draw two starting markers and two ending markers, but again no
mid markers.

~TJ
Received on Monday, 21 November 2011 22:23:49 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:49 GMT