From 8b7c8e3822d5bc601d8876089014298043f00e97 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Tue, 1 Apr 2008 17:59:23 +0200 Subject: [PATCH] [draw] Better computation for vertical text centering Signed-off-by: Julien Danjou --- common/draw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/draw.c b/common/draw.c index a297b63d1..08f456320 100644 --- a/common/draw.c +++ b/common/draw.c @@ -244,7 +244,10 @@ draw_text(DrawCtx *ctx, pango_layout_set_font_description(ctx->layout, style.font->desc); x = area.x + padding; - y = area.y + (ctx->height - style.font->height) / 2; + /* + 1 is added for rounding, so that in any case of doubt we rather draw + * the text 1px lower than too high which usually results in a better type + * face */ + y = area.y + (ctx->height - style.font->height + 1) / 2; switch(align) {