Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-10 10:23:50

0001 //========================================================================
0002 //
0003 // PSOutputDev.h
0004 //
0005 // Copyright 1996-2003 Glyph & Cog, LLC
0006 //
0007 //========================================================================
0008 
0009 //========================================================================
0010 //
0011 // Modified under the Poppler project - http://poppler.freedesktop.org
0012 //
0013 // All changes made under the Poppler project to this file are licensed
0014 // under GPL version 2 or later
0015 //
0016 // Copyright (C) 2005 Martin Kretzschmar <martink@gnome.org>
0017 // Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
0018 // Copyright (C) 2006-2008, 2012, 2013, 2015, 2017-2022 Albert Astals Cid <aacid@kde.org>
0019 // Copyright (C) 2007 Brad Hards <bradh@kde.org>
0020 // Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
0021 // Copyright (C) 2009 Till Kamppeter <till.kamppeter@gmail.com>
0022 // Copyright (C) 2009 Carlos Garcia Campos <carlosgc@gnome.org>
0023 // Copyright (C) 2009, 2011, 2015-2017, 2020 William Bader <williambader@hotmail.com>
0024 // Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
0025 // Copyright (C) 2011, 2014, 2017, 2020 Adrian Johnson <ajohnson@redneon.com>
0026 // Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
0027 // Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, <info@kdab.com>. Work sponsored by the LiMux project of the city of Munich
0028 // Copyright (C) 2018 Adam Reichold <adam.reichold@t-online.de>
0029 // Copyright (C) 2018, 2020 Philipp Knechtges <philipp-dev@knechtges.com>
0030 // Copyright (C) 2019, 2023 Oliver Sander <oliver.sander@tu-dresden.de>
0031 // Copyright (C) 2021 Hubert Figuiere <hub@figuiere.net>
0032 // Copyright (C) 2021 Christian Persch <chpe@src.gnome.org>
0033 //
0034 // To see a description of the changes please see the Changelog file that
0035 // came with your tarball or type make ChangeLog if you are building from git
0036 //
0037 //========================================================================
0038 
0039 #ifndef PSOUTPUTDEV_H
0040 #define PSOUTPUTDEV_H
0041 
0042 #include "poppler-config.h"
0043 #include "poppler_private_export.h"
0044 #include <cstddef>
0045 #include "Object.h"
0046 #include "GfxState.h"
0047 #include "GlobalParams.h"
0048 #include "OutputDev.h"
0049 #include "fofi/FoFiBase.h"
0050 #include <set>
0051 #include <map>
0052 #include <vector>
0053 #include <unordered_set>
0054 #include <unordered_map>
0055 #include <string>
0056 
0057 #include "splash/Splash.h"
0058 
0059 class PDFDoc;
0060 class XRef;
0061 class Function;
0062 class GfxPath;
0063 class GfxFont;
0064 class GfxColorSpace;
0065 class GfxSeparationColorSpace;
0066 class PDFRectangle;
0067 struct PST1FontName;
0068 struct PSFont8Info;
0069 struct PSFont16Enc;
0070 class PSOutCustomColor;
0071 struct PSOutPaperSize;
0072 class PSOutputDev;
0073 
0074 //------------------------------------------------------------------------
0075 // PSOutputDev
0076 //------------------------------------------------------------------------
0077 
0078 enum PSLevel
0079 {
0080     psLevel1,
0081     psLevel1Sep,
0082     psLevel2,
0083     psLevel2Sep,
0084     psLevel3,
0085     psLevel3Sep
0086 };
0087 
0088 enum PSOutMode
0089 {
0090     psModePS,
0091     psModeEPS,
0092     psModeForm
0093 };
0094 
0095 enum PSFileType
0096 {
0097     psFile, // write to file
0098     psPipe, // write to pipe
0099     psStdout, // write to stdout
0100     psGeneric // write to a generic stream
0101 };
0102 
0103 enum PSOutCustomCodeLocation
0104 {
0105     psOutCustomDocSetup,
0106     psOutCustomPageSetup
0107 };
0108 
0109 enum PSForceRasterize
0110 {
0111     psRasterizeWhenNeeded, // default
0112     psAlwaysRasterize, // always rasterize, useful for testing
0113     psNeverRasterize // never rasterize, may produce incorrect output
0114 };
0115 
0116 typedef GooString *(*PSOutCustomCodeCbk)(PSOutputDev *psOut, PSOutCustomCodeLocation loc, int n, void *data);
0117 
0118 class POPPLER_PRIVATE_EXPORT PSOutputDev : public OutputDev
0119 {
0120 public:
0121     // Open a PostScript output file, and write the prolog.
0122     // pages has to be sorted in increasing order
0123     PSOutputDev(const char *fileName, PDFDoc *docA, char *psTitleA, const std::vector<int> &pages, PSOutMode modeA, int paperWidthA = -1, int paperHeightA = -1, bool noCrop = false, bool duplexA = true, int imgLLXA = 0, int imgLLYA = 0,
0124                 int imgURXA = 0, int imgURYA = 0, PSForceRasterize forceRasterizeA = psRasterizeWhenNeeded, bool manualCtrlA = false, PSOutCustomCodeCbk customCodeCbkA = nullptr, void *customCodeCbkDataA = nullptr,
0125                 PSLevel levelA = psLevel2);
0126 
0127     // Open a PSOutputDev that will write to a file descriptor
0128     PSOutputDev(int fdA, PDFDoc *docA, char *psTitleA, const std::vector<int> &pages, PSOutMode modeA, int paperWidthA = -1, int paperHeightA = -1, bool noCrop = false, bool duplexA = true, int imgLLXA = 0, int imgLLYA = 0, int imgURXA = 0,
0129                 int imgURYA = 0, PSForceRasterize forceRasterizeA = psRasterizeWhenNeeded, bool manualCtrlA = false, PSOutCustomCodeCbk customCodeCbkA = nullptr, void *customCodeCbkDataA = nullptr, PSLevel levelA = psLevel2);
0130 
0131     // Open a PSOutputDev that will write to a generic stream.
0132     // pages has to be sorted in increasing order
0133     PSOutputDev(FoFiOutputFunc outputFuncA, void *outputStreamA, char *psTitleA, PDFDoc *docA, const std::vector<int> &pages, PSOutMode modeA, int paperWidthA = -1, int paperHeightA = -1, bool noCrop = false, bool duplexA = true,
0134                 int imgLLXA = 0, int imgLLYA = 0, int imgURXA = 0, int imgURYA = 0, PSForceRasterize forceRasterizeA = psRasterizeWhenNeeded, bool manualCtrlA = false, PSOutCustomCodeCbk customCodeCbkA = nullptr,
0135                 void *customCodeCbkDataA = nullptr, PSLevel levelA = psLevel2);
0136 
0137     // Destructor -- writes the trailer and closes the file.
0138     ~PSOutputDev() override;
0139 
0140     // Check if file was successfully created.
0141     virtual bool isOk() { return ok; }
0142 
0143     //---- get info about output device
0144 
0145     // Does this device use upside-down coordinates?
0146     // (Upside-down means (0,0) is the top left corner of the page.)
0147     bool upsideDown() override { return false; }
0148 
0149     // Does this device use drawChar() or drawString()?
0150     bool useDrawChar() override { return false; }
0151 
0152     // Does this device use tilingPatternFill()?  If this returns false,
0153     // tiling pattern fills will be reduced to a series of other drawing
0154     // operations.
0155     bool useTilingPatternFill() override { return true; }
0156 
0157     // Does this device use functionShadedFill(), axialShadedFill(), and
0158     // radialShadedFill()?  If this returns false, these shaded fills
0159     // will be reduced to a series of other drawing operations.
0160     bool useShadedFills(int type) override { return (type < 4 && level >= psLevel2) || (type == 7 && level >= psLevel3); }
0161 
0162     // Does this device use drawForm()?  If this returns false,
0163     // form-type XObjects will be interpreted (i.e., unrolled).
0164     bool useDrawForm() override { return preloadImagesForms; }
0165 
0166     // Does this device use beginType3Char/endType3Char?  Otherwise,
0167     // text in Type 3 fonts will be drawn with drawChar/drawString.
0168     bool interpretType3Chars() override { return false; }
0169 
0170     bool needClipToCropBox() override { return mode == psModeEPS; }
0171 
0172     //----- header/trailer (used only if manualCtrl is true)
0173 
0174     // Write the document-level header.
0175     void writeHeader(int nPages, const PDFRectangle *mediaBox, const PDFRectangle *cropBox, int pageRotate, const char *title);
0176 
0177     // Write the Xpdf procset.
0178     void writeXpdfProcset();
0179 
0180     // Write the trailer for the current page.
0181     void writePageTrailer();
0182 
0183     // Write the document trailer.
0184     void writeTrailer();
0185 
0186     //----- initialization and control
0187 
0188     // Check to see if a page slice should be displayed.  If this
0189     // returns false, the page display is aborted.  Typically, an
0190     // OutputDev will use some alternate means to display the page
0191     // before returning false.
0192     bool checkPageSlice(Page *page, double hDPI, double vDPI, int rotate, bool useMediaBox, bool crop, int sliceX, int sliceY, int sliceW, int sliceH, bool printing, bool (*abortCheckCbk)(void *data) = nullptr,
0193                         void *abortCheckCbkData = nullptr, bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr, void *annotDisplayDecideCbkData = nullptr) override;
0194 
0195     // Start a page.
0196     void startPage(int pageNum, GfxState *state, XRef *xref) override;
0197 
0198     // End a page.
0199     void endPage() override;
0200 
0201     //----- save/restore graphics state
0202     void saveState(GfxState *state) override;
0203     void restoreState(GfxState *state) override;
0204 
0205     //----- update graphics state
0206     void updateCTM(GfxState *state, double m11, double m12, double m21, double m22, double m31, double m32) override;
0207     void updateLineDash(GfxState *state) override;
0208     void updateFlatness(GfxState *state) override;
0209     void updateLineJoin(GfxState *state) override;
0210     void updateLineCap(GfxState *state) override;
0211     void updateMiterLimit(GfxState *state) override;
0212     void updateLineWidth(GfxState *state) override;
0213     void updateFillColorSpace(GfxState *state) override;
0214     void updateStrokeColorSpace(GfxState *state) override;
0215     void updateFillColor(GfxState *state) override;
0216     void updateStrokeColor(GfxState *state) override;
0217     void updateFillOverprint(GfxState *state) override;
0218     void updateStrokeOverprint(GfxState *state) override;
0219     void updateOverprintMode(GfxState *state) override;
0220     void updateTransfer(GfxState *state) override;
0221 
0222     //----- update text state
0223     void updateFont(GfxState *state) override;
0224     void updateTextMat(GfxState *state) override;
0225     void updateCharSpace(GfxState *state) override;
0226     void updateRender(GfxState *state) override;
0227     void updateRise(GfxState *state) override;
0228     void updateWordSpace(GfxState *state) override;
0229     void updateHorizScaling(GfxState *state) override;
0230     void updateTextPos(GfxState *state) override;
0231     void updateTextShift(GfxState *state, double shift) override;
0232     void saveTextPos(GfxState *state) override;
0233     void restoreTextPos(GfxState *state) override;
0234 
0235     //----- path painting
0236     void stroke(GfxState *state) override;
0237     void fill(GfxState *state) override;
0238     void eoFill(GfxState *state) override;
0239     bool tilingPatternFill(GfxState *state, Gfx *gfx, Catalog *cat, GfxTilingPattern *tPat, const double *mat, int x0, int y0, int x1, int y1, double xStep, double yStep) override;
0240     bool functionShadedFill(GfxState *state, GfxFunctionShading *shading) override;
0241     bool axialShadedFill(GfxState *state, GfxAxialShading *shading, double /*tMin*/, double /*tMax*/) override;
0242     bool radialShadedFill(GfxState *state, GfxRadialShading *shading, double /*sMin*/, double /*sMax*/) override;
0243     bool patchMeshShadedFill(GfxState *state, GfxPatchMeshShading *shading) override;
0244 
0245     //----- path clipping
0246     void clip(GfxState *state) override;
0247     void eoClip(GfxState *state) override;
0248     void clipToStrokePath(GfxState *state) override;
0249 
0250     //----- text drawing
0251     void drawString(GfxState *state, const GooString *s) override;
0252     void beginTextObject(GfxState *state) override;
0253     void endTextObject(GfxState *state) override;
0254 
0255     //----- image drawing
0256     void drawImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool interpolate, bool inlineImg) override;
0257     void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str, int width, int height, bool invert, bool inlineImg, double *baseMatrix) override;
0258     void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override;
0259     void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, const int *maskColors, bool inlineImg) override;
0260     void drawMaskedImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, bool interpolate, Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert, bool maskInterpolate) override;
0261 
0262 #ifdef OPI_SUPPORT
0263     //----- OPI functions
0264     void opiBegin(GfxState *state, Dict *opiDict) override;
0265     void opiEnd(GfxState *state, Dict *opiDict) override;
0266 #endif
0267 
0268     //----- Type 3 font operators
0269     void type3D0(GfxState *state, double wx, double wy) override;
0270     void type3D1(GfxState *state, double wx, double wy, double llx, double lly, double urx, double ury) override;
0271 
0272     //----- form XObjects
0273     void drawForm(Ref ref) override;
0274 
0275     //----- PostScript XObjects
0276     void psXObject(Stream *psStream, Stream *level1Stream) override;
0277 
0278     //----- miscellaneous
0279     void setOffset(double x, double y)
0280     {
0281         tx0 = x;
0282         ty0 = y;
0283     }
0284     void setScale(double x, double y)
0285     {
0286         xScale0 = x;
0287         yScale0 = y;
0288     }
0289     void setRotate(int rotateA) { rotate0 = rotateA; }
0290     void setClip(double llx, double lly, double urx, double ury)
0291     {
0292         clipLLX0 = llx;
0293         clipLLY0 = lly;
0294         clipURX0 = urx;
0295         clipURY0 = ury;
0296     }
0297     void setUnderlayCbk(void (*cbk)(PSOutputDev *psOut, void *data), void *data)
0298     {
0299         underlayCbk = cbk;
0300         underlayCbkData = data;
0301     }
0302     void setOverlayCbk(void (*cbk)(PSOutputDev *psOut, void *data), void *data)
0303     {
0304         overlayCbk = cbk;
0305         overlayCbkData = data;
0306     }
0307     void setDisplayText(bool display) { displayText = display; }
0308 
0309     void setPSCenter(bool center) { psCenter = center; }
0310     void setPSExpandSmaller(bool expand) { psExpandSmaller = expand; }
0311     void setPSShrinkLarger(bool shrink) { psShrinkLarger = shrink; }
0312     void setOverprintPreview(bool overprintPreviewA) { overprintPreview = overprintPreviewA; }
0313     void setRasterAntialias(bool a) { rasterAntialias = a; }
0314     void setForceRasterize(PSForceRasterize f) { forceRasterize = f; }
0315     void setRasterResolution(double r) { rasterResolution = r; }
0316     void setRasterMono(bool b)
0317     {
0318         processColorFormat = splashModeMono8;
0319         processColorFormatSpecified = true;
0320     }
0321 
0322     void setUncompressPreloadedImages(bool b) { uncompressPreloadedImages = b; }
0323 
0324     bool getEmbedType1() const { return embedType1; }
0325     bool getEmbedTrueType() const { return embedTrueType; }
0326     bool getEmbedCIDPostScript() const { return embedCIDPostScript; }
0327     bool getEmbedCIDTrueType() const { return embedCIDTrueType; }
0328     bool getFontPassthrough() const { return fontPassthrough; }
0329     bool getOptimizeColorSpace() const { return optimizeColorSpace; }
0330     bool getPassLevel1CustomColor() const { return passLevel1CustomColor; }
0331     bool getEnableLZW() const { return enableLZW; };
0332     bool getEnableFlate() const
0333 #ifdef ENABLE_ZLIB
0334     {
0335         return enableFlate;
0336     }
0337 #else
0338     {
0339         return false;
0340     }
0341 #endif
0342     void setEmbedType1(bool b) { embedType1 = b; }
0343     void setEmbedTrueType(bool b) { embedTrueType = b; }
0344     void setEmbedCIDPostScript(bool b) { embedCIDPostScript = b; }
0345     void setEmbedCIDTrueType(bool b) { embedCIDTrueType = b; }
0346     void setFontPassthrough(bool b) { fontPassthrough = b; }
0347     void setOptimizeColorSpace(bool b) { optimizeColorSpace = b; }
0348     void setPassLevel1CustomColor(bool b) { passLevel1CustomColor = b; }
0349     void setPreloadImagesForms(bool b) { preloadImagesForms = b; }
0350     void setGenerateOPI(bool b) { generateOPI = b; }
0351     void setUseASCIIHex(bool b) { useASCIIHex = b; }
0352     void setUseBinary(bool b) { useBinary = b; }
0353     void setEnableLZW(bool b) { enableLZW = b; }
0354     void setEnableFlate(bool b) { enableFlate = b; }
0355 
0356     void setProcessColorFormat(SplashColorMode format)
0357     {
0358         processColorFormat = format;
0359         processColorFormatSpecified = true;
0360     }
0361 
0362 private:
0363     void init(FoFiOutputFunc outputFuncA, void *outputStreamA, PSFileType fileTypeA, char *psTitleA, PDFDoc *doc, const std::vector<int> &pages, PSOutMode modeA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, bool manualCtrlA,
0364               int paperWidthA, int paperHeightA, bool noCropA, bool duplexA, PSLevel levelA);
0365     void postInit();
0366     void setupResources(Dict *resDict);
0367     void setupFonts(Dict *resDict);
0368     void setupFont(GfxFont *font, Dict *parentResDict);
0369     void setupEmbeddedType1Font(Ref *id, GooString *psName);
0370     void updateFontMaxValidGlyph(GfxFont *font, int maxValidGlyph);
0371     void setupExternalType1Font(const GooString *fileName, GooString *psName);
0372     void setupEmbeddedType1CFont(GfxFont *font, Ref *id, GooString *psName);
0373     void setupEmbeddedOpenTypeT1CFont(GfxFont *font, Ref *id, GooString *psName);
0374     void setupEmbeddedTrueTypeFont(GfxFont *font, Ref *id, GooString *psName);
0375     void setupExternalTrueTypeFont(GfxFont *font, const GooString *fileName, GooString *psName);
0376     void setupEmbeddedCIDType0Font(GfxFont *font, Ref *id, GooString *psName);
0377     void setupEmbeddedCIDTrueTypeFont(GfxFont *font, Ref *id, GooString *psName, bool needVerticalMetrics);
0378     void setupExternalCIDTrueTypeFont(GfxFont *font, const GooString *fileName, GooString *psName, bool needVerticalMetrics);
0379     void setupEmbeddedOpenTypeCFFFont(GfxFont *font, Ref *id, GooString *psName);
0380     void setupType3Font(GfxFont *font, GooString *psName, Dict *parentResDict);
0381     GooString *makePSFontName(GfxFont *font, const Ref *id);
0382     void setupImages(Dict *resDict);
0383     void setupImage(Ref id, Stream *str, bool mask);
0384     void setupForms(Dict *resDict);
0385     void setupForm(Ref id, Object *strObj);
0386     void addProcessColor(double c, double m, double y, double k);
0387     void addCustomColor(GfxSeparationColorSpace *sepCS);
0388     void doPath(const GfxPath *path);
0389     void maskToClippingPath(Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert);
0390     void doImageL1(Object *ref, GfxImageColorMap *colorMap, bool invert, bool inlineImg, Stream *str, int width, int height, int len, const int *maskColors, Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert);
0391     void doImageL1Sep(Object *ref, GfxImageColorMap *colorMap, bool invert, bool inlineImg, Stream *str, int width, int height, int len, const int *maskColors, Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert);
0392     void doImageL2(GfxState *state, Object *ref, GfxImageColorMap *colorMap, bool invert, bool inlineImg, Stream *str, int width, int height, int len, const int *maskColors, Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert);
0393     void doImageL3(GfxState *state, Object *ref, GfxImageColorMap *colorMap, bool invert, bool inlineImg, Stream *str, int width, int height, int len, const int *maskColors, Stream *maskStr, int maskWidth, int maskHeight, bool maskInvert);
0394     void dumpColorSpaceL2(GfxState *state, GfxColorSpace *colorSpace, bool genXform, bool updateColors, bool map01);
0395     bool tilingPatternFillL1(GfxState *state, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep);
0396     bool tilingPatternFillL2(GfxState *state, Catalog *cat, Object *str, const double *pmat, int paintType, int tilingType, Dict *resDict, const double *mat, const double *bbox, int x0, int y0, int x1, int y1, double xStep, double yStep);
0397 
0398 #ifdef OPI_SUPPORT
0399     void opiBegin20(GfxState *state, Dict *dict);
0400     void opiBegin13(GfxState *state, Dict *dict);
0401     void opiTransform(GfxState *state, double x0, double y0, double *x1, double *y1);
0402 #endif
0403     void cvtFunction(const Function *func, bool invertPSFunction = false);
0404     GooString *filterPSName(const std::string &name);
0405 
0406     // Write the document-level setup.
0407     void writeDocSetup(Catalog *catalog, const std::vector<int> &pageList, bool duplexA);
0408 
0409     void writePSChar(char c);
0410     void writePS(const char *s);
0411     void writePSBuf(const char *s, int len);
0412     void writePSFmt(const char *fmt, ...);
0413     void writePSString(const std::string &s);
0414     void writePSName(const char *s);
0415     GooString *filterPSLabel(GooString *label, bool *needParens = nullptr);
0416     void writePSTextLine(const GooString *s);
0417 
0418     PSLevel level; // PostScript level (1, 2, separation)
0419     PSOutMode mode; // PostScript mode (PS, EPS, form)
0420     int paperWidth; // width of paper, in pts
0421     int paperHeight; // height of paper, in pts
0422     bool paperMatch; // true if paper size is set to match each page
0423     int prevWidth; // width of previous page
0424                    // (only psModePSOrigPageSizes output mode)
0425     int prevHeight; // height of previous page
0426                     // (only psModePSOrigPageSizes output mode)
0427     int imgLLX, imgLLY, // imageable area, in pts
0428             imgURX, imgURY;
0429     bool noCrop;
0430     bool duplex;
0431     std::vector<int> pages;
0432     char *psTitle;
0433     bool postInitDone; // true if postInit() was called
0434 
0435     FoFiOutputFunc outputFunc;
0436     void *outputStream;
0437     PSFileType fileType; // file / pipe / stdout
0438     bool manualCtrl;
0439     int seqPage; // current sequential page number
0440     void (*underlayCbk)(PSOutputDev *psOut, void *data);
0441     void *underlayCbkData;
0442     void (*overlayCbk)(PSOutputDev *psOut, void *data);
0443     void *overlayCbkData;
0444     GooString *(*customCodeCbk)(PSOutputDev *psOut, PSOutCustomCodeLocation loc, int n, void *data);
0445     void *customCodeCbkData;
0446 
0447     PDFDoc *doc;
0448     XRef *xref; // the xref table for this PDF file
0449 
0450     std::vector<Ref> fontIDs; // list of object IDs of all used fonts
0451     std::set<int> resourceIDs; // list of object IDs of objects containing Resources we've already set up
0452     std::unordered_set<std::string> fontNames; // all used font names
0453     std::unordered_map<std::string, int> perFontMaxValidGlyph; // max valid glyph of each font
0454     PST1FontName *t1FontNames; // font names for Type 1/1C fonts
0455     int t1FontNameLen; // number of entries in t1FontNames array
0456     int t1FontNameSize; // size of t1FontNames array
0457     PSFont8Info *font8Info; // info for 8-bit fonts
0458     int font8InfoLen; // number of entries in font8Info array
0459     int font8InfoSize; // size of font8Info array
0460     PSFont16Enc *font16Enc; // encodings for substitute 16-bit fonts
0461     int font16EncLen; // number of entries in font16Enc array
0462     int font16EncSize; // size of font16Enc array
0463     Ref *imgIDs; // list of image IDs for in-memory images
0464     int imgIDLen; // number of entries in imgIDs array
0465     int imgIDSize; // size of imgIDs array
0466     Ref *formIDs; // list of IDs for predefined forms
0467     int formIDLen; // number of entries in formIDs array
0468     int formIDSize; // size of formIDs array
0469     int numSaves; // current number of gsaves
0470     int numTilingPatterns; // current number of nested tiling patterns
0471     int nextFunc; // next unique number to use for a function
0472 
0473     std::vector<PSOutPaperSize *> *paperSizes; // list of used paper sizes, if paperMatch
0474                                                //   is true
0475     std::map<int, int> pagePaperSize; // page num to paperSize entry mapping
0476     double tx0, ty0; // global translation
0477     double xScale0, yScale0; // global scaling
0478     int rotate0; // rotation angle (0, 90, 180, 270)
0479     double clipLLX0, clipLLY0, clipURX0, clipURY0;
0480     double tx, ty; // global translation for current page
0481     double xScale, yScale; // global scaling for current page
0482     int rotate; // rotation angle for current page
0483     double epsX1, epsY1, // EPS bounding box (unrotated)
0484             epsX2, epsY2;
0485 
0486     GooString *embFontList; // resource comments for embedded fonts
0487 
0488     int processColors; // used process colors
0489     PSOutCustomColor // used custom colors
0490             *customColors;
0491 
0492     bool haveTextClip; // set if text has been drawn with a
0493                        //   clipping render mode
0494 
0495     bool inType3Char; // inside a Type 3 CharProc
0496     bool inUncoloredPattern; // inside a uncolored pattern (PaintType = 2)
0497     GooString *t3String; // Type 3 content string
0498     double t3WX, t3WY, // Type 3 character parameters
0499             t3LLX, t3LLY, t3URX, t3URY;
0500     bool t3FillColorOnly; // operators should only use the fill color
0501     bool t3Cacheable; // cleared if char is not cacheable
0502     bool t3NeedsRestore; // set if a 'q' operator was issued
0503     PSForceRasterize forceRasterize; // controls the rasterization of pages into images
0504     bool displayText; // displayText
0505     bool psCenter; // center pages on the paper
0506     bool psExpandSmaller = false; // expand smaller pages to fill paper
0507     bool psShrinkLarger = true; // shrink larger pages to fit paper
0508     bool overprintPreview = false; // enable overprint preview
0509     bool rasterAntialias; // antialias on rasterize
0510     bool uncompressPreloadedImages;
0511     double rasterResolution; // PostScript rasterization resolution (dpi)
0512     bool embedType1; // embed Type 1 fonts?
0513     bool embedTrueType; // embed TrueType fonts?
0514     bool embedCIDPostScript; // embed CID PostScript fonts?
0515     bool embedCIDTrueType; // embed CID TrueType fonts?
0516     bool fontPassthrough; // pass all fonts through as-is?
0517     bool optimizeColorSpace; // false to keep gray RGB images in their original color space
0518                              // true to optimize gray images to DeviceGray color space
0519     bool passLevel1CustomColor; // false to convert all custom colors to CMYK
0520                                 // true to pass custom colors
0521                                 // has effect only when doing a level1sep
0522     bool preloadImagesForms; // preload PostScript images and forms into
0523                              //   memory
0524     bool generateOPI; // generate PostScript OPI comments?
0525     bool useASCIIHex; // use ASCIIHex instead of ASCII85?
0526     bool useBinary; // use binary instead of hex
0527     bool enableLZW; // enable LZW compression
0528     bool enableFlate; // enable Flate compression
0529 
0530     SplashColorMode processColorFormat;
0531     bool processColorFormatSpecified;
0532 
0533     std::unordered_set<std::string> iccEmitted; // contains ICCBased CSAs that have been emitted
0534 
0535 #ifdef OPI_SUPPORT
0536     int opi13Nest; // nesting level of OPI 1.3 objects
0537     int opi20Nest; // nesting level of OPI 2.0 objects
0538 #endif
0539 
0540     bool ok; // set up ok?
0541     std::set<int> patternsBeingTiled; // the patterns that are being tiled
0542 
0543     friend class WinPDFPrinter;
0544 };
0545 
0546 #endif