aboutsummaryrefslogtreecommitdiff
path: root/render.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-08-29 18:41:40 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-08-29 18:41:40 +0000
commit6e5688d7da131acf025c9a51a0466a9fbf5c7b56 (patch)
tree867507dd5812506ce3d27291616996b868427034 /render.c
parentrender: add font_baseline() - calculates the y-coordinate for the baseline (diff)
render: draw_bar: don't assume height == ascent+descent
Instead, draw a bar that is ascent+descent tall, positioned around the baseline such that it starts at the ascent and ends at the descent.
Diffstat (limited to 'render.c')
-rw-r--r--render.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/render.c b/render.c
index 88d747b6..66c76f23 100644
--- a/render.c
+++ b/render.c
@@ -103,10 +103,12 @@ static void
draw_bar(const struct terminal *term, pixman_image_t *pix,
const pixman_color_t *color, int x, int y)
{
- /* TODO: investigate if this is the best way */
+ int baseline = y + font_baseline(term) - term->fextents.ascent;
pixman_image_fill_rectangles(
PIXMAN_OP_SRC, pix, color,
- 1, &(pixman_rectangle16_t){x, y, 1, term->cell_height});
+ 1, &(pixman_rectangle16_t){
+ x, baseline,
+ 1, term->fextents.ascent + term->fextents.descent});
}
static void