《构建 Tinkerfont 笔记》
Notes from Building Tinkerfont

原始链接: https://mighil.com/notes-from-building-tinkerfont

Tinkerfont 是一款专为设计师和开发人员打造的浏览器扩展程序,旨在无需修改代码即可在实时网页上快速检查、测试和替换字体。 Tinkerfont 源于在客户项目或接手代码库时对排版进行轻松实验的需求,提供流畅的工作流程。主要功能包括: * **检查:** 右键点击任意文本,即可查看其字体族、字重、字号、颜色和对比度。 * **检测:** 查看页面上使用的所有字体族的详细列表。 * **替换:** 即时测试来自 Bunny Fonts 的 1,900 多种开源字体,或上传您自己的本地字体文件。 * **范围与持久化:** 将更改应用于特定页面元素,并按主机名保存规则。 该扩展程序秉持隐私至上的原则,完全免费,无需注册账户,所有数据均存储在您的本地设备上。它适用于 Chrome 和 Firefox 浏览器,利用 Manifest V3 和 mutation observers 技术,确保字体替换在动态网页和单页应用中保持稳定。 您可以在 [mighil.com/tinkerfont](https://mighil.com/tinkerfont) 获取文档、安装链接及更多详细信息。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 构建 Tinkerfont 的笔记 (mighil.com) 4 个积分,由 surprisetalk 发布于 1 小时前 | 隐藏 | 过往 | 收藏 | 讨论 | 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 加入 YC | 联系 搜索:
相关文章

原文

I'm a generalist. I design, I code, I end up in a lot of places where typography matters but isn't really the job. Reviewing a client's staging site. Onboarding to a codebase I didn't write. Wondering if a page would just read better in a different font face. The question comes up a lot: what's actually being used here, and what would it look like with something else?

DevTools gets you part of the way. But there wasn't a quick way to just try a font on the live page and move on, so Tinkerfont started as a small tool to close that gap.

What Tinkerfont does

Tinkerfont is a browser extension for inspecting, replacing, and testing fonts on live websites.

  • Inspect: right-click any text for family, weight, size, color, and contrast. Copy what you need.
  • Detect: open the panel and see every font family on the page, with counts.
  • Swap: search 1,900+ open fonts from Bunny Fonts, or upload your own .woff2, .woff, .ttf, or .otf. Apply in one click.
  • Scope: limit a swap to the nav, a hero, or any area you pick on the page.
  • Persist: rules save per hostname. Export and import your setup as JSON.

Free on Chrome and Firefox. No account. Everything stays in local storage on your device.

How the idea grew

The first version was really just font swapping -- pick what's on the page, try a candidate, scroll, decide. That alone covered most of what I kept doing on staging and client work: a quick gut check before a meeting, a screenshot to share, no branch and no CSS edit.

The inspector came later. I'd been using Fontanello for years and wanted that flow built in -- right-click, see the breakdown, copy a value. Huge thanks to Lars and Fredrik for the inspiration there.

A Firefox port followed once the Chrome version felt solid -- same panel, same rules, same local-first model. The website (mighil.com/tinkerfont) is a small lander and docs site: install links, a get-started guide, privacy policy, support form.

Dev notes

Nothing too clever under the hood.

The extension

Manifest V3 on Chrome -- service worker background, content scripts on <all_urls>, a floating panel injected as an iframe.

Roughly:

When a page changes (SPAs, lazy-loaded content), a mutation observer re-applies active rules so swaps don't vanish after navigation.

Custom uploads stay local. The Bunny catalog is a bundled JSON file, refreshed with a small Node script whenever Bunny adds families.

The Firefox build shares almost all the same code -- a thin browser shim, a Firefox-specific manifest (gecko id, data collection declarations for AMO), and a few CSS tweaks where the panel layout differed.

The /tinkerfont website

Next.js, deployed on Cloudflare via OpenNext. Static inner pages, a support form with Turnstile. The landing page has interactive extension previews (HTML iframes), a demo video with a lazy-loaded poster for mobile, and the usual install CTAs for both browsers.

Try it

If you use it for work, I'd love to hear what breaks or what's missing.

联系我们 contact @ memedata.com