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.

218 lines
7.8 KiB

  1. #ifndef __FONT_H__
  2. #define __FONT_H__
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. /*****************************************************************************
  7. * *
  8. * FONT.H *
  9. * *
  10. * Copyright (C) Microsoft Corporation 1990 - 1994. *
  11. * All Rights reserved. *
  12. * *
  13. ******************************************************************************
  14. * *
  15. * Module Intent *
  16. * *
  17. * Structures for font handling and export of FONTLYR.C APIs *
  18. * *
  19. ******************************************************************************
  20. * *
  21. * Current Owner: RHobbs *
  22. * *
  23. *****************************************************************************/
  24. /****************************************************************************
  25. * Constants *
  26. *****************************************************************************/
  27. #define coDEFAULT RGB(1, 1, 0)
  28. #define coBLACK RGB( 0, 0, 0)
  29. #define coBLUE RGB( 0, 0, 255)
  30. #define coCYAN RGB( 0, 255, 255)
  31. #define coGREEN RGB( 0, 255, 0)
  32. #define coMAGENTA RGB(255, 0, 255)
  33. #define coRED RGB(255, 0, 0)
  34. #define coYELLOW RGB(255, 255, 0)
  35. #define coWHITE RGB(255, 255, 255)
  36. #define coDARKBLUE RGB( 0, 0, 128)
  37. #define coDARKCYAN RGB( 0, 128, 128)
  38. #define coDARKGREEN RGB( 0, 128, 0)
  39. #define coDARKMAGENTA RGB(128, 0, 128)
  40. #define coDARKRED RGB(128, 0, 0)
  41. #define coDARKYELLOW RGB(128, 128, 0)
  42. #define coDARKGREY RGB(128, 128, 128)
  43. #define coLIGHTGRAY RGB(192, 192, 192)
  44. #define coNIL ((DWORD)0x80000000L)
  45. #define iFntNil ((SHORT)-1) // Protect comparisons in WIN32
  46. #define iFntDefault 0
  47. #define idStyleNil ((SHORT)0)
  48. #define idStyleDefault idStyleNil // The default style is...none
  49. #define idStyleInternalIndexOrigin 1
  50. #define FONT_CACHE_DEFAULT_SIZE 12 // Maximum previously created fonts are remembered.
  51. /****************************************************************************
  52. * TypeDefs *
  53. *****************************************************************************/
  54. #pragma warning(disable : 4200) // for zero-sized array
  55. typedef struct kerntable_tag
  56. {
  57. short cKernPairs;
  58. short rgIndexToKernPairs[256];
  59. KERNINGPAIR rgKernPairs[0];
  60. } KERNTABLE, FAR *QKERNTABLE;
  61. #pragma warning(default : 4200)
  62. // Critical structure that gets messed up in /Zp8
  63. #pragma pack(1)
  64. #define FONT_FILE_HEADER_SIZE 40
  65. typedef struct {
  66. SHORT iFntNameCount;
  67. SHORT iFntEntryCount;
  68. SHORT iFntNameTabOff; // MUST be the 3rd entry for backward comp.
  69. SHORT iFntEntryTabOff; // CF entry offset
  70. SHORT iStyleEntryCount;
  71. SHORT iStyleEntryTabOff;
  72. SHORT iCharMapNameCount; // Number of charmap entries
  73. SHORT iCharMapNameOff; // Offset to charmap's filename
  74. SHORT iCharMapPtrOff; // Offset to all charmap pointers
  75. SHORT iCharMapFlag;
  76. } FONTTABLE, FAR *QFONTTABLE;
  77. // LOGFONTJR is the LOGFONT structure with no lfFaceName field.
  78. // Under Windows, the first five fields of LOGFONT are int's;
  79. // under Windows NT and the Windows Library for Macintosh, the
  80. // first five fields of the LOGFONT structure are LONG's. This
  81. // structure uses the NT and Mac format.
  82. typedef struct
  83. {
  84. LONG lfHeight;
  85. LONG lfWidth;
  86. LONG lfEscapement;
  87. LONG lfOrientation;
  88. LONG lfWeight;
  89. BYTE lfItalic;
  90. BYTE lfUnderline;
  91. BYTE lfStrikeOut;
  92. BYTE lfCharSet;
  93. BYTE lfOutPrecision;
  94. BYTE lfClipPrecision;
  95. BYTE lfQuality;
  96. BYTE lfPitchAndFamily;
  97. } LOGFONTJR, FAR *QLOGFONTJR;
  98. typedef struct
  99. {
  100. BYTE red;
  101. BYTE green;
  102. BYTE blue;
  103. } RGBS, FAR *QRGBS;
  104. #ifdef MOS
  105. // We need converters from 16bit logfont to 32bit.
  106. #define QvCopyLogfontFromLogfontjr( lf, lfjr) \
  107. ( (lf)->lfHeight = (int)(lfjr)->lfHeight, \
  108. (lf)->lfWidth = (int)(lfjr)->lfWidth, \
  109. (lf)->lfEscapement = (int)(lfjr)->lfEscapement, \
  110. (lf)->lfOrientation = (int)(lfjr)->lfOrientation, \
  111. (lf)->lfWeight = (int)(lfjr)->lfWeight, \
  112. *((DWORD*)&((lf)->lfItalic)) = *((DWORD*)&((lfjr)->lfItalic)), \
  113. *((DWORD*)&((lf)->lfOutPrecision)) = *((DWORD*)&((lfjr)->lfOutPrecision)) \
  114. )
  115. #define QvCopyLogfontjrFromLogfont( lfjr, lf) \
  116. ( (lfjr)->lfHeight = (short)(lf)->lfHeight, \
  117. (lfjr)->lfWidth = (short)(lf)->lfWidth, \
  118. (lfjr)->lfEscapement = (short)(lf)->lfEscapement, \
  119. (lfjr)->lfOrientation = (short)(lf)->lfOrientation, \
  120. (lfjr)->lfWeight = (short)(lf)->lfWeight, \
  121. *((DWORD*)&((lfjr)->lfItalic)) = *((DWORD*)&((lf)->lfItalic)), \
  122. *((DWORD*)&((lfjr)->lfOutPrecision)) = *((DWORD*)&((lf)->lfOutPrecision)) \
  123. )
  124. #endif // MOS
  125. // When you change this structure, you MUST make a corresponding change
  126. // to cfDefault in the file, OUTTEXT.C, in the compiler sources. Make sure
  127. // that LOGFONTJR is 4-byte alignment for MIPS
  128. typedef struct
  129. {
  130. WORD wIdFntName; // Font name id
  131. SHORT iExpansion; // positive for expansion; negative for compression
  132. SHORT idStyleInternal;
  133. COLORREF clrFore;
  134. COLORREF clrBack;
  135. LOGFONTJR lf;
  136. BYTE bFlags;
  137. char bSubSuper; // positive for superscript; negative for subscript
  138. } CF, FAR *QCF, FAR *LPCF;
  139. // Bit flags for the CF bFlags field.
  140. #define fHIDDEN 0x0001
  141. #define fHOTSPOT 0x0002
  142. #define fSMALLCAPS 0x0004
  143. #define fNOUNDERLINE 0x0008 // Used by char styles to remove underlining
  144. #define fDOTUNDERLINE 0x0010
  145. #define fWORDUNDERLINE 0x0020
  146. #define fDBLUNDERLINE 0x0040
  147. #define fOUTLINE 0x0080
  148. #define STYLESIZE 64
  149. typedef struct // Style Sheet Entry
  150. {
  151. SHORT idStyleInternal; // ID for this style sheet
  152. SHORT idStyleBasedOnInternal; // ID for style sheet this one is based on
  153. CF cf; // character format for this style sheet
  154. BYTE bFlags; // TRUE if additive style; else FALSE
  155. BYTE bUnusedPad;
  156. char lfFaceName[LF_FACESIZE+1]; // Font face name for this style
  157. char szStyleName[STYLESIZE+1]; // Name for this style sheet
  158. } STE, NEAR *PSTE, FAR *LPSTE;
  159. // Bit flags for the STE bFlags field.
  160. #define fADDITIVE 0x0001
  161. // Critical structure that gets messed up in /Zp8
  162. #pragma pack()
  163. /*****************************************************************************
  164. * Defines for Backwards Compatibility *
  165. *****************************************************************************/
  166. #define OLD_LF_FACESIZE 20
  167. // #define OLD_FONTTABLE_SIZE (sizeof(FONTTABLE) - (sizeof(SHORT) * 2))
  168. /*****************************************************************************
  169. * Prototypes *
  170. *****************************************************************************/
  171. BOOL FAR PASCAL fCreateFntCache(QDE);
  172. VOID FAR PASCAL DestroyFntCache(QDE);
  173. VOID FAR PASCAL ClearFntCache(QDE);
  174. BOOL FAR PASCAL fSetFont(QDE, SHORT);
  175. BOOL FAR PASCAL GetCFFromHandle (QDE, int, QCF, QCH);
  176. VOID FAR PASCAL FontTableInfoFree (HANDLE);
  177. #ifdef __cplusplus
  178. }
  179. #endif
  180. #endif // __FONT_H__