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

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

From: Ian Hickson <ian@hixie.ch>
Date: Sat, 1 Aug 2009 08:06:25 +0000 (UTC)
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: Simon Pieters <simonp@opera.com>, "public-html@w3.org" <public-html@w3.org>
Message-ID: <Pine.LNX.4.62.0908010805190.6420@hixie.dreamhostps.com>
On Sat, 1 Aug 2009, Ian Hickson wrote:
> On Fri, 31 Jul 2009, Boris Zbarsky wrote:
> > Ian Hickson wrote:
> > > Firefox uses the canvas element's computed value for 'font' for _any_
> > > invalid value passed to the 'font' attribute.
> > 
> > Sort of.  What Firefox does is to treat the font as having the following
> > declarations specified:
> > 
> >   font: whatever-you-passed-in;
> >   line-height: normal;
> > 
> > and then act as if that rule were applied to a node that is the child of the
> > <canvas> element (unless the canvas element is not in the document tree, in
> > which case the style is treated as inheriting from "font: 10px sans-serif".
> >
> > > I've clarified that 'initial' and 'inherit' must be ignored. I haven't
> > > changed the spec to match either WebKit or Gecko here.
> > 
> > So basically the behavior should be as Firefox now except:
> > 
> > 1)  Treat inherit and initial as CSS syntax errors.
> > 2)  Always use "font: 10px sans serif" as the parent's font, not
> >     just when the <canvase> is outside of a DOM tree.
> > 
> > Right?
> 
> Right.

Actually, not right. You should use the canvas as the parent, but if 
there's a parse error you should leave the font unchanged. Sorry, I didn't 
fully think through what you had written.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Saturday, 1 August 2009 08:07:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:43 GMT