OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* pshalgo.c */ | 3 /* pshalgo.c */ |
4 /* */ | 4 /* */ |
5 /* PostScript hinting algorithm (body). */ | 5 /* PostScript hinting algorithm (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2001-2010, 2012, 2013 by */ | 7 /* Copyright 2001-2010, 2012-2014 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 */ |
11 /* modified and distributed under the terms of the FreeType project */ | 11 /* modified and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
18 | 18 |
19 #include "../../include/ft2build.h" | 19 #include <ft2build.h> |
20 #include "../../include/freetype/internal/ftobjs.h" | 20 #include FT_INTERNAL_OBJECTS_H |
21 #include "../../include/freetype/internal/ftdebug.h" | 21 #include FT_INTERNAL_DEBUG_H |
22 #include "../../include/freetype/internal/ftcalc.h" | 22 #include FT_INTERNAL_CALC_H |
23 #include "pshalgo.h" | 23 #include "pshalgo.h" |
24 | 24 |
25 #include "pshnterr.h" | 25 #include "pshnterr.h" |
26 | 26 |
27 | 27 |
28 #undef FT_COMPONENT | 28 #undef FT_COMPONENT |
29 #define FT_COMPONENT trace_pshalgo2 | 29 #define FT_COMPONENT trace_pshalgo2 |
30 | 30 |
31 | 31 |
32 #ifdef DEBUG_HINTER | 32 #ifdef DEBUG_HINTER |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 /*************************************************************************/ | 891 /*************************************************************************/ |
892 | 892 |
893 #define PSH_ZONE_MIN -3200000L | 893 #define PSH_ZONE_MIN -3200000L |
894 #define PSH_ZONE_MAX +3200000L | 894 #define PSH_ZONE_MAX +3200000L |
895 | 895 |
896 #define xxDEBUG_ZONES | 896 #define xxDEBUG_ZONES |
897 | 897 |
898 | 898 |
899 #ifdef DEBUG_ZONES | 899 #ifdef DEBUG_ZONES |
900 | 900 |
901 #include "../../include/freetype/config/ftstdlib.h" | 901 #include FT_CONFIG_STANDARD_LIBRARY_H |
902 | 902 |
903 static void | 903 static void |
904 psh_print_zone( PSH_Zone zone ) | 904 psh_print_zone( PSH_Zone zone ) |
905 { | 905 { |
906 printf( "zone [scale,delta,min,max] = [%.3f,%.3f,%d,%d]\n", | 906 printf( "zone [scale,delta,min,max] = [%.3f,%.3f,%d,%d]\n", |
907 zone->scale / 65536.0, | 907 zone->scale / 65536.0, |
908 zone->delta / 64.0, | 908 zone->delta / 64.0, |
909 zone->min, | 909 zone->min, |
910 zone->max ); | 910 zone->max ); |
911 } | 911 } |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 { | 1399 { |
1400 PSH_Point first = glyph->contours[n].start; | 1400 PSH_Point first = glyph->contours[n].start; |
1401 PSH_Point point, before, after; | 1401 PSH_Point point, before, after; |
1402 | 1402 |
1403 | 1403 |
1404 if ( glyph->contours[n].count == 0 ) | 1404 if ( glyph->contours[n].count == 0 ) |
1405 continue; | 1405 continue; |
1406 | 1406 |
1407 point = first; | 1407 point = first; |
1408 before = point; | 1408 before = point; |
1409 after = point; | |
1410 | 1409 |
1411 do | 1410 do |
1412 { | 1411 { |
1413 before = before->prev; | 1412 before = before->prev; |
1414 if ( before == first ) | 1413 if ( before == first ) |
1415 goto Skip; | 1414 goto Skip; |
1416 | 1415 |
1417 } while ( before->org_u == point->org_u ); | 1416 } while ( before->org_u == point->org_u ); |
1418 | 1417 |
1419 first = point = before->next; | 1418 first = point = before->next; |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 point->cur_u = FT_MulFix( point->org_u, scale ) + delta; | 2071 point->cur_u = FT_MulFix( point->org_u, scale ) + delta; |
2073 | 2072 |
2074 goto Next_Contour; | 2073 goto Next_Contour; |
2075 } | 2074 } |
2076 | 2075 |
2077 /* there are more than 2 strong points in this contour; we */ | 2076 /* there are more than 2 strong points in this contour; we */ |
2078 /* need to interpolate weak points between them */ | 2077 /* need to interpolate weak points between them */ |
2079 start = first; | 2078 start = first; |
2080 do | 2079 do |
2081 { | 2080 { |
2082 point = first; | |
2083 | |
2084 /* skip consecutive fitted points */ | 2081 /* skip consecutive fitted points */ |
2085 for (;;) | 2082 for (;;) |
2086 { | 2083 { |
2087 next = first->next; | 2084 next = first->next; |
2088 if ( next == start ) | 2085 if ( next == start ) |
2089 goto Next_Contour; | 2086 goto Next_Contour; |
2090 | 2087 |
2091 if ( !psh_point_is_fitted( next ) ) | 2088 if ( !psh_point_is_fitted( next ) ) |
2092 break; | 2089 break; |
2093 | 2090 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2296 | 2293 |
2297 #ifndef DEBUG_HINTER | 2294 #ifndef DEBUG_HINTER |
2298 psh_glyph_done( glyph ); | 2295 psh_glyph_done( glyph ); |
2299 #endif | 2296 #endif |
2300 | 2297 |
2301 return error; | 2298 return error; |
2302 } | 2299 } |
2303 | 2300 |
2304 | 2301 |
2305 /* END */ | 2302 /* END */ |
OLD | NEW |