9
* The definition of outline glyph hints. These are shared by all
10
* script analysis routines (until now)
16
AF_DIMENSION_HORZ = 0, /* x coordinates, i.e. vertical segments & edges */
17
AF_DIMENSION_VERT = 1, /* y coordinates, i.e. horizontal segments & edges */
19
AF_DIMENSION_MAX /* do not remove */
24
/* hint directions -- the values are computed so that two vectors are */
25
/* in opposite directions iff `dir1+dir2 == 0' */
37
/* point hint flags */
42
/* point type flags */
43
AF_FLAG_CONIC = (1 << 0),
44
AF_FLAG_CUBIC = (1 << 1),
45
AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC,
47
/* point extremum flags */
48
AF_FLAG_EXTREMA_X = (1 << 2),
49
AF_FLAG_EXTREMA_Y = (1 << 3),
51
/* point roundness flags */
52
AF_FLAG_ROUND_X = (1 << 4),
53
AF_FLAG_ROUND_Y = (1 << 5),
55
/* point touch flags */
56
AF_FLAG_TOUCH_X = (1 << 6),
57
AF_FLAG_TOUCH_Y = (1 << 7),
59
/* candidates for weak interpolation have this flag set */
60
AF_FLAG_WEAK_INTERPOLATION = (1 << 8),
62
/* all inflection points in the outline have this flag set */
63
AF_FLAG_INFLECTION = (1 << 9)
72
AF_EDGE_ROUND = (1 << 0),
73
AF_EDGE_SERIF = (1 << 1),
74
AF_EDGE_DONE = (1 << 2)
80
typedef struct AF_PointRec_* AF_Point;
81
typedef struct AF_SegmentRec_* AF_Segment;
82
typedef struct AF_EdgeRec_* AF_Edge;
85
typedef struct AF_PointRec_
87
AF_Flags flags; /* point flags used by hinter */
88
FT_Pos ox, oy; /* original, scaled position */
89
FT_Pos fx, fy; /* original, unscaled position (font units) */
90
FT_Pos x, y; /* current position */
91
FT_Pos u, v; /* current (x,y) or (y,x) depending on context */
93
AF_Direction in_dir; /* direction of inwards vector */
94
AF_Direction out_dir; /* direction of outwards vector */
96
AF_Point next; /* next point in contour */
97
AF_Point prev; /* previous point in contour */
102
typedef struct AF_SegmentRec_
104
AF_Edge_Flags flags; /* edge/segment flags for this segment */
105
AF_Direction dir; /* segment direction */
106
FT_Pos pos; /* position of segment */
107
FT_Pos min_coord; /* minimum coordinate of segment */
108
FT_Pos max_coord; /* maximum coordinate of segment */
110
AF_Edge edge; /* the segment's parent edge */
111
AF_Segment edge_next; /* link to next segment in parent edge */
113
AF_Segment link; /* (stem) link segment */
114
AF_Segment serif; /* primary segment for serifs */
115
FT_Pos num_linked; /* number of linked segments */
116
FT_Pos score; /* used during stem matching */
118
AF_Point first; /* first point in edge segment */
119
AF_Point last; /* last point in edge segment */
120
AF_Point* contour; /* ptr to first point of segment's contour */
125
typedef struct AF_EdgeRec_
127
FT_Pos fpos; /* original, unscaled position (font units) */
128
FT_Pos opos; /* original, scaled position */
129
FT_Pos pos; /* current position */
131
AF_Edge_Flags flags; /* edge flags */
132
AF_Direction dir; /* edge direction */
133
FT_Fixed scale; /* used to speed up interpolation between edges */
134
AF_Width blue_edge; /* non-NULL if this is a blue edge */
148
typedef struct AF_AxisHintsRec_
156
AF_Direction major_dir;
158
} AF_AxisHintsRec, *AF_AxisHints;
161
typedef struct AF_GlyphHintsRec_
171
FT_Pos edge_distance_threshold;
181
AF_AxisHintsRec axis[ AF_DIMENSION_MAX ];
183
FT_UInt32 scaler_flags; /* copy of scaler flags */
184
FT_UInt32 other_flags; /* free for script-specific implementations */
185
AF_ScriptMetrics metrics;
190
#define AF_HINTS_TEST_SCALER(h,f) ( (h)->scaler_flags & (f) )
191
#define AF_HINTS_TEST_OTHER(h,f) ( (h)->other_flags & (f) )
193
#define AF_HINTS_DO_HORIZONTAL(h) \
194
!AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_HORIZONTAL)
196
#define AF_HINTS_DO_VERTICAL(h) \
197
!AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_VERTICAL)
199
#define AF_HINTS_DO_ADVANCE(h) \
200
!AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_ADVANCE)
203
FT_LOCAL( AF_Direction )
204
af_direction_compute( FT_Pos dx,
209
af_glyph_hints_init( AF_GlyphHints hints,
214
/* recomputes all AF_Point in a AF_GlyphHints from the definitions
215
* in a source outline
218
af_glyph_hints_rescale( AF_GlyphHints hints,
219
AF_ScriptMetrics metrics );
222
af_glyph_hints_reload( AF_GlyphHints hints,
223
FT_Outline* outline );
226
af_glyph_hints_save( AF_GlyphHints hints,
227
FT_Outline* outline );
230
af_glyph_hints_align_edge_points( AF_GlyphHints hints,
234
af_glyph_hints_align_strong_points( AF_GlyphHints hints,
238
af_glyph_hints_align_weak_points( AF_GlyphHints hints,
242
af_glyph_hints_done( AF_GlyphHints hints );
248
#endif /* __AFHINTS_H__ */