The fonts property of the Document interface returns the FontFaceSet interface of the document.

Syntax

let fontFaceSet = document.fonts;

Value

The returned value is the FontFaceSet interface of the document. The FontFaceSet interface is useful for loading new fonts, checking the status of previously loaded fonts etc.

Examples

Doing operation after all fonts are loaded

document.fonts.ready.then(function() {
  // Any operation that needs to be done only after all the fonts
  // have finished loading can go here.
});

Specifications

Specification Status Comment
CSS Font Loading Module Level 3
The definition of 'FontFaceSet' in that specification.
Working Draft Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
fontsChrome Full support 60Edge No support NoFirefox Full support 41
Full support 41
No support 35 — 41
Disabled
Disabled From version 35 until version 41 (exclusive): this feature is behind the layout.css.font-loading-api.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
IE No support NoOpera Full support 47Safari Full support 10WebView Android Full support 60Chrome Android Full support 60Edge Mobile No support NoFirefox Android Full support YesOpera Android Full support 44Safari iOS Full support 10.2Samsung Internet Android Full support 5.0

Legend

Full support  
Full support
No support  
No support
User must explicitly enable this feature.
User must explicitly enable this feature.

See also

Document Tags and Contributors

Contributors to this page: matvey-andreyev, mdnwebdocs-bot, mfuji09, fscholz, jsx
Last updated by: matvey-andreyev,