Re: Canvas line style comments

Ian Hickson wrote:
> On Thu, 29 May 2008, Philip Taylor wrote:
>> The spec says: "The lineCap attribute defines the type of endings that 
>> UAs will place on the end of lines. The three valid values are butt, 
>> round, and square. The butt value means that the end of each line is a 
>> flat edge perpendicular to the direction of the line. The round value 
>> ..."
>>
>> That doesn't give any clear "must" requirements for butts. (Nothing else 
>> defines precisely how lines are to be rendered, so this isn't just a 
>> statement of a consequence of a specified line-drawing algorithm, so it 
>> should say "must" here else there won't be any testable requirements for 
>> lineCap=butt.)
> 
> It is intended to be a consequence of the lack of any capping. I've 
> clarified this, but I haven't added a must -- I don't know what the must 
> would be. Is line rendering really not testable?

If I understand my thought processes correctly: I interpret the word 
"must" as a marker meaning "this sentence(/paragraph/etc) describes a 
behaviour to write a test for". I want the spec to tell me to write a 
test for lineCap='butt', so it should say "must" in a sentence that 
describes the butt behaviour.

Currently the only "must" ("The stroke() method must calculate the 
strokes of all the subpaths of the current path, using the lineWidth, 
lineCap, lineJoin, etc etc") is three pages away. If that kind of 
indirect transitive mustiness was acceptable, the spec could just say 
"the canvas element must be implemented as follows: [20 pages without 
saying 'must' again]", which would defeat the point of there being the 
"must" keyword, so clearly that's a bad idea, and I can't think of any 
better ideas, so I prefer the interpretation where "must" simply means 
"write a test here".

(Fortunately the spec pretty much works that way already, and 
lineCap=butt is one of the few cases where it doesn't quite work, so I 
assume my viewpoint is not too radical :-) )

So I don't care about adding "must" in a way that makes a difference 
according to the rules of English and of logic - I just want it to exist 
as a marker in approximately the right location. If it said something 
like "The butt value means that the end of each line must have a flat 
edge perpendicular to the direction of the line", that would satisfy me.


>> "The miter limit ratio is the maximum allowed ratio of the length of the 
>> two continuation lines to the line width" is wrong - it's the maximum 
>> allowed ratio of the miter length to half the line width (e.g. when 
>> mitering a right angle the critical point is miterLimit=sqrt(2)).
> 
> Um, ok. I'm taking your word on this! Please check that the spec is now 
> correct...
> 
>> "If the miter length would be exceeded" - s/length/limit ratio/
> 
> Fixed, ish. Please check that what I wrote made sense.

I don't see any problems when reading the spec now, and I believe it 
matches tests that match implementations, so I think that's okay.

-- 
Philip Taylor
pjt47@cam.ac.uk

Received on Saturday, 21 June 2008 18:09:42 UTC