Source code of Windows XP (NT5)
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.

277 lines
6.1 KiB

  1. /*++
  2. Copyright (c) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. pslib.h
  5. Abstract:
  6. PostScript specific library functions
  7. Environment:
  8. Windows NT printer drivers
  9. Revision History:
  10. 09/25/96 -davidx-
  11. Created it.
  12. --*/
  13. #ifndef _PSLIB_H_
  14. #define _PSLIB_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #include "psglyph.h"
  19. #include "psntm.h"
  20. #include "psntf.h"
  21. #include "psvmerr.h"
  22. //
  23. // Macros for converting between microns and PostScript points
  24. //
  25. #define MICRON_TO_POINT(micron) MulDiv(micron, 72, 25400)
  26. #define POINT_TO_MICRON(point) MulDiv(point, 25400, 72)
  27. //
  28. // Convert between ANSI and Unicode strings (using the current ANSI codepage)
  29. //
  30. VOID
  31. VCopyUnicodeStringToAnsi(
  32. PSTR pstr,
  33. PCWSTR pwstr,
  34. INT iMaxChars
  35. );
  36. VOID
  37. VCopyAnsiStringToUnicode(
  38. PWSTR pwstr,
  39. PCSTR pstr,
  40. INT iMaxChars
  41. );
  42. //
  43. // Check if the devmode form fields are specifying PostScript custom page size
  44. //
  45. BOOL
  46. BValidateDevmodeCustomPageSizeFields(
  47. PRAWBINARYDATA pRawData,
  48. PUIINFO pUIInfo,
  49. PDEVMODE pdm,
  50. PRECTL prclImageArea
  51. );
  52. #if !defined(KERNEL_MODE) || defined(USERMODE_DRIVER)
  53. //
  54. // Get VM? Error message ID
  55. //
  56. DWORD
  57. DWGetVMErrorMessageID(
  58. VOID
  59. );
  60. #endif // !defined(KERNEL_MODE) || defined(USERMODE_DRIVER)
  61. //
  62. // Filename extension for PostScript driver device font data file
  63. //
  64. #define NTF_FILENAME_EXT TEXT(".NTF")
  65. //
  66. // Font downloader NTF file directory
  67. // %SystemRoot%\system32\spool\drivers\psfont\
  68. //
  69. #define FONTDIR TEXT("\\psfont\\")
  70. //
  71. // Private escapes between driver graphics module and driver UI
  72. //
  73. // To get a list of permanant device font names, driver UI should
  74. // call ExtEscape(DRIVERESC_QUERY_DEVFONTS) with cjIn=sizeof(DWORD)
  75. // and pvIn points to a DWORD whose value equals to QUERY_FAMILYNAME.
  76. //
  77. // Driver UI should first call this escape with cjOut=0 and pvOut=NULL
  78. // in order to find out how big the output buffer should be. After
  79. // allocating a large enough output buffer, driver UI should call this
  80. // escape again to retrieve the list of device font names.
  81. //
  82. // The list of device font names is returned as Unicode strings in
  83. // MULTI_SZ format. Note that duplicate font names may appear in the list.
  84. //
  85. #define DRIVERESC_QUERY_DEVFONTS 0x80000001
  86. #define QUERY_FAMILYNAME 'PSFF'
  87. //
  88. // synthesized PS driver feature prefix
  89. //
  90. #define PSFEATURE_PREFIX '%'
  91. //
  92. // synthesized PS driver features
  93. //
  94. extern const CHAR kstrPSFAddEuro[];
  95. extern const CHAR kstrPSFCtrlDAfter[];
  96. extern const CHAR kstrPSFCtrlDBefore[];
  97. extern const CHAR kstrPSFCustomPS[];
  98. extern const CHAR kstrPSFTrueGrayG[];
  99. extern const CHAR kstrPSFJobTimeout[];
  100. extern const CHAR kstrPSFMaxBitmap[];
  101. extern const CHAR kstrPSFEMF[];
  102. extern const CHAR kstrPSFMinOutline[];
  103. extern const CHAR kstrPSFMirroring[];
  104. extern const CHAR kstrPSFNegative[];
  105. extern const CHAR kstrPSFPageOrder[];
  106. extern const CHAR kstrPSFNup[];
  107. extern const CHAR kstrPSFErrHandler[];
  108. extern const CHAR kstrPSFPSMemory[];
  109. extern const CHAR kstrPSFOrientation[];
  110. extern const CHAR kstrPSFOutFormat[];
  111. extern const CHAR kstrPSFOutProtocol[];
  112. extern const CHAR kstrPSFOutPSLevel[];
  113. extern const CHAR kstrPSFTrueGrayT[];
  114. extern const CHAR kstrPSFTTFormat[];
  115. extern const CHAR kstrPSFWaitTimeout[];
  116. //
  117. // some commonly used keyword strings
  118. //
  119. extern const CHAR kstrKwdTrue[];
  120. extern const CHAR kstrKwdFalse[];
  121. typedef BOOL (*_BPSFEATURE_PROC)(
  122. IN HANDLE,
  123. IN PUIINFO,
  124. IN PPPDDATA,
  125. IN PDEVMODE,
  126. IN PPRINTERDATA,
  127. IN PCSTR,
  128. IN PCSTR,
  129. OUT PSTR,
  130. IN INT,
  131. OUT PDWORD,
  132. IN DWORD);
  133. //
  134. // constant definitions for _BPSFEATURE_PROC's dwMode parameter
  135. //
  136. #define PSFPROC_ENUMOPTION_MODE 0
  137. #define PSFPROC_GETOPTION_MODE 1
  138. #define PSFPROC_SETOPTION_MODE 2
  139. typedef struct _PSFEATURE_ENTRY {
  140. PCSTR pszPSFeatureName; // feature name
  141. BOOL bPrinterSticky; // TRUE if printer-sticky
  142. BOOL bEnumerableOptions; // TRUE if options are enumerable
  143. BOOL bBooleanOptions; // TRUE if has boolean options
  144. _BPSFEATURE_PROC pfnPSProc; // option handling proc
  145. } PSFEATURE_ENTRY, *PPSFEATURE_ENTRY;
  146. extern const PSFEATURE_ENTRY kPSFeatureTable[];
  147. //
  148. // PS driver's helper functions for OEM plugins
  149. //
  150. // The following helper functions are available to both UI and render plugins
  151. //
  152. HRESULT
  153. HGetGlobalAttribute(
  154. IN PINFOHEADER pInfoHeader,
  155. IN DWORD dwFlags,
  156. IN PCSTR pszAttribute,
  157. OUT PDWORD pdwDataType,
  158. OUT PBYTE pbData,
  159. IN DWORD cbSize,
  160. OUT PDWORD pcbNeeded
  161. );
  162. HRESULT
  163. HGetFeatureAttribute(
  164. IN PINFOHEADER pInfoHeader,
  165. IN DWORD dwFlags,
  166. IN PCSTR pszFeatureKeyword,
  167. IN PCSTR pszAttribute,
  168. OUT PDWORD pdwDataType,
  169. OUT PBYTE pbData,
  170. IN DWORD cbSize,
  171. OUT PDWORD pcbNeeded
  172. );
  173. HRESULT
  174. HGetOptionAttribute(
  175. IN PINFOHEADER pInfoHeader,
  176. IN DWORD dwFlags,
  177. IN PCSTR pszFeatureKeyword,
  178. IN PCSTR pszOptionKeyword,
  179. IN PCSTR pszAttribute,
  180. OUT PDWORD pdwDataType,
  181. OUT PBYTE pbData,
  182. IN DWORD cbSize,
  183. OUT PDWORD pcbNeeded
  184. );
  185. HRESULT
  186. HEnumFeaturesOrOptions(
  187. IN HANDLE hPrinter,
  188. IN PINFOHEADER pInfoHeader,
  189. IN DWORD dwFlags,
  190. IN PCSTR pszFeatureKeyword,
  191. OUT PSTR pmszOutputList,
  192. IN DWORD cbSize,
  193. OUT PDWORD pcbNeeded
  194. );
  195. HRESULT
  196. HGetOptions(
  197. IN HANDLE hPrinter,
  198. IN PINFOHEADER pInfoHeader,
  199. IN POPTSELECT pOptionsArray,
  200. IN PDEVMODE pdm,
  201. IN PPRINTERDATA pPrinterData,
  202. IN DWORD dwFlags,
  203. IN PCSTR pmszFeaturesRequested,
  204. IN DWORD cbIn,
  205. OUT PSTR pmszFeatureOptionBuf,
  206. IN DWORD cbSize,
  207. OUT PDWORD pcbNeeded,
  208. IN BOOL bPrinterSticky
  209. );
  210. //
  211. // Following are internal utility functions used by helper functions
  212. //
  213. BOOL
  214. BValidMultiSZString(
  215. IN PCSTR pmszString,
  216. IN DWORD cbSize,
  217. IN BOOL bCheckPairs
  218. );
  219. #ifdef __cplusplus
  220. }
  221. #endif
  222. #endif // !_PSLIB_H_