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

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

From: L. David Baron <dbaron@dbaron.org>
Date: Tue, 4 Aug 2009 17:36:29 -0700
To: Ian Hickson <ian@hixie.ch>
Cc: Simon Pieters <simonp@opera.com>, "public-html@w3.org" <public-html@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
Message-ID: <20090805003629.GA23272@pickering.dbaron.org>
On Tuesday 2009-08-04 23:44 +0000, Ian Hickson wrote:
> > (2) If relative units continue to be relative to the canvas element,
> > I think the definition of the font property's *getter* needs a
> > little more clarification.  It currently says:
> >   # On getting, the font  attribute must return the serialized form
> >   # of the current font of the context (with no 'line-height'
> >   # component).
> > My understanding of the term serialization means that something
> > specified as "200% sans-serif" would be returned in essentially that
> > form; perhaps with changes to things like capitalization, spacing,
> > and (if allowed, which it isn't in this case) the order of values --
> > but that the values would not be *computed*.  This means that if
> > a page:
> >   (a) sets ctx.font = "200% sans-serif"
> >   (b) changes the font size on canvas (or, alternatively, removes
> >       the canvas from the document or inserts it into the document)
> >   (c) sets ctx.font = ctx.font
> > step (c) actually changes the state of the context (whereas step (b)
> > does not).  If that's actually the case, I think the spec should be
> > more explicit about both that (b) doesn't change the canvas context
> > state and that (c) does (i.e., that ctx.font returns what was set,
> > which may now compute to something different).
> Fixed, thanks.

One more edge case:  I'm not sure how to convert the font-size
component in:
  ctx.font = "menu";
to pixels, since it doesn't really have a font-size component.  For
the ctx.font getter, should it stay as-is, should the whole thing be
computed, or did you intend to allow system fonts in the first


L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/
Received on Wednesday, 5 August 2009 00:37:17 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:53 UTC