Commit a3a0f57a1d3091b0d4e7576a2ff6af2334896d2e

Werner Lemberg 2011-05-04T06:14:30

* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Simplify.

diff --git a/ChangeLog b/ChangeLog
index 145099d..845b809 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-05-04  Werner Lemberg  <wl@gnu.org>
+
+	* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Simplify.
+
 2011-05-01  Just Fill Bugs  <mozbugbox@yahoo.com.au>
             Werner Lemberg  <wl@gnu.org>
 
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index cebbfad..055e1ef 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -637,9 +637,17 @@
         dist = FT_MulFix( blue->ref.org - blue->shoot.org, scale );
         if ( dist <= 48 && dist >= -48 )
         {
-          FT_Pos  delta1, delta2;
+#if 0
+          FT_Pos  delta1;
+#endif
+          FT_Pos  delta2;
+
 
+          /* use discrete values for blue zone widths */
+
+#if 0
 
+          /* generic, original code */
           delta1 = blue->shoot.org - blue->ref.org;
           delta2 = delta1;
           if ( delta1 < 0 )
@@ -657,6 +665,25 @@
           if ( delta1 < 0 )
             delta2 = -delta2;
 
+#else
+
+          /* simplified version due to abs(dist) <= 48 */
+          delta2 = dist;
+          if ( dist < 0 )
+            delta2 = -delta2;
+
+          if ( delta2 < 32 )
+            delta2 = 0;
+          else if ( delta < 48 )
+            delta2 = 32;
+          else
+            delta2 = 64;
+
+          if ( dist < 0 )
+            delta2 = -delta2;
+
+#endif
+
           blue->ref.fit   = FT_PIX_ROUND( blue->ref.cur );
           blue->shoot.fit = blue->ref.fit + delta2;