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

New commits:
commit f0ecbc6f988aa19ffb2b7e583dca4e609f2f6c65
Author: Thomas Freitag <thomas.frei...@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 <ajohn...@redneon.com>
 // Copyright (C) 2012 Yi Yang <ahyan...@gmail.com>
 // Copyright (C) 2012 Suzuki Toshiya <mpsuz...@hiroshima-u.ac.jp>
-// Copyright (C) 2012 Thomas Freitag <thomas.frei...@alfa.de>
+// Copyright (C) 2012, 2017 Thomas Freitag <thomas.frei...@alfa.de>
 // Copyright (C) 2013-2016 Jason Crain <ja...@aquaticape.us>
 // Copyright (C) 2014 Olly Betts <o...@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) {
_______________________________________________
poppler mailing list
poppler@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to