improvement to glyph spacing, especially when light auto-hinting

This commit is contained in:
David Turner 2007-01-26 15:05:41 +00:00
parent 3b3f2baae4
commit d91eebda1c
5 changed files with 38 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2007-01-25 David Turner <david@freetype.org>
* src/autofit/afhints.h, src/autofit/afhints.c, src/autofit/aftypes.h,
src/autofit/afwarp.c: light auto-hinting, improve glyph advance widths
and ressurect normal/full hinting to its normal quality
2007-01-25 Werner Lemberg <wl@gnu.org>
* docs/release: Updated -- Savannah uses a new uploading scheme.

View File

@ -727,6 +727,9 @@
hints->x_delta = x_delta;
hints->y_delta = y_delta;
hints->xmin_delta = 0;
hints->xmax_delta = 0;
points = hints->points;
if ( hints->num_points == 0 )
goto Exit;

View File

@ -208,6 +208,9 @@ FT_BEGIN_HEADER
/* implementations */
AF_ScriptMetrics metrics;
FT_Pos xmin_delta; /* used for warping */
FT_Pos xmax_delta;
} AF_GlyphHintsRec;

View File

@ -171,8 +171,8 @@
/* we now need to hint the metrics according to the change in */
/* width/positioning that occured during the hinting process */
if ( scaler->render_mode != FT_RENDER_MODE_LIGHT )
{
#ifndef AF_USE_WARPER
FT_Pos old_advance, old_rsb, old_lsb, new_lsb;
FT_Pos pp1x_uh, pp2x_uh;
AF_AxisHints axis = &hints->axis[AF_DIMENSION_HORZ];
@ -216,18 +216,28 @@
slot->rsb_delta = loader->pp2.x - pp2x_uh;
}
else
#endif /* !AF_USE_WARPER */
{
FT_Pos pp1x = loader->pp1.x;
FT_Pos pp2x = loader->pp2.x;
loader->pp1.x = FT_PIX_ROUND( loader->pp1.x );
loader->pp2.x = FT_PIX_ROUND( loader->pp2.x );
loader->pp1.x = FT_PIX_ROUND( pp1x );
loader->pp2.x = FT_PIX_ROUND( pp2x );
slot->lsb_delta = loader->pp1.x - pp1x;
slot->rsb_delta = loader->pp2.x - pp2x;
}
}
else
{
FT_Pos pp1x = loader->pp1.x;
FT_Pos pp2x = loader->pp2.x;
loader->pp1.x = FT_PIX_ROUND( pp1x + hints->xmin_delta );
loader->pp2.x = FT_PIX_ROUND( pp2x + hints->xmax_delta + 16 );
slot->lsb_delta = loader->pp1.x - pp1x;
slot->rsb_delta = loader->pp2.x - pp2x;
}
/* good, we simply add the glyph to our loader's base */
FT_GlyphLoader_Add( gloader );

View File

@ -24,11 +24,11 @@
static const AF_WarpScore
af_warper_weights[64] =
{
35, 32, 30, 20, 15, 12, 10, 5, 2, 1, 0, 0, 0, 0, 0, 0,
35, 32, 30, 25, 20, 15, 12, 10, 5, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, -1, -2, -5, -8,-10,-10,-20,-20,-30,-30,
-30,-30,-20,-20,-10,-10, -8, -5, -2, -1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1, 2, 5, 10, 12, 15, 20, 30, 32,
0, 0, 0, 0, 0, 0, 0, 1, 5, 10, 12, 15, 20, 25, 30, 32,
};
#else
static const AF_WarpScore
@ -314,8 +314,16 @@
segments, num_segments );
}
*a_scale = warper->best_scale;
*a_delta = warper->best_delta;
{
FT_Fixed best_scale = warper->best_scale;
FT_Pos best_delta = warper->best_delta;
hints->xmin_delta = FT_MulFix( X1, best_scale-org_scale ) + best_delta;
hints->xmax_delta = FT_MulFix( X2, best_scale-org_scale ) + best_delta;
*a_scale = best_scale;
*a_delta = best_delta;
}
}
#else /* !AF_USE_WARPER */