Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1124 lines
37 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. gpd.h
  5. Abstract:
  6. GPD parser specific header file
  7. Environment:
  8. Windows NT Unidrv driver
  9. Revision History:
  10. 10/15/96 -amandan-
  11. Created it.
  12. 10/22/96 -zhanw-
  13. add definition of all GPD constants
  14. 1/16/97 -zhanw-
  15. update based on the latest GPD spec
  16. --*/
  17. #ifndef _GPD_H_
  18. #define _GPD_H_
  19. #define UNUSED_ITEM 0xFFFFFFFF
  20. #define END_OF_LIST 0XFFFFFFFF
  21. #define END_SEQUENCE 0xFFFFFFFF
  22. #define MAX_THRESHOLD 0x7FFF
  23. #define HT_PATSIZE_AUTO 255
  24. //
  25. // Binary printer description filename extension
  26. //
  27. #define BUD_FILENAME_EXT TEXT(".BUD")
  28. // driver chooses 'best' GDI halftone pattern.
  29. // ---- Qualified Names Section ---- //
  30. // Note: Current practice of using the same code
  31. // to store Integers, constants, and Qualified Names
  32. // in List structures requires the QUALNAME structure
  33. // to fit inside one DWORD.
  34. typedef struct
  35. {
  36. WORD wFeatureID ;
  37. WORD wOptionID ;
  38. } QUALNAME, * PQUALNAME ;
  39. // assign this struct the tag 'qn'
  40. // ---- End of Qualified Names Section ---- //
  41. typedef DWORD LISTINDEX;
  42. //
  43. // PRINTER TYPE enumeration
  44. //
  45. typedef enum _PRINTERTYPE {
  46. PT_SERIAL,
  47. PT_PAGE,
  48. PT_TTY
  49. } PRINTERTYPE;
  50. //
  51. // OEMPRINTINGCALLBACKS enumeration
  52. //
  53. typedef enum _OEMPRINTINGCALLBACKS {
  54. OEMPC_OEMDownloadFontheader,
  55. OEMPC_OEMDownloadCharGlyph,
  56. OEMPC_OEMTTDownloadMethod,
  57. OEMPC_OEMOutputCharStr,
  58. OEMPC_OEMImageProcessing,
  59. OEMPC_OEMCompression,
  60. OEMPC_OEMHalftonePattern,
  61. OEMPC_OEMFilterGraphics
  62. } OEMPRINTINGCALLBACKS;
  63. //
  64. // define possible values for *CursorXAfterCR keyword
  65. //
  66. typedef enum _CURSORXAFTERCR {
  67. CXCR_AT_PRINTABLE_X_ORIGIN,
  68. CXCR_AT_CURSOR_X_ORIGIN
  69. } CURSORXAFTERCR;
  70. //
  71. // define values for *CursorXAfterSendBlockData keyword
  72. //
  73. typedef enum _CURSORXAFTERSENDBLOCKDATA {
  74. CXSBD_AT_GRXDATA_END,
  75. CXSBD_AT_GRXDATA_ORIGIN,
  76. CXSBD_AT_CURSOR_X_ORIGIN
  77. } CURSORXAFTERSENDBLOCKDATA;
  78. //
  79. // define values for *CursorYAfterSendBlockData keyword
  80. //
  81. typedef enum _CURSORYAFTERSENDBLOCKDATA {
  82. CYSBD_NO_MOVE,
  83. CYSBD_AUTO_INCREMENT
  84. } CURSORYAFTERSENDBLOCKDATA;
  85. //
  86. // define values for *OutputDataFormat keyword
  87. //
  88. typedef enum _OUTPUTDATAFORMAT {
  89. ODF_H_BYTE,
  90. ODF_V_BYTE
  91. } OUTPUTDATAFORMAT;
  92. //
  93. // define values for *CharPosition keyword
  94. //
  95. typedef enum _CHARPOSITION {
  96. CP_UPPERLEFT,
  97. CP_BASELINE
  98. } CHARPOSITION;
  99. //
  100. // define values for *DLSymbolSet
  101. //
  102. typedef enum _DLSYMBOLSET {
  103. DLSS_PC8,
  104. DLSS_ROMAN8
  105. } DLSYMBOLSET;
  106. //
  107. // define values for *FontFormat keyword
  108. //
  109. typedef enum _FONTFORMAT {
  110. FF_HPPCL,
  111. FF_HPPCL_RES,
  112. FF_HPPCL_OUTLINE,
  113. FF_OEM_CALLBACK
  114. } FONTFORMAT;
  115. typedef enum _CURSORXAFTERRECTFILL {
  116. CXARF_AT_RECT_X_ORIGIN,
  117. CXARF_AT_RECT_X_END
  118. } CURSORXAFTERRECTFILL;
  119. typedef enum _CURSORYAFTERRECTFILL {
  120. CYARF_AT_RECT_Y_ORIGIN,
  121. CYARF_AT_RECT_Y_END
  122. } CURSORYAFTERRECTFILL;
  123. typedef enum _RASTERMODE {
  124. RASTMODE_DIRECT,
  125. RASTMODE_INDEXED
  126. } RASTERMODE;
  127. //
  128. // GLOBAL ENTRIES
  129. // Global entries applies to the whole GPD file.
  130. // The driver creates a GLOBALS struct and the parsers initializes
  131. // it. The driver keeps a pointer to the GLOBALS struct in PDEVICE.
  132. //
  133. typedef struct _GLOBALS {
  134. //
  135. // General
  136. //
  137. PWSTR pwstrGPDSpecVersion; // "GPDSPecVersion"
  138. PWSTR pwstrGPDFileVersion; // "GPDFileVersion"
  139. POINT ptMasterUnits; // "MasterUnits"
  140. PWSTR pwstrModelName; // "ModelName"
  141. PWSTR pwstrGPDFileName; // "GPDFileName"
  142. PRINTERTYPE printertype; // "PrinterType"
  143. PWSTR pwstrIncludeFiles; // "Include"
  144. PWSTR pwstrResourceDLL; // "ResourceDLL"
  145. DWORD dwMaxCopies; // "MaxCopies"
  146. DWORD dwFontCartSlots; // "FontCartSlots"
  147. // these two fields hold a true pointer and the number of bytes of
  148. // OEM supplied binary data defined in the GPD file.
  149. PBYTE pOEMCustomData; // "OEMCustomData" location of data
  150. DWORD dwOEMCustomData; // "OEMCustomData" byte count of data
  151. BOOL bRotateCoordinate; // "RotateCoordinate"
  152. BOOL bRotateRasterData; // "RotateRaster"
  153. LISTINDEX liTextCaps; // *TextCaps, offset to a list of
  154. BOOL bRotateFont; // "RotateFont"
  155. LISTINDEX liMemoryUsage; // *MemoryUsage
  156. LISTINDEX liReselectFont; // *ReselectFont
  157. LISTINDEX liOEMPrintingCallbacks; // *OEMPrintingCallbacks
  158. //
  159. // Cursor Control related information
  160. //
  161. CURSORXAFTERCR cxaftercr; // "CursorXAfterCR"
  162. LISTINDEX liBadCursorMoveInGrxMode; // "BadCursorMoveInGrxMode"
  163. LISTINDEX liYMoveAttributes; // "YMoveAttributes"
  164. DWORD dwMaxLineSpacing; // "MaxLineSpacing"
  165. BOOL bEjectPageWithFF; // "EjectPageWithFF"
  166. BOOL bUseSpaceForXMove ; // UseSpaceForXMove?
  167. BOOL bAbsXMovesRightOnly ; // AbsXMovesRightOnly?
  168. DWORD dwXMoveThreshold; // *XMoveThreshold, never negative
  169. DWORD dwYMoveThreshold; // *YMoveThreshold, never negative
  170. POINT ptDeviceUnits; // *XMoveUnit, *YMoveUnit
  171. DWORD dwLineSpacingMoveUnit; // *LineSpacingMoveUnit
  172. //
  173. // Color related information
  174. //
  175. BOOL bChangeColorMode; // "ChangeColorModeOnPage"
  176. DWORD dwMagentaInCyanDye; // "MagentaInCyanDye"
  177. DWORD dwYellowInCyanDye; // "YellowInCyanDye"
  178. DWORD dwCyanInMagentaDye; // "CyanInMagentaDye"
  179. DWORD dwYellowInMagentaDye; // "YellowInMagentaDye"
  180. DWORD dwCyanInYellowDye; // "CyanInYellowDye"
  181. DWORD dwMagentaInYellowDye; // "MagentaInYellowDye"
  182. BOOL bEnableGDIColorMapping; // "EnableGDIColorMapping?"
  183. DWORD dwMaxNumPalettes; // "MaxNumPalettes"
  184. // the Palette entries are indicies to first item in a list.
  185. LISTINDEX liPaletteSizes; // "PaletteSizes"
  186. LISTINDEX liPaletteScope; // "PaletteScope"
  187. //
  188. // Raster related information
  189. //
  190. OUTPUTDATAFORMAT outputdataformat; // "OutputDataFormat"
  191. BOOL bOptimizeLeftBound; // *OptimizaLeftBound?
  192. LISTINDEX liStripBlanks ; // "StripBlanks"
  193. BOOL bRasterSendAllData ; // "RasterSendAllData?"
  194. CURSORXAFTERSENDBLOCKDATA cxafterblock; // "CursorXAfterSendBlockData"
  195. CURSORYAFTERSENDBLOCKDATA cyafterblock; // "CursorYAfterSendBlockData"
  196. BOOL bUseCmdSendBlockDataForColor; // "UseExpColorSelectCmd"
  197. BOOL bMoveToX0BeforeColor; // "MoveToX0BeforeSetColor"
  198. BOOL bSendMultipleRows; // *SendMultipleRows?
  199. DWORD dwMaxMultipleRowBytes ; // "*MaxMultipleRowBytes"
  200. BOOL bMirrorRasterByte; // *MirrorRasterByte?
  201. BOOL bMirrorRasterPage; // *MirrorRasterPage?
  202. //
  203. //Font Information
  204. //Device Font Specific.
  205. //
  206. LISTINDEX liDeviceFontList; // "DeviceFonts" Index to Font List Node
  207. DWORD dwDefaultFont; // "DefaultFont ID"
  208. DWORD dwMaxFontUsePerPage; // "MaxFontUsePerPage"
  209. DWORD dwDefaultCTT; // *DefaultCTT
  210. DWORD dwLookaheadRegion; // *LookAheadRegion, never negative
  211. INT iTextYOffset; // *TextYOffset, could be negative
  212. CHARPOSITION charpos; // "CharPosition"
  213. //
  214. //Font Substitution.
  215. //
  216. BOOL bTTFSEnabled ; //"TTFSEnabled?"
  217. //
  218. //Font Download
  219. //
  220. DWORD dwMinFontID; // "MinFontID"
  221. DWORD dwMaxFontID; // "MaxFontID"
  222. DWORD dwMaxNumDownFonts; // *MaxNumDownFonts
  223. DLSYMBOLSET dlsymbolset; // *DLSymbolSet
  224. DWORD dwMinGlyphID; // "MinGlyphID"
  225. DWORD dwMaxGlyphID; // "MaxGlyphID"
  226. FONTFORMAT fontformat; // "FontFormat"
  227. //
  228. // font simulation
  229. //
  230. BOOL bDiffFontsPerByteMode; // "DiffFontsPerByteMode?"
  231. //
  232. // rectangle area fill
  233. //
  234. CURSORXAFTERRECTFILL cxafterfill; // *CursorXAfterRectFill
  235. CURSORYAFTERRECTFILL cyafterfill; // *CursorYAfterRectFill
  236. DWORD dwMinGrayFill; // *MinGrayFill
  237. DWORD dwMaxGrayFill; // *MaxGrayFill
  238. DWORD dwTextHalftoneThreshold ; // *TextHalftoneThreshold
  239. } GLOBALS, *PGLOBALS;
  240. //
  241. // DATA TYPE
  242. // Enumeration of all data types in DataType array refernce
  243. //
  244. typedef enum _DATATYPE {
  245. DT_COMMANDTABLE, // maps UnidrvID to index into COMMANDARRAY
  246. DT_COMMANDARRAY,
  247. DT_PARAMETERS,
  248. DT_TOKENSTREAM, // stream of RPN operator tokens
  249. DT_LISTNODE, // holds a LIST of dword values
  250. DT_LOCALLISTNODE, // holds a LIST of dword values
  251. DT_FONTSCART, // list of FontCartridges
  252. DT_FONTSUBST, // Font Substitution table.
  253. DT_LAST
  254. } DATATYPE;
  255. //
  256. // GPDDRIVERINFO fields will be access via by predefined macros due
  257. // to the possiblities that different base address might be required
  258. // by the GPD parser.
  259. //
  260. typedef struct _GPDDRIVERINFO {
  261. DWORD dwSize; // Size if GPDDRIVERINFO
  262. ARRAYREF DataType[DT_LAST]; // global list of ALL
  263. // Array References. See DATATYPE
  264. // enumeration for details.
  265. DWORD dwJobSetupIndex; // Index to listnode containing
  266. DWORD dwDocSetupIndex; // list of indicies to COMMANDARRAY.
  267. DWORD dwPageSetupIndex; //
  268. DWORD dwPageFinishIndex; //
  269. DWORD dwDocFinishIndex; //
  270. DWORD dwJobFinishIndex; //
  271. PBYTE pubResourceData; // Pointer to resource data base address
  272. PINFOHEADER pInfoHeader; // Pointer to InfoHeader;
  273. GLOBALS Globals; // GLOBALS struct
  274. } GPDDRIVERINFO, *PGPDDRIVERINFO;
  275. // ---- WARNING, the following section is owned ---- //
  276. // by peterwo. Do not make any changes in these //
  277. // definitions without his permission. //
  278. // --------------- No Tresspassing --------------- //
  279. //
  280. // SEQUENCE COMMANDS
  281. // The GPD identifies 6 sections of a job stream. Within a section, the commands
  282. // are sent out in the increasing order of the sequence number. The number doesn
  283. // not have to be consecutive.
  284. // The driver will send out sequence commands for each
  285. // of the following sections:
  286. // JOB_SETUP
  287. // DOC_SETUP
  288. // PAGE_SETUP
  289. // PAGE_FINISH
  290. // DOC_FINISH
  291. // JOB_FINISH
  292. //
  293. // SECTION enumeration
  294. //
  295. typedef enum _SEQSECTION {
  296. SS_UNINITIALIZED,
  297. SS_JOBSETUP,
  298. SS_DOCSETUP,
  299. SS_PAGESETUP,
  300. SS_PAGEFINISH,
  301. SS_DOCFINISH,
  302. SS_JOBFINISH,
  303. } SEQSECTION;
  304. #if 0
  305. // the sequence structure has been abandoned in favor
  306. // of storing the list of COMMAND indicies in LISTNODE
  307. // structures. The parser will convert wFeatureIndex
  308. // into a command Index so the UI module will only
  309. // deal with command indicies.
  310. typedef struct _SEQUENCE{
  311. WORD wIndexOfCmd; // Index into the COMMAND array
  312. WORD wFeatureIndex; // Index into the FEATURE array
  313. // FEATURE array is in UIINFO
  314. WORD wNextInSequence; // Next sequence commands to send for this setion
  315. // If equal to END_SEQUENCE, means no more for this section
  316. WORD wReserved;
  317. } SEQUENCE, *PSEQUENCE;
  318. #endif
  319. //
  320. // ORDERDEPENDENCY
  321. // Orderdepend is not use by the graphics driver, it's mainly present
  322. // for the parsers.
  323. //
  324. typedef struct
  325. {
  326. SEQSECTION eSection; // Specifies the section
  327. DWORD dwOrder ; // order within each section.
  328. } ORDERDEPENDENCY , * PORDERDEPENDENCY ;
  329. // assign this struct the type 'ord'
  330. //
  331. // COMMAND
  332. // All commands listed in GPD will be parsed into the format defined below.
  333. // The command array is a one dimensional array, accessible via predefined index.
  334. // The invocation string an be in the form of one or more binary string concatenated
  335. // together. Between binary string, there can exists parameter reference, always headed
  336. // by a %. For example, %paramref, where paramref is the index into the PARAMETER array.
  337. //
  338. typedef struct _COMMAND{
  339. INVOCATION strInvocation; // binary string and parameter references
  340. ORDERDEPENDENCY ordOrder; // ORDERDEPENDENCY info
  341. DWORD dwCmdCallbackID; // Command callback IDs are defined in
  342. // GPD. If set to NO_CALLBACK_ID, it means
  343. // that this cmd doesn't need to be hooked
  344. DWORD dwStandardVarsList; // If the dwCmdCallbackID is not used, ignore this
  345. // Otherwise, use dwStandardVarsList as the
  346. // as a list of standard variable that need to be
  347. // passed in command callbacks.
  348. // dwStandardVarsList is an index into the
  349. // LIST array
  350. BOOL bNoPageEject; // does command cause ejection of current page?
  351. // bitfield type doesn't exist for keywords not in snapshot table.
  352. // all StartDoc commands with this flag set form a subset that
  353. // may be sent as a group. They will not cause a page ejection.
  354. } COMMAND, *PCOMMAND;
  355. // assign this struct the type 'cmd'
  356. #define NO_CALLBACK_ID (0xffffffff)
  357. //
  358. // PARAMETER
  359. // All the parameters required by defined commands are stored in the PARAMETER array
  360. // The driver will use the parameter reference in INVOCATION string as the index
  361. // into this array for parameters.
  362. //
  363. typedef struct _PARAMETER{
  364. DWORD dwFormat; // Specifies the format of the parameter
  365. DWORD dwDigits; // Specifies the number of digits to be
  366. // emmitted, this is only valid if the
  367. // format is "D" or "d" AND dwFlags has
  368. // PARAM_FLAG_FIELDWIDTH_USED
  369. DWORD dwFlags; // Flags for parameters, which action to carray out:
  370. // PARAM_FLAG_MIN_USED
  371. // PARAM_FLAG_MAX_USED
  372. // PARAM_FLAG_FIELDWIDTH_USED
  373. LONG lMin; // If PARAMETER_MINUSED is set, use this
  374. // as the min value for parameter
  375. LONG lMax; // If PARAMETER_MAXUSED is set, use this
  376. // as the max value for parameter
  377. ARRAYREF arTokens; // Refernce to array of TOKENs for RPN calculator
  378. } PARAMETER, *PPARAMETER;
  379. // assign this struct the type 'param'
  380. #define PARAM_FLAG_MIN_USED 0x00000001
  381. // lMin field is used
  382. #define PARAM_FLAG_MAX_USED 0x00000002
  383. // lMax field is used
  384. #define PARAM_FLAG_FIELDWIDTH_USED 0x00000004
  385. // if fieldwidth was specified for 'd' or 'D' format.
  386. #define PARAM_FLAG_MAXREPEAT_USED 0x00000008 // dead
  387. // dwMaxRepeat field is used
  388. //
  389. // OPERATOR
  390. // The following is an enumeration of the OPERATOR in TOKENSTREAM
  391. //
  392. typedef enum _OPERATOR
  393. {
  394. OP_INTEGER, // dwValue contains an integer
  395. OP_VARI_INDEX, // dwValue contains index to Standard Variable Table.
  396. //
  397. // these operators will actually be inserted into the token
  398. // stream.
  399. //
  400. OP_MIN, OP_MAX, OP_ADD, OP_SUB, OP_MULT,
  401. OP_DIV, OP_MOD, OP_MAX_REPEAT, OP_HALT,
  402. //
  403. // these operators are used only in the temporary stack
  404. //
  405. OP_OPENPAR, OP_CLOSEPAR, OP_NEG,
  406. //
  407. // these operators are processed immediately by the
  408. // token parser and are not stored.
  409. //
  410. OP_COMMA, OP_NULL, OP_LAST
  411. }OPERATOR ;
  412. //
  413. // TOKENSTREAM
  414. // This contains the token stream (operands and operators) for the parameter.
  415. //
  416. typedef struct _TOKENSTREAM{
  417. DWORD dwValue; // Integer for Standard variable
  418. OPERATOR eType; // Type of Value or Operator
  419. } TOKENSTREAM, *PTOKENSTREAM;
  420. // assign this struct the type 'tstr'
  421. //
  422. //FONTSUBSTITUTION
  423. //Font substitution Table. This structure is same as that defined by the parser.
  424. //
  425. typedef struct _TTFONTSUBTABLE
  426. {
  427. ARRAYREF arTTFontName ; //True Type Font name to be substituted.
  428. ARRAYREF arDevFontName ; // Device Font name of the Font to be used.
  429. DWORD dwRcTTFontNameID ; //
  430. DWORD dwRcDevFontNameID ; //
  431. } TTFONTSUBTABLE, *PTTFONTSUBTABLE ;
  432. // tag 'ttft'
  433. // ---- List Values Section ---- //
  434. /* this defines the nodes used to implement a singly-linked
  435. list of DWORD items. Some values are stored in Lists. */
  436. typedef struct
  437. {
  438. DWORD dwData ;
  439. DWORD dwNextItem ; // index of next listnode
  440. } LISTNODE, * PLISTNODE ;
  441. // assign this struct the type 'lst'
  442. // ---- End of List Values Section ---- //
  443. // ---- Special default values used in snapshot ---- //
  444. #define NO_LIMIT_NUM 0xffffffff
  445. /// #define NO_RC_CTT_ID 0xffffffff set to zero if none supplied.
  446. #define WILDCARD_VALUE (0x80000000)
  447. // if '*' appears in place of an integer, it is assigned this value.
  448. // ---- End of Peterwo's Restricted Area ---- //
  449. //
  450. // STANDARD VARIABLE
  451. // The following is an enumeration of the standard variable as defined in the GPD,
  452. // the TOKEN STREAM struct will contain either the actual parameter value or an index
  453. // to this table. The Control Module will keep a table of this in the PDEVICE,
  454. // the parser will use this enumeration table to initialize the dwValue of TOKENSTREAM
  455. //
  456. typedef enum _STDVARIABLE{
  457. SV_NUMDATABYTES, // "NumOfDataBytes"
  458. SV_WIDTHINBYTES, // "RasterDataWidthInBytes"
  459. SV_HEIGHTINPIXELS, // "RasterDataHeightInPixels"
  460. SV_COPIES, // "NumOfCopies"
  461. SV_PRINTDIRECTION, // "PrintDirInCCDegrees"
  462. SV_DESTX, // "DestX"
  463. SV_DESTY, // "DestY"
  464. SV_DESTXREL, // "DestXRel"
  465. SV_DESTYREL, // "DestYRel"
  466. SV_LINEFEEDSPACING, // "LinefeedSpacing"
  467. SV_RECTXSIZE, // "RectXSize"
  468. SV_RECTYSIZE, // "RectYSize"
  469. SV_GRAYPERCENT, // "GrayPercentage"
  470. SV_NEXTFONTID, // "NextFontID"
  471. SV_NEXTGLYPH, // "NextGlyph"
  472. SV_PHYSPAPERLENGTH, // "PhysPaperLength"
  473. SV_PHYSPAPERWIDTH, // "PhysPaperWidth"
  474. SV_FONTHEIGHT, // "FontHeight"
  475. SV_FONTWIDTH, // "FontWidth"
  476. SV_FONTMAXWIDTH, // "FontMaxWidth"
  477. SV_FONTBOLD, // "FontBold"
  478. SV_FONTITALIC, // "FontItalic"
  479. SV_FONTUNDERLINE, // "FontUnderline"
  480. SV_FONTSTRIKETHRU, // "FontStrikeThru"
  481. SV_CURRENTFONTID, // "CurrentFontID"
  482. SV_TEXTYRES, // "TextYRes"
  483. SV_TEXTXRES, // "TextXRes"
  484. SV_GRAPHICSYRES, // "GraphicsYRes"
  485. SV_GRAPHICSXRES, // "GraphicsXRes"
  486. SV_ROP3, // "Rop3"
  487. SV_REDVALUE, // "RedValue"
  488. SV_GREENVALUE, // "GreenValue"
  489. SV_BLUEVALUE, // "BlueValue"
  490. SV_PALETTEINDEXTOPROGRAM, // "PaletteIndexToProgram"
  491. SV_CURRENTPALETTEINDEX, // "CurrentPaletteIndex"
  492. SV_PATTERNBRUSH_TYPE, // "PatternBrushType"
  493. SV_PATTERNBRUSH_ID, // "PatternBrushID"
  494. SV_PATTERNBRUSH_SIZE, // "PatternBrushSize"
  495. SV_CURSORORIGINX, // "CursorOriginX"
  496. SV_CURSORORIGINY, // "CursorOriginY"
  497. // this is in MasterUnits and in the coordinates of the currently selected orientation.
  498. // this value is defined as ImageableOrigin - CursorOrigin
  499. SV_PAGENUMBER, // "PageNumber"
  500. // this value tracks number of times DrvStartBand has been called since
  501. // StartDoc.
  502. //
  503. // Put new enum above SV_MAX
  504. //
  505. SV_MAX
  506. }STDVARIABLE;
  507. //
  508. // GENERAL PRINTING COMMAND
  509. // General printing commands contains such commands as
  510. // cusor control, color, and overlay etc.
  511. // The following is the enumeration of general printing commands. The list
  512. // of commands are in GPDDRIVERINFO Cmds array, this list is accessed by
  513. // the SEQUENCE struct.
  514. //
  515. typedef enum CMDINDEX
  516. { // unidrv index for commands
  517. // Printer Configuration
  518. FIRST_CONFIG_CMD,
  519. CMD_STARTJOB = FIRST_CONFIG_CMD, // "CmdStartJob"
  520. CMD_STARTDOC, // "CmdStartDoc"
  521. CMD_STARTPAGE, // "CmdStartPage"
  522. CMD_ENDPAGE, // "CmdEndPage"
  523. CMD_ENDDOC, // "CmdEndDoc"
  524. CMD_ENDJOB, // "CmdEndJob"
  525. CMD_COPIES, // "CmdCopies"
  526. CMD_SLEEPTIMEOUT, // "CmdSleepTimeOut"
  527. LAST_CONFIG_CMD, // Larger than any Config Command value.
  528. //
  529. // GENERAL
  530. //
  531. //
  532. // CURSOR CONTROL
  533. //
  534. CMD_XMOVEABSOLUTE, // "CmdXMoveAbsolute"
  535. CMD_XMOVERELLEFT, // "CmdXMoveRelLeft"
  536. CMD_XMOVERELRIGHT, // "CmdXMoveRelRight"
  537. CMD_YMOVEABSOLUTE, // "CmdYMoveAbsolute"
  538. CMD_YMOVERELUP, // "CmdYMoveRelUp"
  539. CMD_YMOVERELDOWN, // "CmdYMoveRelDown"
  540. CMD_SETSIMPLEROTATION, // "CmdSetSimpleRotation"
  541. CMD_SETANYROTATION, // "CmdSetAnyRotation"
  542. CMD_UNIDIRECTIONON, // "CmdUniDirectionOn"
  543. CMD_UNIDIRECTIONOFF, // "CmdUniDirectionOff"
  544. CMD_SETLINESPACING, // "CmdSetLineSpacing"
  545. CMD_PUSHCURSOR, // "CmdPushCursor"
  546. CMD_POPCURSOR, // "CmdPopCursor"
  547. CMD_BACKSPACE, // "CmdBackSpace"
  548. CMD_FORMFEED, // "CmdFF"
  549. CMD_CARRIAGERETURN, // "CmdCR"
  550. CMD_LINEFEED, // "CmdLF"
  551. //
  552. // COLOR
  553. //
  554. CMD_SELECTBLACKCOLOR, // "CmdSelectBlackColor"
  555. CMD_SELECTREDCOLOR, // "CmdSelectRedColor"
  556. CMD_SELECTGREENCOLOR, // "CmdSelectGreenColor"
  557. CMD_SELECTYELLOWCOLOR, // "CmdSelectYellowColor"
  558. CMD_SELECTBLUECOLOR, // "CmdSelectBlueColor"
  559. CMD_SELECTMAGENTACOLOR, // "CmdSelectMagentaColor"
  560. CMD_SELECTCYANCOLOR, // "CmdSelectCyanColor"
  561. CMD_SELECTWHITECOLOR, // "CmdSelectWhiteColor"
  562. CMD_BEGINPALETTEDEF, // "CmdBeginPaletteDef"
  563. CMD_ENDPALETTEDEF, // "CmdEndPaletteDef"
  564. CMD_DEFINEPALETTEENTRY, // "CmdDefinePaletteEntry"
  565. CMD_BEGINPALETTEREDEF, // "CmdBeginPaletteReDef"
  566. CMD_ENDPALETTEREDEF, // "CmdEndPaletteReDef"
  567. CMD_REDEFINEPALETTEENTRY, // "CmdReDefinePaletteEntry"
  568. CMD_SELECTPALETTEENTRY, // "CmdSelectPaletteEntry"
  569. CMD_PUSHPALETTE, // "CmdPushPalette"
  570. CMD_POPPALETTE, // "CmdPopPalette"
  571. //
  572. // DATACOMPRESSION
  573. //
  574. CMD_ENABLETIFF4, // "CmdEnableTIFF4"
  575. CMD_ENABLEDRC, // "CmdEnableDRC"
  576. CMD_ENABLEFERLE, // CmdEnableFE_RLE
  577. CMD_ENABLEOEMCOMP, // "CmdEnableOEMComp"
  578. CMD_DISABLECOMPRESSION, // "CmdDisableCompression"
  579. //
  580. // Raster Data Emission
  581. //
  582. CMD_BEGINRASTER, // "CmdBeginRaster"
  583. CMD_ENDRASTER, // "CmdEndRaster"
  584. CMD_SETDESTBMPWIDTH, // "CmdSetDestBmpWidth"
  585. CMD_SETDESTBMPHEIGHT, // "CmdSetDestBmpHeight"
  586. CMD_SETSRCBMPWIDTH, // "CmdSetSrcBmpWidth"
  587. CMD_SETSRCBMPHEIGHT, // "CmdSetSrcBmpHeight"
  588. CMD_SENDBLOCKDATA, // "CmdSendBlockData"
  589. CMD_ENDBLOCKDATA, // "CmdEndBlockData"
  590. CMD_SENDREDDATA, // "CmdSendRedData"
  591. CMD_SENDGREENDATA, // "CmdSendGreenData"
  592. CMD_SENDBLUEDATA, // "CmdSendBlueData"
  593. CMD_SENDCYANDATA, // "CmdSendCyanData"
  594. CMD_SENDMAGENTADATA, // "CmdSendMagentaData"
  595. CMD_SENDYELLOWDATA, // "CmdSendYellowData"
  596. CMD_SENDBLACKDATA, // "CmdSendBlackData"
  597. //
  598. // Font Downloading
  599. //
  600. CMD_SETFONTID, // "CmdSetFontID"
  601. CMD_SELECTFONTID, // "CmdSelectFontID"
  602. CMD_SETCHARCODE, // "CmdSetCharCode"
  603. CMD_DESELECTFONTID, // "CmdDeselectFontID"
  604. CMD_SELECTFONTHEIGHT, // "CmdSelectFontHeight"
  605. CMD_SELECTFONTWIDTH, // "CmdSelectFontWidth"
  606. CMD_DELETEFONT, // "CmdDeleteFont"
  607. //
  608. // Font Simulation
  609. //
  610. CMD_SETFONTSIM, // "CmdSetFontSim"
  611. CMD_BOLDON, // "CmdBoldOn"
  612. CMD_BOLDOFF, // "CmdBoldOff"
  613. CMD_ITALICON, // "CmdItalicOn"
  614. CMD_ITALICOFF, // "CmdItalicOff"
  615. CMD_UNDERLINEON, // "CmdUnderlineOn"
  616. CMD_UNDERLINEOFF, // "CmdUnderlineOff"
  617. CMD_STRIKETHRUON, // "CmdStrikeThruOn"
  618. CMD_STRIKETHRUOFF, // "CmdStrikeThruOff"
  619. CMD_WHITETEXTON, // "CmdWhiteTextOn"
  620. CMD_WHITETEXTOFF, // "CmdWhiteTextOff"
  621. CMD_SELECTSINGLEBYTEMODE, // "CmdSelectSingleByteMode"
  622. CMD_SELECTDOUBLEBYTEMODE, // "CmdSelectDoubleByteMode"
  623. CMD_VERTICALPRINTINGON, // "CmdVerticalPrintingOn"
  624. CMD_VERTICALPRINTINGOFF, // "CmdVerticalPrintingOff"
  625. CMD_CLEARALLFONTATTRIBS, // "CmdClearAllFontAttribs"
  626. //
  627. // Print Object Specific Halftone Alogorithms (Used mainly for color devices)
  628. //
  629. CMD_SETTEXTHTALGO, // "CmdSetTextHTAlgo"
  630. CMD_SETGRAPHICSHTALGO, // "CmdSetGraphicsHTAlgo"
  631. CMD_SETPHOTOHTALGO, // "CmdSetPhotoHTAlgo"
  632. //
  633. // Vector Printing
  634. //
  635. CMD_FIRST_RULES, // existence of the RULES commands
  636. // imples RULES_ABLE
  637. CMD_SETRECTWIDTH = CMD_FIRST_RULES, // "CmdSetRectWidth"
  638. CMD_SETRECTHEIGHT, // "CmdSetRectHeight"
  639. CMD_SETRECTSIZE, // "CmdSetRectSize"
  640. CMD_RECTGRAYFILL, // "CmdRectGrayFill"
  641. CMD_RECTWHITEFILL, // "CmdRectWhiteFill"
  642. CMD_RECTBLACKFILL, // "CmdRectBlackFill"
  643. CMD_LAST_RULES = CMD_RECTBLACKFILL,
  644. //
  645. // Brush Selection
  646. //
  647. CMD_DOWNLOAD_PATTERN, // "CmdDownloadPattern"
  648. CMD_SELECT_PATTERN, // "CmdSelectPattern"
  649. CMD_SELECT_WHITEBRUSH, // "CmdSelectWhiteBrush"
  650. CMD_SELECT_BLACKBRUSH, // "CmdSelectBlackBrush"
  651. //
  652. // Put new commands above CMD_MAX
  653. //
  654. CMD_MAX
  655. } CMDINDEX;
  656. //
  657. // Rendering Information for Predefined Features
  658. //
  659. //
  660. // GID_RESOLUTION
  661. //
  662. typedef struct _RESOLUTIONEX {
  663. POINT ptGrxDPI; // *DPI
  664. POINT ptTextDPI; // *TextDPI
  665. DWORD dwMinStripBlankPixels ; // *MinStripBlankPixels
  666. DWORD dwPinsPerPhysPass; // *PinsPerPhysPass
  667. DWORD dwPinsPerLogPass; // *PinsPerLogPass
  668. DWORD dwSpotDiameter; // *SpotDiameter
  669. BOOL bRequireUniDir; // *RequireUniDir?
  670. DWORD dwRedDeviceGamma ; // "RedDeviceGamma"
  671. DWORD dwGreenDeviceGamma ; // "GreenDeviceGamma"
  672. DWORD dwBlueDeviceGamma ; // "BlueDeviceGamma"
  673. } RESOLUTIONEX, * PRESOLUTIONEX;
  674. //
  675. // GID_COLORMODE
  676. //
  677. typedef struct _COLORMODEEX {
  678. BOOL bColor; // *Color?
  679. DWORD dwPrinterNumOfPlanes; // *DevNumOfPlanes
  680. DWORD dwPrinterBPP; // *DevBPP
  681. LISTINDEX liColorPlaneOrder; // *ColorPlaneOrder
  682. DWORD dwDrvBPP; // *DrvBPP
  683. DWORD dwIPCallbackID ; // *IPCallbackID
  684. RASTERMODE dwRasterMode ; // *RasterMode
  685. DWORD dwPaletteSize ; // *PaletteSize
  686. BOOL bPaletteProgrammable; // *PaletteProgrammable?
  687. } COLORMODEEX, *PCOLORMODEEX;
  688. //
  689. // GID_PAGESIZE
  690. //
  691. typedef struct _PAGESIZEEX {
  692. SIZEL szImageArea; // *PrintableArea, for non-CUSTOMSIZE options
  693. POINT ptImageOrigin; // *PrintableOrigin, for non-CUSTOMSIZE options
  694. POINT ptPrinterCursorOrig; // *CursorOrigin
  695. POINT ptMinSize; // *MinSize, for CUSTOMSIZE option only
  696. POINT ptMaxSize; // *MaxSize, for CUSTOMSIZE option only
  697. DWORD dwTopMargin; // *TopMargin, for CUSTOMSIZE option only
  698. DWORD dwBottomMargin; // *BottomMargin, for CUSTOMSIZE option only
  699. DWORD dwMaxPrintableWidth; // *MaxPrintableWidth, for CUSTOMSIZE option only
  700. DWORD dwMinLeftMargin; // *MinLeftMargin, for CUSTOMSIZE option only
  701. BOOL bCenterPrintArea; // *CenterPrintable?, for CUSTOMSIZE option only
  702. BOOL bRotateSize; // *RotateSize?
  703. DWORD dwPortRotationAngle; // *PortRotationAngle
  704. INVOCATION strCustCursorOriginX ; // "CustCursorOriginX"
  705. INVOCATION strCustCursorOriginY ; // "CustCursorOriginY"
  706. INVOCATION strCustPrintableOriginX ; // "CustPrintableOriginX"
  707. INVOCATION strCustPrintableOriginY ; // "CustPrintableOriginY"
  708. INVOCATION strCustPrintableSizeX; // "CustPrintableSizeX"
  709. INVOCATION strCustPrintableSizeY; // "CustPrintableSizeY"
  710. } PAGESIZEEX, *PPAGESIZEEX;
  711. //
  712. // define standard PageProtect options (for PAGEPROTECT.dwPageProtectID)
  713. //
  714. typedef enum _PAGEPRO {
  715. PAGEPRO_ON,
  716. PAGEPRO_OFF
  717. } PAGEPRO;
  718. //
  719. // define possible values for *FeatureType keyword
  720. //
  721. typedef enum _FEATURETYPE {
  722. FT_DOCPROPERTY,
  723. FT_JOBPROPERTY,
  724. FT_PRINTERPROPERTY
  725. } FEATURETYPE;
  726. //
  727. // define possible values for *PromptTime keyword
  728. //
  729. typedef enum _PROMPTTIME {
  730. PROMPT_UISETUP,
  731. PROMPT_PRTSTARTDOC
  732. } PROMPTTIME;
  733. //
  734. // define color plane id's, used by *ColorPlaneOrder keyword
  735. //
  736. typedef enum _COLORPLANE {
  737. COLOR_YELLOW,
  738. COLOR_MAGENTA,
  739. COLOR_CYAN,
  740. COLOR_BLACK,
  741. COLOR_RED,
  742. COLOR_GREEN,
  743. COLOR_BLUE
  744. } COLORPLANE;
  745. //
  746. // define values for *BadCursorMoveInGrxMode keyword
  747. //
  748. typedef enum _BADCURSORMOVEINGRXMODE {
  749. NOCM_X_PORTRAIT,
  750. NOCM_X_LANDSCAPE,
  751. NOCM_Y_PORTRAIT,
  752. NOCM_Y_LANDSCAPE
  753. } BADCURSORMOVEINGRXMODE;
  754. //
  755. // define values for *YMoveAttributes keyword
  756. //
  757. typedef enum _YMOVEATTRIBUTE {
  758. YMOVE_FAVOR_LINEFEEDSPACING,
  759. YMOVE_SENDCR_FIRST,
  760. } YMOVEATTRIBUTE;
  761. //
  762. // define values for *PaletteScope keyword
  763. //
  764. typedef enum _PALETTESCOPE {
  765. PALS_FOR_RASTER,
  766. PALS_FOR_TEXT,
  767. PALS_FOR_VECTOR
  768. } PALETTESCOPE;
  769. //
  770. // define values for *StripBlanks keyword
  771. //
  772. typedef enum _STRIPBLANKS {
  773. SB_LEADING,
  774. SB_ENCLOSED,
  775. SB_TRAILING
  776. } STRIPBLANKS;
  777. //
  778. // define values for *TextCaps
  779. //
  780. typedef enum _TEXTCAP {
  781. TEXTCAPS_OP_CHARACTER,
  782. TEXTCAPS_OP_STROKE,
  783. TEXTCAPS_CP_STROKE,
  784. TEXTCAPS_CR_90,
  785. TEXTCAPS_CR_ANY,
  786. TEXTCAPS_SF_X_YINDEP,
  787. TEXTCAPS_SA_DOUBLE,
  788. TEXTCAPS_SA_INTEGER,
  789. TEXTCAPS_SA_CONTIN,
  790. TEXTCAPS_EA_DOUBLE,
  791. TEXTCAPS_IA_ABLE,
  792. TEXTCAPS_UA_ABLE,
  793. TEXTCAPS_SO_ABLE,
  794. TEXTCAPS_RA_ABLE,
  795. TEXTCAPS_VA_ABLE
  796. } TEXTCAP;
  797. //
  798. // define values for *MemoryUsage
  799. //
  800. typedef enum _MEMORYUSAGE {
  801. MEMORY_FONT,
  802. MEMORY_RASTER,
  803. MEMORY_VECTOR
  804. } MEMORYUSAGE;
  805. //
  806. // define values for *ReselectFont
  807. //
  808. typedef enum _RESELECTFONT {
  809. RESELECTFONT_AFTER_GRXDATA,
  810. RESELECTFONT_AFTER_XMOVE,
  811. RESELECTFONT_AFTER_FF
  812. } RESELECTFONT;
  813. // ---- macrodefinitions to access various data structures: ---- //
  814. // this macro returns a pointer to the COMMAND structure
  815. // corresponding to the specified Unidrv CommandID.
  816. #ifndef PERFTEST
  817. #define COMMANDPTR(pGPDDrvInfo , UniCmdID ) \
  818. ((((PDWORD)((PBYTE)(pGPDDrvInfo)->pInfoHeader + \
  819. (pGPDDrvInfo)->DataType[DT_COMMANDTABLE].loOffset)) \
  820. [(UniCmdID)] == UNUSED_ITEM ) ? NULL : \
  821. (PCOMMAND)((pGPDDrvInfo)->pubResourceData + \
  822. (pGPDDrvInfo)->DataType[DT_COMMANDARRAY].loOffset) \
  823. + ((PDWORD)((PBYTE)(pGPDDrvInfo)->pInfoHeader + \
  824. (pGPDDrvInfo)->DataType[DT_COMMANDTABLE].loOffset)) \
  825. [(UniCmdID)])
  826. #else //PERFTEST
  827. #define COMMANDPTR CommandPtr
  828. PCOMMAND
  829. CommandPtr(
  830. IN PGPDDRIVERINFO pGPDDrvInfo,
  831. IN DWORD UniCmdID
  832. );
  833. #endif //PERFTEST
  834. // this macro returns a pointer to the COMMAND structure
  835. // corresponding to specified index(to the COMMAND ARRAY)
  836. #define INDEXTOCOMMANDPTR(pGPDDrvInfo , CmdIndex ) \
  837. ((CmdIndex == UNUSED_ITEM ) ? NULL : \
  838. (PCOMMAND)((pGPDDrvInfo)->pubResourceData + \
  839. (pGPDDrvInfo)->DataType[DT_COMMANDARRAY].loOffset) \
  840. + CmdIndex)
  841. // this macro returns a pointer to the specified PARAMETER structure
  842. // within the parameter array
  843. #define PARAMETERPTR(pGPDDrvInfo , dwIndex ) \
  844. (PPARAMETER)((pGPDDrvInfo)->pubResourceData + \
  845. (pGPDDrvInfo)->DataType[DT_PARAMETERS].loOffset) \
  846. + (dwIndex)
  847. // this macro returns a pointer to the start of the specified
  848. // TOKENSTREAM structure, dwIndex comes from pParameter->Tokens.loOffset
  849. #define TOKENSTREAMPTR(pGPDDrvInfo , dwIndex ) \
  850. (PTOKENSTREAM)((pGPDDrvInfo)->pubResourceData + \
  851. (pGPDDrvInfo)->DataType[DT_TOKENSTREAM].loOffset) \
  852. + (dwIndex)
  853. // This macro returns a pointer to the start of the FontCart Array.
  854. // FONTCART is ARRAYREF so all the elements are contiguous.
  855. #define GETFONTCARTARRAY(pGPDDrvInfo) \
  856. (PFONTCART)((pGPDDrvInfo)->pubResourceData + \
  857. (pGPDDrvInfo)->DataType[DT_FONTSCART].loOffset)
  858. // This macro returns a pointer to the start of the Font Substitution table.
  859. // Substitution table is ARRAYREF so all the elements are contiguous.
  860. #define GETTTFONTSUBTABLE(pGPDDrvInfo) \
  861. (PTTFONTSUBTABLE)((pGPDDrvInfo)->pubResourceData + \
  862. (pGPDDrvInfo)->DataType[DT_FONTSUBST].loOffset)
  863. // This macro returns the string pointer. The string is null terminated.
  864. // Use the dwcount member of ARRAYEF to verify the correct size.
  865. #define GETSTRING(pGPDDrvInfo, arfString) \
  866. (WCHAR *)((pGPDDrvInfo)->pubResourceData + (arfString).loOffset )
  867. // this macro returns a pointer to the start of the specified
  868. // LISTNODE structure, for example, dwIndex may come from
  869. // pParameter->dwStandardVarsList
  870. #define LISTNODEPTR(pGPDDrvInfo , dwIndex ) \
  871. ((dwIndex == END_OF_LIST ) ? NULL : \
  872. (PLISTNODE)((pGPDDrvInfo)->pubResourceData + \
  873. (pGPDDrvInfo)->DataType[DT_LISTNODE].loOffset) \
  874. + (dwIndex))
  875. // this macro returns a pointer to the start of the specified
  876. // LOCALLISTNODE structure, for example, dwIndex may come from
  877. // pParameter->dwStandardVarsList. Returns NULL if
  878. // (dwIndex == UNUSED_ITEM)
  879. #define LOCALLISTNODEPTR(pGPDDrvInfo , dwIndex ) \
  880. ((dwIndex == UNUSED_ITEM ) ? NULL : \
  881. (PLISTNODE)((PBYTE)(pGPDDrvInfo)->pInfoHeader + \
  882. (pGPDDrvInfo)->DataType[DT_LOCALLISTNODE].loOffset) \
  883. + (dwIndex))
  884. // ---- end macrodefinitions section ----- //
  885. // ----- GPD parser only helper function ----- //
  886. DWORD
  887. UniMapToDeviceOptIndex(
  888. IN PINFOHEADER pInfoHdr ,
  889. IN DWORD dwFeatureID,
  890. IN LONG lParam1,
  891. IN LONG lParam2,
  892. OUT PDWORD pdwOptionIndexes, // used only for GID_PAGESIZE
  893. IN PDWORD pdwPaperID // optional paperID
  894. ) ;
  895. #endif // !_GPD_H_