Skip to content

systemFonts ​

systemFonts lists the fonts installed on the system.

SignaturesystemFonts(): FontInfo[]
tyrus
import { FontInfo, systemFonts } from "tyrus:os";

const fonts: FontInfo[] = systemFonts();
print(`${fonts.length} faces installed`);
if (fonts.length > 0) {
    print(`${fonts[0].name} (${fonts[0].style})`);
}

Returns one FontInfo per font face, a family with regular/bold/italic/bold-italic variants contributes one entry per variant, not one per family.

FontInfo Fields ​

FieldTypeMeaning
namestringThe face's primary family name.
stylestringEither "normal", "italic", or "oblique".
pathstringThe font file's path, or an empty string for a font embedded in memory rather than backed by a file.

An empty array is a valid outcome

A headless machine can plausibly have zero fonts installed, that is not an error condition.