[whatwg] Canvas line styles comments

Philip Taylor excors+whatwg at gmail.com
Sat Feb 2 11:48:18 PST 2008

Some comments on the newly modified version:

"The lineCap attribute defines the type of endings that UAs shall
place on the end of lines." - it seems weird to use "shall", since
this is the only place in the spec (except the list of RFC2119
keywords) that uses it. The other line* properties don't try define to
conformance requirements like that (e.g. they say "The lineWidth
attribute gives the width of lines" which is only informative), so I
can't tell whether the lineCap one is trying to be a requirement.

"The lineJoin attribute defines the type of corners that that UAs will
place where two lines meet." - s/that that/that/

"A join exists at any point in a subpath shared by two consecutive
pairs of lines." - should be "two consecutive lines" or "a consecutive
pair of lines".

"In addition to the point where the join occurs, two additional points
are relevant to each join: the corners found half the line width away
from the join point, perpendicular to the two lines joining at the
join point." - I'm not sure what that means. Nothing can be
perpendicular to both of the two lines (unless they're parallel). For
each line, there are the two corners half the line width away from the
join point perpendicular to that line, but that gives four corners in

I suppose it'd be alright to say there's four corners, and then talk
about the "two corners on the outside of the join" since the meaning
of "outside" is obvious enough even if it's not defined (at least when
the lines aren't parallel).

"A filled triangle connecting ... with the third point of the triangle
being the point of the join itself (where the lines touch on the
inside of the join), must be rendered at all joins." - the "inside of
the join" bit seems unhelpful and unclear (since it's not the opposite
of the "outside of the join") - it'd be better just to say "... being
the join point, must be ...", since that's the term used earlier for
that point.

"The round value means that a filled arc connecting the two corners on
the outside of the join, with the diameter equal to the line width and
the origin at the point of the join, must be rendered at joins." - if
I was being pedantic (which I am) I'd say there's two possible arcs
connecting those two corners (one clockwise, one anticlockwise), so it
should specify which one is meant. But I don't know how to easily say
that, and an implementor would have to be silly to do it the wrong
way, so maybe a precise definition isn't needed.

Should lineJoin='round';moveTo(0,0);lineTo(100,0);lineTo(0,0);stroke()
draw a semicircle at (100,0) pointing rightwards? There is no "outside
of the join" there, so the spec doesn't say what should happen.

"The miter value means that a filled four-sided polygon must be
rendered at the join, with two of the lines being the perpendicular
edges of the joining lines, ..." - the miter-polygon lines aren't the
perpendicular edges - they're only half of each edge (between the join
point and the outside corners). It's probably easier to define the
polygon's points (being the join point, the two outside corners, and
the point where the two continuated outside edges intersect).

Philip Taylor
excors at gmail.com

More information about the whatwg mailing list