From f319b02cb17da87ac8fb34121c4e2b233507caf4 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 3 Sep 2023 07:24:22 +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 | 23 +++++++++++++---------- client/gui-sdl2/dialogs.c | 7 ++++--- client/gui-sdl2/gui_string.c | 3 +++ client/gui-sdl2/gui_string.h | 3 ++- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/client/gui-sdl2/connectdlg.c b/client/gui-sdl2/connectdlg.c index 81948ae65d..247f6850e7 100644 --- a/client/gui-sdl2/connectdlg.c +++ b/client/gui-sdl2/connectdlg.c @@ -238,7 +238,7 @@ void popup_connection_dialog(bool lan_scan) area = label_window->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}; new_widget = create_iconlabel(NULL, label_window->dst, pstr, @@ -808,9 +808,10 @@ static void popup_user_passwd_dialog(const char *message) area.h += adj_size(10) + buf->size.h + adj_size(5); /* Password edit */ - buf = create_edit(NULL, pwindow->dst, create_utf8_str(NULL, 0, adj_font(16)), - adj_size(210), - (WF_PASSWD_EDIT|WF_RESTORE_BACKGROUND|WF_FREE_DATA)); + buf = 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)); buf->action = convert_passwd_callback; set_wstate(buf, FC_WS_NORMAL); add_to_gui_list(ID_EDIT, buf); @@ -976,18 +977,20 @@ static void popup_new_user_passwd_dialog(const char *message) area.h += adj_size(10) + buf->size.h + adj_size(5); /* Password edit */ - buf = create_edit(NULL, pwindow->dst, create_utf8_str(NULL, 0, adj_font(16)), - adj_size(210), - (WF_PASSWD_EDIT|WF_RESTORE_BACKGROUND|WF_FREE_DATA)); + buf = 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)); buf->action = convert_first_passwd_callback; set_wstate(buf, FC_WS_NORMAL); add_to_gui_list(ID_EDIT, buf); area.h += buf->size.h + adj_size(5); /* Second password edit */ - buf = create_edit(NULL, pwindow->dst, create_utf8_str(NULL, 0, adj_font(16)), - adj_size(210), - (WF_PASSWD_EDIT|WF_RESTORE_BACKGROUND|WF_FREE_DATA)); + buf = 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)); buf->action = convert_second_passwd_callback; add_to_gui_list(ID_EDIT, buf); area.h += buf->size.h + adj_size(10); diff --git a/client/gui-sdl2/dialogs.c b/client/gui-sdl2/dialogs.c index ab5ef9c9b1..ad21eb596d 100644 --- a/client/gui-sdl2/dialogs.c +++ b/client/gui-sdl2/dialogs.c @@ -549,7 +549,7 @@ void popup_notify_dialog(const char *caption, const char *headline, add_to_gui_list(ID_BUTTON, buf); notify_dlg->begin_widget_list = buf; - pstr = create_utf8_from_char(headline, adj_font(16)); + pstr = create_utf8_from_char_fonto(headline, FONTO_BIG); pstr->style |= TTF_STYLE_BOLD; headline_surf = create_text_surf_from_utf8(pstr); @@ -3300,8 +3300,9 @@ 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 d7434615cc..2bf76df6c6 100644 --- a/client/gui-sdl2/gui_string.c +++ b/client/gui-sdl2/gui_string.c @@ -172,6 +172,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 8068d32693..43eb0e70fc 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