Annotation of ntddk/src/print/pscript/pscript.h, revision 1.1

1.1     ! root        1: //--------------------------------------------------------------------------
        !             2: //
        !             3: // Module Name:  PSCRIPT.H
        !             4: //
        !             5: // Brief Description:  This module contains global defines and structures
        !             6: //                    necessary for the PSCRIPT driver.
        !             7: //
        !             8: // Author:  Kent Settle (kentse)
        !             9: // Created: 04-Nov-1991
        !            10: //
        !            11: //  27-Mar-1992 Fri 12:26:47 updated  -by-  Daniel Chou (danielc)
        !            12: //      Modified DEVDATA data structrue, changed halftone data pointer
        !            13: //
        !            14: // Copyright (c) 1991, 1992 Microsoft Corporation
        !            15: //
        !            16: //--------------------------------------------------------------------------
        !            17: 
        !            18: #include "stddef.h"
        !            19: #include "windows.h"
        !            20: #include "winddi.h"
        !            21: #include "wingdi.h"
        !            22: #include "winspool.h"
        !            23: #include "ppd.h"
        !            24: #include "pfm.h"
        !            25: #include "psproc.h"
        !            26: #include "fwall.h"
        !            27: #include "libproto.h"
        !            28: 
        !            29: //#define INDEX_PAL  // defined if we change to indexed palette.
        !            30: 
        !            31: // the default linewidth is .008 inch.
        !            32: 
        !            33: #define PSFX_DEFAULT_LINEWIDTH  LTOPSFX(576) / 1000
        !            34: 
        !            35: #define DRIVER_ID           0x44445350  // "PSDD" = driver id.
        !            36: #define PRIVATE_DEVMODE_ID  0x56495250  // "PRIV" = private data id.
        !            37: 
        !            38: #define FX_ZERO             0x00000000
        !            39: #define FX_ONEHALF          0x00000008
        !            40: #define FX_ONE              0x00000010
        !            41: #define FX_TWO              0x00000020
        !            42: #define FILLFONTLOADED      1
        !            43: #define BASEPATLOADED       2
        !            44: #define MAX_FONT_NAME       80
        !            45: #define ADOBE_FONT_UNITS    1000
        !            46: #define MAX_CLIP_RECTS      100
        !            47: #define MAX_EPS_FILE        40  // win31 compatible length.
        !            48: 
        !            49: // macro for updating pstr to point to the translation string, if
        !            50: // one exists.
        !            51: 
        !            52: #define XLATESTRING(pstr)                                           \
        !            53:     pstr = strchr(pstrSave, '/');                                   \
        !            54:     if (pstr)                                                       \
        !            55:         pstr++;                                                     \
        !            56:     else                                                            \
        !            57:         pstr = pstrSave
        !            58: 
        !            59: typedef struct _HSURFPAT    /* hsp */
        !            60: {
        !            61:     HSURF       hsurf_DENSE1;
        !            62:     HSURF       hsurf_DENSE2;
        !            63:     HSURF       hsurf_DENSE3;
        !            64:     HSURF       hsurf_DENSE4;
        !            65:     HSURF       hsurf_DENSE5;
        !            66:     HSURF       hsurf_DENSE6;
        !            67:     HSURF       hsurf_DENSE7;
        !            68:     HSURF       hsurf_DENSE8;
        !            69:     HSURF       hsurf_VERT;
        !            70:     HSURF       hsurf_HORIZ;
        !            71:     HSURF       hsurf_DIAG1;
        !            72:     HSURF       hsurf_DIAG2;
        !            73:     HSURF       hsurf_DIAG3;
        !            74:     HSURF       hsurf_DIAG4;
        !            75:     HSURF       hsurf_NOSHADE;
        !            76:     HSURF       hsurf_SOLID;
        !            77:     HSURF       hsurf_HALFTONE;
        !            78:     HSURF       hsurf_HATCH;
        !            79:     HSURF       hsurf_DIAGHATCH;
        !            80: 
        !            81: } HSURFPAT;
        !            82: 
        !            83: typedef HSURFPAT *PHSURFPAT;
        !            84: 
        !            85: typedef struct _IOCHANNEL   /* ioChannel */
        !            86: {
        !            87:     PVOID   pBuffer;            // pointer to output buffer.
        !            88:     ULONG   ulBufCount;         // buffer position holder.
        !            89: } IOCHANNEL;
        !            90: 
        !            91: typedef IOCHANNEL *PIOCHANNEL;
        !            92: 
        !            93: #define PSDEVMODE_EPS       0x01    // set if outputting EPS file.
        !            94: #define PSDEVMODE_EHANDLER  0x02    // set if outputting error handler.
        !            95: #define PSDEVMODE_MIRROR    0x04    // set if mirror image.
        !            96: #define PSDEVMODE_BLACK     0x08    // set if all colors set to black.
        !            97: #define PSDEVMODE_NEG       0x10    // set if negative image.
        !            98: #define PSDEVMODE_FONTSUBST 0x20    // set if font substitution enabled.
        !            99: 
        !           100: typedef struct
        !           101: {
        !           102:     DEVMODE         dm;
        !           103:     DWORD           dwPrivDATA;     // private data id.
        !           104:     DWORD           dwFlags;        // a bunch of flags defined above.
        !           105:     WCHAR           wstrEPSFile[MAX_EPS_FILE]; // EPS file name.
        !           106:     COLORADJUSTMENT coloradj;   // structure for halftoning.
        !           107: } PSDEVMODE;
        !           108: 
        !           109: typedef PSDEVMODE FAR *LPPSDEVMODE;
        !           110: 
        !           111: // structure for unicode <-> pscript character mapping.
        !           112: 
        !           113: typedef struct
        !           114: {
        !           115:     char   *szChar;
        !           116:     USHORT  usPSValue;    // Adobe character index.
        !           117:     USHORT  usUCValue;    // UNICODE character index.
        !           118: } UCMap, *PUCMap;
        !           119: 
        !           120: // PS_FIX will represent our internal 24.8 number type.
        !           121: 
        !           122: typedef LONG        PS_FIX;
        !           123: typedef PS_FIX     *PPS_FIX;
        !           124: 
        !           125: // font downloading struct.
        !           126: 
        !           127: typedef struct
        !           128: {
        !           129:     ULONG   iFace;      // device index for font; zero if GDI font.
        !           130:     ULONG   iUniq;      // unique number identifying realization of font.
        !           131:     DWORD   cGlyphs;    // count of HGLYPHS in phgVector.
        !           132:     HGLYPH *phgVector;  // Encoding vector.
        !           133:     CHAR    strFont[MAX_FONT_NAME]; // font name as defined in the printer.
        !           134:     PS_FIX  psfxScaleFactor;    // scale factor for this instance of font.
        !           135: } DLFONT, *PDLFONT;
        !           136: 
        !           137: // font remapping structure.
        !           138: 
        !           139: typedef struct
        !           140: {
        !           141:     struct _FREMAP *pNext;
        !           142:     DWORD           iFontID;
        !           143: } FREMAP, *PFREMAP;
        !           144: 
        !           145: // flag defines for the CGS structure.
        !           146: 
        !           147: #define CGS_PATHEXISTS      0x00000001      // set if path exists in printer.
        !           148: #define CGS_FONTREDEFINED   0x00000002      // set if font redefine sent.
        !           149: #define CGS_GEOLINEXFORM    0x00000004      // set if xform in progress.
        !           150: #define CGS_BASEPATSENT     0x00000010      // set if base pattern def sent.
        !           151: #define CGS_LATENCODED      0x00000020      // set if latin encoding defined.
        !           152: #define CGS_SYMENCODED      0x00000040      // set if sym encoding defined.
        !           153: #define CGS_DINGENCODED     0x00000080      // set if ding encoding defined.
        !           154: #define CGS_DLFONTTHRESHOLD 0x00000100      // set if font download max.
        !           155: #define CGS_EPS_PROC        0x00000200      // set if EPS procedures defined.
        !           156: 
        !           157: // current graphics state structure.
        !           158: 
        !           159: typedef struct _CGS        /* cgs */
        !           160: {
        !           161:     struct _CGS           *pcgsNext;       // next CGS pointer.
        !           162:     struct _CGS           *pcgsPrev;       // previous CGS pointer.
        !           163:     DWORD          dwFlags;        // a bunch of flags.
        !           164:     LINEATTRS       lineattrs;      // line attributes.
        !           165:     LONG            psfxLineWidth;  // actual width sent to printer.
        !           166:     ULONG          ulColor;        // Current RGB color
        !           167:     ULONG          lidFont;        // Current font ID.
        !           168:     PUCMap         pmap;           // font mapping table.
        !           169:     POINTL         ptlCurPos;
        !           170:     DWORD           cDownloadedFonts;
        !           171:     DLFONT         *pDLFonts;       // place to track downloaded fonts.
        !           172:     XFORM           FontXform;
        !           173:     FWORD           fwdEmHeight;
        !           174:     XFORM           GeoLineXform;   // geometric linewidth XFORM.
        !           175:     LONG           psfxScaleFactor;   // font point size.
        !           176:     BYTE           *pSFArray;       // BIT array for downloaded softfonts.
        !           177:     char           szFont[MAX_FONT_NAME]; // The PostScript font name
        !           178:     FREMAP          FontRemap;      // start of linked list of remapped fonts.
        !           179: } CGS;
        !           180: typedef CGS *PCGS;
        !           181: 
        !           182: // pscript driver's device brush.
        !           183: 
        !           184: typedef struct    _DEVBRUSH
        !           185: {
        !           186: #ifdef INDEX_PAL
        !           187:     ULONG           iSolidColor;
        !           188: #endif
        !           189:     SIZEL           sizlBitmap;
        !           190:     ULONG           iFormat;    // BMF_XXXX, indicates bitmap Format.
        !           191:     FLONG           flBitmap;   // BMF_TOPDOWN iff (pvBits == pvScan0)
        !           192:     ULONG           cXlate;     // count of color table entries.
        !           193:     ULONG           offsetXlate;// offset from top of struct to color table.
        !           194:     ULONG           iPatIndex;  // pattern index.
        !           195:     BYTE            ajBits[1];  // pattern bitmap.
        !           196: } DEVBRUSH;
        !           197: 
        !           198: typedef struct
        !           199: {
        !           200:     CHAR        FormName[CCHFORMNAME];
        !           201:     CHAR        PrinterForm[CCHFORMNAME];
        !           202:     RECTL       imagearea;      // imageable area rectangle in USER units.
        !           203:     SIZEL       sizlPaper;      // size of the paper in USER units.
        !           204: } CURRENTFORM;
        !           205: 
        !           206: typedef struct
        !           207: {
        !           208:     PNTFM       pntfm;
        !           209:     HANDLE      hFontRes;
        !           210: } PFMPAIR;
        !           211: 
        !           212: // PDEVDATA flag definitions
        !           213: 
        !           214: #define PDEV_COMPLETEHEADER 0x00000001  // set if complete header sent to printer.
        !           215: #define PDEV_PRINTCOLOR     0x00000002  // set if using color.
        !           216: #define PDEV_STARTDOC       0x00000004  // set if Escape(STARTDOC) called.
        !           217: #define PDEV_CANCELDOC      0x00000008  // set if EngWrite failed.
        !           218: #define PDEV_FONTREDEFINED  0x00000010  // set if font redefine sent.
        !           219: #define PDEV_LATINENCODED   0x00000020  // set if latin encoding defined.
        !           220: #define PDEV_SYMENCODED     0x00000040  // set if sym encoding defined.
        !           221: #define PDEV_DINGENCODED    0x00000080  // set if ding encoding defined.
        !           222: #define PDEV_MANUALFEED     0x00000100  // set if using manual feed.
        !           223: #define PDEV_UTILSSENT      0x00000200  // set if Utils Procset sent.
        !           224: #define PDEV_BMPPATSENT     0x00000400  // set if Pattern Bmp Procset sent.
        !           225: #define PDEV_IMAGESENT      0x00000800  // set if Image Procset sent.
        !           226: #define PDEV_PSHALFTONE     0x00001000  // set if PS is doing halftoning.
        !           227: #define PDEV_RAWDATASENT    0x00002000  // set if RAW data has been sent.
        !           228: #define PDEV_PROCSET        0x00004000  // set if procset part of header sent.
        !           229: #define PDEV_WITHINPAGE     0x00008000  // set if withing save/restore of page.
        !           230: #define PDEV_SOURCEORHACK   0x00010000  // set if doing source OR hack.
        !           231: #define PDEV_CHANGEFORM     0x00020000  // set if form change within document.
        !           232: 
        !           233: // the postscript driver's device data structure.
        !           234: 
        !           235: typedef struct _DEVDATA     /* dev */
        !           236: {
        !           237:     DWORD          dwID;               // "PSDD" = pdev id.
        !           238:     PSDEVMODE       psdm;               // DEVMODE.
        !           239:     HANDLE          hheap;              // heap handle for current pdev.
        !           240:     HANDLE          hPrinter;           // handle passed in at enablepdev time.
        !           241:     PWSTR           pwstrPPDFile;       // pointer to PPD filename.
        !           242:     PWSTR           pwstrDocName;       // pointer to document name.
        !           243:     PS_FIX          psfxScale;          // scale factor (1.0 = 100%).
        !           244:     DWORD           ScaledDPI;          // (DPI * dmScale) / 100.
        !           245:     DWORD           cCopies;            // count of copies.
        !           246:     DWORD           cPatterns;          // count of patterns.
        !           247:     HSURFPAT        hsp;                // surface handles to patterns.
        !           248:     HDEV            hdev;               // engine's handle for device.
        !           249:     HSURF           hsurf;              // our surface handle.
        !           250:     HANDLE          hpal;               // handle to our palette.
        !           251:     PNTPD           pntpd;              // pointer to printer descriptor.
        !           252:     IOCHANNEL       ioChannel;          // output channel information.
        !           253:     CGS             cgs;                // current graphics state.
        !           254:     CGS           *pcgsSave;           // pointer to gsave linked list.
        !           255:     DWORD           dwFlags;            // a bunch of flags defined above.
        !           256:     CURRENTFORM     CurForm;            // current form information.
        !           257:     DWORD           dwCurVM;            // current VM free in printer.
        !           258:     DWORD           iDLFonts;           // downloadable font threshold.
        !           259:     DWORD          iPageNumber;        // page number of current page.
        !           260:     PFMPAIR        *pfmtable;           // pointer to font metrics table.
        !           261:     WCHAR          *pTTSubstTable;      // pointer to TT font subst table.
        !           262:     WCHAR          *pTrayFormTable;     // pointer to tray-form table.
        !           263:     ULONG          cDeviceFonts;       // count of device fonts.
        !           264:     ULONG          cSoftFonts;         // count of softfonts.
        !           265:     VOID           *pvDrvHTData;        // Now device's halftone info
        !           266:     SOFTFONTENTRY  *pSFList;            // pointer to list of softfonts.
        !           267:     DWORD           dwEndPDEV;          // end of pdev signature.
        !           268: } DEVDATA;
        !           269: typedef DEVDATA *PDEVDATA;
        !           270: 
        !           271: #include "pslayer.h"
        !           272: 
        !           273: VOID FreeFont(PDEVDATA, ULONG, HANDLE, PNTFM);
        !           274: 
        !           275: 
        !           276: typedef struct
        !           277: {
        !           278:     DWORD       iFace;
        !           279:     BOOL        bFontSubstitution;
        !           280:     BOOL        bDeviceFont;
        !           281:     BOOL        bJustification;
        !           282:     POINTPSFX   ptSpace;
        !           283:     POINTPSFX   ptNonSpace;
        !           284: } TEXTDATA, *PTEXTDATA;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.