* src/truetype/ttdriver.c, src/truetype/ttobjs.h, src/truetype/ttobjs.c,

src/truetype/ttinterp.c, src/base/ftobjs.c: fixing the slight distortion
    problem that occured due to the latest auto-hinter changes
This commit is contained in:
David Turner 2003-02-18 22:25:22 +00:00
parent d4c48e06c0
commit ba4511b807
6 changed files with 39 additions and 50 deletions

View File

@ -1,12 +1,20 @@
2003-02-18 David Turner <david@freetype.org>
* src/truetype/ttdriver.c, src/truetype/ttobjs.h, src/truetype/ttobjs.c,
src/truetype/ttinterp.c, src/base/ftobjs.c: fixing the slight distortion
problem that occured due to the latest auto-hinter changes
2003-02-13 Graham Asher <graham.asher@btinternet.com> 2003-02-13 Graham Asher <graham.asher@btinternet.com>
* include/freetype/ftincrem.h, src/cff/cffgload.c, src/cid/cidgload.c, * include/freetype/ftincrem.h, src/cff/cffgload.c, src/cid/cidgload.c,
src/truetype/ttgload.c, src/type1/t1gload.c src/truetype/ttgload.c, src/type1/t1gload.c
[FT_CONFIG_OPTION_INCREMENTAL]: I have changed the incremental loading [FT_CONFIG_OPTION_INCREMENTAL]: I have changed the incremental loading
interface in a way that makes it simpler and allows glyph metrics to interface in a way that makes it simpler and allows glyph metrics to
be changed (e.g., by adding a constant, as required by CFF fonts) be changed (e.g., by adding a constant, as required by CFF fonts)
rather than just overridden. This was required to make the GhsotScript- rather than just overridden. This was required to make the GhsotScript-
to-FreeType bridge work. to-FreeType bridge work.
2003-01-31 David Turner <david@freetype.org> 2003-01-31 David Turner <david@freetype.org>

View File

@ -1330,10 +1330,10 @@
/* Compute root ascender, descender, test height, and max_advance */ /* Compute root ascender, descender, test height, and max_advance */
metrics->ascender = ( FT_MulFix( face->ascender, metrics->ascender = ( FT_MulFix( face->ascender,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) + 63 ) & -64;
metrics->descender = ( FT_MulFix( face->descender, metrics->descender = ( FT_MulFix( face->descender,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) + 0 ) & -64;
metrics->height = ( FT_MulFix( face->height, metrics->height = ( FT_MulFix( face->height,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) + 32 ) & -64;

View File

@ -190,43 +190,32 @@
FT_UInt horz_resolution, FT_UInt horz_resolution,
FT_UInt vert_resolution ) FT_UInt vert_resolution )
{ {
FT_Size_Metrics* metrics = &size->root.metrics; FT_Size_Metrics* metrics = &size->root.metrics;
TT_Face face = (TT_Face)size->root.face; FT_Size_Metrics* metrics2 = &size->metrics;
TT_Face face = (TT_Face)size->root.face;
*metrics2 = *metrics;
/* This bit flag, when set, indicates that the pixel size must be */ /* This bit flag, when set, indicates that the pixel size must be */
/* truncated to an integer. Nearly all TrueType fonts have this */ /* truncated to an integer. Nearly all TrueType fonts have this */
/* bit set, as hinting won't work really well otherwise. */ /* bit set, as hinting won't work really well otherwise. */
/* */ /* */
/* However, for those rare fonts who do not set it, we override */ if ( ( face->header.Flags & 8 ) != 0 )
/* the default computations performed by the base layer. I */
/* really don't know whether this is useful, but hey, that's the */
/* spec :-) */
/* */
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
if ( ( face->header.Flags & 8 ) == 0 )
{ {
/* Compute pixel sizes in 26.6 units */
FT_Long dim_x, dim_y; FT_Long dim_x, dim_y;
dim_x = ( char_width * horz_resolution + 36 ) / 72; /* we need to use rounding in the following computations. Otherwise,
dim_y = ( char_height * vert_resolution + 36 ) / 72; * the resulting hinted outlines will be very slightly distorted
*/
dim_x = ( ( ( char_width * horz_resolution ) / 72 ) + 32 ) & -64;
dim_y = ( ( ( char_height * vert_resolution ) / 72 ) + 32 ) & -64;
metrics->x_scale = FT_DivFix( dim_x, face->root.units_per_EM ); metrics2->x_ppem = (FT_UShort)( dim_x >> 6 );
metrics->y_scale = FT_DivFix( dim_y, face->root.units_per_EM ); metrics2->y_ppem = (FT_UShort)( dim_y >> 6 );
metrics2->x_scale = FT_DivFix( dim_x, face->root.units_per_EM );
metrics->x_ppem = (FT_UShort)( dim_x >> 6 ); metrics2->y_scale = FT_DivFix( dim_y, face->root.units_per_EM );
metrics->y_ppem = (FT_UShort)( dim_y >> 6 );
} }
#else
FT_UNUSED( vert_resolution );
FT_UNUSED( horz_resolution );
FT_UNUSED( char_height );
FT_UNUSED( char_width );
FT_UNUSED( face );
FT_UNUSED( metrics );
#endif
size->ttmetrics.valid = FALSE; size->ttmetrics.valid = FALSE;
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
@ -267,6 +256,7 @@
/* many things have been pre-computed by the base layer */ /* many things have been pre-computed by the base layer */
size->metrics = size->root.metrics;
size->ttmetrics.valid = FALSE; size->ttmetrics.valid = FALSE;
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
size->strike_index = 0xFFFF; size->strike_index = 0xFFFF;

View File

@ -568,7 +568,7 @@
exec->FDefs = size->function_defs; exec->FDefs = size->function_defs;
exec->IDefs = size->instruction_defs; exec->IDefs = size->instruction_defs;
exec->tt_metrics = size->ttmetrics; exec->tt_metrics = size->ttmetrics;
exec->metrics = size->root.metrics; exec->metrics = size->metrics;
exec->maxFunc = size->max_func; exec->maxFunc = size->max_func;
exec->maxIns = size->max_ins; exec->maxIns = size->max_ins;

View File

@ -541,7 +541,7 @@
face = (TT_Face)size->root.face; face = (TT_Face)size->root.face;
metrics = &size->root.metrics; metrics = &size->metrics;
if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 ) if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 )
return TT_Err_Invalid_PPem; return TT_Err_Invalid_PPem;
@ -566,21 +566,11 @@
size->ttmetrics.y_ratio = 0x10000L; size->ttmetrics.y_ratio = 0x10000L;
} }
#ifdef FT_CONFIG_CHESTER_ASCENDER
/* Compute root ascender, descender, test height, and max_advance */
metrics->ascender = ( FT_MulFix( face->root.ascender,
metrics->y_scale ) + 63 ) & -64;
metrics->descender = ( FT_MulFix( face->root.descender,
metrics->y_scale ) + 0 ) & -64;
#else /* !CHESTER_ASCENDER */
/* Compute root ascender, descender, test height, and max_advance */ /* Compute root ascender, descender, test height, and max_advance */
metrics->ascender = ( FT_MulFix( face->root.ascender, metrics->ascender = ( FT_MulFix( face->root.ascender,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) + 32 ) & -64;
metrics->descender = ( FT_MulFix( face->root.descender, metrics->descender = ( FT_MulFix( face->root.descender,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) + 32 ) & -64;
#endif /* !CHESTER_ASCENDER */
metrics->height = ( FT_MulFix( face->root.height, metrics->height = ( FT_MulFix( face->root.height,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) + 32 ) & -64;
metrics->max_advance = ( FT_MulFix( face->root.max_advance_width, metrics->max_advance = ( FT_MulFix( face->root.max_advance_width,
@ -701,7 +691,7 @@
SFNT_Service sfnt; SFNT_Service sfnt;
metrics = &size->root.metrics; metrics = &size->metrics;
if ( size->strike_index != 0xFFFFU ) if ( size->strike_index != 0xFFFFU )
return TT_Err_Ok; return TT_Err_Ok;
@ -739,8 +729,8 @@
sbit_metrics->descender; sbit_metrics->descender;
/* XXX: Is this correct? */ /* XXX: Is this correct? */
sbit_metrics->max_advance = ( strike->hori.min_origin_SB + sbit_metrics->max_advance = ( strike->hori.min_origin_SB +
strike->hori.max_width + strike->hori.max_width +
strike->hori.min_advance_SB ) << 6; strike->hori.min_advance_SB ) << 6;
size->strike_index = strike_index; size->strike_index = strike_index;

View File

@ -311,6 +311,7 @@ FT_BEGIN_HEADER
{ {
FT_SizeRec root; FT_SizeRec root;
FT_Size_Metrics metrics; /* slightly different from the root metrics */
TT_Size_Metrics ttmetrics; TT_Size_Metrics ttmetrics;
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS