From 9720570cc57a22045b0103814de9ccfd44641eda Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 15 Sep 2023 12:35:06 +0300 Subject: [PATCH 6/6] sdl2: Make size 11 fonts to adjust to theme font size See osdn #48574 Signed-off-by: Marko Lindqvist --- client/gui-sdl2/citydlg.c | 4 ++-- client/gui-sdl2/gui_string.c | 3 +++ client/gui-sdl2/gui_string.h | 1 + client/gui-sdl2/repodlgs.c | 16 ++++++++-------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/client/gui-sdl2/citydlg.c b/client/gui-sdl2/citydlg.c index db4201d9cf..1ec99c2611 100644 --- a/client/gui-sdl2/citydlg.c +++ b/client/gui-sdl2/citydlg.c @@ -989,7 +989,7 @@ static void create_city_options_widget_list(struct city *pCity) /* ----- */ fc_snprintf(cBuf, sizeof(cBuf), "%s:", _("New citizens produce")); - pstr = create_utf8_from_char(cBuf, adj_font(11)); + pstr = create_utf8_from_char_fonto(cBuf, FONTO_SLIGHTLY_BIGGER); pstr->style |= SF_CENTER; if (BV_ISSET(pCity->city_options, CITYO_SCIENCE_SPECIALISTS)) { @@ -1933,7 +1933,7 @@ static void redraw_info_city_dialog(struct widget *pCityWindow, FREESURFACE(pSurf); - change_ptsize_utf8(pstr, adj_font(11)); + change_fonto_utf8(pstr, FONTO_SLIGHTLY_BIGGER); pstr->fgcol = *get_theme_color(COLOR_THEME_CITYDLG_INFOPANEL); if (pCity->pollution) { diff --git a/client/gui-sdl2/gui_string.c b/client/gui-sdl2/gui_string.c index 80b1612842..19aa49a0ba 100644 --- a/client/gui-sdl2/gui_string.c +++ b/client/gui-sdl2/gui_string.c @@ -165,6 +165,9 @@ static Uint16 fonto_ptsize(enum font_origin origin) case FONTO_DEFAULT: /* Rely on create_utf8_str() default */ return 0; + case FONTO_SLIGHTLY_BIGGER: + def = ptsize_default(); + return adj_font(MAX(def + 0, def * 1.1)); /* Same as def, when def < 10 */ case FONTO_ATTENTION: def = ptsize_default(); return adj_font(MAX(def + 1, def * 1.2)); diff --git a/client/gui-sdl2/gui_string.h b/client/gui-sdl2/gui_string.h index ff6a91429e..611ac9e042 100644 --- a/client/gui-sdl2/gui_string.h +++ b/client/gui-sdl2/gui_string.h @@ -62,6 +62,7 @@ typedef struct utf8_str { enum font_origin { FONTO_DEFAULT, + FONTO_SLIGHTLY_BIGGER, FONTO_ATTENTION, FONTO_HEADING, FONTO_BIG diff --git a/client/gui-sdl2/repodlgs.c b/client/gui-sdl2/repodlgs.c index 8e8f9078e2..8215ba7827 100644 --- a/client/gui-sdl2/repodlgs.c +++ b/client/gui-sdl2/repodlgs.c @@ -1996,7 +1996,7 @@ void economy_report_dialog_popup(bool make_modal) w2 = adj_size(10) + pBuf->size.w; - /* lux rate slider */ + /* Lux rate slider */ pBuf = create_horizontal(current_theme->Horiz, pWindow->dst, adj_size(30), (WF_FREE_DATA | WF_RESTORE_BACKGROUND)); @@ -2009,11 +2009,11 @@ void economy_report_dialog_popup(bool make_modal) w2 += adj_size(184); - /* lux rate iconlabel */ + /* Lux rate iconlabel */ - /* it is important to leave 1 space at ending of this string */ + /* It is important to leave 1 space at the end of this string. */ fc_snprintf(cbuf, sizeof(cbuf), "%d%% ", client.conn.playing->economic.luxury); - pstr = create_utf8_from_char(cbuf, adj_font(11)); + pstr = create_utf8_from_char_fonto(cbuf, FONTO_SLIGHTLY_BIGGER); pstr->style |= TTF_STYLE_BOLD; pBuf = create_iconlabel(pIcons->pBIG_Luxury, pWindow->dst, pstr, @@ -2042,7 +2042,7 @@ void economy_report_dialog_popup(bool make_modal) add_to_gui_list(ID_CHANGE_TAXRATE_DLG_SCI_BLOCK_CHECKBOX, pBuf); - /* science rate slider */ + /* Science rate slider */ pBuf = create_horizontal(current_theme->Horiz, pWindow->dst, adj_size(30), (WF_FREE_DATA | WF_RESTORE_BACKGROUND)); @@ -2054,10 +2054,10 @@ void economy_report_dialog_popup(bool make_modal) add_to_gui_list(ID_CHANGE_TAXRATE_DLG_SCI_SCROLLBAR, pBuf); - /* science rate iconlabel */ - /* it is important to leave 1 space at ending of this string */ + /* Science rate iconlabel */ + /* It is important to leave 1 space at the end of this string */ fc_snprintf(cbuf, sizeof(cbuf), "%d%% ", client.conn.playing->economic.science); - pstr = create_utf8_from_char(cbuf, adj_font(11)); + pstr = create_utf8_from_char_fonto(cbuf, FONTO_SLIGHTLY_BIGGER); pstr->style |= TTF_STYLE_BOLD; pBuf = create_iconlabel(pIcons->pBIG_Colb, pWindow->dst, pstr, -- 2.40.1