Add the checkFont.js
code to a page you want to detect a font within.
Calling checkFont('Font Names')
or checkFont(anElement)
, returns an object telling which fonts are supported by this browser.
checkFont('MyFontFace, Roboto')
/* returns -> {
"MyFontFace": false,
"Roboto": false
} */
checkFont(document.body)
/* returns -> {
"-apple-system": false,
"BlinkMacSystemFont": false,
"Segoe UI": true,
"Roboto": false,
"Noto Sans": false,
"Ubuntu": false,
"Droid Sans": false,
"Helvetica Neue": false,
"sans-serif": true
} */