xref: /inferno-os/include/freetype/t1tables.h (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1 /***************************************************************************/
2 /*                                                                         */
3 /*  t1tables.h                                                             */
4 /*                                                                         */
5 /*    Basic Type 1/Type 2 tables definitions and interface (specification  */
6 /*    only).                                                               */
7 /*                                                                         */
8 /*  Copyright 1996-2001, 2002 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 __T1TABLES_H__
21 #define __T1TABLES_H__
22 
23 
24 #include <ft2build.h>
25 #include FT_FREETYPE_H
26 
27 
28 FT_BEGIN_HEADER
29 
30 
31   /*************************************************************************/
32   /*                                                                       */
33   /* <Section>                                                             */
34   /*    type1_tables                                                       */
35   /*                                                                       */
36   /* <Title>                                                               */
37   /*    Type 1 Tables                                                      */
38   /*                                                                       */
39   /* <Abstract>                                                            */
40   /*    Type 1 (PostScript) specific font tables.                          */
41   /*                                                                       */
42   /* <Description>                                                         */
43   /*    This section contains the definition of Type 1-specific tables,    */
44   /*    including structures related to other PostScript font formats.     */
45   /*                                                                       */
46   /*************************************************************************/
47 
48 
49   /* Note that we separate font data in PS_FontInfoRec and PS_PrivateRec */
50   /* structures in order to support Multiple Master fonts.               */
51 
52 
53   /*************************************************************************/
54   /*                                                                       */
55   /* <Struct>                                                              */
56   /*    PS_FontInfoRec                                                     */
57   /*                                                                       */
58   /* <Description>                                                         */
59   /*    A structure used to model a Type1/Type2 FontInfo dictionary.  Note */
60   /*    that for Multiple Master fonts, each instance has its own          */
61   /*    FontInfo.                                                          */
62   /*                                                                       */
63   typedef struct  PS_FontInfoRec
64   {
65     FT_String*  version;
66     FT_String*  notice;
67     FT_String*  full_name;
68     FT_String*  family_name;
69     FT_String*  weight;
70     FT_Long     italic_angle;
71     FT_Bool     is_fixed_pitch;
72     FT_Short    underline_position;
73     FT_UShort   underline_thickness;
74 
75   } PS_FontInfoRec, *PS_FontInfo;
76 
77 
78   /*************************************************************************/
79   /*                                                                       */
80   /* <Struct>                                                              */
81   /*    T1_FontInfo                                                        */
82   /*                                                                       */
83   /* <Description>                                                         */
84   /*    This type is equivalent to @PS_FontInfoRec.  It is deprecated but  */
85   /*    kept to maintain source compatibility between various versions of  */
86   /*    FreeType.                                                          */
87   /*                                                                       */
88   typedef PS_FontInfoRec  T1_FontInfo;
89 
90 
91   /*************************************************************************/
92   /*                                                                       */
93   /* <Struct>                                                              */
94   /*    PS_PrivateRec                                                      */
95   /*                                                                       */
96   /* <Description>                                                         */
97   /*    A structure used to model a Type1/Type2 private dictionary.  Note  */
98   /*    that for Multiple Master fonts, each instance has its own Private  */
99   /*    dictionary.                                                        */
100   /*                                                                       */
101   typedef struct  PS_PrivateRec_
102   {
103     FT_Int     unique_id;
104     FT_Int     lenIV;
105 
106     FT_Byte    num_blue_values;
107     FT_Byte    num_other_blues;
108     FT_Byte    num_family_blues;
109     FT_Byte    num_family_other_blues;
110 
111     FT_Short   blue_values[14];
112     FT_Short   other_blues[10];
113 
114     FT_Short   family_blues      [14];
115     FT_Short   family_other_blues[10];
116 
117     FT_Fixed   blue_scale;
118     FT_Int     blue_shift;
119     FT_Int     blue_fuzz;
120 
121     FT_UShort  standard_width[1];
122     FT_UShort  standard_height[1];
123 
124     FT_Byte    num_snap_widths;
125     FT_Byte    num_snap_heights;
126     FT_Bool    force_bold;
127     FT_Bool    round_stem_up;
128 
129     FT_Short   snap_widths [13];  /* including std width  */
130     FT_Short   snap_heights[13];  /* including std height */
131 
132     FT_Long    language_group;
133     FT_Long    password;
134 
135     FT_Short   min_feature[2];
136 
137   } PS_PrivateRec, *PS_Private;
138 
139 
140   /*************************************************************************/
141   /*                                                                       */
142   /* <Struct>                                                              */
143   /*    T1_Private                                                         */
144   /*                                                                       */
145   /* <Description>                                                         */
146   /*   This type is equivalent to @PS_PrivateRec.  It is deprecated but    */
147   /*   kept to maintain source compatibility between various versions of   */
148   /*   FreeType.                                                           */
149   /*                                                                       */
150   typedef PS_PrivateRec  T1_Private;
151 
152 
153   /*************************************************************************/
154   /*                                                                       */
155   /* <Enum>                                                                */
156   /*    T1_Blend_Flags                                                     */
157   /*                                                                       */
158   /* <Description>                                                         */
159   /*    A set of flags used to indicate which fields are present in a      */
160   /*    given blen dictionary (font info or private).  Used to support     */
161   /*    Multiple Masters fonts.                                            */
162   /*                                                                       */
163   typedef enum
164   {
165     /*# required fields in a FontInfo blend dictionary */
166     T1_BLEND_UNDERLINE_POSITION = 0,
167     T1_BLEND_UNDERLINE_THICKNESS,
168     T1_BLEND_ITALIC_ANGLE,
169 
170     /*# required fields in a Private blend dictionary */
171     T1_BLEND_BLUE_VALUES,
172     T1_BLEND_OTHER_BLUES,
173     T1_BLEND_STANDARD_WIDTH,
174     T1_BLEND_STANDARD_HEIGHT,
175     T1_BLEND_STEM_SNAP_WIDTHS,
176     T1_BLEND_STEM_SNAP_HEIGHTS,
177     T1_BLEND_BLUE_SCALE,
178     T1_BLEND_BLUE_SHIFT,
179     T1_BLEND_FAMILY_BLUES,
180     T1_BLEND_FAMILY_OTHER_BLUES,
181     T1_BLEND_FORCE_BOLD,
182 
183     /*# never remove */
184     T1_BLEND_MAX
185 
186   } T1_Blend_Flags;
187 
188 
189   /*# backwards compatible definitions */
190 #define t1_blend_underline_position   T1_BLEND_UNDERLINE_POSITION
191 #define t1_blend_underline_thickness  T1_BLEND_UNDERLINE_THICKNESS
192 #define t1_blend_italic_angle         T1_BLEND_ITALIC_ANGLE
193 #define t1_blend_blue_values          T1_BLEND_BLUE_VALUES
194 #define t1_blend_other_blues          T1_BLEND_OTHER_BLUES
195 #define t1_blend_standard_widths      T1_BLEND_STANDARD_WIDTH
196 #define t1_blend_standard_height      T1_BLEND_STANDARD_HEIGHT
197 #define t1_blend_stem_snap_widths     T1_BLEND_STEM_SNAP_WIDTHS
198 #define t1_blend_stem_snap_heights    T1_BLEND_STEM_SNAP_HEIGHTS
199 #define t1_blend_blue_scale           T1_BLEND_BLUE_SCALE
200 #define t1_blend_blue_shift           T1_BLEND_BLUE_SHIFT
201 #define t1_blend_family_blues         T1_BLEND_FAMILY_BLUES
202 #define t1_blend_family_other_blues   T1_BLEND_FAMILY_OTHER_BLUES
203 #define t1_blend_force_bold           T1_BLEND_FORCE_BOLD
204 #define t1_blend_max                  T1_BLEND_MAX
205 
206 
207   /* maximum number of Multiple Masters designs, as defined in the spec */
208 #define T1_MAX_MM_DESIGNS     16
209 
210   /* maximum number of Multiple Masters axes, as defined in the spec */
211 #define T1_MAX_MM_AXIS        4
212 
213   /* maximum number of elements in a design map */
214 #define T1_MAX_MM_MAP_POINTS  20
215 
216 
217   /* this structure is used to store the BlendDesignMap entry for an axis */
218   typedef struct  PS_DesignMap_
219   {
220     FT_Byte    num_points;
221     FT_Fixed*  design_points;
222     FT_Fixed*  blend_points;
223 
224   } PS_DesignMapRec, *PS_DesignMap;
225 
226   /* backwards-compatible definition */
227   typedef PS_DesignMapRec  T1_DesignMap;
228 
229 
230   typedef struct  PS_BlendRec_
231   {
232     FT_UInt          num_designs;
233     FT_UInt          num_axis;
234 
235     FT_String*       axis_names[T1_MAX_MM_AXIS];
236     FT_Fixed*        design_pos[T1_MAX_MM_DESIGNS];
237     PS_DesignMapRec  design_map[T1_MAX_MM_AXIS];
238 
239     FT_Fixed*        weight_vector;
240     FT_Fixed*        default_weight_vector;
241 
242     PS_FontInfo      font_infos[T1_MAX_MM_DESIGNS + 1];
243     PS_Private       privates  [T1_MAX_MM_DESIGNS + 1];
244 
245     FT_ULong         blend_bitflags;
246 
247     FT_BBox*         bboxes    [T1_MAX_MM_DESIGNS + 1];
248 
249   } PS_BlendRec, *PS_Blend;
250 
251 
252   /* backwards-compatible definition */
253   typedef PS_BlendRec  T1_Blend;
254 
255 
256   typedef struct  CID_FaceDictRec_
257   {
258     PS_PrivateRec  private_dict;
259 
260     FT_UInt        len_buildchar;
261     FT_Fixed       forcebold_threshold;
262     FT_Pos         stroke_width;
263     FT_Fixed       expansion_factor;
264 
265     FT_Byte        paint_type;
266     FT_Byte        font_type;
267     FT_Matrix      font_matrix;
268     FT_Vector      font_offset;
269 
270     FT_UInt        num_subrs;
271     FT_ULong       subrmap_offset;
272     FT_Int         sd_bytes;
273 
274   } CID_FaceDictRec, *CID_FaceDict;
275 
276 
277   /* backwards-compatible definition */
278   typedef CID_FaceDictRec  CID_FontDict;
279 
280 
281   typedef struct  CID_FaceInfoRec_
282   {
283     FT_String*      cid_font_name;
284     FT_Fixed        cid_version;
285     FT_Int          cid_font_type;
286 
287     FT_String*      registry;
288     FT_String*      ordering;
289     FT_Int          supplement;
290 
291     PS_FontInfoRec  font_info;
292     FT_BBox         font_bbox;
293     FT_ULong        uid_base;
294 
295     FT_Int          num_xuid;
296     FT_ULong        xuid[16];
297 
298     FT_ULong        cidmap_offset;
299     FT_Int          fd_bytes;
300     FT_Int          gd_bytes;
301     FT_ULong        cid_count;
302 
303     FT_Int          num_dicts;
304     CID_FaceDict    font_dicts;
305 
306     FT_ULong        data_offset;
307 
308   } CID_FaceInfoRec, *CID_FaceInfo;
309 
310 
311   /*************************************************************************/
312   /*                                                                       */
313   /* <Struct>                                                              */
314   /*    CID_Info                                                           */
315   /*                                                                       */
316   /* <Description>                                                         */
317   /*   This type is equivalent to @CID_FaceInfoRec. It is deprecated but   */
318   /*   kept to maintain source compatibility between various versions of   */
319   /*   FreeType.                                                           */
320   /*                                                                       */
321   typedef CID_FaceInfoRec  CID_Info;
322 
323   /* */
324 
325 
326  /************************************************************************
327   *
328   * @function:
329   *    FT_Has_PS_Glyph_Names
330   *
331   * @description:
332   *    Return true if a given face provides reliable Postscript glyph
333   *    names.  This is similar to using the @FT_HAS_GLYPH_NAMES macro,
334   *    except that certain fonts (mostly TrueType) contain incorrect
335   *    glyph name tables.
336   *
337   *    When this function returns true, the caller is sure that the glyph
338   *    names returned by @FT_Get_Glyph_Name are reliable.
339   *
340   * @input:
341   *    face ::
342   *       face handle
343   *
344   * @return:
345   *    Boolean.  True if glyph names are reliable.
346   */
347   FT_EXPORT( FT_Int )
348   FT_Has_PS_Glyph_Names( FT_Face  face );
349 
350 
351  /************************************************************************
352   *
353   * @function:
354   *    FT_Get_PS_Font_Info
355   *
356   * @description:
357   *    Retrieve the @PS_FontInfoRec structure corresponding to a given
358   *    Postscript font.
359   *
360   * @input:
361   *    face ::
362   *       Postscript face handle.
363   *
364   * @output:
365   *    afont_info ::
366   *       Output font info structure pointer.
367   *
368   * @return:
369   *    FreeType error code.  0 means success.
370   *
371   * @note:
372   *    The string pointers within the font info structure are owned by
373   *    the face and don't need to be freed by the caller.
374   *
375   *    If the font's format is not Postscript-based, this function will
376   *    return the @FT_Err_Invalid_Argument error code.
377   */
378   FT_EXPORT( FT_Error )
379   FT_Get_PS_Font_Info( FT_Face          face,
380                        PS_FontInfoRec  *afont_info );
381 
382  /* */
383 
384 
385 
386 FT_END_HEADER
387 
388 #endif /* __T1TABLES_H__ */
389 
390 
391 /* END */
392