44Shortname : css-font-loading
55Level : 3
66Group : csswg
7- Status : LCWD
8- Date : 2014-05-22
9- Deadline : 2014-06-30
7+ Status : ED
108ED : http://dev.w3.org/csswg/css-font-loading/
119TR : http://w3.org/TR/css-font-loading/
10+ Previous Version : http://www.w3.org/TR/2014/WD-css-font-loading-3-20140522/
1211Editor : Tab Atkins Jr., Google, http://xanthir.com/contact/
1312Former Editor : John Daggett, Mozilla, jdaggett@mozilla.com
1413Abstract : This CSS module describes events and interfaces used for dynamically loading font resources.
@@ -86,7 +85,7 @@ The <code>FontFace</code> Interface</h2>
8685 readonly attribute FontFaceLoadStatus status;
8786
8887 Promise<FontFace> load();
89- attribute Promise<boolean> loaded;
88+ readonly attribute Promise<boolean> loaded;
9089 };
9190 </pre>
9291
@@ -361,7 +360,7 @@ The <code>FontFaceSet</code> Interface</h2>
361360 boolean check(DOMString font, optional DOMString text = " ");
362361
363362 // async notification that font loading and layout operations are done
364- Promise<FontFaceSet> ready() ;
363+ readonly attribute Promise<FontFaceSet> ready;
365364
366365 // loading state, "loading" while one or more fonts loading, "loaded" otherwise
367366 readonly attribute FontFaceLoadStatus status;
@@ -370,6 +369,14 @@ The <code>FontFaceSet</code> Interface</h2>
370369 FontFaceSet implements EventTarget;
371370 </pre>
372371
372+ <dl dfn-type=attribute dfn-for="FontFaceSet">
373+ <dt> <dfn>ready</dfn> <span attribute-info for=FontFaceSet/ready></span>
374+ <dd>
375+ This attribute reflects the <a idl>FontFaceSet</a> 's <a idl>[<!---->[ReadyPromise]]</a> slot.
376+
377+ See <a section href="#font-face-set-ready"></a> for more details on this <a idl>Promise</a> and its use.
378+ </dl>
379+
373380 Note: The use of [SetClass] is controversial,
374381 so this will be rewritten to instead be just a Set look-alike,
375382 without use of [SetClass] ,
@@ -415,9 +422,10 @@ The <code>FontFaceSet</code> Interface</h2>
415422 <a interface>FontFaceSet</a> objects also have internal
416423 <dfn attribute for=FontFaceSet>[<!---->[LoadingFonts]]</dfn> ,
417424 <dfn attribute for=FontFaceSet>[<!---->[LoadedFonts]]</dfn> ,
418- <dfn attribute for=FontFaceSet>[<!---->[FailedFonts]]</dfn> ,
419- and <dfn attribute for=FontFaceSet>[<!---->[PendingReadyPromises]]</dfn> slots,
420- all of which are initialized to the empty list.
425+ <dfn attribute for=FontFaceSet>[<!---->[FailedFonts]]</dfn> slots,
426+ all of which are initialized to the empty list,
427+ and a <dfn attribute for=FontFaceSet>[<!---->[ReadyPromise]]</dfn> slot,
428+ which is initialized to a fresh pending <a idl>Promise</a> .
421429
422430<h3 id='set-modifications'>
423431Modifications of normal Set methods</h3>
@@ -509,6 +517,10 @@ Events</h3>
509517
510518 <li>
511519 Append the <var> loading fonts</var> to <var> font face set's</var> <a attribute>[<!---->[LoadingFonts]]</a> slot.
520+
521+ <li>
522+ If <var> font face set's</var> <a attribute>[<!---->[ReadyPromise]]</a> slot currently holds a fulfilled promise,
523+ replace it with a fresh pending promise.
512524 </ol>
513525
514526 Whenever one or more <a>available font faces</a> for a given <a interface>FontFaceSet</a>
@@ -548,11 +560,7 @@ Events</h3>
548560 with the contents of <var> font face set's</var> <a attribute>[<!---->[FailedFonts]]</a> slot.
549561
550562 <li>
551- If <var> font face set's</var> <a attribute>[<!---->[PendingReadyPromises]]</a> attribute is non-empty,
552- fulfill each promise in the attribute's value with <var> font face set</var> .
553-
554- <li>
555- Empty <var> font face set's</var> <a attribute>[<!---->[LoadingFonts]]</a> , <a attribute>[<!---->[LoadedFonts]]</a> , <a attribute>[<!---->[FailedFonts]]</a> , and <a attribute>[<!---->[PendingReadyPromises]]</a> slots.
563+ Fulfill <var> font face set's</var> <a attribute>[<!---->[ReadyPromise]]</a> attribute's value with <var> font face set</var> .
556564 </ol>
557565
558566
@@ -705,46 +713,28 @@ The <code>check()</code> method</h3>
705713 </ol>
706714
707715<!--
708- ████████ ████████ ███ ████████ ██ ██ ███ ███
709- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
710- ██ ██ ██ ██ ██ ██ ██ ████ ██ ██
711- ████████ ██████ ██ ██ ██ ██ ██ ██ ██
712- ██ ██ ██ █████████ ██ ██ ██ ██ ██
713- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
714- ██ ██ ████████ ██ ██ ████████ ██ ███ ███
716+ ████████ ████████ ███ ████████ ██ ██
717+ ██ ██ ██ ██ ██ ██ ██ ██ ██
718+ ██ ██ ██ ██ ██ ██ ██ ████
719+ ████████ ██████ ██ ██ ██ ██ ██
720+ ██ ██ ██ █████████ ██ ██ ██
721+ ██ ██ ██ ██ ██ ██ ██ ██
722+ ██ ██ ████████ ██ ██ ████████ ██
715723-->
716724
717725<h3 id='font-face-set-ready'>
718- The <code>ready() </code> method </h3>
726+ The <code>ready</code> attribute </h3>
719727
720728 Because the number of fonts loaded depends on the how many fonts are used for a given piece of text,
721729 in some cases whether fonts need to be loaded or not may not be known.
722- The <a for=FontFaceSet>ready() </a> method returns a Promise which is resolved when the document is done loading fonts,
730+ The <a idl for=FontFaceSet>ready</a> attribute contains a <a idl> Promise</a> which is resolved when the document is done loading fonts,
723731 which provides a way for authors to avoid having to keep track of which fonts have or haven't been loaded
724732 before examining content which may be affected by loading fonts.
725733
726- When the <dfn method for=FontFaceSet>ready()</dfn> method is called,
727- execute these steps:
728-
729- <ol>
730- <li>
731- Let <var> font face set</var> be the <a interface>FontFaceSet</a> object this method was called on.
732- Let <var> ready promise</var> be a fresh Promise which is initially pending.
733-
734- <li>
735- If <var> font face set's</var> <a attribute for=FontFaceSet>status</a> attribute is "loaded",
736- fulfill <var> ready promise</var> with <var> font face set</var> .
737- Otherwise, append <var> ready promise</var>
738- to <var> font face set's</var> <a attribute>[<!---->[PendingReadyPromises]]</a> slot.
739-
740- <li>
741- Return <var> ready promise</var> .
742- </ol>
743-
744734 Note: Authors should note that a given <var> ready promise</var> is only fulfilled once,
745735 but further fonts may be loaded after it fulfills.
746736 This is similar to listening for a <a event>loadingdone</a> event to fire,
747- but the callbacks passed to the <a method for=FontFaceSet>ready() </a> promise will <strong> always</strong> get called,
737+ but the callbacks passed to the <a idl for=FontFaceSet>ready</a> promise will <strong> always</strong> get called,
748738 even when no font loads occur because the fonts in question are already loaded.
749739 It's a simple, easy way to synchronize code to font loads
750740 without the need to keep track of what fonts are needed and precisely when they load.
@@ -757,7 +747,7 @@ The <code>ready()</code> method</h3>
757747 The <var> ready promise</var> is only fulfilled after layout operations complete
758748 and no additional font loads are necessary.
759749
760- Note: Note that the Promise returned by this <a method for=FontFaceSet>ready() </a> method is only ever fulfilled,
750+ Note: Note that the Promise returned by this <a idl for=FontFaceSet>ready</a> attribute is only ever fulfilled,
761751 never rejected,
762752 unlike the Promise returned by the <a interface>FontFace</a> <a method for=FontFace>load()</a> method.
763753
0 commit comments