systemFonts
systemFonts lists the fonts installed on the system.
Signature
systemFonts(): 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
| Field | Type | Meaning |
|---|---|---|
name | string | The face's primary family name. |
style | string | Either "normal", "italic", or "oblique". |
path | string | The 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.
