W3cubDocs

/Web APIs

FontFaceSet

The FontFaceSet interface of the CSS Font Loading API manages the loading of font-faces and querying of their download status.

A FontFaceSet instance is a Set-like object that can hold an ordered set of FontFace objects.

This property is available as Document.fonts, or self.fonts in web workers.

EventTarget FontFaceSet

Instance 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

loading

Fires when a font-face set has started loading.

loadingdone

Fires when a font face set has finished loading.

loadingerror

Fires when an error occurred whilst loading a font-face set.

Instance 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
@@iterator 48 79 41 No 35 10 48 48 41 35 10 5.0
FontFaceSet No No No No No 10 No No No No 10 No
FontFaceSet
35Chrome does not expose the FontFaceSet interface directly, and is only available through Document.fonts or WorkerGlobalScope.fonts.
79Edge does not expose the FontFaceSet interface directly, and is only available through Document.fonts or WorkerGlobalScope.fonts.
41 No
22Opera does not expose the FontFaceSet interface directly, and is only available through Document.fonts or WorkerGlobalScope.fonts.
10
37Chrome does not expose the FontFaceSet interface directly, and is only available through Document.fonts or WorkerGlobalScope.fonts.
35Chrome does not expose the FontFaceSet interface directly, and is only available through Document.fonts or WorkerGlobalScope.fonts.
41
22Opera does not expose the FontFaceSet interface directly, and is only available through Document.fonts or WorkerGlobalScope.fonts.
10
3.0Samsung Internet does not expose the FontFaceSet interface directly, and is only available through Document.fonts or WorkerGlobalScope.fonts.
add 35 79 41 No 22 10 37 35 41 22 10 3.0
check
35The method returns false instead of true for nonexistent or locally installed fonts. See bug 591602.
79The method returns false instead of true for nonexistent or locally installed fonts. See bug 591602.
41 No
22The method returns false instead of true for nonexistent or locally installed fonts. See bug 591602.
10
37The method returns false instead of true for nonexistent or locally installed fonts. See bug 591602.
35The method returns false instead of true for nonexistent or locally installed fonts. See bug 591602.
41
22The method returns false instead of true for nonexistent or locally installed fonts. See bug 591602.
10
3.0The method returns false instead of true for nonexistent or locally installed fonts. See bug 591602.
clear 35 79 41 No 22 10 37 35 41 22 10 3.0
delete 35 79 41 No 22 10 37 35 41 22 10 3.0
entries 48 79 41 No 35 10 48 48 41 35 10 5.0
forEach 35 79 41 No 22 10 37 35 41 22 10 3.0
has 35 79 41 No 22 10 37 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 37 35 41 22 10 3.0
loading_event 35 79 41 No 22 10 37 35 41 22 10 3.0
loadingdone_event 35 79 41 No 22 10 37 35 41 22 10 3.0
loadingerror_event 35 79 41 No 22 10 37 35 41 22 10 3.0
ready 35 79 41 No 22 10 37 35 41 22 10 3.0
size 35 79 41 No 22 10 37 35 41 22 10 3.0
status 35 79 41 No 22 10 37 35 41 22 10 3.0
values 48 79 41 No 35 10 48 48 41 35 10 5.0
worker_support 69 79 105 No 56 No 69 69 105 48 No 10.0

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet