pfrtypes.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. /***************************************************************************/
  2. /* */
  3. /* pfrtypes.h */
  4. /* */
  5. /* FreeType PFR data structures (specification only). */
  6. /* */
  7. /* Copyright 2002 by */
  8. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  9. /* */
  10. /* This file is part of the FreeType project, and may only be used, */
  11. /* modified, and distributed under the terms of the FreeType project */
  12. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  13. /* this file you indicate that you have read the license and */
  14. /* understand and accept it fully. */
  15. /* */
  16. /***************************************************************************/
  17. #ifndef __PFRTYPES_H__
  18. #define __PFRTYPES_H__
  19. #include <ft2build.h>
  20. #include FT_INTERNAL_OBJECTS_H
  21. FT_BEGIN_HEADER
  22. /************************************************************************/
  23. /* the PFR Header structure */
  24. typedef struct PFR_HeaderRec_
  25. {
  26. FT_UInt32 signature;
  27. FT_UInt version;
  28. FT_UInt signature2;
  29. FT_UInt header_size;
  30. FT_UInt log_dir_size;
  31. FT_UInt log_dir_offset;
  32. FT_UInt log_font_max_size;
  33. FT_UInt32 log_font_section_size;
  34. FT_UInt32 log_font_section_offset;
  35. FT_UInt32 phy_font_max_size;
  36. FT_UInt32 phy_font_section_size;
  37. FT_UInt32 phy_font_section_offset;
  38. FT_UInt gps_max_size;
  39. FT_UInt32 gps_section_size;
  40. FT_UInt32 gps_section_offset;
  41. FT_UInt max_blue_values;
  42. FT_UInt max_x_orus;
  43. FT_UInt max_y_orus;
  44. FT_UInt phy_font_max_size_high;
  45. FT_UInt color_flags;
  46. FT_UInt32 bct_max_size;
  47. FT_UInt32 bct_set_max_size;
  48. FT_UInt32 phy_bct_set_max_size;
  49. FT_UInt num_phy_fonts;
  50. FT_UInt max_vert_stem_snap;
  51. FT_UInt max_horz_stem_snap;
  52. FT_UInt max_chars;
  53. } PFR_HeaderRec, *PFR_Header;
  54. /* used in `color_flags' field of the PFR_Header */
  55. typedef enum PFR_HeaderFlags_
  56. {
  57. PFR_FLAG_BLACK_PIXEL = 1,
  58. PFR_FLAG_INVERT_BITMAP = 2
  59. } PFR_HeaderFlags;
  60. /************************************************************************/
  61. typedef struct PFR_LogFontRec_
  62. {
  63. FT_UInt32 size;
  64. FT_UInt32 offset;
  65. FT_Int32 matrix[4];
  66. FT_UInt stroke_flags;
  67. FT_Int stroke_thickness;
  68. FT_Int bold_thickness;
  69. FT_Int32 miter_limit;
  70. FT_UInt32 phys_size;
  71. FT_UInt32 phys_offset;
  72. } PFR_LogFontRec, *PFR_LogFont;
  73. typedef enum PFR_LogFlags_
  74. {
  75. PFR_LOG_EXTRA_ITEMS = 0x40,
  76. PFR_LOG_2BYTE_BOLD = 0x20,
  77. PFR_LOG_BOLD = 0x10,
  78. PFR_LOG_2BYTE_STROKE = 8,
  79. PFR_LOG_STROKE = 4,
  80. PFR_LINE_JOIN_MASK = 3
  81. } PFR_LogFlags;
  82. typedef enum PFR_LineJoinFlags_
  83. {
  84. PFR_LINE_JOIN_MITER = 0,
  85. PFR_LINE_JOIN_ROUND = 1,
  86. PFR_LINE_JOIN_BEVEL = 2
  87. } PFR_LineJoinFlags;
  88. /************************************************************************/
  89. typedef enum PFR_BitmapFlags_
  90. {
  91. PFR_BITMAP_3BYTE_OFFSET = 4,
  92. PFR_BITMAP_2BYTE_SIZE = 2,
  93. PFR_BITMAP_2BYTE_CHARCODE = 1
  94. } PFR_BitmapFlags;
  95. typedef struct PFR_BitmapCharRec_
  96. {
  97. FT_UInt char_code;
  98. FT_UInt gps_size;
  99. FT_UInt32 gps_offset;
  100. } PFR_BitmapCharRec, *PFR_BitmapChar;
  101. typedef enum PFR_StrikeFlags_
  102. {
  103. PFR_STRIKE_2BYTE_COUNT = 0x10,
  104. PFR_STRIKE_3BYTE_OFFSET = 0x08,
  105. PFR_STRIKE_3BYTE_SIZE = 0x04,
  106. PFR_STRIKE_2BYTE_YPPM = 0x02,
  107. PFR_STRIKE_2BYTE_XPPM = 0x01
  108. } PFR_StrikeFlags;
  109. typedef struct PFR_StrikeRec_
  110. {
  111. FT_UInt x_ppm;
  112. FT_UInt y_ppm;
  113. FT_UInt flags;
  114. FT_UInt32 gps_size;
  115. FT_UInt32 gps_offset;
  116. FT_UInt32 bct_size;
  117. FT_UInt32 bct_offset;
  118. /* optional */
  119. FT_UInt num_bitmaps;
  120. PFR_BitmapChar bitmaps;
  121. } PFR_StrikeRec, *PFR_Strike;
  122. /************************************************************************/
  123. typedef struct PFR_CharRec_
  124. {
  125. FT_UInt char_code;
  126. FT_Int advance;
  127. FT_UInt gps_size;
  128. FT_UInt32 gps_offset;
  129. } PFR_CharRec, *PFR_Char;
  130. /************************************************************************/
  131. typedef struct PFR_DimensionRec_
  132. {
  133. FT_UInt standard;
  134. FT_UInt num_stem_snaps;
  135. FT_Int* stem_snaps;
  136. } PFR_DimensionRec, *PFR_Dimension;
  137. /************************************************************************/
  138. typedef struct PFR_KernItemRec_* PFR_KernItem;
  139. typedef struct PFR_KernItemRec_
  140. {
  141. PFR_KernItem next;
  142. FT_UInt pair_count;
  143. FT_UInt pair_size;
  144. FT_Int base_adj;
  145. FT_UInt flags;
  146. FT_UInt32 offset;
  147. FT_UInt32 pair1;
  148. FT_UInt32 pair2;
  149. } PFR_KernItemRec;
  150. #define PFR_KERN_INDEX( g1, g2 ) \
  151. ( ( (FT_UInt32)(g1) << 16 ) | (FT_UInt16)(g2) )
  152. typedef struct PFR_KernPairRec_
  153. {
  154. FT_UInt glyph1;
  155. FT_UInt glyph2;
  156. FT_Vector kerning;
  157. } PFR_KernPairRec, *PFR_KernPair;
  158. /************************************************************************/
  159. typedef struct PFR_PhyFontRec_
  160. {
  161. FT_Memory memory;
  162. FT_UInt32 offset;
  163. FT_UInt font_ref_number;
  164. FT_UInt outline_resolution;
  165. FT_UInt metrics_resolution;
  166. FT_BBox bbox;
  167. FT_UInt flags;
  168. FT_UInt standard_advance;
  169. PFR_DimensionRec horizontal;
  170. PFR_DimensionRec vertical;
  171. FT_String* font_id;
  172. FT_UInt num_strikes;
  173. FT_UInt max_strikes;
  174. PFR_StrikeRec* strikes;
  175. FT_UInt num_blue_values;
  176. FT_Int *blue_values;
  177. FT_UInt blue_fuzz;
  178. FT_UInt blue_scale;
  179. FT_UInt num_chars;
  180. FT_UInt32 chars_offset;
  181. PFR_Char chars;
  182. FT_UInt num_kern_pairs;
  183. PFR_KernItem kern_items;
  184. PFR_KernItem* kern_items_tail;
  185. /* not part of the spec, but used during load */
  186. FT_UInt32 bct_offset;
  187. FT_Byte* cursor;
  188. } PFR_PhyFontRec, *PFR_PhyFont;
  189. typedef enum PFR_PhyFlags_
  190. {
  191. PFR_PHY_EXTRA_ITEMS = 0x80,
  192. PFR_PHY_3BYTE_GPS_OFFSET = 0x20,
  193. PFR_PHY_2BYTE_GPS_SIZE = 0x10,
  194. PFR_PHY_ASCII_CODE = 0x08,
  195. PFR_PHY_PROPORTIONAL = 0x04,
  196. PFR_PHY_2BYTE_CHARCODE = 0x02,
  197. PFR_PHY_VERTICAL = 0x01
  198. } PFR_PhyFlags;
  199. typedef enum PFR_KernFlags_
  200. {
  201. PFR_KERN_2BYTE_ADJ = 0x01,
  202. PFR_KERN_2BYTE_CHAR = 0x02
  203. } PFR_KernFlags;
  204. /************************************************************************/
  205. typedef enum PFR_GlyphFlags_
  206. {
  207. PFR_GLYPH_IS_COMPOUND = 0x80,
  208. PFR_GLYPH_EXTRA_ITEMS = 0x08,
  209. PFR_GLYPH_1BYTE_XYCOUNT = 0x04,
  210. PFR_GLYPH_XCOUNT = 0x02,
  211. PFR_GLYPH_YCOUNT = 0x01
  212. } PFR_GlyphFlags;
  213. /* controlled coordinate */
  214. typedef struct PFR_CoordRec_
  215. {
  216. FT_UInt org;
  217. FT_UInt cur;
  218. } PFR_CoordRec, *PFR_Coord;
  219. typedef struct PFR_SubGlyphRec_
  220. {
  221. FT_Fixed x_scale;
  222. FT_Fixed y_scale;
  223. FT_Int x_delta;
  224. FT_Int y_delta;
  225. FT_UInt32 gps_offset;
  226. FT_UInt gps_size;
  227. } PFR_SubGlyphRec, *PFR_SubGlyph;
  228. typedef enum PFR_SubgGlyphFlags_
  229. {
  230. PFR_SUBGLYPH_3BYTE_OFFSET = 0x80,
  231. PFR_SUBGLYPH_2BYTE_SIZE = 0x40,
  232. PFR_SUBGLYPH_YSCALE = 0x20,
  233. PFR_SUBGLYPH_XSCALE = 0x10
  234. } PFR_SubGlyphFlags;
  235. typedef struct PFR_GlyphRec_
  236. {
  237. FT_Byte format;
  238. FT_UInt num_x_control;
  239. FT_UInt num_y_control;
  240. FT_UInt max_xy_control;
  241. FT_Pos* x_control;
  242. FT_Pos* y_control;
  243. FT_UInt num_subs;
  244. FT_UInt max_subs;
  245. PFR_SubGlyphRec* subs;
  246. FT_GlyphLoader loader;
  247. FT_Bool path_begun;
  248. } PFR_GlyphRec, *PFR_Glyph;
  249. FT_END_HEADER
  250. #endif /* __PFRTYPES_H__ */
  251. /* END */