Feature request: system font lookup by family name

未关闭
#359 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript
领域
desktop

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
JavaScript
星标
1.7k
派生
254
平均合并
1 天 13 小时
30 天内合并 PR
22

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

foliojs/fontkit 的其他 Issue

查看 foliojs/fontkit 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。