Re: [css-fonts] Proposal for standardizing font timeout behavior

Tab Atkins wrote:

> Font faces downloaded via @font-face can sometimes take a while on
> slow connections.  Browsers have adopted some inconsistent default
> behavior regarding timeouts and display.  Some Chrome team members
> (including input from me) have put together a proposal to let
> authors control this, which has received a good response from
> developers.  You can find the full proposal at
> <https://github.com/igrigorik/css-font-timeout/blob/patch-1/README.md>
> 
> The abbreviated proposal is to add a new 'font-rendering'
> descriptor to @font-face, and a related 'font-rendering' property.
> 
> The grammar is:
> 
> font-rendering: optional | swap <time>? | mandatory <time>?

I think there are two separate issues here. One is whether user
agents should have more consistent fallback behavior and the other
is whether an author should be able to control this via a descriptor
and/or a property.

I think it would be a good idea to have more consistent behavior
across browsers for font downloads. It definitely sucks to be using
Mobile Safari and get stuck on a page that remains blank until the
end of time because the font load stalls on a flakey network
connection. But I'm not sure how valuable it is to specify the
Firefox/Chrome behavior as "must" behavior. Firefox actually
implements not a 3-second timeout out but a 3-second timeout,
followed by another timeout if the load has started and progressed
at the end of the first timeout.

Font loads generally occur after stylesheets have loaded and layout
has started. This will be after other content on the page will
already be queued for fetching. Depending upon the complexity of a
page, the delay in loading a font may not be the actual load time
for the font but the fact that the font is queued behind a lot of
other content.

As for the 'font-rendering' descriptor/property, I'm somewhat skeptical 
that giving authors control over the timeout is the right approach here.
I think it would be better to give authors some form of preload hint
for @font-face fonts so that they could tag fonts that should begin
loading after the @font-face rule is parsed.

Maybe the resource hints spec will help here? [1]

The behavior for this descriptor/property can also be done via
script using the Font Loading API. I think it would be better to let
authors experiment with that first and then consider whether there
are simple use cases for which a descriptor and/or property would
simplify things.

Regards,

John Daggett
Mozilla Japan

[1] http://w3c.github.io/resource-hints/

Received on Monday, 27 October 2014 04:32:05 UTC