shithub: freetype+ttf2subf

Download patch

ref: c5e566590d4e26ea18cab24d14223cb9c5f3b70b
parent: 2a922e87fab6fbe324b1b58d64946f8c68651136
author: Werner Lemberg <[email protected]>
date: Sat Sep 21 04:33:27 EDT 2002

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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2002-09-19  Wolfgang Domr�se  <[email protected]>
+
+	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  <[email protected]>
 
 	* builds/unix/config.guess, builds/unix/config.sub: Updated to
--- 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,7 +346,7 @@
         /* we only consider stem segments there! */
         if ( link && link->link == seg && link > seg )
         {
-          FT_Int  dist;
+          FT_Pos  dist;
 
 
           dist = seg->pos - link->pos;
@@ -352,7 +353,7 @@
           if ( dist < 0 )
             dist = -dist;
 
-          if ( num_widths < 12 )
+          if ( num_widths < AH_MAX_WIDTHS )
             widths[num_widths++] = dist;
         }
       }
--- 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,12 +251,12 @@
       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;
@@ -261,29 +263,29 @@
       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;
--- a/src/autohint/ahtypes.h
+++ b/src/autohint/ahtypes.h
@@ -286,7 +286,7 @@
     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;