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

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 UTC