OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* aflatin2.c */ | 3 /* aflatin2.c */ |
4 /* */ | 4 /* */ |
5 /* Auto-fitter hinting routines for latin script (body). */ | 5 /* Auto-fitter hinting routines for latin script (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2003-2011 by */ | 7 /* Copyright 2003-2011 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if ( link && link->link == seg && link > seg ) | 126 if ( link && link->link == seg && link > seg ) |
127 { | 127 { |
128 FT_Pos dist; | 128 FT_Pos dist; |
129 | 129 |
130 | 130 |
131 dist = seg->pos - link->pos; | 131 dist = seg->pos - link->pos; |
132 if ( dist < 0 ) | 132 if ( dist < 0 ) |
133 dist = -dist; | 133 dist = -dist; |
134 | 134 |
135 if ( num_widths < AF_LATIN_MAX_WIDTHS ) | 135 if ( num_widths < AF_LATIN_MAX_WIDTHS ) |
136 axis->widths[ num_widths++ ].org = dist; | 136 axis->widths[num_widths++].org = dist; |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 af_sort_widths( num_widths, axis->widths ); | 140 af_sort_widths( num_widths, axis->widths ); |
141 axis->width_count = num_widths; | 141 axis->width_count = num_widths; |
142 } | 142 } |
143 | 143 |
144 Exit: | 144 Exit: |
145 for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) | 145 for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) |
146 { | 146 { |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 error = af_latin2_hints_compute_edges( hints, dim ); | 1352 error = af_latin2_hints_compute_edges( hints, dim ); |
1353 } | 1353 } |
1354 return error; | 1354 return error; |
1355 } | 1355 } |
1356 | 1356 |
1357 | 1357 |
1358 FT_LOCAL_DEF( void ) | 1358 FT_LOCAL_DEF( void ) |
1359 af_latin2_hints_compute_blue_edges( AF_GlyphHints hints, | 1359 af_latin2_hints_compute_blue_edges( AF_GlyphHints hints, |
1360 AF_LatinMetrics metrics ) | 1360 AF_LatinMetrics metrics ) |
1361 { | 1361 { |
1362 AF_AxisHints axis = &hints->axis[ AF_DIMENSION_VERT ]; | 1362 AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT]; |
1363 AF_Edge edge = axis->edges; | 1363 AF_Edge edge = axis->edges; |
1364 AF_Edge edge_limit = edge + axis->num_edges; | 1364 AF_Edge edge_limit = edge + axis->num_edges; |
1365 AF_LatinAxis latin = &metrics->axis[ AF_DIMENSION_VERT ]; | 1365 AF_LatinAxis latin = &metrics->axis[AF_DIMENSION_VERT]; |
1366 FT_Fixed scale = latin->scale; | 1366 FT_Fixed scale = latin->scale; |
1367 FT_Pos best_dist0; /* initial threshold */ | 1367 FT_Pos best_dist0; /* initial threshold */ |
1368 | 1368 |
1369 | 1369 |
1370 /* compute the initial threshold as a fraction of the EM size */ | 1370 /* compute the initial threshold as a fraction of the EM size */ |
1371 best_dist0 = FT_MulFix( metrics->units_per_em / 40, scale ); | 1371 best_dist0 = FT_MulFix( metrics->units_per_em / 40, scale ); |
1372 | 1372 |
1373 if ( best_dist0 > 64 / 2 ) | 1373 if ( best_dist0 > 64 / 2 ) |
1374 best_dist0 = 64 / 2; | 1374 best_dist0 = 64 / 2; |
1375 | 1375 |
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2349 | 2349 |
2350 | 2350 |
2351 static const AF_Script_UniRangeRec af_latin2_uniranges[] = | 2351 static const AF_Script_UniRangeRec af_latin2_uniranges[] = |
2352 { | 2352 { |
2353 AF_UNIRANGE_REC( 32UL, 127UL ), /* TODO: Add new Unicode ranges here! */ | 2353 AF_UNIRANGE_REC( 32UL, 127UL ), /* TODO: Add new Unicode ranges here! */ |
2354 AF_UNIRANGE_REC( 160UL, 255UL ), | 2354 AF_UNIRANGE_REC( 160UL, 255UL ), |
2355 AF_UNIRANGE_REC( 0UL, 0UL ) | 2355 AF_UNIRANGE_REC( 0UL, 0UL ) |
2356 }; | 2356 }; |
2357 | 2357 |
2358 | 2358 |
2359 AF_DEFINE_SCRIPT_CLASS(af_latin2_script_class, | 2359 AF_DEFINE_SCRIPT_CLASS( af_latin2_script_class, |
2360 AF_SCRIPT_LATIN2, | 2360 AF_SCRIPT_LATIN2, |
2361 af_latin2_uniranges, | 2361 af_latin2_uniranges, |
2362 | 2362 |
2363 sizeof( AF_LatinMetricsRec ), | 2363 sizeof ( AF_LatinMetricsRec ), |
2364 | 2364 |
2365 (AF_Script_InitMetricsFunc) af_latin2_metrics_init, | 2365 (AF_Script_InitMetricsFunc) af_latin2_metrics_init, |
2366 (AF_Script_ScaleMetricsFunc)af_latin2_metrics_scale, | 2366 (AF_Script_ScaleMetricsFunc)af_latin2_metrics_scale, |
2367 (AF_Script_DoneMetricsFunc) NULL, | 2367 (AF_Script_DoneMetricsFunc) NULL, |
2368 | 2368 |
2369 (AF_Script_InitHintsFunc) af_latin2_hints_init, | 2369 (AF_Script_InitHintsFunc) af_latin2_hints_init, |
2370 (AF_Script_ApplyHintsFunc) af_latin2_hints_apply | 2370 (AF_Script_ApplyHintsFunc) af_latin2_hints_apply |
2371 ) | 2371 ) |
2372 | 2372 |
2373 | 2373 |
2374 /* END */ | 2374 /* END */ |
OLD | NEW |