Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
AutoHideFeatureList,
SkipConstraintWarning,
RequireShiftToDock,
UseResolutionFont,
Theme,
SelectedThemePreset)

Expand Down
6 changes: 4 additions & 2 deletions src/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,13 @@ 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, 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)
};
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; }
Comment thread
alandtse marked this conversation as resolved.
winrt::com_ptr<IDXGIAdapter3> GetDXGIAdapter3() const { return dxgiAdapter3; } // Provide access to dxgiAdapter3
ThemeSettings::FontRoleSettings& GetFontRoleSettings(FontRole role) { return settings.Theme.FontRoles[static_cast<size_t>(role)]; }
const ThemeSettings::FontRoleSettings& GetFontRoleSettings(FontRole role) const { return settings.Theme.FontRoles[static_cast<size_t>(role)]; }
Expand Down
7 changes: 3 additions & 4 deletions src/Menu/SettingsTabRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,11 +856,10 @@ 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;
} 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);
}
Expand Down
13 changes: 7 additions & 6 deletions src/Menu/ThemeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading