Commit 48ce226ae3c2ccbe3230417d118ada4fea8508e3

Alexei Podtelezhnikov 2012-11-03T22:27:27

[base] Clean up emboldening code and improve comments there. * src/base/ftoutln.c (FT_Outline_EmboldenXY): Replace sequential calls to FT_MulFix and FT_DivFix with FT_MulDiv. Mention that bisectors are used to figure out the shift direction.

diff --git a/ChangeLog b/ChangeLog
index 82abe63..f2f7957 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-11-03  Alexei Podtelezhnikov  <apodtele@gmail.com>
+
+	[base] Clean up emboldening code and improve comments there.
+
+	* src/base/ftoutln.c (FT_Outline_EmboldenXY): Replace sequential
+	calls to FT_MulFix and FT_DivFix with FT_MulDiv.
+	Mention that bisectors are used to figure out the shift direction.
+
 2012-10-24  Werner Lemberg  <wl@gnu.org>
 
 	[autofit] Add standard character to `AF_ScriptClassRec' structure.
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index 76e2b04..798f8c9 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -952,17 +952,18 @@
         /* shift only if turn is less then ~160 degrees */
         if ( 16 * d > l_in * l_out )
         {
-          /* shift components are rotated */
-          shift.x = FT_DivFix( l_out * in.y + l_in * out.y, d );
-          shift.y = FT_DivFix( l_out * in.x + l_in * out.x, d );
+          /* shift components are aligned along bisector        */
+          /* and directed according to the outline orientation. */
+          shift.x = l_out * in.y + l_in * out.y;
+          shift.y = l_out * in.x + l_in * out.x;
 
           if ( orientation == FT_ORIENTATION_TRUETYPE )
             shift.x = -shift.x;
           else
             shift.y = -shift.y;
 
-          shift.x = FT_MulFix( xstrength, shift.x );
-          shift.y = FT_MulFix( ystrength, shift.y );
+          shift.x = FT_MulDiv( shift.x, xstrength, d );
+          shift.y = FT_MulDiv( shift.y, ystrength, d );
         }
         else
           shift.x = shift.y = 0;