[poppler] utils/HtmlOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Jul 28 11:59:42 PDT 2008


 utils/HtmlOutputDev.cc |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit dccfc4c2910b47a77cd7b6019d9365f1684ffd0c
Author: Boris Toloknov <tlknv at yandex.ru>
Date:   Mon Jul 28 20:58:13 2008 +0200

    Limit ascent and descent are to reasonable values.
    
    See bug 16592 to cases where this helps

diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 593db32..301bd72 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -81,8 +81,18 @@ HtmlString::HtmlString(GfxState *state, double fontSize, HtmlFontAccu* fonts) {
 
   state->transform(state->getCurX(), state->getCurY(), &x, &y);
   if ((font = state->getFont())) {
-    yMin = y - font->getAscent() * fontSize;
-    yMax = y - font->getDescent() * fontSize;
+    double ascent = font->getAscent();
+    double descent = font->getDescent();
+    if( ascent > 1.05 ){
+        //printf( "ascent=%.15g is too high, descent=%.15g\n", ascent, descent );
+        ascent = 1.05;
+    }
+    if( descent < -0.4 ){
+        //printf( "descent %.15g is too low, ascent=%.15g\n", descent, ascent );
+        descent = -0.4;
+    }
+    yMin = y - ascent * fontSize;
+    yMax = y - descent * fontSize;
     GfxRGB rgb;
     state->getFillRGB(&rgb);
     GooString *name = state->getFont()->getName();


More information about the poppler mailing list