New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 592226 link

Starred by 5 users

Issue metadata

Status: WontFix
Owner:
Closed: May 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

FontFace is not immediately recognised after loading and parsing CSS

Reported by b.l.st...@gmail.com, Mar 5 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Example URL:

Steps to reproduce the problem:
1. Open the attached test case and the inspector.
2. Reload the attached test case a couple times and observe the console output.

Every now and then you should see "FontFace was in document but can't not be loaded". Most of the time it shows up once, but I've seen it happen more than that.

What is the expected behavior?
The expected behaviour is that "document.fonts.load" immediately recognises the new FontFace rule and does not resolves the promise with an empty font face list (indicating there is no matching font, even though there should be). 

Other CSS rules are correctly recognised and applied as soon as the stylesheet's "onload" handler is called.

What went wrong?
Calling "document.fonts.load" in the "onload" handler of a stylesheet containing font face rules sometimes results in an empty font face list. By the time the "onload" handler is called, the CSSOM for that stylesheet should have been constructed and any font face rules in it should be recognised by the font matching algorithm.

This behaviour does not happen in Firefox.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? No 

Does this work in other browsers? Yes 

Chrome version: 48.0.2564.116  Channel: n/a
OS Version: OS X 10.9.3
Flash Version: Shockwave Flash 20.0 r0

This problem makes it hard to reliably use the css font loading API, because it incorrectly results in an empty font face list even though the stylesheet contains web fonts.

I had to work around this issue in the Web Font Loader (https://github.com/typekit/webfontloader/blob/master/src/core/nativefontwatchrunner.js#L39) by repeatedly calling document.fonts.load until a font is recognised and loaded (instead of calling it once, after receiving the "load" event from a stylesheet containing fonts).
 
fonts.zip
6.7 KB Download

Comment 1 by kochi@chromium.org, Mar 7 2016

Cc: kochi@chromium.org
Labels: -OS-Mac OS-All
Owner: ksakamoto@chromium.org
Status: Assigned (was: Unconfirmed)
ksakamoto-san, who is the best contact of this issue nowadays?

Comment 2 by kochi@chromium.org, Mar 7 2016

Components: -Blink Blink>WebFonts
Labels: Needs-Feedback
Confirmed in Chrome 49, but it no longer reproduces after upgrading to Chrome 50.

b.l.stein@, do you still see the problem?

Comment 4 by b.l.st...@gmail.com, Apr 28 2016

ksakamoto@chromium.org I can no longer reproduce the issue in Chrome 50. Thanks for looking into it.
Status: WontFix (was: Assigned)
Closing. Thank you for reporting!

Sign in to add a comment