1 /***************************************************************************/
5 /* Type 1 hinter (body). */
7 /* Copyright 1996-2000 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
23 #ifdef FT_FLAT_COMPILE
30 #include <type1/t1objs.h>
31 #include <type1/t1gload.h>
41 /*************************************************************************/
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. */
52 /* The position corresponds to the stem width (for stem snap zones) */
53 /* or to the blue position (for blue zones). */
56 /* orus :: The original position in font units. */
58 /* pix :: The current position in sub-pixel units. */
60 /* min :: The minimum boundary in sub-pixel units. */
62 /* max :: The maximum boundary in sub-pixel units. */
64 typedef struct T1_Snap_Zone_
74 /*************************************************************************/
80 /* A very simple structure used to model a stem edge. */
83 /* orus :: The original edge position in font units. */
85 /* pix :: The scaled edge position in sub-pixel units. */
87 typedef struct T1_Edge_
95 /*************************************************************************/
101 /* A simple structure used to model a stem hint. */
104 /* min_edge :: The hint's minimum edge. */
106 /* max_edge :: The hint's maximum edge. */
108 /* hint_flags :: Some flags describing the stem properties. */
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. */
114 typedef struct T1_Stem_Hint_
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 */
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 */
133 /*************************************************************************/
139 /* A structure used to model the hinting information related to a size */
143 /* supress_overshoots :: A boolean flag to tell whether overshoot */
144 /* supression should occur. */
146 /* num_blue_zones :: The total number of blue zones (top+bottom). */
148 /* num_bottom_zones :: The number of bottom zones. */
150 /* blue_zones :: The blue zones table. Bottom zones are */
151 /* stored first in the table, followed by all */
154 /* num_snap_widths :: The number of horizontal stem snap zones. */
156 /* snap_widths :: An array of horizontal stem snap zones. */
158 /* num_snap_heights :: The number of vertical stem snap zones. */
160 /* snap_heights :: An array of vertical stem snap zones. */
162 struct T1_Size_Hints_
164 FT_Bool supress_overshoots
;
166 FT_Int num_blue_zones
;
167 FT_Int num_bottom_zones
;
168 T1_Snap_Zone blue_zones
[T1_HINTER_MAX_BLUES
];
170 FT_Int num_snap_widths
;
171 T1_Snap_Zone snap_widths
[T1_HINTER_MAX_SNAPS
];
173 FT_Int num_snap_heights
;
174 T1_Snap_Zone snap_heights
[T1_HINTER_MAX_SNAPS
];
178 /*************************************************************************/
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 */
190 /* num_stems :: The total number of stems in the table. */
192 /* num_active :: The number of active stems in the table. */
194 /* stems :: A table of all stems. */
196 /* sort :: A table of indices into the stems table, used to */
197 /* keep a sorted list of the active stems. */
199 typedef struct T1_Stem_Table_
204 T1_Stem_Hint stems
[T1_HINTER_MAX_EDGES
];
205 FT_Int sort
[T1_HINTER_MAX_EDGES
];
210 /*************************************************************************/
216 /* A structure used to model the stem hints of a given glyph outline */
217 /* during glyph loading. */
220 /* hori_stems :: The horizontal stem hints table. */
221 /* vert_stems :: The vertical stem hints table. */
223 struct T1_Glyph_Hints_
225 T1_Stem_Table hori_stems
;
226 T1_Stem_Table vert_stems
;
230 /*************************************************************************/
233 /* t1_hinter_funcs */
236 /* A table containing the address of various functions used during */
237 /* the loading of an hinted scaled outline. */
239 extern const T1_Hinter_Funcs t1_hinter_funcs
;
243 FT_Error
T1_New_Size_Hinter( T1_Size size
);
246 void T1_Done_Size_Hinter( T1_Size size
);
249 FT_Error
T1_Reset_Size_Hinter( T1_Size size
);
252 FT_Error
T1_New_Glyph_Hinter( T1_GlyphSlot glyph
);
255 void T1_Done_Glyph_Hinter( T1_GlyphSlot glyph
);
259 void T1_Hint_Points( T1_Builder
* builder
);
262 void T1_Hint_Stems( T1_Builder
* builder
);
270 #endif /* T1HINTER_H */