Feature request: system font lookup by family name

Aperta
#359 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
desktop

Direzione di ricerca

Start with the proposed openSystem('Helvetica', { weight, style }) entry point and review how Fontkit currently opens fonts from file paths or Buffers. Compare resolution needs across the listed macOS, Linux, and Windows font locations, including family, weight, style, and collection handling. Done means a cross-platform lookup works with the documented API and tests cover the supported systems.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
1.7k
Fork
254
Merge medio
1g 19h
PR unite (30g)
29

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di foliojs/fontkit

Tutte le issue di foliojs/fontkit

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.