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