W3C home > Mailing lists > Public > www-svg@w3.org > April 2010

Question about stroke-linecap="square" and zero-length paths

From: Jeff Schiller <codedread@gmail.com>
Date: Tue, 20 Apr 2010 15:22:37 -0500
Message-ID: <x2sda131fde1004201322v2398a8d1mb01b6782bd63b57@mail.gmail.com>
To: www-svg <www-svg@w3.org>
Hello SVG WG,

I know that the following text was back-ported from SVGT 1.2 to SVG
1.1 2nd Edition:


"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'."

I am wondering what the value is in having the linecap of "square"
produce a square when the path is zero-length?

With "round", the behavior seems clear and sensible:

at T=t0: stroke-linecap="round" d="M100,100 L100,100" => produces a circle
at T=t1: stroke-linecap="round" d="M100,100 L200,200" => elongates the
path diagonally, keeping consistent end-caps

Things work sensibly and as you'd expect.

But what about the exact same example with stroke-linecap="square"?

It's clear what the path should look like at t1, but I guess the
square is axis-aligned in the path's coordinate system at t0?  This
produces a discontinuity where at t0 the square is axis-aligned but at
any other point, the square cap rotates 45 degrees abruptly.  There is
no "continuity".

I started looking at this in the context of the test created by
Microsoft in their testing center [1], looked at the WebKit code and
realized that this would have to be special-cased and then started
questioning the value of the feature.


[1] http://samples.msdn.microsoft.com/ietestcenter/svg112/svg_harness.htm?url=./svg112/svg/chapter_11.4.svg
Received on Tuesday, 20 April 2010 20:23:13 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:20 UTC