1 /***************************************************************************/ 2 /* */ 3 /* aflatin.h */ 4 /* */ 5 /* Auto-fitter hinting routines for latin script (specification). */ 6 /* */ 7 /* Copyright 2003, 2004, 2005, 2006, 2007 by */ 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 9 /* */ 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. */ 15 /* */ 16 /***************************************************************************/ 17 18 19 #ifndef __AFLATIN_H__ 20 #define __AFLATIN_H__ 21 22 #include "afhints.h" 23 24 25 FT_BEGIN_HEADER 26 27 28 /* the latin-specific script class */ 29 30 FT_CALLBACK_TABLE const AF_ScriptClassRec 31 af_latin_script_class; 32 33 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 ) 37 38 39 /*************************************************************************/ 40 /*************************************************************************/ 41 /***** *****/ 42 /***** L A T I N G L O B A L M E T R I C S *****/ 43 /***** *****/ 44 /*************************************************************************/ 45 /*************************************************************************/ 46 47 48 /* 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. 52 */ 53 54 55 /* Latin (global) metrics management */ 56 57 enum 58 { 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, 65 66 AF_LATIN_BLUE_MAX 67 }; 68 69 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 ) 73 74 #define AF_LATIN_MAX_WIDTHS 16 75 #define AF_LATIN_MAX_BLUES AF_LATIN_BLUE_MAX 76 77 78 enum 79 { 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 */ 83 /* optimization */ 84 AF_LATIN_BLUE_FLAG_MAX 85 }; 86 87 88 typedef struct AF_LatinBlueRec_ 89 { 90 AF_WidthRec ref; 91 AF_WidthRec shoot; 92 FT_UInt flags; 93 94 } AF_LatinBlueRec, *AF_LatinBlue; 95 96 97 typedef struct AF_LatinAxisRec_ 98 { 99 FT_Fixed scale; 100 FT_Pos delta; 101 102 FT_UInt width_count; 103 AF_WidthRec widths[AF_LATIN_MAX_WIDTHS]; 104 FT_Pos edge_distance_threshold; 105 FT_Pos standard_width; 106 FT_Bool extra_light; 107 108 /* ignored for horizontal metrics */ 109 FT_Bool control_overshoot; 110 FT_UInt blue_count; 111 AF_LatinBlueRec blues[AF_LATIN_BLUE_MAX]; 112 113 FT_Fixed org_scale; 114 FT_Pos org_delta; 115 116 } AF_LatinAxisRec, *AF_LatinAxis; 117 118 119 typedef struct AF_LatinMetricsRec_ 120 { 121 AF_ScriptMetricsRec root; 122 FT_UInt units_per_em; 123 AF_LatinAxisRec axis[AF_DIMENSION_MAX]; 124 125 } AF_LatinMetricsRec, *AF_LatinMetrics; 126 127 128 FT_LOCAL( FT_Error ) 129 af_latin_metrics_init( AF_LatinMetrics metrics, 130 FT_Face face ); 131 132 FT_LOCAL( void ) 133 af_latin_metrics_scale( AF_LatinMetrics metrics, 134 AF_Scaler scaler ); 135 136 FT_LOCAL( void ) 137 af_latin_metrics_init_widths( AF_LatinMetrics metrics, 138 FT_Face face, 139 FT_ULong charcode ); 140 141 142 /*************************************************************************/ 143 /*************************************************************************/ 144 /***** *****/ 145 /***** L A T I N G L Y P H A N A L Y S I S *****/ 146 /***** *****/ 147 /*************************************************************************/ 148 /*************************************************************************/ 149 150 enum 151 { 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 */ 155 /* adjustment */ 156 AF_LATIN_HINTS_MONO = 1 << 3 /* indicate monochrome */ 157 /* rendering */ 158 }; 159 160 161 #define AF_LATIN_HINTS_DO_HORZ_SNAP( h ) \ 162 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_HORZ_SNAP ) 163 164 #define AF_LATIN_HINTS_DO_VERT_SNAP( h ) \ 165 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_VERT_SNAP ) 166 167 #define AF_LATIN_HINTS_DO_STEM_ADJUST( h ) \ 168 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_STEM_ADJUST ) 169 170 #define AF_LATIN_HINTS_DO_MONO( h ) \ 171 AF_HINTS_TEST_OTHER( h, AF_LATIN_HINTS_MONO ) 172 173 174 /* 175 * This shouldn't normally be exported. However, other scripts might 176 * like to use this function as-is. 177 */ 178 FT_LOCAL( FT_Error ) 179 af_latin_hints_compute_segments( AF_GlyphHints hints, 180 AF_Dimension dim ); 181 182 /* 183 * This shouldn't normally be exported. However, other scripts might 184 * want to use this function as-is. 185 */ 186 FT_LOCAL( void ) 187 af_latin_hints_link_segments( AF_GlyphHints hints, 188 AF_Dimension dim ); 189 190 /* 191 * This shouldn't normally be exported. However, other scripts might 192 * want to use this function as-is. 193 */ 194 FT_LOCAL( FT_Error ) 195 af_latin_hints_compute_edges( AF_GlyphHints hints, 196 AF_Dimension dim ); 197 198 FT_LOCAL( FT_Error ) 199 af_latin_hints_detect_features( AF_GlyphHints hints, 200 AF_Dimension dim ); 201 202 /* */ 203 204 FT_END_HEADER 205 206 #endif /* __AFLATIN_H__ */ 207 208 209 /* END */ 210