Re: canvas text: web fonts

On Tue, Jul 21, 2009 at 8:04 PM, Simon Pieters <simonp@opera.com> wrote:

> 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.
>

In Gecko, font loads delay the load event. However, only font loads that are
actually needed delay the load event. If you set up a @font-face rule but
don't actually use that family (or the family would only be used for
fallback, and fallback is not triggered), then the load event is not
delayed.

I think that drawing text to the canvas that uses a not-fully-loaded font
should actually throw, so script can detect it. When the font is fully
loaded then a "fontloaded" event should fire at the canvas, so script can
redraw the text.

Rob
-- 
"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
53:5-6]

Received on Tuesday, 21 July 2009 09:43:23 UTC