mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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:
parent
428b5ef27c
commit
a0c359c24e
1 changed files with 8 additions and 4 deletions
12
terminal.c
12
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 ||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue