From aaf21968deb85b635cb6aa6544df233ea5981346 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 13 Feb 2013 09:48:21 +0100 Subject: Update to following packages: openssl-1.0.1e freetype-2.4.11 --- freetype/src/base/ftoutln.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'freetype/src/base/ftoutln.c') diff --git a/freetype/src/base/ftoutln.c b/freetype/src/base/ftoutln.c index 76e2b04a1..c4fd2660a 100644 --- a/freetype/src/base/ftoutln.c +++ b/freetype/src/base/ftoutln.c @@ -922,7 +922,7 @@ for ( c = 0; c < outline->n_contours; c++ ) { FT_Vector in, out, shift; - FT_Fixed l_in, l_out, d; + FT_Fixed l_in, l_out, l, q, d; int last = outline->contours[c]; @@ -952,17 +952,32 @@ /* shift only if turn is less then ~160 degrees */ if ( 16 * d > l_in * l_out ) { - /* shift components are rotated */ - shift.x = FT_DivFix( l_out * in.y + l_in * out.y, d ); - shift.y = FT_DivFix( l_out * in.x + l_in * out.x, d ); + /* shift components are aligned along bisector */ + /* and directed according to the outline orientation. */ + shift.x = l_out * in.y + l_in * out.y; + shift.y = l_out * in.x + l_in * out.x; if ( orientation == FT_ORIENTATION_TRUETYPE ) shift.x = -shift.x; else shift.y = -shift.y; - shift.x = FT_MulFix( xstrength, shift.x ); - shift.y = FT_MulFix( ystrength, shift.y ); + /* threshold strength to better handle collapsing segments */ + l = FT_MIN( l_in, l_out ); + q = out.x * in.y - out.y * in.x; + if ( orientation == FT_ORIENTATION_TRUETYPE ) + q = -q; + + if ( FT_MulDiv( xstrength, q, l ) < d ) + shift.x = FT_MulDiv( shift.x, xstrength, d ); + else + shift.x = FT_MulDiv( shift.x, l, q ); + + + if ( FT_MulDiv( ystrength, q, l ) < d ) + shift.y = FT_MulDiv( shift.y, ystrength, d ); + else + shift.y = FT_MulDiv( shift.y, l, q ); } else shift.x = shift.y = 0; -- cgit v1.2.3