summaryrefslogtreecommitdiff
path: root/src/autofit
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2016-03-15 07:55:05 +0100
committerWerner Lemberg <wl@gnu.org>2016-03-15 07:55:05 +0100
commitda86b73f034c077637b169c374808a966e00f399 (patch)
tree6fbb94d8ad91fe8033bb8280ec9dd72cba31c4cf /src/autofit
parent1865575a712adfcd844ae2aa7abb810e1055c4d4 (diff)
downloadfreetype2-da86b73f034c077637b169c374808a966e00f399.tar.gz
* src/autofit/aflatin.c (af_latin_compute_stem_width): Optimize.
Diffstat (limited to 'src/autofit')
-rw-r--r--src/autofit/aflatin.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index dddfadab0..f9b850707 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