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