fix bug #19565, which was caused by an incorrect segment link computation

This commit is contained in:
David Turner 2007-06-11 19:36:48 +00:00
parent b792017faf
commit b38c15da09
3 changed files with 21 additions and 15 deletions

View File

@ -1,5 +1,9 @@
2007-06-11 David Turner <david@freetype.org>
* src/autofit/aflatin,c: fix incorrect segment linking computation,
this was the root cause of bug #19565.
* src/autofit/*: some very experimental changes to improve the Latin
auto-hinter. note that the new code is disabled by default since this
is not stablizied yet.

View File

@ -843,11 +843,11 @@
{
/* the fake segments are introduced to hint the metrics -- */
/* we must never link them to anything */
if ( seg1->first == seg1->last )
if ( seg1->dir != axis->major_dir || seg1->first == seg1->last )
continue;
for ( seg2 = seg1 + 1; seg2 < segment_limit; seg2++ )
if ( seg1->dir + seg2->dir == 0 )
for ( seg2 = segments; seg2 < segment_limit; seg2++ )
if ( seg1->dir + seg2->dir == 0 && seg2->pos > seg1->pos )
{
FT_Pos pos1 = seg1->pos;
FT_Pos pos2 = seg2->pos;

View File

@ -902,7 +902,7 @@
continue;
for ( seg2 = segments; seg2 < segment_limit; seg2++ )
if ( seg1->dir + seg2->dir == 0 )
if ( seg1->dir + seg2->dir == 0 && seg2->pos > seg1->pos )
#endif
{
FT_Pos pos1 = seg1->pos;
@ -1940,24 +1940,26 @@
/* we want to avoid the absolute worst case which is
* when the left and right edges of the span each represent
* about 50% of the gray. we'd better want to change this
* to 25/75%, since this is much more pleasant to the eye with
* to 20/80%, since this is much more pleasant to the eye with
* very acceptable distortion
*/
FT_Pos frac_left = (org_left) & 63;
FT_Pos frac_right = (org_right) & 63;
if (frac_left >= 20 && frac_left <= 44)
if ( frac_left >= 22 && frac_left <= 42 &&
frac_right >= 22 && frac_right <= 42 )
{
FT_Pos ref = (frac_left <= 32) ? 16 : 48;
displacements[count] = delta = ref - frac_left;
scores[count++] = FT_ABS(delta) + 8;
}
org = frac_left;
fit = (org <= 32) ? 13 : 51;
delta = FT_ABS(fit - org);
displacements[count] = fit - org;
scores[count++] = delta;
if (frac_right >= 20 && frac_right <= 44)
{
FT_Pos ref = (frac_right < 32) ? 16 : 48;
displacements[count] = delta = ref - frac_right;
scores[count++] = FT_ABS(delta) + 8;
org = frac_right;
fit = (org <= 32) ? 13 : 51;
delta = FT_ABS(fit - org);
displacement[count] = fit - org;
scores[count++] = delta;
}
}