Created
March 30, 2026 00:40
-
-
Save fgclue/d4b65ffae6e5a2a19aad8a61ef63a1c8 to your computer and use it in GitHub Desktop.
Get all fonts in Chromium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Installed fonts</title> | |
| </head> | |
| <body> | |
| <h1>This page only works in Chrome, Chromium, Brave or Safari.</h1> | |
| <input type="checkbox" id="j"> | |
| <label for="j">Render fonts (warning: your browser begs you to not click here)</label> | |
| <br> | |
| <br> | |
| <button id="a" onclick="logFontData()">LOAD FONTS</button> | |
| <div id="div" style="line-height: 0.5;"></div> | |
| <script defer> | |
| async function logFontData() { | |
| document.getElementById("a").remove() | |
| // j.style.fontFamily = fontData.fullName | |
| console.log(document.getElementById("j").checked == true) | |
| try { | |
| const availableFonts = await window.queryLocalFonts(); | |
| var k = document.createElement("p") | |
| k.textContent = availableFonts.length + " fonts available to the browser" | |
| var l = document.getElementById("div") | |
| document.body.appendChild(l) | |
| l.appendChild(k) | |
| for (const fontData of availableFonts) { | |
| var j = document.createElement("p") | |
| j.textContent = fontData.fullName + " (PS: " + fontData.postscriptName + ", " + fontData.family + " " + fontData.style + ")" | |
| console.log(j.textContent) | |
| j.style.fontSize = "20pt" | |
| if( document.getElementById("j").checked == true) { | |
| j.style.fontFamily = fontData.fullName | |
| } | |
| l.appendChild(j) | |
| } | |
| } catch (err) { | |
| console.error(err.name, err.message); | |
| } | |
| } | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment