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