File bugzilla-113799-render-fi-correctly.patch of Package kdegraphics3

Index: kdegraphics-3.5.10/kpdf/xpdf/xpdf/GfxFont.cc
===================================================================
--- kdegraphics-3.5.10.orig/kpdf/xpdf/xpdf/GfxFont.cc
+++ kdegraphics-3.5.10/kpdf/xpdf/xpdf/GfxFont.cc
@@ -1508,7 +1508,8 @@ Gushort *GfxCIDFont::getCodeToGIDMap(FoF
   int /*unicodeCmap, macRomanCmap, msSymbolCmap, */cmap;
 //   GBool useMacRoman, useUnicode;
 //   char *charName;
-  Unicode u;
+  Unicode u[64];
+  const int ulen = sizeof(u) / sizeof(Unicode);
   int /*code, */i;
   int mapsize;
   int cidlen;
@@ -1533,7 +1534,7 @@ Gushort *GfxCIDFont::getCodeToGIDMap(FoF
 
   while (cidlen < ctu->getLength()) {
     int n;
-    if ((n = ctu->mapToUnicode((CharCode)cidlen, &u, 1)) == 0) {
+    if ((n = ctu->mapToUnicode((CharCode)cidlen, u, ulen)) == 0) {
       cidlen++;
       continue;
     }
@@ -1542,7 +1543,20 @@ Gushort *GfxCIDFont::getCodeToGIDMap(FoF
 	mapsize *= 2;
       map = (Gushort *)grealloc(map, mapsize * sizeof(Gushort));
     }
-    map[cidlen] = ff->mapCodeToGID(cmap, u);
+    if (n == 1)
+      map[cidlen] = ff->mapCodeToGID(cmap, u[0]);
+    else {
+      char str[n + 1];
+      Unicode u2;
+      for (i = 0; i < n; i++)
+	str[i] = u[i];
+      str[i] = 0;
+      u2 = globalParams->mapNameToUnicode(str);
+      if (u2)
+	map[cidlen] = ff->mapCodeToGID(cmap, u2);
+      else
+	map[cidlen] = cidlen; /* FIXME */
+    }
     cidlen++;
   }
 
openSUSE Build Service is sponsored by