Re: [css3-fonts] Question on CSSFontFaceLoadEvent

Tab Atkins wrote:

> > How should we dispatch CSSFontFaceLoadEvent when there are two (or
> > more) font-face rules which have the same url in the src
> > descriptor?
> >
> > @font-face {  /* (A) */
> >   font-family: A;
> >   src: url(X);
> > }
> >
> > @font-face {  /* (B) */
> >   font-family: B;
> >   src: url(X);
> > }
> >
> > Case #1:
> > <div style="font-family: A;">Foo</div>  // -> event.fontface = (A)
> >
> > Case #2:
> > <div style="font-family: B, A;">Foo</div>  // -> event.fontface = (B)
> >
> > Case #3:
> > <div>
> > <span style="font-family: A">Foo</span><span style="font-family:
> > B">Bar</span>
> > </div>  // -> event.fontface = (A) ? dispatch events for (A) and (B)?
> 
> I think it should dispatch both A and B. However, we need to define
> the ordering.

Load events are associated with the @font-face rules, not the
underlying network events that load font data.  They apply equally to
font resources and to fonts linked via the use of local().  So, as Tab
suggests, events for both A and B should be dispatched.

I don't see any need to define some sort of ordering since the
underlying loads are async in nature.

One minor note, the "Case 2" example above is dependent to some degree
on the coverage contained within the fonts.  Consider the example
below:

  div { font-family: A, B; }

  <div>Foo バー</div>

If A lacks support for Japanese, then *both* A and B will be loaded
and load events should fire for each.

Regards,

John Daggett

Received on Friday, 2 November 2012 01:52:16 UTC