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).
This commit is contained in:
Daniel Eklöf 2020-07-07 10:44:55 +02:00
parent 3063204289
commit 69e4213e4a
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
7 changed files with 126 additions and 107 deletions

8
main.c
View file

@ -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)