Re: Shouldn't fonts embedded through @font-face be available in <canvas>?

?I much prefer this option. Drawing a text to ask to download a font
seems like a terrible hack. Another solution would be to add a
property in the @font-face {} rule to force immediate download.

The traditionnal "onload" event of the window object would then
be delayed until the font (and images...) to be used in the canvas
is ready.

-----Message d'origine----- 
From: L. David Baron
Sent: Sunday, September 26, 2010 9:46 PM
To: Robert O'Callahan
Cc: list.adam@twardoch.com ; Sergey Malkin ; www-font ; www-style
Subject: Re: Shouldn't fonts embedded through @font-face be available in ?

On Monday 2010-09-27 08:11 +1300, Robert O'Callahan wrote:
> This problem has been discussed before on the WHATWG list. It's tricky
> because in some browsers (e.g. Gecko) we only start loading the font after
> you try to draw text that needs it. One possible solution: after drawing
> canvas text with a font that hasn't finished loading, when the font 
> finishes
> loading fire an event at the canvas, e.g. "fontload".

Another possible solution (which might be useful for other things,
but also might be more painful to use than a solution specific to
this problem) is to add APIs to CSSFontFaceRule to:
* find out if the font is loaded
* request that the font be loaded (and add an observer to be called
   when it is)

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/ 

Received on Sunday, 26 September 2010 19:53:51 UTC