From a0c359c24e8aacd16d8f9d4db35f50c985bfdf77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Thu, 7 Jan 2021 11:17:23 +0100 Subject: [PATCH] term: set_fonts: use custom line-height+letter-spacing, if set If the user has configured a custom line-height and/or letter-spacing, use that instead of the font metrics. --- terminal.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/terminal.c b/terminal.c index 6ba04677..c7383ae2 100644 --- a/terminal.c +++ b/terminal.c @@ -629,10 +629,14 @@ term_set_fonts(struct terminal *term, struct fcft_font *fonts[static 4]) const int old_cell_width = term->cell_width; const int old_cell_height = term->cell_height; - term->cell_width = term->fonts[0]->space_advance.x > 0 - ? term->fonts[0]->space_advance.x : term->fonts[0]->max_advance.x; - term->cell_height = max(term->fonts[0]->height, - term->fonts[0]->ascent + term->fonts[0]->descent); + term->cell_width = term->conf->letter_spacing >= 0 + ? term->conf->letter_spacing + : (term->fonts[0]->space_advance.x > 0 + ? term->fonts[0]->space_advance.x : term->fonts[0]->max_advance.x); + term->cell_height = term->conf->line_height >= 0 + ? term->conf->line_height + : max(term->fonts[0]->height, + term->fonts[0]->ascent + term->fonts[0]->descent); LOG_INFO("cell width=%d, height=%d", term->cell_width, term->cell_height); if (term->cell_width < old_cell_width ||