From 09354286955a6a7eb05e0e336ce7fc9cc43cb5f3 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 13 May 2021 00:15:00 +0200 Subject: term: remove get_font_scale() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit get_font_scale() was used to get the new scaling factor when loading fonts. This was then compared to the last seen font scaling factor. If there was no difference, the fonts were not reloaded. The problem was, the initial term->scale was set differently. This sometimes led to term->scale=2, while get_font_scale() return 1. That meant, fonts were initially scaled by 2 (when dpi-aware=no). Later, when mapped on an output (and thus term->scale being set to 1), the fonts weren’t reloaded with the correct scaling factor since the cached term->font_scale value was already 1. Since term->scale always reflects the *new* scaling factor when term_font_dpi_changed() is called, use that directly, and remove get_font_scale(). Also rename the following functions: * font_should_size_by_dpi() -> font_size_by_dpi_for_scale() * font_size_by_dpi() -> font_sized_by_dpi() * font_size_by_scale() -> font_sized_by_scale() --- terminal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'terminal.h') diff --git a/terminal.h b/terminal.h index 85ba90eb..42e2fd2a 100644 --- a/terminal.h +++ b/terminal.h @@ -320,7 +320,7 @@ struct terminal { struct config_font *font_sizes[4]; struct pt_or_px font_line_height; float font_dpi; - int font_scale; + int font_scale; /* scaling factor last time we loaded fonts */ int16_t font_x_ofs; int16_t font_y_ofs; enum fcft_subpixel font_subpixel; -- cgit v1.3