You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The <code>match()</code> method</a><li><ahref=#font-face-set-load><spanclass=secno>3.3</span>
142
142
The <code>load()</code> method</a><li><ahref=#font-face-set-check><spanclass=secno>3.4</span>
143
143
The <code>check()</code> method</a><li><ahref=#font-face-set-ready><spanclass=secno>3.5</span>
144
-
The <code>ready()</code> method</a><li><ahref=#document-FontFaceSet><spanclass=secno>3.6</span>
145
-
Extension to the <code>document</code> interface</a><li><ahref=#worker-font-face-set><spanclass=secno>3.7</span>
146
-
Extensions to the <code>WorkerGlobalScope</code> interface</a></ul><li><ahref=#font-load-event-examples><spanclass=secno>4</span>
144
+
The <code>ready()</code> method</a></ul><li><ahref=#font-face-source><spanclass=secno>4</span>
145
+
The <code>FontFaceSource</code> interface</a><ulclass=toc><li><ahref=#document-font-face-set><spanclass=secno>4.1</span>
146
+
Interaction with CSS’s <spanclass=cssdata-link-type=maybe>@font-face</span> Rule</a></ul><li><ahref=#font-load-event-examples><spanclass=secno>5</span>
147
147
API Examples</a><li><ahref=#changes><spanclass=secno></span>Changes</a><ulclass=toc><li><ahref=#changes-since-20130212><spanclass=secno></span>
148
148
Changes from the <span>February 2013 CSS3 Fonts Working Draft</span></a></ul><li><ahref=#acknowledgments><spanclass=secno></span>
Connection to CSS’s <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-fonts-3/#at-font-face-rule>@font-face</a></span><aclass=self-linkhref=#font-face-css-connection></a></h3>
411
+
Interaction with CSS’s <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-fonts-3/#at-font-face-rule>@font-face</a> Rule</span><aclass=self-linkhref=#font-face-css-connection></a></h3>
412
412
413
413
<p> A CSS <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-fonts-3/#at-font-face-rule>@font-face</a> rule automatically defines a corresponding <aclass=idl-codedata-link-type=interface>FontFace</a> object,
414
-
which is automatically placed in the document’s <aclass=idl-codedata-link-type=attributehref=#dom-document-fonts>fonts</a> attribute.
414
+
which is automatically placed in the document’s <ahref=#font-source>font source</a>.
415
+
This <aclass=idl-codedata-link-type=interface>FontFace</a> object is <dfndata-dfn-type=dfndata-noexport="" id=css-connected>CSS-connected<aclass=self-linkhref=#css-connected></a></dfn>.
415
416
416
417
<p> The <aclass=idl-codedata-link-type=interface>FontFace</a> object corresponding to a <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-fonts-3/#at-font-face-rule>@font-face</a> rule
417
418
has its <aclass=idl-codedata-link-type=attributehref=#dom-fontface-family>family</a>, <aclass=idl-codedata-link-type=attributehref=#dom-fontface-style>style</a>, <aclass=idl-codedata-link-type=attributehref=#dom-fontface-weight>weight</a>, <aclass=idl-codedata-link-type=attributehref=#dom-fontface-stretch>stretch</a>, <aclass=idl-codedata-link-type=attributehref=#dom-fontface-unicoderange>unicodeRange</a>, <aclass=idl-codedata-link-type=attributehref=#dom-fontface-variant>variant</a>, and <aclass=idl-codedata-link-type=attributehref=#dom-fontface-featuresettings>featureSettings</a> attributes set to the same value as the corresponding descriptors in the <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-fonts-3/#at-font-face-rule>@font-face</a> rule.
<p> The set entries for a <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a>
473
-
474
-
<p> The set entries for a <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a> in the <aclass=idl-codedata-link-type=attributehref=#dom-document-fonts>fonts</a> attribute of a document
475
-
are initially populated with the corresponding <aclass=idl-codedata-link-type=interface>FontFace</a> objects
476
-
from all of the CSS <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-fonts-3/#at-font-face-rule>@font-face</a> rules in the document’s stylesheets,
477
-
in document order.
478
-
As stylesheets are added to or removed from the document,
479
-
this initial segment of set entries is changed accordingly,
480
-
always maintaining document order.
481
-
Manually-added <aclass=idl-codedata-link-type=interface>FontFace</a> objects appear in the set entries
482
-
after the <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-fonts-3/#at-font-face-rule>@font-face</a>-generated ones,
483
-
in insertion order.
484
-
485
-
<p> The <aclass=idl-codedata-link-type=interface>FontFace</a> objects in a given <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a>
486
-
are the <dfndata-dfn-type=dfndata-noexport="" id=available-font-faces>available font faces<aclass=self-linkhref=#available-font-faces></a></dfn> for that set.
487
-
Similarly, the <ahref=#available-font-faces>available font faces</a> for a document
488
-
are the <ahref=#available-font-faces>available font faces</a> for the <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a>
489
-
that is the value of its <aclass=idl-codedata-link-type=attributehref=#dom-document-fonts>fonts</a> attribute.
473
+
<p> The set entries for a <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a> is initially an empty list.
474
+
A <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a> attached to a document may have some initial <aclass=idl-codedata-link-type=interface>FontFace</a> objects prefilled in it;
475
+
see the section on <ahref=#document-font-face-set>Interactions with CSS’s @font-face Rule</a> for details.
490
476
491
477
<p> Because font families are loaded only when they are used,
492
478
content sometimes needs to understand when the loading of fonts occurs.
<p> Whenever a <aclass=idl-codedata-link-type=interface>FontFace</a> in a given <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a><var>font face set</var>
582
568
changes its <aclass=idl-codedata-link-for=FontFacedata-link-type=attributehref=#dom-fontface-status>status</a> attribute to
583
569
584
-
<p> Whenever one or more <ahref=#available-font-faces>available font faces</a> for a given <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a>
570
+
<p> Whenever one or more <a>available font faces</a> for a given <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a>
585
571
change their <aclass=idl-codedata-link-for=FontFacedata-link-type=attributehref=#dom-fontface-status>status</a> attribute to "loading",
Append the <var>loading fonts</var> to <var>font face set’s</var><aclass=idl-codedata-link-type=attributehref=#dom-fontfaceset-loadingfonts>[[LoadingFonts]]</a> attribute.
604
590
</ol>
605
591
606
-
<p> Whenever one or more <ahref=#available-font-faces>available font faces</a> for a given <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a>
592
+
<p> Whenever one or more <a>available font faces</a> for a given <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a>
607
593
change their <aclass=idl-codedata-link-for=FontFacedata-link-type=attributehref=#dom-fontface-status>status</a> attribute to "loaded" or "error",
The <code>match()</code> method</span><aclass=self-linkhref=#font-face-set-match></a></h3>
653
639
654
640
<p> The <ahref=#dom-fontface-matchfontfacedescriptors-descriptors-optional-domstring-characters>match()</a> method of <aclass=idl-codedata-link-type=interfacehref=#dom-fontfaceset>FontFaceSet</a> returns
655
-
the subset of <a>available fonts</a>
641
+
the subset of <ahref=#available-fonts>available fonts</a>
656
642
that match a given <aclass=propertydata-link-type=propdeschref=http://dev.w3.org/csswg/css-fonts-3/#propdef-fonttitle=font>font</a> specifier
use the font matching rules to select the <ahref=#available-font-faces>available font faces</a> that match the <var>font style</var>.
663
+
use the font matching rules to select the <a>available font faces</a> that match the <var>font style</var>.
678
664
The use of the <aclass=idl-codedata-link-type=attributehref=#dom-fontface-unicoderange>unicodeRange</a> attribute means that this may be more than just a single font face.
unlike the Promise returned by the <aclass=idl-codedata-link-type=interface>FontFace</a><aclass=idl-codedata-link-for=FontFacedata-link-type=methodhref=#dom-fontface-ready>ready()</a> method.
Look up what to do to add this to workers as well.
818
-
I think I just need to add it to WorkerGlobalScope or something.
802
+
<p> Any document, workers, or other context which can use fonts in some manner must implement the <aclass=idl-codedata-link-type=interfacehref=#dom-fontfacesource>FontFaceSource</a> interface.
803
+
The value of the context’s <aclass=idl-codedata-link-type=attributehref=#dom-fontfacesource-fonts>fonts</a> attribute is its <dfndata-dfn-type=dfndata-noexport="" id=font-source>font source<aclass=self-linkhref=#font-source></a></dfn>,
804
+
which provides all of the fonts used in font-related operations,
805
+
unless defined otherwise.
806
+
Operations referring to “the font source” must be interpreted as referring to the <ahref=#font-source>font source</a> of the relevant context in which the operation is taking place.
Extensions to the <code>WorkerGlobalScope</code> interface</span><aclass=self-linkhref=#worker-font-face-set></a></h3>
808
+
<p> For any font-related operation that takes place within one of these contexts,
809
+
the <aclass=idl-codedata-link-type=interface>FontFace</a> objects within the <ahref=#font-source>font source</a> are its <dfndata-dfn-type=dfndata-noexport="" id=available-fonts>available fonts<aclass=self-linkhref=#available-fonts></a></dfn>.
Interaction with CSS’s <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-fonts-3/#at-font-face-rule>@font-face</a> Rule</span><aclass=self-linkhref=#document-font-face-set></a></h3>
818
+
819
+
<p> The set entries for a document’s <ahref=#font-source>font source</a>
820
+
must be initially populated with all the <ahref=#css-connected>CSS-connected</a><aclass=idl-codedata-link-type=interface>FontFace</a> objects
821
+
from all of the CSS <aclass=cssdata-link-type=maybehref=http://dev.w3.org/csswg/css-fonts-3/#at-font-face-rule>@font-face</a> rules in the document’s stylesheets,
822
+
in document order.
823
+
This ordering must be maintained regardless of how the <aclass=idl-codedata-link-type=interface>FontFace</a> object is added;
824
+
if a script manually removes and then re-adds one of them,
825
+
it returns to its appropriate document-order position in the initial segment of the set entries.
826
+
All non-<ahref=#css-connected>CSS-connected</a><aclass=idl-codedata-link-type=interface>FontFace</a> objects must be sorted after the <ahref=#css-connected>CSS-connected</a> ones,
827
+
in insertion order.
828
+
829
+
<p> Adding or removing a stylesheet from the document must add or remove the corresponding <ahref=#css-connected>CSS-connected</a><aclass=idl-codedata-link-type=interface>FontFace</a> objects from the document’s <ahref=#font-source>font source</a>.
0 commit comments