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