Re: canvas text: web fonts

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.

-- 
Simon Pieters
Opera Software

Received on Tuesday, 21 July 2009 08:05:06 UTC