Skip to content

Feature request: system font lookup by family name #359

@RedWilly

Description

@RedWilly

Fontkit currently needs an absolute file path (or a Buffer) to load a font.
It would be useful to pass a family name like "Helvetica" and have Fontkit locate the file automatically, similar to how browsers and GUI toolkits work.

Example API:

const font = await fontkit.openSystem('Helvetica', {
  weight: 400,
  style: 'normal'
});

this means that all font family name use should be installed on the system first.

Without built-in lookup, each project has to:

  • Scan OS font directories (/System/Library/Fonts, /usr/share/fonts, C:\Windows\Fonts, etc.)
  • Handle platform quirks (macOS .ttc bundles, Windows registry, Linux fontconfig)
  • Reimplement matching logic for weight/style/fallback

This logic is duplicated across many projects and is easy to get wrong.

Use libraries like font-manager or system-fonts to resolve paths, then open in Fontkit. Works, but adds dependencies and complexity.

Happy to help with a PR and cross-platform tests if maintainers are open to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions