config: letter-spacing: make this a relative value

0, the default, means no additional spacing; the cell width is defined
by the font metrics.

A positive value *adds* to the width from the font metrics, while a
negative value *subtracts*.
This commit is contained in:
Daniel Eklöf 2021-01-07 11:46:18 +01:00
parent 389570b274
commit 70cfcf11fb
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 21 additions and 7 deletions

View file

@ -629,10 +629,11 @@ 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->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_width = (term->fonts[0]->space_advance.x > 0
? term->fonts[0]->space_advance.x
: term->fonts[0]->max_advance.x)
+ term->conf->letter_spacing;
term->cell_height = term->conf->line_height >= 0
? term->conf->line_height
: max(term->fonts[0]->height,