ScummVM API documentation
ahtypes.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 /***************************************************************************/
23 /* */
24 /* ahtypes.h */
25 /* */
26 /* General types and definitions for the auto-hint module */
27 /* (specification only). */
28 /* */
29 /* Copyright 2000-2001, 2002 Catharon Productions Inc. */
30 /* Author: David Turner */
31 /* */
32 /* This file is part of the Catharon Typography Project and shall only */
33 /* be used, modified, and distributed under the terms of the Catharon */
34 /* Open Source License that should come with this file under the name */
35 /* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
36 /* this file you indicate that you have read the license and */
37 /* understand and accept it fully. */
38 /* */
39 /* Note that this license is compatible with the FreeType license. */
40 /* */
41 /***************************************************************************/
42 
43 
44 #ifndef AGS_LIB_FREETYPE_AHTYPES_H
45 #define AGS_LIB_FREETYPE_AHTYPES_H
46 
47 
48 #include <ft2build.h>
49 #include FT_TYPES_H
50 
51 #include "ags/lib/freetype-2.1.3/autohint/ahloader.h"
52 
53 
54 namespace AGS3 {
55 namespace FreeType213 {
56 
57 
58 /**** COMPILE-TIME BUILD OPTIONS ****/
59 
60 /*************************************************************************/
61 /* */
62 /* If this option is defined, only strong interpolation will be used to */
63 /* place the points between edges. Otherwise, `smooth' points are */
64 /* detected and later hinted through weak interpolation to correct some */
65 /* unpleasant artefacts. */
66 /* */
67 #undef AH_OPTION_NO_WEAK_INTERPOLATION
68 
69 /*************************************************************************/
70 /* */
71 /* If this option is defined, only weak interpolation will be used to */
72 /* place the points between edges. Otherwise, `strong' points are */
73 /* detected and later hinted through strong interpolation to correct */
74 /* some unpleasant artefacts. */
75 /* */
76 #undef AH_OPTION_NO_STRONG_INTERPOLATION
77 
78 /*************************************************************************/
79 /* */
80 /* Undefine this macro if you don't want to hint the metrics. There is */
81 /* no reason to do this (at least for non-CJK scripts), except for */
82 /* experimentation. */
83 /* */
84 #undef AH_HINT_METRICS
85 
86 /*************************************************************************/
87 /* */
88 /* Define this macro if you do not want to insert extra edges at a */
89 /* glyph's x and y extremum (if there isn't one already available). */
90 /* This helps to reduce a number of artefacts and allows hinting of */
91 /* metrics. */
92 /* */
93 #undef AH_OPTION_NO_EXTREMUM_EDGES
94 
95 /* don't touch for now */
96 #define AH_MAX_WIDTHS 12
97 #define AH_MAX_HEIGHTS 12
98 
99 
100 /**** TYPE DEFINITIONS ****/
101 
102 /* see agangles.h */
103 typedef FT_Int AH_Angle;
104 
105 /* hint flags */
106 #define AH_FLAG_NONE 0
107 
108 /* bezier control points flags */
109 #define AH_FLAG_CONIC 1
110 #define AH_FLAG_CUBIC 2
111 #define AH_FLAG_CONTROL ( AH_FLAG_CONIC | AH_FLAG_CUBIC )
112 
113 /* extrema flags */
114 #define AH_FLAG_EXTREMA_X 4
115 #define AH_FLAG_EXTREMA_Y 8
116 
117 /* roundness */
118 #define AH_FLAG_ROUND_X 16
119 #define AH_FLAG_ROUND_Y 32
120 
121 /* touched */
122 #define AH_FLAG_TOUCH_X 64
123 #define AH_FLAG_TOUCH_Y 128
124 
125 /* weak interpolation */
126 #define AH_FLAG_WEAK_INTERPOLATION 256
127 #define AH_FLAG_INFLECTION 512
128 
129 typedef FT_Int AH_Flags;
130 
131 /* edge hint flags */
132 #define AH_EDGE_NORMAL 0
133 #define AH_EDGE_ROUND 1
134 #define AH_EDGE_SERIF 2
135 #define AH_EDGE_DONE 4
136 
137 typedef FT_Int AH_Edge_Flags;
138 
139 /* hint directions -- the values are computed so that two vectors are */
140 /* in opposite directions iff `dir1+dir2 == 0' */
141 #define AH_DIR_NONE 4
142 #define AH_DIR_RIGHT 1
143 #define AH_DIR_LEFT -1
144 #define AH_DIR_UP 2
145 #define AH_DIR_DOWN -2
146 
147 typedef FT_Int AH_Direction;
148 
149 typedef struct AH_PointRec_ *AH_Point;
150 typedef struct AH_SegmentRec_ *AH_Segment;
151 typedef struct AH_EdgeRec_ *AH_Edge;
152 
153 typedef struct AH_PointRec_ {
154  AH_Flags flags; /* point flags used by hinter */
155  FT_Pos ox, oy;
156  FT_Pos fx, fy;
157  FT_Pos x, y;
158  FT_Pos u, v;
159 
160  AH_Direction in_dir; /* direction of inwards vector */
161  AH_Direction out_dir; /* direction of outwards vector */
162 
163  AH_Angle in_angle;
164  AH_Angle out_angle;
165 
166  AH_Point next; /* next point in contour */
167  AH_Point prev; /* previous point in contour */
168 } AH_PointRec;
169 
170 
171 typedef struct AH_SegmentRec_ {
172  AH_Edge_Flags flags;
173  AH_Direction dir;
174 
175  AH_Point first; /* first point in edge segment */
176  AH_Point last; /* last point in edge segment */
177  AH_Point *contour; /* ptr to first point of segment's contour */
178 
179  FT_Pos pos; /* position of segment */
180  FT_Pos min_coord; /* minimum coordinate of segment */
181  FT_Pos max_coord; /* maximum coordinate of segment */
182 
183  AH_Edge edge;
184  AH_Segment edge_next;
185 
186  AH_Segment link; /* link segment */
187  AH_Segment serif; /* primary segment for serifs */
188  FT_Pos num_linked; /* number of linked segments */
189  FT_Pos score;
190 } AH_SegmentRec;
191 
192 
193 typedef struct AH_EdgeRec_ {
194  AH_Edge_Flags flags;
195  AH_Direction dir;
196 
197  AH_Segment first;
198  AH_Segment last;
199 
200  FT_Pos fpos;
201  FT_Pos opos;
202  FT_Pos pos;
203 
204  AH_Edge link;
205  AH_Edge serif;
206  FT_Int num_linked;
207 
208  FT_Int score;
209  FT_Pos *blue_edge;
210 } AH_EdgeRec;
211 
212 
213 /* an outline as seen by the hinter */
214 typedef struct AH_OutlineRec_ {
215  FT_Memory memory;
216 
217  AH_Direction vert_major_dir; /* vertical major direction */
218  AH_Direction horz_major_dir; /* horizontal major direction */
219 
220  FT_Fixed x_scale;
221  FT_Fixed y_scale;
222  FT_Pos edge_distance_threshold;
223 
224  FT_Int max_points;
225  FT_Int num_points;
226  AH_Point points;
227 
228  FT_Int max_contours;
229  FT_Int num_contours;
230  AH_Point *contours;
231 
232  FT_Int num_hedges;
233  AH_Edge horz_edges;
234 
235  FT_Int num_vedges;
236  AH_Edge vert_edges;
237 
238  FT_Int num_hsegments;
239  AH_Segment horz_segments;
240 
241  FT_Int num_vsegments;
242  AH_Segment vert_segments;
244 
245 
246 #define AH_BLUE_CAPITAL_TOP 0 /* THEZOCQS */
247 #define AH_BLUE_CAPITAL_BOTTOM ( AH_BLUE_CAPITAL_TOP + 1 ) /* HEZLOCUS */
248 #define AH_BLUE_SMALL_TOP ( AH_BLUE_CAPITAL_BOTTOM + 1 ) /* xzroesc */
249 #define AH_BLUE_SMALL_BOTTOM ( AH_BLUE_SMALL_TOP + 1 ) /* xzroesc */
250 #define AH_BLUE_SMALL_MINOR ( AH_BLUE_SMALL_BOTTOM + 1 ) /* pqgjy */
251 #define AH_BLUE_MAX ( AH_BLUE_SMALL_MINOR + 1 )
252 
253 typedef FT_Int AH_Blue;
254 
255 
256 #define AH_HINTER_MONOCHROME 1
257 #define AH_HINTER_OPTIMIZE 2
258 
259 typedef FT_Int AH_Hinter_Flags;
260 
261 
262 typedef struct AH_GlobalsRec_ {
263  FT_Int num_widths;
264  FT_Int num_heights;
265 
266  FT_Pos stds[2];
267 
268  FT_Pos widths[AH_MAX_WIDTHS];
269  FT_Pos heights[AH_MAX_HEIGHTS];
270 
271  FT_Pos blue_refs[AH_BLUE_MAX];
272  FT_Pos blue_shoots[AH_BLUE_MAX];
274 
275 
276 typedef struct AH_Face_GlobalsRec_ {
277  FT_Face face;
278  AH_GlobalsRec design;
279  AH_GlobalsRec scaled;
280  FT_Fixed x_scale;
281  FT_Fixed y_scale;
282  FT_Bool control_overshoot;
284 
285 
286 typedef struct AH_HinterRec {
287  FT_Memory memory;
288  AH_Hinter_Flags flags;
289 
290  FT_Int algorithm;
291  FT_Face face;
292 
293  AH_Face_Globals globals;
294 
295  AH_Outline glyph;
296 
297  AH_Loader loader;
298  FT_Vector pp1;
299  FT_Vector pp2;
300 
301  FT_Bool transformed;
302  FT_Vector trans_delta;
303  FT_Matrix trans_matrix;
304 
305  FT_Bool do_horz_hints; /* disable X hinting */
306  FT_Bool do_vert_hints; /* disable Y hinting */
307  FT_Bool do_horz_snapping; /* disable X stem size snapping */
308  FT_Bool do_vert_snapping; /* disable Y stem size snapping */
310 
311 
312 } // End of namespace FreeType213
313 } // End of namespace AGS3
314 
315 #endif /* AGS_LIB_FREETYPE_AHTYPES_H */
Definition: ahtypes.h:153
Definition: ahtypes.h:171
Definition: ahtypes.h:214
Definition: ahtypes.h:262
Definition: ahtypes.h:286
Definition: ahtypes.h:193
Definition: ags.h:40