Document.fonts is an instance property that returns the document’s FontFaceSet—the heart of the CSS Font Loading API. Learn fonts.ready, status, checking and loading faces, adding a FontFace, and five examples with try-it labs.
01
Kind
Instance property
02
Returns
FontFaceSet
03
API
CSS Font Loading
04
Key promise
fonts.ready
05
Status
loading | loaded
06
Baseline
Widely available
Fundamentals
Introduction
Web fonts declared with @font-face download in the background. Layout can shift when a custom face finally arrives. The CSS Font Loading API lets JavaScript wait for fonts, check whether a face is ready, and load fonts programmatically.
MDN: document.fonts returns the FontFaceSet of the document—useful for loading new fonts and checking the status of previously loaded fonts.
💡
Think of it as a font manager
FontFaceSet is a Set-like collection of FontFace objects. You can iterate it, read size / status, and await ready before measuring text.
Run code only after used fonts finish loading and layout.
JavaScript
document.fonts.ready.then((fontFaceSet) => {
// Safe place for canvas text, measuring, etc.
const fontFaces = [...fontFaceSet];
console.log(fontFaces);
// Some fonts may still be unloaded if unused (MDN)
console.log(fontFaces.map((f) => f.status));
});
Document.fonts is marked Baseline Widely available on MDN (since January 2020). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline · Widely available
Document.fonts
FontFaceSet entry point for the CSS Font Loading API — ready, check, load, and add faces.
WidelyAvailable
Google ChromeFull support · Desktop & Mobile
Full support
Mozilla FirefoxFull support · Desktop & Mobile
Full support
Apple SafariFull support · macOS & iOS
Full support
Microsoft EdgeFull support · Chromium
Full support
OperaFull support · Modern versions
Full support
Internet ExplorerNot supported
No support
Document.fontsBaseline support
Bottom line: Await document.fonts.ready before measuring text. Use FontFace + fonts.add for dynamic loads, and keep @font-face as the default declaration path.
Wrap Up
Conclusion
Document.fonts gives you the document’s FontFaceSet—the standard way to wait for web fonts, check availability, and load faces from JavaScript. Pair it with CSS @font-face and font-display for polished typography.
FontFaceSet for the CSS Font Loading API — wait, check, load.
5
Core concepts
📄01
Returns
FontFaceSet
API
✓02
Status
baseline
Standard
⏳03
Promise
fonts.ready
Used fonts
🔎04
Query
check / load
Methods
➕05
Dynamic
FontFace + add
JS load
❓ Frequently Asked Questions
The FontFaceSet interface for the document. MDN: it is useful for loading new fonts and checking the status of previously loaded fonts. This is part of the CSS Font Loading API.
No. MDN marks Document.fonts as Baseline Widely available (since January 2020). It is a standard Document property.
A Promise that fulfills when loading and layout of all used fonts are done (MDN). Put measurement or paint-sensitive work inside its then/await callback.
Not necessarily. MDN notes the set of used fonts can differ from declared fonts — for example optional fonts (font-display: optional) that did not load in time.
Create a FontFace, call face.load(), then document.fonts.add(face), or use document.fonts.load("12px MyFont") to request matching faces.
FontFaceSet is also available as self.fonts in web workers (MDN FontFaceSet). Document.fonts is the document entry point in window contexts.
Did you know?
Spreading the set with [...document.fonts] (as in MDN’s example) gives you an array of FontFace objects you can map for family, status, and unicodeRange—handy for debug overlays in design tools.