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