[poppler] 2 commits - poppler/CairoFontEngine.cc poppler/GfxFont.cc poppler/GfxFont.h poppler/GlobalParams.cc poppler/GlobalParams.h poppler/PSOutputDev.cc poppler/PSOutputDev.h poppler/SplashOutputDev.cc qt4/src qt5/src utils/pdftops.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Jan 18 06:40:17 PST 2015


 poppler/CairoFontEngine.cc |    4 -
 poppler/GfxFont.cc         |   15 ++--
 poppler/GfxFont.h          |    7 +-
 poppler/GlobalParams.cc    |  144 ---------------------------------------------
 poppler/GlobalParams.h     |   29 ---------
 poppler/PSOutputDev.cc     |  121 ++++++++++++++++++-------------------
 poppler/PSOutputDev.h      |   30 ++++++++-
 poppler/SplashOutputDev.cc |    2 
 qt4/src/ArthurOutputDev.cc |    4 -
 qt5/src/ArthurOutputDev.cc |    4 -
 utils/pdftops.cc           |   36 +++--------
 11 files changed, 116 insertions(+), 280 deletions(-)

New commits:
commit 30a0baa353c374165e5f411efc4203746f14a74d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Jan 18 15:39:53 2015 +0100

    Move more variables from GlobalParams to PSOutputDev

diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 4cf8d6b..a5a3023 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -17,7 +17,7 @@
 // Copyright (C) 2005-2007 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
-// Copyright (C) 2005, 2009, 2012, 2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2009, 2012, 2013, 2015 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006, 2007, 2010, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2007 Koji Otani <sho at bbr.jp>
 // Copyright (C) 2008, 2009 Chris Wilson <chris at chris-wilson.co.uk>
@@ -417,7 +417,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
   ref = *gfxFont->getID();
   fontType = gfxFont->getType();
 
-  if (!(fontLoc = gfxFont->locateFont(xref, gFalse))) {
+  if (!(fontLoc = gfxFont->locateFont(xref, NULL))) {
     error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",
     	gfxFont->getName() ? gfxFont->getName()->getCString()
 	                       : "(unnamed)");
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 39f026a..3e9b7db 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005, 2006, 2008-2010, 2012, 2014 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2006, 2008-2010, 2012, 2014, 2015 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
@@ -66,6 +66,7 @@
 #include <fofi/FoFiType1C.h>
 #include <fofi/FoFiTrueType.h>
 #include "GfxFont.h"
+#include "PSOutputDev.h"
 
 //------------------------------------------------------------------------
 
@@ -610,7 +611,7 @@ CharCodeToUnicode *GfxFont::readToUnicodeCMap(Dict *fontDict, int nBits,
   return ctu;
 }
 
-GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) {
+GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) {
   GfxFontLoc *fontLoc;
   SysFontType sysFontType;
   GooString *path, *base14Name, *substName;
@@ -640,19 +641,19 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) {
 	case fontType1:
 	case fontType1C:
 	case fontType1COT:
-	  embed = globalParams->getPSEmbedType1();
+	  embed = ps->getEmbedType1();
 	  break;
 	case fontTrueType:
 	case fontTrueTypeOT:
-	  embed = globalParams->getPSEmbedTrueType();
+	  embed = ps->getEmbedTrueType();
 	  break;
 	case fontCIDType0C:
 	case fontCIDType0COT:
-	  embed = globalParams->getPSEmbedCIDPostScript();
+	  embed = ps->getEmbedCIDPostScript();
 	  break;
 	case fontCIDType2:
 	case fontCIDType2OT:
-	  embed = globalParams->getPSEmbedCIDTrueType();
+	  embed = ps->getEmbedCIDTrueType();
 	  break;
 	default:
 	  break;
@@ -669,7 +670,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) {
   }
 
   //----- PS passthrough
-  if (ps && !isCIDFont() && globalParams->getPSFontPassthrough()) {
+  if (ps && !isCIDFont() && ps->getFontPassthrough()) {
     fontLoc = new GfxFontLoc();
     fontLoc->locType = gfxFontLocResident;
     fontLoc->fontType = fontType1;
diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h
index 1be8975..1f01cc7 100644
--- a/poppler/GfxFont.h
+++ b/poppler/GfxFont.h
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2005, 2008 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2008, 2015 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
 // Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
@@ -43,6 +43,7 @@ class Dict;
 class CMap;
 class CharCodeToUnicode;
 class FoFiTrueType;
+class PSOutputDev;
 struct GfxFontCIDWidths;
 struct Base14FontMapEntry;
 
@@ -237,9 +238,9 @@ public:
   // Return the writing mode (0=horizontal, 1=vertical).
   virtual int getWMode() { return 0; }
 
-  // Locate the font file for this font.  If <ps> is true, includes PS
+  // Locate the font file for this font.  If <ps> is not null, includes PS
   // printer-resident fonts.  Returns NULL on failure.
-  GfxFontLoc *locateFont(XRef *xref, GBool ps);
+  GfxFontLoc *locateFont(XRef *xref, PSOutputDev *ps);
 
   // Locate a Base-14 font file for a specified font name.
   static GfxFontLoc *locateBase14Font(GooString *base14Name);
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 26c3120..7e110d0 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -597,15 +597,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
   psResidentFonts = new GooHash(gTrue);
   psResidentFonts16 = new GooList();
   psResidentFontsCC = new GooList();
-  psEmbedType1 = gTrue;
-  psEmbedTrueType = gTrue;
-  psEmbedCIDPostScript = gTrue;
-  psEmbedCIDTrueType = gTrue;
-  psFontPassthrough = gFalse;
-  psPreload = gFalse;
-  psOPI = gFalse;
-  psASCIIHex = gFalse;
-  psBinary = gFalse;
   textEncoding = new GooString("UTF-8");
 #if defined(_WIN32)
   textEOL = eolDOS;
@@ -1542,87 +1533,6 @@ PSFontParam16 *GlobalParams::getPSResidentFontCC(GooString *collection,
   return p;
 }
 
-GBool GlobalParams::getPSEmbedType1() {
-  GBool e;
-
-  lockGlobalParams;
-  e = psEmbedType1;
-  unlockGlobalParams;
-  return e;
-}
-
-GBool GlobalParams::getPSEmbedTrueType() {
-  GBool e;
-
-  lockGlobalParams;
-  e = psEmbedTrueType;
-  unlockGlobalParams;
-  return e;
-}
-
-GBool GlobalParams::getPSEmbedCIDPostScript() {
-  GBool e;
-
-  lockGlobalParams;
-  e = psEmbedCIDPostScript;
-  unlockGlobalParams;
-  return e;
-}
-
-GBool GlobalParams::getPSEmbedCIDTrueType() {
-  GBool e;
-
-  lockGlobalParams;
-  e = psEmbedCIDTrueType;
-  unlockGlobalParams;
-  return e;
-}
-
-GBool GlobalParams::getPSFontPassthrough() {
-  GBool e;
-
-  lockGlobalParams;
-  e = psFontPassthrough;
-  unlockGlobalParams;
-  return e;
-}
-
-GBool GlobalParams::getPSPreload() {
-  GBool preload;
-
-  lockGlobalParams;
-  preload = psPreload;
-  unlockGlobalParams;
-  return preload;
-}
-
-GBool GlobalParams::getPSOPI() {
-  GBool opi;
-
-  lockGlobalParams;
-  opi = psOPI;
-  unlockGlobalParams;
-  return opi;
-}
-
-GBool GlobalParams::getPSASCIIHex() {
-  GBool ah;
-
-  lockGlobalParams;
-  ah = psASCIIHex;
-  unlockGlobalParams;
-  return ah;
-}
-
-GBool GlobalParams::getPSBinary() {
-  GBool binary;
-
-  lockGlobalParams;
-  binary = psBinary;
-  unlockGlobalParams;
-  return binary;
-}
-
 GooString *GlobalParams::getTextEncodingName() {
   GooString *s;
 
@@ -1913,60 +1823,6 @@ void GlobalParams::setPSLevel(PSLevel level) {
   unlockGlobalParams;
 }
 
-void GlobalParams::setPSEmbedType1(GBool embed) {
-  lockGlobalParams;
-  psEmbedType1 = embed;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setPSEmbedTrueType(GBool embed) {
-  lockGlobalParams;
-  psEmbedTrueType = embed;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setPSEmbedCIDPostScript(GBool embed) {
-  lockGlobalParams;
-  psEmbedCIDPostScript = embed;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setPSEmbedCIDTrueType(GBool embed) {
-  lockGlobalParams;
-  psEmbedCIDTrueType = embed;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setPSFontPassthrough(GBool passthrough) {
-  lockGlobalParams;
-  psFontPassthrough = passthrough;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setPSPreload(GBool preload) {
-  lockGlobalParams;
-  psPreload = preload;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setPSOPI(GBool opi) {
-  lockGlobalParams;
-  psOPI = opi;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setPSASCIIHex(GBool hex) {
-  lockGlobalParams;
-  psASCIIHex = hex;
-  unlockGlobalParams;
-}
-
-void GlobalParams::setPSBinary(GBool binary) {
-  lockGlobalParams;
-  psBinary = binary;
-  unlockGlobalParams;
-}
-
 void GlobalParams::setTextEncoding(char *encodingName) {
   lockGlobalParams;
   delete textEncoding;
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 3419622..16d615a 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -166,15 +166,6 @@ public:
   GooList *getPSResidentFonts();
   PSFontParam16 *getPSResidentFont16(GooString *fontName, int wMode);
   PSFontParam16 *getPSResidentFontCC(GooString *collection, int wMode);
-  GBool getPSEmbedType1();
-  GBool getPSEmbedTrueType();
-  GBool getPSEmbedCIDPostScript();
-  GBool getPSEmbedCIDTrueType();
-  GBool getPSFontPassthrough();
-  GBool getPSPreload();
-  GBool getPSOPI();
-  GBool getPSASCIIHex();
-  GBool getPSBinary();
   GooString *getTextEncodingName();
   EndOfLineKind getTextEOL();
   GBool getTextPageBreaks();
@@ -213,15 +204,6 @@ public:
   void setPSShrinkLarger(GBool shrink);
   void setPSCenter(GBool center);
   void setPSLevel(PSLevel level);
-  void setPSEmbedType1(GBool embed);
-  void setPSEmbedTrueType(GBool embed);
-  void setPSEmbedCIDPostScript(GBool embed);
-  void setPSEmbedCIDTrueType(GBool embed);
-  void setPSFontPassthrough(GBool passthrough);
-  void setPSPreload(GBool preload);
-  void setPSOPI(GBool opi);
-  void setPSASCIIHex(GBool hex);
-  void setPSBinary(GBool binary);
   void setTextEncoding(char *encodingName);
   GBool setTextEOL(char *s);
   void setTextPageBreaks(GBool pageBreaks);
@@ -307,16 +289,6 @@ private:
   GooList *psResidentFontsCC;	// 16-bit character collection fonts
 				//   resident in printer: collection name
 				//   mapped to font info [PSFontParam16]
-  GBool psEmbedType1;		// embed Type 1 fonts?
-  GBool psEmbedTrueType;	// embed TrueType fonts?
-  GBool psEmbedCIDPostScript;	// embed CID PostScript fonts?
-  GBool psEmbedCIDTrueType;	// embed CID TrueType fonts?
-  GBool psFontPassthrough;	// pass all fonts through as-is?
-  GBool psPreload;		// preload PostScript images and forms into
-				//   memory
-  GBool psOPI;			// generate PostScript OPI comments?
-  GBool psASCIIHex;		// use ASCIIHex instead of ASCII85?
-  GBool psBinary;		// use binary instead of hex
   GooString *textEncoding;	// encoding (unicodeMap) to use for text
 				//   output
   EndOfLineKind textEOL;	// type of EOL marker to use for text
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 4139d0b..f69eb86 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1230,6 +1230,15 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
   }
 
   // initialize
+  embedType1 = gTrue;
+  embedTrueType = gTrue;
+  embedCIDPostScript = gTrue;
+  embedCIDTrueType = gTrue;
+  fontPassthrough = gFalse;
+  preloadImagesForms = gFalse;
+  generateOPI = gFalse;
+  useASCIIHex = gFalse;
+  useBinary = gFalse;
   rasterMono = gFalse;
   rasterResolution = 300;
   uncompressPreloadedImages = gFalse;
@@ -1314,7 +1323,6 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
     if (!paperMatch)
       break; // we only need one entry when all pages are the same size
   }
-  preload = globalParams->getPSPreload();
   if (imgLLX == 0 && imgURX == 0 && imgLLY == 0 && imgURY == 0) {
     imgLLX = imgLLY = 0;
     imgURX = paperWidth;
@@ -1519,7 +1527,7 @@ void PSOutputDev::writeHeader(const std::vector<int> &pages,
     writePS("%%DocumentCustomColors: (atend)\n");
   }
   writePS("%%DocumentSuppliedResources: (atend)\n");
-  if ((level == psLevel1 || level == psLevel1Sep) && globalParams->getPSBinary()) {
+  if ((level == psLevel1 || level == psLevel1Sep) && useBinary) {
     writePS("%%DocumentData: Binary\n");
   }
 
@@ -1675,7 +1683,7 @@ void PSOutputDev::writeDocSetup(PDFDoc *doc, Catalog *catalog,
       }
     }
 #if OPI_SUPPORT
-    if (globalParams->getPSOPI()) {
+    if (generateOPI) {
       writePS("/opiMatrix matrix currentmatrix def\n");
     }
 #endif
@@ -1884,7 +1892,7 @@ void PSOutputDev::setupFont(GfxFont *font, Dict *parentResDict) {
 			     font->getID()->num, font->getID()->gen);
     setupType3Font(font, psName, parentResDict);
   } else {
-    fontLoc = font->locateFont(xref, gTrue);
+    fontLoc = font->locateFont(xref, this);
     if (fontLoc != NULL) {
       switch (fontLoc->locType) {
       case gfxFontLocEmbedded:
@@ -2816,7 +2824,7 @@ void PSOutputDev::setupImages(Dict *resDict) {
   Ref imgID;
   int i, j;
 
-  if (!(mode == psModeForm || inType3Char || preload)) {
+  if (!(mode == psModeForm || inType3Char || preloadImagesForms)) {
     return;
   }
 
@@ -2868,7 +2876,7 @@ void PSOutputDev::setupImages(Dict *resDict) {
 }
 
 void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
-  GBool useRLE, useCompressed, useASCIIHex;
+  GBool useRLE, useCompressed, doUseASCIIHex;
   GooString *s;
   int c;
   int size, line, col, i;
@@ -2880,7 +2888,7 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
   if (level < psLevel2) {
     useRLE = gFalse;
     useCompressed = gFalse;
-    useASCIIHex = gTrue;
+    doUseASCIIHex = gTrue;
   } else {
     if (uncompressPreloadedImages) {
       useRLE = gFalse;
@@ -2896,7 +2904,7 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
 	useCompressed = gFalse;
       }
     }
-    useASCIIHex = globalParams->getPSASCIIHex();
+    doUseASCIIHex = useASCIIHex;
   }
   if (useCompressed) {
     str = str->getUndecodedStream();
@@ -2904,7 +2912,7 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
   if (useRLE) {
     str = new RunLengthEncoder(str);
   }
-  if (useASCIIHex) {
+  if (doUseASCIIHex) {
     str = new ASCIIHexEncoder(str);
   } else {
     str = new ASCII85Encoder(str);
@@ -2917,23 +2925,23 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
     do {
       c = str->getChar();
     } while (c == '\n' || c == '\r');
-    if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
+    if (c == (doUseASCIIHex ? '>' : '~') || c == EOF) {
       break;
     }
     if (c == 'z') {
       ++col;
     } else {
       ++col;
-      for (i = 1; i <= (useASCIIHex ? 1 : 4); ++i) {
+      for (i = 1; i <= (doUseASCIIHex ? 1 : 4); ++i) {
 	do {
 	  c = str->getChar();
 	} while (c == '\n' || c == '\r');
-	if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
+	if (c == (doUseASCIIHex ? '>' : '~') || c == EOF) {
 	  break;
 	}
 	++col;
       }
-      if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
+      if (c == (doUseASCIIHex ? '>' : '~') || c == EOF) {
 	break;
       }
     }
@@ -2941,7 +2949,7 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
       ++size;
       col = 0;
     }
-  } while (c != (useASCIIHex ? '>' : '~') && c != EOF);
+  } while (c != (doUseASCIIHex ? '>' : '~') && c != EOF);
   // add one entry for the final line of data; add another entry
   // because the RunLengthDecode filter may read past the end
   ++size;
@@ -2963,12 +2971,12 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
     writePSFmt("{0:d} array 1 index {1:d} 2 index put\n",
 	       innerSize, outer);
     line = col = 0;
-    writePS((char *)(useASCIIHex ? "dup 0 <" : "dup 0 <~"));
+    writePS((char *)(doUseASCIIHex ? "dup 0 <" : "dup 0 <~"));
     for (;;) {
       do {
 	c = str->getChar();
       } while (c == '\n' || c == '\r');
-      if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
+      if (c == (doUseASCIIHex ? '>' : '~') || c == EOF) {
 	break;
       }
       if (c == 'z') {
@@ -2977,18 +2985,18 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
       } else {
 	writePSChar(c);
 	++col;
-	for (i = 1; i <= (useASCIIHex ? 1 : 4); ++i) {
+	for (i = 1; i <= (doUseASCIIHex ? 1 : 4); ++i) {
 	  do {
 	    c = str->getChar();
 	  } while (c == '\n' || c == '\r');
-	  if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
+	  if (c == (doUseASCIIHex ? '>' : '~') || c == EOF) {
 	    break;
 	  }
 	  writePSChar(c);
 	  ++col;
 	}
       }
-      if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
+      if (c == (doUseASCIIHex ? '>' : '~') || c == EOF) {
 	break;
       }
       // each line is: "dup nnnnn <~...data...~> put<eol>"
@@ -2996,15 +3004,15 @@ void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
       // chunks are 1 or 4 bytes each, so we have to stop at 232
       // but make it 225 just to be safe
       if (col > 225) {
-	writePS((char *)(useASCIIHex ? "> put\n" : "~> put\n"));
+	writePS((char *)(doUseASCIIHex ? "> put\n" : "~> put\n"));
 	++line;
 	if (line >= innerSize) break;
-	writePSFmt((char *)(useASCIIHex ? "dup {0:d} <" : "dup {0:d} <~"), line);
+	writePSFmt((char *)(doUseASCIIHex ? "dup {0:d} <" : "dup {0:d} <~"), line);
 	col = 0;
       }
     }
-    if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
-      writePS((char *)(useASCIIHex ? "> put\n" : "~> put\n"));
+    if (c == (doUseASCIIHex ? '>' : '~') || c == EOF) {
+      writePS((char *)(doUseASCIIHex ? "> put\n" : "~> put\n"));
       if (useRLE) {
 	++line;
 	writePSFmt("{0:d} <> put\n", line);
@@ -3026,7 +3034,7 @@ void PSOutputDev::setupForms(Dict *resDict) {
   Object xObjDict, xObj, xObjRef, subtypeObj;
   int i;
 
-  if (!preload) {
+  if (!preloadImagesForms) {
     return;
   }
 
@@ -3163,7 +3171,6 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
 #endif
   char hexBuf[32*2 + 2];	// 32 values X 2 chars/value + line ending + null
   Guchar digit;
-  GBool useBinary;
   GBool isGray;
 
   if (forceRasterize) {
@@ -3265,7 +3272,6 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
 	       m0, m1, m2, m3, m4, m5);
     switch (level) {
     case psLevel1:
-      useBinary = globalParams->getPSBinary();
       writePSFmt("{0:d} {1:d} 8 [{2:d} 0 0 {3:d} 0 {4:d}] pdfIm1{5:s}\n",
 		 w, h, w, -h, h,
 		 useBinary ? "Bin" : "");
@@ -3304,7 +3310,6 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
       }
       break;
     case psLevel1Sep:
-      useBinary = globalParams->getPSBinary();
       p = bitmap->getDataPtr();
       // Check for an all gray image
       isGray = gTrue;
@@ -3517,10 +3522,9 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
 	writePS("  /Decode [0 1 0 1 0 1 0 1]\n");
       }
       writePS("  /DataSource currentfile\n");
-      useBinary = globalParams->getPSBinary();
       if (useBinary) {
 	/* nothing to do */;
-      } else if (globalParams->getPSASCIIHex()) {
+      } else if (useASCIIHex) {
 	writePS("    /ASCIIHexDecode filter\n");
       } else {
 	writePS("    /ASCII85Decode filter\n");
@@ -3529,7 +3533,7 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/,
       writePS(">>\n");
       if (useBinary) {
 	/* nothing to do */;
-      } else if (globalParams->getPSASCIIHex()) {
+      } else if (useASCIIHex) {
 	str = new ASCIIHexEncoder(str);
       } else {
 	str = new ASCII85Encoder(str);
@@ -5140,14 +5144,13 @@ void PSOutputDev::doImageL1(Object *ref, GfxImageColorMap *colorMap,
   int col, x, y, c, i;
   char hexBuf[32*2 + 2];	// 32 values X 2 chars/value + line ending + null
   Guchar digit, grayValue;
-  const GBool useBinary = globalParams->getPSBinary();
 
   // explicit masking
   if (maskStr && !(maskColors && colorMap)) {
     maskToClippingPath(maskStr, maskWidth, maskHeight, maskInvert);
   }
 
-  if ((inType3Char || preload) && !colorMap) {
+  if ((inType3Char || preloadImagesForms) && !colorMap) {
     if (inlineImg) {
       // create an array
       str = new FixedLengthEncoder(str, len);
@@ -5186,7 +5189,7 @@ void PSOutputDev::doImageL1(Object *ref, GfxImageColorMap *colorMap,
   }
 
   // image/imagemask command
-  if ((inType3Char || preload) && !colorMap) {
+  if ((inType3Char || preloadImagesForms) && !colorMap) {
     writePSFmt("{0:d} {1:d} {2:s} [{3:d} 0 0 {4:d} 0 {5:d}] pdfImM1a\n",
 	       width, height, invert ? "true" : "false",
 	       width, -height, height);
@@ -5203,7 +5206,7 @@ void PSOutputDev::doImageL1(Object *ref, GfxImageColorMap *colorMap,
   }
 
   // image data
-  if (!((inType3Char || preload) && !colorMap)) {
+  if (!((inType3Char || preloadImagesForms) && !colorMap)) {
 
     if (colorMap) {
 
@@ -5299,7 +5302,6 @@ void PSOutputDev::doImageL1Sep(Object *ref, GfxImageColorMap *colorMap,
   GBool checkProcessColor;
   char hexBuf[32*2 + 2];	// 32 values X 2 chars/value + line ending + null
   Guchar digit;
-  const GBool useBinary = globalParams->getPSBinary();
 
   // explicit masking
   if (maskStr && !(maskColors && colorMap)) {
@@ -5526,7 +5528,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
   GBool emitRect, addRect, extendRect;
   GooString *s;
   int n, numComps;
-  GBool useRLE, useASCII, useASCIIHex, useCompressed;
+  GBool useRLE, useASCII, useCompressed;
   GfxSeparationColorSpace *sepCS;
   GfxColor color;
   GfxCMYK cmyk;
@@ -5705,10 +5707,8 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
     writePS(" setcolorspace\n");
   }
 
-  useASCIIHex = globalParams->getPSASCIIHex();
-
   // set up the image data
-  if (mode == psModeForm || inType3Char || preload) {
+  if (mode == psModeForm || inType3Char || preloadImagesForms) {
     if (inlineImg) {
       // create an array
       str2 = new FixedLengthEncoder(str, len);
@@ -5818,7 +5818,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
   }
 
   // data source
-  if (mode == psModeForm || inType3Char || preload) {
+  if (mode == psModeForm || inType3Char || preloadImagesForms) {
     if (inlineImg) {
       writePS("  /DataSource { pdfImStr }\n");
     } else {
@@ -5830,7 +5830,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
   }
 
   // filters
-  if ((mode == psModeForm || inType3Char || preload) &&
+  if ((mode == psModeForm || inType3Char || preloadImagesForms) &&
       uncompressPreloadedImages) {
     s = NULL;
     useRLE = gFalse;
@@ -5842,12 +5842,12 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
     if ((colorMap && colorMap->getColorSpace()->getMode() == csDeviceN) ||
 	inlineImg || !s) {
       useRLE = gTrue;
-      useASCII = !(mode == psModeForm || inType3Char || preload);
+      useASCII = !(mode == psModeForm || inType3Char || preloadImagesForms);
       useCompressed = gFalse;
     } else {
       useRLE = gFalse;
       useASCII = str->isBinary() &&
-	         !(mode == psModeForm || inType3Char || preload);
+	         !(mode == psModeForm || inType3Char || preloadImagesForms);
       useCompressed = gTrue;
     }
   }
@@ -5865,7 +5865,7 @@ void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
     delete s;
   }
 
-  if (mode == psModeForm || inType3Char || preload) {
+  if (mode == psModeForm || inType3Char || preloadImagesForms) {
 
     // end of image dictionary
     writePSFmt(">>\n{0:s}\n", colorMap ? "image" : "imagemask");
@@ -5985,7 +5985,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
   Stream *str2;
   GooString *s;
   int n, numComps;
-  GBool useRLE, useASCII, useASCIIHex, useCompressed;
+  GBool useRLE, useASCII, useCompressed;
   GBool maskUseRLE, maskUseASCII, maskUseCompressed;
   GooString *maskFilters;
   GfxSeparationColorSpace *sepCS;
@@ -5994,7 +5994,6 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
   int c;
   int col, i;
 
-  useASCIIHex = globalParams->getPSASCIIHex();
   useRLE = useASCII = useCompressed = gFalse; // make gcc happy
   maskUseRLE = maskUseASCII = maskUseCompressed = gFalse; // make gcc happy
   maskFilters = NULL; // make gcc happy
@@ -6003,7 +6002,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
   if (maskStr) {
 
     // mask data source
-    if ((mode == psModeForm || inType3Char || preload) &&
+    if ((mode == psModeForm || inType3Char || preloadImagesForms) &&
       uncompressPreloadedImages) {
       s = NULL;
       maskUseRLE = gFalse;
@@ -6013,12 +6012,12 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
       s = maskStr->getPSFilter(3, "  ");
       if (!s) {
 	maskUseRLE = gTrue;
-	maskUseASCII = !(mode == psModeForm || inType3Char || preload);
+	maskUseASCII = !(mode == psModeForm || inType3Char || preloadImagesForms);
 	maskUseCompressed = gFalse;
       } else {
 	maskUseRLE = gFalse;
 	maskUseASCII = maskStr->isBinary() &&
-	               !(mode == psModeForm || inType3Char || preload);
+	               !(mode == psModeForm || inType3Char || preloadImagesForms);
 	maskUseCompressed = gTrue;
       }
     }
@@ -6036,7 +6035,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
     if (s) {
       delete s;
     }
-    if (mode == psModeForm || inType3Char || preload) {
+    if (mode == psModeForm || inType3Char || preloadImagesForms) {
       writePSFmt("MaskData_{0:d}_{1:d} pdfMaskInit\n",
 		 ref->getRefNum(), ref->getRefGen());
     } else {
@@ -6082,7 +6081,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
   }
 
   // set up the image data
-  if (mode == psModeForm || inType3Char || preload) {
+  if (mode == psModeForm || inType3Char || preloadImagesForms) {
     if (inlineImg) {
       // create an array
       str2 = new FixedLengthEncoder(str, len);
@@ -6200,7 +6199,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
   }
 
   // data source
-  if (mode == psModeForm || inType3Char || preload) {
+  if (mode == psModeForm || inType3Char || preloadImagesForms) {
     if (inlineImg) {
   writePS("  /DataSource { pdfImStr }\n");
     } else {
@@ -6212,7 +6211,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
   }
 
   // filters
-  if ((mode == psModeForm || inType3Char || preload) &&
+  if ((mode == psModeForm || inType3Char || preloadImagesForms) &&
       uncompressPreloadedImages) {
     s = NULL;
     useRLE = gFalse;
@@ -6224,12 +6223,12 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
     if ((colorMap && colorMap->getColorSpace()->getMode() == csDeviceN) ||
 	inlineImg || !s) {
       useRLE = gTrue;
-      useASCII = !(mode == psModeForm || inType3Char || preload);
+      useASCII = !(mode == psModeForm || inType3Char || preloadImagesForms);
       useCompressed = gFalse;
     } else {
       useRLE = gFalse;
       useASCII = str->isBinary() &&
-                 !(mode == psModeForm || inType3Char || preload);
+                 !(mode == psModeForm || inType3Char || preloadImagesForms);
       useCompressed = gTrue;
     }
   }
@@ -6264,7 +6263,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
 	       maskInvert ? 1 : 0, maskInvert ? 0 : 1);
 
     // mask data source
-    if (mode == psModeForm || inType3Char || preload) {
+    if (mode == psModeForm || inType3Char || preloadImagesForms) {
       writePS("  /DataSource {pdfMaskSrc}\n");
       writePS(maskFilters->getCString());
     } else {
@@ -6276,7 +6275,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
     writePS(">>\n");
   }
 
-  if (mode == psModeForm || inType3Char || preload) {
+  if (mode == psModeForm || inType3Char || preloadImagesForms) {
 
     // image command
     writePSFmt("{0:s}\n", colorMap ? "image" : "imagemask");
@@ -6299,7 +6298,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
   }
 
   // get rid of the array and index
-  if (mode == psModeForm || inType3Char || preload) {
+  if (mode == psModeForm || inType3Char || preloadImagesForms) {
     if (!inlineImg) writePS("pop ");
     writePS("pop pop\n");
 
@@ -6344,7 +6343,7 @@ void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
 
   // close the mask stream
   if (maskStr) {
-    if (!(mode == psModeForm || inType3Char || preload)) {
+    if (!(mode == psModeForm || inType3Char || preloadImagesForms)) {
       writePS("pdfMaskEnd\n");
     }
   }
@@ -6626,7 +6625,7 @@ void PSOutputDev::dumpColorSpaceL2(GfxColorSpace *colorSpace,
 void PSOutputDev::opiBegin(GfxState *state, Dict *opiDict) {
   Object dict;
 
-  if (globalParams->getPSOPI()) {
+  if (generateOPI) {
     opiDict->lookup("2.0", &dict);
     if (dict.isDict()) {
       opiBegin20(state, dict.getDict());
@@ -6999,7 +6998,7 @@ void PSOutputDev::opiTransform(GfxState *state, double x0, double y0,
 void PSOutputDev::opiEnd(GfxState *state, Dict *opiDict) {
   Object dict;
 
-  if (globalParams->getPSOPI()) {
+  if (generateOPI) {
     opiDict->lookup("2.0", &dict);
     if (dict.isDict()) {
       writePS("%%EndIncludedImage\n");
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 46f065c..128ff7c 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -45,6 +45,7 @@
 #include "OutputDev.h"
 #include <set>
 #include <map>
+#include <vector>
 
 class GHooash;
 class PDFDoc;
@@ -151,7 +152,7 @@ public:
 
   // Does this device use drawForm()?  If this returns false,
   // form-type XObjects will be interpreted (i.e., unrolled).
-  virtual GBool useDrawForm() { return preload; }
+  virtual GBool useDrawForm() { return preloadImagesForms; }
 
   // Does this device use beginType3Char/endType3Char?  Otherwise,
   // text in Type 3 fonts will be drawn with drawChar/drawString.
@@ -313,6 +314,21 @@ public:
   void setRasterMono(GBool b) { rasterMono = b; }
   void setUncompressPreloadedImages(GBool b) { uncompressPreloadedImages = b; }
 
+  GBool getEmbedType1() const { return embedType1; }
+  GBool getEmbedTrueType() const { return embedTrueType; }
+  GBool getEmbedCIDPostScript() const { return embedCIDPostScript; }
+  GBool getEmbedCIDTrueType() const { return embedCIDTrueType; }
+  GBool getFontPassthrough() const { return fontPassthrough; }
+  void setEmbedType1(GBool b) { embedType1 = b; }
+  void setEmbedTrueType(GBool b) { embedTrueType = b; }
+  void setEmbedCIDPostScript(GBool b) { embedCIDPostScript = b; }
+  void setEmbedCIDTrueType(GBool b) { embedCIDTrueType = b; }
+  void setFontPassthrough(GBool b) { fontPassthrough = b; }
+  void setPreloadImagesForms(GBool b) { preloadImagesForms = b; }
+  void setGenerateOPI(GBool b) { generateOPI = b; }
+  void setUseASCIIHex(GBool b) { useASCIIHex = b; }
+  void setUseBinary(GBool b) { useBinary = b; }
+
 private:
 
   void init(PSOutputFunc outputFuncA, void *outputStreamA,
@@ -415,8 +431,6 @@ private:
                                 // (only psModePSOrigPageSizes output mode)
   int imgLLX, imgLLY,		// imageable area, in pts
       imgURX, imgURY;
-  GBool preload;		// load all images into memory, and
-				//   predefine forms
   GBool noCrop;
 
   PSOutputFunc outputFunc;
@@ -499,6 +513,16 @@ private:
   GBool rasterMono;		// true to do PostScript rasterization
 				//   in monochrome (gray); false to do it
 				//   in color (RGB/CMYK)
+  GBool embedType1;		// embed Type 1 fonts?
+  GBool embedTrueType;		// embed TrueType fonts?
+  GBool embedCIDPostScript;	// embed CID PostScript fonts?
+  GBool embedCIDTrueType;	// embed CID TrueType fonts?
+  GBool fontPassthrough;	// pass all fonts through as-is?
+  GBool preloadImagesForms;	// preload PostScript images and forms into
+				//   memory
+  GBool generateOPI;		// generate PostScript OPI comments?
+  GBool useASCIIHex;		// use ASCIIHex instead of ASCII85?
+  GBool useBinary;		// use binary instead of hex
 
 #if OPI_SUPPORT
   int opi13Nest;		// nesting level of OPI 1.3 objects
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index b96232f..97af5c4 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -1893,7 +1893,7 @@ void SplashOutputDev::doUpdateFont(GfxState *state) {
 
   } else {
 
-    if (!(fontLoc = gfxFont->locateFont((xref) ? xref : doc->getXRef(), gFalse))) {
+    if (!(fontLoc = gfxFont->locateFont((xref) ? xref : doc->getXRef(), NULL))) {
       error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",
 	    gfxFont->getName() ? gfxFont->getName()->getCString()
 	                       : "(unnamed)");
diff --git a/qt4/src/ArthurOutputDev.cc b/qt4/src/ArthurOutputDev.cc
index 05c95ba..7e80b4a 100644
--- a/qt4/src/ArthurOutputDev.cc
+++ b/qt4/src/ArthurOutputDev.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Brad Hards <bradh at frogmouth.net>
-// Copyright (C) 2005-2009, 2011, 2012, 2014 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2009, 2011, 2012, 2014, 2015 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008, 2010 Pino Toscano <pino at kde.org>
 // Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
@@ -309,7 +309,7 @@ void ArthurOutputDev::updateFont(GfxState *state)
 
   } else {
 
-    if (!(fontLoc = gfxFont->locateFont(xref, gFalse))) {
+    if (!(fontLoc = gfxFont->locateFont(xref, NULL))) {
       error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",
 	    gfxFont->getName() ? gfxFont->getName()->getCString()
 	                       : "(unnamed)");
diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc
index 05c95ba..7e80b4a 100644
--- a/qt5/src/ArthurOutputDev.cc
+++ b/qt5/src/ArthurOutputDev.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Brad Hards <bradh at frogmouth.net>
-// Copyright (C) 2005-2009, 2011, 2012, 2014 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2009, 2011, 2012, 2014, 2015 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008, 2010 Pino Toscano <pino at kde.org>
 // Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009 Petr Gajdos <pgajdos at novell.com>
@@ -309,7 +309,7 @@ void ArthurOutputDev::updateFont(GfxState *state)
 
   } else {
 
-    if (!(fontLoc = gfxFont->locateFont(xref, gFalse))) {
+    if (!(fontLoc = gfxFont->locateFont(xref, NULL))) {
       error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",
 	    gfxFont->getName() ? gfxFont->getName()->getCString()
 	                       : "(unnamed)");
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index 391ec04..b85d96e 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -297,32 +297,6 @@ int main(int argc, char *argv[]) {
   if (level1 || level1Sep || level2 || level2Sep || level3 || level3Sep) {
     globalParams->setPSLevel(level);
   }
-  if (noEmbedT1Fonts) {
-    globalParams->setPSEmbedType1(!noEmbedT1Fonts);
-  }
-  if (noEmbedTTFonts) {
-    globalParams->setPSEmbedTrueType(!noEmbedTTFonts);
-  }
-  if (noEmbedCIDPSFonts) {
-    globalParams->setPSEmbedCIDPostScript(!noEmbedCIDPSFonts);
-  }
-  if (noEmbedCIDTTFonts) {
-    globalParams->setPSEmbedCIDTrueType(!noEmbedCIDTTFonts);
-  }
-  if (fontPassthrough) {
-    globalParams->setPSFontPassthrough(fontPassthrough);
-  }
-  if (preload) {
-    globalParams->setPSPreload(preload);
-  }
-#if OPI_SUPPORT
-  if (doOPI) {
-    globalParams->setPSOPI(doOPI);
-  }
-#endif
-  if (psBinary) {
-    globalParams->setPSBinary(psBinary);
-  }
   if (quiet) {
     globalParams->setErrQuiet(quiet);
   }
@@ -423,6 +397,16 @@ int main(int argc, char *argv[]) {
   if (splashResolution > 0) {
     psOut->setRasterResolution(splashResolution);
   }
+  psOut->setEmbedType1(!noEmbedT1Fonts);
+  psOut->setEmbedTrueType(!noEmbedTTFonts);
+  psOut->setEmbedCIDPostScript(!noEmbedCIDPSFonts);
+  psOut->setEmbedCIDTrueType(!noEmbedCIDTTFonts);
+  psOut->setFontPassthrough(fontPassthrough);
+  psOut->setPreloadImagesForms(preload);
+#if OPI_SUPPORT
+  psOut->setGenerateOPI(doOPI);
+#endif
+  psOut->setUseBinary(psBinary);
 
   psOut->setRasterAntialias(rasterAntialias);
   if (psOut->isOk()) {
commit 8fed995c3457d64669ae12901450b7c811599dba
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Jan 18 14:52:53 2015 +0100

    Forgot to delete this in the previous commit

diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 98d2bad..3419622 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -175,7 +175,6 @@ public:
   GBool getPSOPI();
   GBool getPSASCIIHex();
   GBool getPSBinary();
-  GBool getPSRasterMono();
   GooString *getTextEncodingName();
   EndOfLineKind getTextEOL();
   GBool getTextPageBreaks();


More information about the poppler mailing list