1 /***************************************************************************/
5 /* Auto-fitter hinting routines for latin script (specification). */
7 /* Copyright 2003, 2004, 2005, 2006, 2007 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
16 /***************************************************************************/
28 /* the latin-specific script class */
30 FT_CALLBACK_TABLE
const AF_ScriptClassRec
31 af_latin_script_class
;
34 /* constants are given with units_per_em == 2048 in mind */
35 #define AF_LATIN_CONSTANT( metrics, c ) \
36 ( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )
39 /*************************************************************************/
40 /*************************************************************************/
42 /***** L A T I N G L O B A L M E T R I C S *****/
44 /*************************************************************************/
45 /*************************************************************************/
49 * The following declarations could be embedded in the file `aflatin.c';
50 * they have been made semi-public to allow alternate script hinters to
51 * re-use some of them.
55 /* Latin (global) metrics management */
59 AF_LATIN_BLUE_CAPITAL_TOP
,
60 AF_LATIN_BLUE_CAPITAL_BOTTOM
,
61 AF_LATIN_BLUE_SMALL_F_TOP
,
62 AF_LATIN_BLUE_SMALL_TOP
,
63 AF_LATIN_BLUE_SMALL_BOTTOM
,
64 AF_LATIN_BLUE_SMALL_MINOR
,
70 #define AF_LATIN_IS_TOP_BLUE( b ) ( (b) == AF_LATIN_BLUE_CAPITAL_TOP || \
71 (b) == AF_LATIN_BLUE_SMALL_F_TOP || \
72 (b) == AF_LATIN_BLUE_SMALL_TOP )
74 #define AF_LATIN_MAX_WIDTHS 16
75 #define AF_LATIN_MAX_BLUES AF_LATIN_BLUE_MAX
80 AF_LATIN_BLUE_ACTIVE
= 1 << 0,
81 AF_LATIN_BLUE_TOP
= 1 << 1,
82 AF_LATIN_BLUE_ADJUSTMENT
= 1 << 2, /* used for scale adjustment */
84 AF_LATIN_BLUE_FLAG_MAX
88 typedef struct AF_LatinBlueRec_
94 } AF_LatinBlueRec
, *AF_LatinBlue
;
97 typedef struct AF_LatinAxisRec_
103 AF_WidthRec widths
[AF_LATIN_MAX_WIDTHS
];
104 FT_Pos edge_distance_threshold
;
105 FT_Pos standard_width
;
108 /* ignored for horizontal metrics */
109 FT_Bool control_overshoot
;
111 AF_LatinBlueRec blues
[AF_LATIN_BLUE_MAX
];
116 } AF_LatinAxisRec
, *AF_LatinAxis
;
119 typedef struct AF_LatinMetricsRec_
121 AF_ScriptMetricsRec root
;
122 FT_UInt units_per_em
;
123 AF_LatinAxisRec axis
[AF_DIMENSION_MAX
];
125 } AF_LatinMetricsRec
, *AF_LatinMetrics
;
129 af_latin_metrics_init( AF_LatinMetrics metrics
,
133 af_latin_metrics_scale( AF_LatinMetrics metrics
,
137 af_latin_metrics_init_widths( AF_LatinMetrics metrics
,
142 /*************************************************************************/
143 /*************************************************************************/
145 /***** L A T I N G L Y P H A N A L Y S I S *****/
147 /*************************************************************************/
148 /*************************************************************************/
152 AF_LATIN_HINTS_HORZ_SNAP
= 1 << 0, /* enable stem width snapping */
153 AF_LATIN_HINTS_VERT_SNAP
= 1 << 1, /* enable stem height snapping */
154 AF_LATIN_HINTS_STEM_ADJUST
= 1 << 2, /* enable stem width/height */
156 AF_LATIN_HINTS_MONO
= 1 << 3 /* indicate monochrome */
161 #define AF_LATIN_HINTS_DO_HORZ_SNAP( h ) \
162 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP )
164 #define AF_LATIN_HINTS_DO_VERT_SNAP( h ) \
165 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP )
167 #define AF_LATIN_HINTS_DO_STEM_ADJUST( h ) \
168 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST )
170 #define AF_LATIN_HINTS_DO_MONO( h ) \
171 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO )
175 * This shouldn't normally be exported. However, other scripts might
176 * like to use this function as-is.
179 af_latin_hints_compute_segments( AF_GlyphHints hints
,
183 * This shouldn't normally be exported. However, other scripts might
184 * want to use this function as-is.
187 af_latin_hints_link_segments( AF_GlyphHints hints
,
191 * This shouldn't normally be exported. However, other scripts might
192 * want to use this function as-is.
195 af_latin_hints_compute_edges( AF_GlyphHints hints
,
199 af_latin_hints_detect_features( AF_GlyphHints hints
,
206 #endif /* __AFLATIN_H__ */