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.

245 lines
5.1 KiB

  1. #ifndef METRICS_H
  2. #define METRICS_H
  3. #define ONOFFSIZE(n) ((((n+7)/8)+sizeof(long)-1)/sizeof(long)*sizeof(long))
  4. #define OnCurve(arr, n) !((arr[(USHORT)(n)>>5]) & (ULONG)(1UL<<((USHORT)(n) % 32UL)))
  5. #define SetOffPoint(arr, n) arr[(unsigned)(n)/sizeof(arr[0])/8] |= \
  6. 1UL<<((unsigned)(n) % (sizeof(arr[0])*8))
  7. #define SetOnPoint(arr, n) arr[(unsigned)(n)/sizeof(arr[0])/8] &= \
  8. ~(1UL<<((unsigned)(n) % (sizeof(arr[0])*8UL)))
  9. #define USEMETRICS 0
  10. #define DEFAULTMETRICS 1
  11. #define F8D8 256
  12. #define MAXSNAP (USHORT)12
  13. #define MAXBLUE (USHORT)20
  14. #define UNDEF_CVT 0
  15. #define ENDOFPATH -1
  16. #define NORANGE -2
  17. #define ARGSIZE 2000
  18. #define PGMSIZE 3000
  19. #define DEFAULTMATRIX NULL
  20. #define F16D16BASE (1L<<19L)
  21. #define F16D16HALF (1L<<18L)
  22. #define F16D16PPM 524
  23. typedef int funit;
  24. typedef struct {
  25. funit x;
  26. funit y;
  27. } Point;
  28. typedef struct Outline {
  29. struct Outline *next; /* Next path of the glyph. */
  30. USHORT count; /* Number of 'pts', 'onoff' and 'map'. */
  31. Point *pts; /* X/Y coordinates. */
  32. ULONG *onoff; /* On/Off curve point bit flags. */
  33. } Outline;
  34. typedef struct StemS {
  35. struct StemS *next;
  36. funit offset;
  37. funit width;
  38. short i1;
  39. short i2;
  40. } Stem;
  41. typedef struct Stem3S {
  42. struct Stem3S *next;
  43. Stem stem1;
  44. Stem stem2;
  45. Stem stem3;
  46. } Stem3;
  47. typedef struct FlexS {
  48. struct FlexS *next;
  49. funit civ;
  50. Point pos;
  51. Point midpos;
  52. Point startpos;
  53. USHORT start;
  54. USHORT mid;
  55. USHORT end;
  56. } Flex;
  57. typedef struct {
  58. Stem *vstems;
  59. Stem *hstems;
  60. Stem3 *vstems3;
  61. Stem3 *hstems3;
  62. Flex *flex;
  63. } Hints;
  64. typedef struct Composite {
  65. struct Composite *next;
  66. funit asbx;
  67. funit aw;
  68. funit adx;
  69. funit ady;
  70. const char *achar;
  71. const char *bchar;
  72. char *cchar;
  73. struct encoding *oenc;
  74. } Composite;
  75. typedef struct T1Glyph {
  76. char *name;
  77. Point lsb;
  78. Point width;
  79. Outline *paths;
  80. Hints hints;
  81. } T1Glyph;
  82. typedef struct StemWidth {
  83. funit width;
  84. USHORT storage;
  85. } StemWidth;
  86. typedef struct WeightControl {
  87. StemWidth *vwidths;
  88. USHORT cnt_vw;
  89. USHORT max_vw;
  90. StemWidth *hwidths;
  91. USHORT cnt_hw;
  92. USHORT max_hw;
  93. USHORT storage;
  94. } WeightControl;
  95. struct CVTPos {
  96. funit y;
  97. USHORT cvt;
  98. };
  99. typedef struct StemPos {
  100. struct CVTPos *pos;
  101. USHORT cnt;
  102. USHORT blue_cvt;
  103. } StemPos;
  104. typedef struct AlignmentControl {
  105. StemPos top[MAXBLUE/2];
  106. StemPos bottom[MAXBLUE/2];
  107. USHORT cvt;
  108. } AlignmentControl;
  109. typedef struct Blues {
  110. funit bluevalues[MAXBLUE];
  111. USHORT blue_cnt;
  112. funit otherblues[MAXBLUE];
  113. USHORT oblue_cnt;
  114. funit familyblues[MAXBLUE];
  115. USHORT family_cvt[MAXBLUE/2];
  116. USHORT fblue_cnt;
  117. funit familyotherblues[MAXBLUE];
  118. USHORT familyother_cvt[MAXBLUE/2];
  119. USHORT foblue_cnt;
  120. short blueShift; /* /BlueShift * F8D8 */
  121. UBYTE blueFuzz;
  122. UBYTE blueScale; /* /BlueScale * 1000 */
  123. AlignmentControl align;
  124. } Blues;
  125. struct kerning {
  126. UBYTE left;
  127. UBYTE right;
  128. funit delta;
  129. };
  130. struct T1Metrics {
  131. char *date;
  132. char *copyright;
  133. char *name;
  134. char *id;
  135. char *notice;
  136. char *fullname;
  137. char *weight;
  138. char *family;
  139. struct {
  140. USHORT ver;
  141. USHORT rev;
  142. } version;
  143. f16d16 angle;
  144. funit avgCharWidth;
  145. funit underline;
  146. funit uthick;
  147. funit stdhw;
  148. funit stdvw;
  149. funit defstdhw;
  150. funit defstdvw;
  151. funit stemsnaph[MAXSNAP];
  152. USHORT snaph_cnt;
  153. funit stemsnapv[MAXSNAP];
  154. USHORT snapv_cnt;
  155. UBYTE forcebold;
  156. UBYTE pitchfam;
  157. USHORT fixedPitch;
  158. USHORT flags;
  159. USHORT tmweight;
  160. funit ascent;
  161. funit descent;
  162. funit intLeading;
  163. funit extLeading;
  164. funit superoff;
  165. funit supersize;
  166. funit suboff;
  167. funit subsize;
  168. funit strikeoff;
  169. funit strikesize;
  170. UBYTE firstChar;
  171. UBYTE lastChar;
  172. UBYTE DefaultChar;
  173. UBYTE BreakChar;
  174. UBYTE CharSet;
  175. funit *widths; /* Advance widths. */
  176. struct kerning *kerns;
  177. USHORT kernsize;
  178. WeightControl stems;
  179. Blues blues;
  180. funit upem;
  181. f16d16 *fmatrix;
  182. UBYTE pgm[PGMSIZE];
  183. short args[ARGSIZE];
  184. struct encoding *encoding;
  185. USHORT encSize;
  186. Composite *seac;
  187. Composite *used_seac;
  188. };
  189. /****** MACROS */
  190. #define GetUPEM(t1m) (t1m->upem)
  191. #define GetFontMatrix(t1m) (t1m->fmatrix)
  192. #define GetStdVW(t1m) (t1m->stdvw)
  193. #define GetStdHW(t1m) (t1m->stdhw)
  194. #define GetDefStdVW(t1m) (t1m->defstdvw)
  195. #define GetDefStdHW(t1m) (t1m->defstdhw)
  196. #define SetDefStdVW(t1m, width) t1m->defstdvw = width
  197. #define SetDefStdHW(t1m, width) t1m->defstdhw = width
  198. #define GetCodeStack(t1m) t1m->pgm
  199. #define GetArgStack(t1m) t1m->args
  200. #define GetWeight(t1m) &(t1m->stems)
  201. #define ForceBold(t1m) t1m->forcebold
  202. #define GetAlignment(t1m) &(t1m->blues.align)
  203. #define GetBlues(t1m) &(t1m->blues)
  204. #define CurrentEncoding(t1m) t1m->encoding
  205. #define EncodingSize(t1m) t1m->encSize
  206. #define Composites(t1m) t1m->seac
  207. #define SyntheticOblique(t1m) (t1m->fmatrix && t1m->fmatrix[2])
  208. #endif