]> git.saurik.com Git - wxWidgets.git/blob - src/freetype/type1/t1hinter.h
use the new wxSystemSettings API everywhere
[wxWidgets.git] / src / freetype / type1 / t1hinter.h
1 /***************************************************************************/
2 /* */
3 /* t1hinter.h */
4 /* */
5 /* Type 1 hinter (body). */
6 /* */
7 /* Copyright 1996-2000 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17
18
19 #ifndef T1HINTER_H
20 #define T1HINTER_H
21
22
23 #ifdef FT_FLAT_COMPILE
24
25 #include "t1objs.h"
26 #include "t1gload.h"
27
28 #else
29
30 #include <type1/t1objs.h>
31 #include <type1/t1gload.h>
32
33 #endif
34
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40
41 /*************************************************************************/
42 /* */
43 /* <Struct> */
44 /* T1_Snap_Zone */
45 /* */
46 /* <Description> */
47 /* A `snap zone' is used to model either a blue zone or a stem width */
48 /* at a given character size. It is made of a minimum and maximum */
49 /* edge, defined in 26.6 pixels, as well as an `original' and */
50 /* `scaled' position. */
51 /* */
52 /* The position corresponds to the stem width (for stem snap zones) */
53 /* or to the blue position (for blue zones). */
54 /* */
55 /* <Fields> */
56 /* orus :: The original position in font units. */
57 /* */
58 /* pix :: The current position in sub-pixel units. */
59 /* */
60 /* min :: The minimum boundary in sub-pixel units. */
61 /* */
62 /* max :: The maximum boundary in sub-pixel units. */
63 /* */
64 typedef struct T1_Snap_Zone_
65 {
66 FT_Pos orus;
67 FT_Pos pix;
68 FT_Pos min;
69 FT_Pos max;
70
71 } T1_Snap_Zone;
72
73
74 /*************************************************************************/
75 /* */
76 /* <Struct> */
77 /* T1_Edge */
78 /* */
79 /* <Description> */
80 /* A very simple structure used to model a stem edge. */
81 /* */
82 /* <Fields> */
83 /* orus :: The original edge position in font units. */
84 /* */
85 /* pix :: The scaled edge position in sub-pixel units. */
86 /* */
87 typedef struct T1_Edge_
88 {
89 FT_Pos orus;
90 FT_Pos pix;
91
92 } T1_Edge;
93
94
95 /*************************************************************************/
96 /* */
97 /* <Struct> */
98 /* T1_Stem_Hint */
99 /* */
100 /* <Description> */
101 /* A simple structure used to model a stem hint. */
102 /* */
103 /* <Fields> */
104 /* min_edge :: The hint's minimum edge. */
105 /* */
106 /* max_edge :: The hint's maximum edge. */
107 /* */
108 /* hint_flags :: Some flags describing the stem properties. */
109 /* */
110 /* <Note> */
111 /* The min and max edges of a ghost stem have the same position, even */
112 /* if they are coded in a weird way in the charstrings. */
113 /* */
114 typedef struct T1_Stem_Hint_
115 {
116 T1_Edge min_edge;
117 T1_Edge max_edge;
118 FT_Int hint_flags;
119
120 } T1_Stem_Hint;
121
122
123 #define T1_HINT_FLAG_ACTIVE 1 /* indicates an active stem */
124 #define T1_HINT_FLAG_MIN_BORDER 2 /* unused for now */
125 #define T1_HINT_FLAG_MAX_BORDER 4 /* unused for now */
126
127 /* hinter's configuration constants */
128 #define T1_HINTER_MAX_BLUES 24 /* maximum number of blue zones */
129 #define T1_HINTER_MAX_SNAPS 16 /* maximum number of stem snap zones */
130 #define T1_HINTER_MAX_EDGES 64 /* maximum number of stem hints */
131
132
133 /*************************************************************************/
134 /* */
135 /* <Struct> */
136 /* T1_Size_Hints */
137 /* */
138 /* <Description> */
139 /* A structure used to model the hinting information related to a size */
140 /* object. */
141 /* */
142 /* <Fields> */
143 /* supress_overshoots :: A boolean flag to tell whether overshoot */
144 /* supression should occur. */
145 /* */
146 /* num_blue_zones :: The total number of blue zones (top+bottom). */
147 /* */
148 /* num_bottom_zones :: The number of bottom zones. */
149 /* */
150 /* blue_zones :: The blue zones table. Bottom zones are */
151 /* stored first in the table, followed by all */
152 /* top zones. */
153 /* */
154 /* num_snap_widths :: The number of horizontal stem snap zones. */
155 /* */
156 /* snap_widths :: An array of horizontal stem snap zones. */
157 /* */
158 /* num_snap_heights :: The number of vertical stem snap zones. */
159 /* */
160 /* snap_heights :: An array of vertical stem snap zones. */
161 /* */
162 struct T1_Size_Hints_
163 {
164 FT_Bool supress_overshoots;
165
166 FT_Int num_blue_zones;
167 FT_Int num_bottom_zones;
168 T1_Snap_Zone blue_zones[T1_HINTER_MAX_BLUES];
169
170 FT_Int num_snap_widths;
171 T1_Snap_Zone snap_widths[T1_HINTER_MAX_SNAPS];
172
173 FT_Int num_snap_heights;
174 T1_Snap_Zone snap_heights[T1_HINTER_MAX_SNAPS];
175 };
176
177
178 /*************************************************************************/
179 /* */
180 /* <Struct> */
181 /* T1_Stem_Table */
182 /* */
183 /* <Description> */
184 /* A simple structure used to model a set of stem hints in a single */
185 /* direction during the loading of a given glyph outline. Not all */
186 /* stem hints are active at a time. Moreover, stems must be sorted */
187 /* regularly. */
188 /* */
189 /* <Fields> */
190 /* num_stems :: The total number of stems in the table. */
191 /* */
192 /* num_active :: The number of active stems in the table. */
193 /* */
194 /* stems :: A table of all stems. */
195 /* */
196 /* sort :: A table of indices into the stems table, used to */
197 /* keep a sorted list of the active stems. */
198 /* */
199 typedef struct T1_Stem_Table_
200 {
201 FT_Int num_stems;
202 FT_Int num_active;
203
204 T1_Stem_Hint stems[T1_HINTER_MAX_EDGES];
205 FT_Int sort [T1_HINTER_MAX_EDGES];
206
207 } T1_Stem_Table;
208
209
210 /*************************************************************************/
211 /* */
212 /* <Struct> */
213 /* T1_Glyph_Hints */
214 /* */
215 /* <Description> */
216 /* A structure used to model the stem hints of a given glyph outline */
217 /* during glyph loading. */
218 /* */
219 /* <Fields> */
220 /* hori_stems :: The horizontal stem hints table. */
221 /* vert_stems :: The vertical stem hints table. */
222 /* */
223 struct T1_Glyph_Hints_
224 {
225 T1_Stem_Table hori_stems;
226 T1_Stem_Table vert_stems;
227 };
228
229
230 /*************************************************************************/
231 /* */
232 /* <Data> */
233 /* t1_hinter_funcs */
234 /* */
235 /* <Description> */
236 /* A table containing the address of various functions used during */
237 /* the loading of an hinted scaled outline. */
238 /* */
239 extern const T1_Hinter_Funcs t1_hinter_funcs;
240
241
242 LOCAL_DEF
243 FT_Error T1_New_Size_Hinter( T1_Size size );
244
245 LOCAL_DEF
246 void T1_Done_Size_Hinter( T1_Size size );
247
248 LOCAL_DEF
249 FT_Error T1_Reset_Size_Hinter( T1_Size size );
250
251 LOCAL_DEF
252 FT_Error T1_New_Glyph_Hinter( T1_GlyphSlot glyph );
253
254 LOCAL_DEF
255 void T1_Done_Glyph_Hinter( T1_GlyphSlot glyph );
256
257
258 LOCAL_DEF
259 void T1_Hint_Points( T1_Builder* builder );
260
261 LOCAL_DEF
262 void T1_Hint_Stems( T1_Builder* builder );
263
264
265 #ifdef __cplusplus
266 }
267 #endif
268
269
270 #endif /* T1HINTER_H */
271
272
273 /* END */