Is there a way in javascript to obtain the names of all fonts (or font-families) that the browser can show? (I want to give the user a dropdown with a list of all available fonts, and allow the user to choose a font.) I'd prefer not to have to hardcode this list ahead of time or send it down from the server. (Intuitively, it seems like the browser should know what fonts it has and this should be exposed to javascript somehow.)
12 Answers
Yes there is! I'm so glad you asked this question because I now want to use this too.
http://www.lalit.org/lab/javascript-css-font-detect
Code from http://www.lalit.org/wordpress/wp-content/uploads/2008/05/fontdetect.js?ver=0.3
/**
* JavaScript code to detect available availability of a
* particular font in a browser using JavaScript and CSS.
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/javascript-css-font-detect/
* License: Apache Software License 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* Version: 0.15 (21 Sep 2009)
* Changed comparision font to default from sans-default-default,
* as in FF3.0 font of child element didn't fallback
* to parent element if the font is missing.
* Version: 0.2 (04 Mar 2012)
* Comparing font against all the 3 generic font families ie,
* 'monospace', 'sans-serif' and 'sans'. If it doesn't match all 3
* then that font is 100% not available in the system
* Version: 0.3 (24 Mar 2012)
* Replaced sans with serif in the list of baseFonts
*/
/**
* Usage: d = new Detector();
* d.detect('font name');
*/
var Detector = function() {
// a font will be compared against all the three default fonts.
// and if it doesn't match all 3 then that font is not available.
var baseFonts = ['monospace', 'sans-serif', 'serif'];
//we use m or w because these two characters take up the maximum width.
// And we use a LLi so that the same matching fonts can get separated
var testString = "mmmmmmmmmmlli";
//we test using 72px font size, we may use any size. I guess larger the better.
var testSize = '72px';
var h = document.getElementsByTagName("body")[0];
// create a SPAN in the document to get the width of the text we use to test
var s = document.createElement("span");
s.style.fontSize = testSize;
s.innerHTML = testString;
var defaultWidth = {};
var defaultHeight = {};
for (var index in baseFonts) {
//get the default width for the three base fonts
s.style.fontFamily = baseFonts[index];
h.appendChild(s);
defaultWidth[baseFonts[index]] = s.offsetWidth; //width for the default font
defaultHeight[baseFonts[index]] = s.offsetHeight; //height for the defualt font
h.removeChild(s);
}
function detect(font) {
var detected = false;
for (var index in baseFonts) {
s.style.fontFamily = font + ',' + baseFonts[index]; // name of the font along with the base font for fallback.
h.appendChild(s);
var matched = (s.offsetWidth != defaultWidth[baseFonts[index]] || s.offsetHeight != defaultHeight[baseFonts[index]]);
h.removeChild(s);
detected = detected || matched;
}
return detected;
}
this.detect = detect;
};
Summary
How does it work?
This code works on the simple principle that each character appears differently in different fonts. So different fonts will take different width and height for the same string of characters of same font-size.

- 20,365
- 9
- 72
- 105

- 71,361
- 28
- 124
- 158
-
4Very devious. This is awesome. – recursive Jul 30 '10 at 05:17
-
+1. I just saw this the other day, too...definitely very cool. :D – Faisal Jul 30 '10 at 05:19
-
7Thank you, yes this is useful once I have a list of fonts to test what is installed, but the problem is how to generate a list of font names in the first place. – mattsh Jul 31 '10 at 03:11
-
57This will only give a yes/no for whether a font is installed. – rektide May 25 '11 at 15:50
-
3First I thought it’s great but then I’ve found some issues. The main problem is that each browser returns different results. Definitely not reliable. – Błażej Klisz Feb 13 '13 at 20:51
-
Why would you rollback the edit? I was removing the noise outside of the actual answer. – alex Mar 10 '13 at 03:03
-
1@alex, because posting just a link as an answer is in my eyes insufficient and vague. I don't see anything wrong with the text. – Marko Mar 11 '13 at 00:16
-
1@Marko Posting fluff around a link also adds nothing to the answer. :) – alex Jul 04 '13 at 02:01
-
1link is broken: Error establishing a database connection – Grom S Feb 27 '14 at 08:37
-
Sorry guys, looks like link has gone dead. Answer is 4 years old so I guess not many surprises. I should've copied some of the content and attributed to the author but from memory, it was lengthy. – Marko Feb 27 '14 at 09:28
-
Ehm, the link isn't dead. Maybe the server was down when you tried just then. Nice article, by the way; I can use that. – Mr Lister Mar 22 '14 at 13:08
-
18Interesting and useful but does not answer the question. This does not retrieve the names of fonts available in the browser. Giving a reluctant -1. – BenjaminGolder May 30 '15 at 15:57
-
Consider a "Chinese Japanese Korean" font, some of them might use the exactly same English font as their alphabet font face. Which seems to pass this test against different font set. – Hikariztw Jan 16 '21 at 14:04
FontFaceSet.check() solution
- Detecting all available fonts is common browser fingerprinting technique so it is unlikely any JS API will ever be added which will directly return a list.
- FontFaceSet.check() support is good enough to be used but will need a fallback e.g. this answer for older browsers.
- Checking the following list of fonts takes 150ms+ so will need to be run only as required and the result cached.
Windows 10 Font List
'Arial',
'Arial Black',
'Bahnschrift',
'Calibri',
'Cambria',
'Cambria Math',
'Candara',
'Comic Sans MS',
'Consolas',
'Constantia',
'Corbel',
'Courier New',
'Ebrima',
'Franklin Gothic Medium',
'Gabriola',
'Gadugi',
'Georgia',
'HoloLens MDL2 Assets',
'Impact',
'Ink Free',
'Javanese Text',
'Leelawadee UI',
'Lucida Console',
'Lucida Sans Unicode',
'Malgun Gothic',
'Marlett',
'Microsoft Himalaya',
'Microsoft JhengHei',
'Microsoft New Tai Lue',
'Microsoft PhagsPa',
'Microsoft Sans Serif',
'Microsoft Tai Le',
'Microsoft YaHei',
'Microsoft Yi Baiti',
'MingLiU-ExtB',
'Mongolian Baiti',
'MS Gothic',
'MV Boli',
'Myanmar Text',
'Nirmala UI',
'Palatino Linotype',
'Segoe MDL2 Assets',
'Segoe Print',
'Segoe Script',
'Segoe UI',
'Segoe UI Historic',
'Segoe UI Emoji',
'Segoe UI Symbol',
'SimSun',
'Sitka',
'Sylfaen',
'Symbol',
'Tahoma',
'Times New Roman',
'Trebuchet MS',
'Verdana',
'Webdings',
'Wingdings',
'Yu Gothic',
macOS/iOS Font List
'American Typewriter',
'Andale Mono',
'Arial',
'Arial Black',
'Arial Narrow',
'Arial Rounded MT Bold',
'Arial Unicode MS',
'Avenir',
'Avenir Next',
'Avenir Next Condensed',
'Baskerville',
'Big Caslon',
'Bodoni 72',
'Bodoni 72 Oldstyle',
'Bodoni 72 Smallcaps',
'Bradley Hand',
'Brush Script MT',
'Chalkboard',
'Chalkboard SE',
'Chalkduster',
'Charter',
'Cochin',
'Comic Sans MS',
'Copperplate',
'Courier',
'Courier New',
'Didot',
'DIN Alternate',
'DIN Condensed',
'Futura',
'Geneva',
'Georgia',
'Gill Sans',
'Helvetica',
'Helvetica Neue',
'Herculanum',
'Hoefler Text',
'Impact',
'Lucida Grande',
'Luminari',
'Marker Felt',
'Menlo',
'Microsoft Sans Serif',
'Monaco',
'Noteworthy',
'Optima',
'Palatino',
'Papyrus',
'Phosphate',
'Rockwell',
'Savoye LET',
'SignPainter',
'Skia',
'Snell Roundhand',
'Tahoma',
'Times',
'Times New Roman',
'Trattatello',
'Trebuchet MS',
'Verdana',
'Zapfino',
FontFaceSet.check()
const fontCheck = new Set([
// Windows 10
'Arial', 'Arial Black', 'Bahnschrift', 'Calibri', 'Cambria', 'Cambria Math', 'Candara', 'Comic Sans MS', 'Consolas', 'Constantia', 'Corbel', 'Courier New', 'Ebrima', 'Franklin Gothic Medium', 'Gabriola', 'Gadugi', 'Georgia', 'HoloLens MDL2 Assets', 'Impact', 'Ink Free', 'Javanese Text', 'Leelawadee UI', 'Lucida Console', 'Lucida Sans Unicode', 'Malgun Gothic', 'Marlett', 'Microsoft Himalaya', 'Microsoft JhengHei', 'Microsoft New Tai Lue', 'Microsoft PhagsPa', 'Microsoft Sans Serif', 'Microsoft Tai Le', 'Microsoft YaHei', 'Microsoft Yi Baiti', 'MingLiU-ExtB', 'Mongolian Baiti', 'MS Gothic', 'MV Boli', 'Myanmar Text', 'Nirmala UI', 'Palatino Linotype', 'Segoe MDL2 Assets', 'Segoe Print', 'Segoe Script', 'Segoe UI', 'Segoe UI Historic', 'Segoe UI Emoji', 'Segoe UI Symbol', 'SimSun', 'Sitka', 'Sylfaen', 'Symbol', 'Tahoma', 'Times New Roman', 'Trebuchet MS', 'Verdana', 'Webdings', 'Wingdings', 'Yu Gothic',
// macOS
'American Typewriter', 'Andale Mono', 'Arial', 'Arial Black', 'Arial Narrow', 'Arial Rounded MT Bold', 'Arial Unicode MS', 'Avenir', 'Avenir Next', 'Avenir Next Condensed', 'Baskerville', 'Big Caslon', 'Bodoni 72', 'Bodoni 72 Oldstyle', 'Bodoni 72 Smallcaps', 'Bradley Hand', 'Brush Script MT', 'Chalkboard', 'Chalkboard SE', 'Chalkduster', 'Charter', 'Cochin', 'Comic Sans MS', 'Copperplate', 'Courier', 'Courier New', 'Didot', 'DIN Alternate', 'DIN Condensed', 'Futura', 'Geneva', 'Georgia', 'Gill Sans', 'Helvetica', 'Helvetica Neue', 'Herculanum', 'Hoefler Text', 'Impact', 'Lucida Grande', 'Luminari', 'Marker Felt', 'Menlo', 'Microsoft Sans Serif', 'Monaco', 'Noteworthy', 'Optima', 'Palatino', 'Papyrus', 'Phosphate', 'Rockwell', 'Savoye LET', 'SignPainter', 'Skia', 'Snell Roundhand', 'Tahoma', 'Times', 'Times New Roman', 'Trattatello', 'Trebuchet MS', 'Verdana', 'Zapfino',
].sort());
(async() => {
await document.fonts.ready;
const fontAvailable = new Set();
for (const font of fontCheck.values()) {
if (document.fonts.check(`12px "${font}"`)) {
fontAvailable.add(font);
}
}
console.log('Available Fonts:', [...fontAvailable.values()]);
})();

- 3,019
- 23
- 21
-
thanks this is what i looking for too for eventual web design along local system fonts for gaining much fiability in showing content or parsing page in manner to not fill much cpu – Jul 24 '20 at 08:41
-
4
-
1
-
1This should be the accepted answer to this question. I'm building a simple notepad web app and this is a great solution for displaying fonts that a user can select for the text edit area. +1 – TerranRich Jan 18 '23 at 21:13
-
1This is nice, however I think `fonts.check` only works on Chrome - By standard, fonts.check() should also return true if the font is not available, source: https://developer.mozilla.org/en-US/docs/Web/API/FontFaceSet/check . I checked and in Safari it also gives `true` for every made up font you pass in. – olivarra1 Mar 17 '23 at 17:07
There is a way to do this using document.fonts
.
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.
- Returned values are verbose with weight, style, etc.
function listFonts() {
return [...document.fonts.values()];
}
- Returns only the font family
function listFontFamilies() {
const fontFaces = [...document.fonts.values()];
const families = fontFaces.map(font => font.family);
// converted to set then to array to remove duplicates
return [...new Set(families)];
}
I have tested it without linking any fonts in the HTML, then linked Roboto font, tested again and it got added to the result.

- 5,123
- 4
- 24
- 41

- 1,445
- 10
- 21
-
this code snippet worked perfectly thanks! ``` listFonts() { let fonts = document['fonts']; const it = fonts.entries(); let arr = []; let done = false; while (!done) { const font = it.next(); if (!font.done) { arr.push(font.value[0].family); } else { done = font.done; } } // converted to set then arr to filter repetitive values return [...new Set(arr)]; } ``` – rufreakde Sep 06 '20 at 11:18
-
3when I run this in Firefox, it only shows web fonts (like FontAwesome) – Tim Davis Nov 01 '20 at 03:59
-
4On Chome (in console for this page!) I ran Array.from(document.fonts) and I got two fonts, bot in the "Roboto Slab" family. Clearly I have more than those 2 fonts installed on my machine. – Trade-Ideas Philip Dec 10 '20 at 18:38
-
-
8Looks like it's only showing fonts that are downloaded from the server. – I wrestled a bear once. Jun 23 '21 at 12:34
-
Can you tell me how to use this in react js to get all the available fonts displayed in a dropdown which can be used to change the font of text inside textarea? – Sharjeel Faiq Apr 20 '22 at 05:40
The JavaScript version is a bit flaky. It gets fonts by iterating through known fonts and testing.
The most accurate way (albeit having to use a propriety plugin) is to use Flash. Here you can get the list of fonts without having to test for them individually using dimensions.
You are going have to decide whether to have an exact list at the expense of not working on some devices ( iDevices, browsers without Flash plugin, etc), or a partial list with better support via JavaScript only.
-
3Here is a Flash + JS and displays sample text with your fonts, which is what I was looking for. https://github.com/gabriel/font-detect-js – Dylan Valade Jan 25 '13 at 18:40
-
31@Jared For mentioning Flash? I didn't say it was the only solution, I mentioned it's the most accurate way of detecting fonts. – alex Jul 04 '13 at 01:47
-
5@alex Yes. It might give the wrong impression to developers, especially new ones. I suggest editing your answer to better explain the pros and cons of using Flash, maybe just "It's not recommended, but..." or something like that. – Jared Jul 04 '13 at 01:52
-
21@Jared Do I need to write all my answers to provide information from the ground up for readers in the chance they are new to the craft? I did explain that Flash requires a propriety plugin, but I also mentioned it's currently the only way to get all available fonts (the JavaScript method just detects a subset of fonts, which is probably good enough for most use cases). I'm not happy about having to use Flash either, but it's all we have right now for this task. – alex Jul 04 '13 at 01:57
-
@alex Yes? At least mention if it's the right or wrong thing to do. Just a word or two. It doesn't take much effort and helps newbies. – Jared Jul 05 '13 at 02:26
-
What happens if a newbie uses Flash to do this and they get an influx of complaints from iOS users? You could help them out _now_ by instead of making them go _back_ to SO to ask why it's not working, probably resulting in a duplicate question. – Jared Jul 05 '13 at 02:27
-
7
-
1@alex Thanks. I know it's painful to do so, but I believe it'll help in the long term. Back to +1. – Jared Jul 05 '13 at 02:31
-
10
-
@alex Although the answer revisions says otherwise, I did not see that paragraph when I started this debate. Either you are a wizard and edited the revision notes or I'm blind. – Jared Jul 05 '13 at 02:37
-
2While I'm a big proponent of not using Flash, I think when you say it's dead, you're confusing it with the state of the guy who said it's dead. http://isflashdeadyet.com/ – Rob Grant Nov 11 '13 at 12:14
-
4@jared Just compared the dates and times. Your statement evaluates to "You are blind". – oxygen Feb 06 '16 at 23:38
-
Thanks for mentioning Flash, it is still the only solution for determining available fonts. – Dawied Jul 18 '16 at 07:53
-
Flash Player will list all the fonts but of course the player is unavailable on mobile. My opinion is font listing should be behind an access prompt in Flash Player & should be made available to JavaScript via access prompt similar to the notifications prompt, web cam prompt and location prompt. – 1.21 gigawatts Feb 20 '17 at 04:00
-
@1.21gigawatts It would be nice, perhaps confusing for an average user though *This website wants to know which fonts are available on your system*. – alex Feb 20 '17 at 08:27
-
1It might not make sense but the reason for the prompt is because it's identifying information. For word processors, graphic applications, spreadsheets (google docs) the prompt would make more sense since it's an advantage to provide the user with a list of his own fonts. I can't see it being used often but it's a way for JS developers to get that information if they need it rather than not at all. – 1.21 gigawatts Feb 20 '17 at 08:35
-
Yeah I get that, but I wonder if it's identifying enough to concern the user. The user already sends user agent, IP, etc – alex Feb 20 '17 at 08:50
-
Now that SVG font rendering has been out for a while I'm sure you can replace your "flash" reference with an html5 / SVG solution. – Jacksonkr Feb 26 '17 at 19:31
-
The short answer is. Not much has changed regarding fonts detection in browsers in 2020 except that using Flash is now an even worse idea.
There's currently no browser native system to "list" all available fonts. This is intentional to avoid browser fingerprinting and its security implications.
However, browsers will let you check if a font is loaded/ready using the FontFaceSet API. It's pretty well supported in modern browsers.
This is intended to show if a web font is completely downloaded BUT it will work for system fonts as well. The catch is you have to provide a list of fonts to check.
So in conjunction with a user agent
test (not always accurate), you could produce a list of common system fonts for each device type. Then test against those and any web fonts you load.
NOTE: This will NOT give you a full list of available fonts, but you can check for fonts commonly installed by MS Office or Adobe products.

- 7,339
- 18
- 40
You can use the new Local Font Access API to enumerate through all of the fonts:
console.log(await queryLocalFonts());
You can also check whether the user has granted permission:
const {state} = await navigator.permissions.query({name: 'local-fonts'});
console.log(state); // Either 'granted', 'prompt' or 'denied'

- 7,738
- 4
- 38
- 58
-
The shape of the API has now changed slightly, it's a picker now that you access via `const pickedFonts = await navigator.fonts.query()` and whose picked options you can then iterate over via `for (const metadata of pickedFonts) { }`. The [article](https://web.dev/local-fonts) has been updated accordingly. – DenverCoder9 Jun 02 '21 at 07:21
-
1In Chrome it gives a permission pop-up asking for `Use the fonts on your computer so you can create high-fidelity content`. Other than that it works perfectly and seems to be the only answer here that works reliably in modern browsers. – rebane2001 Oct 02 '22 at 14:47
Font access API is available in Chrome 87:
// Query for all available fonts and log metadata.
const fonts = navigator.fonts.query();
try {
for await (const metadata of fonts) {
console.log(`${metadata.family} (${metadata.fullName})`);
}
} catch (err) {
console.error(err);
}
// Roboto (Roboto Black)
// Roboto (Roboto Black Italic)
// Roboto (Roboto Bold)
More info here

- 4,484
- 2
- 27
- 24
I added two methods to Lalit Patel's Detector above :
- addFont(family, stylesheetUrl, ruleString) -> detects if the font 'family' exists, if not adds a stylesheet loading the font using either stylesheetUrl if given or otherwise ruleString
- addFontsArr(arr) -> adds an array of fonts
With this you can do:
fonts = [ 'Arial', 'Arial Black', { family: 'Lato', stylesheetUrl: 'https://fonts.googleapis.com/css?family=Lato'}, 'Leelawadee UI']
(new FontDetector()).addFontsArr(fonts);
code:
/**
* JavaScript code to detect available availability of a
* particular font in a browser using JavaScript and CSS.
*
* Author : Lalit Patel
* Website: http://www.lalit.org/lab/javascript-css-font-detect/
* License: Apache Software License 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* Version: 0.15 (21 Sep 2009)
* Changed comparision font to default from sans-default-default,
* as in FF3.0 font of child element didn't fallback
* to parent element if the font is missing.
* Version: 0.2 (04 Mar 2012)
* Comparing font against all the 3 generic font families ie,
* 'monospace', 'sans-serif' and 'sans'. If it doesn't match all 3
* then that font is 100% not available in the system
* Version: 0.3 (24 Mar 2012)
* Replaced sans with serif in the list of baseFonts
*/
/**
* Usage: d = new Detector();
* d.detect('font name');
*/
function FontDetector() {
this.detect = detect;
this.addFont = addFont;
this.addFontsArr = addFontsArr;
// a font will be compared against all the three default fonts.
// and if it doesn't match all 3 then that font is not available.
var baseFonts = ['monospace', 'sans-serif', 'serif'];
//we use m or w because these two characters take up the maximum width.
// And we use a LLi so that the same matching fonts can get separated
var testString = "mmmmmmmmmmlli";
//we test using 72px font size, we may use any size. I guess larger the better.
var testSize = '72px';
var h = document.getElementsByTagName("body")[0];
// create a SPAN in the document to get the width of the text we use to test
var s = document.createElement("span");
s.style.fontSize = testSize;
s.innerHTML = testString;
var defaultWidth = {};
var defaultHeight = {};
for (var index in baseFonts) {
//get the default width for the three base fonts
s.style.fontFamily = baseFonts[index];
h.appendChild(s);
defaultWidth[baseFonts[index]] = s.offsetWidth; //width for the default font
defaultHeight[baseFonts[index]] = s.offsetHeight; //height for the defualt font
h.removeChild(s);
}
function detect(font) {
var detected = false;
for (var index in baseFonts) {
s.style.fontFamily = font + ',' + baseFonts[index]; // name of the font along with the base font for fallback.
h.appendChild(s);
var matched = (s.offsetWidth != defaultWidth[baseFonts[index]] || s.offsetHeight != defaultHeight[baseFonts[index]]);
h.removeChild(s);
detected = detected || matched;
}
return detected;
}
function addFont(family, stylesheetUrl, ruleString) {
if (detect(family)) {
//console.log('using internal font '+family);
return true;
}
if (stylesheetUrl) {
console.log('added stylesheet '+stylesheetUrl);
var head = document.head, link = document.createElement('link');
link.type = 'text/css';
link.rel = 'stylesheet';
link.href = stylesheetUrl;
head.appendChild(link);
return true;
}
if (ruleString) {
console.log('adding font rule:'+rule);
var newStyle = document.createElement('style');
newStyle.appendChild(document.createTextNode(rule));
document.head.appendChild(newStyle);
return true;
}
console.log('could not add font '+family);
}
function addFontsArr(arr) {
arr.forEach(a => typeof a==='string' ? addFont(a) : addFont(a.family, a.stylesheetUrl, a.ruleString));
}
};

- 17,260
- 17
- 99
- 173
In my search for this, I also found Font.js, which adds a Font object much like Image, so it's possible to check when a font is actually ready to use. Also works on installed/system fonts. Downside is IE9+ only due to needing Object.defineProperty
(other browsers have it), but if you are doing modern web, this seems like an even better option. (I will, sadly, have to go with the answer above, upvoted and moving on for now. :))

- 2,744
- 2
- 25
- 24
<SCRIPT>
function getFonts()
{
var nFontLen = dlgHelper.fonts.count;
var rgFonts = new Array();
for ( var i = 1; i < nFontLen + 1; i++ )
rgFonts[i] = dlgHelper.fonts(i);
rgFonts.sort();
for ( var j = 0; j < nFontLen; j++ )
document.write( rgFonts[j] + "<BR>" );
}
</SCRIPT>
<BODY onload="getFonts()">
<OBJECT id=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px">
</OBJECT>

- 90,639
- 22
- 233
- 295

- 87
- 1
- 1
-
2@Robert Sköld, yes, it appears to be IE-only. It’s still useful for many purposes, though when used seriously, you should have some feature detection so that people using other browsers will understand; see e.g. http://www.cs.tut.fi/~jkorpela/listfonts1.html – Jukka K. Korpela Jul 16 '12 at 10:22
-
It will not work in IE11 for windows phone??is there anything else i need to add for windows phone??? – jats Aug 26 '14 at 08:15
Maybe this could be done in a completely different way, using a spritesheet with known font images for a specific character and comparing that with snapshots of a canvas element on which the same character is drawn with what the browser reports as the same font. The comparison may be done with something like resemble.js.
This is slower, but should also allow us to detect when the browser is lying.

- 2,183
- 1
- 19
- 25
I have recently noticed that if I set the context.font value for an HTML5 canvas, to something invalid, such as "junk", the change is ignored by the canvas. I do not know if this is browser specific, but it seems to work this way on Chrome. I have also seen other posts (HTML 5 canvas font being ignored) that indicate it happens in other browsers.
One could then write a string out with the default value, which I believe is "10px sans serif" (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font), set the font to one you are testing and write the string again. If it is the same as the first drawing, then the font is not available.

- 31
- 3