[poppler] poppler/CairoFontEngine.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sat Apr 2 10:12:10 UTC 2016


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

New commits:
commit b68a4ee1dcd1da5b48b2c1f0bb2b6a789ca18ea5
Author: Jason Crain <jason at aquaticape.us>
Date:   Thu Feb 18 01:59:42 2016 -0600

    cairo: Check if PDF knows the width of 'm' in case of substituted font
    
    Bug #94054

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) {


More information about the poppler mailing list