[poppler] poppler/SplashOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Feb 17 22:01:23 UTC 2016


 poppler/SplashOutputDev.cc |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 23e4291f2545f56432b0a9c4d709048825327bc2
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Wed Feb 17 22:59:30 2016 +0100

    Check if PDF knows the witdh of 'm' in case of substituted font
    
    To check wether the PDF font declaration includes the width of the letter 'm', compare it with the width of code 0. Code 0 is the replacement glyph in a font and has the width of a blank. The width table is initialized with this value, and the blank is always smaller than a 'm'.
    
    Bug #94054

diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index ac0f9ac..7ddf6e0 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -2160,7 +2160,7 @@ reload:
   // for substituted fonts: adjust the font matrix -- compare the
   // width of 'm' in the original font and the substituted font
   if (fontFile->doAdjustMatrix && !gfxFont->isCIDFont()) {
-    double w1, w2;
+    double w1, w2, w3;
     CharCode code;
     char *name;
     for (code = 0; code < 256; ++code) {
@@ -2172,7 +2172,8 @@ reload:
     if (code < 256) {
       w1 = ((Gfx8BitFont *)gfxFont)->getWidth(code);
       w2 = font->getGlyphAdvance(code);
-      if (!gfxFont->isSymbolic() && w2 > 0) {
+      w3 = ((Gfx8BitFont *)gfxFont)->getWidth(0);
+      if (!gfxFont->isSymbolic() && w2 > 0 && w1 > w3) {
         // if real font is substantially narrower than substituted
         // font, reduce the font size accordingly
         if (w1 > 0.01 && w1 < 0.9 * w2) {


More information about the poppler mailing list