[poppler] poppler/GfxFont.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Thu Aug 10 07:22:42 UTC 2017


 poppler/GfxFont.cc |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

New commits:
commit f0ecbc6f988aa19ffb2b7e583dca4e609f2f6c65
Author: Thomas Freitag <Thomas.Freitag at alfa.de>
Date:   Thu Aug 10 09:17:27 2017 +0200

    Tweak which cmap we use
    
    Bug #101855

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 183f0497..d95f8f7c 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -29,7 +29,7 @@
 // Copyright (C) 2011, 2012, 2014 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2012 Yi Yang <ahyangyi at gmail.com>
 // Copyright (C) 2012 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
-// Copyright (C) 2012 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2012, 2017 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2013-2016 Jason Crain <jason at aquaticape.us>
 // Copyright (C) 2014 Olly Betts <olly at survex.com>
 //
@@ -1639,14 +1639,13 @@ int *Gfx8BitFont::getCodeToGIDMap(FoFiTrueType *ff) {
   // To match up with the Adobe-defined behaviour, we choose a cmap
   // like this:
   // 1. If the PDF font has an encoding:
-  //    1a. If the PDF font specified MacRomanEncoding and the
+  //    1a. If the TrueType font has a Microsoft Unicode
+  //        cmap or a non-Microsoft Unicode cmap, use it, and use the
+  //        Unicode indexes, not the char codes.
+  //    1b. If the PDF font specified MacRomanEncoding and the
   //        TrueType font has a Macintosh Roman cmap, use it, and
   //        reverse map the char names through MacRomanEncoding to
   //        get char codes.
-  //    1b. If the PDF font is not symbolic or the PDF font is not
-  //        embedded, and the TrueType font has a Microsoft Unicode
-  //        cmap or a non-Microsoft Unicode cmap, use it, and use the
-  //        Unicode indexes, not the char codes.
   //    1c. If the PDF font is symbolic and the TrueType font has a
   //        Microsoft Symbol cmap, use it, and use char codes
   //        directly (possibly with an offset of 0xf000).
@@ -1679,13 +1678,12 @@ int *Gfx8BitFont::getCodeToGIDMap(FoFiTrueType *ff) {
   useMacRoman = gFalse;
   useUnicode = gFalse;
   if (hasEncoding || type == fontType1) {
-    if (usesMacRomanEnc && macRomanCmap >= 0) {
-      cmap = macRomanCmap;
-      useMacRoman = gTrue;
-    } else if ((!(flags & fontSymbolic) || embFontID.num < 0) &&
-	       unicodeCmap >= 0) {
+    if (unicodeCmap >= 0) {
       cmap = unicodeCmap;
       useUnicode = gTrue;
+    } else if (usesMacRomanEnc && macRomanCmap >= 0) {
+      cmap = macRomanCmap;
+      useMacRoman = gTrue;
     } else if ((flags & fontSymbolic) && msSymbolCmap >= 0) {
       cmap = msSymbolCmap;
     } else if ((flags & fontSymbolic) && macRomanCmap >= 0) {


More information about the poppler mailing list