Skip to content

Commit 783f229

Browse files
committed
(merge)
2 parents ad7fca6 + 586c4c1 commit 783f229

6 files changed

Lines changed: 837 additions & 993 deletions

File tree

css-font-loading/Overview.bs

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,16 @@ The <code>load()</code> method</h3>
336336
When this happens,
337337
they must act as if they had called the corresponding {{FontFace}}’s {{FontFace/load()}} method described here.
338338

339+
Note: Some UAs utilize a "font cache"
340+
which avoids having to download the same font multiple times
341+
on a page or on multiple pages within the same origin.
342+
Multiple {{FontFace}} objects can be mapped to the same entry in the font cache,
343+
which means that a {{FontFace}} object might start loading unexpectedly,
344+
even if it's not in a {{FontFaceSet}},
345+
because some other {{FontFace}} object pointing to the same font data
346+
(perhaps on a different page entirely!)
347+
has been loaded.
348+
339349
<h3 id='font-face-css-connection'>
340350
Interaction with CSS’s ''@font-face'' Rule</h3>
341351

@@ -429,7 +439,7 @@ The <code>FontFaceSet</code> Interface</h2>
429439
<dd>
430440
This attribute reflects the {{FontFaceSet}}'s {{[[ReadyPromise]]}} slot.
431441

432-
See <a section href="#font-face-set-ready"></a> for more details on this {{Promise}} and its use.
442+
See [[#font-face-set-ready]] for more details on this {{Promise}} and its use.
433443

434444
<dt><dfn>size</dfn> <span attribute-info for=FontFaceSet/size></span>
435445
<dd>
@@ -486,15 +496,21 @@ The <code>FontFaceSet</code> Interface</h2>
486496
which is initialized to a fresh pending {{Promise}},
487497
and a <dfn attribute for=FontFaceSet>\[[ContainedFonts]]</dfn> slot,
488498
which is initialized by the <a constructor title="FontFaceSet()">FontFaceSet constructor</a> to a {{Set}} object
489-
(though see <a section href="#document-font-face-set"></a> for information on how the Set may be pre-filled
499+
(though see [[#document-font-face-set]] for information on how the Set may be pre-filled
490500
for {{FontFaceSet}} objects created by the user agent).
491501

492502
Because font families are loaded only when they are used,
493503
content sometimes needs to understand when the loading of fonts occurs.
494504
Authors can use the events and methods defined here to allow greater control over actions
495505
that are dependent upon the availability of specific fonts.
496506

497-
There are <dfn>no pending font loads</dfn> whenever all of the following are true:
507+
There are <dfn>no pending font loads</dfn> for a given {{FontFaceSet}} whenever
508+
none of its contained {{FontFace}} objects have a {{FontFace/status}} of <code>"loading"</code>.
509+
510+
For {{FontFaceSet}}s that are <a>font sources</a>,
511+
in addition to the above constriant,
512+
the following must all be true
513+
for them to be considered as having <a>no pending font loads</a>:
498514

499515
<ul>
500516
<li>
@@ -503,20 +519,12 @@ The <code>FontFaceSet</code> Interface</h2>
503519
<li>
504520
There are no pending stylesheet requests.
505521

506-
<li>
507-
There are no <a>available font faces</a>
508-
with a {{FontFace/status}} of "loading".
509-
510522
<li>
511523
There are no pending layout operations which might cause the user agent to request a font.
512524
</ul>
513525

514-
If any of the above conditions are false,
515-
there are <dfn>possibly pending font loads</dfn>.
516-
517-
Issue: The above is wrong; it assumes that you're only asking about the <a>font source</a>.
518-
The {{FontFaceSet/status}} promise needs to pay attention to what {{FontFaceSet}} it's attached to.
519-
I guess only the <a>font source's</a> {{FontFaceSet/status}} promise should care about pending layout operations.
526+
If a {{FontFaceSet}} can't be considered to have <a>no pending font loads</a>,
527+
it instead has <dfn>possibly pending font loads</dfn>.
520528

521529
<!--
522530
████████ ██ ██ ████████ ██ ██ ████████ ██████
@@ -574,7 +582,7 @@ Events</h3>
574582
The {{FontFaceSetLoadEvent/fontfaces}} attribute is initialized to the given list of {{FontFace}} objects.
575583
</ol>
576584

577-
Whenever one or more <a>available font faces</a> for a given {{FontFaceSet}}
585+
Whenever one or more {{FontFace}} objects within a given {{FontFaceSet}}
578586
change their {{FontFace/status}} attribute to "loading",
579587
the user agent must run the following steps:
580588

@@ -624,6 +632,12 @@ Events</h3>
624632
user agents must run these steps:
625633

626634
<ol>
635+
<li>
636+
If this is not the first time the {{FontFaceSet}} has had <a>no pending font loads</a>,
637+
and none of its contained {{FontFace}} objects began loading
638+
since the last time it had <a>no pending font loads</a>,
639+
abort this algorithm.
640+
627641
<li>
628642
Set <var>font face set's</var> {{FontFaceSet/status}} attribute to "loaded".
629643

@@ -951,6 +965,11 @@ Interaction with CSS’s ''@font-face'' Rule</h3>
951965
must be added or removed from the document's <a>font source</a>,
952966
and maintain this ordering.
953967

968+
Note: Authors can still maintain references to a removed {{FontFace}},
969+
even if it's been automatically removed from a <a>font source</a>.
970+
As specified in [[#font-face-css-connection]], though,
971+
the {{FontFace}} is no longer <a>CSS-connected</a> at that point.
972+
954973
All non-<a>CSS-connected</a> {{FontFace}} objects must be sorted after the <a>CSS-connected</a> ones,
955974
in insertion order.
956975

0 commit comments

Comments
 (0)