From f0b064a6f1dea9b6acb409ba94d3baea94bd3a17 Mon Sep 17 00:00:00 2001 From: Jason Crain Date: Thu, 18 Feb 2016 01:59:42 -0600 Subject: [PATCH] cairo: Check if PDF knows the width of 'm' in case of substituted font Bug #94054 --- poppler/CairoFontEngine.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc index 3cff917..1e23d78 100644 --- a/poppler/CairoFontEngine.cc +++ b/poppler/CairoFontEngine.cc @@ -113,7 +113,7 @@ CairoFont::getGlyph(CharCode code, double CairoFont::getSubstitutionCorrection(GfxFont *gfxFont) { - double w1, w2; + double w1, w2, w3; CharCode code; char *name; @@ -143,7 +143,8 @@ CairoFont::getSubstitutionCorrection(GfxFont *gfxFont) cairo_font_options_destroy(options); w2 = extents.x_advance; } - if (!gfxFont->isSymbolic()) { + 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) { -- 2.7.0