aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-01-07 10:46:18 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-01-11 08:31:06 +0000
commit70cfcf11fb26a1e3954e72550e4c24e0fa43a8b2 (patch)
tree93efd38f383508106a76f2df6dda7087eca2cbab /terminal.c
parentbox-drawing: compensate for non-zero {horizontal,vertical}-letter-offsets (diff)
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*.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/terminal.c b/terminal.c
index c7383ae2..c23450fb 100644
--- a/terminal.c
+++ b/terminal.c
@@ -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,