From 829e59808a01e01db47e7f2d4416a564ae0651c7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 13 Jun 2023 07:17:21 +0300 Subject: [PATCH 16/16] gtk3(.22): Set font size unit correctly Reported by skywind3000 See osdn #48185 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.0/gui_stuff.c | 9 +++++++-- client/gui-gtk-3.22/gui_stuff.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/client/gui-gtk-3.0/gui_stuff.c b/client/gui-gtk-3.0/gui_stuff.c index 3788fc4f8d..eefd4d5475 100644 --- a/client/gui-gtk-3.0/gui_stuff.c +++ b/client/gui-gtk-3.0/gui_stuff.c @@ -1038,8 +1038,13 @@ void gui_update_font(const char *font_name, const char *font_value) size = pango_font_description_get_size(desc); if (size != 0) { - str = g_strdup_printf("#Freeciv #%s { font-family: %s; font-size: %dpx;%s%s}", - font_name, fam, size / PANGO_SCALE, style, weight); + if (pango_font_description_get_size_is_absolute(desc)) { + str = g_strdup_printf("#Freeciv #%s { font-family: %s; font-size: %dpx;%s%s}", + font_name, fam, size / PANGO_SCALE, style, weight); + } else { + str = g_strdup_printf("#Freeciv #%s { font-family: %s; font-size: %dpt;%s%s}", + font_name, fam, size / PANGO_SCALE, style, weight); + } } else { str = g_strdup_printf("#Freeciv #%s { font-family: %s;%s%s}", font_name, fam, style, weight); diff --git a/client/gui-gtk-3.22/gui_stuff.c b/client/gui-gtk-3.22/gui_stuff.c index 8db0d51c78..270795db7c 100644 --- a/client/gui-gtk-3.22/gui_stuff.c +++ b/client/gui-gtk-3.22/gui_stuff.c @@ -1037,8 +1037,13 @@ void gui_update_font(const char *font_name, const char *font_value) size = pango_font_description_get_size(desc); if (size != 0) { - str = g_strdup_printf("#Freeciv #%s { font-family: %s; font-size: %dpx;%s%s}", - font_name, fam, size / PANGO_SCALE, style, weight); + if (pango_font_description_get_size_is_absolute(desc)) { + str = g_strdup_printf("#Freeciv #%s { font-family: %s; font-size: %dpx;%s%s}", + font_name, fam, size / PANGO_SCALE, style, weight); + } else { + str = g_strdup_printf("#Freeciv #%s { font-family: %s; font-size: %dpt;%s%s}", + font_name, fam, size / PANGO_SCALE, style, weight); + } } else { str = g_strdup_printf("#Freeciv #%s { font-family: %s;%s%s}", font_name, fam, style, weight); -- 2.39.2