summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorBoris Toloknov <tlknv@yandex.ru>2008-07-28 20:58:13 +0200
committerAlbert Astals Cid <aacid@kde.org>2008-07-28 20:59:26 +0200
commitdccfc4c2910b47a77cd7b6019d9365f1684ffd0c (patch)
treeb8b16023a9ce8a2b489be0be6eeeb2b65e4f1529 /utils
parent0fd5a3db1ddad447d44b64eff9abfb077a7853a0 (diff)
Limit ascent and descent are to reasonable values.
See bug 16592 to cases where this helps
Diffstat (limited to 'utils')
-rw-r--r--utils/HtmlOutputDev.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 593db32f..301bd72a 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();