Fix Savannah bug #36091.

* src/autofit/aflatin.c (af_latin_metrics_init_blues),
src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Change the
constraint for testing round vs. flat segment: Accept either a
small distance or a small angle.
This commit is contained in:
Werner Lemberg 2012-07-04 17:20:33 +02:00
parent e8da532d2a
commit 5210306145
3 changed files with 33 additions and 14 deletions

View File

@ -1,3 +1,12 @@
2012-07-04 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #36091.
* src/autofit/aflatin.c (af_latin_metrics_init_blues),
src/autofit/aflatin2.c (af_latin2_metrics_init_blues): Change the
constraint for testing round vs. flat segment: Accept either a
small distance or a small angle.
2012-07-04 Werner Lemberg <wl@gnu.org>
[autofit] Beautify blue zone tracing.

View File

@ -301,6 +301,7 @@
/* lies, then inspect its previous and next points */
if ( best_point >= 0 )
{
FT_Pos best_x = points[best_point].x;
FT_Int prev, next;
FT_Pos dist;
@ -317,9 +318,12 @@
else
prev = best_last;
dist = points[prev].y - best_y;
if ( dist < -5 || dist > 5 )
break;
dist = FT_ABS( points[prev].y - best_y );
/* accept a small distance or a small angle (both values are */
/* heuristic; value 20 corresponds to approx. 2.9 degrees) */
if ( dist > 5 )
if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist )
break;
} while ( prev != best_point );
@ -330,9 +334,10 @@
else
next = best_first;
dist = points[next].y - best_y;
if ( dist < -5 || dist > 5 )
break;
dist = FT_ABS( points[next].y - best_y );
if ( dist > 5 )
if ( FT_ABS( points[next].x - best_x ) <= 20 * dist )
break;
} while ( next != best_point );

View File

@ -290,6 +290,7 @@
/* segment; we first need to find in which contour the extremum */
/* lies, then inspect its previous and next points */
{
FT_Pos best_x = points[best_point].x;
FT_Int start, end, prev, next;
FT_Pos dist;
@ -300,13 +301,16 @@
do
{
prev = start-1;
prev = start - 1;
if ( prev < best_first )
prev = best_last;
dist = points[prev].y - best_y;
if ( dist < -5 || dist > 5 )
break;
dist = FT_ABS( points[prev].y - best_y );
/* accept a small distance or a small angle (both values are */
/* heuristic; value 20 corresponds to approx. 2.9 degrees) */
if ( dist > 5 )
if ( FT_ABS( points[prev].x - best_x ) <= 20 * dist )
break;
start = prev;
@ -314,13 +318,14 @@
do
{
next = end+1;
next = end + 1;
if ( next > best_last )
next = best_first;
dist = points[next].y - best_y;
if ( dist < -5 || dist > 5 )
break;
dist = FT_ABS( points[next].y - best_y );
if ( dist > 5 )
if ( FT_ABS( points[next].x - best_x ) <= 20 * dist )
break;
end = next;