From c5e566590d4e26ea18cab24d14223cb9c5f3b70b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 21 Sep 2002 08:33:27 +0000 Subject: [PATCH] More 16bit fixes. * src/autohint/ahglobal.c (sort_values): Use FT_Pos for `swap'. (ah_hinter_compute_widths): Use FT_Pos for `dist'. Use AH_MAX_WIDTHS. * src/autohint/ahglyph.c (ah_outline_scale_blue_edges): Use FT_Pos for `delta'. (ah_outline_compute_edges): Replace some ints with FT_Int and FT_Pos. (ah_test_extrema): Clean up code. (ah_get_orientation): Use 4 FT_Int variables instead of FT_BBox to hold indices. * src/autohint/ahtypes.h (AH_SegmentRec): Change type of `score' to FT_Pos. --- ChangeLog | 17 ++++++++++++++ src/autohint/ahglobal.c | 7 +++--- src/autohint/ahglyph.c | 50 +++++++++++++++++++++-------------------- src/autohint/ahtypes.h | 2 +- 4 files changed, 48 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 518400712..1faa04e9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2002-09-19 Wolfgang Domröse + + More 16bit fixes. + + * src/autohint/ahglobal.c (sort_values): Use FT_Pos for `swap'. + (ah_hinter_compute_widths): Use FT_Pos for `dist'. + Use AH_MAX_WIDTHS. + * src/autohint/ahglyph.c (ah_outline_scale_blue_edges): Use FT_Pos + for `delta'. + (ah_outline_compute_edges): Replace some ints with FT_Int and + FT_Pos. + (ah_test_extrema): Clean up code. + (ah_get_orientation): Use 4 FT_Int variables instead of FT_BBox to + hold indices. + * src/autohint/ahtypes.h (AH_SegmentRec): Change type of `score' + to FT_Pos. + 2002-09-19 Werner Lemberg * builds/unix/config.guess, builds/unix/config.sub: Updated to diff --git a/src/autohint/ahglobal.c b/src/autohint/ahglobal.c index f2b679970..2ce8ac35c 100644 --- a/src/autohint/ahglobal.c +++ b/src/autohint/ahglobal.c @@ -43,7 +43,8 @@ sort_values( FT_Int count, FT_Pos* table ) { - FT_Int i, j, swap; + FT_Int i, j; + FT_Pos swap; for ( i = 1; i < count; i++ ) @@ -345,14 +346,14 @@ /* we only consider stem segments there! */ if ( link && link->link == seg && link > seg ) { - FT_Int dist; + FT_Pos dist; dist = seg->pos - link->pos; if ( dist < 0 ) dist = -dist; - if ( num_widths < 12 ) + if ( num_widths < AH_MAX_WIDTHS ) widths[num_widths++] = dist; } } diff --git a/src/autohint/ahglyph.c b/src/autohint/ahglyph.c index 052aef42b..ee628be3b 100644 --- a/src/autohint/ahglyph.c +++ b/src/autohint/ahglyph.c @@ -164,13 +164,14 @@ /* this function is used by ah_get_orientation (see below) to test */ /* the fill direction of a given bbox extrema */ - static int + static FT_Int ah_test_extrema( FT_Outline* outline, - int n ) + FT_Int n ) { FT_Vector *prev, *cur, *next; FT_Pos product; FT_Int first, last, c; + FT_Int retval; /* we need to compute the `previous' and `next' point */ @@ -201,10 +202,11 @@ next->x - cur->x, /* out.x */ 0x40 ); + retval = 0; if ( product ) - product = product > 0 ? 2 : 1; + retval = product > 0 ? 2 : 1; - return product; + return retval; } @@ -218,18 +220,18 @@ /* */ /* The function returns either 1 or -1. */ /* */ - static int + static FT_Int ah_get_orientation( FT_Outline* outline ) { FT_BBox box; - FT_BBox indices; - int n, last; + FT_Int indices_xMin, indices_yMin, indices_xMax, indices_yMax; + FT_Int n, last; - indices.xMin = -1; - indices.yMin = -1; - indices.xMax = -1; - indices.yMax = -1; + indices_xMin = -1; + indices_yMin = -1; + indices_xMax = -1; + indices_yMax = -1; box.xMin = box.yMin = 32767L; box.xMax = box.yMax = -32768L; @@ -249,41 +251,41 @@ if ( x < box.xMin ) { box.xMin = x; - indices.xMin = n; + indices_xMin = n; } if ( x > box.xMax ) { box.xMax = x; - indices.xMax = n; + indices_xMax = n; } y = outline->points[n].y; if ( y < box.yMin ) { box.yMin = y; - indices.yMin = n; + indices_yMin = n; } if ( y > box.yMax ) { box.yMax = y; - indices.yMax = n; + indices_yMax = n; } } /* test orientation of the xmin */ - n = ah_test_extrema( outline, indices.xMin ); + n = ah_test_extrema( outline, indices_xMin ); if ( n ) goto Exit; - n = ah_test_extrema( outline, indices.yMin ); + n = ah_test_extrema( outline, indices_yMin ); if ( n ) goto Exit; - n = ah_test_extrema( outline, indices.xMax ); + n = ah_test_extrema( outline, indices_xMax ); if ( n ) goto Exit; - n = ah_test_extrema( outline, indices.yMax ); + n = ah_test_extrema( outline, indices_yMax ); if ( !n ) n = 1; @@ -1284,10 +1286,10 @@ /* now, compute each edge properties */ for ( edge = edges; edge < edge_limit; edge++ ) { - int is_round = 0; /* does it contain round segments? */ - int is_straight = 0; /* does it contain straight segments? */ - int ups = 0; /* number of upwards segments */ - int downs = 0; /* number of downwards segments */ + FT_Int is_round = 0; /* does it contain round segments? */ + FT_Int is_straight = 0; /* does it contain straight segments? */ + FT_Pos ups = 0; /* number of upwards segments */ + FT_Pos downs = 0; /* number of downwards segments */ seg = edge->first; @@ -1561,7 +1563,7 @@ { AH_Edge edge = outline->horz_edges; AH_Edge edge_limit = edge + outline->num_hedges; - FT_Int delta; + FT_Pos delta; delta = globals->scaled.blue_refs - globals->design.blue_refs; diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h index a893e8421..f492d7bb7 100644 --- a/src/autohint/ahtypes.h +++ b/src/autohint/ahtypes.h @@ -286,7 +286,7 @@ FT_BEGIN_HEADER AH_Segment link; /* link segment */ AH_Segment serif; /* primary segment for serifs */ FT_Pos num_linked; /* number of linked segments */ - FT_Int score; + FT_Pos score; } AH_SegmentRec;