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.

310 lines
7.0 KiB

  1. /***
  2. **
  3. ** Module: Builder
  4. **
  5. ** Description:
  6. ** This is a module of the T1 to TT font converter. The module
  7. ** contains functions that will write the tables found in a
  8. ** TrueType font file.
  9. **
  10. ** Author: Michael Jansson
  11. **
  12. ** Created: 5/26/93
  13. **
  14. ***/
  15. #ifndef _ARGS
  16. # define IN const
  17. # define OUT
  18. # define INOUT
  19. # define _ARGS(arg) arg
  20. #endif
  21. #define PREPSIZE 1000
  22. #define MAXNOTDEFSIZE 1024
  23. /* Referenced types. */
  24. struct TTArg;
  25. struct TTHandle;
  26. /* Argument types. */
  27. struct TTGlyph {
  28. struct encoding *code;
  29. USHORT num;
  30. USHORT stack;
  31. USHORT twilights;
  32. UBYTE *hints;
  33. Outline *paths;
  34. funit aw;
  35. funit lsb;
  36. };
  37. struct TTComposite {
  38. struct encoding *aenc;
  39. struct encoding *benc;
  40. struct encoding *cenc;
  41. struct encoding *oenc;
  42. funit dx;
  43. funit dy;
  44. funit aw;
  45. funit lsb;
  46. };
  47. typedef struct {
  48. ULONG a;
  49. ULONG b;
  50. } longdate;
  51. struct TTMetrics {
  52. struct {
  53. USHORT ver;
  54. USHORT rev;
  55. } version;
  56. longdate created;
  57. char *family;
  58. char *copyright;
  59. char *name;
  60. char *id;
  61. char *notice;
  62. char *fullname;
  63. char *weight;
  64. char *verstr;
  65. f16d16 angle;
  66. funit underline;
  67. funit uthick;
  68. USHORT macStyle;
  69. USHORT usWeightClass;
  70. USHORT usWidthClass;
  71. USHORT fsSelection;
  72. /* True Typographical metrics. */
  73. funit typAscender;
  74. funit typDescender;
  75. funit typLinegap;
  76. Point superoff;
  77. Point supersize;
  78. Point suboff;
  79. Point subsize;
  80. funit strikeoff;
  81. funit strikesize;
  82. short isFixPitched;
  83. /* Windows based metrics. */
  84. funit winAscender;
  85. funit winDescender;
  86. UBYTE panose[10];
  87. /* Mac based metrics. */
  88. funit macLinegap;
  89. funit emheight;
  90. USHORT FirstChar;
  91. USHORT LastChar;
  92. USHORT DefaultChar;
  93. USHORT BreakChar;
  94. USHORT CharSet;
  95. funit *widths;
  96. short *cvt;
  97. USHORT cvt_cnt;
  98. struct kerning *kerns;
  99. USHORT kernsize;
  100. /* Copy of the encoding table. */
  101. struct encoding *Encoding;
  102. USHORT encSize;
  103. /* Hint specific information. */
  104. const UBYTE *prep; /* PreProgram. */
  105. USHORT prep_size;
  106. const UBYTE *fpgm; /* FontProgram. */
  107. USHORT fpgm_size;
  108. USHORT maxstorage;
  109. USHORT maxprepstack; /* Max stack depth in pre-program. */
  110. USHORT maxfpgm; /* Max number of function in the font program. */
  111. USHORT onepix; /* Treshold where stems become >= 1.0 pixles. */
  112. };
  113. /***
  114. ** Function: InitTTOutput
  115. **
  116. ** Description:
  117. ** This function allocates the resources needed to
  118. ** write a TT font file.
  119. ***/
  120. errcode InitTTOutput _ARGS((IN struct TTArg *,
  121. OUT struct TTHandle **));
  122. /***
  123. ** Function: CleanUpTT
  124. **
  125. ** Description:
  126. ** This function free's the resources used while
  127. ** writing a TT font file.
  128. ***/
  129. errcode CleanUpTT _ARGS((INOUT struct TTHandle *,
  130. IN struct TTArg *,
  131. IN errcode status));
  132. /***
  133. ** Function: PutTTNotDefGlyph
  134. **
  135. ** Description:
  136. ** This function adds a record for a the ".notdef" glyph to the
  137. ** 'glyf' table of the TT font file.
  138. **
  139. ***/
  140. errcode PutTTNotDefGlyph _ARGS((INOUT struct TTHandle *,
  141. IN struct TTGlyph*));
  142. /** Function: PutTTGlyph
  143. **
  144. ** Description:
  145. ** This function adds a record for a simple glyph to the
  146. ** 'glyf' table of the TT font file.
  147. **
  148. ***/
  149. errcode PutTTGlyph _ARGS((INOUT struct TTHandle *,
  150. IN struct TTGlyph*,
  151. IN boolean fStdEncoding));
  152. /***
  153. ** Function: PutTTOther
  154. **
  155. ** Description:
  156. ** This function writes the required TT tables to the
  157. ** TT font file, except for the 'glyf' table which is
  158. ** only completed (check sum is computed, etc.).
  159. **
  160. ***/
  161. errcode PutTTOther _ARGS((INOUT struct TTHandle *,
  162. INOUT struct TTMetrics *));
  163. /***
  164. ** Function: FreeTTGlyph
  165. **
  166. ** Description:
  167. ** This function will free the memory used to represent a
  168. ** a TrueType glyph.
  169. **
  170. ***/
  171. void FreeTTGlyph _ARGS((INOUT struct TTGlyph *));
  172. /***
  173. ** Function: PutTTComposite
  174. **
  175. ** Description:
  176. **
  177. ***/
  178. errcode PutTTComposite _ARGS((INOUT struct TTHandle *,
  179. OUT struct TTComposite *));
  180. /***
  181. ** Function: WindowsBBox
  182. **
  183. ** Description:
  184. ** Compute the bounding box of the characters that are
  185. ** used in Windows character set.
  186. ***/
  187. void WindowsBBox _ARGS((IN struct TTHandle *tt,
  188. OUT Point *bbox));
  189. /***
  190. ** Function: MacBBox
  191. **
  192. ** Description:
  193. ** Compute the bounding box of the characters that are
  194. ** used in Mac character set.
  195. **
  196. ** This is currently set to the global bounding box
  197. ** (tt->bbox) of all characters in the font. This will
  198. ** ensure that accents are not sqeezed on Mac platforms.
  199. ***/
  200. void MacBBox _ARGS((IN struct TTHandle *tt,
  201. OUT Point *bbox));
  202. // the name says it
  203. void GlobalBBox _ARGS((IN struct TTHandle *tt,
  204. OUT Point *bbox));
  205. /***
  206. ** Function: TypographicalAscender
  207. **
  208. ** Description:
  209. ** Compute the typographical ascender height, as ymax of
  210. ** the letter 'b'.
  211. ***/
  212. funit TypographicalDescender _ARGS((IN struct TTHandle *tt));
  213. /***
  214. ** Function: TypographicalDescender
  215. **
  216. ** Description:
  217. ** Compute the typographical descender height, as ymin of
  218. ** the letter 'g'.
  219. ***/
  220. funit TypographicalAscender _ARGS((IN struct TTHandle *tt));
  221. /***
  222. ** Function: FreeTTMetrics
  223. **
  224. ** Description:
  225. ** This function free's the resources used to represent
  226. ** TT specific metrics and auxiliary font information.
  227. ***/
  228. void FreeTTMetrics _ARGS((INOUT struct TTMetrics *));
  229. /***
  230. ** Function: UsePrep
  231. **
  232. ** Description:
  233. ** This function records the pre-program in the
  234. ** TTMetrics record, until an appropriate time
  235. ** when the data can be stored in the TT file.
  236. **
  237. ***/
  238. void UsePrep _ARGS((INOUT struct TTMetrics *,
  239. IN UBYTE *prep,
  240. IN USHORT size));
  241. /***
  242. ** Function: SetFPGM
  243. **
  244. ** Description:
  245. ** This function records the font-program in the
  246. ** TTMetrics record, until an appropriate time
  247. ** when the data can be stored in the TT file.
  248. **
  249. ***/
  250. void SetFPGM _ARGS((INOUT struct TTMetrics *,
  251. IN UBYTE *fpgm,
  252. IN USHORT size,
  253. IN USHORT num));
  254. /***
  255. ** Function: GetPrep
  256. **
  257. ** Description:
  258. ** This function allocates needed space for the
  259. ** pre-program.
  260. **
  261. ***/
  262. UBYTE *GetPrep _ARGS((IN int size));