OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* aflatin.c */ | 3 /* aflatin.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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 if ( link && link->link == seg && link > seg ) | 127 if ( link && link->link == seg && link > seg ) |
128 { | 128 { |
129 FT_Pos dist; | 129 FT_Pos dist; |
130 | 130 |
131 | 131 |
132 dist = seg->pos - link->pos; | 132 dist = seg->pos - link->pos; |
133 if ( dist < 0 ) | 133 if ( dist < 0 ) |
134 dist = -dist; | 134 dist = -dist; |
135 | 135 |
136 if ( num_widths < AF_LATIN_MAX_WIDTHS ) | 136 if ( num_widths < AF_LATIN_MAX_WIDTHS ) |
137 axis->widths[ num_widths++ ].org = dist; | 137 axis->widths[num_widths++].org = dist; |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 af_sort_widths( num_widths, axis->widths ); | 141 af_sort_widths( num_widths, axis->widths ); |
142 axis->width_count = num_widths; | 142 axis->width_count = num_widths; |
143 } | 143 } |
144 | 144 |
145 Exit: | 145 Exit: |
146 for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) | 146 for ( dim = 0; dim < AF_DIMENSION_MAX; dim++ ) |
147 { | 147 { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 | 215 |
216 FT_TRACE5(( "blue %3d: ", bb )); | 216 FT_TRACE5(( "blue %3d: ", bb )); |
217 | 217 |
218 num_flats = 0; | 218 num_flats = 0; |
219 num_rounds = 0; | 219 num_rounds = 0; |
220 | 220 |
221 for ( ; p < limit && *p; p++ ) | 221 for ( ; p < limit && *p; p++ ) |
222 { | 222 { |
223 FT_UInt glyph_index; | 223 FT_UInt glyph_index; |
224 FT_Pos best_y; /* same as points.y */ | 224 FT_Pos best_y; /* same as points.y */ |
225 FT_Int best_point, best_first, best_last; | 225 FT_Int best_point, best_first, best_last; |
226 FT_Vector* points; | 226 FT_Vector* points; |
227 FT_Bool round = 0; | 227 FT_Bool round = 0; |
228 | 228 |
229 | 229 |
230 FT_TRACE5(( "'%c'", *p )); | 230 FT_TRACE5(( "'%c'", *p )); |
231 | 231 |
232 /* load the character in the face -- skip unknown or empty ones */ | 232 /* load the character in the face -- skip unknown or empty ones */ |
233 glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p ); | 233 glyph_index = FT_Get_Char_Index( face, (FT_UInt)*p ); |
234 if ( glyph_index == 0 ) | 234 if ( glyph_index == 0 ) |
(...skipping 23 matching lines...) Expand all Loading... |
258 FT_Int old_best_point = best_point; | 258 FT_Int old_best_point = best_point; |
259 FT_Int pp; | 259 FT_Int pp; |
260 | 260 |
261 | 261 |
262 last = glyph->outline.contours[nn]; | 262 last = glyph->outline.contours[nn]; |
263 | 263 |
264 /* Avoid single-point contours since they are never rasterized. */ | 264 /* Avoid single-point contours since they are never rasterized. */ |
265 /* In some fonts, they correspond to mark attachment points */ | 265 /* In some fonts, they correspond to mark attachment points */ |
266 /* which are way outside of the glyph's real outline. */ | 266 /* which are way outside of the glyph's real outline. */ |
267 if ( last <= first ) | 267 if ( last <= first ) |
268 continue; | 268 continue; |
269 | 269 |
270 if ( AF_LATIN_IS_TOP_BLUE( bb ) ) | 270 if ( AF_LATIN_IS_TOP_BLUE( bb ) ) |
271 { | 271 { |
272 for ( pp = first; pp <= last; pp++ ) | 272 for ( pp = first; pp <= last; pp++ ) |
273 if ( best_point < 0 || points[pp].y > best_y ) | 273 if ( best_point < 0 || points[pp].y > best_y ) |
274 { | 274 { |
275 best_point = pp; | 275 best_point = pp; |
276 best_y = points[pp].y; | 276 best_y = points[pp].y; |
277 } | 277 } |
278 } | 278 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 FT_TRACE5(( "empty\n" )); | 360 FT_TRACE5(( "empty\n" )); |
361 continue; | 361 continue; |
362 } | 362 } |
363 | 363 |
364 /* we have computed the contents of the `rounds' and `flats' tables, */ | 364 /* we have computed the contents of the `rounds' and `flats' tables, */ |
365 /* now determine the reference and overshoot position of the blue -- */ | 365 /* now determine the reference and overshoot position of the blue -- */ |
366 /* we simply take the median value after a simple sort */ | 366 /* we simply take the median value after a simple sort */ |
367 af_sort_pos( num_rounds, rounds ); | 367 af_sort_pos( num_rounds, rounds ); |
368 af_sort_pos( num_flats, flats ); | 368 af_sort_pos( num_flats, flats ); |
369 | 369 |
370 blue = & axis->blues[axis->blue_count]; | 370 blue = &axis->blues[axis->blue_count]; |
371 blue_ref = & blue->ref.org; | 371 blue_ref = &blue->ref.org; |
372 blue_shoot = & blue->shoot.org; | 372 blue_shoot = &blue->shoot.org; |
373 | 373 |
374 axis->blue_count++; | 374 axis->blue_count++; |
375 | 375 |
376 if ( num_flats == 0 ) | 376 if ( num_flats == 0 ) |
377 { | 377 { |
378 *blue_ref = | 378 *blue_ref = |
379 *blue_shoot = rounds[num_rounds / 2]; | 379 *blue_shoot = rounds[num_rounds / 2]; |
380 } | 380 } |
381 else if ( num_rounds == 0 ) | 381 else if ( num_rounds == 0 ) |
382 { | 382 { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 FT_LOCAL_DEF( void ) | 430 FT_LOCAL_DEF( void ) |
431 af_latin_metrics_check_digits( AF_LatinMetrics metrics, | 431 af_latin_metrics_check_digits( AF_LatinMetrics metrics, |
432 FT_Face face ) | 432 FT_Face face ) |
433 { | 433 { |
434 FT_UInt i; | 434 FT_UInt i; |
435 FT_Bool started = 0, same_width = 1; | 435 FT_Bool started = 0, same_width = 1; |
436 FT_Fixed advance, old_advance = 0; | 436 FT_Fixed advance, old_advance = 0; |
437 | 437 |
438 | 438 |
439 /* digit `0' is 0x30 in all supported charmaps */ | 439 /* digit `0' is 0x30 in all supported charmaps */ |
440 for ( i = 0x30; i <= 0x39; i++ ) | 440 for ( i = 0x30; i <= 0x39; i++ ) |
441 { | 441 { |
442 FT_UInt glyph_index; | 442 FT_UInt glyph_index; |
443 | 443 |
444 | 444 |
445 glyph_index = FT_Get_Char_Index( face, i ); | 445 glyph_index = FT_Get_Char_Index( face, i ); |
446 if ( glyph_index == 0 ) | 446 if ( glyph_index == 0 ) |
447 continue; | 447 continue; |
448 | 448 |
449 if ( FT_Get_Advance( face, glyph_index, | 449 if ( FT_Get_Advance( face, glyph_index, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 /*************************************************************************/ | 719 /*************************************************************************/ |
720 /*************************************************************************/ | 720 /*************************************************************************/ |
721 | 721 |
722 | 722 |
723 /* Walk over all contours and compute its segments. */ | 723 /* Walk over all contours and compute its segments. */ |
724 | 724 |
725 FT_LOCAL_DEF( FT_Error ) | 725 FT_LOCAL_DEF( FT_Error ) |
726 af_latin_hints_compute_segments( AF_GlyphHints hints, | 726 af_latin_hints_compute_segments( AF_GlyphHints hints, |
727 AF_Dimension dim ) | 727 AF_Dimension dim ) |
728 { | 728 { |
729 AF_AxisHints axis = &hints->axis[dim]; | 729 AF_AxisHints axis = &hints->axis[dim]; |
730 FT_Memory memory = hints->memory; | 730 FT_Memory memory = hints->memory; |
731 FT_Error error = AF_Err_Ok; | 731 FT_Error error = AF_Err_Ok; |
732 AF_Segment segment = NULL; | 732 AF_Segment segment = NULL; |
733 AF_SegmentRec seg0; | 733 AF_SegmentRec seg0; |
734 AF_Point* contour = hints->contours; | 734 AF_Point* contour = hints->contours; |
735 AF_Point* contour_limit = contour + hints->num_contours; | 735 AF_Point* contour_limit = contour + hints->num_contours; |
736 AF_Direction major_dir, segment_dir; | 736 AF_Direction major_dir, segment_dir; |
737 | 737 |
738 | 738 |
739 FT_ZERO( &seg0 ); | 739 FT_ZERO( &seg0 ); |
740 seg0.score = 32000; | 740 seg0.score = 32000; |
741 seg0.flags = AF_EDGE_NORMAL; | 741 seg0.flags = AF_EDGE_NORMAL; |
742 | 742 |
743 major_dir = (AF_Direction)FT_ABS( axis->major_dir ); | 743 major_dir = (AF_Direction)FT_ABS( axis->major_dir ); |
744 segment_dir = major_dir; | 744 segment_dir = major_dir; |
745 | 745 |
746 axis->num_segments = 0; | 746 axis->num_segments = 0; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 | 822 |
823 if ( point->out_dir != segment_dir || point == last ) | 823 if ( point->out_dir != segment_dir || point == last ) |
824 { | 824 { |
825 /* we are just leaving an edge; record a new segment! */ | 825 /* we are just leaving an edge; record a new segment! */ |
826 segment->last = point; | 826 segment->last = point; |
827 segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); | 827 segment->pos = (FT_Short)( ( min_pos + max_pos ) >> 1 ); |
828 | 828 |
829 /* a segment is round if either its first or last point */ | 829 /* a segment is round if either its first or last point */ |
830 /* is a control point */ | 830 /* is a control point */ |
831 if ( ( segment->first->flags | point->flags ) & | 831 if ( ( segment->first->flags | point->flags ) & |
832 AF_FLAG_CONTROL ) | 832 AF_FLAG_CONTROL ) |
833 segment->flags |= AF_EDGE_ROUND; | 833 segment->flags |= AF_EDGE_ROUND; |
834 | 834 |
835 /* compute segment size */ | 835 /* compute segment size */ |
836 min_pos = max_pos = point->v; | 836 min_pos = max_pos = point->v; |
837 | 837 |
838 v = segment->first->v; | 838 v = segment->first->v; |
839 if ( v < min_pos ) | 839 if ( v < min_pos ) |
840 min_pos = v; | 840 min_pos = v; |
841 if ( v > max_pos ) | 841 if ( v > max_pos ) |
842 max_pos = v; | 842 max_pos = v; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 for ( seg1 = segments; seg1 < segment_limit; seg1++ ) | 963 for ( seg1 = segments; seg1 < segment_limit; seg1++ ) |
964 { | 964 { |
965 /* the fake segments are introduced to hint the metrics -- */ | 965 /* the fake segments are introduced to hint the metrics -- */ |
966 /* we must never link them to anything */ | 966 /* we must never link them to anything */ |
967 if ( seg1->dir != axis->major_dir || seg1->first == seg1->last ) | 967 if ( seg1->dir != axis->major_dir || seg1->first == seg1->last ) |
968 continue; | 968 continue; |
969 | 969 |
970 /* search for stems having opposite directions, */ | 970 /* search for stems having opposite directions, */ |
971 /* with seg1 to the `left' of seg2 */ | 971 /* with seg1 to the `left' of seg2 */ |
972 for ( seg2 = segments; seg2 < segment_limit; seg2++ ) | 972 for ( seg2 = segments; seg2 < segment_limit; seg2++ ) |
973 { | 973 { |
974 FT_Pos pos1 = seg1->pos; | 974 FT_Pos pos1 = seg1->pos; |
975 FT_Pos pos2 = seg2->pos; | 975 FT_Pos pos2 = seg2->pos; |
976 | 976 |
977 | 977 |
978 if ( seg1->dir + seg2->dir == 0 && pos2 > pos1 ) | 978 if ( seg1->dir + seg2->dir == 0 && pos2 > pos1 ) |
979 { | 979 { |
980 /* compute distance between the two segments */ | 980 /* compute distance between the two segments */ |
981 FT_Pos dist = pos2 - pos1; | 981 FT_Pos dist = pos2 - pos1; |
982 FT_Pos min = seg1->min_coord; | 982 FT_Pos min = seg1->min_coord; |
983 FT_Pos max = seg1->max_coord; | 983 FT_Pos max = seg1->max_coord; |
984 FT_Pos len, score; | 984 FT_Pos len, score; |
985 | 985 |
986 | 986 |
987 if ( min < seg2->min_coord ) | 987 if ( min < seg2->min_coord ) |
988 min = seg2->min_coord; | 988 min = seg2->min_coord; |
989 | 989 |
990 if ( max > seg2->max_coord ) | 990 if ( max > seg2->max_coord ) |
991 max = seg2->max_coord; | 991 max = seg2->max_coord; |
992 | 992 |
993 /* compute maximum coordinate difference of the two segments */ | 993 /* compute maximum coordinate difference of the two segments */ |
994 len = max - min; | 994 len = max - min; |
995 if ( len >= len_threshold ) | 995 if ( len >= len_threshold ) |
996 { | 996 { |
997 /* small coordinate differences cause a higher score, and */ | 997 /* small coordinate differences cause a higher score, and */ |
998 /* segments with a greater distance cause a higher score also */ | 998 /* segments with a greater distance cause a higher score also */ |
999 score = dist + len_score / len; | 999 score = dist + len_score / len; |
1000 | 1000 |
1001 /* and we search for the smallest score */ | 1001 /* and we search for the smallest score */ |
1002 /* of the sum of the two values */ | 1002 /* of the sum of the two values */ |
1003 if ( score < seg1->score ) | 1003 if ( score < seg1->score ) |
1004 { | 1004 { |
1005 seg1->score = score; | 1005 seg1->score = score; |
1006 seg1->link = seg2; | 1006 seg1->link = seg2; |
1007 } | 1007 } |
1008 | 1008 |
1009 if ( score < seg2->score ) | 1009 if ( score < seg2->score ) |
1010 { | 1010 { |
1011 seg2->score = score; | 1011 seg2->score = score; |
1012 seg2->link = seg1; | 1012 seg2->link = seg1; |
1013 } | |
1014 } | 1013 } |
1015 } | 1014 } |
1016 } | 1015 } |
| 1016 } |
1017 } | 1017 } |
1018 | 1018 |
1019 /* now compute the `serif' segments, cf. explanations in `afhints.h' */ | 1019 /* now compute the `serif' segments, cf. explanations in `afhints.h' */ |
1020 for ( seg1 = segments; seg1 < segment_limit; seg1++ ) | 1020 for ( seg1 = segments; seg1 < segment_limit; seg1++ ) |
1021 { | 1021 { |
1022 seg2 = seg1->link; | 1022 seg2 = seg1->link; |
1023 | 1023 |
1024 if ( seg2 ) | 1024 if ( seg2 ) |
1025 { | 1025 { |
1026 if ( seg2->link != seg1 ) | 1026 if ( seg2->link != seg1 ) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 | 1227 |
1228 /* check for roundness of segment */ | 1228 /* check for roundness of segment */ |
1229 if ( seg->flags & AF_EDGE_ROUND ) | 1229 if ( seg->flags & AF_EDGE_ROUND ) |
1230 is_round++; | 1230 is_round++; |
1231 else | 1231 else |
1232 is_straight++; | 1232 is_straight++; |
1233 | 1233 |
1234 #if 0 | 1234 #if 0 |
1235 /* check for segment direction */ | 1235 /* check for segment direction */ |
1236 if ( seg->dir == up_dir ) | 1236 if ( seg->dir == up_dir ) |
1237 ups += seg->max_coord-seg->min_coord; | 1237 ups += seg->max_coord - seg->min_coord; |
1238 else | 1238 else |
1239 downs += seg->max_coord-seg->min_coord; | 1239 downs += seg->max_coord - seg->min_coord; |
1240 #endif | 1240 #endif |
1241 | 1241 |
1242 /* check for links -- if seg->serif is set, then seg->link must */ | 1242 /* check for links -- if seg->serif is set, then seg->link must */ |
1243 /* be ignored */ | 1243 /* be ignored */ |
1244 is_serif = (FT_Bool)( seg->serif && | 1244 is_serif = (FT_Bool)( seg->serif && |
1245 seg->serif->edge && | 1245 seg->serif->edge && |
1246 seg->serif->edge != edge ); | 1246 seg->serif->edge != edge ); |
1247 | 1247 |
1248 if ( ( seg->link && seg->link->edge != NULL ) || is_serif ) | 1248 if ( ( seg->link && seg->link->edge != NULL ) || is_serif ) |
1249 { | 1249 { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 return error; | 1347 return error; |
1348 } | 1348 } |
1349 | 1349 |
1350 | 1350 |
1351 /* Compute all edges which lie within blue zones. */ | 1351 /* Compute all edges which lie within blue zones. */ |
1352 | 1352 |
1353 FT_LOCAL_DEF( void ) | 1353 FT_LOCAL_DEF( void ) |
1354 af_latin_hints_compute_blue_edges( AF_GlyphHints hints, | 1354 af_latin_hints_compute_blue_edges( AF_GlyphHints hints, |
1355 AF_LatinMetrics metrics ) | 1355 AF_LatinMetrics metrics ) |
1356 { | 1356 { |
1357 AF_AxisHints axis = &hints->axis[ AF_DIMENSION_VERT ]; | 1357 AF_AxisHints axis = &hints->axis[AF_DIMENSION_VERT]; |
1358 AF_Edge edge = axis->edges; | 1358 AF_Edge edge = axis->edges; |
1359 AF_Edge edge_limit = edge + axis->num_edges; | 1359 AF_Edge edge_limit = edge + axis->num_edges; |
1360 AF_LatinAxis latin = &metrics->axis[ AF_DIMENSION_VERT ]; | 1360 AF_LatinAxis latin = &metrics->axis[AF_DIMENSION_VERT]; |
1361 FT_Fixed scale = latin->scale; | 1361 FT_Fixed scale = latin->scale; |
1362 | 1362 |
1363 | 1363 |
1364 /* compute which blue zones are active, i.e. have their scaled */ | 1364 /* compute which blue zones are active, i.e. have their scaled */ |
1365 /* size < 3/4 pixels */ | 1365 /* size < 3/4 pixels */ |
1366 | 1366 |
1367 /* for each horizontal edge search the blue zone which is closest */ | 1367 /* for each horizontal edge search the blue zone which is closest */ |
1368 for ( ; edge < edge_limit; edge++ ) | 1368 for ( ; edge < edge_limit; edge++ ) |
1369 { | 1369 { |
1370 FT_Int bb; | 1370 FT_Int bb; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 | 1407 |
1408 /* first of all, compare it to the reference position */ | 1408 /* first of all, compare it to the reference position */ |
1409 dist = edge->fpos - blue->ref.org; | 1409 dist = edge->fpos - blue->ref.org; |
1410 if ( dist < 0 ) | 1410 if ( dist < 0 ) |
1411 dist = -dist; | 1411 dist = -dist; |
1412 | 1412 |
1413 dist = FT_MulFix( dist, scale ); | 1413 dist = FT_MulFix( dist, scale ); |
1414 if ( dist < best_dist ) | 1414 if ( dist < best_dist ) |
1415 { | 1415 { |
1416 best_dist = dist; | 1416 best_dist = dist; |
1417 best_blue = & blue->ref; | 1417 best_blue = &blue->ref; |
1418 } | 1418 } |
1419 | 1419 |
1420 /* now compare it to the overshoot position and check whether */ | 1420 /* now compare it to the overshoot position and check whether */ |
1421 /* the edge is rounded, and whether the edge is over the */ | 1421 /* the edge is rounded, and whether the edge is over the */ |
1422 /* reference position of a top zone, or under the reference */ | 1422 /* reference position of a top zone, or under the reference */ |
1423 /* position of a bottom zone */ | 1423 /* position of a bottom zone */ |
1424 if ( edge->flags & AF_EDGE_ROUND && dist != 0 ) | 1424 if ( edge->flags & AF_EDGE_ROUND && dist != 0 ) |
1425 { | 1425 { |
1426 FT_Bool is_under_ref = FT_BOOL( edge->fpos < blue->ref.org ); | 1426 FT_Bool is_under_ref = FT_BOOL( edge->fpos < blue->ref.org ); |
1427 | 1427 |
1428 | 1428 |
1429 if ( is_top_blue ^ is_under_ref ) | 1429 if ( is_top_blue ^ is_under_ref ) |
1430 { | 1430 { |
1431 dist = edge->fpos - blue->shoot.org; | 1431 dist = edge->fpos - blue->shoot.org; |
1432 if ( dist < 0 ) | 1432 if ( dist < 0 ) |
1433 dist = -dist; | 1433 dist = -dist; |
1434 | 1434 |
1435 dist = FT_MulFix( dist, scale ); | 1435 dist = FT_MulFix( dist, scale ); |
1436 if ( dist < best_dist ) | 1436 if ( dist < best_dist ) |
1437 { | 1437 { |
1438 best_dist = dist; | 1438 best_dist = dist; |
1439 best_blue = & blue->shoot; | 1439 best_blue = &blue->shoot; |
1440 } | 1440 } |
1441 } | 1441 } |
1442 } | 1442 } |
1443 } | 1443 } |
1444 } | 1444 } |
1445 | 1445 |
1446 if ( best_blue ) | 1446 if ( best_blue ) |
1447 edge->blue_edge = best_blue; | 1447 edge->blue_edge = best_blue; |
1448 } | 1448 } |
1449 } | 1449 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 if ( mode != FT_RENDER_MODE_LIGHT ) | 1504 if ( mode != FT_RENDER_MODE_LIGHT ) |
1505 other_flags |= AF_LATIN_HINTS_STEM_ADJUST; | 1505 other_flags |= AF_LATIN_HINTS_STEM_ADJUST; |
1506 | 1506 |
1507 if ( mode == FT_RENDER_MODE_MONO ) | 1507 if ( mode == FT_RENDER_MODE_MONO ) |
1508 other_flags |= AF_LATIN_HINTS_MONO; | 1508 other_flags |= AF_LATIN_HINTS_MONO; |
1509 | 1509 |
1510 /* | 1510 /* |
1511 * In `light' hinting mode we disable horizontal hinting completely. | 1511 * In `light' hinting mode we disable horizontal hinting completely. |
1512 * We also do it if the face is italic. | 1512 * We also do it if the face is italic. |
1513 */ | 1513 */ |
1514 if ( mode == FT_RENDER_MODE_LIGHT || | 1514 if ( mode == FT_RENDER_MODE_LIGHT || |
1515 (face->style_flags & FT_STYLE_FLAG_ITALIC) != 0 ) | 1515 ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) |
1516 scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; | 1516 scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; |
1517 | 1517 |
1518 hints->scaler_flags = scaler_flags; | 1518 hints->scaler_flags = scaler_flags; |
1519 hints->other_flags = other_flags; | 1519 hints->other_flags = other_flags; |
1520 | 1520 |
1521 return AF_Err_Ok; | 1521 return AF_Err_Ok; |
1522 } | 1522 } |
1523 | 1523 |
1524 | 1524 |
1525 /*************************************************************************/ | 1525 /*************************************************************************/ |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1590 AF_Edge_Flags stem_flags ) | 1590 AF_Edge_Flags stem_flags ) |
1591 { | 1591 { |
1592 AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics; | 1592 AF_LatinMetrics metrics = (AF_LatinMetrics) hints->metrics; |
1593 AF_LatinAxis axis = & metrics->axis[dim]; | 1593 AF_LatinAxis axis = & metrics->axis[dim]; |
1594 FT_Pos dist = width; | 1594 FT_Pos dist = width; |
1595 FT_Int sign = 0; | 1595 FT_Int sign = 0; |
1596 FT_Int vertical = ( dim == AF_DIMENSION_VERT ); | 1596 FT_Int vertical = ( dim == AF_DIMENSION_VERT ); |
1597 | 1597 |
1598 | 1598 |
1599 if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || | 1599 if ( !AF_LATIN_HINTS_DO_STEM_ADJUST( hints ) || |
1600 axis->extra_light ) | 1600 axis->extra_light ) |
1601 return width; | 1601 return width; |
1602 | 1602 |
1603 if ( dist < 0 ) | 1603 if ( dist < 0 ) |
1604 { | 1604 { |
1605 dist = -width; | 1605 dist = -width; |
1606 sign = 1; | 1606 sign = 1; |
1607 } | 1607 } |
1608 | 1608 |
1609 if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || | 1609 if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) || |
1610 ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) | 1610 ( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) ) |
(...skipping 13 matching lines...) Expand all Loading... |
1624 } | 1624 } |
1625 else if ( dist < 56 ) | 1625 else if ( dist < 56 ) |
1626 dist = 56; | 1626 dist = 56; |
1627 | 1627 |
1628 if ( axis->width_count > 0 ) | 1628 if ( axis->width_count > 0 ) |
1629 { | 1629 { |
1630 FT_Pos delta; | 1630 FT_Pos delta; |
1631 | 1631 |
1632 | 1632 |
1633 /* compare to standard width */ | 1633 /* compare to standard width */ |
1634 delta = dist - axis->widths[0].cur; | 1634 delta = dist - axis->widths[0].cur; |
1635 | 1635 |
1636 if ( delta < 0 ) | 1636 if ( delta < 0 ) |
1637 delta = -delta; | 1637 delta = -delta; |
1638 | 1638 |
1639 if ( delta < 40 ) | 1639 if ( delta < 40 ) |
1640 { | 1640 { |
1641 dist = axis->widths[0].cur; | 1641 dist = axis->widths[0].cur; |
1642 if ( dist < 48 ) | 1642 if ( dist < 48 ) |
1643 dist = 48; | 1643 dist = 48; |
1644 | 1644 |
1645 goto Done_Width; | 1645 goto Done_Width; |
1646 } | 1646 } |
1647 | 1647 |
1648 if ( dist < 3 * 64 ) | 1648 if ( dist < 3 * 64 ) |
1649 { | 1649 { |
1650 delta = dist & 63; | 1650 delta = dist & 63; |
1651 dist &= -64; | 1651 dist &= -64; |
1652 | 1652 |
1653 if ( delta < 10 ) | 1653 if ( delta < 10 ) |
1654 dist += delta; | 1654 dist += delta; |
1655 | 1655 |
1656 else if ( delta < 32 ) | 1656 else if ( delta < 32 ) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 | 1756 |
1757 FT_Pos fitted_width = af_latin_compute_stem_width( | 1757 FT_Pos fitted_width = af_latin_compute_stem_width( |
1758 hints, dim, dist, | 1758 hints, dim, dist, |
1759 (AF_Edge_Flags)base_edge->flags, | 1759 (AF_Edge_Flags)base_edge->flags, |
1760 (AF_Edge_Flags)stem_edge->flags ); | 1760 (AF_Edge_Flags)stem_edge->flags ); |
1761 | 1761 |
1762 | 1762 |
1763 stem_edge->pos = base_edge->pos + fitted_width; | 1763 stem_edge->pos = base_edge->pos + fitted_width; |
1764 | 1764 |
1765 FT_TRACE5(( " LINK: edge %d (opos=%.2f) linked to (%.2f)," | 1765 FT_TRACE5(( " LINK: edge %d (opos=%.2f) linked to (%.2f)," |
1766 "dist was %.2f, now %.2f\n", | 1766 " dist was %.2f, now %.2f\n", |
1767 stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0, | 1767 stem_edge-hints->axis[dim].edges, stem_edge->opos / 64.0, |
1768 stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 )); | 1768 stem_edge->pos / 64.0, dist / 64.0, fitted_width / 64.0 )); |
1769 } | 1769 } |
1770 | 1770 |
1771 | 1771 |
1772 /* Shift the coordinates of the `serif' edge by the same amount */ | 1772 /* Shift the coordinates of the `serif' edge by the same amount */ |
1773 /* as the corresponding `base' edge has been moved already. */ | 1773 /* as the corresponding `base' edge has been moved already. */ |
1774 | 1774 |
1775 static void | 1775 static void |
1776 af_latin_align_serif_edge( AF_GlyphHints hints, | 1776 af_latin_align_serif_edge( AF_GlyphHints hints, |
1777 AF_Edge base, | 1777 AF_Edge base, |
1778 AF_Edge serif ) | 1778 AF_Edge serif ) |
1779 { | 1779 { |
1780 FT_UNUSED( hints ); | 1780 FT_UNUSED( hints ); |
1781 | 1781 |
1782 serif->pos = base->pos + (serif->opos - base->opos); | 1782 serif->pos = base->pos + ( serif->opos - base->opos ); |
1783 } | 1783 } |
1784 | 1784 |
1785 | 1785 |
1786 /*************************************************************************/ | 1786 /*************************************************************************/ |
1787 /*************************************************************************/ | 1787 /*************************************************************************/ |
1788 /*************************************************************************/ | 1788 /*************************************************************************/ |
1789 /**** ****/ | 1789 /**** ****/ |
1790 /**** E D G E H I N T I N G ****/ | 1790 /**** E D G E H I N T I N G ****/ |
1791 /**** ****/ | 1791 /**** ****/ |
1792 /*************************************************************************/ | 1792 /*************************************************************************/ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 { | 1838 { |
1839 blue = edge2->blue_edge; | 1839 blue = edge2->blue_edge; |
1840 edge1 = edge2; | 1840 edge1 = edge2; |
1841 edge2 = edge; | 1841 edge2 = edge; |
1842 } | 1842 } |
1843 | 1843 |
1844 if ( !edge1 ) | 1844 if ( !edge1 ) |
1845 continue; | 1845 continue; |
1846 | 1846 |
1847 FT_TRACE5(( " BLUE: edge %d (opos=%.2f) snapped to (%.2f)," | 1847 FT_TRACE5(( " BLUE: edge %d (opos=%.2f) snapped to (%.2f)," |
1848 "was (%.2f)\n", | 1848 " was (%.2f)\n", |
1849 edge1-edges, edge1->opos / 64.0, blue->fit / 64.0, | 1849 edge1 - edges, edge1->opos / 64.0, blue->fit / 64.0, |
1850 edge1->pos / 64.0 )); | 1850 edge1->pos / 64.0 )); |
1851 | 1851 |
1852 edge1->pos = blue->fit; | 1852 edge1->pos = blue->fit; |
1853 edge1->flags |= AF_EDGE_DONE; | 1853 edge1->flags |= AF_EDGE_DONE; |
1854 | 1854 |
1855 if ( edge2 && !edge2->blue_edge ) | 1855 if ( edge2 && !edge2->blue_edge ) |
1856 { | 1856 { |
1857 af_latin_align_linked_edge( hints, dim, edge1, edge2 ); | 1857 af_latin_align_linked_edge( hints, dim, edge1, edge2 ); |
1858 edge2->flags |= AF_EDGE_DONE; | 1858 edge2->flags |= AF_EDGE_DONE; |
1859 } | 1859 } |
1860 | 1860 |
1861 if ( !anchor ) | 1861 if ( !anchor ) |
1862 anchor = edge; | 1862 anchor = edge; |
1863 } | 1863 } |
1864 } | 1864 } |
1865 | 1865 |
1866 /* now we align all other stem edges, trying to maintain the */ | 1866 /* now we align all other stem edges, trying to maintain the */ |
1867 /* relative order of stems in the glyph */ | 1867 /* relative order of stems in the glyph */ |
1868 for ( edge = edges; edge < edge_limit; edge++ ) | 1868 for ( edge = edges; edge < edge_limit; edge++ ) |
1869 { | 1869 { |
1870 AF_Edge edge2; | 1870 AF_Edge edge2; |
1871 | 1871 |
1872 | 1872 |
1873 if ( edge->flags & AF_EDGE_DONE ) | 1873 if ( edge->flags & AF_EDGE_DONE ) |
1874 continue; | 1874 continue; |
1875 | 1875 |
1876 /* skip all non-stem edges */ | 1876 /* skip all non-stem edges */ |
1877 edge2 = edge->link; | 1877 edge2 = edge->link; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1941 else | 1941 else |
1942 cur_pos1 += d_off; | 1942 cur_pos1 += d_off; |
1943 | 1943 |
1944 edge->pos = cur_pos1 - cur_len / 2; | 1944 edge->pos = cur_pos1 - cur_len / 2; |
1945 edge2->pos = edge->pos + cur_len; | 1945 edge2->pos = edge->pos + cur_len; |
1946 } | 1946 } |
1947 else | 1947 else |
1948 edge->pos = FT_PIX_ROUND( edge->opos ); | 1948 edge->pos = FT_PIX_ROUND( edge->opos ); |
1949 | 1949 |
1950 FT_TRACE5(( " ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)" | 1950 FT_TRACE5(( " ANCHOR: edge %d (opos=%.2f) and %d (opos=%.2f)" |
1951 "snapped to (%.2f) (%.2f)\n", | 1951 " snapped to (%.2f) (%.2f)\n", |
1952 edge-edges, edge->opos / 64.0, | 1952 edge - edges, edge->opos / 64.0, |
1953 edge2-edges, edge2->opos / 64.0, | 1953 edge2 - edges, edge2->opos / 64.0, |
1954 edge->pos / 64.0, edge2->pos / 64.0 )); | 1954 edge->pos / 64.0, edge2->pos / 64.0 )); |
1955 anchor = edge; | 1955 anchor = edge; |
1956 | 1956 |
1957 edge->flags |= AF_EDGE_DONE; | 1957 edge->flags |= AF_EDGE_DONE; |
1958 | 1958 |
1959 af_latin_align_linked_edge( hints, dim, edge, edge2 ); | 1959 af_latin_align_linked_edge( hints, dim, edge, edge2 ); |
1960 } | 1960 } |
1961 else | 1961 else |
1962 { | 1962 { |
1963 FT_Pos org_pos, org_len, org_center, cur_len; | 1963 FT_Pos org_pos, org_len, org_center, cur_len; |
1964 FT_Pos cur_pos1, cur_pos2, delta1, delta2; | 1964 FT_Pos cur_pos1, cur_pos2, delta1, delta2; |
1965 | 1965 |
1966 | 1966 |
1967 org_pos = anchor->pos + ( edge->opos - anchor->opos ); | 1967 org_pos = anchor->pos + ( edge->opos - anchor->opos ); |
1968 org_len = edge2->opos - edge->opos; | 1968 org_len = edge2->opos - edge->opos; |
1969 org_center = org_pos + ( org_len >> 1 ); | 1969 org_center = org_pos + ( org_len >> 1 ); |
1970 | 1970 |
1971 cur_len = af_latin_compute_stem_width( | 1971 cur_len = af_latin_compute_stem_width( |
1972 hints, dim, org_len, | 1972 hints, dim, org_len, |
1973 (AF_Edge_Flags)edge->flags, | 1973 (AF_Edge_Flags)edge->flags, |
1974 (AF_Edge_Flags)edge2->flags ); | 1974 (AF_Edge_Flags)edge2->flags ); |
1975 | 1975 |
1976 if ( edge2->flags & AF_EDGE_DONE ) | 1976 if ( edge2->flags & AF_EDGE_DONE ) |
1977 { | 1977 { |
1978 FT_TRACE5(( " ADJUST: edge %d (pos=%.2f) moved to %.2f\n", | 1978 FT_TRACE5(( " ADJUST: edge %d (pos=%.2f) moved to %.2f\n", |
1979 edge - edges, edge->pos / 64.0, | 1979 edge - edges, edge->pos / 64.0, |
1980 ( edge2->pos - cur_len ) / 64.0 )); | 1980 ( edge2->pos - cur_len ) / 64.0 )); |
1981 | 1981 |
1982 edge->pos = edge2->pos - cur_len; | 1982 edge->pos = edge2->pos - cur_len; |
1983 } | 1983 } |
1984 | 1984 |
(...skipping 25 matching lines...) Expand all Loading... |
2010 | 2010 |
2011 if ( delta1 < delta2 ) | 2011 if ( delta1 < delta2 ) |
2012 cur_pos1 -= u_off; | 2012 cur_pos1 -= u_off; |
2013 else | 2013 else |
2014 cur_pos1 += d_off; | 2014 cur_pos1 += d_off; |
2015 | 2015 |
2016 edge->pos = cur_pos1 - cur_len / 2; | 2016 edge->pos = cur_pos1 - cur_len / 2; |
2017 edge2->pos = cur_pos1 + cur_len / 2; | 2017 edge2->pos = cur_pos1 + cur_len / 2; |
2018 | 2018 |
2019 FT_TRACE5(( " STEM: %d (opos=%.2f) to %d (opos=%.2f)" | 2019 FT_TRACE5(( " STEM: %d (opos=%.2f) to %d (opos=%.2f)" |
2020 "snapped to (%.2f) and (%.2f)\n", | 2020 " snapped to (%.2f) and (%.2f)\n", |
2021 edge-edges, edge->opos / 64.0, | 2021 edge - edges, edge->opos / 64.0, |
2022 edge2-edges, edge2->opos / 64.0, | 2022 edge2 - edges, edge2->opos / 64.0, |
2023 edge->pos / 64.0, edge2->pos / 64.0 )); | 2023 edge->pos / 64.0, edge2->pos / 64.0 )); |
2024 } | 2024 } |
2025 else | 2025 else |
2026 { | 2026 { |
2027 org_pos = anchor->pos + ( edge->opos - anchor->opos ); | 2027 org_pos = anchor->pos + ( edge->opos - anchor->opos ); |
2028 org_len = edge2->opos - edge->opos; | 2028 org_len = edge2->opos - edge->opos; |
2029 org_center = org_pos + ( org_len >> 1 ); | 2029 org_center = org_pos + ( org_len >> 1 ); |
2030 | 2030 |
2031 cur_len = af_latin_compute_stem_width( | 2031 cur_len = af_latin_compute_stem_width( |
2032 hints, dim, org_len, | 2032 hints, dim, org_len, |
2033 (AF_Edge_Flags)edge->flags, | 2033 (AF_Edge_Flags)edge->flags, |
2034 (AF_Edge_Flags)edge2->flags ); | 2034 (AF_Edge_Flags)edge2->flags ); |
2035 | 2035 |
2036 cur_pos1 = FT_PIX_ROUND( org_pos ); | 2036 cur_pos1 = FT_PIX_ROUND( org_pos ); |
2037 delta1 = cur_pos1 + ( cur_len >> 1 ) - org_center; | 2037 delta1 = cur_pos1 + ( cur_len >> 1 ) - org_center; |
2038 if ( delta1 < 0 ) | 2038 if ( delta1 < 0 ) |
2039 delta1 = -delta1; | 2039 delta1 = -delta1; |
2040 | 2040 |
2041 cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len; | 2041 cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len; |
2042 delta2 = cur_pos2 + ( cur_len >> 1 ) - org_center; | 2042 delta2 = cur_pos2 + ( cur_len >> 1 ) - org_center; |
2043 if ( delta2 < 0 ) | 2043 if ( delta2 < 0 ) |
2044 delta2 = -delta2; | 2044 delta2 = -delta2; |
2045 | 2045 |
2046 edge->pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2; | 2046 edge->pos = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2; |
2047 edge2->pos = edge->pos + cur_len; | 2047 edge2->pos = edge->pos + cur_len; |
2048 | 2048 |
2049 FT_TRACE5(( " STEM: %d (opos=%.2f) to %d (opos=%.2f)" | 2049 FT_TRACE5(( " STEM: %d (opos=%.2f) to %d (opos=%.2f)" |
2050 "snapped to (%.2f) and (%.2f)\n", | 2050 " snapped to (%.2f) and (%.2f)\n", |
2051 edge-edges, edge->opos / 64.0, | 2051 edge - edges, edge->opos / 64.0, |
2052 edge2-edges, edge2->opos / 64.0, | 2052 edge2 - edges, edge2->opos / 64.0, |
2053 edge->pos / 64.0, edge2->pos / 64.0 )); | 2053 edge->pos / 64.0, edge2->pos / 64.0 )); |
2054 } | 2054 } |
2055 | 2055 |
2056 edge->flags |= AF_EDGE_DONE; | 2056 edge->flags |= AF_EDGE_DONE; |
2057 edge2->flags |= AF_EDGE_DONE; | 2057 edge2->flags |= AF_EDGE_DONE; |
2058 | 2058 |
2059 if ( edge > edges && edge->pos < edge[-1].pos ) | 2059 if ( edge > edges && edge->pos < edge[-1].pos ) |
2060 { | 2060 { |
2061 FT_TRACE5(( " BOUND: %d (pos=%.2f) to (%.2f)\n", | 2061 FT_TRACE5(( " BOUND: %d (pos=%.2f) to (%.2f)\n", |
2062 edge-edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); | 2062 edge - edges, edge->pos / 64.0, edge[-1].pos / 64.0 )); |
2063 edge->pos = edge[-1].pos; | 2063 edge->pos = edge[-1].pos; |
2064 } | 2064 } |
2065 } | 2065 } |
2066 } | 2066 } |
2067 | 2067 |
2068 /* make sure that lowercase m's maintain their symmetry */ | 2068 /* make sure that lowercase m's maintain their symmetry */ |
2069 | 2069 |
2070 /* In general, lowercase m's have six vertical edges if they are sans */ | 2070 /* In general, lowercase m's have six vertical edges if they are sans */ |
2071 /* serif, or twelve if they are with serifs. This implementation is */ | 2071 /* serif, or twelve if they are with serifs. This implementation is */ |
2072 /* based on that assumption, and seems to work very well with most */ | 2072 /* based on that assumption, and seems to work very well with most */ |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2147 { | 2147 { |
2148 delta = edge->serif->opos - edge->opos; | 2148 delta = edge->serif->opos - edge->opos; |
2149 if ( delta < 0 ) | 2149 if ( delta < 0 ) |
2150 delta = -delta; | 2150 delta = -delta; |
2151 } | 2151 } |
2152 | 2152 |
2153 if ( delta < 64 + 16 ) | 2153 if ( delta < 64 + 16 ) |
2154 { | 2154 { |
2155 af_latin_align_serif_edge( hints, edge->serif, edge ); | 2155 af_latin_align_serif_edge( hints, edge->serif, edge ); |
2156 FT_TRACE5(( " SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)" | 2156 FT_TRACE5(( " SERIF: edge %d (opos=%.2f) serif to %d (opos=%.2f)" |
2157 "aligned to (%.2f)\n", | 2157 " aligned to (%.2f)\n", |
2158 edge-edges, edge->opos / 64.0, | 2158 edge - edges, edge->opos / 64.0, |
2159 edge->serif - edges, edge->serif->opos / 64.0, | 2159 edge->serif - edges, edge->serif->opos / 64.0, |
2160 edge->pos / 64.0 )); | 2160 edge->pos / 64.0 )); |
2161 } | 2161 } |
2162 else if ( !anchor ) | 2162 else if ( !anchor ) |
2163 { | 2163 { |
2164 edge->pos = FT_PIX_ROUND( edge->opos ); | 2164 edge->pos = FT_PIX_ROUND( edge->opos ); |
2165 anchor = edge; | 2165 anchor = edge; |
2166 FT_TRACE5(( " SERIF_ANCHOR: edge %d (opos=%.2f)" | 2166 FT_TRACE5(( " SERIF_ANCHOR: edge %d (opos=%.2f)" |
2167 " snapped to (%.2f)\n", | 2167 " snapped to (%.2f)\n", |
2168 edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); | 2168 edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); |
2169 } | 2169 } |
2170 else | 2170 else |
(...skipping 14 matching lines...) Expand all Loading... |
2185 { | 2185 { |
2186 if ( after->opos == before->opos ) | 2186 if ( after->opos == before->opos ) |
2187 edge->pos = before->pos; | 2187 edge->pos = before->pos; |
2188 else | 2188 else |
2189 edge->pos = before->pos + | 2189 edge->pos = before->pos + |
2190 FT_MulDiv( edge->opos - before->opos, | 2190 FT_MulDiv( edge->opos - before->opos, |
2191 after->pos - before->pos, | 2191 after->pos - before->pos, |
2192 after->opos - before->opos ); | 2192 after->opos - before->opos ); |
2193 | 2193 |
2194 FT_TRACE5(( " SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f)" | 2194 FT_TRACE5(( " SERIF_LINK1: edge %d (opos=%.2f) snapped to (%.2f)" |
2195 "from %d (opos=%.2f)\n", | 2195 " from %d (opos=%.2f)\n", |
2196 edge-edges, edge->opos / 64.0, | 2196 edge - edges, edge->opos / 64.0, |
2197 edge->pos / 64.0, | 2197 edge->pos / 64.0, |
2198 before - edges, before->opos / 64.0 )); | 2198 before - edges, before->opos / 64.0 )); |
2199 } | 2199 } |
2200 else | 2200 else |
2201 { | 2201 { |
2202 edge->pos = anchor->pos + | 2202 edge->pos = anchor->pos + |
2203 ( ( edge->opos - anchor->opos + 16 ) & ~31 ); | 2203 ( ( edge->opos - anchor->opos + 16 ) & ~31 ); |
2204 | 2204 |
2205 FT_TRACE5(( " SERIF_LINK2: edge %d (opos=%.2f)" | 2205 FT_TRACE5(( " SERIF_LINK2: edge %d (opos=%.2f)" |
2206 " snapped to (%.2f)\n", | 2206 " snapped to (%.2f)\n", |
2207 edge-edges, edge->opos / 64.0, edge->pos / 64.0 )); | 2207 edge - edges, edge->opos / 64.0, edge->pos / 64.0 )); |
2208 } | 2208 } |
2209 } | 2209 } |
2210 | 2210 |
2211 edge->flags |= AF_EDGE_DONE; | 2211 edge->flags |= AF_EDGE_DONE; |
2212 | 2212 |
2213 if ( edge > edges && edge->pos < edge[-1].pos ) | 2213 if ( edge > edges && edge->pos < edge[-1].pos ) |
2214 edge->pos = edge[-1].pos; | 2214 edge->pos = edge[-1].pos; |
2215 | 2215 |
2216 if ( edge + 1 < edge_limit && | 2216 if ( edge + 1 < edge_limit && |
2217 edge[1].flags & AF_EDGE_DONE && | 2217 edge[1].flags & AF_EDGE_DONE && |
(...skipping 17 matching lines...) Expand all Loading... |
2235 int dim; | 2235 int dim; |
2236 | 2236 |
2237 | 2237 |
2238 error = af_glyph_hints_reload( hints, outline ); | 2238 error = af_glyph_hints_reload( hints, outline ); |
2239 if ( error ) | 2239 if ( error ) |
2240 goto Exit; | 2240 goto Exit; |
2241 | 2241 |
2242 /* analyze glyph outline */ | 2242 /* analyze glyph outline */ |
2243 #ifdef AF_CONFIG_OPTION_USE_WARPER | 2243 #ifdef AF_CONFIG_OPTION_USE_WARPER |
2244 if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT || | 2244 if ( metrics->root.scaler.render_mode == FT_RENDER_MODE_LIGHT || |
2245 AF_HINTS_DO_HORIZONTAL( hints ) ) | 2245 AF_HINTS_DO_HORIZONTAL( hints ) ) |
2246 #else | 2246 #else |
2247 if ( AF_HINTS_DO_HORIZONTAL( hints ) ) | 2247 if ( AF_HINTS_DO_HORIZONTAL( hints ) ) |
2248 #endif | 2248 #endif |
2249 { | 2249 { |
2250 error = af_latin_hints_detect_features( hints, AF_DIMENSION_HORZ ); | 2250 error = af_latin_hints_detect_features( hints, AF_DIMENSION_HORZ ); |
2251 if ( error ) | 2251 if ( error ) |
2252 goto Exit; | 2252 goto Exit; |
2253 } | 2253 } |
2254 | 2254 |
2255 if ( AF_HINTS_DO_VERTICAL( hints ) ) | 2255 if ( AF_HINTS_DO_VERTICAL( hints ) ) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2334 AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ | 2334 AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */ |
2335 AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), /* Cyrillic Extended-A */ | 2335 AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), /* Cyrillic Extended-A */ |
2336 AF_UNIRANGE_REC( 0xA640UL, 0xA69FUL ), /* Cyrillic Extended-B */ | 2336 AF_UNIRANGE_REC( 0xA640UL, 0xA69FUL ), /* Cyrillic Extended-B */ |
2337 AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ | 2337 AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */ |
2338 AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin L
igs) */ | 2338 AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin L
igs) */ |
2339 AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbo
ls */ | 2339 AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbo
ls */ |
2340 AF_UNIRANGE_REC( 0UL, 0UL ) | 2340 AF_UNIRANGE_REC( 0UL, 0UL ) |
2341 }; | 2341 }; |
2342 | 2342 |
2343 | 2343 |
2344 AF_DEFINE_SCRIPT_CLASS(af_latin_script_class, | 2344 AF_DEFINE_SCRIPT_CLASS( af_latin_script_class, |
2345 AF_SCRIPT_LATIN, | 2345 AF_SCRIPT_LATIN, |
2346 af_latin_uniranges, | 2346 af_latin_uniranges, |
2347 | 2347 |
2348 sizeof( AF_LatinMetricsRec ), | 2348 sizeof ( AF_LatinMetricsRec ), |
2349 | 2349 |
2350 (AF_Script_InitMetricsFunc) af_latin_metrics_init, | 2350 (AF_Script_InitMetricsFunc) af_latin_metrics_init, |
2351 (AF_Script_ScaleMetricsFunc)af_latin_metrics_scale, | 2351 (AF_Script_ScaleMetricsFunc)af_latin_metrics_scale, |
2352 (AF_Script_DoneMetricsFunc) NULL, | 2352 (AF_Script_DoneMetricsFunc) NULL, |
2353 | 2353 |
2354 (AF_Script_InitHintsFunc) af_latin_hints_init, | 2354 (AF_Script_InitHintsFunc) af_latin_hints_init, |
2355 (AF_Script_ApplyHintsFunc) af_latin_hints_apply | 2355 (AF_Script_ApplyHintsFunc) af_latin_hints_apply |
2356 ) | 2356 ) |
2357 | 2357 |
2358 | 2358 |
2359 /* END */ | 2359 /* END */ |
OLD | NEW |