W3C home > Mailing lists > Public > public-html@w3.org > July 2009

Re: canvas text: ctx.font='inherit'

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 31 Jul 2009 22:44:45 +0000 (UTC)
To: Simon Pieters <simonp@opera.com>
Cc: "public-html@w3.org" <public-html@w3.org>
Message-ID: <Pine.LNX.4.62.0907312241570.6420@hixie.dreamhostps.com>
On Tue, 21 Jul 2009, Simon Pieters wrote:
>
> "The font DOM attribute, on setting, must be parsed the same way as the 'font'
> property of CSS (but without supporting property-independent stylesheet syntax
> like 'inherit'), ..."
> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#text
> 
> demo for ctx.font='inherit'
> 
> http://software.hixie.ch/utilities/js/live-dom-viewer/?%3Ccanvas%20style%3D%27font%3A30px%20monospace%27%3Ex%3C%2Fcanvas%3E%0A%3Cscript%3E%0Avar%20c%3Ddocument.querySelector(%27canvas%27).getContext(%272d%27)%3B%0Ac.fillText(%27test%27%2C%200%2C%2020)%3B%0Ac.font%3D%27inherit%27%3B%0Ac.fillText(%27test%27%2C%200%2C%2050)%3B%0A%3C%2Fscript%3E%0A%20%3C%2Fbody%3E%0A%3C%2Fhtml%3E
> 
> Firefox seems to use the canvas element's computed value for 'font'.

Firefox uses the canvas element's computed value for 'font' for _any_ 
invalid value passed to the 'font' attribute.


> WebKit seems to use 16px serif.

WebKit uses the initial value for 'initial' and 'inherit'.


I've clarified that 'initial' and 'inherit' must be ignored. I haven't 
changed the spec to match either WebKit or Gecko here.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 31 July 2009 22:45:25 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:15:48 UTC