FontFaceSet
The FontFaceSet interface of the CSS Font Loading API manages the loading of font-faces and querying of their download status. It is available as Document.fonts.
Properties
-
FontFaceSet.statusRead only -
Indicates the font-face's loading status. It will be one of
'loading'or'loaded'. -
FontFaceSet.readyRead only -
Promisewhich resolves once font loading and layout operations have completed. -
FontFaceSet.sizeRead only -
Returns the number of values in the
FontFaceSet.
Events
FontFaceSet.onloading-
An
EventListenercalled whenever an event of typeloadingis fired, indicating a font-face set has started loading. FontFaceSet.onloadingdone-
An
EventListenercalled whenever an event of typeloadingdoneis fired, indicating that a font face set has finished loading. FontFaceSet.onloadingerror-
An
EventListenercalled whenever an event of typeloadingerroris fired, indicating that an error occurred whilst loading a font-face set.
Methods
FontFaceSet.add()-
Adds a font to the font set.
FontFaceSet.check()-
A boolean value that indicates whether a font is loaded, but doesn't initiate a load when it isn't.
FontFaceSet.clear()-
Removes all manually-added fonts from the font set. CSS-connected fonts are unaffected.
FontFaceSet.delete()-
Removes a manually-added font from the font set. CSS-connected fonts are unaffected.
FontFaceSet.entries()-
Returns a new iterator with the values for each element in the
FontFaceSetin insertion order. FontFaceSet.forEach()-
Executes a provided function for each value in the
FontFaceSetobject. FontFaceSet.has()-
Returns a
Booleanasserting whether an element is present with the given value. FontFaceSet.keys()-
An alias for
CustomStateSet.values(). FontFaceSet.load()-
Returns a
Promisewhich resolves to a list of font-faces for a requested font. FontFaceSet.values()-
Returns a new iterator object that yields the values for each element in the
FontFaceSetobject in insertion order.
Specifications
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
FontFaceSet |
35 |
≤79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
10 |
3.0 |
FontFaceSet |
No |
No |
No |
No |
No |
10 |
No |
No |
No |
No |
10 |
No |
add |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
check |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
clear |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
delete |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
entries |
48 |
79 |
41 |
No |
35 |
10 |
48 |
48 |
41 |
35 |
10 |
5.0 |
forEach |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
10 |
3.0 |
has |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
10 |
3.0 |
keys |
48 |
79 |
41 |
No |
35 |
10 |
48 |
48 |
41 |
35 |
10 |
5.0 |
load |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
onloading |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
onloadingdone |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
onloadingerror |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
ready |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
size |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
10 |
3.0 |
status |
35 |
79 |
41 |
No |
22 |
10 |
4.4.3 |
35 |
41 |
22 |
Yes |
3.0 |
values |
48 |
79 |
41 |
No |
35 |
10 |
48 |
48 |
41 |
35 |
10 |
5.0 |
worker_support |
69 |
≤79 |
No |
No |
56 |
No |
69 |
69 |
No |
48 |
No |
10.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet