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.
This commit is contained in:
Daniel Eklöf 2021-01-07 11:17:23 +01:00
parent 428b5ef27c
commit a0c359c24e
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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_width = term->cell_width;
const int old_cell_height = term->cell_height; const int old_cell_height = term->cell_height;
term->cell_width = term->fonts[0]->space_advance.x > 0 term->cell_width = term->conf->letter_spacing >= 0
? term->fonts[0]->space_advance.x : term->fonts[0]->max_advance.x; ? term->conf->letter_spacing
term->cell_height = max(term->fonts[0]->height, : (term->fonts[0]->space_advance.x > 0
term->fonts[0]->ascent + term->fonts[0]->descent); ? 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); LOG_INFO("cell width=%d, height=%d", term->cell_width, term->cell_height);
if (term->cell_width < old_cell_width || if (term->cell_width < old_cell_width ||