Re: [css-fonts] ready attribute vs function

On Sun, Oct 4, 2015 at 7:15 PM, John Daggett <jdaggett@mozilla.com> wrote:

> Rik Cabanier wrote:
>
> > The CSS font loading spec defines 'ready' as a function [1] returning
> > a promise but in Chrome it's implemented as a read only attribute.
> >
> > Is the spec out of date or did chrome implement it incorrectly?
> >
> > 1: http://www.w3.org/TR/css-font-loading-3/#dom-fontfaceset-ready
>
> Old spec, both Firefox and Chrome implement it an attribute as defined in
> the latest editor's draft:
>
> https://drafts.csswg.org/css-font-loading/#font-face-set-ready
>

Thanks John! I mistakenly clicked on "latest version" and not "editor's
draft".

I've experimented a bit with this API on Chrome. Although it helpfully
tells me when fonts are loaded, it actually fulfills the promise before the
fonts are applied.
So, if I look at the page during the 'ready' phase, the font is still not
there. I can work around it by doing a 'requestAnimationFrame' but it seems
like the callback should happen after content that uses the fonts is laid
out. Thoughts?

Received on Tuesday, 6 October 2015 04:47:50 UTC