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.

309 lines
10 KiB

  1. /*++
  2. Copyright (c) 1996 - 1999 Microsoft Corporation
  3. Module Name:
  4. fontmap.h
  5. Abstract:
  6. Unidrv FONTMAP and related info header file.
  7. Environment:
  8. Windows NT Unidrv driver
  9. Revision History:
  10. 05-19-97 -eigos-
  11. Created
  12. dd-mm-yy -author-
  13. description
  14. --*/
  15. #ifndef _FONTMAP_
  16. #define _FONMTAP_
  17. //
  18. // CD - Command Descriptor is used in many of the following structures to
  19. // reference a particular set of printer command/escape codes
  20. // used to select paper sizes, graphics resolutions, character attributes,
  21. // etc. If CD.wType = CMD_FTYPE_EXTENDED, the CD is followed by CD.sCount
  22. // EXTCD structures.
  23. //
  24. #define NOOCD -1 // command does not exist
  25. typedef struct _CD
  26. {
  27. BYTE fType; // type of command
  28. BYTE bCmdCbId; // command callback ID, as in 95
  29. short sCount;
  30. WORD wLength; // length of the command
  31. char rgchCmd[2]; // Actual Command String, variable length
  32. } CD, *PCD;
  33. //
  34. // FINVOCATION data structure is in printoem.h at public\oak\inc
  35. //
  36. //
  37. // FONTMAP structure for NT 5.0
  38. //
  39. typedef struct _FONTMAP *PFONTMAP;
  40. //
  41. // _________________
  42. // | |
  43. // | Font Main |
  44. // | module |
  45. // -----------------
  46. // | | |
  47. // ____|__ ___|___ __|_____
  48. // |Device ||TT | |TT |
  49. // | font || Bitmap| | Outline|
  50. // | sub || sub | | sub |
  51. // | module|| Module| | Module |
  52. // ------- -------- --------
  53. //
  54. //
  55. //
  56. //
  57. // Glyph output function
  58. //
  59. // TO_DATA structure is in fmtxtout.h
  60. //
  61. typedef DWORD (*PFNGLYPHOUT) (TO_DATA *pTod);
  62. //
  63. // Font selection/deselection function
  64. // UNIDRV
  65. //
  66. typedef BOOL (*PFNSELFONT) (PDEV *pdev, PFONTMAP pFM, POINTL* pptl);
  67. typedef BOOL (*PFNDESELFONT) (PDEV *pdev, PFONTMAP pFM);
  68. typedef BOOL (*PFNFREEPFM) (PFONTMAP pFM);
  69. //
  70. // font download functions
  71. //
  72. // Header download function
  73. // This function returns the memory used to download this font.
  74. // If this function fails, this function has to return 0,
  75. //
  76. typedef DWORD (*PFNDLHEADER) (PDEV *pdev, PFONTMAP pFM);
  77. //
  78. // Character glyph download function
  79. // This function returns the memory used to download this character.
  80. // If this function fails, this function has to return 0. The optional
  81. // parameter is width. This function should fill in the width of the
  82. // Glyph downloaded. This value is save in DLGLYPH.wWidth field.
  83. //
  84. typedef DWORD (*PFNDLGLYPH) ( PDEV *pdev, PFONTMAP pFM,
  85. HGLYPH hGlyph, WORD wDLGlyphId, WORD *pwWidth);
  86. //
  87. // Before downnloading this font a font main calls this function
  88. // to determine if this font can be downloaded with this font and the current
  89. // condition.
  90. // Sub module checks if this font is appropriate to download with FONTMAP.
  91. // And checks if the remaining memory is enough to download this font.
  92. //
  93. typedef BOOL (*PFNCHECKCOND) ( PDEV *pdev, FONTOBJ *pfo,
  94. STROBJ *pstro, IFIMETRICS *pifi);
  95. typedef struct _FONTMAP
  96. {
  97. DWORD dwSignature; // FONTMAP Signature
  98. DWORD dwSize; // FONTMAP Size.
  99. DWORD dwFontType; // Device/TTBitmap//TTOutline/..
  100. LONG flFlags; // Flags listed below
  101. IFIMETRICS *pIFIMet; // The IFIMETRICS for this font
  102. WCHAR wFirstChar; // First char available
  103. WCHAR wLastChar; // Last one available - inclusive
  104. ULONG ulDLIndex; // Currently selected DL index.
  105. WORD wXRes; // X Res used for font metrics numbers
  106. WORD wYRes; // Ditto for the y coordinates
  107. SHORT syAdj; // Y position adjustment during printing
  108. //
  109. // Font specific data structure
  110. //
  111. PVOID pSubFM; // Pointer to the font specific data structure
  112. // dwFontType represents this FONTMAP font type.
  113. // FMTYPE_DEVICE
  114. // FMTYPE_TTBITMAP
  115. // FMTYPE_TTOUTLINE
  116. // FMTYPE_TTOEM
  117. //
  118. // Font specific drawing functions' pointers
  119. // These pointers varies according to the dwFontType.
  120. //
  121. PFNGLYPHOUT pfnGlyphOut; // Glyph drawing function
  122. PFNSELFONT pfnSelectFont; // Font selection function
  123. PFNDESELFONT pfnDeSelectFont; // Font deselection function
  124. PFNDLHEADER pfnDownloadFontHeader; // Download font header
  125. PFNDLGLYPH pfnDownloadGlyph; // Download glyph
  126. PFNCHECKCOND pfnCheckCondition; // Condition check function
  127. PFNFREEPFM pfnFreePFM; // To Free the pfm
  128. } FONTMAP, *PFONTMAP;
  129. //
  130. // Values for dwFontType
  131. //
  132. #define FMTYPE_DEVICE 1 // Set for Device font.
  133. #define FMTYPE_TTBITMAP 2 // Set for True Type Bitmap font.
  134. #define FMTYPE_TTOUTLINE 3 // Set for True Type Outline font.
  135. #define FMTYPE_TTOEM 4 // Set for True Type download OEM callback.
  136. //
  137. // FONTMAP_DEV
  138. // Device font sub part of FONTMAP
  139. //
  140. typedef BOOL (*PFNDEVSELFONT) (PDEV *pdev, BYTE *pbCmd, INT iCmdLength, POINTL *pptl);
  141. typedef struct _FONTMAP_DEV
  142. {
  143. WORD wDevFontType; // Type of Device font
  144. SHORT sCTTid; // It's value as ID in resource data
  145. // Assume that RLE/GTT must be in the same
  146. // DLL as IFI/UFM is in.
  147. SHORT fCaps; // Capabilities flags
  148. SHORT sYAdjust; // Position adjustment amount before print
  149. SHORT sYMoved; // Position adjustment amount after print
  150. SHORT sPadding; // For Padding
  151. union
  152. {
  153. DWORD dwResID; // Resource ID for this font
  154. QUALNAMEEX QualName; // Fully qualified resource ID.
  155. };
  156. EXTTEXTMETRIC *pETM; // Pointer to ETM for this font
  157. FWORD fwdFOAveCharWidth; // TrueType IFI Average char width
  158. FWORD fwdFOMaxCharInc ; // TrueType IFI Max char width.
  159. FWORD fwdFOUnitsPerEm; // TrueType IFI units per em
  160. FWORD fwdFOWinAscender; // TrueType IFI Win Ascender
  161. ULONG ulCodepage; // default codepage
  162. ULONG ulCodepageID; // current codepage
  163. VOID *pUCTree; // UNICODE glyph handle tree
  164. VOID *pUCKernTree; // UNICODE Kernpair table
  165. VOID *pvMapTable; // Allocated MAPTABLE. This is a merged
  166. // MAPTABLE from predefined and mini def.
  167. PUFF_FONTDIRECTORY pFontDir; // UFF font directory of this font.
  168. //
  169. // Font selection function pointer
  170. //
  171. PFNDEVSELFONT pfnDevSelFont; // Device font selection command
  172. //
  173. // File resource pointer
  174. //
  175. VOID *pvNTGlyph; // The GLYPH TRANS data for this font
  176. VOID *pvFontRes; // Font Matrics(IFI) Resource Pointer
  177. VOID *pvPredefGTT; // This is used for lPredefinedID
  178. union
  179. {
  180. SHORT *psWidth; // Width vector (proportional font) else 0
  181. PWIDTHTABLE pWidthTable; // pointer to WIDTHTABLE
  182. } W;
  183. //
  184. // Font command
  185. // If FM_IFIVER40 is set, pCDSelect and pCDDeselect are set.
  186. // Otherwise, FInvSelect/FinvDeselect are set.
  187. //
  188. union
  189. {
  190. CD *pCD; // How to select/deselect this font
  191. FINVOCATION FInv;
  192. }cmdFontSel;
  193. union
  194. {
  195. CD *pCD;
  196. FINVOCATION FInv;
  197. }cmdFontDesel;
  198. } FONTMAP_DEV, *PFONTMAP_DEV;
  199. //
  200. // Values for device font flFlags
  201. //
  202. #define FM_SCALABLE 0x00000001 // Scalable font
  203. #define FM_DEFAULT 0x00000002 // Set for the device's default font
  204. #define FM_EXTCART 0x00000004 // Cartridge, in external font file
  205. #define FM_FREE_GLYDATA 0x00000008 // we need to free GTT or CTT data
  206. #define FM_FONTCMD 0x00000010 // Font select/deselect command in resource
  207. #define FM_WIDTHRES 0x00000020 // Width tables are in a resource
  208. #define FM_IFIRES 0x00000040 // IFIMETRICS are in a resource
  209. #define FM_KERNRES 0x00000080 // FD_KERNINGPAIR is in a resource
  210. #define FM_IFIVER40 0x00000100 // Old IFIMETRICS(NT 4.0) resource
  211. #define FM_GLYVER40 0x00000200 // Old RLE(NT 4.0) resource
  212. #define FM_FINVOC 0x00000400 // FINVOCATION is filled out
  213. #define FM_SOFTFONT 0x00000800 // Soft font, downloaded or installed
  214. #define FM_GEN_SFONT 0x00001000 // Internally generated soft font
  215. #define FM_SENT 0x00002000 // Set if downloaded font downloaded
  216. #define FM_TT_BOUND 0x00004000 // Bound TrueType font
  217. #define FM_TO_PROP 0x00008000 // PROPORTIONAL font
  218. #define FM_EXTERNAL 0x00010000 // External font
  219. //
  220. // FONTMAP_TTB
  221. // TrueType as Bitmap font sub part of FONTMAP
  222. //
  223. typedef struct _FONTMAP_TTB
  224. {
  225. DWORD dwDLSize;
  226. union
  227. {
  228. VOID *pvDLData; // Pointer to DL_MAP
  229. ULONG ulOffset;
  230. } u;
  231. } FONTMAP_TTB, *PFONTMAP_TTB;
  232. //
  233. // FONTMAP_TTO
  234. // TrueType as TrueType Outline font sub part of FONTMAP
  235. //
  236. typedef struct _FONTMAP_TTO
  237. {
  238. VOID *pvDLData; // Pointer to DL_MAP
  239. LONG lCurrentPointSize;
  240. DWORD dwCurrentTextParseMode;
  241. //VOID *pTTFile;
  242. ULONG ulGlyphTable;
  243. ULONG ulGlyphTabLength;
  244. USHORT usNumGlyphs;
  245. SHORT sIndexToLoc; // head.indexToLocFormat
  246. ULONG ulLocaTable;
  247. PVOID pvGlyphData;
  248. //GLYPH_DATA GlyphData; // TT GlyphData
  249. FLONG flFontType; // Font Type (bold/italic)
  250. } FONTMAP_TTO, *PFONTMAP_TTO;
  251. typedef struct _FONTMAP_TTOEM
  252. {
  253. DWORD dwDLSize;
  254. DWORD dwFlags;
  255. FLONG flFontType;
  256. union
  257. {
  258. VOID *pvDLData; // Pointer to DL_MAP
  259. ULONG ulOffset;
  260. } u;
  261. } FONTMAP_TTOEM, *PFONTMAP_TTOEM;
  262. #endif // !_FONTMAP_