W3C home > Mailing lists > Public > www-style@w3.org > July 2009

Re: canvas text: web fonts

From: Simon Pieters <simonp@opera.com>
Date: Tue, 21 Jul 2009 10:18:36 +0200
To: "public-html@w3.org" <public-html@w3.org>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <op.uxer1ay5idj3kv@zcorpandell.linkoping.osa>
On Tue, 21 Jul 2009 10:04:23 +0200, Simon Pieters <simonp@opera.com> wrote:

> On Tue, 21 Jul 2009 08:47:58 +0200, Simon Pieters <simonp@opera.com>  
> wrote:
>
>> "Font names must be interpreted in the context of the canvas element's  
>> stylesheets; any fonts embedded using @font-face must therefore be  
>> available. [CSSWEBFONTS]"
>> http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#text
>>
>> What should happen when you fillText() while a font is still loading?
>
> I think blocking is not something we want.
>
> That leaves throwing and using a fallback font.
>
> For an interactive game, it seems more useful to show the fallback font  
> than no text at all, which rules out throwing.
>
> For a static graph, you would either want to draw twice: once with the  
> fallback font, and once again when the font has loaded; or you would  
> want to draw once when the font has loaded.
>
> In order for a Web page to know when a font has loaded, we probably need  
> to introduce an event that is fired when a web font has loaded, or make  
> web font loading delay the load event, or both.

This might be something for the CSS WG to specify, though.

BTW, I think images referenced from CSS should delay the load event, too.
http://software.hixie.ch/utilities/js/live-dom-viewer/saved/176

-- 
Simon Pieters
Opera Software
Received on Tuesday, 21 July 2009 08:19:20 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:19 GMT