From f8a8ddeddfa969e77edef3349782074bcabe1ef7 Mon Sep 17 00:00:00 2001 From: TryTwo Date: Wed, 17 Sep 2025 23:38:36 -0700 Subject: OSD / Imgui: Add font size spinbox to Interface Pane. Adjust some imgui windows to work better with different font sizes. --- Source/Core/VideoCommon/OnScreenUI.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/OnScreenUI.cpp') diff --git a/Source/Core/VideoCommon/OnScreenUI.cpp b/Source/Core/VideoCommon/OnScreenUI.cpp index 935cec8619..4689bb6321 100644 --- a/Source/Core/VideoCommon/OnScreenUI.cpp +++ b/Source/Core/VideoCommon/OnScreenUI.cpp @@ -263,11 +263,12 @@ void OnScreenUI::DrawDebugText() { // Position under the FPS display. ImGui::SetNextWindowPos( - ImVec2(ImGui::GetIO().DisplaySize.x - 10.f * m_backbuffer_scale, 80.f * m_backbuffer_scale), + ImVec2(ImGui::GetIO().DisplaySize.x - ImGui::GetFontSize() * m_backbuffer_scale, + 80.f * m_backbuffer_scale), ImGuiCond_FirstUseEver, ImVec2(1.0f, 0.0f)); - ImGui::SetNextWindowSizeConstraints( - ImVec2(150.0f * m_backbuffer_scale, 20.0f * m_backbuffer_scale), - ImGui::GetIO().DisplaySize); + ImGui::SetNextWindowSizeConstraints(ImVec2(5.0f * ImGui::GetFontSize() * m_backbuffer_scale, + 2.1f * ImGui::GetFontSize() * m_backbuffer_scale), + ImGui::GetIO().DisplaySize); if (ImGui::Begin("Movie", nullptr, ImGuiWindowFlags_NoFocusOnAppearing)) { auto& movie = Core::System::GetInstance().GetMovie(); @@ -395,6 +396,12 @@ void OnScreenUI::Finalize() DrawChallengesAndLeaderboards(); ImGui::Render(); + // Check for font changes + ImGuiStyle& style = ImGui::GetStyle(); + const int size = Config::Get(Config::MAIN_OSD_FONT_SIZE); + if (size != style.FontSizeBase) + style.FontSizeBase = static_cast(size); + // Create or update fonts. ImDrawData* draw_data = ImGui::GetDrawData(); if (draw_data->Textures != nullptr) -- cgit v1.2.3