Clarification on SVG stroke implementation

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 <http://www.w3.org/TR/SVG/paths.html>) consisting of a
single moveto <http://www.w3.org/TR/SVG/paths.html#PathDataMovetoCommands>
shall
not be stroked. Any zero length subpath shall not be stroked if the
‘stroke-linecap’<http://www.w3.org/TR/SVG/painting.html#StrokeLinecapProperty>
property
has a value of butt but shall be stroked if the
‘stroke-linecap’<http://www.w3.org/TR/SVG/painting.html#StrokeLinecapProperty>
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.

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.

This issue is also raised, with similar confusion, in
https://bugzilla.mozilla.org/show_bug.cgi?format=multiple&id=355842

Stephen.

Received on Monday, 21 November 2011 22:12:28 UTC