summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-09-09 13:02:09 (GMT)
committerWerner Almesberger <werner@almesberger.net>2016-09-09 13:02:09 (GMT)
commit4fde8d6eb13ef44e6865576e7e59f9b20680a2d3 (patch)
tree5f007f03456ac8757a8d2ac9fa303697eaa28c79 /gfx
parent9d3a9476a2f12421a02747abb1f68664f17e655a (diff)
downloadeeshow-4fde8d6eb13ef44e6865576e7e59f9b20680a2d3.zip
eeshow-4fde8d6eb13ef44e6865576e7e59f9b20680a2d3.tar.gz
eeshow-4fde8d6eb13ef44e6865576e7e59f9b20680a2d3.tar.bz2
gfx/cro.c (cr_text_cairo): gently correct for text descending below the baseline
(Especially underlines.)
Diffstat (limited to 'gfx')
-rw-r--r--gfx/cro.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index 50b0d5f..7dcb695 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -341,6 +341,16 @@ static void cr_text_cairo(void *ctx, int x, int y, const char *s, unsigned size,
cairo_get_matrix(cc->cr, &m);
cairo_rotate(cc->cr, -rot / 180.0 * M_PI);
+ /*
+ * Correct for text that descends below the baseline. We should also
+ * take into account the vertical alignment, but this information isn't
+ * available here (at least at the moment.)
+ *
+ * If we use the full difference the correction seems to large, so we
+ * only use half the difference.
+ */
+ cairo_rel_move_to(cc->cr, 0, -(ext.height + ext.y_bearing) / 2);
+
switch (align) {
case text_min:
break;