[poppler] poppler/GlobalParams.cc poppler/GlobalParams.h poppler/PSOutputDev.cc poppler/PSOutputDev.h utils/pdftops.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 29 14:42:30 UTC 2021
poppler/GlobalParams.cc | 26 --------------------------
poppler/GlobalParams.h | 6 ------
poppler/PSOutputDev.cc | 2 +-
poppler/PSOutputDev.h | 4 ++++
utils/pdftops.cc | 14 +++++++-------
5 files changed, 12 insertions(+), 40 deletions(-)
New commits:
commit 3a82fc29f025fcb1ab4b41d519efb916ba297c6f
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Oct 29 16:30:09 2021 +0200
Move two variables from GlobalParams to PSOutputDev
Only place they are ever used
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 7f512665..5673bcdf 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -384,8 +384,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) : popplerDataDir(cu
nameToUnicodeZapfDingbats = new NameToCharCode();
nameToUnicodeText = new NameToCharCode();
sysFonts = new SysFontList();
- psExpandSmaller = false;
- psShrinkLarger = true;
textEncoding = new GooString("UTF-8");
overprintPreview = false;
printCommands = false;
@@ -1114,18 +1112,6 @@ GooString *GlobalParams::findSystemFontFile(const GfxFont *font, SysFontType *ty
}
#endif
-bool GlobalParams::getPSExpandSmaller()
-{
- globalParamsLocker();
- return psExpandSmaller;
-}
-
-bool GlobalParams::getPSShrinkLarger()
-{
- globalParamsLocker();
- return psShrinkLarger;
-}
-
std::string GlobalParams::getTextEncodingName() const
{
globalParamsLocker();
@@ -1222,18 +1208,6 @@ void GlobalParams::addFontFile(const GooString *fontName, const GooString *path)
fontFiles[fontName->toStr()] = path->toStr();
}
-void GlobalParams::setPSExpandSmaller(bool expand)
-{
- globalParamsLocker();
- psExpandSmaller = expand;
-}
-
-void GlobalParams::setPSShrinkLarger(bool shrink)
-{
- globalParamsLocker();
- psShrinkLarger = shrink;
-}
-
void GlobalParams::setTextEncoding(const char *encodingName)
{
globalParamsLocker();
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 9fc315d7..152228f3 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -111,8 +111,6 @@ public:
GooString *findFontFile(const GooString *fontName);
GooString *findBase14FontFile(const GooString *base14Name, const GfxFont *font);
GooString *findSystemFontFile(const GfxFont *font, SysFontType *type, int *fontNum, GooString *substituteFontName = nullptr, const GooString *base14Name = nullptr);
- bool getPSExpandSmaller();
- bool getPSShrinkLarger();
std::string getTextEncodingName() const;
bool getOverprintPreview() { return overprintPreview; }
bool getPrintCommands();
@@ -130,8 +128,6 @@ public:
//----- functions to set parameters
void addFontFile(const GooString *fontName, const GooString *path);
- void setPSExpandSmaller(bool expand);
- void setPSShrinkLarger(bool shrink);
void setTextEncoding(const char *encodingName);
void setOverprintPreview(bool overprintPreviewA);
void setPrintCommands(bool printCommandsA);
@@ -179,8 +175,6 @@ private:
// font files: font name mapped to path
std::unordered_map<std::string, std::string> fontFiles;
SysFontList *sysFonts; // system fonts
- bool psExpandSmaller; // expand smaller pages to fill paper
- bool psShrinkLarger; // shrink larger pages to fit paper
GooString *textEncoding; // encoding (unicodeMap) to use for text
// output
bool overprintPreview; // enable overprint preview
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index a13ab851..39930dc1 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -3713,7 +3713,7 @@ void PSOutputDev::startPage(int pageNum, GfxState *state, XRef *xrefA)
if (xScale0 > 0 && yScale0 > 0) {
xScale = xScale0;
yScale = yScale0;
- } else if ((globalParams->getPSShrinkLarger() && (width > imgWidth2 || height > imgHeight2)) || (globalParams->getPSExpandSmaller() && (width < imgWidth2 && height < imgHeight2))) {
+ } else if ((psShrinkLarger && (width > imgWidth2 || height > imgHeight2)) || (psExpandSmaller && (width < imgWidth2 && height < imgHeight2))) {
if (unlikely(width == 0)) {
error(errSyntaxError, -1, "width 0, xScale would be infinite");
return;
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index dc84bc10..e127ca91 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -303,6 +303,8 @@ public:
void setDisplayText(bool display) { displayText = display; }
void setPSCenter(bool center) { psCenter = center; }
+ void setPSExpandSmaller(bool expand) { psExpandSmaller = expand; }
+ void setPSShrinkLarger(bool shrink) { psShrinkLarger = shrink; }
void setRasterAntialias(bool a) { rasterAntialias = a; }
void setForceRasterize(PSForceRasterize f) { forceRasterize = f; }
void setRasterResolution(double r) { rasterResolution = r; }
@@ -498,6 +500,8 @@ private:
PSForceRasterize forceRasterize; // controls the rasterization of pages into images
bool displayText; // displayText
bool psCenter; // center pages on the paper
+ bool psExpandSmaller = false; // expand smaller pages to fill paper
+ bool psShrinkLarger = true; // shrink larger pages to fit paper
bool rasterAntialias; // antialias on rasterize
bool uncompressPreloadedImages;
double rasterResolution; // PostScript rasterization resolution (dpi)
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index a56634d2..6d5ecc83 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -16,7 +16,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2007-2008, 2010, 2015, 2017, 2018, 2020 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2008, 2010, 2015, 2017, 2018, 2020, 2021 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2009 Till Kamppeter <till.kamppeter at gmail.com>
// Copyright (C) 2009 Sanjoy Mahajan <sanjoy at mit.edu>
// Copyright (C) 2009, 2011, 2012, 2014-2016, 2020 William Bader <williambader at hotmail.com>
@@ -271,12 +271,6 @@ int main(int argc, char *argv[])
if (overprint) {
globalParams->setOverprintPreview(true);
}
- if (expand) {
- globalParams->setPSExpandSmaller(true);
- }
- if (noShrink) {
- globalParams->setPSShrinkLarger(false);
- }
if (quiet) {
globalParams->setErrQuiet(quiet);
}
@@ -451,6 +445,12 @@ int main(int argc, char *argv[])
if (noCenter) {
psOut->setPSCenter(false);
}
+ if (expand) {
+ psOut->setPSExpandSmaller(true);
+ }
+ if (noShrink) {
+ psOut->setPSShrinkLarger(false);
+ }
if (rasterAntialiasStr[0]) {
if (!GlobalParams::parseYesNo2(rasterAntialiasStr, &rasterAntialias)) {
More information about the poppler
mailing list