Commit 30a0baa3 authored by Albert Astals Cid's avatar Albert Astals Cid

Move more variables from GlobalParams to PSOutputDev

parent 8fed995c
......@@ -17,7 +17,7 @@
// Copyright (C) 2005-2007 Jeff Muizelaar <jeff@infidigm.net>
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2005 Martin Kretzschmar <martink@gnome.org>
// Copyright (C) 2005, 2009, 2012, 2013 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005, 2009, 2012, 2013, 2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006, 2007, 2010, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2007 Koji Otani <sho@bbr.jp>
// Copyright (C) 2008, 2009 Chris Wilson <chris@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)");
......
......@@ -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@kde.org>
// Copyright (C) 2005, 2006, 2008-2010, 2012, 2014, 2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
// Copyright (C) 2007 Julien Rebetez <julienr@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;
......
......@@ -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@kde.org>
// Copyright (C) 2005, 2008, 2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
// Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com>
// Copyright (C) 2007 Julien Rebetez <julienr@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);
......
......@@ -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;
......
......@@ -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
......
This diff is collapsed.
......@@ -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
......
......@@ -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)");
......
......@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Brad Hards <bradh@frogmouth.net>
// Copyright (C) 2005-2009, 2011, 2012, 2014 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005-2009, 2011, 2012, 2014, 2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2008, 2010 Pino Toscano <pino@kde.org>
// Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2009 Petr Gajdos <pgajdos@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)");
......
......@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2005 Brad Hards <bradh@frogmouth.net>
// Copyright (C) 2005-2009, 2011, 2012, 2014 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005-2009, 2011, 2012, 2014, 2015 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2008, 2010 Pino Toscano <pino@kde.org>
// Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright (C) 2009 Petr Gajdos <pgajdos@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)");
......
......@@ -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()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment