forked from minhngoc25a/freetype2
[autofit] Implement Infinality's `increase glyph heights'.
This is an improved version of a similar fix contained in the so-called `Infinality patch', taken from http://www.infinality.net/fedora/linux/zips/freetype-infinality-2.4.10-20120616_01-x86_64.tar.bz2 which addresses various enhancements of the auto-hinter. Without properties to control a module's metadata it wasn't possible to adapt the patches because everything was originally controlled by environment variables which I consider not suitable in general. A patch to control `increase_x_height' follows. * src/autofit/afglobal.h (AF_PROP_INCREASE_X_HEIGHT_MIN, AF_PROP_INCREASE_X_HEIGHT_MAX): New macros. (AF_FaceGlobalsRec): Add `increase_x_height' member. * src/autofit/afglobal.c (af_face_globals_new): Initialize it. * src/autofit/aflatin.c (af_latin_metrics_scale_dim), * src/autofit/aflatin2.c (af_latin2_metrics_scale_dim): Implement handling of `increase_x_height'.
This commit is contained in:
parent
842c4ea258
commit
d180ac70fc
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
2012-09-18 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[autofit] Implement Infinality's `increase glyph heights'.
|
||||
|
||||
This is an improved version of a similar fix contained in the
|
||||
so-called `Infinality patch', taken from
|
||||
|
||||
http://www.infinality.net/fedora/linux/zips/freetype-infinality-2.4.10-20120616_01-x86_64.tar.bz2
|
||||
|
||||
which addresses various enhancements of the auto-hinter. Without
|
||||
properties to control a module's metadata it wasn't possible to
|
||||
adapt the patches because everything was originally controlled by
|
||||
environment variables which I consider not suitable in general.
|
||||
|
||||
A patch to control `increase_x_height' follows.
|
||||
|
||||
* src/autofit/afglobal.h (AF_PROP_INCREASE_X_HEIGHT_MIN,
|
||||
AF_PROP_INCREASE_X_HEIGHT_MAX): New macros.
|
||||
(AF_FaceGlobalsRec): Add `increase_x_height' member.
|
||||
* src/autofit/afglobal.c (af_face_globals_new): Initialize it.
|
||||
|
||||
* src/autofit/aflatin.c (af_latin_metrics_scale_dim),
|
||||
* src/autofit/aflatin2.c (af_latin2_metrics_scale_dim): Implement
|
||||
handling of `increase_x_height'.
|
||||
|
||||
2012-09-18 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[autofit] Add hierarchical property access to some structures.
|
||||
|
|
|
@ -182,6 +182,8 @@
|
|||
globals = NULL;
|
||||
}
|
||||
|
||||
globals->increase_x_height = AF_PROP_INCREASE_X_HEIGHT_MAX;
|
||||
|
||||
Exit:
|
||||
*aglobals = globals;
|
||||
return error;
|
||||
|
|
|
@ -28,14 +28,10 @@
|
|||
FT_BEGIN_HEADER
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/***** *****/
|
||||
/***** F A C E G L O B A L S *****/
|
||||
/***** *****/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
/*
|
||||
* Default values and flags for both autofitter globals (found in
|
||||
* AF_ModuleRec) and face globals (in AF_FaceGlobalsRec).
|
||||
*/
|
||||
|
||||
/* index of fallback script in `af_script_classes' */
|
||||
#define AF_SCRIPT_FALLBACK 2
|
||||
|
@ -44,6 +40,19 @@ FT_BEGIN_HEADER
|
|||
/* if this flag is set, we have an ASCII digit */
|
||||
#define AF_DIGIT 0x80
|
||||
|
||||
/* `increase-x-height' property */
|
||||
#define AF_PROP_INCREASE_X_HEIGHT_MIN 6
|
||||
#define AF_PROP_INCREASE_X_HEIGHT_MAX 0
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
/***** *****/
|
||||
/***** F A C E G L O B A L S *****/
|
||||
/***** *****/
|
||||
/************************************************************************/
|
||||
/************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Note that glyph_scripts[] is used to map each glyph into
|
||||
|
@ -56,6 +65,9 @@ FT_BEGIN_HEADER
|
|||
FT_Long glyph_count; /* same as face->num_glyphs */
|
||||
FT_Byte* glyph_scripts;
|
||||
|
||||
/* per-face auto-hinter properties */
|
||||
FT_UInt increase_x_height;
|
||||
|
||||
AF_ScriptMetrics metrics[AF_SCRIPT_MAX];
|
||||
|
||||
AF_Module module; /* to access global properties */
|
||||
|
|
|
@ -613,10 +613,27 @@
|
|||
|
||||
if ( blue )
|
||||
{
|
||||
FT_Pos scaled = FT_MulFix( blue->shoot.org, scaler->y_scale );
|
||||
FT_Pos fitted = ( scaled + 40 ) & ~63;
|
||||
FT_Pos scaled;
|
||||
FT_Pos threshold;
|
||||
FT_Pos fitted;
|
||||
FT_UInt limit;
|
||||
FT_UInt ppem;
|
||||
|
||||
|
||||
scaled = FT_MulFix( blue->shoot.org, scaler->y_scale );
|
||||
ppem = metrics->root.scaler.face->size->metrics.x_ppem;
|
||||
limit = metrics->root.globals->increase_x_height;
|
||||
threshold = 40;
|
||||
|
||||
/* if the `increase_x_height' property is active, */
|
||||
/* we round up much more often */
|
||||
if ( limit &&
|
||||
ppem <= limit &&
|
||||
ppem >= AF_PROP_INCREASE_X_HEIGHT_MIN )
|
||||
threshold = 52;
|
||||
|
||||
fitted = ( scaled + threshold ) & ~63;
|
||||
|
||||
if ( scaled != fitted )
|
||||
{
|
||||
#if 0
|
||||
|
|
|
@ -562,8 +562,26 @@
|
|||
|
||||
if ( blue )
|
||||
{
|
||||
FT_Pos scaled = FT_MulFix( blue->shoot.org, scaler->y_scale );
|
||||
FT_Pos fitted = ( scaled + 40 ) & ~63;
|
||||
FT_Pos scaled;
|
||||
FT_Pos threshold;
|
||||
FT_Pos fitted;
|
||||
FT_UInt limit;
|
||||
FT_UInt ppem;
|
||||
|
||||
|
||||
scaled = FT_MulFix( blue->shoot.org, scaler->y_scale );
|
||||
ppem = metrics->root.scaler.face->size->metrics.x_ppem;
|
||||
limit = metrics->root.globals->increase_x_height;
|
||||
threshold = 40;
|
||||
|
||||
/* if the `increase_x_height' property is active, */
|
||||
/* we round up much more often */
|
||||
if ( limit &&
|
||||
ppem <= limit &&
|
||||
ppem >= AF_PROP_INCREASE_X_HEIGHT_MIN )
|
||||
threshold = 52;
|
||||
|
||||
fitted = ( scaled + threshold ) & ~63;
|
||||
|
||||
#if 1
|
||||
if ( scaled != fitted )
|
||||
|
|
Loading…
Reference in New Issue