[css-font-loading] status attribute of FontFaceSet

The CSS Font Loading API spec defines 'status' attributes for both
fonts (FontFace objects) and the set of fonts contained by a
document (FontFaceSet object). These are intended to indicate the
load state of individual fonts and whether any font is currently
loading or not.

Definition of FontFaceSet.status [1]:

  status of type FontFaceSetLoadStatus, readonly
    If there are possibly pending font loads, the status attribute
    must have the value "loading". Otherwise, it must have the
    value "loaded". 

This seems to imply that any style change that affects font
selection or text content would cause the state of document.fonts to
be "loading".

This implies the assertions below, which I think aren't desired behavior:

  var f = new FontFace("test", "url(myfont.woff)");
  document.fonts.add(f);
  document.body.style.fontFamily = "bongo";
  assert(document.fonts.status == "loading"); // pending layout
  document.body.offsetTop;
  assert(document.fonts.status == "loaded");  // no pending layout

However, later on in the actual description of when
FontFaceSet.status is set to "loading" in section 3.1, this actually
only occurs when the load state of a given FontFace object contained
within the FontFaceSet changes to "loading".

Edited definition of FontFaceSet.status:

  status of type FontFaceSetLoadStatus, readonly
    When one or more FontFace objects have a status of "loading",
    this attribute must have the value "loading". Otherwise, it must
    have the value "loaded". See Section 3.1 for the precise
    description of when this state change occurs.
  
Cheers,

John

[1] http://dev.w3.org/csswg/css-font-loading/#dom-fontfaceset-status

Received on Wednesday, 22 October 2014 08:24:36 UTC