shithub: freetype+ttf2subf

Download patch

ref: 48ce226ae3c2ccbe3230417d118ada4fea8508e3
parent: 553bb3c3caa38bf73d01f5c3a3ebe5a96070f527
author: Alexei Podtelezhnikov <[email protected]>
date: Sat Nov 3 18:27:27 EDT 2012

[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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-11-03  Alexei Podtelezhnikov  <[email protected]>
+
+	[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  <[email protected]>
 
 	[autofit] Add standard character to `AF_ScriptClassRec' structure.
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -952,9 +952,10 @@
         /* 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;
@@ -961,8 +962,8 @@
           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;