[whatwg] canvas miterLimit property

Ian Hickson ian at hixie.ch
Thu Sep 20 16:49:45 PDT 2012

On Tue, 11 Sep 2012, Michael Day wrote:
> The canvas miterLimit property has a default value of 10, while the SVG 
> stroke-miterlimit property has a default value of 4. Is there a reason 
> for this inconsistency?

It's what Apple implemented when they invented <canvas>.

> For reference, the PDF rendering model also has a default value of 10 
> for miterLimit, making SVG apparently the odd one out here.

That's probably why Apple used 10.

On Tue, 11 Sep 2012, Rik Cabanier wrote:
> This is a problem with the new Path object that takes an SVG path 
> string. A user will have to remember to set the miter limit to the SVG 
> default otherwise the path might render differently in Canvas.

More specifically, they'll have to remember to set the miter limit to 
whatever they want the miter limit to be. This is the same as when drawing 
paths in canvas or SVG today, it's not new just becauser we support using 
SVG path syntax in canvas.

On Wed, 12 Sep 2012, Michael Day wrote:
> While we are on the subject, in SVG stroke-miterlimit must be >= 1.0, 
> whereas in the canvas it must be >= 0.0.
> In Prince we are clamping it to 1.0, as the PDF spec is consistent with 
> SVG this time, and Adobe Reader will fail if the miter limit is dropped 
> below 1.0.

What do you mean by fail?

Unless I'm doing my maths wrong, a miter limit below 1.0 is equivalent to 
one equal to 1.0, since 1.0 is the lower possible miter ratio (the 
distance from the join point to the outer intersection point can't 
possibly be less than the line width, otherwise it wouldn't be the outside 
of the join, no?).

Its trivial to treat numbers 0.0 < q <= 1.0 as 1.0. No need to fail. 
Browsers (at least Opera, Safari, Firefox, and Chrome) consistently follow 
the spec here.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list