* src/autofit/aflatin.c (af_latin_compute_stem_width): Optimize.
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
diff --git a/ChangeLog b/ChangeLog
index 3f94966..f963c83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-03-15 Werner Lemberg <wl@gnu.org>
+
+ * src/autofit/aflatin.c (af_latin_compute_stem_width): Optimize.
+
2016-03-14 Alexei Podtelezhnikov <apodtele@gmail.com>
[smooth] Temporarily revert 6eb6158dd787 (#47114).
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index dddfada..f9b8507 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -2511,7 +2511,6 @@
AF_LatinMetrics metrics = (AF_LatinMetrics)hints->metrics;
AF_LatinAxis axis = &metrics->axis[dim];
FT_Pos dist = width;
- FT_Pos bdelta = 0;
FT_Int sign = 0;
FT_Int vertical = ( dim == AF_DIMENSION_VERT );
@@ -2526,32 +2525,6 @@
sign = 1;
}
- /* A stem's end position depends on two values: the start position */
- /* and the stem length. The former gets usually rounded to the grid, */
- /* while the latter gets rounded also if it exceeds a certain length */
- /* (see below in this function). This `double rounding' can lead to */
- /* a great difference to the original, unhinted position; this */
- /* normally doesn't matter for large PPEM values, but for small sizes */
- /* it can easily make outlines collide. For this reason, we adjust */
- /* the stem length by a small amount depending on the PPEM value in */
- /* case the former and latter rounding both point into the same */
- /* direction. */
-
- if ( ( ( width > 0 ) && ( base_delta > 0 ) ) ||
- ( ( width < 0 ) && ( base_delta < 0 ) ) )
- {
- FT_UInt ppem = metrics->root.scaler.face->size->metrics.x_ppem;
-
-
- if ( ppem < 10 )
- bdelta = base_delta;
- else if ( ppem < 30 )
- bdelta = ( base_delta * (FT_Pos)( 30 - ppem ) ) / 20;
-
- if ( bdelta < 0 )
- bdelta = -bdelta;
- }
-
if ( ( vertical && !AF_LATIN_HINTS_DO_VERT_SNAP( hints ) ) ||
( !vertical && !AF_LATIN_HINTS_DO_HORZ_SNAP( hints ) ) )
{
@@ -2609,7 +2582,39 @@
dist += delta;
}
else
+ {
+ /* A stem's end position depends on two values: the start */
+ /* position and the stem length. The former gets usually */
+ /* rounded to the grid, while the latter gets rounded also if it */
+ /* exceeds a certain length (see below in this function). This */
+ /* `double rounding' can lead to a great difference to the */
+ /* original, unhinted position; this normally doesn't matter for */
+ /* large PPEM values, but for small sizes it can easily make */
+ /* outlines collide. For this reason, we adjust the stem length */
+ /* by a small amount depending on the PPEM value in case the */
+ /* former and latter rounding both point into the same */
+ /* direction. */
+
+ FT_Pos bdelta = 0;
+
+
+ if ( ( ( width > 0 ) && ( base_delta > 0 ) ) ||
+ ( ( width < 0 ) && ( base_delta < 0 ) ) )
+ {
+ FT_UInt ppem = metrics->root.scaler.face->size->metrics.x_ppem;
+
+
+ if ( ppem < 10 )
+ bdelta = base_delta;
+ else if ( ppem < 30 )
+ bdelta = ( base_delta * (FT_Pos)( 30 - ppem ) ) / 20;
+
+ if ( bdelta < 0 )
+ bdelta = -bdelta;
+ }
+
dist = ( dist - bdelta + 32 ) & ~63;
+ }
}
}
else