From d2eeac9b22a1d06d84194894a35f22e3ce6edd51 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Wed, 25 Jan 2017 04:40:58 +0100 Subject: [PATCH] fix(cairo): Use font metrics as vertical baseline Refs #372 --- include/cairo/context.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/cairo/context.hpp b/include/cairo/context.hpp index c80e8e5f..82fd4396 100644 --- a/include/cairo/context.hpp +++ b/include/cairo/context.hpp @@ -186,7 +186,7 @@ namespace cairo { cairo_text_extents_t extents; f->textwidth(subset, &extents); - save(true); + save(); { *this << t.bg; cairo_set_operator(m_c, static_cast(t.bg_operator)); @@ -194,11 +194,11 @@ namespace cairo { t.bg_rect.w + extents.x_advance, t.bg_rect.h); cairo_fill(m_c); } - restore(true); + restore(); // Render subset auto fontextents = f->extents(); - f->render(subset, x, y - (extents.height / 2.0 + extents.y_bearing + fontextents.descent) + f->offset()); + f->render(subset, x, y - (fontextents.descent / 2 - fontextents.height / 4) + f->offset()); // Get updated position position(&x, nullptr);