feat(font): add the FreeType-only font backend (font-backend-freetype)

Ghostty can be built with -Dfont-backend=freetype, which uses FreeType
without any font discovery. The Rust port only had fontconfig+freetype
(default on Linux) and the CoreText variants. The new cargo feature
`font-backend-freetype` on ghostty-font (forwarded by ghostty-cli and
the root crate; non-Apple, non-wasm targets) behaves like Zig's mode:
font-family discovery, fallback search and codepoint-map overrides are
skipped (embedded fonts only); +list-fonts and +show-face print Zig's
"built without a font discovery mechanism" message and exit 1; +version
reports `.freetype`. The default backend is unchanged.

Also registers the Rust-only benchmark tooling extensions (--time,
--handler=full, ghostty-synthetic +sgr) in DEVIANT_FIXES.md.

Note: `--all-features` now selects this backend for the workspace.

Test Plan:
- cargo test -p ghostty-font --features font-backend-freetype (198)
- cargo build --features font-backend-freetype && ghostty +list-fonts
This commit is contained in:
ddidderr committed 2026-10-12 15:56:21 +02:00
1 parent 798a31ccac
commit 389266720d
18 files changed
+327 -12

No files matched your search

+8
View File
@@ -19,6 +19,9 @@ pub mod config_types;
pub mod coretext_util;
#[cfg(font_fontconfig)]
pub mod deferred_face;
#[cfg(all(not(target_arch = "wasm32"), not(font_fontconfig), not(font_coretext)))]
#[path = "deferred_face_freetype.rs"]
pub mod deferred_face;
#[cfg(font_coretext)]
#[path = "deferred_face_coretext.rs"]
pub mod deferred_face;
@@ -48,6 +51,11 @@ pub mod sprite;
pub use atlas::Atlas;
pub use backend::{Backend, OPTIONS as options};
/// Whether a font discovery mechanism exists in this build (Zig:
/// `font.Discover != void`; false for the `freetype` and `web_canvas`
/// backends).
pub const HAS_DISCOVERY: bool = cfg!(font_discovery);
pub use codepoint_map::CodepointMap;
#[cfg(not(target_arch = "wasm32"))]
pub use codepoint_resolver::CodepointResolver;