Repository navigation
fix(tooling): isolate headless FontSmoothing::On from host AppleFontSmoothing and add --font-smoothing flag - #2665
Merged
Merged
Conversation
…moothing and add --font-smoothing flag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
In
crates/rune-text/src/raster/coretext_match.rs,FontSmoothing::On.pipeline()checks macOS'sAppleFontSmoothinguser preference (CFPreferencesCopyAppValue, which searches global, app, and-currentHost/ ByHost domains) and downgradesOntoApplePipeline::UNSMOOTHEDwhen it reads0.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). LeakingAppleFontSmoothinginto headless runs madeFontSmoothing::OnandFontSmoothing::Offrender byte-identical PNGs on any Mac withAppleFontSmoothing = 0(including ByHost preferences not shown bydefaults read -g), whileWindfoil(which ignoresAppleFontSmoothing) andWindfoilChromium(which applies Skia text gamma) still differed.Changes
FontSmoothing::On: AddedFontSmoothing::pipeline_with_user_smoothingandTextSystem::set_respect_user_font_smoothing(bool)(plumbed throughRuntimeConfig/CoreConfigwith defaulttruefor live windows). Headless entry points (--snap/--frames/--video/--strip,--desktop/--window,--snap-on-patch,App::headless_runtime, andpixel_compare::Harness) disable hostAppleFontSmoothinglookup soFontSmoothing::Onalways dilates deterministically across machines.--font-smoothing MODECLI flag: Added--font-smoothing MODEtoArgs,flags(),HELP, headless runs,--desktop,--snap-on-patch, and live windows (alongside--scale,--theme, and--scroll-bars), accepting allFontSmoothingvariants 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-smoothingflag also bypasses hostAppleFontSmoothing = 0so--font-smoothing onalways draws smoothed.rune-text(coretext_match_tests.rs) andrune(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--snapPNGs comparingOnvsOffand 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--snapverifyingOnvsOffPNGs differ and--font-smoothingoverridesApp::font_smoothing)cargo test -p rune --lib app::config::tests(2 passed)cargo check -p rune-text -p rune --libandcargo check -p rune --lib --features hotCFPreferencesCopyAppValue/ Apple Silicon Metal hardware was not executed locally.Fixes #2650