aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-07 10:17:23 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-11 08:31:06 +0000
commita0c359c24e8aacd16d8f9d4db35f50c985bfdf77 (patch)
tree4e163b4ac6e01df89962528ac3c2667065b89bae
parentfoot.ini: add new options: line-height, letter-spacing and *-letter-offset (diff)
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.
-rw-r--r--terminal.c12
1 files 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 ||