From f4dac5fa33ed6721c2143887e0332d08a031e764 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 3 Sep 2023 07:33:57 +0300 Subject: [PATCH 3/3] sdl2: Make size 16 fonts to adjust to theme font size See osdn #48573 Signed-off-by: Marko Lindqvist --- client/gui-sdl2/connectdlg.c | 11 +++++++---- client/gui-sdl2/dialogs.c | 6 +++--- client/gui-sdl2/gui_string.c | 3 +++ client/gui-sdl2/gui_string.h | 3 ++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/client/gui-sdl2/connectdlg.c b/client/gui-sdl2/connectdlg.c index b1821189be..1ccc8de153 100644 --- a/client/gui-sdl2/connectdlg.c +++ b/client/gui-sdl2/connectdlg.c @@ -246,7 +246,7 @@ void popup_connection_dialog(bool lan_scan) area = pLabelWindow->area; fc_snprintf(cBuf, sizeof(cBuf), _("Creating Server List...")); - pstr = create_utf8_from_char(cBuf, adj_font(16)); + pstr = create_utf8_from_char_fonto(cBuf, FONTO_BIG); pstr->style = TTF_STYLE_BOLD; pstr->bgcol = (SDL_Color) {0, 0, 0, 0}; pNewWidget = create_iconlabel(NULL, pLabelWindow->dst, pstr, @@ -813,7 +813,8 @@ static void popup_user_passwd_dialog(const char *pMessage) area.h += adj_size(10) + pBuf->size.h + adj_size(5); /* Password edit */ - pBuf = create_edit(NULL, pWindow->dst, create_utf8_str(NULL, 0, adj_font(16)), + pBuf = create_edit(NULL, pWindow->dst, + create_utf8_str_fonto(NULL, 0, FONTO_BIG), adj_size(210), (WF_PASSWD_EDIT|WF_RESTORE_BACKGROUND|WF_FREE_DATA)); pBuf->action = convert_passwd_callback; @@ -980,7 +981,8 @@ static void popup_new_user_passwd_dialog(const char *pMessage) area.h += adj_size(10) + pBuf->size.h + adj_size(5); /* Password edit */ - pBuf = create_edit(NULL, pWindow->dst, create_utf8_str(NULL, 0, adj_font(16)), + pBuf = create_edit(NULL, pWindow->dst, + create_utf8_str_fonto(NULL, 0, FONTO_BIG), adj_size(210), (WF_PASSWD_EDIT|WF_RESTORE_BACKGROUND|WF_FREE_DATA)); pBuf->action = convert_first_passwd_callback; @@ -989,7 +991,8 @@ static void popup_new_user_passwd_dialog(const char *pMessage) area.h += pBuf->size.h + adj_size(5); /* Second password edit */ - pBuf = create_edit(NULL, pWindow->dst, create_utf8_str(NULL, 0, adj_font(16)), + pBuf = create_edit(NULL, pWindow->dst, + create_utf8_str_fonto(NULL, 0, FONTO_BIG), adj_size(210), (WF_PASSWD_EDIT|WF_RESTORE_BACKGROUND|WF_FREE_DATA)); pBuf->action = convert_second_passwd_callback; diff --git a/client/gui-sdl2/dialogs.c b/client/gui-sdl2/dialogs.c index 13c54d1700..3028a478d5 100644 --- a/client/gui-sdl2/dialogs.c +++ b/client/gui-sdl2/dialogs.c @@ -557,7 +557,7 @@ void popup_notify_dialog(const char *caption, const char *headline, add_to_gui_list(ID_BUTTON, pBuf); pNotifyDlg->pBeginWidgetList = pBuf; - pstr = create_utf8_from_char(headline, adj_font(16)); + pstr = create_utf8_from_char_fonto(headline, FONTO_BIG); pstr->style |= TTF_STYLE_BOLD; pHeadline = create_text_surf_from_utf8(pstr); @@ -3249,8 +3249,8 @@ void popup_races_dialog(struct player *pplayer) add_to_gui_list(ID_LABEL, pWidget); /* Create leader name edit */ - pWidget = create_edit_from_chars(NULL, pWindow->dst, - NULL, adj_font(16), adj_size(200), 0); + pWidget = create_edit_from_chars_fonto(NULL, pWindow->dst, NULL, + FONTO_BIG, adj_size(200), 0); pWidget->size.h = adj_size(24); set_wstate(pWidget, FC_WS_NORMAL); diff --git a/client/gui-sdl2/gui_string.c b/client/gui-sdl2/gui_string.c index d53601f46e..80b1612842 100644 --- a/client/gui-sdl2/gui_string.c +++ b/client/gui-sdl2/gui_string.c @@ -171,6 +171,9 @@ static Uint16 fonto_ptsize(enum font_origin origin) case FONTO_HEADING: def = ptsize_default(); return adj_font(MAX(def + 2, def * 1.4)); + case FONTO_BIG: + def = ptsize_default(); + return adj_font(MAX(def + 3, def * 1.6)); } return 0; diff --git a/client/gui-sdl2/gui_string.h b/client/gui-sdl2/gui_string.h index 92b613635f..ff6a91429e 100644 --- a/client/gui-sdl2/gui_string.h +++ b/client/gui-sdl2/gui_string.h @@ -63,7 +63,8 @@ typedef struct utf8_str { enum font_origin { FONTO_DEFAULT, FONTO_ATTENTION, - FONTO_HEADING + FONTO_HEADING, + FONTO_BIG }; utf8_str *create_utf8_str_fonto(char *in_text, size_t n_alloc, -- 2.40.1