[whatwg] Canvas: Fonts in workers

Ian Hickson ian at hixie.ch
Wed Feb 20 21:59:41 PST 2013

On Wed, 20 Feb 2013, Jonas Sicking wrote:
> On Wed, Feb 20, 2013 at 2:55 AM, Anne van Kesteren <annevk at annevk.nl> wrote:
> > I think currently the specification assumes FontLoader is the solution 
> > to fonts in workers. However, 1) FontLoader as currently designed does 
> > not work in workers. 2) Even if slightly modified it would not work in 
> > shared workers as FontLoader is pretty much tied to the document that 
> > has the relevant @font-face declarations. I don't really have a good 
> > solution to this problem.
> In general, we need to define which fonts are available to use when 
> drawing text into a canvas in a worker. For a dedicated worker we could 
> say that it's the same set as is available in the document, except that 
> that set can change at any time as new fonts are loaded. And for a 
> shared worker this is even more complicated since multiple documents, 
> with different sets of fonts, can be connected to the same shared 
> worker.
> We could possibly still use the the FontLoader interface if we do the following:
> * FontLoader needs to drop the dependency on CSSFontFaceRule (or at
> least make the dependency optional and not available in workers).
> * We'll expose a global FontLoader object per worker scope.
> * The worker can't use any downloaded fonts other than the ones loaded
> through the global FontLoader for that scope.

My expectation was that this is how FontLoader would work for workers. (We 
can't rely on what fonts are in the Document since that's shared state, 
and workers try to avoid shared state as a design principle.)

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list