-
Notifications
You must be signed in to change notification settings - Fork 235
Open
Description
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
.ttcbundles, 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
Labels
No labels