X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=sidebyside;f=pdf%2Fxpdf%2FPSOutputDev.h;h=f7896ccc73963df346f7f54310997c1e5e80f4bd;hb=884f739665dc56e66f51e104350f2affd33f2dd8;hp=d23d19eeb785cfd8fc8cd0d20b45536cbcb817dd;hpb=7aac8dc8533347e21311b15186e0af82f1b22fd6;p=evince.git diff --git a/pdf/xpdf/PSOutputDev.h b/pdf/xpdf/PSOutputDev.h index d23d19ee..f7896ccc 100644 --- a/pdf/xpdf/PSOutputDev.h +++ b/pdf/xpdf/PSOutputDev.h @@ -2,65 +2,62 @@ // // PSOutputDev.h // -// Copyright 1996 Derek B. Noonburg +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== #ifndef PSOUTPUTDEV_H #define PSOUTPUTDEV_H -#ifdef __GNUC__ +#include + +#ifdef USE_GCC_PRAGMAS #pragma interface #endif #include #include "config.h" #include "Object.h" +#include "GlobalParams.h" #include "OutputDev.h" class GfxPath; class GfxFont; class GfxColorSpace; - -//------------------------------------------------------------------------ -// Parameters -//------------------------------------------------------------------------ - -// Generate Level 1 PostScript? -extern GBool psOutLevel1; - -// Generate Level 1 separable PostScript? -extern GBool psOutLevel1Sep; - -// Generate Encapsulated PostScript? -extern GBool psOutEPS; - -#if OPI_SUPPORT -// Generate OPI comments? -extern GBool psOutOPI; -#endif - -// Paper size. -extern int paperWidth; -extern int paperHeight; +class GfxSeparationColorSpace; +struct PSFont16Enc; +class PSOutCustomColor; //------------------------------------------------------------------------ // PSOutputDev //------------------------------------------------------------------------ +enum PSOutMode { + psModePS, + psModeEPS, + psModeForm +}; + enum PSFileType { psFile, // write to file psPipe, // write to pipe - psStdout // write to stdout + psStdout, // write to stdout + psGeneric // write to a generic stream }; +typedef void (*PSOutputFunc)(void *stream, char *data, int len); + class PSOutputDev: public OutputDev { public: // Open a PostScript output file, and write the prolog. - PSOutputDev(char *fileName, Catalog *catalog, - int firstPage, int lastPage, - GBool embedType11, GBool doForm1); + PSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog, + int firstPage, int lastPage, PSOutMode modeA); + + // Open a PSOutputDev that will write to a generic stream. + PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, + XRef *xrefA, Catalog *catalog, + int firstPage, int lastPage, PSOutMode modeA); // Destructor -- writes the trailer and closes the file. virtual ~PSOutputDev(); @@ -77,6 +74,10 @@ public: // Does this device use drawChar() or drawString()? virtual GBool useDrawChar() { return gFalse; } + // Does this device use beginType3Char/endType3Char? Otherwise, + // text in Type 3 fonts will be drawn with drawChar/drawString. + virtual GBool interpretType3Chars() { return gFalse; } + //----- initialization and control // Start a page. @@ -123,7 +124,6 @@ public: //----- text drawing virtual void drawString(GfxState *state, GString *s); - virtual void drawString16(GfxState *state, GString *s); //----- image drawing virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, @@ -131,7 +131,7 @@ public: GBool inlineImg); virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, - GBool inlineImg); + int *maskColors, GBool inlineImg); #if OPI_SUPPORT //----- OPI functions @@ -139,16 +139,35 @@ public: virtual void opiEnd(GfxState *state, Dict *opiDict); #endif + //----- Type 3 font operators + virtual void type3D0(GfxState *state, double wx, double wy); + virtual void type3D1(GfxState *state, double wx, double wy, + double llx, double lly, double urx, double ury); + + //----- PostScript XObjects + virtual void psXObject(Stream *psStream, Stream *level1Stream); + + private: + void init(PSOutputFunc outputFuncA, void *outputStreamA, + PSFileType fileTypeA, XRef *xrefA, Catalog *catalog, + int firstPage, int lastPage, PSOutMode modeA); void setupResources(Dict *resDict); void setupFonts(Dict *resDict); - void setupFont(GfxFont *font); + void setupFont(GfxFont *font, Dict *parentResDict); void setupEmbeddedType1Font(Ref *id, char *psName); - void setupEmbeddedType1Font(GString *fileName, char *psName); + void setupExternalType1Font(GString *fileName, char *psName); void setupEmbeddedType1CFont(GfxFont *font, Ref *id, char *psName); + void setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id, char *psName); + void setupExternalTrueTypeFont(GfxFont *font, char *psName); + void setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, char *psName); + void setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, char *psName); + void setupType3Font(GfxFont *font, char *psName, Dict *parentResDict); void setupImages(Dict *resDict); void setupImage(Ref id, Stream *str); + void addProcessColor(double c, double m, double y, double k); + void addCustomColor(GfxSeparationColorSpace *sepCS); void doPath(GfxPath *path); void doImageL1(GfxImageColorMap *colorMap, GBool invert, GBool inlineImg, @@ -160,21 +179,32 @@ private: GBool invert, GBool inlineImg, Stream *str, int width, int height, int len); void dumpColorSpaceL2(GfxColorSpace *colorSpace); +#if OPI_SUPPORT void opiBegin20(GfxState *state, Dict *dict); void opiBegin13(GfxState *state, Dict *dict); void opiTransform(GfxState *state, double x0, double y0, double *x1, double *y1); GBool getFileSpec(Object *fileSpec, Object *fileName); - void writePS(const char *fmt, ...); +#endif + void writePSChar(char c); + void writePS(char *s); + void writePSFmt(const char *fmt, ...); void writePSString(GString *s); + void writePSName(char *s); + GString *filterPSName(GString *name); - GBool embedType1; // embed Type 1 fonts? - GBool doForm; // generate a form? + PSLevel level; // PostScript level (1, 2, separation) + PSOutMode mode; // PostScript mode (PS, EPS, form) + int paperWidth; // width of paper, in pts + int paperHeight; // height of paper, in pts - FILE *f; // PostScript file + PSOutputFunc outputFunc; + void *outputStream; PSFileType fileType; // file / pipe / stdout int seqPage; // current sequential page number + XRef *xref; // the xref table for this PDF file + Ref *fontIDs; // list of object IDs of all used fonts int fontIDLen; // number of entries in fontIDs array int fontIDSize; // size of fontIDs array @@ -184,6 +214,11 @@ private: GString **fontFileNames; // list of names of all embedded external fonts int fontFileNameLen; // number of entries in fontFileNames array int fontFileNameSize; // size of fontFileNames array + PSFont16Enc *font16Enc; // encodings for substitute 16-bit fonts + int font16EncLen; // number of entries in font16Enc array + int font16EncSize; // size of font16Enc array + GList *xobjStack; // stack of XObject dicts currently being + // processed double tx, ty; // global translation double xScale, yScale; // global scaling @@ -191,14 +226,23 @@ private: GString *embFontList; // resource comments for embedded fonts + int processColors; // used process colors + PSOutCustomColor // used custom colors + *customColors; + + GBool inType3Char; // inside a Type 3 CharProc + GString *t3String; // Type 3 content string + double t3WX, t3WY, // Type 3 character parameters + t3LLX, t3LLY, t3URX, t3URY; + GBool t3Cacheable; // cleared if char is not cacheable + #if OPI_SUPPORT int opi13Nest; // nesting level of OPI 1.3 objects int opi20Nest; // nesting level of OPI 2.0 objects #endif - GBool type3Warning; // only show the Type 3 font warning once - GBool ok; // set up ok? + }; #endif