[whatwg] are relative values of CanvasRenderingContext2D.font live to style changes?

Ian Hickson ian at hixie.ch
Fri Jun 13 02:09:33 PDT 2008


On Thu, 12 Jun 2008, L. David Baron wrote:
>
> I'm looking at
> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas.html#text
> which currently says:
>   # When the 'font-size' component is set to lengths using
>   # percentages, 'em' or 'ex' units, or the 'larger' or 'smaller'
>   # keywords, these must be interpreted relative to the computed
>   # value of the 'font-size' property of the corresponding canvas
>   # element. When the 'font-weight' component is set to the relative
>   # values 'bolder' and 'lighter', these must be interpreted
>   # relative to the computed value of the 'font-weight' property of
>   # the corresponding canvas element. If the computed values are
>   # undefined for a particular case (e.g. because the canvas element
>   # is not in a document), then the relative keywords must be
>   # interpreted relative to the normal-weight 10px sans-serif
>   # default. 
> 
> Suppose that the computed style of the corresponding canvas element
> changes between when the font DOM attribute is set and text is
> drawn.  Based on the text above, it's not clear to me whether values
> like '1em' or 'lighter' should be relative to the canvas's values at
> the time the font is set or the time the text is drawn.
>
> [...]
> 
> I'd prefer if it were static, because for Mozilla, we'd either have to 
> add new infrastructure to handle dynamic style changes for elements 
> inside something that's display:none or we'd have to recompute the style 
> for every text operation (probably the latter).

It is now explicitly static. (Also changed for 'currentColor'.)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list