- From: Ian Hickson <ian@hixie.ch>
- Date: Fri, 31 Jul 2009 22:53:50 +0000 (UTC)
- To: Simon Pieters <simonp@opera.com>, Robert O'Callahan <robert@ocallahan.org>
- Cc: "public-html@w3.org" <public-html@w3.org>, "www-style@w3.org" <www-style@w3.org>
On Tue, 21 Jul 2009, Simon Pieters 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? On Tue, 21 Jul 2009, Simon Pieters wrote: > > 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. I agree with your reasoning. On Tue, 21 Jul 2009, Simon Pieters wrote: > > This might be something for the CSS WG to specify, though. > > BTW, I think images referenced from CSS should delay the load event, > too. http://software.hixie.ch/utilities/js/live-dom-viewer/saved/176 As you say, this is a CSSWG issue. On Tue, 21 Jul 2009, Robert O'Callahan wrote: > > 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. I am very hesitant to make the API throw based on network speed. I think that would result in hard-to-debug problems (especially hard to debug since developers are likely to have well cached, fast connections.) I've made the spec explicitly say that fonts that are still loading should be ignored. I agree that events for font loading would be useful, but I don't feel this is in scope for HTML5 to define. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 31 July 2009 22:54:30 UTC