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

On Friday 2009-07-31 22:44 +0000, Ian Hickson wrote:
> I've clarified that 'initial' and 'inherit' must be ignored. I haven't 
> changed the spec to match either WebKit or Gecko here.

Two other notes on this issue:

(1) the summary text at the very start of the section says:
  # Relative keywords and lengths are computed relative to the
  # default font, 10px sans-serif.
which disagrees with the text later on (which I think is the text
that's currently under discussion).

(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).


L. David Baron                       
Mozilla Corporation             

Received on Saturday, 1 August 2009 15:12:13 UTC