[poppler] Branch 'poppler-0.8' - utils/HtmlOutputDev.cc

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


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

New commits:
commit c84f91f1006ba7425f786ef57f7031a2641d216a
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 9438909..933070d 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