Re: [whatwg] canvas miterLimit property

2012-09-20 Thread Ian Hickson
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.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] canvas miterLimit property

2012-09-20 Thread Ian Hickson
On Fri, 21 Sep 2012, Michael Day wrote:
  
  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.
 
 Yes, we can clamp it to 1.0 when we generate the PDF, just wanted to 
 point out another inconsistency with SVG, where miter limit values less 
 than 1.0 will be ignored as invalid.

The main thing driving this API is back-compat with canvas 
implementations, not consistency with SVG. :-)

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


Re: [whatwg] canvas miterLimit property

2012-09-20 Thread Michael Day

Hi Ian,


The main thing driving this API is back-compat with canvas
implementations, not consistency with SVG. :-)


As always, whatever random crap gets implemented first becomes the 
official standard we have to support forever in the name of backwards 
compatibility because it already has a few dozen users :)


Cheers,

Michael



[whatwg] canvas miterLimit property

2012-09-11 Thread Michael Day

Hi,

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?


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


Cheers,

Michael


Re: [whatwg] canvas miterLimit property

2012-09-11 Thread Rik Cabanier
Good catch!
I'm unsure why SVG is different.

This is a problem with the new Path object [1] 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.
If we ever harmonize the path object so it can be shared by SVG and Canvas,
we will need to account for this.

Rik

1:
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#path

On Tue, Sep 11, 2012 at 9:11 AM, Michael Day mike...@yeslogic.com wrote:

 Hi,

 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?

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

 Cheers,

 Michael



Re: [whatwg] canvas miterLimit property

2012-09-11 Thread Michael Day

Hi Rik,


I'm unsure why SVG is different.


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.


Best regards,

Michael