Skip to content

fix(tooling): isolate headless FontSmoothing::On from host AppleFontSmoothing and add --font-smoothing flag - #2665

Merged
Hona merged 1 commit into
devfrom
fix/headless-font-smoothing
Nov 27, 2026
Merged

Hona merged 1 commit into
devfrom
fix/headless-font-smoothing

Conversation

@Hona

@Hona Hona commented Nov 27, 2026

Copy link
Copy Markdown
Member

Root cause

In crates/rune-text/src/raster/coretext_match.rs, FontSmoothing::On.pipeline() checks macOS's AppleFontSmoothing user preference (CFPreferencesCopyAppValue, which searches global, app, and -currentHost / ByHost domains) and downgrades On to ApplePipeline::UNSMOOTHED when it reads 0.

While live macOS windows intentionally honour AppleFontSmoothing = 0 (matching AppKit/SwiftUI), headless runs isolate every other host user setting (--theme, --scale, --scroll-bars, contrast, transparency, text scale). Leaking AppleFontSmoothing into headless runs made FontSmoothing::On and FontSmoothing::Off render byte-identical PNGs on any Mac with AppleFontSmoothing = 0 (including ByHost preferences not shown by defaults read -g), while Windfoil (which ignores AppleFontSmoothing) and WindfoilChromium (which applies Skia text gamma) still differed.

Changes

  • Deterministic headless FontSmoothing::On: Added FontSmoothing::pipeline_with_user_smoothing and TextSystem::set_respect_user_font_smoothing(bool) (plumbed through RuntimeConfig / CoreConfig with default true for live windows). Headless entry points (--snap/--frames/--video/--strip, --desktop/--window, --snap-on-patch, App::headless_runtime, and pixel_compare::Harness) disable host AppleFontSmoothing lookup so FontSmoothing::On always dilates deterministically across machines.
  • --font-smoothing MODE CLI flag: Added --font-smoothing MODE to Args, flags(), HELP, headless runs, --desktop, --snap-on-patch, and live windows (alongside --scale, --theme, and --scroll-bars), accepting all FontSmoothing variants in kebab-case or variant-name form (on, off, windfoil, windfoil-chromium, windfoil-rgb, slug, hinted-gpu, hinted, direct-write, clear-type). An explicit --font-smoothing flag also bypasses host AppleFontSmoothing = 0 so --font-smoothing on always draws smoothed.
  • Tests: Added unit tests in rune-text (coretext_match_tests.rs) and rune (args_tests.rs, tooling/headless/app_tests.rs) covering pipeline resolution, TextSystem::set_respect_user_font_smoothing, flag parsing/metadata sync, App::headless_runtime, and offscreen --snap PNGs comparing On vs Off and CLI overrides.

Verification

  • cargo test -p rune-text --lib coretext_match (9 passed)
  • cargo test -p rune --lib tooling::args_tests (11 passed)
  • cargo test -p rune --lib tooling::headless::app::tests (6 passed, including GPU offscreen --snap verifying On vs Off PNGs differ and --font-smoothing overrides App::font_smoothing)
  • cargo test -p rune --lib app::config::tests (2 passed)
  • cargo check -p rune-text -p rune --lib and cargo check -p rune --lib --features hot
  • Note: verified locally on Windows; macOS CFPreferencesCopyAppValue / Apple Silicon Metal hardware was not executed locally.

Fixes #2650

@Hona
Hona merged commit 1933367 into dev Nov 27, 2026
4 checks passed
@Hona
Hona deleted the fix/headless-font-smoothing branch November 27, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Headless snapshots render FontSmoothing On and Off identically on macOS

1 participant