fix: inspector font/formatting, FreeType-only backend on Apple

Resolves the parity items of docs/rewrite/notes/review-rv17-codex.md
(final-Z20.md):
- FreeType-only font backend is also available on Apple targets
  (discovery-free, embedded emoji fonts); ghostty_surface_quicklook_font
  returns null for every backend except plain CoreText like Zig.
- The +list-fonts test keys off the font crate's selected backend
  (HAS_DISCOVERY), correct under feature unification and on Apple.
- Inspector font: 32 px rasterized with FreeType (dear-imgui freetype)
  like Ghostty; a new `visual-parity.sh inspector` scenario shows 0.031%
  differing pixels (hover highlight) vs the original on Linux. Windows,
  Apple and wasm keep stb_truetype at 32 px (registered as a deliberate
  deviation).
- Inspector DCS/APC descriptions follow Zig 0.15.2's formatting
  (checked by running Zig), incl. the terminal.Parser.Action prefix.
- The ImGui demo window appears only in dev-profile builds, mirroring
  Zig's .Debug-only gate.

Test Plan:
- cargo test --workspace --no-fail-fast (3582 passed)
- just check-macos (both, also with --features font-backend-freetype)
- scripts/visual-parity.sh inspector
This commit is contained in:
ddidderr committed 2026-10-12 16:23:54 +02:00
1 parent 75fd25d1f1
commit e536b603b2
18 files changed
+267 -83

No files matched your search

+8 -7
View File
@@ -40,7 +40,7 @@ harfbuzz-sys = { version = "0.8.0", features = ["bundled"] }
# Like upstream (which builds them from source) the bundled copies are used,
# so no system library is needed on macOS.
freetype-sys = { version = "0.23.0", optional = true, features = ["bundled"] }
harfbuzz-sys = { version = "0.8.0", optional = true, default-features = false, features = ["coretext", "bundled"] }
harfbuzz-sys = { version = "0.8.0", optional = true, default-features = false, features = ["bundled"] }
objc2 = "0.6.5"
objc2-core-foundation = "0.3.2"
objc2-core-graphics = "0.3.2"
@@ -51,18 +51,19 @@ objc2-foundation = "0.3.2"
default = []
# CoreText for discovery, FreeType for rendering, HarfBuzz for shaping
# (Zig `-Dfont-backend=coretext_freetype`; Apple targets only).
coretext-freetype = ["dep:freetype-sys", "dep:harfbuzz-sys", "harfbuzz-sys/freetype"]
coretext-freetype = ["dep:freetype-sys", "dep:harfbuzz-sys", "harfbuzz-sys/freetype", "harfbuzz-sys/coretext"]
# CoreText for discovery and rendering, HarfBuzz for shaping
# (Zig `-Dfont-backend=coretext_harfbuzz`; Apple targets only).
coretext-harfbuzz = ["dep:harfbuzz-sys"]
coretext-harfbuzz = ["dep:harfbuzz-sys", "harfbuzz-sys/coretext"]
# CoreText for discovery and rendering, no shaping
# (Zig `-Dfont-backend=coretext_noshape`; Apple targets only).
coretext-noshape = []
# FreeType for rendering and HarfBuzz for shaping with no font discovery
# (Zig `-Dfont-backend=freetype`; non-Apple, non-wasm targets only; the
# default there is `fontconfig_freetype`). Not enabled by `--all-features`
# in any meaningful sense: it switches the whole build to the backend.
font-backend-freetype = []
# (Zig `-Dfont-backend=freetype`; every target but wasm32, Apple included;
# the default on Linux is `fontconfig_freetype`). Not enabled by
# `--all-features` in any meaningful sense: it switches the whole build to
# the backend.
font-backend-freetype = ["dep:freetype-sys", "dep:harfbuzz-sys", "harfbuzz-sys/freetype"]
# This crate wraps the freetype / harfbuzz / fontconfig C libraries through
# their `-sys` crates; unsafe is denied by default and allowed on minimal,