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

François REMY <[email protected]>
Newsgroups gmane.comp.web.fonts,gmane.comp.web.css.general
Message-ID <BD822B0186564795B92663551F54D09B@FREMY2>
?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: [email protected] ; 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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.