[whatwg] Canvas textBaseline 'middle' conflicting definition

Dirk Schulze dschulze at adobe.com
Mon Mar 31 14:08:26 PDT 2014


On Mar 31, 2014, at 5:06 PM, Justin Novosad <junov at google.com> wrote:

> Wow, that is confusing. How can this be fixed without breaking existing web content? Are browsers currently compliant with the canvas spec, or do they implement the CSS definition of middle?
> 

WebKit uses the definition for Canvas. It looks like David Hyatt implemented it in WebKit for Canvas following the Canvas spec a couple of years ago. Therefore, I assume it is the same for Blink. Didn’t check Gecko.

WebKit and Blink both implement 'alignment-baseline' following the definition in SVG as well. Very unfortunate the confusion.

Greetings,
Dirk

> 
> On Sun, Mar 30, 2014 at 3:11 PM, Dirk Schulze <dschulze at adobe.com> wrote:
> Hi,
> 
> Canvas let you set alignment baselines with the textBaseline attribute [1].
> 
> One of the baseline values is ‘middle’. The description of the ‘middle’ baseline seems to be in conflict with the definition for the alignment-baseline property in CSS[2].
> 
> Canvas: The middle of the em square
> CSS: [..] it may be computed using 1/2 the "x-height”
> 
> What Canvas uses as middle is described as ‘center’ in CSS. Is there a way that we can change the naming and/or definition of ‘middle’ in Canvas?
> 
> Greetings,
> Dirk
> 
> [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-textbaseline
> [2] http://www.w3.org/TR/SVG11/text.html#TextAlignmentProperties
> 



More information about the whatwg mailing list