From 65f758adef2011e519ea1faca4a6c902d1d6fb91 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 22 Sep 2023 12:34:27 +0300 Subject: [PATCH 17/17] sdl2: Add font size option Requested by tigertoes See osdn #47704 Signed-off-by: Marko Lindqvist --- client/gui-sdl2/gui_main.c | 3 ++- client/options.c | 11 +++++++++++ client/options.h | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/gui-sdl2/gui_main.c b/client/gui-sdl2/gui_main.c index c0e38a2f24..2888d5362a 100644 --- a/client/gui-sdl2/gui_main.c +++ b/client/gui-sdl2/gui_main.c @@ -1302,7 +1302,8 @@ void gui_update_font(const char *font_name, const char *font_value) unsigned default_font_size(struct theme *act_theme) { return font_size_parameter > 0 ? font_size_parameter : - theme_default_font_size(act_theme); + (GUI_SDL_OPTION(use_theme_font_size) ? theme_default_font_size(act_theme) : + GUI_SDL_OPTION(font_size)); } /**********************************************************************//** diff --git a/client/options.c b/client/options.c index 696cee6b77..d1c0d90fc7 100644 --- a/client/options.c +++ b/client/options.c @@ -392,6 +392,8 @@ struct client_options gui_options = { .gui_sdl2_use_color_cursors = TRUE, .gui_sdl2_font_city_names = "10", .gui_sdl2_font_city_productions = "10", + .gui_sdl2_use_theme_font_size = TRUE, + .gui_sdl2_font_size = 10, /* gui-qt client specific options. */ .gui_qt_fullscreen = FALSE, @@ -3412,6 +3414,15 @@ static struct client_option client_options[] = { "production names on the map."), COC_FONT, GUI_SDL2, "10", font_changed_callback), + GEN_BOOL_OPTION(gui_sdl2_use_theme_font_size, N_("Use theme defined font size"), + N_("Disable this to override base font size set by theme " + "by the setting below."), + COC_FONT, GUI_SDL2, TRUE, NULL), + GEN_INT_OPTION(gui_sdl2_font_size, N_("Base Font Size"), + N_("Base Font Size. All the fonts' sizes are defined relative " + "to this. This option has effect only if theme font sizes " + "option is disabled."), + COC_FONT, GUI_SDL2, 10, 6, 50, NULL), /* gui-qt client specific options. */ GEN_BOOL_OPTION(gui_qt_fullscreen, N_("Fullscreen"), diff --git a/client/options.h b/client/options.h index 6fc9bd509a..b06ea59ba5 100644 --- a/client/options.h +++ b/client/options.h @@ -418,6 +418,8 @@ struct client_options bool gui_sdl2_use_color_cursors; char gui_sdl2_font_city_names[64]; char gui_sdl2_font_city_productions[64]; + bool gui_sdl2_use_theme_font_size; + int gui_sdl2_font_size; /* gui-qt client specific options. */ #define FC_QT_DEFAULT_THEME_NAME "NightStalker" -- 2.40.1