[poppler] 6 commits - poppler/GfxFont.cc poppler/GlobalParams.cc poppler/GlobalParams.h poppler/GlobalParamsWin.cc poppler/PSOutputDev.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Fri Sep 22 16:19:09 UTC 2017


 poppler/GfxFont.cc         |   48 ---------------
 poppler/GlobalParams.cc    |  143 ---------------------------------------------
 poppler/GlobalParams.h     |   36 -----------
 poppler/GlobalParamsWin.cc |    2 
 poppler/PSOutputDev.cc     |    6 -
 5 files changed, 2 insertions(+), 233 deletions(-)

New commits:
commit 2afde7084ab55893182c2da59c429b48eb5d5a35
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Sep 22 18:18:54 2017 +0200

    Remove GlobalParams::splashResolution
    
    Noone was setting or getting the variable

diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 8114b2e9..16dc7a4a 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -275,7 +275,6 @@ private:
   GBool printCommands;		// print the drawing commands
   GBool profileCommands;	// profile the drawing commands
   GBool errQuiet;		// suppress error messages?
-  double splashResolution;	// resolution when rasterizing images
 
   CharCodeToUnicodeCache *cidToUnicodeCache;
   CharCodeToUnicodeCache *unicodeToUnicodeCache;
commit df783c5d10490e94e911316a6f42bb2d91a22dea
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Sep 22 18:18:50 2017 +0200

    Add a const to the static structure

diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index 1dc3d4ab..eba72fa0 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -78,7 +78,7 @@ description for all fonts available in Windows. That's how MuPDF works.
 #define DEFAULT_CID_FONT_AK1_MSWIN "Batang"    /* Adobe-Korea1 */
 #define DEFAULT_CID_FONT_MSWIN "ArialUnicode"  /* Unknown */
 
-static struct {
+static const struct {
     const char *name;
     const char *t1FileName;
     const char *ttFileName;
commit a309cbfdd831b37461284b95763ca5a872e6af2b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Sep 22 18:18:46 2017 +0200

    Remove GlobalParams::setPSFile
    
    It had a setter but not a getter so wasn't used for anything

diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 5c355daf..2f8717ae 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -574,7 +574,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
   psShrinkLarger = gTrue;
   psCenter = gTrue;
   psLevel = psLevel2;
-  psFile = NULL;
   textEncoding = new GooString("UTF-8");
 #if defined(_WIN32)
   textEOL = eolDOS;
@@ -777,9 +776,6 @@ GlobalParams::~GlobalParams() {
   deleteGooHash(substFiles, GooString);
 #endif
   delete sysFonts;
-  if (psFile) {
-    delete psFile;
-  }
   delete textEncoding;
 
   GooHashIter *iter;
@@ -1663,15 +1659,6 @@ void GlobalParams::addFontFile(GooString *fontName, GooString *path) {
   unlockGlobalParams;
 }
 
-void GlobalParams::setPSFile(char *file) {
-  lockGlobalParams;
-  if (psFile) {
-    delete psFile;
-  }
-  psFile = new GooString(file);
-  unlockGlobalParams;
-}
-
 void GlobalParams::setPSExpandSmaller(GBool expand) {
   lockGlobalParams;
   psExpandSmaller = expand;
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index cd712e72..8114b2e9 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -177,7 +177,6 @@ public:
 
   //----- functions to set parameters
   void addFontFile(GooString *fontName, GooString *path);
-  void setPSFile(char *file);
   void setPSExpandSmaller(GBool expand);
   void setPSShrinkLarger(GBool shrink);
   void setPSCenter(GBool center);
@@ -250,7 +249,6 @@ private:
   GooHash *fontFiles;		// font files: font name mapped to path
 				//   [GString]
   SysFontList *sysFonts;	// system fonts
-  GooString *psFile;		// PostScript file or command (for xpdf)
   GBool psExpandSmaller;	// expand smaller pages to fill paper
   GBool psShrinkLarger;		// shrink larger pages to fit paper
   GBool psCenter;		// center pages on the paper
commit 7af5f7cadbdb89e0eaab148940c2c65cb12cc6d6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Sep 22 18:18:42 2017 +0200

    Remove GlobalParams::ccFontFiles
    
    it was never filled so it was basically a noop

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 713cec74..04431b3c 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -756,16 +756,6 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) {
     return NULL;
   }
 
-  //----- CID font substitution
-  if ((path = globalParams->findCCFontFile(
-				((GfxCIDFont *)this)->getCollection()))) {
-    if ((fontLoc = getExternalFont(path, gTrue))) {
-      error(errSyntaxWarning, -1, "Substituting font '{0:t}' for '{1:t}'",
-	    fontLoc->path, name);
-      return fontLoc;
-    }
-  }
-
   // failed to find a substitute font
   return NULL;
 }
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 110f4a64..5c355daf 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -569,7 +569,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
   cMapDirs = new GooHash(gTrue);
   toUnicodeDirs = new GooList();
   fontFiles = new GooHash(gTrue);
-  ccFontFiles = new GooHash(gTrue);
   sysFonts = new SysFontList();
   psExpandSmaller = gFalse;
   psShrinkLarger = gTrue;
@@ -774,7 +773,6 @@ GlobalParams::~GlobalParams() {
   deleteGooHash(unicodeMaps, GooString);
   deleteGooList(toUnicodeDirs, GooString);
   deleteGooHash(fontFiles, GooString);
-  deleteGooHash(ccFontFiles, GooString);
 #ifdef _WIN32
   deleteGooHash(substFiles, GooString);
 #endif
@@ -1372,18 +1370,6 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
 }
 #endif
 
-GooString *GlobalParams::findCCFontFile(GooString *collection) {
-  GooString *path;
-
-  lockGlobalParams;
-  if ((path = (GooString *)ccFontFiles->lookup(collection))) {
-    path = path->copy();
-  }
-  unlockGlobalParams;
-  return path;
-}
-
-
 GBool GlobalParams::getPSExpandSmaller() {
   GBool f;
 
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 238b4f8d..cd712e72 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -140,7 +140,6 @@ public:
   GooString *findSystemFontFile(GfxFont *font, SysFontType *type,
 			      int *fontNum, GooString *substituteFontName = NULL, 
 		              GooString *base14Name = NULL);
-  GooString *findCCFontFile(GooString *collection);
   GBool getPSExpandSmaller();
   GBool getPSShrinkLarger();
   GBool getPSCenter();
@@ -250,8 +249,6 @@ private:
 #endif
   GooHash *fontFiles;		// font files: font name mapped to path
 				//   [GString]
-  GooHash *ccFontFiles;	// character collection font files:
-				//   collection name  mapped to path [GString]
   SysFontList *sysFonts;	// system fonts
   GooString *psFile;		// PostScript file or command (for xpdf)
   GBool psExpandSmaller;	// expand smaller pages to fill paper
commit b5f8be7ede64e55d44ed484797a66ca068ba955f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Sep 22 18:18:39 2017 +0200

    Remove GlobalParams::fontDirs
    
    It was only read but never filled so it was basically a noop

diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 58a00ab9..110f4a64 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -569,7 +569,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
   cMapDirs = new GooHash(gTrue);
   toUnicodeDirs = new GooList();
   fontFiles = new GooHash(gTrue);
-  fontDirs = new GooList();
   ccFontFiles = new GooHash(gTrue);
   sysFonts = new SysFontList();
   psExpandSmaller = gFalse;
@@ -775,7 +774,6 @@ GlobalParams::~GlobalParams() {
   deleteGooHash(unicodeMaps, GooString);
   deleteGooList(toUnicodeDirs, GooString);
   deleteGooHash(fontFiles, GooString);
-  deleteGooList(fontDirs, GooString);
   deleteGooHash(ccFontFiles, GooString);
 #ifdef _WIN32
   deleteGooHash(substFiles, GooString);
@@ -1081,14 +1079,7 @@ static FcPattern *buildFcPattern(GfxFont *font, GooString *base14Name)
 #endif
 
 GooString *GlobalParams::findFontFile(GooString *fontName) {
-  static const char *exts[] = { ".pfa", ".pfb", ".ttf", ".ttc", ".otf" };
-  GooString *path, *dir;
-#ifdef WIN32
-  GooString *fontNameU;
-#endif
-  const char *ext;
-  FILE *f;
-  int i, j;
+  GooString *path;
 
   setupBaseFonts(NULL);
   lockGlobalParams;
@@ -1097,26 +1088,6 @@ GooString *GlobalParams::findFontFile(GooString *fontName) {
     unlockGlobalParams;
     return path;
   }
-  for (i = 0; i < fontDirs->getLength(); ++i) {
-    dir = (GooString *)fontDirs->get(i);
-    for (j = 0; j < (int)(sizeof(exts) / sizeof(exts[0])); ++j) {
-      ext = exts[j];
-#ifdef WIN32
-      fontNameU = fileNameToUTF8(fontName->getCString());
-      path = appendToPath(dir->copy(), fontNameU->getCString());
-      delete fontNameU;
-#else
-      path = appendToPath(dir->copy(), fontName->getCString());
-#endif
-      path->append(ext);
-      if ((f = openFile(path->getCString(), "rb"))) {
-	fclose(f);
-	unlockGlobalParams;
-	return path;
-      }
-      delete path;
-    }
-  }
   unlockGlobalParams;
   return NULL;
 }
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index ffc5378e..238b4f8d 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -250,7 +250,6 @@ private:
 #endif
   GooHash *fontFiles;		// font files: font name mapped to path
 				//   [GString]
-  GooList *fontDirs;		// list of font dirs [GString]
   GooHash *ccFontFiles;	// character collection font files:
 				//   collection name  mapped to path [GString]
   SysFontList *sysFonts;	// system fonts
commit 3463537624a24e3bdcaa42c135d337c6cd452ea5
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Sep 22 18:18:22 2017 +0200

    Remove GlobalParams::getPSResidentFont*
    
    There was no way to set its contents so it's basically a noop

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 1c3d0b25..713cec74 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -594,7 +594,6 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) {
   GfxFontLoc *fontLoc;
   SysFontType sysFontType;
   GooString *path, *base14Name, *substName;
-  PSFontParam16 *psFont16;
   int substIdx, fontNum;
   GBool embed;
 
@@ -715,17 +714,6 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) {
 
   if (!isCIDFont()) {
 
-    //----- 8-bit PS resident font
-    if (name && ps) {
-      if ((path = globalParams->getPSResidentFont(name))) {
-	fontLoc = new GfxFontLoc();
-	fontLoc->locType = gfxFontLocResident;
-	fontLoc->fontType = fontType1;
-	fontLoc->path = path;
-	return fontLoc;
-      }
-    }
-
     //----- 8-bit font substitution
     if (flags & fontFixedWidth) {
       substIdx = 0;
@@ -768,32 +756,6 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) {
     return NULL;
   }
 
-  //----- 16-bit PS resident font
-  if (ps && ((psFont16 = globalParams->getPSResidentFont16(
-					 name,
-					 ((GfxCIDFont *)this)->getWMode())))) {
-    fontLoc = new GfxFontLoc();
-    fontLoc->locType = gfxFontLocResident;
-    fontLoc->fontType = fontCIDType0; // this is not used
-    fontLoc->path = psFont16->psFontName->copy();
-    fontLoc->encoding = psFont16->encoding->copy();
-    fontLoc->wMode = psFont16->wMode;
-    return fontLoc;
-  }
-  if (ps && ((psFont16 = globalParams->getPSResidentFontCC(
-				 ((GfxCIDFont *)this)->getCollection(),
-				 ((GfxCIDFont *)this)->getWMode())))) {
-    error(errSyntaxWarning, -1, "Substituting font '{0:t}' for '{1:t}'",
-	  psFont16->psFontName, name);
-    fontLoc = new GfxFontLoc();
-    fontLoc->locType = gfxFontLocResident;
-    fontLoc->fontType = fontCIDType0; // this is not used
-    fontLoc->path = psFont16->psFontName->copy();
-    fontLoc->encoding = psFont16->encoding->copy();
-    fontLoc->wMode = psFont16->wMode;
-    return fontLoc;
-  }
-
   //----- CID font substitution
   if ((path = globalParams->findCCFontFile(
 				((GfxCIDFont *)this)->getCollection()))) {
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 10830944..58a00ab9 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -127,24 +127,6 @@ extern XpdfPluginVecTable xpdfPluginVecTable;
 
 GlobalParams *globalParams = NULL;
 
-//------------------------------------------------------------------------
-// PSFontParam16
-//------------------------------------------------------------------------
-
-PSFontParam16::PSFontParam16(GooString *nameA, int wModeA,
-			     GooString *psFontNameA, GooString *encodingA) {
-  name = nameA;
-  wMode = wModeA;
-  psFontName = psFontNameA;
-  encoding = encodingA;
-}
-
-PSFontParam16::~PSFontParam16() {
-  delete name;
-  delete psFontName;
-  delete encoding;
-}
-
 #if ENABLE_RELOCATABLE && defined(_WIN32)
 
 /* search for data relative to where we are installed */
@@ -595,9 +577,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
   psCenter = gTrue;
   psLevel = psLevel2;
   psFile = NULL;
-  psResidentFonts = new GooHash(gTrue);
-  psResidentFonts16 = new GooList();
-  psResidentFontsCC = new GooList();
   textEncoding = new GooString("UTF-8");
 #if defined(_WIN32)
   textEOL = eolDOS;
@@ -805,9 +784,6 @@ GlobalParams::~GlobalParams() {
   if (psFile) {
     delete psFile;
   }
-  deleteGooHash(psResidentFonts, GooString);
-  deleteGooList(psResidentFonts16, PSFontParam16);
-  deleteGooList(psResidentFontsCC, PSFontParam16);
   delete textEncoding;
 
   GooHashIter *iter;
@@ -1473,67 +1449,6 @@ PSLevel GlobalParams::getPSLevel() {
   return level;
 }
 
-GooString *GlobalParams::getPSResidentFont(GooString *fontName) {
-  GooString *psName;
-
-  lockGlobalParams;
-  psName = (GooString *)psResidentFonts->lookup(fontName);
-  unlockGlobalParams;
-  return psName;
-}
-
-GooList *GlobalParams::getPSResidentFonts() {
-  GooList *names;
-  GooHashIter *iter;
-  GooString *name;
-  GooString *psName;
-
-  names = new GooList();
-  lockGlobalParams;
-  psResidentFonts->startIter(&iter);
-  while (psResidentFonts->getNext(&iter, &name, (void **)&psName)) {
-    names->append(psName->copy());
-  }
-  unlockGlobalParams;
-  return names;
-}
-
-PSFontParam16 *GlobalParams::getPSResidentFont16(GooString *fontName,
-						 int wMode) {
-  PSFontParam16 *p;
-  int i;
-
-  lockGlobalParams;
-  p = NULL;
-  for (i = 0; i < psResidentFonts16->getLength(); ++i) {
-    p = (PSFontParam16 *)psResidentFonts16->get(i);
-    if (!(p->name->cmp(fontName)) && p->wMode == wMode) {
-      break;
-    }
-    p = NULL;
-  }
-  unlockGlobalParams;
-  return p;
-}
-
-PSFontParam16 *GlobalParams::getPSResidentFontCC(GooString *collection,
-						 int wMode) {
-  PSFontParam16 *p;
-  int i;
-
-  lockGlobalParams;
-  p = NULL;
-  for (i = 0; i < psResidentFontsCC->getLength(); ++i) {
-    p = (PSFontParam16 *)psResidentFontsCC->get(i);
-    if (!(p->name->cmp(collection)) && p->wMode == wMode) {
-      break;
-    }
-    p = NULL;
-  }
-  unlockGlobalParams;
-  return p;
-}
-
 GooString *GlobalParams::getTextEncodingName() {
   GooString *s;
 
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 1a65085f..ffc5378e 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -81,22 +81,6 @@ enum SysFontType {
 
 //------------------------------------------------------------------------
 
-class PSFontParam16 {
-public:
-
-  GooString *name;		// PDF font name for psResidentFont16;
-				//   char collection name for psResidentFontCC
-  int wMode;			// writing mode (0=horiz, 1=vert)
-  GooString *psFontName;		// PostScript font name
-  GooString *encoding;		// encoding
-
-  PSFontParam16(GooString *nameA, int wModeA,
-		GooString *psFontNameA, GooString *encodingA);
-  ~PSFontParam16();
-};
-
-//------------------------------------------------------------------------
-
 enum PSLevel {
   psLevel1,
   psLevel1Sep,
@@ -161,10 +145,6 @@ public:
   GBool getPSShrinkLarger();
   GBool getPSCenter();
   PSLevel getPSLevel();
-  GooString *getPSResidentFont(GooString *fontName);
-  GooList *getPSResidentFonts();
-  PSFontParam16 *getPSResidentFont16(GooString *fontName, int wMode);
-  PSFontParam16 *getPSResidentFontCC(GooString *collection, int wMode);
   GooString *getTextEncodingName();
   EndOfLineKind getTextEOL();
   GBool getTextPageBreaks();
@@ -279,15 +259,6 @@ private:
   GBool psShrinkLarger;		// shrink larger pages to fit paper
   GBool psCenter;		// center pages on the paper
   PSLevel psLevel;		// PostScript level to generate
-  GooHash *psResidentFonts;	// 8-bit fonts resident in printer:
-				//   PDF font name mapped to PS font name
-				//   [GString]
-  GooList *psResidentFonts16;	// 16-bit fonts resident in printer:
-				//   PDF font name mapped to font info
-				//   [PSFontParam16]
-  GooList *psResidentFontsCC;	// 16-bit character collection fonts
-				//   resident in printer: collection name
-				//   mapped to font info [PSFontParam16]
   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 17f31b37..416df932 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1311,7 +1311,6 @@ void PSOutputDev::postInit()
   Catalog *catalog;
   PDFRectangle *box;
   PSOutPaperSize *size;
-  GooList *names;
   int w, h, i;
 
   if (postInitDone || !ok) {
@@ -1405,11 +1404,6 @@ void PSOutputDev::postInit()
   for (i = 0; i < 14; ++i) {
     fontNames->add(new GooString(psBase14SubstFonts[i].psName), 1);
   }
-  names = globalParams->getPSResidentFonts();
-  for (i = 0; i < names->getLength(); ++i) {
-    fontNames->add((GooString *)names->get(i), 1);
-  }
-  delete names;
   t1FontNameSize = 64;
   t1FontNameLen = 0;
   t1FontNames = (PST1FontName *)gmallocn(t1FontNameSize, sizeof(PST1FontName));


More information about the poppler mailing list