[poppler] Branch 'xpdf303merge' - 3 commits - fofi/FoFiType1C.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Sat Sep 3 02:06:21 PDT 2011


 fofi/FoFiType1C.cc |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit ce5e620f07e984927610866467705bb526f9ad8d
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sat Sep 3 11:05:42 2011 +0200

    xpdf303: Handle the case where sid < 0

diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 6df4af5..d0ea888 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -2715,7 +2715,9 @@ char *FoFiType1C::getString(int sid, char *buf, GBool *ok) {
   Type1CIndexVal val;
   int n;
 
-  if (sid < 391) {
+  if (sid < 0) {
+    buf[0] = '\0';
+  } else if (sid < 391) {
     strcpy(buf, fofiType1CStdStrings[sid]);
   } else {
     sid -= 391;
commit 9d77f999de973f3c547245bca0568f8984faa5d7
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sat Sep 3 11:02:55 2011 +0200

    xpdf303: Initialize nFDs in FoFiType1C::parse()

diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 19b8a97..6df4af5 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -2024,6 +2024,7 @@ GBool FoFiType1C::parse() {
 
   // for 8-bit fonts: read the private dict
   } else {
+    nFDs = 1;
     privateDicts = (Type1CPrivateDict *)gmalloc(sizeof(Type1CPrivateDict));
     readPrivateDict(topDict.privateOffset, topDict.privateSize,
 		    &privateDicts[0]);
commit d9594c95713ac79b46e313ecf2875196ea076ef4
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Sat Sep 3 11:01:28 2011 +0200

    xpdf303: Check whether fdSelect is NULL before using it

diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 1aa7a4a..19b8a97 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -541,12 +541,13 @@ void FoFiType1C::convertToCIDType0(char *psName, int *codeMap, int nCodes,
       ok = gTrue;
       getIndexVal(&charStringsIdx, gid, &val, &ok);
       if (ok) {
-	getIndex(privateDicts[fdSelect[gid]].subrsOffset, &subrIdx, &ok);
+	getIndex(privateDicts[fdSelect ? fdSelect[gid] : 0].subrsOffset,
+		 &subrIdx, &ok);
 	if (!ok) {
 	  subrIdx.pos = -1;
 	}
 	cvtGlyph(val.pos, val.len, charStrings,
-		 &subrIdx, &privateDicts[fdSelect[gid]], gTrue);
+		 &subrIdx, &privateDicts[fdSelect ? fdSelect[gid] : 0], gTrue);
       }
     }
   }
@@ -791,7 +792,7 @@ void FoFiType1C::convertToCIDType0(char *psName, int *codeMap, int nCodes,
   // write the charstring offset (CIDMap) table
   for (i = 0; i <= nCIDs; i += 6) {
     for (j = 0; j < 6 && i+j <= nCIDs; ++j) {
-      if (i+j < nCIDs && cidMap[i+j] >= 0) {
+      if (i+j < nCIDs && cidMap[i+j] >= 0 && fdSelect) {
 	buf2[0] = (char)fdSelect[cidMap[i+j]];
       } else {
 	buf2[0] = (char)0;
@@ -881,7 +882,8 @@ void FoFiType1C::convertToType0(char *psName, int *codeMap, int nCodes,
     //~ to handle multiple FDs correctly, need to somehow divide the
     //~ font up by FD; as a kludge we ignore CID 0, which is .notdef
     fd = 0;
-    if (fdSelect != NULL) {
+    // if fdSelect is NULL, we have an 8-bit font, so just leave fd=0
+    if (fdSelect) {
       for (j = i==0 ? 1 : 0; j < 256 && i+j < nCIDs; ++j) {
         if (cidMap[i+j] >= 0) {
           fd = fdSelect[cidMap[i+j]];


More information about the poppler mailing list