Commit 6ee907f2 authored by Albert Astals Cid's avatar Albert Astals Cid

[xpdf303] More merges from Thomas, basically PSOutputDev and some other small stuff

parent 4fcd42cf
...@@ -729,7 +729,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) { ...@@ -729,7 +729,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) {
if (!isCIDFont()) { if (!isCIDFont()) {
//----- 8-bit PS resident font //----- 8-bit PS resident font
if (ps) { if (name && ps) {
if ((path = globalParams->getPSResidentFont(name))) { if ((path = globalParams->getPSResidentFont(name))) {
fontLoc = new GfxFontLoc(); fontLoc = new GfxFontLoc();
fontLoc->locType = gfxFontLocResident; fontLoc->locType = gfxFontLocResident;
...@@ -756,7 +756,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) { ...@@ -756,7 +756,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, GBool ps) {
substName = new GooString(base14SubstFonts[substIdx]); substName = new GooString(base14SubstFonts[substIdx]);
if (ps) { if (ps) {
error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:t}'", error(errSyntaxWarning, -1, "Substituting font '{0:s}' for '{1:t}'",
base14SubstFonts[substIdx], name); base14SubstFonts[substIdx], name ? name : new GooString("null"));
fontLoc = new GfxFontLoc(); fontLoc = new GfxFontLoc();
fontLoc->locType = gfxFontLocResident; fontLoc->locType = gfxFontLocResident;
fontLoc->fontType = fontType1; fontLoc->fontType = fontType1;
......
...@@ -582,6 +582,10 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) ...@@ -582,6 +582,10 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
psOPI = gFalse; psOPI = gFalse;
psASCIIHex = gFalse; psASCIIHex = gFalse;
psBinary = gFalse; psBinary = gFalse;
psUncompressPreloadedImages = gFalse;
psRasterResolution = 300;
psRasterMono = gFalse;
psAlwaysRasterize = gFalse;
textEncoding = new GooString("UTF-8"); textEncoding = new GooString("UTF-8");
#if defined(_WIN32) #if defined(_WIN32)
textEOL = eolDOS; textEOL = eolDOS;
...@@ -596,6 +600,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) ...@@ -596,6 +600,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
disableFreeTypeHinting = gFalse; disableFreeTypeHinting = gFalse;
antialias = gTrue; antialias = gTrue;
vectorAntialias = gTrue; vectorAntialias = gTrue;
antialiasPrinting = gFalse;
strokeAdjust = gTrue; strokeAdjust = gTrue;
screenType = screenUnset; screenType = screenUnset;
screenSize = -1; screenSize = -1;
...@@ -610,7 +615,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir) ...@@ -610,7 +615,6 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
printCommands = gFalse; printCommands = gFalse;
profileCommands = gFalse; profileCommands = gFalse;
errQuiet = gFalse; errQuiet = gFalse;
splashResolution = 0.0;
cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize); cidToUnicodeCache = new CharCodeToUnicodeCache(cidToUnicodeCacheSize);
unicodeToUnicodeCache = unicodeToUnicodeCache =
...@@ -1559,6 +1563,42 @@ GBool GlobalParams::getPSBinary() { ...@@ -1559,6 +1563,42 @@ GBool GlobalParams::getPSBinary() {
return binary; return binary;
} }
GBool GlobalParams::getPSUncompressPreloadedImages() {
GBool ah;
lockGlobalParams;
ah = psUncompressPreloadedImages;
unlockGlobalParams;
return ah;
}
double GlobalParams::getPSRasterResolution() {
double res;
lockGlobalParams;
res = psRasterResolution;
unlockGlobalParams;
return res;
}
GBool GlobalParams::getPSRasterMono() {
GBool mono;
lockGlobalParams;
mono = psRasterMono;
unlockGlobalParams;
return mono;
}
GBool GlobalParams::getPSAlwaysRasterize() {
GBool rast;
lockGlobalParams;
rast = psAlwaysRasterize;
unlockGlobalParams;
return rast;
}
GooString *GlobalParams::getTextEncodingName() { GooString *GlobalParams::getTextEncodingName() {
GooString *s; GooString *s;
...@@ -1631,6 +1671,15 @@ GBool GlobalParams::getVectorAntialias() { ...@@ -1631,6 +1671,15 @@ GBool GlobalParams::getVectorAntialias() {
return f; return f;
} }
GBool GlobalParams::getAntialiasPrinting() {
GBool f;
lockGlobalParams;
f = antialiasPrinting;
unlockGlobalParams;
return f;
}
GBool GlobalParams::getStrokeAdjust() { GBool GlobalParams::getStrokeAdjust() {
GBool f; GBool f;
...@@ -1745,14 +1794,6 @@ GBool GlobalParams::getErrQuiet() { ...@@ -1745,14 +1794,6 @@ GBool GlobalParams::getErrQuiet() {
return errQuiet; return errQuiet;
} }
double GlobalParams::getSplashResolution() {
double r;
lockGlobalParams;
r = splashResolution;
unlockGlobalParams;
return r;
}
CharCodeToUnicode *GlobalParams::getCIDToUnicode(GooString *collection) { CharCodeToUnicode *GlobalParams::getCIDToUnicode(GooString *collection) {
GooString *fileName; GooString *fileName;
CharCodeToUnicode *ctu; CharCodeToUnicode *ctu;
...@@ -1944,6 +1985,30 @@ void GlobalParams::setPSBinary(GBool binary) { ...@@ -1944,6 +1985,30 @@ void GlobalParams::setPSBinary(GBool binary) {
unlockGlobalParams; unlockGlobalParams;
} }
void GlobalParams::setPSUncompressPreloadedImages(GBool uncomp) {
lockGlobalParams;
psUncompressPreloadedImages = uncomp;
unlockGlobalParams;
}
void GlobalParams::setPSRasterResolution(double res) {
lockGlobalParams;
psRasterResolution = res;
unlockGlobalParams;
}
void GlobalParams::setPSRasterMono(GBool mono) {
lockGlobalParams;
psRasterMono = mono;
unlockGlobalParams;
}
void GlobalParams::setPSAlwaysRasterize(GBool always) {
lockGlobalParams;
psAlwaysRasterize = always;
unlockGlobalParams;
}
void GlobalParams::setTextEncoding(char *encodingName) { void GlobalParams::setTextEncoding(char *encodingName) {
lockGlobalParams; lockGlobalParams;
delete textEncoding; delete textEncoding;
...@@ -2015,6 +2080,12 @@ GBool GlobalParams::setVectorAntialias(char *s) { ...@@ -2015,6 +2080,12 @@ GBool GlobalParams::setVectorAntialias(char *s) {
return ok; return ok;
} }
void GlobalParams::setAntialiasPrinting(GBool anti) {
lockGlobalParams;
antialiasPrinting = anti;
unlockGlobalParams;
}
void GlobalParams::setStrokeAdjust(GBool adjust) void GlobalParams::setStrokeAdjust(GBool adjust)
{ {
lockGlobalParams; lockGlobalParams;
...@@ -2107,12 +2178,6 @@ void GlobalParams::setErrQuiet(GBool errQuietA) { ...@@ -2107,12 +2178,6 @@ void GlobalParams::setErrQuiet(GBool errQuietA) {
unlockGlobalParams; unlockGlobalParams;
} }
void GlobalParams::setSplashResolution(double SplashResolutionA) {
lockGlobalParams;
splashResolution = SplashResolutionA;
unlockGlobalParams;
}
void GlobalParams::addSecurityHandler(XpdfSecurityHandler *handler) { void GlobalParams::addSecurityHandler(XpdfSecurityHandler *handler) {
#ifdef ENABLE_PLUGINS #ifdef ENABLE_PLUGINS
lockGlobalParams; lockGlobalParams;
......
...@@ -165,6 +165,10 @@ public: ...@@ -165,6 +165,10 @@ public:
GBool getPSOPI(); GBool getPSOPI();
GBool getPSASCIIHex(); GBool getPSASCIIHex();
GBool getPSBinary(); GBool getPSBinary();
GBool getPSUncompressPreloadedImages();
double getPSRasterResolution();
GBool getPSRasterMono();
GBool getPSAlwaysRasterize();
GooString *getTextEncodingName(); GooString *getTextEncodingName();
EndOfLineKind getTextEOL(); EndOfLineKind getTextEOL();
GBool getTextPageBreaks(); GBool getTextPageBreaks();
...@@ -173,6 +177,7 @@ public: ...@@ -173,6 +177,7 @@ public:
GBool getDisableFreeTypeHinting(); GBool getDisableFreeTypeHinting();
GBool getAntialias(); GBool getAntialias();
GBool getVectorAntialias(); GBool getVectorAntialias();
GBool getAntialiasPrinting();
GBool getStrokeAdjust(); GBool getStrokeAdjust();
ScreenType getScreenType(); ScreenType getScreenType();
int getScreenSize(); int getScreenSize();
...@@ -217,6 +222,10 @@ public: ...@@ -217,6 +222,10 @@ public:
void setPSOPI(GBool opi); void setPSOPI(GBool opi);
void setPSASCIIHex(GBool hex); void setPSASCIIHex(GBool hex);
void setPSBinary(GBool binary); void setPSBinary(GBool binary);
void setPSUncompressPreloadedImages(GBool uncomp);
void setPSRasterResolution(double res);
void setPSRasterMono(GBool mono);
void setPSAlwaysRasterize(GBool always);
void setTextEncoding(char *encodingName); void setTextEncoding(char *encodingName);
GBool setTextEOL(char *s); GBool setTextEOL(char *s);
void setTextPageBreaks(GBool pageBreaks); void setTextPageBreaks(GBool pageBreaks);
...@@ -225,6 +234,7 @@ public: ...@@ -225,6 +234,7 @@ public:
GBool setDisableFreeTypeHinting(char *s); GBool setDisableFreeTypeHinting(char *s);
GBool setAntialias(char *s); GBool setAntialias(char *s);
GBool setVectorAntialias(char *s); GBool setVectorAntialias(char *s);
void setAntialiasPrinting(GBool print);
void setStrokeAdjust(GBool strokeAdjust); void setStrokeAdjust(GBool strokeAdjust);
void setScreenType(ScreenType st); void setScreenType(ScreenType st);
void setScreenSize(int size); void setScreenSize(int size);
...@@ -239,7 +249,6 @@ public: ...@@ -239,7 +249,6 @@ public:
void setPrintCommands(GBool printCommandsA); void setPrintCommands(GBool printCommandsA);
void setProfileCommands(GBool profileCommandsA); void setProfileCommands(GBool profileCommandsA);
void setErrQuiet(GBool errQuietA); void setErrQuiet(GBool errQuietA);
void setSplashResolution(double splashResolutionA);
//----- security handlers //----- security handlers
...@@ -313,6 +322,12 @@ private: ...@@ -313,6 +322,12 @@ private:
GBool psOPI; // generate PostScript OPI comments? GBool psOPI; // generate PostScript OPI comments?
GBool psASCIIHex; // use ASCIIHex instead of ASCII85? GBool psASCIIHex; // use ASCIIHex instead of ASCII85?
GBool psBinary; // use binary instead of hex GBool psBinary; // use binary instead of hex
GBool psUncompressPreloadedImages; // uncompress all preloaded images
double psRasterResolution; // PostScript rasterization resolution (dpi)
GBool psRasterMono; // true to do PostScript rasterization
// in monochrome (gray); false to do it
// in color (RGB/CMYK)
GBool psAlwaysRasterize; // force PostScript rasterization
GooString *textEncoding; // encoding (unicodeMap) to use for text GooString *textEncoding; // encoding (unicodeMap) to use for text
// output // output
EndOfLineKind textEOL; // type of EOL marker to use for text EndOfLineKind textEOL; // type of EOL marker to use for text
...@@ -323,6 +338,7 @@ private: ...@@ -323,6 +338,7 @@ private:
GBool disableFreeTypeHinting; // FreeType disable hinting flag GBool disableFreeTypeHinting; // FreeType disable hinting flag
GBool antialias; // anti-aliasing enable flag GBool antialias; // anti-aliasing enable flag
GBool vectorAntialias; // vector anti-aliasing enable flag GBool vectorAntialias; // vector anti-aliasing enable flag
GBool antialiasPrinting; // allow anti-aliasing when printing
GBool strokeAdjust; // stroke adjustment enable flag GBool strokeAdjust; // stroke adjustment enable flag
ScreenType screenType; // halftone screen type ScreenType screenType; // halftone screen type
int screenSize; // screen matrix size int screenSize; // screen matrix size
......
...@@ -60,9 +60,9 @@ description for all fonts available in Windows. That's how MuPDF works. ...@@ -60,9 +60,9 @@ description for all fonts available in Windows. That's how MuPDF works.
#define DEFAULT_SUBSTITUTE_FONT "Helvetica" #define DEFAULT_SUBSTITUTE_FONT "Helvetica"
static struct { static struct {
char *name; const char *name;
char *t1FileName; const char *t1FileName;
char *ttFileName; const char *ttFileName;
} displayFontTab[] = { } displayFontTab[] = {
{"Courier", "n022003l.pfb", "cour.ttf"}, {"Courier", "n022003l.pfb", "cour.ttf"},
{"Courier-Bold", "n022004l.pfb", "courbd.ttf"}, {"Courier-Bold", "n022004l.pfb", "courbd.ttf"},
...@@ -253,7 +253,8 @@ void SysFontList::scanWindowsFonts(GooString *winFontDir) { ...@@ -253,7 +253,8 @@ void SysFontList::scanWindowsFonts(GooString *winFontDir) {
data[dataLen] = '\0'; data[dataLen] = '\0';
n = strlen(data); n = strlen(data);
if (!strcasecmp(data + n - 4, ".ttf") || if (!strcasecmp(data + n - 4, ".ttf") ||
!strcasecmp(data + n - 4, ".ttc")) { !strcasecmp(data + n - 4, ".ttc") ||
!strcasecmp(data + n - 4, ".otf")) {
fontPath = new GooString(data); fontPath = new GooString(data);
if (!(dataLen >= 3 && data[1] == ':' && data[2] == '\\')) { if (!(dataLen >= 3 && data[1] == ':' && data[2] == '\\')) {
fontPath->insert(0, '\\'); fontPath->insert(0, '\\');
...@@ -301,6 +302,11 @@ SysFontInfo *SysFontList::makeWindowsFont(char *name, int fontNum, ...@@ -301,6 +302,11 @@ SysFontInfo *SysFontList::makeWindowsFont(char *name, int fontNum,
n -= 11; n -= 11;
} }
// remove trailing ' (OpenType)'
if (n > 11 && !strncmp(name + n - 11, " (OpenType)", 11)) {
n -= 11;
}
// remove trailing ' Italic' // remove trailing ' Italic'
if (n > 7 && !strncmp(name + n - 7, " Italic", 7)) { if (n > 7 && !strncmp(name + n - 7, " Italic", 7)) {
n -= 7; n -= 7;
...@@ -401,7 +407,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font, ...@@ -401,7 +407,7 @@ GooString *GlobalParams::findSystemFontFile(GfxFont *font,
*fontNum = fi->fontNum; *fontNum = fi->fontNum;
} else { } else {
GooString *substFontName = new GooString(findSubstituteName(fontName->getCString())); GooString *substFontName = new GooString(findSubstituteName(fontName->getCString()));
error(errSyntaxError, -1, "Couldn't find a font for '{0:t}', subst is '{0:s}'", fontName, substFontName); error(errSyntaxError, -1, "Couldn't find a font for '{0:t}', subst is '{1:t}'", fontName, substFontName);
if ((fi = sysFonts->find(substFontName, gFalse))) { if ((fi = sysFonts->find(substFontName, gFalse))) {
path = fi->path->copy(); path = fi->path->copy();
*type = fi->type; *type = fi->type;
......
...@@ -134,7 +134,7 @@ void Hints::readTables(BaseStream *str, Linearization *linearization, XRef *xref ...@@ -134,7 +134,7 @@ void Hints::readTables(BaseStream *str, Linearization *linearization, XRef *xref
if (parser->getObj(&obj)->isInt() && if (parser->getObj(&obj)->isInt() &&
(num = obj.getInt(), obj.free(), parser->getObj(&obj)->isInt()) && (num = obj.getInt(), obj.free(), parser->getObj(&obj)->isInt()) &&
(gen = obj.getInt(), obj.free(), parser->getObj(&obj)->isCmd("obj")) && (gen = obj.getInt(), obj.free(), parser->getObj(&obj)->isCmd("obj")) &&
(obj.free(), parser->getObj(&obj, (obj.free(), parser->getObj(&obj, gFalse,
secHdlr ? secHdlr->getFileKey() : (Guchar *)NULL, secHdlr ? secHdlr->getFileKey() : (Guchar *)NULL,
secHdlr ? secHdlr->getEncAlgorithm() : cryptRC4, secHdlr ? secHdlr->getEncAlgorithm() : cryptRC4,
secHdlr ? secHdlr->getFileKeyLength() : 0, secHdlr ? secHdlr->getFileKeyLength() : 0,
......
This diff is collapsed.
...@@ -43,16 +43,20 @@ ...@@ -43,16 +43,20 @@
#include "GlobalParams.h" #include "GlobalParams.h"
#include "OutputDev.h" #include "OutputDev.h"
class GHooash;
class PDFDoc;
class XRef;
class Function;
class GfxPath; class GfxPath;
class GfxFont; class GfxFont;
class GfxColorSpace; class GfxColorSpace;
class GfxSeparationColorSpace; class GfxSeparationColorSpace;
class PDFRectangle; class PDFRectangle;
struct PST1FontName;
struct PSFont8Info; struct PSFont8Info;
struct PSFont16Enc; struct PSFont16Enc;
class PSOutCustomColor; class PSOutCustomColor;
class Function; class PSOutputDev;
class PDFDoc;
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// PSOutputDev // PSOutputDev
...@@ -72,8 +76,17 @@ enum PSFileType { ...@@ -72,8 +76,17 @@ enum PSFileType {
psGeneric // write to a generic stream psGeneric // write to a generic stream
}; };
enum PSOutCustomCodeLocation {
psOutCustomDocSetup,
psOutCustomPageSetup
};
typedef void (*PSOutputFunc)(void *stream, const char *data, int len); typedef void (*PSOutputFunc)(void *stream, const char *data, int len);
typedef GooString *(*PSOutCustomCodeCbk)(PSOutputDev *psOut,
PSOutCustomCodeLocation loc, int n,
void *data);
class PSOutputDev: public OutputDev { class PSOutputDev: public OutputDev {
public: public:
...@@ -85,8 +98,9 @@ public: ...@@ -85,8 +98,9 @@ public:
GBool duplexA = gTrue, GBool duplexA = gTrue,
int imgLLXA = 0, int imgLLYA = 0, int imgLLXA = 0, int imgLLYA = 0,
int imgURXA = 0, int imgURYA = 0, int imgURXA = 0, int imgURYA = 0,
GBool forceRasterizeA = gFalse, GBool manualCtrlA = gFalse,
GBool manualCtrlA = gFalse); PSOutCustomCodeCbk customCodeCbkA = NULL,
void *customCodeCbkDataA = NULL);
// Open a PSOutputDev that will write to a generic stream. // Open a PSOutputDev that will write to a generic stream.
PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
...@@ -97,8 +111,9 @@ public: ...@@ -97,8 +111,9 @@ public:
GBool duplexA = gTrue, GBool duplexA = gTrue,
int imgLLXA = 0, int imgLLYA = 0, int imgLLXA = 0, int imgLLYA = 0,
int imgURXA = 0, int imgURYA = 0, int imgURXA = 0, int imgURYA = 0,
GBool forceRasterizeA = gFalse, GBool manualCtrlA = gFalse,
GBool manualCtrlA = gFalse); PSOutCustomCodeCbk customCodeCbkA = NULL,
void *customCodeCbkDataA = NULL);
// Destructor -- writes the trailer and closes the file. // Destructor -- writes the trailer and closes the file.
virtual ~PSOutputDev(); virtual ~PSOutputDev();
...@@ -310,7 +325,7 @@ private: ...@@ -310,7 +325,7 @@ private:
void setupType3Font(GfxFont *font, GooString *psName, Dict *parentResDict); void setupType3Font(GfxFont *font, GooString *psName, Dict *parentResDict);
GooString *makePSFontName(GfxFont *font, Ref *id); GooString *makePSFontName(GfxFont *font, Ref *id);
void setupImages(Dict *resDict); void setupImages(Dict *resDict);
void setupImage(Ref id, Stream *str); void setupImage(Ref id, Stream *str, GBool mask);
void setupForms(Dict *resDict); void setupForms(Dict *resDict);
void setupForm(Ref id, Object *strObj); void setupForm(Ref id, Object *strObj);
void addProcessColor(double c, double m, double y, double k); void addProcessColor(double c, double m, double y, double k);
...@@ -376,6 +391,7 @@ private: ...@@ -376,6 +391,7 @@ private:
PSOutMode mode; // PostScript mode (PS, EPS, form) PSOutMode mode; // PostScript mode (PS, EPS, form)
int paperWidth; // width of paper, in pts int paperWidth; // width of paper, in pts
int paperHeight; // height of paper, in pts int paperHeight; // height of paper, in pts
GBool paperMatch; // true if paper size is set to match each page
int prevWidth; // width of previous page int prevWidth; // width of previous page
// (only psModePSOrigPageSizes output mode) // (only psModePSOrigPageSizes output mode)
int prevHeight; // height of previous page int prevHeight; // height of previous page
...@@ -394,6 +410,10 @@ private: ...@@ -394,6 +410,10 @@ private:
void *underlayCbkData; void *underlayCbkData;
void (*overlayCbk)(PSOutputDev *psOut, void *data); void (*overlayCbk)(PSOutputDev *psOut, void *data);
void *overlayCbkData; void *overlayCbkData;
GooString *(*customCodeCbk)(PSOutputDev *psOut,
PSOutCustomCodeLocation loc, int n,
void *data);
void *customCodeCbkData;
PDFDoc *doc; PDFDoc *doc;
XRef *xref; // the xref table for this PDF file XRef *xref; // the xref table for this PDF file
...@@ -402,15 +422,9 @@ private: ...@@ -402,15 +422,9 @@ private:
int fontIDLen; // number of entries in fontIDs array int fontIDLen; // number of entries in fontIDs array
int fontIDSize; // size of fontIDs array int fontIDSize; // size of fontIDs array
GooHash *fontNames; // all used font names GooHash *fontNames; // all used font names
Ref *fontFileIDs; // list of object IDs of all embedded fonts PST1FontName *t1FontNames; // font names for Type 1/1C fonts
int fontFileIDLen; // number of entries in fontFileIDs array int t1FontNameLen; // number of entries in t1FontNames array
int fontFileIDSize; // size of fontFileIDs array int t1FontNameSize; // size of t1FontNames array
GooString **fontFileNames; // list of names of all embedded external fonts
GooString **psFileNames; // list of names of all embedded external fonts
int fontFileNameLen; // number of entries in fontFileNames array
int fontFileNameSize; // size of fontFileNames array
int nextTrueTypeNum; // next unique number to append to a TrueType
// font name
PSFont8Info *font8Info; // info for 8-bit fonts PSFont8Info *font8Info; // info for 8-bit fonts
int font8InfoLen; // number of entries in font8Info array int font8InfoLen; // number of entries in font8Info array
int font8InfoSize; // size of font8Info array int font8InfoSize; // size of font8Info array
...@@ -429,6 +443,8 @@ private: ...@@ -429,6 +443,8 @@ private:
int numTilingPatterns; // current number of nested tiling patterns int numTilingPatterns; // current number of nested tiling patterns
int nextFunc; // next unique number to use for a function int nextFunc; // next unique number to use for a function
GooList *paperSizes; // list of used paper sizes, if paperMatch
// is true [PSOutPaperSize]
double tx0, ty0; // global translation double tx0, ty0; // global translation
double xScale0, yScale0; // global scaling double xScale0, yScale0; // global scaling
int rotate0; // rotation angle (0, 90, 180, 270) int rotate0; // rotation angle (0, 90, 180, 270)
...@@ -453,9 +469,9 @@ private: ...@@ -453,9 +469,9 @@ private:
GooString *t3String; // Type 3 content string GooString *t3String; // Type 3 content string
double t3WX, t3WY, // Type 3 character parameters double t3WX, t3WY, // Type 3 character parameters
t3LLX, t3LLY, t3URX, t3URY; t3LLX, t3LLY, t3URX, t3URY;
GBool t3FillColorOnly; // operators should only use the fill color
GBool t3Cacheable; // cleared if char is not cacheable GBool t3Cacheable; // cleared if char is not cacheable
GBool t3NeedsRestore; // set if a 'q' operator was issued 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 displayText; // displayText
#if OPI_SUPPORT #if OPI_SUPPORT
...@@ -465,7 +481,6 @@ private: ...@@ -465,7 +481,6 @@ private:
GBool ok; // set up ok? GBool ok; // set up ok?
friend class WinPDFPrinter; friend class WinPDFPrinter;
}; };
......
...@@ -59,10 +59,11 @@ Parser::~Parser() { ...@@ -59,10 +59,11 @@ Parser::~Parser() {
Object *Parser::getObj(Object *obj, int recursion) Object *Parser::getObj(Object *obj, int recursion)
{ {
return getObj(obj, NULL, cryptRC4, 0, 0, 0, recursion); return getObj(obj, gFalse, NULL, cryptRC4, 0, 0, 0, recursion);
} }
Object *Parser::getObj(Object *obj, Guchar *fileKey, Object *Parser::getObj(Object *obj, GBool simpleOnly,
Guchar *fileKey,
CryptAlgorithm encAlgorithm, int keyLength, CryptAlgorithm encAlgorithm, int keyLength,
int objNum, int objGen, int recursion) { int objNum, int objGen, int recursion) {
char *key; char *key;
...@@ -83,18 +84,18 @@ Object *Parser::getObj(Object *obj, Guchar *fileKey, ...@@ -83,18 +84,18 @@ Object *Parser::getObj(Object *obj, Guchar *fileKey,
} }
// array // array
if (likely(recursion < recursionLimit) && buf1.isCmd("[")) { if (!simpleOnly && likely(recursion < recursionLimit) && buf1.isCmd("[")) {
shift(); shift();
obj->initArray(xref); obj->initArray(xref);
while (!buf1.isCmd("]") && !buf1.isEOF()) while (!buf1.isCmd("]") && !buf1.isEOF())
obj->arrayAdd(getObj(&obj2, fileKey, encAlgorithm, keyLength, obj->arrayAdd(getObj(&obj2, gFalse, fileKey, encAlgorithm, keyLength,
objNum, objGen, recursion + 1)); objNum, objGen, recursion + 1));
if (buf1.isEOF()) if (buf1.isEOF())
error(errSyntaxError, getPos(), "End of file inside array"); error(errSyntaxError, getPos(), "End of file inside array");
shift(); shift();
// dictionary or stream // dictionary or stream
} else if (likely(recursion < recursionLimit) && buf1.isCmd("<<")) { } else if (!simpleOnly && likely(recursion < recursionLimit) && buf1.isCmd("<<")) {
shift(objNum); shift(objNum);
obj->initDict(xref); obj->initDict(xref);
while (!buf1.isCmd(">>") && !buf1.isEOF()) { while (!buf1.isCmd(">>") && !buf1.isEOF()) {
...@@ -109,7 +110,7 @@ Object *Parser::getObj(Object *obj, Guchar *fileKey, ...@@ -109,7 +110,7 @@ Object *Parser::getObj(Object *obj, Guchar *fileKey,
gfree(key); gfree(key);
break; break;
} }
obj->dictAdd(key, getObj(&obj2, fileKey, encAlgorithm, keyLength, objNum, objGen, recursion + 1)); obj->dictAdd(key, getObj(&obj2, gFalse, fileKey, encAlgorithm, keyLength, objNum, objGen, recursion + 1));
} }
} }
if (buf1.isEOF()) if (buf1.isEOF())
......
...@@ -42,8 +42,11 @@ public: ...@@ -42,8 +42,11 @@ public:
// Destructor. // Destructor.
~Parser(); ~Parser();
// Get the next object from the input stream. // Get the next object from the input stream. If <simpleOnly> is
Object *getObj(Object *obj, Guchar *fileKey = NULL, // true, do not parse compound objects (arrays, dictionaries, or
// streams).
Object *getObj(Object *obj, GBool simpleOnly = gFalse,
Guchar *fileKey = NULL,
CryptAlgorithm encAlgorithm = cryptRC4, int keyLength = 0, CryptAlgorithm encAlgorithm = cryptRC4, int keyLength = 0,
int objNum = 0, int objGen = 0, int recursion = 0); int objNum = 0, int objGen = 0, int recursion = 0);
......
...@@ -95,6 +95,46 @@ GBool PreScanOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *ca ...@@ -95,6 +95,46 @@ GBool PreScanOutputDev::tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *ca
return gTrue; return gTrue;
} }
GBool PreScanOutputDev::functionShadedFill(GfxState *state,
GfxFunctionShading *shading) {
if (shading->getColorSpace()->getMode() != csDeviceGray &&
shading->getColorSpace()->getMode() != csCalGray) {
gray = gFalse;
}
mono = gFalse;
if (state->getFillOpacity() != 1 ||
state->getBlendMode() != gfxBlendNormal) {
transparency = gTrue;
}
return gTrue;
}
GBool PreScanOutputDev::axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) {
if (shading->getColorSpace()->getMode() != csDeviceGray &&
shading->getColorSpace()->getMode() != csCalGray) {
gray = gFalse;
}
mono = gFalse;
if (state->getFillOpacity() != 1 ||
state->getBlendMode() != gfxBlendNormal) {
transparency = gTrue;
}
return gTrue;
}
GBool PreScanOutputDev::radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) {
if (shading->getColorSpace()->getMode() != csDeviceGray &&
shading->getColorSpace()->getMode() != csCalGray) {
gray = gFalse;
}
mono = gFalse;
if (state->getFillOpacity() != 1 ||
state->getBlendMode() != gfxBlendNormal) {
transparency = gTrue;
}
return gTrue;
}
void PreScanOutputDev::clip(GfxState * /*state*/) { void PreScanOutputDev::clip(GfxState * /*state*/) {
//~ check for a rectangle "near" the edge of the page; //~ check for a rectangle "near" the edge of the page;
//~ else set gdi to false //~ else set gdi to false
...@@ -161,7 +201,7 @@ void PreScanOutputDev::drawImageMask(GfxState *state, Object * /*ref*/, Stream * ...@@ -161,7 +201,7 @@ void PreScanOutputDev::drawImageMask(GfxState *state, Object * /*ref*/, Stream *
gdi = gFalse;