From 69e4213e4a68a969e34dfad1807b49430c8606fb Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 7 Jul 2020 10:44:55 +0200 Subject: term: don't use deprecated fcft_size_adjust() When resizing the font on-the-fly, we now do a complete font-reload (this is basically what fcft_size_adjust() did anyway). To get the correct size, we maintain the current size ourselves. We get the initial size from the user-provided font pattern, by converting the string to an FcPattern, and using FcPatternGet() to retrieve both the FC_SIZE and FC_PIXEL_SIZE attributes. These attributes are then removed from the pattern, and the pattern is converted back to a string. The terminal struct maintains a copy of the font sizes. These are initially set to the sizes from the config. When the user resizes the font, the terminal-local sizes are adjusted. To ensure the primary and user-configured fallback fonts are resizes equally much, convert any pixel sizes to point sizes at this point. When the font size is reset, we reload the font sizes from the config (thus once again returning actual pixel-sizes, if that's what the user has configured). --- main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 210179d3..02bd7fcd 100644 --- a/main.c +++ b/main.c @@ -224,7 +224,7 @@ main(int argc, char *const *argv) if (strlen(font) == 0) continue; - tll_push_back(conf_fonts, strdup(font)); + tll_push_back(conf_fonts, font); } break; @@ -342,9 +342,11 @@ main(int argc, char *const *argv) if (login_shell) conf.login_shell = true; if (tll_length(conf_fonts) > 0) { - tll_free_and_free(conf.fonts, free); + tll_foreach(conf.fonts, it) + config_font_destroy(&it->item); + tll_free(conf.fonts); tll_foreach(conf_fonts, it) - tll_push_back(conf.fonts, it->item); + tll_push_back(conf.fonts, config_font_parse(it->item)); tll_free(conf_fonts); } if (conf_width > 0) -- cgit v1.3