diff --git a/desktop/src/main.rs b/desktop/src/main.rs index 3130afc..93c2c95 100644 --- a/desktop/src/main.rs +++ b/desktop/src/main.rs @@ -37,7 +37,14 @@ fn main() { } match SystemTheme::from_system() { - Ok(system) => apply_system_theme(&system, cx), + Ok(mut system) => { + let native = system.light.defaults.font.size; + if native > 0.0 { + let scaling = settings.theme.font_size / native; + system.accessibility.text_scaling_factor *= scaling; + } + apply_system_theme(&system, cx); + } Err(error) => { tracing::warn!("native theme unavailable ({error})"); diff --git a/docs/NATIVE-THEME-MIGRATION.md b/docs/NATIVE-THEME-MIGRATION.md index 072e3a5..73a7684 100644 --- a/docs/NATIVE-THEME-MIGRATION.md +++ b/docs/NATIVE-THEME-MIGRATION.md @@ -147,6 +147,15 @@ match native_theme_gpui::SystemTheme::from_system() { configs, so the subsequent `Theme::change` / `sync_system_appearance` for the user's `AppearanceMode` picks the right native palette. +Sizing note: gpui-component derives the window rem from `theme.font_size`, so +every rem-relative element scales with it. The OS-reported UI font (13 on +macOS) is smaller than the 16 this app is designed around, so the native path +multiplies `system.accessibility.text_scaling_factor` by +`settings.theme.font_size / native_size` before applying — the connector's +supported scaling knob, which also preserves any OS accessibility scaling. +The same factor scales `mono_font_size`, so code text follows the UI size +(the pre-migration app used 13 for mono while the UI was 16). + On the native path, do **not** set `radius` / `font_size` / `light_theme` / `dark_theme` etc. on `Theme::global_mut` — the connector owns those fields, and overwriting them fights its observer.