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
ebd603f3da
commit
ff1169abed
18 files changed
+327
-12
No files matched your search
@@ -86,6 +86,16 @@ cli_options!(Options, help, diagnostics);
|
||||
/// style. Valid options are `text` and `emoji`. If unset, the presentation
|
||||
/// style of a codepoint will be inferred from the Unicode standard.
|
||||
pub fn run(args: &[impl AsRef<[u8]>]) -> Result<u8, Error> {
|
||||
// Its possible to build Ghostty without font discovery! (This is checked
|
||||
// before the arguments are parsed, as in Zig; the stderr writer is on
|
||||
// stdout, like the other show-face writers.)
|
||||
if !ghostty_font::HAS_DISCOVERY {
|
||||
let mut stderr = ZigWriter::new(stdout_sink(), 1024);
|
||||
write!(stderr, "{}", crate::list_fonts::NO_DISCOVERY_MESSAGE)?;
|
||||
stderr.flush()?;
|
||||
return Ok(1);
|
||||
}
|
||||
|
||||
let mut opts = Options::default();
|
||||
crate::parse_options(&mut opts, args)?;
|
||||
|
||||
|
||||
Reference in new issue
Block a user