shithub: freetype+ttf2subf

Download patch

ref: a3a0f57a1d3091b0d4e7576a2ff6af2334896d2e
parent: c3135e43f54a3694a4ac476d3c6ee49a2e6d332f
author: Werner Lemberg <[email protected]>
date: Wed May 4 02:14:30 EDT 2011

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

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-05-04  Werner Lemberg  <[email protected]>
+
+	* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Simplify.
+
 2011-05-01  Just Fill Bugs  <[email protected]>
             Werner Lemberg  <[email protected]>
 
--- 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 )
@@ -656,6 +664,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;