dom / latest / fontfaceset / check.html /

FontFaceSet.check()

The check() method of the FontFaceSet returns whether all fonts in the given font list have been loaded and are available.

Syntax

check(font)
check(font, text)

Return value

A Boolean value that is true if the font list is available.

Parameters

font

a font specification using the CSS value syntax, for example "italic bold 16px Roboto"

text

limit the font faces to those whose Unicode range contains at least one of the characters in text. This does not check for individual glyph coverage.

Examples

In the following example, the first line will print true if the Courier font is available at 12px. The second line will print true if the font MyFont contains the "ß" character.

console.log(document.fonts.check("12px courier"));

console.log(document.fonts.check("12px MyFont", "ß"));

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
check
35
79
41
No
22
10
4.4.3
35
41
22
10
3.0

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