W3C home > Mailing lists > Public > www-style@w3.org > September 2010

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

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Sun, 26 Sep 2010 21:51:39 +0200
Message-ID: <BD822B0186564795B92663551F54D09B@FREMY2>
To: "L. David Baron" <dbaron@dbaron.org>, "Robert O'Callahan" <robert@ocallahan.org>
Cc: <list.adam@twardoch.com>, "Sergey Malkin" <sergeym@microsoft.com>, "www-font" <www-font@w3.org>, "www-style" <www-style@w3.org>
?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 GMT

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