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:
1 parent
798a31ccac
commit
389266720d
18 files changed
+327
-12
No files matched your search
@@ -96,6 +96,7 @@ Only entries with an observable behavioural difference are listed.
|
||||
| Config strings | UTF-8 not required in many places | Escaped-bytes representation (`EncodedOs`) so non-UTF-8 survives; behaviour and error names matched to Zig (for example `theme=/etc/passwd/x` gives `error.NotDir`, checked against the oracle) | `notes/review-rv11-codex.md` (item 3) | 672e8a4, 4bbe0d7 |
|
||||
| `+version` / build info | Real build metadata | Placeholder `build_info` values in places; `gtk-opengl-debug` follows `cfg!(debug_assertions)` (the `release` profile has them on, `production` off) | `notes/ghostty-cli.md`, `notes/ghostty-config.md` | 6286e02 |
|
||||
| OSC 52 base64 acceptance | Surface.zig:2149,2163 rules | Was different in both directions (Codex core audit); fixed to match Zig | `notes/review-core-codex.md` | 2f58f02 |
|
||||
| Benchmark / synthetic tooling extensions | `ghostty-bench` has no `--time` option and only the simplified terminal handler; `ghostty-synthetic` has the actions `ascii`, `osc`, `utf8` | `ghostty-bench --time` prints the measured step time to stderr; `ghostty-bench --handler=full` runs the full `stream_readonly` handler instead of the print-only one; `ghostty-synthetic +sgr` generates SGR-heavy output. Dev/benchmark tooling only; otherwise upstream behaviour is unchanged | `crates/ghostty-bench/src/main.rs`, `src/benches.rs`, `src/bin/ghostty-synthetic.rs`; `notes/review-rv16-codex.md` | 0c4f0ee |
|
||||
|
||||
## Maintenance
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
# 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.
|
||||
Reference in new issue
Block a user