cpp/poppler-page-renderer.cpp | 5 ++- poppler/GlobalParams.cc | 58 +----------------------------------------- poppler/GlobalParams.h | 16 ++--------- poppler/PSOutputDev.cc | 14 +++++----- poppler/PSOutputDev.h | 5 ++- poppler/SplashOutputDev.cc | 19 +++++-------- poppler/SplashOutputDev.h | 11 +++++-- qt4/src/poppler-page.cc | 7 ++--- qt5/src/poppler-page.cc | 7 ++--- utils/pdftohtml.cc | 9 ++---- utils/pdftoppm.cc | 49 ++++++++++++++++++++++++++--------- utils/pdftops.cc | 14 +++++++++- 12 files changed, 96 insertions(+), 118 deletions(-)
New commits: commit 6b072500b5ac936631be6b29b7d5a591848a18f3 Author: William Bader <[email protected]> Date: Wed Jan 14 23:28:03 2015 +0100 Add rasterization option to pdftops Also removes GlobalParams stuff \o/ Coded in conjuntion with Albert Bug #85934 diff --git a/cpp/poppler-page-renderer.cpp b/cpp/poppler-page-renderer.cpp index 1317192..4c64684 100644 --- a/cpp/poppler-page-renderer.cpp +++ b/cpp/poppler-page-renderer.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010, Pino Toscano <[email protected]> + * Copyright (C) 2015 William Bader <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -171,8 +172,8 @@ image page_renderer::render_page(const page *p, bgColor[0] = d->paper_color & 0xff; bgColor[1] = (d->paper_color >> 8) & 0xff; bgColor[2] = (d->paper_color >> 16) & 0xff; - const GBool text_AA = d->hints & text_antialiasing ? gTrue : gFalse; - SplashOutputDev splashOutputDev(splashModeXBGR8, 4, gFalse, bgColor, gTrue, text_AA); + SplashOutputDev splashOutputDev(splashModeXBGR8, 4, gFalse, bgColor, gTrue); + splashOutputDev.setFontAntialias(d->hints & text_antialiasing ? gTrue : gFalse); splashOutputDev.setVectorAntialias(d->hints & antialiasing ? gTrue : gFalse); splashOutputDev.setFreeTypeHinting(d->hints & text_hinting ? gTrue : gFalse, gFalse); splashOutputDev.startDoc(pdfdoc); diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc index 3d88646..b73ebb6 100644 --- a/poppler/GlobalParams.cc +++ b/poppler/GlobalParams.cc @@ -15,7 +15,7 @@ // // Copyright (C) 2005 Martin Kretzschmar <[email protected]> // Copyright (C) 2005, 2006 Kristian Høgsberg <[email protected]> -// Copyright (C) 2005, 2007-2010, 2012 Albert Astals Cid <[email protected]> +// Copyright (C) 2005, 2007-2010, 2012, 2015 Albert Astals Cid <[email protected]> // Copyright (C) 2005 Jonathan Blandford <[email protected]> // Copyright (C) 2006, 2007 Jeff Muizelaar <[email protected]> // Copyright (C) 2006 Takashi Iwai <[email protected]> @@ -23,7 +23,7 @@ // Copyright (C) 2007 Krzysztof Kowalczyk <[email protected]> // Copyright (C) 2007, 2009 Jonathan Kew <[email protected]> // Copyright (C) 2009 Petr Gajdos <[email protected]> -// Copyright (C) 2009, 2011, 2012 William Bader <[email protected]> +// Copyright (C) 2009, 2011, 2012, 2015 William Bader <[email protected]> // Copyright (C) 2009 Kovid Goyal <[email protected]> // Copyright (C) 2010, 2012 Hib Eris <[email protected]> // Copyright (C) 2010 Patrick Spendrin <[email protected]> @@ -620,9 +620,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) textPageBreaks = gTrue; textKeepTinyChars = gFalse; enableFreeType = gTrue; - antialias = gTrue; - vectorAntialias = gTrue; - antialiasPrinting = gFalse; strokeAdjust = gTrue; screenType = screenUnset; screenSize = -1; @@ -1701,33 +1698,6 @@ GBool GlobalParams::getEnableFreeType() { return f; } -GBool GlobalParams::getAntialias() { - GBool f; - - lockGlobalParams; - f = antialias; - unlockGlobalParams; - return f; -} - -GBool GlobalParams::getVectorAntialias() { - GBool f; - - lockGlobalParams; - f = vectorAntialias; - unlockGlobalParams; - return f; -} - -GBool GlobalParams::getAntialiasPrinting() { - GBool f; - - lockGlobalParams; - f = antialiasPrinting; - unlockGlobalParams; - return f; -} - GBool GlobalParams::getStrokeAdjust() { GBool f; @@ -2098,30 +2068,6 @@ GBool GlobalParams::setDisableFreeTypeHinting(char *s) { return ok; } -GBool GlobalParams::setAntialias(char *s) { - GBool ok; - - lockGlobalParams; - ok = parseYesNo2(s, &antialias); - unlockGlobalParams; - return ok; -} - -GBool GlobalParams::setVectorAntialias(char *s) { - GBool ok; - - lockGlobalParams; - ok = parseYesNo2(s, &vectorAntialias); - unlockGlobalParams; - return ok; -} - -void GlobalParams::setAntialiasPrinting(GBool anti) { - lockGlobalParams; - antialiasPrinting = anti; - unlockGlobalParams; -} - void GlobalParams::setStrokeAdjust(GBool adjust) { lockGlobalParams; diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h index c33a802..f670641 100644 --- a/poppler/GlobalParams.h +++ b/poppler/GlobalParams.h @@ -13,14 +13,14 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2005, 2007-2010, 2012 Albert Astals Cid <[email protected]> +// Copyright (C) 2005, 2007-2010, 2012, 2015 Albert Astals Cid <[email protected]> // Copyright (C) 2005 Jonathan Blandford <[email protected]> // Copyright (C) 2006 Takashi Iwai <[email protected]> // Copyright (C) 2006 Kristian Høgsberg <[email protected]> // Copyright (C) 2007 Krzysztof Kowalczyk <[email protected]> // Copyright (C) 2009 Jonathan Kew <[email protected]> // Copyright (C) 2009 Petr Gajdos <[email protected]> -// Copyright (C) 2009, 2011, 2012 William Bader <[email protected]> +// Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <[email protected]> // Copyright (C) 2010 Hib Eris <[email protected]> // Copyright (C) 2011 Pino Toscano <[email protected]> // Copyright (C) 2012 Adrian Johnson <[email protected]> @@ -183,9 +183,6 @@ public: GBool getTextPageBreaks(); GBool getTextKeepTinyChars(); GBool getEnableFreeType(); - GBool getAntialias(); - GBool getVectorAntialias(); - GBool getAntialiasPrinting(); GBool getStrokeAdjust(); ScreenType getScreenType(); int getScreenSize(); @@ -238,9 +235,6 @@ public: void setTextKeepTinyChars(GBool keep); GBool setEnableFreeType(char *s); GBool setDisableFreeTypeHinting(char *s); - GBool setAntialias(char *s); - GBool setVectorAntialias(char *s); - void setAntialiasPrinting(GBool print); void setStrokeAdjust(GBool strokeAdjust); void setScreenType(ScreenType st); void setScreenSize(int size); @@ -256,6 +250,8 @@ public: void setProfileCommands(GBool profileCommandsA); void setErrQuiet(GBool errQuietA); + static GBool parseYesNo2(const char *token, GBool *flag); + //----- security handlers void addSecurityHandler(XpdfSecurityHandler *handler); @@ -264,7 +260,6 @@ public: private: void parseNameToUnicode(GooString *name); - GBool parseYesNo2(const char *token, GBool *flag); UnicodeMap *getUnicodeMap2(GooString *encodingName); void scanEncodingDirs(); @@ -342,9 +337,6 @@ private: GBool textKeepTinyChars; // keep all characters in text output GBool enableFreeType; // FreeType enable flag GBool disableFreeTypeHinting; // FreeType disable hinting flag - GBool antialias; // anti-aliasing enable flag - GBool vectorAntialias; // vector anti-aliasing enable flag - GBool antialiasPrinting; // allow anti-aliasing when printing GBool strokeAdjust; // stroke adjustment enable flag ScreenType screenType; // halftone screen type int screenSize; // screen matrix size diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index b95df31..b13476e 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -23,7 +23,7 @@ // Copyright (C) 2009-2013 Thomas Freitag <[email protected]> // Copyright (C) 2009 Till Kamppeter <[email protected]> // Copyright (C) 2009 Carlos Garcia Campos <[email protected]> -// Copyright (C) 2009, 2011, 2012 William Bader <[email protected]> +// Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <[email protected]> // Copyright (C) 2009 Kovid Goyal <[email protected]> // Copyright (C) 2009-2011, 2013, 2014 Adrian Johnson <[email protected]> // Copyright (C) 2012, 2014 Fabio D'Urso <[email protected]> @@ -1230,6 +1230,7 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, } // initialize + rasterAntialias = gFalse; displayText = gTrue; ok = gTrue; outputFunc = outputFuncA; @@ -3202,24 +3203,23 @@ GBool PSOutputDev::checkPageSlice(Page *page, double /*hDPI*/, double /*vDPI*/, numComps = 1; paperColor[0] = 0xff; splashOut = new SplashOutputDev(splashModeMono8, 1, gFalse, - paperColor, gFalse, - globalParams->getAntialiasPrinting()); + paperColor, gFalse); #if SPLASH_CMYK } else if (level == psLevel1Sep || level == psLevel2Sep || level == psLevel3Sep || globalParams->getOverprintPreview()) { numComps = 4; paperColor[0] = paperColor[1] = paperColor[2] = paperColor[3] = 0; splashOut = new SplashOutputDev(splashModeCMYK8, 1, gFalse, - paperColor, gFalse, - globalParams->getAntialiasPrinting()); + paperColor, gFalse); #endif } else { numComps = 3; paperColor[0] = paperColor[1] = paperColor[2] = 0xff; splashOut = new SplashOutputDev(splashModeRGB8, 1, gFalse, - paperColor, gFalse, - globalParams->getAntialiasPrinting()); + paperColor, gFalse); } + splashOut->setFontAntialias(rasterAntialias); + splashOut->setVectorAntialias(rasterAntialias); splashOut->startDoc(doc); // break the page into stripes diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h index 262ce14..7f80899 100644 --- a/poppler/PSOutputDev.h +++ b/poppler/PSOutputDev.h @@ -20,7 +20,7 @@ // Copyright (C) 2009-2013 Thomas Freitag <[email protected]> // Copyright (C) 2009 Till Kamppeter <[email protected]> // Copyright (C) 2009 Carlos Garcia Campos <[email protected]> -// Copyright (C) 2009, 2011 William Bader <[email protected]> +// Copyright (C) 2009, 2011, 2015 William Bader <[email protected]> // Copyright (C) 2010 Hib Eris <[email protected]> // Copyright (C) 2011, 2014 Adrian Johnson <[email protected]> // Copyright (C) 2012 Fabio D'Urso <[email protected]> @@ -308,6 +308,8 @@ public: { overlayCbk = cbk; overlayCbkData = data; } void setDisplayText(GBool display) { displayText = display; } + void setRasterAntialias(GBool a) { rasterAntialias = a; } + private: void init(PSOutputFunc outputFuncA, void *outputStreamA, @@ -488,6 +490,7 @@ private: GBool t3NeedsRestore; // set if a 'q' operator was issued GBool forceRasterize; // forces the page to be rasterized into a image before printing GBool displayText; // displayText + GBool rasterAntialias; // antialias on rasterize #if OPI_SUPPORT int opi13Nest; // nesting level of OPI 1.3 objects diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index bfb07eb..b96232f 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -15,14 +15,14 @@ // // Copyright (C) 2005 Takashi Iwai <[email protected]> // Copyright (C) 2006 Stefan Schweizer <[email protected]> -// Copyright (C) 2006-2014 Albert Astals Cid <[email protected]> +// Copyright (C) 2006-2015 Albert Astals Cid <[email protected]> // Copyright (C) 2006 Krzysztof Kowalczyk <[email protected]> // Copyright (C) 2006 Scott Turner <[email protected]> // Copyright (C) 2007 Koji Otani <[email protected]> // Copyright (C) 2009 Petr Gajdos <[email protected]> // Copyright (C) 2009-2014 Thomas Freitag <[email protected]> // Copyright (C) 2009 Carlos Garcia Campos <[email protected]> -// Copyright (C) 2009 William Bader <[email protected]> +// Copyright (C) 2009, 2014, 2015 William Bader <[email protected]> // Copyright (C) 2010 Patrick Spendrin <[email protected]> // Copyright (C) 2010 Brian Cameron <[email protected]> // Copyright (C) 2010 PaweŠWiejacha <[email protected]> @@ -1252,17 +1252,14 @@ SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA, GBool reverseVideoA, SplashColorPtr paperColorA, GBool bitmapTopDownA, - GBool allowAntialiasA, - SplashThinLineMode thinLineMode, - GBool overprintPreviewA) { + SplashThinLineMode thinLineMode, + GBool overprintPreviewA) { colorMode = colorModeA; bitmapRowPad = bitmapRowPadA; bitmapTopDown = bitmapTopDownA; bitmapUpsideDown = gFalse; - allowAntialias = allowAntialiasA; - vectorAntialias = allowAntialias && - globalParams->getVectorAntialias() && - colorMode != splashModeMono1; + fontAntialias = gTrue; + vectorAntialias = gTrue; overprintPreview = overprintPreviewA; enableFreeTypeHinting = gFalse; enableSlightHinting = gFalse; @@ -1383,8 +1380,7 @@ void SplashOutputDev::startDoc(PDFDoc *docA) { enableFreeTypeHinting, enableSlightHinting, #endif - allowAntialias && - globalParams->getAntialias() && + getFontAntialias() && colorMode != splashModeMono1); for (i = 0; i < nT3Fonts; ++i) { delete t3FontCache[i]; @@ -4151,6 +4147,7 @@ GBool SplashOutputDev::getVectorAntialias() { } void SplashOutputDev::setVectorAntialias(GBool vaa) { + vaa = vaa && colorMode != splashModeMono1; vectorAntialias = vaa; splash->setVectorAntialias(vaa); } diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h index efbb865..ae20fac 100644 --- a/poppler/SplashOutputDev.h +++ b/poppler/SplashOutputDev.h @@ -20,7 +20,8 @@ // Copyright (C) 2011 Andreas Hartmetz <[email protected]> // Copyright (C) 2011 Andrea Canciani <[email protected]> // Copyright (C) 2011 Adrian Johnson <[email protected]> -// Copyright (C) 2012 Albert Astals Cid <[email protected]> +// Copyright (C) 2012, 2015 Albert Astals Cid <[email protected]> +// Copyright (C) 2015 William Bader <[email protected]> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -170,9 +171,8 @@ public: SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, GBool reverseVideoA, SplashColorPtr paperColorA, GBool bitmapTopDownA = gTrue, - GBool allowAntialiasA = gTrue, SplashThinLineMode thinLineMode = splashThinLineDefault, - GBool overprintPreviewA = globalParams->getOverprintPreview()); + GBool overprintPreviewA = globalParams->getOverprintPreview()); // Destructor. virtual ~SplashOutputDev(); @@ -359,6 +359,9 @@ public: virtual void setVectorAntialias(GBool vaa); #endif + GBool getFontAntialias() { return fontAntialias; } + void setFontAntialias(GBool anti) { fontAntialias = anti; } + void setFreeTypeHinting(GBool enable, GBool enableSlightHinting); protected: @@ -396,7 +399,7 @@ private: int bitmapRowPad; GBool bitmapTopDown; GBool bitmapUpsideDown; - GBool allowAntialias; + GBool fontAntialias; GBool vectorAntialias; GBool overprintPreview; GBool enableFreeTypeHinting; diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index fc928b9..9c99cda 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -1,7 +1,7 @@ /* poppler-page.cc: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. * Copyright (C) 2005, Brad Hards <[email protected]> - * Copyright (C) 2005-2014, Albert Astals Cid <[email protected]> + * Copyright (C) 2005-2015, Albert Astals Cid <[email protected]> * Copyright (C) 2005, Stefan Kebekus <[email protected]> * Copyright (C) 2006-2011, Pino Toscano <[email protected]> * Copyright (C) 2008 Carlos Garcia Campos <[email protected]> @@ -14,6 +14,7 @@ * Copyright (C) 2012 Fabio D'Urso <[email protected]> * Copyright (C) 2012 Adam Reichold <[email protected]> * Copyright (C) 2012, 2013 Thomas Freitag <[email protected]> + * Copyright (C) 2015 William Bader <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -293,7 +294,6 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, bgColor[2] = m_page->parentDoc->paperColor.red(); } - GBool AA = m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse; SplashThinLineMode thinLineMode = splashThinLineDefault; if (m_page->parentDoc->m_hints & Document::ThinLineShape) thinLineMode = splashThinLineShape; if (m_page->parentDoc->m_hints & Document::ThinLineSolid) thinLineMode = splashThinLineSolid; @@ -304,8 +304,9 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, #else splashModeXBGR8, #endif - 4, gFalse, bgColor, gTrue, AA, thinLineMode, overprint); + 4, gFalse, bgColor, gTrue, thinLineMode, overprint); + splash_output->setFontAntialias(m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse); splash_output->setVectorAntialias(m_page->parentDoc->m_hints & Document::Antialiasing ? gTrue : gFalse); splash_output->setFreeTypeHinting(m_page->parentDoc->m_hints & Document::TextHinting ? gTrue : gFalse, m_page->parentDoc->m_hints & Document::TextSlightHinting ? gTrue : gFalse); diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc index 6eea0d0..eec211e 100644 --- a/qt5/src/poppler-page.cc +++ b/qt5/src/poppler-page.cc @@ -1,7 +1,7 @@ /* poppler-page.cc: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. * Copyright (C) 2005, Brad Hards <[email protected]> - * Copyright (C) 2005-2014, Albert Astals Cid <[email protected]> + * Copyright (C) 2005-2015, Albert Astals Cid <[email protected]> * Copyright (C) 2005, Stefan Kebekus <[email protected]> * Copyright (C) 2006-2011, Pino Toscano <[email protected]> * Copyright (C) 2008 Carlos Garcia Campos <[email protected]> @@ -14,6 +14,7 @@ * Copyright (C) 2012 Fabio D'Urso <[email protected]> * Copyright (C) 2012 Adam Reichold <[email protected]> * Copyright (C) 2012, 2013 Thomas Freitag <[email protected]> + * Copyright (C) 2015 William Bader <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -293,7 +294,6 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, bgColor[2] = m_page->parentDoc->paperColor.red(); } - GBool AA = m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse; SplashThinLineMode thinLineMode = splashThinLineDefault; if (m_page->parentDoc->m_hints & Document::ThinLineShape) thinLineMode = splashThinLineShape; if (m_page->parentDoc->m_hints & Document::ThinLineSolid) thinLineMode = splashThinLineSolid; @@ -304,8 +304,9 @@ QImage Page::renderToImage(double xres, double yres, int x, int y, int w, int h, #else splashModeXBGR8, #endif - 4, gFalse, bgColor, gTrue, AA, thinLineMode, overprint); + 4, gFalse, bgColor, gTrue, thinLineMode, overprint); + splash_output->setFontAntialias(m_page->parentDoc->m_hints & Document::TextAntialiasing ? gTrue : gFalse); splash_output->setVectorAntialias(m_page->parentDoc->m_hints & Document::Antialiasing ? gTrue : gFalse); splash_output->setFreeTypeHinting(m_page->parentDoc->m_hints & Document::TextHinting ? gTrue : gFalse, m_page->parentDoc->m_hints & Document::TextSlightHinting ? gTrue : gFalse); diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc index aabed0b..ffd559e 100644 --- a/utils/pdftohtml.cc +++ b/utils/pdftohtml.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) 2007-2008, 2010, 2012 Albert Astals Cid <[email protected]> +// Copyright (C) 2007-2008, 2010, 2012, 2015 Albert Astals Cid <[email protected]> // Copyright (C) 2010 Hib Eris <[email protected]> // Copyright (C) 2010 Mike Slegeir <[email protected]> // Copyright (C) 2010, 2013 Suzuki Toshiya <[email protected]> @@ -23,6 +23,7 @@ // Copyright (C) 2012 Ihar Filipau <[email protected]> // Copyright (C) 2012 Luis Parravicini <[email protected]> // Copyright (C) 2014 Pino Toscano <[email protected]> +// Copyright (C) 2015 William Bader <[email protected]> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -155,10 +156,8 @@ class SplashOutputDevNoText : public SplashOutputDev { public: SplashOutputDevNoText(SplashColorMode colorModeA, int bitmapRowPadA, GBool reverseVideoA, SplashColorPtr paperColorA, - GBool bitmapTopDownA = gTrue, - GBool allowAntialiasA = gTrue) : SplashOutputDev(colorModeA, - bitmapRowPadA, reverseVideoA, paperColorA, bitmapTopDownA, - allowAntialiasA) { } + GBool bitmapTopDownA = gTrue) : SplashOutputDev(colorModeA, + bitmapRowPadA, reverseVideoA, paperColorA, bitmapTopDownA) { } virtual ~SplashOutputDevNoText() { } void drawChar(GfxState *state, double x, double y, diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc index 962860b..7ff5b22 100644 --- a/utils/pdftoppm.cc +++ b/utils/pdftoppm.cc @@ -18,7 +18,7 @@ // Copyright (C) 2009 Michael K. Johnson <[email protected]> // Copyright (C) 2009 Shen Liang <[email protected]> // Copyright (C) 2009 Stefan Thomas <[email protected]> -// Copyright (C) 2009-2011 Albert Astals Cid <[email protected]> +// Copyright (C) 2009-2011, 2015 Albert Astals Cid <[email protected]> // Copyright (C) 2010, 2012 Adrian Johnson <[email protected]> // Copyright (C) 2010 Hib Eris <[email protected]> // Copyright (C) 2010 Jonathan Liu <[email protected]> @@ -26,6 +26,7 @@ // Copyright (C) 2011-2013 Thomas Freitag <[email protected]> // Copyright (C) 2013 Adam Reichold <[email protected]> // Copyright (C) 2013 Suzuki Toshiya <[email protected]> +// Copyright (C) 2015 William Bader <[email protected]> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -268,6 +269,20 @@ static std::deque<PageJob> pageJobQueue; static pthread_mutex_t pageJobMutex = PTHREAD_MUTEX_INITIALIZER; static void processPageJobs() { + GBool fontAntialias = gTrue; + GBool vectorAntialias = gTrue; + + if (antialiasStr[0]) { + if (!GlobalParams::parseYesNo2(antialiasStr, &fontAntialias)) { + fprintf(stderr, "Bad '-aa' value on command line\n"); + } + } + if (vectorAntialiasStr[0]) { + if (!GlobalParams::parseYesNo2(vectorAntialiasStr, &vectorAntialias)) { + fprintf(stderr, "Bad '-aaVector' value on command line\n"); + } + } + while(true) { // pop the next job or exit if queue is empty pthread_mutex_lock(&pageJobMutex); @@ -288,7 +303,9 @@ static void processPageJobs() { #if SPLASH_CMYK (jpegcmyk || overprint) ? splashModeDeviceN8 : #endif - splashModeRGB8, 4, gFalse, *pageJob.paperColor, gTrue, gTrue, thinLineMode); + splashModeRGB8, 4, gFalse, *pageJob.paperColor, gTrue, thinLineMode); + splashOut->setFontAntialias(fontAntialias); + splashOut->setVectorAntialias(vectorAntialias); splashOut->startDoc(pageJob.doc); savePageSlice(pageJob.doc, splashOut, pageJob.pg, x, y, w, h, pageJob.pg_w, pageJob.pg_h, pageJob.ppmFile); @@ -328,6 +345,8 @@ int main(int argc, char *argv[]) { int exitCode; int pg, pg_num_len; double pg_w, pg_h, tmp; + GBool fontAntialias = gTrue; + GBool vectorAntialias = gTrue; exitCode = 99; @@ -363,16 +382,6 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Bad '-freetype' value on command line\n"); } } - if (antialiasStr[0]) { - if (!globalParams->setAntialias(antialiasStr)) { - fprintf(stderr, "Bad '-aa' value on command line\n"); - } - } - if (vectorAntialiasStr[0]) { - if (!globalParams->setVectorAntialias(vectorAntialiasStr)) { - fprintf(stderr, "Bad '-aaVector' value on command line\n"); - } - } if (thinLineModeStr[0]) { if (strcmp(thinLineModeStr, "solid") == 0) { thinLineMode = splashThinLineSolid; @@ -464,7 +473,21 @@ int main(int argc, char *argv[]) { (jpegcmyk || overprint) ? splashModeDeviceN8 : #endif splashModeRGB8, 4, - gFalse, paperColor, gTrue, gTrue, thinLineMode); + gFalse, paperColor, gTrue, thinLineMode); + + if (antialiasStr[0]) { + if (!GlobalParams::parseYesNo2(antialiasStr, &fontAntialias)) { + fprintf(stderr, "Bad '-aa' value on command line\n"); + } + } + if (vectorAntialiasStr[0]) { + if (!GlobalParams::parseYesNo2(vectorAntialiasStr, &vectorAntialias)) { + fprintf(stderr, "Bad '-aaVector' value on command line\n"); + } + } + + splashOut->setFontAntialias(fontAntialias); + splashOut->setVectorAntialias(vectorAntialias); splashOut->startDoc(doc); #endif // UTILS_USE_PTHREADS diff --git a/utils/pdftops.cc b/utils/pdftops.cc index fbc3d67..43234db 100644 --- a/utils/pdftops.cc +++ b/utils/pdftops.cc @@ -19,7 +19,7 @@ // Copyright (C) 2007-2008, 2010, 2015 Albert Astals Cid <[email protected]> // Copyright (C) 2009 Till Kamppeter <[email protected]> // Copyright (C) 2009 Sanjoy Mahajan <[email protected]> -// Copyright (C) 2009, 2011, 2012 William Bader <[email protected]> +// Copyright (C) 2009, 2011, 2012, 2014, 2015 William Bader <[email protected]> // Copyright (C) 2010 Hib Eris <[email protected]> // Copyright (C) 2012 Thomas Freitag <[email protected]> // Copyright (C) 2013 Suzuki Toshiya <[email protected]> @@ -95,6 +95,7 @@ static GBool noEmbedTTFonts = gFalse; static GBool noEmbedCIDPSFonts = gFalse; static GBool noEmbedCIDTTFonts = gFalse; static GBool fontPassthrough = gFalse; +static char rasterAntialiasStr[16] = ""; static GBool preload = gFalse; static char paperSize[15] = ""; static int paperWidth = -1; @@ -154,6 +155,8 @@ static const ArgDesc argDesc[] = { "don't embed CID TrueType fonts"}, {"-passfonts", argFlag, &fontPassthrough,0, "don't substitute missing fonts"}, + {"-aaRaster", argString, rasterAntialiasStr, sizeof(rasterAntialiasStr), + "enable anti-aliasing on rasterization: yes, no"}, {"-preload", argFlag, &preload, 0, "preload images and forms"}, {"-paper", argString, paperSize, sizeof(paperSize), @@ -206,6 +209,7 @@ int main(int argc, char *argv[]) { GBool ok; char *p; int exitCode; + GBool rasterAntialias = gFalse; std::vector<int> pages; exitCode = 99; @@ -412,6 +416,14 @@ int main(int argc, char *argv[]) { paperHeight, noCrop, duplex); + + if (rasterAntialiasStr[0]) { + if (!GlobalParams::parseYesNo2(rasterAntialiasStr, &rasterAntialias)) { + fprintf(stderr, "Bad '-aaRaster' value on command line\n"); + } + } + + psOut->setRasterAntialias(rasterAntialias); if (psOut->isOk()) { for (int i = firstPage; i <= lastPage; ++i) { doc->displayPage(psOut, i, 72, 72,
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
