From e1b7c6983b36d62a63401a1e97aa0cd09fa4d3e7 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 1 Apr 2023 06:05:24 +0300 Subject: [PATCH 22/22] sdl2: Adjust theme font size relative to other elements See osdn #47681 Signed-off-by: Marko Lindqvist --- client/gui-sdl2/gui_string.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/gui-sdl2/gui_string.c b/client/gui-sdl2/gui_string.c index 113007b8c6..634bc77069 100644 --- a/client/gui-sdl2/gui_string.c +++ b/client/gui-sdl2/gui_string.c @@ -154,16 +154,18 @@ void utf8_str_size(utf8_str *pstr, SDL_Rect *fill) } /**********************************************************************//** - Create utf8_str struct with ptsize font. + Create utf8_str struct with ptsize font. If ptsize is zero, + use theme's default font size. + Font will be loaded or aliased with existing font of that size. - in_text must be allocated in memory (malloc/fc_calloc) + in_text must be allocated in memory (fc_malloc() / fc_calloc()) **************************************************************************/ utf8_str *create_utf8_str(char *in_text, size_t n_alloc, Uint16 ptsize) { utf8_str *str = fc_calloc(1, sizeof(utf8_str)); - if (!ptsize) { - str->ptsize = theme_default_font_size(active_theme); + if (ptsize == 0) { + str->ptsize = adj_font(theme_default_font_size(active_theme)); } else { str->ptsize = ptsize; } @@ -180,7 +182,7 @@ utf8_str *create_utf8_str(char *in_text, size_t n_alloc, Uint16 ptsize) str->fgcol = *get_theme_color(COLOR_THEME_TEXT); str->render = 2; - /* in_text must be allocated in memory (malloc/fc_calloc) */ + /* in_text must be allocated in memory (fc_malloc() / fc_calloc() ) */ str->text = in_text; str->n_alloc = n_alloc; -- 2.39.2