Files
ghostty-rs/docs/rewrite/notes/final-Z19.md
T
ddidderr ff1169abed 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
2026-10-12 15:56:21 +02:00

2.2 KiB

Z19: font-backend=freetype feature, DEVIANT_FIXES additions (RV16)

Font backend freetype (Zig -Dfont-backend=freetype)

  • Cargo feature font-backend-freetype on ghostty-font, forwarded by ghostty-cli and 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.rs emits font_discovery (fontconfig or CoreText exists; Zig Discover != void); font_fontconfig is off in this mode. Backend::name() added; OPTIONS = Backend::Freetype; ghostty_font::HAS_DISCOVERY.
  • Zig behaviour matched: Discover = void (Rust: uninhabited stub Discover, never constructed); DeferredFace is 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. +version shows .freetype; crash options use Backend::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. shaper test_util now 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:116 writes path[108] after the 108 < len check; Rust uses rustix SocketAddrUnix::new). Introduced in f8c5ce0. New regression test notify_maximum_length_socket_path_is_rejected_safely in crates/ghostty-os/src/systemd.rs (own hunk, for the orchestrator's fix-deviant commit).
  • Added "Benchmark / synthetic tooling extensions" row (--time, --handler=full, +sgr; commit 0c4f0ee) under Other deliberate deviations.