other font scaling

This commit is contained in:
2025-07-17 21:55:52 +02:00
parent db4df33861
commit 74848fbd78

View File

@@ -95,11 +95,16 @@ Display::Display(int a_Width, int a_Height, const std::string& a_Title) :
// Setup scaling // Setup scaling
float main_scale = SDL_GetDisplayContentScale(SDL_GetPrimaryDisplay()); float main_scale = SDL_GetDisplayContentScale(SDL_GetPrimaryDisplay());
ImGuiStyle& style = ImGui::GetStyle(); // ImGuiStyle& style = ImGui::GetStyle();
style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this // style.ScaleAllSizes(main_scale); // Bake a fixed style scale. (until we have a solution for dynamic style scaling, changing this
// requires resetting Style + calling this again) // // requires resetting Style + calling this again)
style.FontScaleDpi = main_scale; // Set initial font scale. (using io.ConfigDpiScaleFonts=true makes this unnecessary. We leave // style.FontSizeBase = 13 * main_scale; // Set initial font scale. (using io.ConfigDpiScaleFonts=true makes this unnecessary. We leave
// both here for documentation purpose) // // both here for documentation purpose)
ImFontConfig cfg;
cfg.SizePixels = 13 * main_scale * 2;
io.Fonts->AddFontDefault(&cfg);
// Setup Platform/Renderer backends // Setup Platform/Renderer backends
ImGui_ImplSDL3_InitForOpenGL(m_Window, m_GLContext); ImGui_ImplSDL3_InitForOpenGL(m_Window, m_GLContext);