From d02436fb6fe476daf65521917cf766b78a22a189 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 13 Jun 2023 07:08:57 +0300 Subject: [PATCH 41/41] gtk: Set font size unit correctly Reported by skywind3000 See osdn #48185 Signed-off-by: Marko Lindqvist --- client/gui-gtk-3.22/gui_stuff.c | 9 +++++++-- client/gui-gtk-4.0/gui_stuff.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/client/gui-gtk-3.22/gui_stuff.c b/client/gui-gtk-3.22/gui_stuff.c index 3abfb4c940..5234b6ae77 100644 --- a/client/gui-gtk-3.22/gui_stuff.c +++ b/client/gui-gtk-3.22/gui_stuff.c @@ -1044,8 +1044,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-4.0/gui_stuff.c b/client/gui-gtk-4.0/gui_stuff.c index de66a177d3..9027dfd97d 100644 --- a/client/gui-gtk-4.0/gui_stuff.c +++ b/client/gui-gtk-4.0/gui_stuff.c @@ -983,8 +983,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