poppler/GfxFont.cc |   32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

New commits:
commit 62727d0119b4e1a6c000506f47673385f7eccd43
Author: Albert Astals Cid <[email protected]>
Date:   Sun May 17 11:53:21 2020 +0200

    Read CIDToGIDMap for all GfxCIDFont fonts
    
    Also revert my old hack to fix rendering of bug-poppler20605.pdf since
    that was breaking the PS export.
    
    What my old hack did was force the font type to be one of those that
    read the CIDToGIDMap, what the new fix does is actually just read the
    CIDToGIDMap for all fonts

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 07cb5f6f..adaf474e 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -429,7 +429,7 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict 
*fontDict, Ref *embID) {
        t = isType0 ? fontCIDType2 : fontTrueType;
        break;
       case fofiIdOpenTypeCFF8Bit:
-       t = expectedType; // hack: open type always == expected type? s. 
bug-poppler20605.pdf
+       t = isType0 ? fontCIDType0COT : fontType1COT;
        break;
       case fofiIdOpenTypeCFFCID:
        t = fontCIDType0COT;
@@ -1826,24 +1826,22 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, 
Ref idA, GooString *nameA,
   }
 
   // CIDToGIDMap (for embedded TrueType fonts)
-  if (type == fontCIDType2 || type == fontCIDType2OT) {
-    obj1 = desFontDict->lookup("CIDToGIDMap");
-    if (obj1.isStream()) {
-      cidToGIDLen = 0;
-      int i = 64;
-      cidToGID = (int *)gmallocn(i, sizeof(int));
-      obj1.streamReset();
-      while ((c1 = obj1.streamGetChar()) != EOF &&
-            (c2 = obj1.streamGetChar()) != EOF) {
-       if (cidToGIDLen == i) {
-         i *= 2;
-         cidToGID = (int *)greallocn(cidToGID, i, sizeof(int));
-       }
-       cidToGID[cidToGIDLen++] = (c1 << 8) + c2;
+  obj1 = desFontDict->lookup("CIDToGIDMap");
+  if (obj1.isStream()) {
+    cidToGIDLen = 0;
+    int i = 64;
+    cidToGID = (int *)gmallocn(i, sizeof(int));
+    obj1.streamReset();
+    while ((c1 = obj1.streamGetChar()) != EOF &&
+           (c2 = obj1.streamGetChar()) != EOF) {
+      if (cidToGIDLen == i) {
+       i *= 2;
+       cidToGID = (int *)greallocn(cidToGID, i, sizeof(int));
       }
-    } else if (!obj1.isName("Identity") && !obj1.isNull()) {
-      error(errSyntaxError, -1, "Invalid CIDToGIDMap entry in CID font");
+      cidToGID[cidToGIDLen++] = (c1 << 8) + c2;
     }
+  } else if (!obj1.isName("Identity") && !obj1.isNull()) {
+    error(errSyntaxError, -1, "Invalid CIDToGIDMap entry in CID font");
   }
 
   //----- character metrics -----
_______________________________________________
poppler mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to