aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-03-02 17:43:23 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-03-02 17:43:23 +0000
commitf235bfdfdf2a33f9cf0a7074fb3c1722722ffb7b (patch)
tree3b7df0afc94957bbc9754baea125e842de52e8d5
parentwayland: log whether CSDs or SSDs are used at info level, not debug (diff)
terminal: workaround founds with negative line gaps
Some fonts, even monospaced ones, have a negative line gap (line height < ascent + descent). Using the font's line height as cell height will result in some glyphs overflowing into the cell above or below. Workaround by using which ever value is the largest: the line height or ascent + descent.
-rw-r--r--terminal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/terminal.c b/terminal.c
index b0f0679c..290a1425 100644
--- a/terminal.c
+++ b/terminal.c
@@ -521,7 +521,8 @@ term_set_fonts(struct terminal *term, struct font *fonts[static 4])
term->cell_width = term->fonts[0]->space_x_advance > 0
? term->fonts[0]->space_x_advance : term->fonts[0]->max_x_advance;
- term->cell_height = term->fonts[0]->height;
+ term->cell_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);
render_resize_force(term, term->width, term->height);