1 /***************************************************************************/
5 /* FreeType auto hinting outline optimization (declaration). */
7 /* Copyright 2000-2001 Catharon Productions Inc. */
8 /* Author: David Turner */
10 /* This file is part of the Catharon Typography Project and shall only */
11 /* be used, modified, and distributed under the terms of the Catharon */
12 /* Open Source License that should come with this file under the name */
13 /* `CatharonLicense.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. */
17 /* Note that this license is compatible with the FreeType license. */
19 /***************************************************************************/
33 /* the maximal number of stem configurations to record */
34 /* during optimization */
35 #define AH_MAX_CONFIGS 8
38 typedef struct AH_Stem_
40 FT_Pos pos; /* current position */
41 FT_Pos velocity; /* current velocity */
42 FT_Pos force; /* sum of current forces */
43 FT_Pos width; /* normalized width */
45 FT_Pos min_pos; /* minimum grid position */
46 FT_Pos max_pos; /* maximum grid position */
48 AH_Edge* edge1; /* left/bottom edge */
49 AH_Edge* edge2; /* right/top edge */
51 FT_Pos opos; /* original position */
52 FT_Pos owidth; /* original width */
54 FT_Pos min_coord; /* minimum coordinate */
55 FT_Pos max_coord; /* maximum coordinate */
60 /* A spring between two stems */
61 typedef struct AH_Spring_
65 FT_Pos owidth; /* original width */
66 FT_Pos tension; /* current tension */
71 /* A configuration records the position of each stem at a given time */
72 /* as well as the associated distortion */
73 typedef struct AH_Configuration_
81 typedef struct AH_Optimizer_
94 AH_Spring* horz_springs;
95 AH_Spring* vert_springs;
98 AH_Configuration configs[AH_MAX_CONFIGS];
101 /* during each pass, use these instead */
109 FT_Fixed tension_scale;
110 FT_Pos tension_threshold;
115 /* loads the outline into the optimizer */
117 AH_Optimizer_Init( AH_Optimizer* optimizer,
122 /* compute optimal outline */
124 AH_Optimizer_Compute( AH_Optimizer* optimizer );
127 /* release the optimization data */
129 AH_Optimizer_Done( AH_Optimizer* optimizer );
134 #endif /* __AHOPTIM_H__ */