branch update for HEAD-2003021201
[reactos.git] / include / freetype / internal / t2types.h
1 /***************************************************************************/
2 /*                                                                         */
3 /*  t2types.h                                                              */
4 /*                                                                         */
5 /*    Basic OpenType/CFF type definitions and interface (specification     */
6 /*    only).                                                               */
7 /*                                                                         */
8 /*  Copyright 1996-2000 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 T2TYPES_H
21 #define T2TYPES_H
22
23
24 #include <freetype/freetype.h>
25
26
27   /*************************************************************************/
28   /*                                                                       */
29   /* <Struct>                                                              */
30   /*    CFF_Index                                                          */
31   /*                                                                       */
32   /* <Description>                                                         */
33   /*    A structure used to model a CFF Index table.                       */
34   /*                                                                       */
35   /* <Fields>                                                              */
36   /*    stream      :: XXX                                                 */
37   /*                                                                       */
38   /*    count       :: The number of elements in the index.                */
39   /*                                                                       */
40   /*    off_size    :: The size in bytes of object offsets in index.       */
41   /*                                                                       */
42   /*    data_offset :: The position of first data byte in the index's      */
43   /*                   bytes.                                              */
44   /*                                                                       */
45   /*    offsets     :: XXX                                                 */
46   /*                                                                       */
47   /*    bytes       :: If the index is loaded in memory, its bytes.        */
48   /*                                                                       */
49   typedef struct  CFF_Index_
50   {
51     FT_Stream  stream;
52     FT_UInt    count;
53     FT_Byte    off_size;
54     FT_ULong   data_offset;
55
56     FT_ULong*  offsets;
57     FT_Byte*   bytes;
58
59   } CFF_Index;
60
61
62   typedef struct  CFF_Font_Dict_
63   {
64     FT_UInt    version;
65     FT_UInt    notice;
66     FT_UInt    copyright;
67     FT_UInt    full_name;
68     FT_UInt    family_name;
69     FT_UInt    weight;
70     FT_Bool    is_fixed_pitch;
71     FT_Fixed   italic_angle;
72     FT_Pos     underline_position;
73     FT_Pos     underline_thickness;
74     FT_Int     paint_type;
75     FT_Int     charstring_type;
76     FT_Matrix  font_matrix;
77     FT_ULong   unique_id;
78     FT_BBox    font_bbox;
79     FT_Pos     stroke_width;
80     FT_ULong   charset_offset;
81     FT_ULong   encoding_offset;
82     FT_ULong   charstrings_offset;
83     FT_ULong   private_offset;
84     FT_ULong   private_size;
85     FT_Long    synthetic_base;
86     FT_UInt    embedded_postscript;
87     FT_UInt    base_font_name;       
88     FT_UInt    postscript;
89
90     /* these should only be used for the top-level font dictionary */
91     FT_UInt    cid_registry;
92     FT_UInt    cid_ordering;
93     FT_ULong   cid_supplement;
94
95     FT_Long    cid_font_version;
96     FT_Long    cid_font_revision;
97     FT_Long    cid_font_type;
98     FT_Long    cid_count;
99     FT_ULong   cid_uid_base;
100     FT_ULong   cid_fd_array_offset;
101     FT_ULong   cid_fd_select_offset;
102     FT_UInt    cid_font_name;
103
104   } CFF_Font_Dict;
105   
106   
107   typedef struct  CFF_Private_
108   {
109     FT_Byte   num_blue_values;
110     FT_Byte   num_other_blues;
111     FT_Byte   num_family_blues;
112     FT_Byte   num_family_other_blues;
113     
114     FT_Pos    blue_values[14];
115     FT_Pos    other_blues[10];
116     FT_Pos    family_blues[14];
117     FT_Pos    family_other_blues[10];
118     
119     FT_Fixed  blue_scale;
120     FT_Pos    blue_shift;
121     FT_Pos    blue_fuzz;
122     FT_Pos    standard_width;
123     FT_Pos    standard_height;
124     
125     FT_Byte   num_snap_widths;
126     FT_Byte   num_snap_heights;
127     FT_Pos    snap_widths[13];
128     FT_Pos    snap_heights[13];
129     FT_Bool   force_bold;
130     FT_Fixed  force_bold_threshold;
131     FT_Int    lenIV;
132     FT_Int    language_group;
133     FT_Fixed  expansion_factor;
134     FT_Long   initial_random_seed;
135     FT_ULong  local_subrs_offset;
136     FT_Pos    default_width;
137     FT_Pos    nominal_width;
138   
139   } CFF_Private;
140
141
142   typedef struct  CFF_FD_Select_
143   {
144     FT_Byte   format;
145     FT_UInt   range_count;
146
147     /* that's the table, taken from the file `as is' */
148     FT_Byte*  data;
149     FT_UInt   data_size;
150
151     /* small cache for format 3 only */
152     FT_UInt   cache_first;
153     FT_UInt   cache_count;
154     FT_Byte   cache_fd;
155     
156   } CFF_FD_Select;
157
158
159   /* A SubFont packs a font dict and a private dict together. They are */
160   /* needed to support CID-keyed CFF fonts.                            */
161   typedef struct  CFF_SubFont_
162   {
163     CFF_Font_Dict  font_dict;
164     CFF_Private    private_dict;
165     
166     CFF_Index      local_subrs_index;
167     FT_UInt        num_local_subrs;
168     FT_Byte**      local_subrs;
169
170   } CFF_SubFont;
171
172
173   /* maximum number of sub-fonts in a CID-keyed file */
174 #define CFF_MAX_CID_FONTS  16
175   
176
177   typedef struct  CFF_Font_
178   {
179     FT_Stream      stream;
180     FT_Memory      memory;
181     FT_UInt        num_faces;
182     FT_UInt        num_glyphs;
183     
184     FT_Byte        version_major;
185     FT_Byte        version_minor;
186     FT_Byte        header_size;
187     FT_Byte        absolute_offsize;
188
189   
190     CFF_Index      name_index;
191     CFF_Index      top_dict_index;
192     CFF_Index      string_index;
193     CFF_Index      global_subrs_index;
194   
195     /* we don't load the Encoding and CharSet tables */
196   
197     CFF_Index      charstrings_index;
198     CFF_Index      font_dict_index;
199     CFF_Index      private_index;
200     CFF_Index      local_subrs_index;
201
202     FT_String*     font_name;
203     FT_UInt        num_global_subrs;
204     FT_Byte**      global_subrs;
205
206     CFF_SubFont    top_font;
207     FT_UInt        num_subfonts;
208     CFF_SubFont*   subfonts[CFF_MAX_CID_FONTS];
209
210     CFF_FD_Select  fd_select;
211
212   } CFF_Font;
213
214
215 #endif /* T2TYPES_H */
216
217
218 /* END */