diff options
| author | v44r <dv@v44r.com> | 2019-01-28 19:51:34 +0100 |
|---|---|---|
| committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-01-28 14:28:08 -0500 |
| commit | ecc8402c43262e7d92ffa238e4da609c174f55a0 (patch) | |
| tree | 17899f06c9d1dec00ea0f7866a65e85cdda9444f /render.c | |
| parent | 6a7e3a16f2070f2ebc1fb22b158820a77b75cce1 (diff) | |
Fix vertical align of text inside the circle
Diffstat (limited to 'render.c')
| -rw-r--r-- | render.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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); |
