shithub: freetype+ttf2subf

Download patch

ref: a5e9dbd528328fa62432326a1633e2f3d62194f8
parent: 934d054f451079e3521ddec732b474fc15cd6c06
author: Werner Lemberg <[email protected]>
date: Fri Nov 20 04:33:57 EST 2009

Fix Savannah bug #27742.

* src/base/ftstroke.c (ft_stroker_outside): Avoid silent division by
zero, using a threshold for `theta'.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-11-20  Werner Lemberg  <[email protected]>
 
+	Fix Savannah bug #27742.
+
+	* src/base/ftstroke.c (ft_stroker_outside): Avoid silent division by
+	zero, using a threshold for `theta'.
+
+2009-11-20  Werner Lemberg  <[email protected]>
+
 	Fix Savannah bug #28036.
 
 	* src/type1/t1afm.c (t1_get_index): Fix comparison.
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -979,7 +979,8 @@
       thcos = FT_Cos( theta );
       sigma = FT_MulFix( stroker->miter_limit, thcos );
 
-      if ( sigma >= 0x10000L )
+      /* FT_Sin(x) = 0 for x <= 57 */
+      if ( sigma >= 0x10000L || ft_pos_abs( theta ) <= 57 )
         miter = FALSE;
 
       if ( miter )  /* this is a miter (broken angle) */
@@ -1360,7 +1361,7 @@
         phi1    = (angle_mid + angle_in ) / 2;
         phi2    = (angle_mid + angle_out ) / 2;
         length1 = FT_DivFix( stroker->radius, FT_Cos( theta1 ) );
-        length2 = FT_DivFix( stroker->radius, FT_Cos(theta2) );
+        length2 = FT_DivFix( stroker->radius, FT_Cos( theta2 ) );
 
         for ( side = 0; side <= 1; side++ )
         {