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.

378 lines
12 KiB

  1. /************************************************************/
  2. /* Windows Write, Copyright 1985-1992 Microsoft Corporation */
  3. /************************************************************/
  4. /* fontdefs.h -- MW definitions for fonts */
  5. #ifdef PRDFILES
  6. struct PRDD
  7. { /* printer description file descriptor */
  8. int cfcdMac, /* count of fonts defined for this printer */
  9. cxInch, /* pixels per inch, horizontal */
  10. dyaMin, /* " " " " y " */
  11. pid, /* printer identification number */
  12. pe, /* print element */
  13. fNoMSJ, /* microspace justification flag */
  14. fSpecial, /* special flags */
  15. pn, /* serial interface word */
  16. bfcdBase, /* byte address of start of FCDs */
  17. cttBase, /* byte address of start of CTT */
  18. bpcdBase, /* byte address of start of PCDs */
  19. bpcsBase, /* byte address of start of PCSs */
  20. bprdMax; /* end of PRD file */
  21. CHAR (**hrgbprdf)[]; /* block that contains the FCDs and WTs */
  22. int (**hmpiftcfcd)[]; /* double entry table: consists of 2 word
  23. entries, 1st is the font code of this font,
  24. 2nd is heap offset to FCD for this font.
  25. There are exactly cfcdMac sets of these */
  26. CHAR (**hrgbctt)[]; /* character translation table */
  27. CHAR (**hprcc)[]; /* printer control sequences */
  28. /* CHAR szFile[cchMaxFile]; /* file name for printer desc. file */
  29. };
  30. #define cchPRDDFile 26
  31. #define cwPRDD (sizeof (struct PRDD) / sizeof(int))
  32. /* prd file byte offsets */
  33. #define bPrdData1 (typeFC)64
  34. #define bPrdData2 (typeFC)128
  35. #define cpsMax 10
  36. #define dxaDefault ((unsigned) 144)
  37. #ifdef SAND
  38. #define wpcPica 0 /* Daisy wheel pitch codes */
  39. #define wpcElite 1
  40. #define wpcMicron 2
  41. #define wpcProportional 3
  42. #define wpPica 10 /* Pitches */
  43. #define wpElite 12
  44. #define wpMicron 15
  45. #define wpProportional 10 /* Bogus */
  46. #define psPica 12 /* point Sizes */
  47. #define psElite 10
  48. #define psMicron 8
  49. #define psProportional 12 /* Bogus */
  50. #define convWpPs 120 /* conversion between wheel pitch and
  51. Point Size */
  52. /* IMPORTANT-- the following font codes (20, 21, 22, 23) random numbers
  53. we will have to be assigned permanent font codes by Apple */
  54. #define ftcPrintFONT 20
  55. #define ftcPrintFWID 21
  56. #define ftcPrintPSFONT 22
  57. #define ftcPrintPSFWID 23
  58. #endif /* SAND */
  59. struct FAD
  60. { /* Font Address Descriptor */
  61. unsigned wtp; /* multi purpose word */
  62. };
  63. struct PCSD1
  64. { /* printer control sequence descriptor */
  65. int bprcc; /* byte offset of start of control sequence */
  66. CHAR bMod; /* modification byte */
  67. CHAR cch; /* length of control sequence */
  68. };
  69. #define cwPCSD1 (sizeof(struct PCSD1) / sizeof(int))
  70. struct PSD
  71. { /* Printer Size Descriptor */
  72. int hps; /* size available in half points */
  73. struct FAD fad,
  74. fadI,
  75. fadB,
  76. fadIB;
  77. struct PCSD1 pcsdBegin,
  78. pcsdEnd;
  79. };
  80. struct FCD
  81. { /* Font Code Description */
  82. int ctp; /* character translation table pointer (a la wtp) */
  83. int cpsd; /* count of sizes available */
  84. struct PSD rgpsd[cpsMax]; /* psds for each size available */
  85. CHAR rgchFntName[32];/* font name (null terminated) */
  86. };
  87. #define pnfSerial 0100000
  88. #define pnfETX 040000
  89. #define pnfXON 020000
  90. #define MSJ_fNone 1
  91. #define MSJ_fChars 2
  92. #define MSJ_fPSCorrect 4
  93. #define SPC_fNoBSCtt 1
  94. #ifdef GENERIC_MSDOS
  95. #ifdef HP150
  96. #define cPortMac 3
  97. #define cchPort 4
  98. #else /* not HP150 */
  99. #define cPortMac 2
  100. #define cchPort 4
  101. #endif /* not HP150 */
  102. #else /* not GENERIC_MSDOS */
  103. #define cPortMac 5
  104. #define cchPort 5
  105. #endif /* GENERIC_MSDOS */
  106. #define fntMax 6
  107. struct PCSD
  108. { /* printer control sequence descriptor */
  109. int bprcc; /* byte offset of start of control sequence */
  110. CHAR bMod; /* modification byte */
  111. CHAR cch; /* length of control sequence */
  112. CHAR bMagic; /* magic number */
  113. CHAR bMax; /* max value of parameter */
  114. };
  115. #endif /* PRDFILES */
  116. #define hpsMin 8
  117. #define hpsMax 256
  118. #define cchFontSize 4
  119. #define iszSizeMax 32
  120. #define iffnEnumMax 64
  121. #define psFontMin 4
  122. #define psFontMax 127
  123. /* macros used to get/put pitch and font family info in windows data structs */
  124. #define bitPitch 0x01
  125. #define grpbitFamily 0xf0
  126. typedef CHAR FFID; /* font family ID */
  127. #define iftcRoman 0
  128. #define iftcModern 1
  129. #define iftcScript 2
  130. #define iftcDecorative 3
  131. #define iftcSwiss 4
  132. #ifdef SYSENDMARK
  133. #define ftcSystem 0x3E
  134. #define bitFtcChp 0x3E
  135. #endif /* KANJI */
  136. #define ftcNil 255
  137. #define cchFfnMin 1
  138. #define chGhost '\003'
  139. #define iffnProfMax 5 /* # of fonts described in win.ini list */
  140. #define LocalFaceSize 32
  141. #ifndef LF_FACESIZE
  142. /* this is gross, but so's our compiler! */
  143. #define LF_FACESIZE LocalFaceSize
  144. #endif
  145. #ifdef NEWFONTENUM
  146. #define ibFfnMax (LF_FACESIZE + sizeof(FFID) + sizeof(BYTE) + 1 /* to make it a max */)
  147. #else
  148. #define ibFfnMax (LF_FACESIZE + sizeof(FFID) + 1)
  149. #endif
  150. #define CbFfn(cch) (sizeof(struct FFN) - cchFfnMin + (cch))
  151. /* Added 5/5/89: insure we only touch memory to which we're entitled ..pault */
  152. #define CbFromPffn(pffn) (sizeof(FFID)+sizeof(BYTE)+CchSz((pffn)->szFfn))
  153. /* NOTE: If this structure is changed, CbFromPffn() above must be updated! */
  154. typedef struct FFN /* Font Family Name */
  155. {
  156. #ifdef NEWFONTENUM
  157. BYTE chs; /* The charset associated with this facename
  158. (ANSI, OEM, Symbol, etc). We've kludged the
  159. way that FFN's are written out in documents
  160. so see HffntbForNewDoc() ..pault */
  161. #endif
  162. FFID ffid;
  163. /* really a variable length string */
  164. CHAR szFfn[cchFfnMin];
  165. };
  166. /* 255 ffn's lets us map ftc's in a single byte, with one nil value */
  167. #define iffnMax 255
  168. #define cffnMin 1
  169. typedef struct FFNTB /* font table */
  170. {
  171. unsigned int iffnMac: 15;
  172. unsigned int fFontMenuValid: 1; /* Used for names on CHAR dropdown */
  173. struct FFN **mpftchffn[cffnMin];
  174. };
  175. struct FFNTB **HffntbCreateForFn();
  176. struct FFNTB **HffntbNewDoc();
  177. struct FFNTB **HffntbAlloc();
  178. struct FFN *PffnDefault();
  179. #define HffntbGet(doc) ((**hpdocdod)[(doc)].hffntb)
  180. /* following structures support font information caching */
  181. #define fcidNil 0xffffffffL
  182. typedef union FCID /* font cache identifier */
  183. {
  184. long lFcid;
  185. struct
  186. {
  187. unsigned ftc : 8;
  188. unsigned hps : 8;
  189. unsigned doc : 4;
  190. unsigned wFcid : 12;
  191. } strFcid;
  192. };
  193. /* bits set in wFcid */
  194. #define grpbitPsWidthFcid 0x007f
  195. #define bitFixedPitchFcid 0x0080
  196. #define bitUlineFcid 0x0100
  197. #define bitBoldFcid 0x0200
  198. #define bitItalicFcid 0x0400
  199. #define bitPrintFcid 0x0800
  200. #define psWidthMax 127
  201. typedef struct FMI /* font metric information */
  202. {
  203. int *mpchdxp; /* pointer to width table */
  204. /* NOTE - we actually point chDxpMin entries
  205. before the start of the table, so
  206. that the valid range begins at the
  207. start of the actual table */
  208. int dxpSpace; /* width of a space */
  209. int dxpOverhang; /* overhang for italic/bold chars */
  210. int dypAscent; /* ascent */
  211. int dypDescent; /* descent */
  212. int dypBaseline; /* difference from top of cell to baseline */
  213. int dypLeading; /* accent space plus recommended leading */
  214. #ifdef DBCS
  215. int dypIntLeading; /* internal leading */
  216. #if defined(JAPAN) || defined(KOREA) || defined(TAIWAN) || defined(PRC)
  217. WORD dxpDBCS; /* Win3.1 T-HIROYN change BYTE--> WORD*/
  218. #else
  219. BYTE dxpDBCS; /* width of a DBCS character. */
  220. /* WARNING - This assumes a kanji character
  221. is fixed pitch. */
  222. BYTE bDummy; /* To guarantee that this addition
  223. increases the amount by 1 word. */
  224. #endif /* JAPAN */
  225. #endif /* DBCS */
  226. };
  227. #define chFmiMin 0x20
  228. #ifdef WIN30
  229. /* Why are we not asking for widths of all characters? We should. */
  230. #ifdef KOREA
  231. #define chFmiMax 0x80
  232. #elif defined(TAIWAN)
  233. #define chFmiMax 0x80
  234. #elif defined(PRC)
  235. #define chFmiMax 0x80
  236. #else
  237. #define chFmiMax 0x100
  238. #endif
  239. #else
  240. #define chFmiMax 0x80
  241. #endif
  242. #define dxpNil 0xFFFF
  243. typedef struct FCE /* font cache entry */
  244. {
  245. struct FCE *pfceNext; /* next entry in lru list */
  246. struct FCE *pfcePrev; /* prev entry in lru list */
  247. union FCID fcidRequest; /* request this entry satisfied */
  248. union FCID fcidActual; /* what this entry really contains */
  249. struct FFN **hffn; /* font family name */
  250. struct FMI fmi; /* helpful metric information for this entry */
  251. HFONT hfont; /* windows' font object */
  252. int rgdxp[chFmiMax - chFmiMin]; /* width table proper */
  253. };
  254. #define ifceMax 16
  255. struct FCE *PfceLruGet();
  256. struct FCE *PfceFcidScan();
  257. /* values to be passed to LoadFont() directing it's actions */
  258. #define mdFontScreen 0 /* sets font for random screen chars */
  259. #define mdFontChk 1 /* sets font as constrained by printer avail */
  260. #define mdFontJam 2 /* like mdFontChk, but jams props into chp */
  261. #define mdFontPrint 3 /* like mdFontScreen, but for the printer */
  262. #ifdef SAND
  263. typedef struct { /* structure of a Macintosh font. See Font Manager */
  264. int frFontType; /* fr was prepended to each element to */
  265. int frFirstChar; /* prevent "name collision" with the */
  266. int frLastChar; /* elements of FONTINFO */
  267. int frWidMax;
  268. int frKernMax;
  269. int frNDescent;
  270. int frFRectMax;
  271. int frChHeight;
  272. int frOwTLoc;
  273. int frAscent;
  274. int frDescent;
  275. int frLeading;
  276. int frRowWords;
  277. } FONTREC;
  278. #define woFrOwTLoc 8 /* The word offset of the owTLoc from the beginning */
  279. #define wdthTabFrOwTLoc 4 /* The frOwTLoc for a width table */
  280. typedef struct {
  281. int family;
  282. int size;
  283. int face;
  284. int needBits;
  285. int device;
  286. POINT numer;
  287. POINT denom;
  288. } FMINPUT;
  289. typedef struct {
  290. int errNum;
  291. HANDLE fontHandle;
  292. CHAR bold;
  293. CHAR italic;
  294. CHAR ulOffset;
  295. CHAR ulShadow;
  296. CHAR ulThick;
  297. CHAR shadow;
  298. CHAR extra;
  299. CHAR ascent;
  300. CHAR descent;
  301. CHAR widMax;
  302. CHAR leading;
  303. CHAR unused;
  304. POINT numer;
  305. POINT denom;
  306. } FMOUTPUT;
  307. #define qFMOUTPUT ((FMOUTPUT far *) 0x998)
  308. #endif /* SAND */
  309. #define enumFaceNames 0
  310. #define enumFindAspectRatio 1
  311. #define enumSizeList 2
  312. #define enumCheckFont 3
  313. #define enumQuickFaces 4
  314. #ifdef JAPAN
  315. #define enumFaceNameJapan 128 // T-HIROYN Win3.1 use FontFaceEnum JAPAN only
  316. #endif
  317. #ifdef NEWFONTENUM
  318. #define psApprovedMax 48 /* don't know why we don't go up to 64 here; spose
  319. that's for "the big boy word processors" ..pault */
  320. #endif
  321. /* Used in DOPRM.C and FONTENUM.C */
  322. #define csizeApprovedMax 13