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
2.2 KiB
2.2 KiB
Z19: font-backend=freetype feature, DEVIANT_FIXES additions (RV16)
Font backend freetype (Zig -Dfont-backend=freetype)
- Cargo feature
font-backend-freetypeonghostty-font, forwarded byghostty-cliand the root crate (cargo build --features font-backend-freetype). Default (fontconfig_freetype / coretext / web_canvas) unchanged. Non-Apple, non-wasm targets only (build.rs warns and ignores it elsewhere). build.rsemitsfont_discovery(fontconfig or CoreText exists; ZigDiscover != void);font_fontconfigis off in this mode.Backend::name()added;OPTIONS=Backend::Freetype;ghostty_font::HAS_DISCOVERY.- Zig behaviour matched:
Discover = void(Rust: uninhabited stubDiscover, never constructed);DeferredFaceis empty (family/name "", load/has_codepoint unreachable); SharedGridSet skips the font-family search (primary fonts come from the embedded fallback only) and still adds the embedded emoji fonts; CodepointResolver has no discovery fallback and codepoint-map overrides return None;+list-fonts(after arg parsing) and+show-face(before parsing, written to stdout like Zig's writers) print the "built without a font discovery mechanism" message (no trailing newline) and exit 1.+versionshows.freetype; crash options useBackend::name(). - Fontconfig sys crate is still linked (target dependency), just unused.
- Tests:
cargo test -p ghostty-font --features font-backend-freetype(198 pass),cargo test -p ghostty-cli --features font-backend-freetype list_fonts. shapertest_utilnow compiles without fontconfig (discovered-font tests skip). Note--all-features(just recipes) selects this backend workspace-wide.
DEVIANT_FIXES.md
- Added row 33 (maximum-length NOTIFY_SOCKET: Zig
systemd.zig:116writespath[108]after the108 < lencheck; Rust uses rustixSocketAddrUnix::new). Introduced inf8c5ce0. New regression testnotify_maximum_length_socket_path_is_rejected_safelyincrates/ghostty-os/src/systemd.rs(own hunk, for the orchestrator's fix-deviant commit). - Added "Benchmark / synthetic tooling extensions" row (
--time,--handler=full,+sgr; commit0c4f0ee) under Other deliberate deviations.