From 57d3b93bd53e8ae68d43bd16a2ed752fbe3e280f Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Wed, 8 Apr 2009 01:32:21 +0000 Subject: [PATCH] (ftfont_text_extents): Fix calculation of metrics->descent. --- src/ChangeLog | 5 +++++ src/ftfont.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index a76c86f1195..3ae638fbb41 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2009-04-08 YAMAMOTO Mitsuharu + + * ftfont.c (ftfont_text_extents): Fix calculation of + metrics->descent. + 2009-04-06 Jason Rumney * frame.c (x_set_font): Avoid C99 mid-block variable declaration. diff --git a/src/ftfont.c b/src/ftfont.c index f515856bcba..0be985e30f2 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -1255,7 +1255,7 @@ ftfont_text_extents (font, code, nglyphs, metrics) metrics->lbearing = m->horiBearingX >> 6; metrics->rbearing = (m->horiBearingX + m->width) >> 6; metrics->ascent = m->horiBearingY >> 6; - metrics->descent = (m->horiBearingY + m->height) >> 6; + metrics->descent = (m->height - m->horiBearingY) >> 6; } first = 0; } @@ -1269,8 +1269,8 @@ ftfont_text_extents (font, code, nglyphs, metrics) = width + ((m->horiBearingX + m->width) >> 6); if (metrics->ascent < (m->horiBearingY >> 6)) metrics->ascent = m->horiBearingY >> 6; - if (metrics->descent > ((m->horiBearingY + m->height) >> 6)) - metrics->descent = (m->horiBearingY + m->height) >> 6; + if (metrics->descent > ((m->height - m->horiBearingY) >> 6)) + metrics->descent = (m->height - m->horiBearingY) >> 6; } width += m->horiAdvance >> 6; } -- 2.39.5