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.

424 lines
11 KiB

  1. /*++
  2. Copyright (c) 1996 - 1999 Microsoft Corporation
  3. Module Name:
  4. uni16res.h
  5. Abstract:
  6. Universal printer driver specific resource header
  7. Windows 16 UNIDRV Font data structure
  8. Environment:
  9. Windows NT printer drivers
  10. Revision History:
  11. 10/16/96 -eigos-
  12. Created it.
  13. --*/
  14. #ifndef _UNI16RES_H_
  15. #define _UNI16RES_H_
  16. //
  17. // NOTE: It is necessary to include "uni16res.h" header before including this
  18. // file.
  19. //
  20. #ifndef _OCD_
  21. #define _OCD_
  22. //
  23. // OCD are offsets into the heap to obtain a CD structure
  24. //
  25. typedef WORD OCD;
  26. typedef DWORD LOCD; /* double word offset to a CD */
  27. typedef WORD OOCD; /* offset to table of OCD's. */
  28. #endif //_OCD_
  29. //
  30. // Old version of the structure
  31. //
  32. #define DRIVERINFO_VERSION 0x0200
  33. //
  34. // DRIVERINFO contains extra font information needed by genlib to output text
  35. //
  36. #pragma pack (2)
  37. typedef struct _DRIVERINFO
  38. {
  39. short sSize; /* size of this structure */
  40. short sVersion; /* version number */
  41. WORD fCaps; /* Capabilties Flags */
  42. short sFontID; /* unique font id defined by the driver */
  43. short sYAdjust; /* adjust y position before output character */
  44. /* used by double height characters */
  45. short sYMoved; /* cursor has moved after printing this font */
  46. short sTransTab; /* ID value for CTT */
  47. short sUnderLinePos;
  48. short sDoubleUnderlinePos;
  49. short sStrikeThruPos;
  50. LOCD locdSelect; /* long offset to command descriptor */
  51. LOCD locdUnSelect; /* long offset to command descriptor to unselect */
  52. /* NOOCD is none */
  53. WORD wPrivateData; /* Used in DeskJet driver for font enumerations */
  54. short sShift; /* # of pixels shifted from the center of the
  55. * char center-line. Used for Z1 cartidge.
  56. * Use a negative value representing left shift.
  57. */
  58. WORD wFontType; /* Type of font */
  59. } DRIVERINFO;
  60. #pragma pack ()
  61. //
  62. // flags defined for DRIVERINFO.fCaps
  63. //
  64. #define DF_NOITALIC 0x0001 // Cannot italicize via FONTSIMULATION
  65. #define DF_NOUNDER 0x0002 // Cannot underline via FONTSIMULATION
  66. #define DF_XM_CR 0x0004 // send CR after using this font
  67. #define DF_NO_BOLD 0x0008 // Cannot bold via FONTSIMULATION
  68. #define DF_NO_DOUBLE_UNDERLINE 0x0010 // Cannot double underline
  69. // via FONTSIMULATION
  70. #define DF_NO_STRIKETHRU 0x0020 // Cannot strikethru via FONTSIMULATION
  71. #define DF_BKSP_OK 0x0040 // Can use backspace char, see spec.
  72. //
  73. // Types for DRIVERINFO.wFontType
  74. //
  75. #define DF_TYPE_HPINTELLIFONT 0 // HP's Intellifont
  76. #define DF_TYPE_TRUETYPE 1 // HP's PCLETTO fonts on LJ4
  77. #define DF_TYPE_PST1 2 // Lexmark PPDS scalable fonts
  78. #define DF_TYPE_CAPSL 3 // Canon CAPSL scalable fonts
  79. #define DF_TYPE_OEM1 4 // OEM scalable font type 1
  80. #define DF_TYPE_OEM2 5 // OEM scalable font type 2
  81. //
  82. // The following structure has awful alignment characteristics. So,
  83. // all the non-aligned entries have been turned into BYTE arrays. This
  84. // ensures that the structure has the correct size, since we MUST
  85. // use the data in the minidrivers, which have this format.
  86. //
  87. //
  88. // res_PFMHEADER
  89. //
  90. typedef struct _res_PFMHEADER
  91. {
  92. short dfType;
  93. short dfPoints;
  94. short dfVertRes;
  95. short dfHorizRes;
  96. short dfAscent;
  97. short dfInternalLeading;
  98. short dfExternalLeading;
  99. BYTE dfItalic;
  100. BYTE dfUnderline;
  101. BYTE dfStrikeOut;
  102. BYTE b_dfWeight[ 2 ]; // short dfWeight;
  103. BYTE dfCharSet;
  104. short dfPixWidth;
  105. short dfPixHeight;
  106. BYTE dfPitchAndFamily;
  107. BYTE b_dfAvgWidth[ 2 ]; // short dfAvgWidth;
  108. BYTE b_dfMaxWidth[ 2 ]; // short dfMaxWidth;
  109. BYTE dfFirstChar;
  110. BYTE dfLastChar;
  111. BYTE dfDefaultChar;
  112. BYTE dfBreakChar;
  113. BYTE b_dfWidthBytes[ 2 ]; // short dfWidthBytes;
  114. BYTE b_dfDevice[ 4 ]; // DWORD dfDevice;
  115. BYTE b_dfFace[ 4 ]; // DWORD dfFace;
  116. BYTE b_dfBitsPointer[ 4 ]; // DWORD dfBitsPointer;
  117. BYTE b_dfBitsOffset[ 4 ]; // DWORD dfBitsOffset;
  118. BYTE dfReservedByte;
  119. } res_PFMHEADER;
  120. //
  121. // PFMHEADER
  122. //
  123. // Following are the correctly byte aligned versions of the above
  124. // structures with a name beginning res_
  125. //
  126. typedef struct _PFMHEADER
  127. {
  128. DWORD dfDevice;
  129. DWORD dfFace;
  130. DWORD dfBitsPointer;
  131. DWORD dfBitsOffset;
  132. short dfType;
  133. short dfPoints;
  134. short dfVertRes;
  135. short dfHorizRes;
  136. short dfAscent;
  137. short dfInternalLeading;
  138. short dfExternalLeading;
  139. short dfWeight;
  140. short dfPixWidth;
  141. short dfPixHeight;
  142. short dfAvgWidth;
  143. short dfMaxWidth;
  144. short dfWidthBytes;
  145. BYTE dfItalic;
  146. BYTE dfUnderline;
  147. BYTE dfStrikeOut;
  148. BYTE dfCharSet;
  149. BYTE dfFirstChar;
  150. BYTE dfLastChar;
  151. BYTE dfDefaultChar;
  152. BYTE dfBreakChar;
  153. BYTE dfPitchAndFamily;
  154. BYTE dfReservedByte;
  155. } PFMHEADER;
  156. //
  157. // res_PFMEXTENSION
  158. //
  159. typedef struct _res_PFMEXTENSION
  160. {
  161. WORD dfSizeFields;
  162. BYTE b_dfExtMetricsOffset[ 4 ];
  163. BYTE b_dfExtentTable[ 4 ];
  164. BYTE b_dfOriginTable[ 4 ];
  165. BYTE b_dfPairKernTable[ 4 ];
  166. BYTE b_dfTrackKernTable[ 4 ];
  167. BYTE b_dfDriverInfo[ 4 ];
  168. BYTE b_dfReserved[ 4 ];
  169. } res_PFMEXTENSION;
  170. //
  171. // PFMEXTENSION
  172. //
  173. // The aligned version of the above - for civilised users
  174. //
  175. typedef struct _PFMEXTENSION
  176. {
  177. DWORD dfSizeFields; /* DWORD for alignment */
  178. DWORD dfExtMetricsOffset;
  179. DWORD dfExtentTable;
  180. DWORD dfOriginTable;
  181. DWORD dfPairKernTable;
  182. DWORD dfTrackKernTable;
  183. DWORD dfDriverInfo;
  184. DWORD dfReserved;
  185. } PFMEXTENSION;
  186. //
  187. // PFM structure used by all hardware fonts
  188. //
  189. typedef struct _PFM
  190. {
  191. res_PFMHEADER pfm;
  192. res_PFMEXTENSION pfme;
  193. } PFM;
  194. //
  195. // BMFEXTENSION
  196. //
  197. // bitmap font extension
  198. //
  199. typedef struct _BMFEXTENSION
  200. {
  201. DWORD flags; // Bit Blags
  202. WORD Aspace; // Global A space, if any
  203. WORD Bspace; // Global B space, if any
  204. WORD Cspace; // Global C space, if any
  205. DWORD oColor; // offset to color table, if any
  206. DWORD reserve;
  207. DWORD reserve1;
  208. WORD reserve2;
  209. WORD dfCharOffset[1]; // Area for storing the character offsets
  210. } BMFEXTENSION;
  211. //
  212. // BMF
  213. // bitmap font structure used by 3.0 bitmap fonts
  214. //
  215. typedef struct _BMF
  216. {
  217. PFMHEADER pfm;
  218. BMFEXTENSION bmfe;
  219. } BMF;
  220. #ifndef _EXTTEXTMETRIC_
  221. #define _EXTTEXTMETRIC_
  222. //
  223. // EXTTEXTMETRIC
  224. //
  225. typedef struct _EXTTEXTMETRIC
  226. {
  227. short emSize;
  228. short emPointSize;
  229. short emOrientation;
  230. short emMasterHeight;
  231. short emMinScale;
  232. short emMaxScale;
  233. short emMasterUnits;
  234. short emCapHeight;
  235. short emXHeight;
  236. short emLowerCaseAscent;
  237. short emLowerCaseDescent;
  238. short emSlant;
  239. short emSuperScript;
  240. short emSubScript;
  241. short emSuperScriptSize;
  242. short emSubScriptSize;
  243. short emUnderlineOffset;
  244. short emUnderlineWidth;
  245. short emDoubleUpperUnderlineOffset;
  246. short emDoubleLowerUnderlineOffset;
  247. short emDoubleUpperUnderlineWidth;
  248. short emDoubleLowerUnderlineWidth;
  249. short emStrikeOutOffset;
  250. short emStrikeOutWidth;
  251. WORD emKernPairs;
  252. WORD emKernTracks;
  253. } EXTTEXTMETRIC;
  254. #endif //_EXTTEXTMETRIC_
  255. //
  256. // w3KERNPAIR
  257. //
  258. typedef struct _w3KERNPAIR
  259. {
  260. union
  261. {
  262. BYTE each[2];
  263. WORD both;
  264. } kpPair;
  265. short kpKernAmount;
  266. } w3KERNPAIR;
  267. //
  268. // w3KERNTRACK
  269. //
  270. typedef struct _w3KERNTRACK
  271. {
  272. short ktDegree;
  273. short ktMinSize;
  274. short ktMinAmount;
  275. short ktMaxSize;
  276. short ktMaxAmount;
  277. } w3KERNTRACK;
  278. //
  279. // TRANSTAB is used to do ANSI to OEM code pages.
  280. //
  281. typedef struct _TRANSTAB
  282. {
  283. WORD wType; // tells what type of translation table
  284. BYTE chFirstChar;
  285. BYTE chLastChar;
  286. union
  287. {
  288. short psCode[1];
  289. BYTE bCode[1];
  290. BYTE bPairs[1][2];
  291. } uCode;
  292. } TRANSTAB, *PTRANSTAB;
  293. //
  294. // Defined indices for wType
  295. //
  296. #define CTT_WTYPE_COMPOSE 0
  297. //
  298. // uCode is an array of 16-bit offsets from the
  299. // beginning of the file pointing to the strings to
  300. // use for translation. The length of the translated
  301. // string is the difference between the next offset
  302. // and the current offset.
  303. //
  304. #define CTT_WTYPE_DIRECT 1
  305. //
  306. // uCode is a byte array of one-to-one translation
  307. // table from bFirstChar to bLastChar
  308. //
  309. #define CTT_WTYPE_PAIRED 2
  310. //
  311. // uCode contains an array of paired unsigned
  312. // bytes. If only one character is needed to do
  313. // the translation then the second byte is zero,
  314. // otherewise the second byte is struct over the
  315. // first byte.
  316. //
  317. //
  318. // Predefined CTT in Win95
  319. //
  320. #define CTT_CP437 -1 // MS-DOS United States
  321. #define CTT_CP850 -2 // MS-DOS Multilingual (Latin I)
  322. #define CTT_CP863 -3 // MS-DOS Canadian-French
  323. #define CTT_BIG5 -261 // Chinese (PRC, Singapore)
  324. #define CTT_ISC -258 // Korean
  325. #define CTT_JIS78 -256 // Japan
  326. #define CTT_JIS83 -259 // Japan
  327. #define CTT_JIS78_ANK -262 // Japan
  328. #define CTT_JIS83_ANK -263 // Japan
  329. #define CTT_NS86 -257 // Chinese (PRC, Singapore)
  330. #define CTT_TCA -260 // Chinese (PRC, Singapore)
  331. //
  332. // PFMDATA
  333. //
  334. typedef struct _PFMDATA
  335. {
  336. PFMHEADER *pPfmHeader;
  337. short *pCharWidths;
  338. PFMEXTENSION *pPfmExtension;
  339. EXTTEXTMETRIC *pExtTextMetrics;
  340. short *pExtentTable;
  341. DRIVERINFO *pDriverInfo;
  342. w3KERNPAIR *pKernPair;
  343. w3KERNTRACK *pKernTrack;
  344. } PFMDATA;
  345. //
  346. // PCMHEADER is taken from HP/PCL font installer's "pfm.h".
  347. //
  348. typedef struct _PCMHEADER
  349. {
  350. WORD pcmMagic;
  351. WORD pcmVersion;
  352. DWORD pcmSize;
  353. DWORD pcmTitle;
  354. DWORD pcmPFMList;
  355. } PCMHEADER;
  356. #define PCM_MAGIC 0xCAC
  357. #define PCM_VERSION 0x310
  358. #endif // _UNI16RES