* src/base/fttrigon.c (FT_Vector_Rotate): Avoid rounding errors for small values. * src/autohint/ahtypes.h (AH_PointRec): Remove unused `in_angle' and `out_angle' fields.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
diff --git a/ChangeLog b/ChangeLog
index 4f976c1..7d17814 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-05-15 David Turner <david@freetype.org>
+
+ * src/base/fttrigon.c (FT_Vector_Rotate): Avoid rounding errors
+ for small values.
+
+2003-05-15 Werner Lemberg <wl@gnu.org>
+
+ * src/autohint/ahtypes.h (AH_PointRec): Remove unused `in_angle'
+ and `out_angle' fields.
+
2003-05-14 George Williams <gww@silcom.com>
* src/base/ftmac.c (FT_New_Face_From_SFNT): Handle CFF files also.
diff --git a/src/autohint/ahtypes.h b/src/autohint/ahtypes.h
index 5ad62ba..947ee62 100644
--- a/src/autohint/ahtypes.h
+++ b/src/autohint/ahtypes.h
@@ -201,10 +201,6 @@ FT_BEGIN_HEADER
/* */
/* out_dir :: The direction of the outwards vector (point->next). */
/* */
- /* in_angle :: The angle of the inwards vector. */
- /* */
- /* out_angle :: The angle of the outwards vector. */
- /* */
/* next :: The next point in same contour. */
/* */
/* prev :: The previous point in same contour. */
@@ -220,9 +216,6 @@ FT_BEGIN_HEADER
AH_Direction in_dir; /* direction of inwards vector */
AH_Direction out_dir; /* direction of outwards vector */
- AH_Angle in_angle;
- AH_Angle out_angle;
-
AH_Point next; /* next point in contour */
AH_Point prev; /* previous point in contour */
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c
index 5bf55eb..fc48d6c 100644
--- a/src/base/fttrigon.c
+++ b/src/base/fttrigon.c
@@ -356,6 +356,14 @@
}
+ /* these macros return 0 for positive numbers,
+ and -1 for negative ones */
+#define FT_SIGN_LONG( x ) ( (x) >> ( FT_SIZEOF_LONG * 8 - 1 ) )
+#define FT_SIGN_INT( x ) ( (x) >> ( FT_SIZEOF_INT * 8 - 1 ) )
+#define FT_SIGN_INT32( x ) ( (x) >> 31 )
+#define FT_SIGN_INT16( x ) ( (x) >> 15 )
+
+
/* documentation is in fttrigon.h */
FT_EXPORT_DEF( void )
@@ -366,8 +374,8 @@
FT_Vector v;
- v.x = vec->x;
- v.y = vec->y;
+ v.x = vec->x;
+ v.y = vec->y;
if ( angle && ( v.x != 0 || v.y != 0 ) )
{
@@ -376,10 +384,13 @@
v.x = ft_trig_downscale( v.x );
v.y = ft_trig_downscale( v.y );
- if ( shift >= 0 )
+ if ( shift > 0 )
{
- vec->x = v.x >> shift;
- vec->y = v.y >> shift;
+ FT_Int32 half = 1L << ( shift - 1 );
+
+
+ vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;
+ vec->y = ( v.y + half + FT_SIGN_LONG( v.y ) ) >> shift;
}
else
{