t1tables.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. /***************************************************************************/
  2. /* */
  3. /* t1tables.h */
  4. /* */
  5. /* Basic Type 1/Type 2 tables definitions and interface (specification */
  6. /* only). */
  7. /* */
  8. /* Copyright 1996-2001, 2002, 2003, 2004, 2006 by */
  9. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  10. /* */
  11. /* This file is part of the FreeType project, and may only be used, */
  12. /* modified, and distributed under the terms of the FreeType project */
  13. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  14. /* this file you indicate that you have read the license and */
  15. /* understand and accept it fully. */
  16. /* */
  17. /***************************************************************************/
  18. #ifndef __T1TABLES_H__
  19. #define __T1TABLES_H__
  20. #include <ft2build.h>
  21. #include FT_FREETYPE_H
  22. #ifdef FREETYPE_H
  23. #error "freetype.h of FreeType 1 has been loaded!"
  24. #error "Please fix the directory search order for header files"
  25. #error "so that freetype.h of FreeType 2 is found first."
  26. #endif
  27. FT_BEGIN_HEADER
  28. /*************************************************************************/
  29. /* */
  30. /* <Section> */
  31. /* type1_tables */
  32. /* */
  33. /* <Title> */
  34. /* Type 1 Tables */
  35. /* */
  36. /* <Abstract> */
  37. /* Type 1 (PostScript) specific font tables. */
  38. /* */
  39. /* <Description> */
  40. /* This section contains the definition of Type 1-specific tables, */
  41. /* including structures related to other PostScript font formats. */
  42. /* */
  43. /*************************************************************************/
  44. /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */
  45. /* structures in order to support Multiple Master fonts. */
  46. /*************************************************************************/
  47. /* */
  48. /* <Struct> */
  49. /* PS_FontInfoRec */
  50. /* */
  51. /* <Description> */
  52. /* A structure used to model a Type1/Type2 FontInfo dictionary. Note */
  53. /* that for Multiple Master fonts, each instance has its own */
  54. /* FontInfo dictionary. */
  55. /* */
  56. typedef struct PS_FontInfoRec
  57. {
  58. FT_String* version;
  59. FT_String* notice;
  60. FT_String* full_name;
  61. FT_String* family_name;
  62. FT_String* weight;
  63. FT_Long italic_angle;
  64. FT_Bool is_fixed_pitch;
  65. FT_Short underline_position;
  66. FT_UShort underline_thickness;
  67. } PS_FontInfoRec, *PS_FontInfo;
  68. /*************************************************************************/
  69. /* */
  70. /* <Struct> */
  71. /* T1_FontInfo */
  72. /* */
  73. /* <Description> */
  74. /* This type is equivalent to @PS_FontInfoRec. It is deprecated but */
  75. /* kept to maintain source compatibility between various versions of */
  76. /* FreeType. */
  77. /* */
  78. typedef PS_FontInfoRec T1_FontInfo;
  79. /*************************************************************************/
  80. /* */
  81. /* <Struct> */
  82. /* PS_PrivateRec */
  83. /* */
  84. /* <Description> */
  85. /* A structure used to model a Type1/Type2 private dictionary. Note */
  86. /* that for Multiple Master fonts, each instance has its own Private */
  87. /* dictionary. */
  88. /* */
  89. typedef struct PS_PrivateRec_
  90. {
  91. FT_Int unique_id;
  92. FT_Int lenIV;
  93. FT_Byte num_blue_values;
  94. FT_Byte num_other_blues;
  95. FT_Byte num_family_blues;
  96. FT_Byte num_family_other_blues;
  97. FT_Short blue_values[14];
  98. FT_Short other_blues[10];
  99. FT_Short family_blues [14];
  100. FT_Short family_other_blues[10];
  101. FT_Fixed blue_scale;
  102. FT_Int blue_shift;
  103. FT_Int blue_fuzz;
  104. FT_UShort standard_width[1];
  105. FT_UShort standard_height[1];
  106. FT_Byte num_snap_widths;
  107. FT_Byte num_snap_heights;
  108. FT_Bool force_bold;
  109. FT_Bool round_stem_up;
  110. FT_Short snap_widths [13]; /* including std width */
  111. FT_Short snap_heights[13]; /* including std height */
  112. FT_Fixed expansion_factor;
  113. FT_Long language_group;
  114. FT_Long password;
  115. FT_Short min_feature[2];
  116. } PS_PrivateRec, *PS_Private;
  117. /*************************************************************************/
  118. /* */
  119. /* <Struct> */
  120. /* T1_Private */
  121. /* */
  122. /* <Description> */
  123. /* This type is equivalent to @PS_PrivateRec. It is deprecated but */
  124. /* kept to maintain source compatibility between various versions of */
  125. /* FreeType. */
  126. /* */
  127. typedef PS_PrivateRec T1_Private;
  128. /*************************************************************************/
  129. /* */
  130. /* <Enum> */
  131. /* T1_Blend_Flags */
  132. /* */
  133. /* <Description> */
  134. /* A set of flags used to indicate which fields are present in a */
  135. /* given blend dictionary (font info or private). Used to support */
  136. /* Multiple Masters fonts. */
  137. /* */
  138. typedef enum
  139. {
  140. /*# required fields in a FontInfo blend dictionary */
  141. T1_BLEND_UNDERLINE_POSITION = 0,
  142. T1_BLEND_UNDERLINE_THICKNESS,
  143. T1_BLEND_ITALIC_ANGLE,
  144. /*# required fields in a Private blend dictionary */
  145. T1_BLEND_BLUE_VALUES,
  146. T1_BLEND_OTHER_BLUES,
  147. T1_BLEND_STANDARD_WIDTH,
  148. T1_BLEND_STANDARD_HEIGHT,
  149. T1_BLEND_STEM_SNAP_WIDTHS,
  150. T1_BLEND_STEM_SNAP_HEIGHTS,
  151. T1_BLEND_BLUE_SCALE,
  152. T1_BLEND_BLUE_SHIFT,
  153. T1_BLEND_FAMILY_BLUES,
  154. T1_BLEND_FAMILY_OTHER_BLUES,
  155. T1_BLEND_FORCE_BOLD,
  156. /*# never remove */
  157. T1_BLEND_MAX
  158. } T1_Blend_Flags;
  159. /* */
  160. /*# backwards compatible definitions */
  161. #define t1_blend_underline_position T1_BLEND_UNDERLINE_POSITION
  162. #define t1_blend_underline_thickness T1_BLEND_UNDERLINE_THICKNESS
  163. #define t1_blend_italic_angle T1_BLEND_ITALIC_ANGLE
  164. #define t1_blend_blue_values T1_BLEND_BLUE_VALUES
  165. #define t1_blend_other_blues T1_BLEND_OTHER_BLUES
  166. #define t1_blend_standard_widths T1_BLEND_STANDARD_WIDTH
  167. #define t1_blend_standard_height T1_BLEND_STANDARD_HEIGHT
  168. #define t1_blend_stem_snap_widths T1_BLEND_STEM_SNAP_WIDTHS
  169. #define t1_blend_stem_snap_heights T1_BLEND_STEM_SNAP_HEIGHTS
  170. #define t1_blend_blue_scale T1_BLEND_BLUE_SCALE
  171. #define t1_blend_blue_shift T1_BLEND_BLUE_SHIFT
  172. #define t1_blend_family_blues T1_BLEND_FAMILY_BLUES
  173. #define t1_blend_family_other_blues T1_BLEND_FAMILY_OTHER_BLUES
  174. #define t1_blend_force_bold T1_BLEND_FORCE_BOLD
  175. #define t1_blend_max T1_BLEND_MAX
  176. /* maximum number of Multiple Masters designs, as defined in the spec */
  177. #define T1_MAX_MM_DESIGNS 16
  178. /* maximum number of Multiple Masters axes, as defined in the spec */
  179. #define T1_MAX_MM_AXIS 4
  180. /* maximum number of elements in a design map */
  181. #define T1_MAX_MM_MAP_POINTS 20
  182. /* this structure is used to store the BlendDesignMap entry for an axis */
  183. typedef struct PS_DesignMap_
  184. {
  185. FT_Byte num_points;
  186. FT_Long* design_points;
  187. FT_Fixed* blend_points;
  188. } PS_DesignMapRec, *PS_DesignMap;
  189. /* backwards-compatible definition */
  190. typedef PS_DesignMapRec T1_DesignMap;
  191. typedef struct PS_BlendRec_
  192. {
  193. FT_UInt num_designs;
  194. FT_UInt num_axis;
  195. FT_String* axis_names[T1_MAX_MM_AXIS];
  196. FT_Fixed* design_pos[T1_MAX_MM_DESIGNS];
  197. PS_DesignMapRec design_map[T1_MAX_MM_AXIS];
  198. FT_Fixed* weight_vector;
  199. FT_Fixed* default_weight_vector;
  200. PS_FontInfo font_infos[T1_MAX_MM_DESIGNS + 1];
  201. PS_Private privates [T1_MAX_MM_DESIGNS + 1];
  202. FT_ULong blend_bitflags;
  203. FT_BBox* bboxes [T1_MAX_MM_DESIGNS + 1];
  204. /* since 2.3.0 */
  205. /* undocumented, optional: the default design instance; */
  206. /* corresponds to default_weight_vector -- */
  207. /* num_default_design_vector == 0 means it is not present */
  208. /* in the font and associated metrics files */
  209. FT_UInt default_design_vector[T1_MAX_MM_DESIGNS];
  210. FT_UInt num_default_design_vector;
  211. } PS_BlendRec, *PS_Blend;
  212. /* backwards-compatible definition */
  213. typedef PS_BlendRec T1_Blend;
  214. typedef struct CID_FaceDictRec_
  215. {
  216. PS_PrivateRec private_dict;
  217. FT_UInt len_buildchar;
  218. FT_Fixed forcebold_threshold;
  219. FT_Pos stroke_width;
  220. FT_Fixed expansion_factor;
  221. FT_Byte paint_type;
  222. FT_Byte font_type;
  223. FT_Matrix font_matrix;
  224. FT_Vector font_offset;
  225. FT_UInt num_subrs;
  226. FT_ULong subrmap_offset;
  227. FT_Int sd_bytes;
  228. } CID_FaceDictRec, *CID_FaceDict;
  229. /* backwards-compatible definition */
  230. typedef CID_FaceDictRec CID_FontDict;
  231. /*************************************************************************/
  232. /* */
  233. /* <Struct> */
  234. /* CID_FaceInfoRec */
  235. /* */
  236. /* <Description> */
  237. /* A structure used to represent CID Face information. */
  238. /* */
  239. typedef struct CID_FaceInfoRec_
  240. {
  241. FT_String* cid_font_name;
  242. FT_Fixed cid_version;
  243. FT_Int cid_font_type;
  244. FT_String* registry;
  245. FT_String* ordering;
  246. FT_Int supplement;
  247. PS_FontInfoRec font_info;
  248. FT_BBox font_bbox;
  249. FT_ULong uid_base;
  250. FT_Int num_xuid;
  251. FT_ULong xuid[16];
  252. FT_ULong cidmap_offset;
  253. FT_Int fd_bytes;
  254. FT_Int gd_bytes;
  255. FT_ULong cid_count;
  256. FT_Int num_dicts;
  257. CID_FaceDict font_dicts;
  258. FT_ULong data_offset;
  259. } CID_FaceInfoRec, *CID_FaceInfo;
  260. /*************************************************************************/
  261. /* */
  262. /* <Struct> */
  263. /* CID_Info */
  264. /* */
  265. /* <Description> */
  266. /* This type is equivalent to @CID_FaceInfoRec. It is deprecated but */
  267. /* kept to maintain source compatibility between various versions of */
  268. /* FreeType. */
  269. /* */
  270. typedef CID_FaceInfoRec CID_Info;
  271. /* */
  272. /************************************************************************
  273. *
  274. * @function:
  275. * FT_Has_PS_Glyph_Names
  276. *
  277. * @description:
  278. * Return true if a given face provides reliable Postscript glyph
  279. * names. This is similar to using the @FT_HAS_GLYPH_NAMES macro,
  280. * except that certain fonts (mostly TrueType) contain incorrect
  281. * glyph name tables.
  282. *
  283. * When this function returns true, the caller is sure that the glyph
  284. * names returned by @FT_Get_Glyph_Name are reliable.
  285. *
  286. * @input:
  287. * face ::
  288. * face handle
  289. *
  290. * @return:
  291. * Boolean. True if glyph names are reliable.
  292. */
  293. FT_EXPORT( FT_Int )
  294. FT_Has_PS_Glyph_Names( FT_Face face );
  295. /************************************************************************
  296. *
  297. * @function:
  298. * FT_Get_PS_Font_Info
  299. *
  300. * @description:
  301. * Retrieve the @PS_FontInfoRec structure corresponding to a given
  302. * Postscript font.
  303. *
  304. * @input:
  305. * face ::
  306. * Postscript face handle.
  307. *
  308. * @output:
  309. * afont_info ::
  310. * Output font info structure pointer.
  311. *
  312. * @return:
  313. * FreeType error code. 0 means success.
  314. *
  315. * @note:
  316. * The string pointers within the font info structure are owned by
  317. * the face and don't need to be freed by the caller.
  318. *
  319. * If the font's format is not Postscript-based, this function will
  320. * return the `FT_Err_Invalid_Argument' error code.
  321. */
  322. FT_EXPORT( FT_Error )
  323. FT_Get_PS_Font_Info( FT_Face face,
  324. PS_FontInfoRec *afont_info );
  325. /************************************************************************
  326. *
  327. * @function:
  328. * FT_Get_PS_Font_Private
  329. *
  330. * @description:
  331. * Retrieve the @PS_PrivateRec structure corresponding to a given
  332. * Postscript font.
  333. *
  334. * @input:
  335. * face ::
  336. * Postscript face handle.
  337. *
  338. * @output:
  339. * afont_private ::
  340. * Output private dictionary structure pointer.
  341. *
  342. * @return:
  343. * FreeType error code. 0 means success.
  344. *
  345. * @note:
  346. * The string pointers within the font info structure are owned by
  347. * the face and don't need to be freed by the caller.
  348. *
  349. * If the font's format is not Postscript-based, this function will
  350. * return the `FT_Err_Invalid_Argument' error code.
  351. */
  352. FT_EXPORT( FT_Error )
  353. FT_Get_PS_Font_Private( FT_Face face,
  354. PS_PrivateRec *afont_private );
  355. /* */
  356. FT_END_HEADER
  357. #endif /* __T1TABLES_H__ */
  358. /* END */