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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
fonts | Chrome Full support 60 | Edge Full support 79 | Firefox
Full support
41
| IE No support No | Opera Full support 47 | Safari Full support 10 | WebView Android Full support 60 | Chrome Android Full support 60 | Firefox Android Full support Yes | Opera Android Full support 44 | Safari iOS Full support 10 | Samsung 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
FontFaceSet
interfaceFontFace