t1tables.h 14 KB

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