t1types.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /***************************************************************************/
  2. /* */
  3. /* t1types.h */
  4. /* */
  5. /* Basic Type1/Type2 type definitions and interface (specification */
  6. /* only). */
  7. /* */
  8. /* Copyright 1996-2004, 2006, 2008, 2009, 2011, 2013 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. /* used to hold extra data of PS_FontInfoRec that
  68. * cannot be stored in the publicly defined structure.
  69. *
  70. * Note these can't be blended with multiple-masters.
  71. */
  72. typedef struct PS_FontExtraRec_
  73. {
  74. FT_UShort fs_type;
  75. } PS_FontExtraRec;
  76. typedef struct T1_FontRec_
  77. {
  78. PS_FontInfoRec font_info; /* font info dictionary */
  79. PS_FontExtraRec font_extra; /* font info extra fields */
  80. PS_PrivateRec private_dict; /* private dictionary */
  81. FT_String* font_name; /* top-level dictionary */
  82. T1_EncodingType encoding_type;
  83. T1_EncodingRec encoding;
  84. FT_Byte* subrs_block;
  85. FT_Byte* charstrings_block;
  86. FT_Byte* glyph_names_block;
  87. FT_Int num_subrs;
  88. FT_Byte** subrs;
  89. FT_PtrDist* subrs_len;
  90. FT_Int num_glyphs;
  91. FT_String** glyph_names; /* array of glyph names */
  92. FT_Byte** charstrings; /* array of glyph charstrings */
  93. FT_PtrDist* charstrings_len;
  94. FT_Byte paint_type;
  95. FT_Byte font_type;
  96. FT_Matrix font_matrix;
  97. FT_Vector font_offset;
  98. FT_BBox font_bbox;
  99. FT_Long font_id;
  100. FT_Fixed stroke_width;
  101. } T1_FontRec, *T1_Font;
  102. typedef struct CID_SubrsRec_
  103. {
  104. FT_UInt num_subrs;
  105. FT_Byte** code;
  106. } CID_SubrsRec, *CID_Subrs;
  107. /*************************************************************************/
  108. /*************************************************************************/
  109. /*************************************************************************/
  110. /*** ***/
  111. /*** ***/
  112. /*** AFM FONT INFORMATION STRUCTURES ***/
  113. /*** ***/
  114. /*** ***/
  115. /*************************************************************************/
  116. /*************************************************************************/
  117. /*************************************************************************/
  118. typedef struct AFM_TrackKernRec_
  119. {
  120. FT_Int degree;
  121. FT_Fixed min_ptsize;
  122. FT_Fixed min_kern;
  123. FT_Fixed max_ptsize;
  124. FT_Fixed max_kern;
  125. } AFM_TrackKernRec, *AFM_TrackKern;
  126. typedef struct AFM_KernPairRec_
  127. {
  128. FT_Int index1;
  129. FT_Int index2;
  130. FT_Int x;
  131. FT_Int y;
  132. } AFM_KernPairRec, *AFM_KernPair;
  133. typedef struct AFM_FontInfoRec_
  134. {
  135. FT_Bool IsCIDFont;
  136. FT_BBox FontBBox;
  137. FT_Fixed Ascender;
  138. FT_Fixed Descender;
  139. AFM_TrackKern TrackKerns; /* free if non-NULL */
  140. FT_Int NumTrackKern;
  141. AFM_KernPair KernPairs; /* free if non-NULL */
  142. FT_Int NumKernPair;
  143. } AFM_FontInfoRec, *AFM_FontInfo;
  144. /*************************************************************************/
  145. /*************************************************************************/
  146. /*************************************************************************/
  147. /*** ***/
  148. /*** ***/
  149. /*** ORIGINAL T1_FACE CLASS DEFINITION ***/
  150. /*** ***/
  151. /*** ***/
  152. /*************************************************************************/
  153. /*************************************************************************/
  154. /*************************************************************************/
  155. typedef struct T1_FaceRec_* T1_Face;
  156. typedef struct CID_FaceRec_* CID_Face;
  157. typedef struct T1_FaceRec_
  158. {
  159. FT_FaceRec root;
  160. T1_FontRec type1;
  161. const void* psnames;
  162. const void* psaux;
  163. const void* afm_data;
  164. FT_CharMapRec charmaprecs[2];
  165. FT_CharMap charmaps[2];
  166. /* support for Multiple Masters fonts */
  167. PS_Blend blend;
  168. /* undocumented, optional: indices of subroutines that express */
  169. /* the NormalizeDesignVector and the ConvertDesignVector procedure, */
  170. /* respectively, as Type 2 charstrings; -1 if keywords not present */
  171. FT_Int ndv_idx;
  172. FT_Int cdv_idx;
  173. /* undocumented, optional: has the same meaning as len_buildchar */
  174. /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */
  175. FT_UInt len_buildchar;
  176. FT_Long* buildchar;
  177. /* since version 2.1 - interface to PostScript hinter */
  178. const void* pshinter;
  179. } T1_FaceRec;
  180. typedef struct CID_FaceRec_
  181. {
  182. FT_FaceRec root;
  183. void* psnames;
  184. void* psaux;
  185. CID_FaceInfoRec cid;
  186. PS_FontExtraRec font_extra;
  187. #if 0
  188. void* afm_data;
  189. #endif
  190. CID_Subrs subrs;
  191. /* since version 2.1 - interface to PostScript hinter */
  192. void* pshinter;
  193. /* since version 2.1.8, but was originally positioned after `afm_data' */
  194. FT_Byte* binary_data; /* used if hex data has been converted */
  195. FT_Stream cid_stream;
  196. } CID_FaceRec;
  197. FT_END_HEADER
  198. #endif /* __T1TYPES_H__ */
  199. /* END */