1 /***************************************************************************/
5 /* Auto-fitter hinting routines for latin script (specification). */
7 /* Copyright 2003-2007, 2009, 2011-2013 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 /***************************************************************************/
27 /* the `latin' writing system */
29 AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin_writing_system_class
)
32 /* the latin-specific script classes */
34 AF_DECLARE_SCRIPT_CLASS( af_cyrl_script_class
)
35 AF_DECLARE_SCRIPT_CLASS( af_grek_script_class
)
36 AF_DECLARE_SCRIPT_CLASS( af_latn_script_class
)
37 AF_DECLARE_SCRIPT_CLASS( af_hebr_script_class
)
39 AF_DECLARE_SCRIPT_CLASS( af_armn_script_class
)
43 /* constants are given with units_per_em == 2048 in mind */
44 #define AF_LATIN_CONSTANT( metrics, c ) \
45 ( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )
48 /*************************************************************************/
49 /*************************************************************************/
51 /***** L A T I N G L O B A L M E T R I C S *****/
53 /*************************************************************************/
54 /*************************************************************************/
58 * The following declarations could be embedded in the file `aflatin.c';
59 * they have been made semi-public to allow alternate script hinters to
60 * re-use some of them.
64 #define AF_LATIN_IS_TOP_BLUE( b ) \
65 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_TOP )
66 #define AF_LATIN_IS_X_HEIGHT_BLUE( b ) \
67 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_X_HEIGHT )
68 #define AF_LATIN_IS_LONG_BLUE( b ) \
69 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_LONG )
71 #define AF_LATIN_MAX_WIDTHS 16
76 AF_LATIN_BLUE_ACTIVE
= 1 << 0, /* set if zone height is <= 3/4px */
77 AF_LATIN_BLUE_TOP
= 1 << 1, /* result of AF_LATIN_IS_TOP_BLUE */
78 AF_LATIN_BLUE_ADJUSTMENT
= 1 << 2, /* used for scale adjustment */
80 AF_LATIN_BLUE_FLAG_MAX
84 typedef struct AF_LatinBlueRec_
90 } AF_LatinBlueRec
, *AF_LatinBlue
;
93 typedef struct AF_LatinAxisRec_
98 FT_UInt width_count
; /* number of used widths */
99 AF_WidthRec widths
[AF_LATIN_MAX_WIDTHS
]; /* widths array */
100 FT_Pos edge_distance_threshold
; /* used for creating edges */
101 FT_Pos standard_width
; /* the default stem thickness */
102 FT_Bool extra_light
; /* is standard width very light? */
104 /* ignored for horizontal metrics */
106 AF_LatinBlueRec blues
[AF_BLUE_STRINGSET_MAX
];
111 } AF_LatinAxisRec
, *AF_LatinAxis
;
114 typedef struct AF_LatinMetricsRec_
116 AF_ScriptMetricsRec root
;
117 FT_UInt units_per_em
;
118 AF_LatinAxisRec axis
[AF_DIMENSION_MAX
];
120 } AF_LatinMetricsRec
, *AF_LatinMetrics
;
124 af_latin_metrics_init( AF_LatinMetrics metrics
,
128 af_latin_metrics_scale( AF_LatinMetrics metrics
,
132 af_latin_metrics_init_widths( AF_LatinMetrics metrics
,
136 af_latin_metrics_check_digits( AF_LatinMetrics metrics
,
140 /*************************************************************************/
141 /*************************************************************************/
143 /***** L A T I N G L Y P H A N A L Y S I S *****/
145 /*************************************************************************/
146 /*************************************************************************/
150 AF_LATIN_HINTS_HORZ_SNAP
= 1 << 0, /* enable stem width snapping */
151 AF_LATIN_HINTS_VERT_SNAP
= 1 << 1, /* enable stem height snapping */
152 AF_LATIN_HINTS_STEM_ADJUST
= 1 << 2, /* enable stem width/height */
154 AF_LATIN_HINTS_MONO
= 1 << 3 /* indicate monochrome */
159 #define AF_LATIN_HINTS_DO_HORZ_SNAP( h ) \
160 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP )
162 #define AF_LATIN_HINTS_DO_VERT_SNAP( h ) \
163 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP )
165 #define AF_LATIN_HINTS_DO_STEM_ADJUST( h ) \
166 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST )
168 #define AF_LATIN_HINTS_DO_MONO( h ) \
169 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO )
173 * The next functions shouldn't normally be exported. However, other
174 * scripts might like to use these functions as-is.
177 af_latin_hints_compute_segments( AF_GlyphHints hints
,
181 af_latin_hints_link_segments( AF_GlyphHints hints
,
185 af_latin_hints_compute_edges( AF_GlyphHints hints
,
189 af_latin_hints_detect_features( AF_GlyphHints hints
,
196 #endif /* __AFLATIN_H__ */