/src/freetype/src/pfr/pfrtypes.h

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 362 lines · 226 code · 106 blank · 30 comment · 0 complexity · 5319bce1d1072e5b11f49f16aa7060f6 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* pfrtypes.h */
  4. /* */
  5. /* FreeType PFR data structures (specification only). */
  6. /* */
  7. /* Copyright 2002, 2003, 2005, 2007 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_Byte pair_count;
  143. FT_Byte flags;
  144. FT_Short base_adj;
  145. FT_UInt pair_size;
  146. FT_Offset 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. #define PFR_KERN_PAIR_INDEX( pair ) \
  153. PFR_KERN_INDEX( (pair)->glyph1, (pair)->glyph2 )
  154. #define PFR_NEXT_KPAIR( p ) ( p += 2, \
  155. ( (FT_UInt32)p[-2] << 16 ) | p[-1] )
  156. /************************************************************************/
  157. typedef struct PFR_PhyFontRec_
  158. {
  159. FT_Memory memory;
  160. FT_UInt32 offset;
  161. FT_UInt font_ref_number;
  162. FT_UInt outline_resolution;
  163. FT_UInt metrics_resolution;
  164. FT_BBox bbox;
  165. FT_UInt flags;
  166. FT_UInt standard_advance;
  167. FT_Int ascent; /* optional, bbox.yMax if not present */
  168. FT_Int descent; /* optional, bbox.yMin if not present */
  169. FT_Int leading; /* optional, 0 if not present */
  170. PFR_DimensionRec horizontal;
  171. PFR_DimensionRec vertical;
  172. FT_String* font_id;
  173. FT_String* family_name;
  174. FT_String* style_name;
  175. FT_UInt num_strikes;
  176. FT_UInt max_strikes;
  177. PFR_StrikeRec* strikes;
  178. FT_UInt num_blue_values;
  179. FT_Int *blue_values;
  180. FT_UInt blue_fuzz;
  181. FT_UInt blue_scale;
  182. FT_UInt num_chars;
  183. FT_Offset chars_offset;
  184. PFR_Char chars;
  185. FT_UInt num_kern_pairs;
  186. PFR_KernItem kern_items;
  187. PFR_KernItem* kern_items_tail;
  188. /* not part of the spec, but used during load */
  189. FT_Long bct_offset;
  190. FT_Byte* cursor;
  191. } PFR_PhyFontRec, *PFR_PhyFont;
  192. typedef enum PFR_PhyFlags_
  193. {
  194. PFR_PHY_EXTRA_ITEMS = 0x80,
  195. PFR_PHY_3BYTE_GPS_OFFSET = 0x20,
  196. PFR_PHY_2BYTE_GPS_SIZE = 0x10,
  197. PFR_PHY_ASCII_CODE = 0x08,
  198. PFR_PHY_PROPORTIONAL = 0x04,
  199. PFR_PHY_2BYTE_CHARCODE = 0x02,
  200. PFR_PHY_VERTICAL = 0x01
  201. } PFR_PhyFlags;
  202. typedef enum PFR_KernFlags_
  203. {
  204. PFR_KERN_2BYTE_CHAR = 0x01,
  205. PFR_KERN_2BYTE_ADJ = 0x02
  206. } PFR_KernFlags;
  207. /************************************************************************/
  208. typedef enum PFR_GlyphFlags_
  209. {
  210. PFR_GLYPH_IS_COMPOUND = 0x80,
  211. PFR_GLYPH_EXTRA_ITEMS = 0x08,
  212. PFR_GLYPH_1BYTE_XYCOUNT = 0x04,
  213. PFR_GLYPH_XCOUNT = 0x02,
  214. PFR_GLYPH_YCOUNT = 0x01
  215. } PFR_GlyphFlags;
  216. /* controlled coordinate */
  217. typedef struct PFR_CoordRec_
  218. {
  219. FT_UInt org;
  220. FT_UInt cur;
  221. } PFR_CoordRec, *PFR_Coord;
  222. typedef struct PFR_SubGlyphRec_
  223. {
  224. FT_Fixed x_scale;
  225. FT_Fixed y_scale;
  226. FT_Int x_delta;
  227. FT_Int y_delta;
  228. FT_UInt32 gps_offset;
  229. FT_UInt gps_size;
  230. } PFR_SubGlyphRec, *PFR_SubGlyph;
  231. typedef enum PFR_SubgGlyphFlags_
  232. {
  233. PFR_SUBGLYPH_3BYTE_OFFSET = 0x80,
  234. PFR_SUBGLYPH_2BYTE_SIZE = 0x40,
  235. PFR_SUBGLYPH_YSCALE = 0x20,
  236. PFR_SUBGLYPH_XSCALE = 0x10
  237. } PFR_SubGlyphFlags;
  238. typedef struct PFR_GlyphRec_
  239. {
  240. FT_Byte format;
  241. #if 0
  242. FT_UInt num_x_control;
  243. FT_UInt num_y_control;
  244. #endif
  245. FT_UInt max_xy_control;
  246. FT_Pos* x_control;
  247. FT_Pos* y_control;
  248. FT_UInt num_subs;
  249. FT_UInt max_subs;
  250. PFR_SubGlyphRec* subs;
  251. FT_GlyphLoader loader;
  252. FT_Bool path_begun;
  253. } PFR_GlyphRec, *PFR_Glyph;
  254. FT_END_HEADER
  255. #endif /* __PFRTYPES_H__ */
  256. /* END */