1 /***************************************************************************/
5 /* Auto-fitter hinting routines for latin writing system */
8 /* Copyright 2003-2007, 2009, 2011-2014 by */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
11 /* This file is part of the FreeType project, and may only be used, */
12 /* modified, and distributed under the terms of the FreeType project */
13 /* license, LICENSE.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 /***************************************************************************/
28 /* the `latin' writing system */
30 AF_DECLARE_WRITING_SYSTEM_CLASS( af_latin_writing_system_class
)
33 /* constants are given with units_per_em == 2048 in mind */
34 #define AF_LATIN_CONSTANT( metrics, c ) \
35 ( ( (c) * (FT_Long)( (AF_LatinMetrics)(metrics) )->units_per_em ) / 2048 )
38 /*************************************************************************/
39 /*************************************************************************/
41 /***** L A T I N G L O B A L M E T R I C S *****/
43 /*************************************************************************/
44 /*************************************************************************/
48 * The following declarations could be embedded in the file `aflatin.c';
49 * they have been made semi-public to allow alternate writing system
50 * hinters to re-use some of them.
54 #define AF_LATIN_IS_TOP_BLUE( b ) \
55 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_TOP )
56 #define AF_LATIN_IS_NEUTRAL_BLUE( b ) \
57 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_NEUTRAL )
58 #define AF_LATIN_IS_X_HEIGHT_BLUE( b ) \
59 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_X_HEIGHT )
60 #define AF_LATIN_IS_LONG_BLUE( b ) \
61 ( (b)->properties & AF_BLUE_PROPERTY_LATIN_LONG )
63 #define AF_LATIN_MAX_WIDTHS 16
68 AF_LATIN_BLUE_ACTIVE
= 1 << 0, /* set if zone height is <= 3/4px */
69 AF_LATIN_BLUE_TOP
= 1 << 1, /* set if we have a top blue zone */
70 AF_LATIN_BLUE_NEUTRAL
= 1 << 2, /* set if we have neutral blue zone */
71 AF_LATIN_BLUE_ADJUSTMENT
= 1 << 3, /* used for scale adjustment */
73 AF_LATIN_BLUE_FLAG_MAX
77 typedef struct AF_LatinBlueRec_
83 } AF_LatinBlueRec
, *AF_LatinBlue
;
86 typedef struct AF_LatinAxisRec_
91 FT_UInt width_count
; /* number of used widths */
92 AF_WidthRec widths
[AF_LATIN_MAX_WIDTHS
]; /* widths array */
93 FT_Pos edge_distance_threshold
; /* used for creating edges */
94 FT_Pos standard_width
; /* the default stem thickness */
95 FT_Bool extra_light
; /* is standard width very light? */
97 /* ignored for horizontal metrics */
99 AF_LatinBlueRec blues
[AF_BLUE_STRINGSET_MAX
];
104 } AF_LatinAxisRec
, *AF_LatinAxis
;
107 typedef struct AF_LatinMetricsRec_
109 AF_StyleMetricsRec root
;
110 FT_UInt units_per_em
;
111 AF_LatinAxisRec axis
[AF_DIMENSION_MAX
];
113 } AF_LatinMetricsRec
, *AF_LatinMetrics
;
117 af_latin_metrics_init( AF_LatinMetrics metrics
,
121 af_latin_metrics_scale( AF_LatinMetrics metrics
,
125 af_latin_metrics_init_widths( AF_LatinMetrics metrics
,
129 af_latin_metrics_check_digits( AF_LatinMetrics metrics
,
133 /*************************************************************************/
134 /*************************************************************************/
136 /***** L A T I N G L Y P H A N A L Y S I S *****/
138 /*************************************************************************/
139 /*************************************************************************/
143 AF_LATIN_HINTS_HORZ_SNAP
= 1 << 0, /* enable stem width snapping */
144 AF_LATIN_HINTS_VERT_SNAP
= 1 << 1, /* enable stem height snapping */
145 AF_LATIN_HINTS_STEM_ADJUST
= 1 << 2, /* enable stem width/height */
147 AF_LATIN_HINTS_MONO
= 1 << 3 /* indicate monochrome */
152 #define AF_LATIN_HINTS_DO_HORZ_SNAP( h ) \
153 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP )
155 #define AF_LATIN_HINTS_DO_VERT_SNAP( h ) \
156 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP )
158 #define AF_LATIN_HINTS_DO_STEM_ADJUST( h ) \
159 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST )
161 #define AF_LATIN_HINTS_DO_MONO( h ) \
162 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO )
166 * The next functions shouldn't normally be exported. However, other
167 * writing systems might like to use these functions as-is.
170 af_latin_hints_compute_segments( AF_GlyphHints hints
,
174 af_latin_hints_link_segments( AF_GlyphHints hints
,
180 af_latin_hints_compute_edges( AF_GlyphHints hints
,
184 af_latin_hints_detect_features( AF_GlyphHints hints
,
193 #endif /* __AFLATIN_H__ */