t1types.h 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. /***************************************************************************/
  2. /* */
  3. /* t1types.h */
  4. /* */
  5. /* Basic Type1/Type2 type definitions and interface (specification */
  6. /* only). */
  7. /* */
  8. /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 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 __T1TYPES_H__
  19. #define __T1TYPES_H__
  20. #include <ft2build.h>
  21. #include FT_TYPE1_TABLES_H
  22. #include FT_INTERNAL_POSTSCRIPT_HINTS_H
  23. #include FT_INTERNAL_SERVICE_H
  24. #include FT_SERVICE_POSTSCRIPT_CMAPS_H
  25. FT_BEGIN_HEADER
  26. /*************************************************************************/
  27. /*************************************************************************/
  28. /*************************************************************************/
  29. /*** ***/
  30. /*** ***/
  31. /*** REQUIRED TYPE1/TYPE2 TABLES DEFINITIONS ***/
  32. /*** ***/
  33. /*** ***/
  34. /*************************************************************************/
  35. /*************************************************************************/
  36. /*************************************************************************/
  37. /*************************************************************************/
  38. /* */
  39. /* <Struct> */
  40. /* T1_EncodingRec */
  41. /* */
  42. /* <Description> */
  43. /* A structure modeling a custom encoding. */
  44. /* */
  45. /* <Fields> */
  46. /* num_chars :: The number of character codes in the encoding. */
  47. /* Usually 256. */
  48. /* */
  49. /* code_first :: The lowest valid character code in the encoding. */
  50. /* */
  51. /* code_last :: The highest valid character code in the encoding */
  52. /* + 1. When equal to code_first there are no valid */
  53. /* character codes. */
  54. /* */
  55. /* char_index :: An array of corresponding glyph indices. */
  56. /* */
  57. /* char_name :: An array of corresponding glyph names. */
  58. /* */
  59. typedef struct T1_EncodingRecRec_
  60. {
  61. FT_Int num_chars;
  62. FT_Int code_first;
  63. FT_Int code_last;
  64. FT_UShort* char_index;
  65. FT_String** char_name;
  66. } T1_EncodingRec, *T1_Encoding;
  67. typedef enum T1_EncodingType_
  68. {
  69. T1_ENCODING_TYPE_NONE = 0,
  70. T1_ENCODING_TYPE_ARRAY,
  71. T1_ENCODING_TYPE_STANDARD,
  72. T1_ENCODING_TYPE_ISOLATIN1,
  73. T1_ENCODING_TYPE_EXPERT
  74. } T1_EncodingType;
  75. /* used to hold extra data of PS_FontInfoRec that
  76. * cannot be stored in the publicly defined structure.
  77. *
  78. * Note these can't be blended with multiple-masters.
  79. */
  80. typedef struct PS_FontExtraRec_
  81. {
  82. FT_UShort fs_type;
  83. } PS_FontExtraRec;
  84. typedef struct T1_FontRec_
  85. {
  86. PS_FontInfoRec font_info; /* font info dictionary */
  87. PS_FontExtraRec font_extra; /* font info extra fields */
  88. PS_PrivateRec private_dict; /* private dictionary */
  89. FT_String* font_name; /* top-level dictionary */
  90. T1_EncodingType encoding_type;
  91. T1_EncodingRec encoding;
  92. FT_Byte* subrs_block;
  93. FT_Byte* charstrings_block;
  94. FT_Byte* glyph_names_block;
  95. FT_Int num_subrs;
  96. FT_Byte** subrs;
  97. FT_PtrDist* subrs_len;
  98. FT_Int num_glyphs;
  99. FT_String** glyph_names; /* array of glyph names */
  100. FT_Byte** charstrings; /* array of glyph charstrings */
  101. FT_PtrDist* charstrings_len;
  102. FT_Byte paint_type;
  103. FT_Byte font_type;
  104. FT_Matrix font_matrix;
  105. FT_Vector font_offset;
  106. FT_BBox font_bbox;
  107. FT_Long font_id;
  108. FT_Fixed stroke_width;
  109. } T1_FontRec, *T1_Font;
  110. typedef struct CID_SubrsRec_
  111. {
  112. FT_UInt num_subrs;
  113. FT_Byte** code;
  114. } CID_SubrsRec, *CID_Subrs;
  115. /*************************************************************************/
  116. /*************************************************************************/
  117. /*************************************************************************/
  118. /*** ***/
  119. /*** ***/
  120. /*** AFM FONT INFORMATION STRUCTURES ***/
  121. /*** ***/
  122. /*** ***/
  123. /*************************************************************************/
  124. /*************************************************************************/
  125. /*************************************************************************/
  126. typedef struct AFM_TrackKernRec_
  127. {
  128. FT_Int degree;
  129. FT_Fixed min_ptsize;
  130. FT_Fixed min_kern;
  131. FT_Fixed max_ptsize;
  132. FT_Fixed max_kern;
  133. } AFM_TrackKernRec, *AFM_TrackKern;
  134. typedef struct AFM_KernPairRec_
  135. {
  136. FT_Int index1;
  137. FT_Int index2;
  138. FT_Int x;
  139. FT_Int y;
  140. } AFM_KernPairRec, *AFM_KernPair;
  141. typedef struct AFM_FontInfoRec_
  142. {
  143. FT_Bool IsCIDFont;
  144. FT_BBox FontBBox;
  145. FT_Fixed Ascender;
  146. FT_Fixed Descender;
  147. AFM_TrackKern TrackKerns; /* free if non-NULL */
  148. FT_Int NumTrackKern;
  149. AFM_KernPair KernPairs; /* free if non-NULL */
  150. FT_Int NumKernPair;
  151. } AFM_FontInfoRec, *AFM_FontInfo;
  152. /*************************************************************************/
  153. /*************************************************************************/
  154. /*************************************************************************/
  155. /*** ***/
  156. /*** ***/
  157. /*** ORIGINAL T1_FACE CLASS DEFINITION ***/
  158. /*** ***/
  159. /*** ***/
  160. /*************************************************************************/
  161. /*************************************************************************/
  162. /*************************************************************************/
  163. typedef struct T1_FaceRec_* T1_Face;
  164. typedef struct CID_FaceRec_* CID_Face;
  165. typedef struct T1_FaceRec_
  166. {
  167. FT_FaceRec root;
  168. T1_FontRec type1;
  169. const void* psnames;
  170. const void* psaux;
  171. const void* afm_data;
  172. FT_CharMapRec charmaprecs[2];
  173. FT_CharMap charmaps[2];
  174. #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
  175. PS_Unicodes unicode_map;
  176. #endif
  177. /* support for Multiple Masters fonts */
  178. PS_Blend blend;
  179. /* undocumented, optional: indices of subroutines that express */
  180. /* the NormalizeDesignVector and the ConvertDesignVector procedure, */
  181. /* respectively, as Type 2 charstrings; -1 if keywords not present */
  182. FT_Int ndv_idx;
  183. FT_Int cdv_idx;
  184. /* undocumented, optional: has the same meaning as len_buildchar */
  185. /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */
  186. FT_UInt len_buildchar;
  187. FT_Long* buildchar;
  188. /* since version 2.1 - interface to PostScript hinter */
  189. const void* pshinter;
  190. } T1_FaceRec;
  191. typedef struct CID_FaceRec_
  192. {
  193. FT_FaceRec root;
  194. void* psnames;
  195. void* psaux;
  196. CID_FaceInfoRec cid;
  197. PS_FontExtraRec font_extra;
  198. #if 0
  199. void* afm_data;
  200. #endif
  201. CID_Subrs subrs;
  202. /* since version 2.1 - interface to PostScript hinter */
  203. void* pshinter;
  204. /* since version 2.1.8, but was originally positioned after `afm_data' */
  205. FT_Byte* binary_data; /* used if hex data has been converted */
  206. FT_Stream cid_stream;
  207. } CID_FaceRec;
  208. FT_END_HEADER
  209. #endif /* __T1TYPES_H__ */
  210. /* END */