1 /***************************************************************************/
5 /* FreeType auto hinting outline optimization (declaration). */
7 /* Copyright 2000 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 /***************************************************************************/
26 #ifdef FT_FLAT_COMPILE
32 #include <freetype/src/autohint/ahtypes.h>
37 /* the maximal number of stem configurations to record */
38 /* during optimization */
39 #define AH_MAX_CONFIGS 8
42 typedef struct AH_Stem_
44 FT_Pos pos; /* current position */
45 FT_Pos velocity; /* current velocity */
46 FT_Pos force; /* sum of current forces */
47 FT_Pos width; /* normalized width */
49 FT_Pos min_pos; /* minimum grid position */
50 FT_Pos max_pos; /* maximum grid position */
52 AH_Edge* edge1; /* left/bottom edge */
53 AH_Edge* edge2; /* right/top edge */
55 FT_Pos opos; /* original position */
56 FT_Pos owidth; /* original width */
58 FT_Pos min_coord; /* minimum coordinate */
59 FT_Pos max_coord; /* maximum coordinate */
64 /* A spring between two stems */
65 typedef struct AH_Spring_
69 FT_Pos owidth; /* original width */
70 FT_Pos tension; /* current tension */
75 /* A configuration records the position of each stem at a given time */
76 /* as well as the associated distortion */
77 typedef struct AH_Configuration_
85 typedef struct AH_Optimizer_
98 AH_Spring* horz_springs;
99 AH_Spring* vert_springs;
102 AH_Configuration configs[AH_MAX_CONFIGS];
105 /* during each pass, use these instead */
113 FT_Fixed tension_scale;
114 FT_Pos tension_threshold;
119 /* loads the outline into the optimizer */
120 int AH_Optimizer_Init( AH_Optimizer* optimizer,
125 /* compute optimal outline */
126 void AH_Optimizer_Compute( AH_Optimizer* optimizer );
129 /* release the optimization data */
130 void AH_Optimizer_Done( AH_Optimizer* optimizer );
133 #endif /* AHOPTIM_H */