mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-05-24 13:50:11 +00:00
Adds a FreeType-based `Discover` implementation for Windows. It walks the system font directory (`%SYSTEMROOT%\Fonts`) and the per-user directory (`%LOCALAPPDATA%\Microsoft\Windows\Fonts`), matches descriptors by FreeType `family_name` (falling back to the SFNT name table), and, when a codepoint is in the descriptor, filters on CMap coverage. Wired up as a new `.freetype_windows` backend which `Backend.default()` now returns on Windows. Existing freetype-only paths are untouched and no other platform is affected; cross-platform switches were extended to handle the new enum value the same way they handle `.freetype`. With this in place, the standard code paths (`+list-fonts`, `SharedGridSet` font-family lookup, `CodepointResolver` fallback) work on Windows without any `os.tag == .windows` branches in the caller. Verified by the `build-libghostty-windows-gnu` CI job. No runtime binary ships yet on Windows (no apprt), but this is a drop-in for the discovery API that the Win32 apprt (and the revisited `+list-fonts` PR #12384) will use. Once this lands, #12384 can be closed and `+list-fonts` will work on Windows through the ordinary discovery code path, which addresses the review feedback that `+list-fonts` should only show fonts the internal discovery can find. --- AI usage disclosure: developed with Claude Code (Claude Opus 4.7). Claude drafted the implementation based on my design direction -- I picked the "add a Discover backend" shape over the ad-hoc approach in the earlier `+list-fonts` PR. I reviewed each diff and validated it with a Windows GNU-ABI smoke build before pushing. Part of the Win32 apprt upstreaming series (see discussion #2563 / mattn/ghostty#1).