From a57e543701d67fd47da6a4ac1a23b2b4bf170cfc Mon Sep 17 00:00:00 2001 From: Alexander Shaduri Date: Fri, 6 Dec 2024 12:33:50 +0400 Subject: [PATCH] Windows: Avoid using non-integer font sizes. --- src/gui/gsc_init.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/gsc_init.cpp b/src/gui/gsc_init.cpp index 5e0ce35..fb57ce4 100644 --- a/src/gui/gsc_init.cpp +++ b/src/gui/gsc_init.cpp @@ -518,10 +518,10 @@ bool app_init_and_loop(int& argc, char**& argv) debug_out_info("app", "Windows system DPI: " << h_ppi << ", scale: " << scale << "\n"); const int fraction_percent = static_cast(std::round(scale * 100)) % 100; if (fraction_percent != 0) { // fractional scaling - // Increase the font size by fraction + // Increase the font size by fraction, but round down the size to match the Windows behavior (?) debug_out_dump("app", "Fractional scaling detected, increasing font size by " << fraction_percent << "%.\n"); Gtk::Settings::get_default()->property_gtk_font_name() - .set_value("Segoe UI " + hz::number_to_string_nolocale(9 * (1. + fraction_percent/100.))); + .set_value("Segoe UI " + hz::number_to_string_nolocale(static_cast(9 * (1. + fraction_percent/100.)))); } } }