Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. Document
  4. fonts

Document: fonts property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

Thefonts property of theDocument interface returns theFontFaceSet interface of the document.

This feature is part of theCSS Font Loading API.

Value

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

Examples

Doing operation after fonts are loaded

js
document.fonts.ready.then((fontFaceSet) => {  // Any operation that needs to be done only after all used fonts  // have finished loading can go here.  const fontFaces = [...fontFaceSet];  console.log(fontFaces);  // some fonts may still be unloaded if they aren't used on the site  console.log(fontFaces.map((f) => f.status));});

The promise fulfils when loading and layout operations of all used fonts are done. The set of used fonts can be different from the set ofdeclared fonts, e.g., if optional fonts (i.e., fonts declared viafont-display: optional) were not able to load in time.

Specifications

Specification
CSS Font Loading Module Level 3
# FontFaceSet-interface

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp