[draw] Better computation for vertical text centering

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Martin Stubenschrott 2008-04-01 17:59:23 +02:00 committed by Julien Danjou
parent 7a220718d2
commit 8b7c8e3822
1 changed files with 4 additions and 1 deletions

View File

@ -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)
{