From 4026ba175c351be32c56bcfcb61e6e818803bba9 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Fri, 21 Jul 2023 07:07:03 +0300 Subject: [PATCH 24/24] sdl2: Unhardcode info label font size Respect changes to base font size. See osdn #48427 Signed-off-by: Marko Lindqvist --- client/gui-sdl2/mapview.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/client/gui-sdl2/mapview.c b/client/gui-sdl2/mapview.c index 506d1a3650..826b0c6660 100644 --- a/client/gui-sdl2/mapview.c +++ b/client/gui-sdl2/mapview.c @@ -394,7 +394,7 @@ void overview_size_changed(void) /************************************************************************** Typically an info box is provided to tell the player about the state - of their civilization. This function is called when the label is + of their civilization. This function is called when the label is changed. **************************************************************************/ void update_info_label(void) @@ -413,13 +413,9 @@ void update_info_label(void) return; } -#ifdef SMALL_SCREEN - ptext = create_utf8_str(NULL, 0, 8); -#else - ptext = create_utf8_str(NULL, 0, 10); -#endif + ptext = create_utf8_str_fonto(NULL, 0, FONTO_DEFAULT); - /* set text settings */ + /* Set text settings */ ptext->style |= TTF_STYLE_BOLD; ptext->fgcol = *get_theme_color(COLOR_THEME_MAPVIEW_INFO_TEXT); ptext->bgcol = (SDL_Color) {0, 0, 0, 0}; @@ -445,7 +441,8 @@ void update_info_label(void) client.conn.playing->economic.luxury, client.conn.playing->economic.science); #endif /* SMALL_SCREEN */ - /* convert to unistr and create text surface */ + + /* Convert to unistr and create text surface */ copy_chars_to_utf8_str(ptext, buffer); pTmp = create_text_surf_from_utf8(ptext); @@ -453,26 +450,30 @@ void update_info_label(void) area.w = pTmp->w + adj_size(8); area.h = pTmp->h + adj_size(4); - SDL_FillRect(Main.gui->surface, &area , map_rgba(Main.gui->surface->format, bg_color)); + SDL_FillRect(Main.gui->surface, &area, + map_rgba(Main.gui->surface->format, bg_color)); /* Horizontal lines */ create_line(Main.gui->surface, area.x + 1, area.y, area.x + area.w - 2, area.y, get_theme_color(COLOR_THEME_MAPVIEW_INFO_FRAME)); create_line(Main.gui->surface, - area.x + 1, area.y + area.h - 1, area.x + area.w - 2, area.y + area.h - 1, + area.x + 1, area.y + area.h - 1, + area.x + area.w - 2, area.y + area.h - 1, get_theme_color(COLOR_THEME_MAPVIEW_INFO_FRAME)); - /* vertical lines */ + /* Vertical lines */ create_line(Main.gui->surface, - area.x + area.w - 1, area.y + 1, area.x + area.w - 1, area.y + area.h - 2, + area.x + area.w - 1, area.y + 1, + area.x + area.w - 1, area.y + area.h - 2, get_theme_color(COLOR_THEME_MAPVIEW_INFO_FRAME)); create_line(Main.gui->surface, area.x, area.y + 1, area.x, area.y + area.h - 2, get_theme_color(COLOR_THEME_MAPVIEW_INFO_FRAME)); - /* blit text to screen */ - blit_entire_src(pTmp, Main.gui->surface, area.x + adj_size(5), area.y + adj_size(2)); + /* Blit text to screen */ + blit_entire_src(pTmp, Main.gui->surface, + area.x + adj_size(5), area.y + adj_size(2)); dirty_sdl_rect(&area); -- 2.40.1