From 2ffd56f29c7e7557032c0e03ee9d418d97b42d2c Mon Sep 17 00:00:00 2001 From: SkrubbySkrubInAShrub Date: Tue, 21 Apr 2026 14:50:53 +0200 Subject: [PATCH 1/4] fix: save resolution based font in usersettings. --- src/Menu.cpp | 11 +++++++++++ src/Menu.h | 2 ++ src/Menu/SettingsTabRenderer.cpp | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Menu.cpp b/src/Menu.cpp index e53f1fcb59..38edb1cf21 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -169,6 +169,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT( AutoHideFeatureList, SkipConstraintWarning, RequireShiftToDock, + UseResolutionFont, Theme, SelectedThemePreset) @@ -427,6 +428,12 @@ void Menu::Save(json& o_json) InputCombo::ComboList::to_json(o_json["WeatherEditorToggleKey"], settings.WeatherEditorToggleKey); } +void Menu::ApplyResolutionFontOverride() +{ + if (settings.UseResolutionFont) + settings.Theme.FontSize = 0.0f; +} + void Menu::LoadTheme(json& o_json) { if (o_json["Theme"].is_object()) { @@ -447,6 +454,8 @@ void Menu::LoadTheme(json& o_json) // Apply background blur enabled state from theme BackgroundBlur::SetEnabled(settings.Theme.BackgroundBlurEnabled); + + ApplyResolutionFontOverride(); } } void Menu::SaveTheme(json& o_json) @@ -520,6 +529,8 @@ bool Menu::LoadThemePreset(const std::string& themeName) // Apply background blur enabled state from theme BackgroundBlur::SetEnabled(settings.Theme.BackgroundBlurEnabled); + ApplyResolutionFontOverride(); + logger::info("Applied theme preset: {}", themeName); return true; } catch (const std::exception& e) { diff --git a/src/Menu.h b/src/Menu.h index 37f4c3d5e0..f9e5418e2f 100644 --- a/src/Menu.h +++ b/src/Menu.h @@ -113,6 +113,7 @@ class Menu void LoadTheme(json& o_json); void SaveTheme(json& o_json); + void ApplyResolutionFontOverride(); // Multi-theme support std::vector DiscoverThemes(); @@ -411,6 +412,7 @@ class Menu bool AutoHideFeatureList = false; // Auto-hide left feature list panel, show on hover bool SkipConstraintWarning = false; // Skip popup when a setting change creates new constraints bool RequireShiftToDock = true; // Require holding Shift to dock windows + bool UseResolutionFont = true; // When true, font size scales with screen resolution (FontSize=0) ThemeSettings Theme; std::string SelectedThemePreset = ""; // Currently selected theme preset (empty = custom/user theme) }; diff --git a/src/Menu/SettingsTabRenderer.cpp b/src/Menu/SettingsTabRenderer.cpp index a52993e4b8..bf661569e2 100644 --- a/src/Menu/SettingsTabRenderer.cpp +++ b/src/Menu/SettingsTabRenderer.cpp @@ -856,7 +856,7 @@ void SettingsTabRenderer::RenderFontsTab() SeparatorTextWithFont("Font", Menu::FontRole::Subheading); - bool useAutoFont = (themeSettings.FontSize <= 0.0f); + bool& useAutoFont = menuInstance->GetSettings().UseResolutionFont; if (ImGui::Checkbox("Use resolution-based font size", &useAutoFont)) { if (useAutoFont) { themeSettings.FontSize = 0.0f; From cfde95fb106d479d7627b43359e94b5a3e6e78d9 Mon Sep 17 00:00:00 2001 From: SkrubbySkrubInAShrub Date: Tue, 21 Apr 2026 15:14:42 +0200 Subject: [PATCH 2/4] fix: address AI comment --- src/Menu.cpp | 10 ---------- src/Menu.h | 2 +- src/Menu/SettingsTabRenderer.cpp | 5 ++--- src/Menu/ThemeManager.cpp | 13 +++++++------ 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/Menu.cpp b/src/Menu.cpp index 38edb1cf21..6c322d28ab 100644 --- a/src/Menu.cpp +++ b/src/Menu.cpp @@ -428,12 +428,6 @@ void Menu::Save(json& o_json) InputCombo::ComboList::to_json(o_json["WeatherEditorToggleKey"], settings.WeatherEditorToggleKey); } -void Menu::ApplyResolutionFontOverride() -{ - if (settings.UseResolutionFont) - settings.Theme.FontSize = 0.0f; -} - void Menu::LoadTheme(json& o_json) { if (o_json["Theme"].is_object()) { @@ -454,8 +448,6 @@ void Menu::LoadTheme(json& o_json) // Apply background blur enabled state from theme BackgroundBlur::SetEnabled(settings.Theme.BackgroundBlurEnabled); - - ApplyResolutionFontOverride(); } } void Menu::SaveTheme(json& o_json) @@ -529,8 +521,6 @@ bool Menu::LoadThemePreset(const std::string& themeName) // Apply background blur enabled state from theme BackgroundBlur::SetEnabled(settings.Theme.BackgroundBlurEnabled); - ApplyResolutionFontOverride(); - logger::info("Applied theme preset: {}", themeName); return true; } catch (const std::exception& e) { diff --git a/src/Menu.h b/src/Menu.h index f9e5418e2f..d718b488c0 100644 --- a/src/Menu.h +++ b/src/Menu.h @@ -113,7 +113,6 @@ class Menu void LoadTheme(json& o_json); void SaveTheme(json& o_json); - void ApplyResolutionFontOverride(); // Multi-theme support std::vector DiscoverThemes(); @@ -418,6 +417,7 @@ class Menu }; const ThemeSettings& GetTheme() const { return settings.Theme; } // Provide read-only access to the Theme. Settings& GetSettings() { return settings; } // Provide access to settings for other components + const Settings& GetSettings() const { return settings; } winrt::com_ptr GetDXGIAdapter3() const { return dxgiAdapter3; } // Provide access to dxgiAdapter3 ThemeSettings::FontRoleSettings& GetFontRoleSettings(FontRole role) { return settings.Theme.FontRoles[static_cast(role)]; } const ThemeSettings::FontRoleSettings& GetFontRoleSettings(FontRole role) const { return settings.Theme.FontRoles[static_cast(role)]; } diff --git a/src/Menu/SettingsTabRenderer.cpp b/src/Menu/SettingsTabRenderer.cpp index bf661569e2..a63b6e2417 100644 --- a/src/Menu/SettingsTabRenderer.cpp +++ b/src/Menu/SettingsTabRenderer.cpp @@ -858,9 +858,8 @@ void SettingsTabRenderer::RenderFontsTab() bool& useAutoFont = menuInstance->GetSettings().UseResolutionFont; if (ImGui::Checkbox("Use resolution-based font size", &useAutoFont)) { - if (useAutoFont) { - themeSettings.FontSize = 0.0f; - } else { + if (!useAutoFont) { + // Seed the fixed-size slider with the current effective size so it doesn't jump float effective = ThemeManager::ResolveFontSize(*menuInstance); themeSettings.FontSize = std::clamp(effective, ThemeManager::Constants::MIN_FONT_SIZE, ThemeManager::Constants::MAX_FONT_SIZE); } diff --git a/src/Menu/ThemeManager.cpp b/src/Menu/ThemeManager.cpp index a1d8466013..31da7155e5 100644 --- a/src/Menu/ThemeManager.cpp +++ b/src/Menu/ThemeManager.cpp @@ -791,15 +791,16 @@ bool ThemeManager::ValidateThemeData(const json& themeData) const float ThemeManager::ResolveFontSize(const Menu& menu) { - const auto& themeSettings = menu.GetTheme(); - float configured = themeSettings.FontSize; + const auto& settings = menu.GetSettings(); - // If user configured a positive size, use it (clamped) - if (std::round(configured) > 0) { - return std::clamp(configured, Constants::MIN_FONT_SIZE, Constants::MAX_FONT_SIZE); + // When resolution-based font is disabled, use the theme's fixed size directly + if (!settings.UseResolutionFont) { + float configured = settings.Theme.FontSize; + if (std::round(configured) > 0) + return std::clamp(configured, Constants::MIN_FONT_SIZE, Constants::MAX_FONT_SIZE); } - // Otherwise, compute dynamic default based on current screen resolution + // Compute dynamic size from screen resolution float dynamicSize; if (globals::game::isVR) { // VR: use overlay height From 97d580f65cf4d66187286fed54a579689812da04 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 21 Apr 2026 13:15:14 +0000 Subject: [PATCH 3/4] =?UTF-8?q?style:=20=F0=9F=8E=A8=20apply=20pre-commit.?= =?UTF-8?q?ci=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details. --- src/Menu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Menu.h b/src/Menu.h index d718b488c0..b75480ef1d 100644 --- a/src/Menu.h +++ b/src/Menu.h @@ -415,8 +415,8 @@ class Menu ThemeSettings Theme; std::string SelectedThemePreset = ""; // Currently selected theme preset (empty = custom/user theme) }; - const ThemeSettings& GetTheme() const { return settings.Theme; } // Provide read-only access to the Theme. - Settings& GetSettings() { return settings; } // Provide access to settings for other components + const ThemeSettings& GetTheme() const { return settings.Theme; } // Provide read-only access to the Theme. + Settings& GetSettings() { return settings; } // Provide access to settings for other components const Settings& GetSettings() const { return settings; } winrt::com_ptr GetDXGIAdapter3() const { return dxgiAdapter3; } // Provide access to dxgiAdapter3 ThemeSettings::FontRoleSettings& GetFontRoleSettings(FontRole role) { return settings.Theme.FontRoles[static_cast(role)]; } From 9c087dcfc91fae7c9e0b4bac50d3a3b33fe3c50e Mon Sep 17 00:00:00 2001 From: SkrubbySkrubInAShrub Date: Tue, 21 Apr 2026 15:33:42 +0200 Subject: [PATCH 4/4] chore: address nitpick --- src/Menu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Menu.h b/src/Menu.h index b75480ef1d..3aedbd2bbc 100644 --- a/src/Menu.h +++ b/src/Menu.h @@ -411,7 +411,7 @@ class Menu bool AutoHideFeatureList = false; // Auto-hide left feature list panel, show on hover bool SkipConstraintWarning = false; // Skip popup when a setting change creates new constraints bool RequireShiftToDock = true; // Require holding Shift to dock windows - bool UseResolutionFont = true; // When true, font size scales with screen resolution (FontSize=0) + bool UseResolutionFont = true; // When true, runtime font size scales with screen resolution; when persisted to theme files, FontSize is zeroed for backward compatibility ThemeSettings Theme; std::string SelectedThemePreset = ""; // Currently selected theme preset (empty = custom/user theme) };