b9e42c3ef4
Build and Deploy / build-and-deploy (push) Has been cancelled
- lit-force-graph: Refactored for instance reuse, better lifecycle management, and added dynamic imports for AR/VR modes. - lit-html-table: Improved visual design, readability of headers, and fixed reactivity in editable mode. - lit-draggable-dom: Fixed clipping issues by switching to relative/absolute positioning and resolved a panning speed bug caused by CSS variable inheritance.
139 lines
2.8 KiB
TypeScript
139 lines
2.8 KiB
TypeScript
export function checkFonts(): string[] {
|
|
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()
|
|
);
|
|
const fontAvailable = new Set<string>();
|
|
// @ts-ignore
|
|
for (const font of fontCheck.values()) {
|
|
// @ts-ignore
|
|
if (document.fonts.check(`12px "${font}"`)) {
|
|
fontAvailable.add(font);
|
|
}
|
|
}
|
|
// @ts-ignore
|
|
return fontAvailable.values();
|
|
}
|