aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--terminal.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/terminal.c b/terminal.c
index dd92cd67..e517253b 100644
--- a/terminal.c
+++ b/terminal.c
@@ -2190,9 +2190,17 @@ term_font_baseline(const struct terminal *term)
const struct fcft_font *font = term->fonts[0];
const int line_height = term->cell_height;
const int font_height = font->ascent + font->descent;
- const int glyph_top_y = round((line_height - font_height) / 2.);
- return term->font_y_ofs + glyph_top_y + font->ascent;
+ /*
+ * Center glyph on the line *if* using a custom line height,
+ * otherwise the baseline is simply 'descent' pixels above the
+ * bottom of the cell
+ */
+ const int glyph_top_y = term->font_line_height.px >= 0
+ ? round((line_height - font_height) / 2.)
+ : 0;
+
+ return term->font_y_ofs + line_height - glyph_top_y - font->descent;
}
void