[poppler] Branch 'poppler-0.10' - poppler/PSOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Dec 30 14:47:48 PST 2008


 poppler/PSOutputDev.cc |   26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

New commits:
commit 382419519587b6a1598600995691e8552b5ecbc1
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Dec 30 23:46:59 2008 +0100

    If Length2 is zero just write until we find EOF of the stream
    
    Fixes exporting to PS of the two pdf i have that have fonts with Length2 set to 0

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 19d34da..3a5d0df 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -36,6 +36,7 @@
 #include <stdarg.h>
 #include <signal.h>
 #include <math.h>
+#include <limits.h>
 #include "goo/GooString.h"
 #include "goo/GooList.h"
 #include "poppler-config.h"
@@ -1878,6 +1879,7 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) {
   int c;
   int start[4];
   GBool binMode;
+  GBool writePadding = gTrue;
   int i;
 
   // check if font is already embedded
@@ -1949,6 +1951,17 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) {
       binMode = gTrue;
   }
 
+  if (length2 == 0)
+  {
+    // length2 == 0 is an error
+    // trying to solve it by just piping all
+    // the stream data
+    error(-1, "Font has length2 as 0, trying to overcome the problem reading the stream until the end");
+    length2 = INT_MAX;
+    writePadding = gFalse;
+  }
+
+
   // convert binary data to ASCII
   if (binMode) {
     for (i = 0; i < 4; ++i) {
@@ -1987,12 +2000,15 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) {
     }
   }
 
-  // write padding and "cleartomark"
-  for (i = 0; i < 8; ++i) {
-    writePS("00000000000000000000000000000000"
-	    "00000000000000000000000000000000\n");
+  if (writePadding)
+  {
+    // write padding and "cleartomark"
+    for (i = 0; i < 8; ++i) {
+      writePS("00000000000000000000000000000000"
+	      "00000000000000000000000000000000\n");
+    }
+    writePS("cleartomark\n");
   }
-  writePS("cleartomark\n");
 
   // ending comment
   writePS("%%EndResource\n");


More information about the poppler mailing list