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.

290 lines
9.1 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: fontfile.h
  3. *
  4. * (Brief description)
  5. *
  6. * Created: 25-Oct-1990 09:20:11
  7. * Author: Bodin Dresevic [BodinD]
  8. *
  9. * Copyright (c) 1990 Microsoft Corporation
  10. *
  11. * (General description of its use)
  12. *
  13. * Dependencies:
  14. *
  15. * (#defines)
  16. * (#includes)
  17. *
  18. \**************************************************************************/
  19. // The CVTRESDATA struct contains the info about particular resource
  20. // The info is in the converted form (RES_ELEM points to the "raw"
  21. // data in the font file, while CVTRESDATA points to the data obtained
  22. // from bConvertFontRes
  23. // header of the converted font file, it is used both for 2.0 and 3.0 files,
  24. // the fields that are 3.0 specofic are all zero filled for 2.0 font file.
  25. // this structure has proper DWORD allignment, so that its fields can be
  26. // accessed in the usual fashion, pcvtfh->field_name
  27. #define FS_ZERO_WIDTH_GLYPHS 1
  28. typedef struct _CVTFILEHDR // cvtfh,
  29. {
  30. USHORT iVersion; // 2 OR 3
  31. USHORT fsFlags; // zero width glyphs present
  32. UCHAR chFirstChar; // First character defined in font
  33. UCHAR chLastChar; // Last character defined in font
  34. UCHAR chDefaultChar; // Sub. for out of range chars.
  35. UCHAR chBreakChar; // Word Break Character
  36. USHORT cy; // height in Fixed Height
  37. USHORT usMaxWidth; // Maximum width; one of the corrected values
  38. #ifdef FE_SB // _CVTFILEHDR - add fields for DBCS
  39. USHORT usDBCSWidth; // Width of double byte character
  40. USHORT usCharSet; // Charset of this font resource
  41. #endif // FE_SB
  42. PTRDIFF dpOffsetTable; // offset to the offset table, I added this field
  43. // fields that have no analog in original headers, to be filled with the data
  44. // that corresponds to the converted "file" only. This info is cashed for
  45. // later use by vFill_IFIMETRICS
  46. ULONG cjFaceName;
  47. ULONG cjIFI;
  48. ULONG cjGlyphMax; // size of the largest GLYPHDATA structure in ULONG's
  49. } CVTFILEHDR, *PCVTFILEHDR;
  50. // flags for the fsSelection field are the same as for the corresponding
  51. // field of the IFIMETRICS structure of the ntifi.h interface, i.e.:
  52. // FM_SEL_ITALIC
  53. // FM_SEL_STRIKEOUT
  54. // FM_SEL_UNDERSCORE
  55. // FM_SEL_BOLD
  56. typedef struct _FACEINFO // fai
  57. {
  58. RES_ELEM re;
  59. HANDLE hResData; // only used for 32 bit dlls
  60. #ifdef FE_SB
  61. BOOL bVertical; // if this face is @face , this field is TRUE
  62. #endif // FE_SB
  63. CVTFILEHDR cvtfh; // aligned and CORRECTED data from the ogiginal header
  64. ULONG iDefFace;
  65. CP_GLYPHSET *pcp; // pointer to struc describing supported glyph set
  66. IFIMETRICS *pifi; // pointer to ifimetrics for this face
  67. } FACEINFO, *PFACEINFO;
  68. // The FACEDATA struct contains the info about particular face
  69. // (simulated faces included)
  70. // allowed values for the FACEDATA.iSimulate field, !!! these must not change
  71. #define FC_SIM_NONE 0L
  72. #define FC_SIM_EMBOLDEN 1L
  73. #define FC_SIM_ITALICIZE 2L
  74. #define FC_SIM_BOLDITALICIZE 3L
  75. typedef struct _BM_FONTFILE *PFONTFILE; // pff
  76. typedef struct _BM_FONTCONTEXT *PFONTCONTEXT; // pfc
  77. #define FF_EXCEPTION_IN_PAGE_ERROR 1
  78. typedef struct _BM_FONTFILE // ff
  79. {
  80. // fields required by handle manager
  81. ULONG ident; // identifier,conveniently chosen as 0X000000FF
  82. // remaining fields
  83. FLONG fl;
  84. ULONG iType; // original file is *.fnt, 16 bit dll or 32 bit dll
  85. HFF iFile;
  86. ULONG cRef; // # no of times this font file is selected into fnt context
  87. ULONG cFntRes; // # of *.fnt files associated with this fontfile struct
  88. // == # of default faces
  89. ULONG cjDescription; // size of the desctiption string (in bytes)
  90. // if size is zero, then there is no string
  91. // and the facename should be used instead.
  92. PTRDIFF dpwszDescription; // offset to the description string
  93. // array of FACEDATA strucs, which is followed by a UNICODE description
  94. // string.
  95. // Full size of the FONTFILE structure is equal to
  96. FACEINFO afai[1];
  97. } FONTFILE;
  98. // allowed values for FONTFILE.iType field:
  99. // ORIGINAL FILE IS AN *.FNT FILE which contains a single
  100. // size of the single font
  101. #define TYPE_FNT 1L
  102. // ORIGINAL FILE IS A win 3.0 16 bit *.DLL (*.fon FILE),
  103. // This file is compiled out of many *.fnt files
  104. // that correspond to different sizes of the same face, (e.g. tmsr or helv)
  105. // This is provided to ensure binary compatibility with win 3.0 *.fon files
  106. #define TYPE_DLL16 2L
  107. // ORIGINAL FILE IS A win 3.0 32 bit *.DLL
  108. // This file is compiled out of many *.fnt files using NT tools
  109. // (coff linker and nt resource compiler)
  110. #define TYPE_DLL32 3L
  111. // an fnt file that is embeded in an exe and loaded using FdLoadResData
  112. #define TYPE_EXE 4L
  113. //
  114. // Allowed values for the FONTFILE.iDefaultFace field
  115. //
  116. #define FF_FACE_NORMAL 0L
  117. #define FF_FACE_BOLD 1L
  118. #define FF_FACE_ITALIC 2L
  119. #define FF_FACE_BOLDITALIC 3L
  120. typedef struct _BM_FONTCONTEXT // fc
  121. {
  122. // fields required by handle manager
  123. ULONG ident; // identifier,conveniently chosen as 0X000000FC
  124. // remaining fields
  125. HFF hff; // handle of the font file selected into this context
  126. #ifdef FE_SB // FONTCONTEXT
  127. ULONG ulRotate; // Rotation degree 0 , 900 , 1800 , 2700
  128. #endif // FE_SB
  129. // which resource (face) this context corresponds
  130. FACEINFO *pfai;
  131. // what to do
  132. FLONG flFontType;
  133. // For Win 3.1 compatibility raster fonts can be scaled from 1 to 5
  134. // vertically and 1-256 horizontally. ptlScale contains the x and y
  135. // scaling factors.
  136. POINTL ptlScale;
  137. // the size of the GLYPHDATA structure necessary to store the largest
  138. // glyph bitmap with the header info. This is value is cashed at the
  139. // time the font context is opened and used later in FdQueryGlyphBitmap
  140. ULONG cxMax; // the width in pels of the largest bitmap
  141. ULONG cjGlyphMax; // size of the RASTERGLYPH for the largest glyph
  142. // true if ptlScale != (1,1)
  143. FLONG flStretch;
  144. // buffer of the width of the maximum bm scan, to be used by sretch routine
  145. // We shall only use ajStrecthBuffer if the buffer of length CJ_STRETCH
  146. // that is allocated on the stack is not big enough, which should almost
  147. // never happen
  148. BYTE ajStretchBuffer[1];
  149. }FONTCONTEXT;
  150. // set if ptlScale != (1,1)
  151. #define FC_DO_STRETCH 1
  152. // set if streching WIDE glyph which can not fit in CJ_STRETCH buffer
  153. #define FC_STRETCH_WIDE 2
  154. // exaple: if CJ_STRETCH == 256, that suffices for bitmap of width cx = 2048
  155. // == 8 bits * 256 bytes
  156. #define CJ_STRETCH (sizeof(DWORD) * 64)
  157. //
  158. // The face provided in the *.fnt file may or may not be emboldened
  159. // or italicized, but most often (I'd say in 99.99% of the cases)
  160. // it will be neither emboldened nor italicized.
  161. //
  162. // If the font provided in the *.fnt file is "normal" (neither bold nor italic)
  163. // there will be 4 faces associated with this *.fnt:
  164. //
  165. // default, // neither bold nor italic
  166. // emboldened, // simulated
  167. // italicized // simulated
  168. // emboldened and italicized. // simulated
  169. //
  170. // If the font provided in the *.fnt file is already emboldened
  171. // there will be 2 faces associated with this *.fnt:
  172. //
  173. // default, // already emboldened
  174. // italicized // will appear as emboldened and italicized font
  175. // // where italicization will be simulated
  176. //
  177. // If the font provided in the *.fnt file is already italicized
  178. // there will be 2 faces associated with this *.fnt:
  179. //
  180. // default, // already italicized
  181. // emboldened // will appear as emboldened and italicized font
  182. // // where emboldening will be simulated
  183. //
  184. // If the font provided in the *.fnt file is already italicized and emboldened
  185. // only a single default face will be associated with this *.fnt. No simulated faces
  186. // will be provided
  187. //
  188. // identifiers for FONTFILE and FONTCONTEXT objects
  189. #define ID_FONTFILE 0x000000FF
  190. #define ID_FONTCONTEXT 0x000000FC
  191. // object types for these objects
  192. #define TYPE_FONTCONTEXT (OBJTYPE)0x0040
  193. #define TYPE_FONTFILE (OBJTYPE)0x0041
  194. // basic "methods" that act on the FONTFILE object (in fontfile.c)
  195. #define hffAlloc(cj) ((HFF)EngAllocMem(0, cj, 'dfmB'))
  196. #define PFF(hff) ((PFONTFILE)(hff))
  197. // basic "methods" that act on the FONTCONTEXT object (in fontfile.c)
  198. #define hfcAlloc(cj) ((HFC)EngAllocMem(0, cj, 'dfmB'))
  199. #define PFC(hfc) ((PFONTCONTEXT)(hfc))
  200. #undef VFREEMEM
  201. #define VFREEMEM(pv) EngFreeMem((PVOID)pv)
  202. extern HSEMAPHORE ghsemBMFD;
  203. extern CP_GLYPHSET *gpcpGlyphsets;