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

Re: [css-font-loading] FontFace objects representing the same set of descriptors

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 29 Sep 2014 10:38:54 -0700
Message-ID: <CAAWBYDAbU6Cj0UadfDG75BajXoVd_ZQn7ZdQxosm+8NqP_HK2w@mail.gmail.com>
To: Cameron McCormack <cam@mcc.id.au>
Cc: "www-style@w3.org" <www-style@w3.org>
On Sun, Sep 28, 2014 at 11:31 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> In Gecko, we have a cache of objects that represent loadable font faces.
> This means that if you use the same @font-face rule on multiple pages in the
> same origin, then we only download the font resource and create OS font
> objects once.  The cache gets exercised frequently, as it's common to
> navigate to pages on the one site that all use the same style sheets with
> the same @font-face rules.
>
> We've discovered that this means in our Font Loading API implementation,
> that if one page starts loading a FontFace, then this will cause the
> FontFace object in another page to have its status set to loading too, and
> eventually have its loaded property resolved.
>
> This isn't so much of a problem with CSS-connected FontFace objects, since
> the implementation can choose to start loading them whenever it feels like
> it, really.  But it does mean that unconnected FontFace objects can appear
> to start loading without the author explicitly loading them.
>
> This happens for FontFace objects in the same page, too.  For example:
>
>   var f1 = new FontFace("ABC", "url(x)");
>   var f2 = new FontFace("ABC", "url(x)");
>
>   f1.load().then(function() {
>     alert(f2.status);
>   });
>
> will alert "loaded", even though we didn't touch f2 explicitly.
>
> My question is whether a FontFace object that is not in the FontFaceSet to
> start loading like this.

Already covered by the spec - UAs have free reign in deciding to load
any FontFace at any time.  The only restriction is that they must act
as if they'd called the FontFace's load() method.  Check out the final
paragraph in <http://dev.w3.org/csswg/css-font-loading/#font-face-load>.

~TJ
Received on Monday, 29 September 2014 17:39:42 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:46 UTC