diff options
author | Thomas Freitag <Thomas.Freitag@alfa.de> | 2016-02-17 22:59:30 +0100 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2016-02-17 22:59:30 +0100 |
commit | 23e4291f2545f56432b0a9c4d709048825327bc2 (patch) | |
tree | c9455d8cbc82fba9aee083082ee8f472fdcd28f3 | |
parent | 88415426df363f1ef86b741cbc3587a89d31aa1f (diff) |
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
-rw-r--r-- | poppler/SplashOutputDev.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index ac0f9ac1..7ddf6e0b 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) { |