Feature request: system font lookup by family name

Đang mở
#359 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
desktop

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
1.7k
Fork
254
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
22

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của foliojs/fontkit

Tất cả issue của foliojs/fontkit

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.