* src/autofit/aflatin.c (af_latin_metrics_scale_dim): Simplify.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
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;