From ecc8402c43262e7d92ffa238e4da609c174f55a0 Mon Sep 17 00:00:00 2001 From: v44r Date: Mon, 28 Jan 2019 19:51:34 +0100 Subject: [PATCH] Fix vertical align of text inside the circle --- render.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/render.c b/render.c index 100e739..25b75f0 100644 --- a/render.c +++ b/render.c @@ -113,12 +113,14 @@ void render_frame(struct swaylock_surface *surface) { if (text) { cairo_text_extents_t extents; + cairo_font_extents_t fe; double x, y; cairo_text_extents(cairo, text, &extents); + cairo_font_extents(cairo, &fe); x = (buffer_width / 2) - (extents.width / 2 + extents.x_bearing); - y = (buffer_height / 2) - - (extents.height / 2 + extents.y_bearing); + y = (buffer_height / 2) + + (fe.height / 2 - fe.descent); cairo_move_to(cairo, x, y); cairo_show_text(cairo, text);