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.status
Read only -
Indicates the font-face's loading status. It will be one of
'loading'
or'loaded'
. -
FontFaceSet.ready
Read only -
Promise
which resolves once font loading and layout operations have completed. -
FontFaceSet.size
Read only -
Returns the number of values in the
FontFaceSet
.
Events
FontFaceSet.onloading
-
An
EventListener
called whenever an event of typeloading
is fired, indicating a font-face set has started loading. FontFaceSet.onloadingdone
-
An
EventListener
called whenever an event of typeloadingdone
is fired, indicating that a font face set has finished loading. FontFaceSet.onloadingerror
-
An
EventListener
called whenever an event of typeloadingerror
is 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
FontFaceSet
in insertion order. FontFaceSet.forEach()
-
Executes a provided function for each value in the
FontFaceSet
object. FontFaceSet.has()
-
Returns a
Boolean
asserting whether an element is present with the given value. FontFaceSet.keys()
-
An alias for
CustomStateSet.values()
. FontFaceSet.load()
-
Returns a
Promise
which 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
FontFaceSet
object 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