]> git.saurik.com Git - wxWidgets.git/blob - src/freetype/autohint/ahoptim.h
case-insensitive sort of HTML help index
[wxWidgets.git] / src / freetype / autohint / ahoptim.h
1 /***************************************************************************/
2 /* */
3 /* ahoptim.h */
4 /* */
5 /* FreeType auto hinting outline optimization (declaration). */
6 /* */
7 /* Copyright 2000 Catharon Productions Inc. */
8 /* Author: David Turner */
9 /* */
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. */
16 /* */
17 /* Note that this license is compatible with the FreeType license. */
18 /* */
19 /***************************************************************************/
20
21
22 #ifndef AHOPTIM_H
23 #define AHOPTIM_H
24
25
26 #ifdef FT_FLAT_COMPILE
27
28 #include "ahtypes.h"
29
30 #else
31
32 #include <autohint/ahtypes.h>
33
34 #endif
35
36
37 /* the maximal number of stem configurations to record */
38 /* during optimization */
39 #define AH_MAX_CONFIGS 8
40
41
42 typedef struct AH_Stem_
43 {
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 */
48
49 FT_Pos min_pos; /* minimum grid position */
50 FT_Pos max_pos; /* maximum grid position */
51
52 AH_Edge* edge1; /* left/bottom edge */
53 AH_Edge* edge2; /* right/top edge */
54
55 FT_Pos opos; /* original position */
56 FT_Pos owidth; /* original width */
57
58 FT_Pos min_coord; /* minimum coordinate */
59 FT_Pos max_coord; /* maximum coordinate */
60
61 } AH_Stem;
62
63
64 /* A spring between two stems */
65 typedef struct AH_Spring_
66 {
67 AH_Stem* stem1;
68 AH_Stem* stem2;
69 FT_Pos owidth; /* original width */
70 FT_Pos tension; /* current tension */
71
72 } AH_Spring;
73
74
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_
78 {
79 FT_Pos* positions;
80 FT_Long distortion;
81
82 } AH_Configuration;
83
84
85 typedef struct AH_Optimizer_
86 {
87 FT_Memory memory;
88 AH_Outline* outline;
89
90 FT_Int num_hstems;
91 AH_Stem* horz_stems;
92
93 FT_Int num_vstems;
94 AH_Stem* vert_stems;
95
96 FT_Int num_hsprings;
97 FT_Int num_vsprings;
98 AH_Spring* horz_springs;
99 AH_Spring* vert_springs;
100
101 FT_Int num_configs;
102 AH_Configuration configs[AH_MAX_CONFIGS];
103 FT_Pos* positions;
104
105 /* during each pass, use these instead */
106 FT_Int num_stems;
107 AH_Stem* stems;
108
109 FT_Int num_springs;
110 AH_Spring* springs;
111 FT_Bool vertical;
112
113 FT_Fixed tension_scale;
114 FT_Pos tension_threshold;
115
116 } AH_Optimizer;
117
118
119 /* loads the outline into the optimizer */
120 int AH_Optimizer_Init( AH_Optimizer* optimizer,
121 AH_Outline* outline,
122 FT_Memory memory );
123
124
125 /* compute optimal outline */
126 void AH_Optimizer_Compute( AH_Optimizer* optimizer );
127
128
129 /* release the optimization data */
130 void AH_Optimizer_Done( AH_Optimizer* optimizer );
131
132
133 #endif /* AHOPTIM_H */
134
135
136 /* END */