зеркало из https://github.com/stride3d/freetype.git
improvement to glyph spacing, especially when light auto-hinting
This commit is contained in:
Родитель
3b3f2baae4
Коммит
d91eebda1c
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -208,6 +208,9 @@ FT_BEGIN_HEADER
|
|||
/* implementations */
|
||||
AF_ScriptMetrics metrics;
|
||||
|
||||
FT_Pos xmin_delta; /* used for warping */
|
||||
FT_Pos xmax_delta;
|
||||
|
||||
} AF_GlyphHintsRec;
|
||||
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 */
|
||||
|
|
Загрузка…
Ссылка в новой задаче