* include/freetype/fttypes.h

src/autofit/afangles.c
        src/autofit/aflatin.c
        src/autohint/ahglyph.c
        src/autohint/ahhint.c
        src/base/ftcalc.c
        src/base/ftgloadr.c
        src/base/ftglyph.c
        src/base/ftobjs.c
        src/base/ftsynth.c
        src/base/fttrigon.c
        src/cff/cffgload.c
        src/cid/cidgload.c
        src/cid/cidload.c
        src/pfr/pfrgload.c
        src/pfr/pfrload.c
        src/pfr/pfrsbit.c
        src/psaux/psobjs.c
        src/pshinter/pshalgo.c
        src/pshinter/pshglob.c
        src/pshinter/pshrec.c
        src/raster/ftrend1.c
        src/sfnt/ttcmap0.c
        src/smooth/ftsmooth.c
        src/truetype/ttdriver.c
        src/truetype/ttgload.c
        src/truetype/ttinterp.c
        src/truetype/ttobjs.c
        src/type1/t1gload.c
        src/winfonts/winfnt.c:

          use of the FT_PAD_XXX and FT_PIX_XXX macros to avoid compiler
          warnings with very pedantic compilers. Hints:  (x) & -64 will
          warn if (x) is not signed.. use (x) & ~63 instead !
This commit is contained in:
David Turner 2003-12-24 01:10:46 +00:00
parent 023612221e
commit 87c0d30fc5
31 changed files with 792 additions and 746 deletions

View File

@ -1,3 +1,41 @@
2003-12-23 David Turner <david@freetype.org>
* include/freetype/fttypes.h
src/autofit/afangles.c
src/autofit/aflatin.c
src/autohint/ahglyph.c
src/autohint/ahhint.c
src/base/ftcalc.c
src/base/ftgloadr.c
src/base/ftglyph.c
src/base/ftobjs.c
src/base/ftsynth.c
src/base/fttrigon.c
src/cff/cffgload.c
src/cid/cidgload.c
src/cid/cidload.c
src/pfr/pfrgload.c
src/pfr/pfrload.c
src/pfr/pfrsbit.c
src/psaux/psobjs.c
src/pshinter/pshalgo.c
src/pshinter/pshglob.c
src/pshinter/pshrec.c
src/raster/ftrend1.c
src/sfnt/ttcmap0.c
src/smooth/ftsmooth.c
src/truetype/ttdriver.c
src/truetype/ttgload.c
src/truetype/ttinterp.c
src/truetype/ttobjs.c
src/type1/t1gload.c
src/winfonts/winfnt.c:
use of the FT_PAD_XXX and FT_PIX_XXX macros to avoid compiler
warnings with very pedantic compilers. Hints: (x) & -64 will
warn if (x) is not signed.. use (x) & ~63 instead !
2003-12-22 Werner Lemberg <wl@gnu.org> 2003-12-22 Werner Lemberg <wl@gnu.org>
* include/freetype/ftwinfnt.h (FT_WinFNT_ID_*): New definitions * include/freetype/ftwinfnt.h (FT_WinFNT_ID_*): New definitions

File diff suppressed because it is too large Load Diff

View File

@ -78,6 +78,13 @@ FT_BEGIN_HEADER
#define ABS( a ) ( (a) < 0 ? -(a) : (a) ) #define ABS( a ) ( (a) < 0 ? -(a) : (a) )
#endif #endif
#define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) )
#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x)+((n)/2), n )
#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x)+((n)-1), n )
#define FT_PIX_FLOOR( x ) ( (x) & ~63 )
#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x)+32 )
#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x)+63 )
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/

View File

@ -6,7 +6,7 @@
static const FT_Fixed static const FT_Fixed
af_angle_arctan_table[9] = af_angle_arctan_table[9] =
{ {
90, 64, 38, 20, 10, 5, 3, 1, 1 90, 64, 38, 20, 10, 5, 3, 1, 1
}; };
@ -116,9 +116,9 @@
/* round theta */ /* round theta */
if ( theta >= 0 ) if ( theta >= 0 )
theta = ( theta + 2 ) & -4; theta = FT_PAD_ROUND( theta, 4 );
else else
theta = - (( -theta + 2 ) & -4); theta = - FT_PAD_ROUND( -theta, 4 );
vec->x = x; vec->x = x;
vec->y = theta; vec->y = theta;
@ -152,18 +152,18 @@
AF_Angle angle2 ) AF_Angle angle2 )
{ {
AF_Angle delta = angle2 - angle1; AF_Angle delta = angle2 - angle1;
delta %= AF_ANGLE_2PI; delta %= AF_ANGLE_2PI;
if ( delta < 0 ) if ( delta < 0 )
delta += AF_ANGLE_2PI; delta += AF_ANGLE_2PI;
if ( delta > AF_ANGLE_PI ) if ( delta > AF_ANGLE_PI )
delta -= AF_ANGLE_2PI; delta -= AF_ANGLE_2PI;
return delta;
}
return delta;
}
/* well, this needs to be somewhere, right :-) /* well, this needs to be somewhere, right :-)
*/ */
@ -187,5 +187,5 @@
table[j - 1] = swap; table[j - 1] = swap;
} }
} }
} }

View File

@ -1173,7 +1173,7 @@
} }
} }
scaled = ( reference + 32 ) & -64; scaled = FT_PIX_ROUND( reference );
if ( width >= reference ) if ( width >= reference )
{ {
@ -1268,7 +1268,7 @@
dist += delta; dist += delta;
} }
else else
dist = ( dist + 32 ) & -64; dist = ( dist + 32 ) & ~63;
} }
} }
else else
@ -1282,7 +1282,7 @@
/* in the case of vertical hinting, always round */ /* in the case of vertical hinting, always round */
/* the stem heights to integer pixels */ /* the stem heights to integer pixels */
if ( dist >= 64 ) if ( dist >= 64 )
dist = ( dist + 16 ) & -64; dist = ( dist + 16 ) & ~63;
else else
dist = 64; dist = 64;
} }
@ -1297,7 +1297,7 @@
if ( dist < 64 ) if ( dist < 64 )
dist = 64; dist = 64;
else else
dist = ( dist + 32 ) & -64; dist = ( dist + 32 ) & ~63;
} }
else else
{ {
@ -1308,10 +1308,10 @@
dist = ( dist + 64 ) >> 1; dist = ( dist + 64 ) >> 1;
else if ( dist < 128 ) else if ( dist < 128 )
dist = ( dist + 22 ) & -64; dist = ( dist + 22 ) & ~63;
else else
/* XXX: round otherwise to prevent color fringes in LCD mode */ /* XXX: round otherwise to prevent color fringes in LCD mode */
dist = ( dist + 32 ) & -64; dist = ( dist + 32 ) & ~63;
} }
} }
} }
@ -1472,7 +1472,7 @@
{ {
org_center = edge->opos + ( org_len >> 1 ); org_center = edge->opos + ( org_len >> 1 );
cur_pos1 = ( org_center + 32 ) & -64; cur_pos1 = FT_PIX_ROUND( org_center );
error1 = org_center - ( cur_pos1 - u_off ); error1 = org_center - ( cur_pos1 - u_off );
if ( error1 < 0 ) if ( error1 < 0 )
@ -1492,7 +1492,7 @@
} }
else else
edge->pos = ( edge->opos + 32 ) & -64; edge->pos = FT_PIX_ROUND( edge->opos );
anchor = edge; anchor = edge;
@ -1518,7 +1518,7 @@
FT_Pos u_off, d_off; FT_Pos u_off, d_off;
cur_pos1 = ( org_center + 32 ) & -64; cur_pos1 = FT_PIX_ROUND( org_center );
if (cur_len <= 64 ) if (cur_len <= 64 )
u_off = d_off = 32; u_off = d_off = 32;
@ -1553,12 +1553,12 @@
cur_len = af_compute_stem_width( hinter, dimension, org_len, cur_len = af_compute_stem_width( hinter, dimension, org_len,
edge->flags, edge2->flags ); edge->flags, edge2->flags );
cur_pos1 = ( org_pos + 32 ) & -64; cur_pos1 = FT_PIX_ROUND( org_pos );
delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center ); delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
if ( delta1 < 0 ) if ( delta1 < 0 )
delta1 = -delta1; delta1 = -delta1;
cur_pos2 = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len; cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len;
delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center ); delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
if ( delta2 < 0 ) if ( delta2 < 0 )
delta2 = -delta2; delta2 = -delta2;
@ -1651,12 +1651,12 @@
af_align_serif_edge( hinter, edge->serif, edge, dimension ); af_align_serif_edge( hinter, edge->serif, edge, dimension );
else if ( !anchor ) else if ( !anchor )
{ {
edge->pos = ( edge->opos + 32 ) & -64; edge->pos = FT_PIX_ROUND( edge->opos );
anchor = edge; anchor = edge;
} }
else else
edge->pos = anchor->pos + edge->pos = anchor->pos +
( ( edge->opos-anchor->opos + 32 ) & -64 ); FT_PIX_ROUND( edge->opos - anchor->opos );
edge->flags |= AF_EDGE_DONE; edge->flags |= AF_EDGE_DONE;

View File

@ -418,7 +418,7 @@
/* first of all, reallocate the contours array if necessary */ /* first of all, reallocate the contours array if necessary */
if ( num_contours > outline->max_contours ) if ( num_contours > outline->max_contours )
{ {
FT_Int new_contours = ( num_contours + 3 ) & -4; FT_Int new_contours = FT_PAD_CEIL( num_contours, 4 );
if ( FT_RENEW_ARRAY( outline->contours, if ( FT_RENEW_ARRAY( outline->contours,
@ -435,7 +435,7 @@
/* */ /* */
if ( num_points + 2 > outline->max_points ) if ( num_points + 2 > outline->max_points )
{ {
FT_Int news = ( num_points + 2 + 7 ) & -8; FT_Int news = FT_PAD_CEIL( num_points, 8 );
FT_Int max = outline->max_points; FT_Int max = outline->max_points;

View File

@ -71,7 +71,7 @@
} }
} }
scaled = ( reference + 32 ) & -64; scaled = FT_PIX_ROUND( reference );
if ( width >= reference ) if ( width >= reference )
{ {
@ -167,7 +167,7 @@
dist += delta; dist += delta;
} }
else else
dist = ( dist + 32 ) & -64; dist = ( dist + 32 ) & ~63;
} }
} }
else else
@ -181,7 +181,7 @@
/* in the case of vertical hinting, always round */ /* in the case of vertical hinting, always round */
/* the stem heights to integer pixels */ /* the stem heights to integer pixels */
if ( dist >= 64 ) if ( dist >= 64 )
dist = ( dist + 16 ) & -64; dist = ( dist + 16 ) & ~63;
else else
dist = 64; dist = 64;
} }
@ -196,7 +196,7 @@
if ( dist < 64 ) if ( dist < 64 )
dist = 64; dist = 64;
else else
dist = ( dist + 32 ) & -64; dist = ( dist + 32 ) & ~63;
} }
else else
{ {
@ -207,10 +207,10 @@
dist = ( dist + 64 ) >> 1; dist = ( dist + 64 ) >> 1;
else if ( dist < 128 ) else if ( dist < 128 )
dist = ( dist + 22 ) & -64; dist = ( dist + 22 ) & ~63;
else else
/* XXX: round otherwise to prevent color fringes in LCD mode */ /* XXX: round otherwise to prevent color fringes in LCD mode */
dist = ( dist + 32 ) & -64; dist = ( dist + 32 ) & ~63;
} }
} }
} }
@ -284,7 +284,7 @@
dist += delta; dist += delta;
} }
else else
dist = ( dist + 32 ) & -64; dist = ( dist + 32 ) & ~63;
} }
} }
else else
@ -298,7 +298,7 @@
/* in the case of vertical hinting, always round */ /* in the case of vertical hinting, always round */
/* the stem heights to integer pixels */ /* the stem heights to integer pixels */
if ( dist >= 64 ) if ( dist >= 64 )
dist = ( dist + 16 ) & -64; dist = ( dist + 16 ) & ~63;
else else
dist = 64; dist = 64;
} }
@ -313,7 +313,7 @@
if ( dist < 64 ) if ( dist < 64 )
dist = 64; dist = 64;
else else
dist = ( dist + 32 ) & -64; dist = ( dist + 32 ) & ~63;
} }
else else
{ {
@ -324,10 +324,10 @@
dist = ( dist + 64 ) >> 1; dist = ( dist + 64 ) >> 1;
else if ( dist < 128 ) else if ( dist < 128 )
dist = ( dist + 22 ) & -64; dist = ( dist + 22 ) & ~63;
else else
/* XXX: round otherwise to prevent color fringes in LCD mode */ /* XXX: round otherwise to prevent color fringes in LCD mode */
dist = ( dist + 32 ) & -64; dist = ( dist + 32 ) & ~63;
} }
} }
} }
@ -396,7 +396,7 @@
if ( base->flags & AH_EDGE_DONE ) if ( base->flags & AH_EDGE_DONE )
{ {
if ( dist >= 64 ) if ( dist >= 64 )
dist = ( dist + 8 ) & -64; dist = ( dist + 8 ) & ~63;
else if ( dist <= 32 && !vertical ) else if ( dist <= 32 && !vertical )
dist = ( dist + 33 ) >> 1; dist = ( dist + 33 ) >> 1;
@ -545,7 +545,7 @@
{ {
org_center = edge->opos + ( org_len >> 1 ); org_center = edge->opos + ( org_len >> 1 );
cur_pos1 = ( org_center + 32 ) & -64; cur_pos1 = FT_PIX_ROUND( org_center );
error1 = org_center - ( cur_pos1 - u_off ); error1 = org_center - ( cur_pos1 - u_off );
if ( error1 < 0 ) if ( error1 < 0 )
@ -565,7 +565,7 @@
} }
else else
edge->pos = ( edge->opos + 32 ) & -64; edge->pos = FT_PIX_ROUND( edge->opos );
anchor = edge; anchor = edge;
@ -575,7 +575,7 @@
#else /* !FT_CONFIG_CHESTER_STEM */ #else /* !FT_CONFIG_CHESTER_STEM */
edge->pos = ( edge->opos + 32 ) & -64; edge->pos = FT_PIX_ROUND( edge->opos );
anchor = edge; anchor = edge;
edge->flags |= AH_EDGE_DONE; edge->flags |= AH_EDGE_DONE;
@ -614,7 +614,7 @@
FT_Pos u_off, d_off; FT_Pos u_off, d_off;
cur_pos1 = ( org_center + 32 ) & -64; cur_pos1 = FT_PIX_ROUND( org_center );
if (cur_len <= 64 ) if (cur_len <= 64 )
u_off = d_off = 32; u_off = d_off = 32;
@ -649,12 +649,12 @@
cur_len = ah_compute_stem_width( hinter, dimension, org_len, cur_len = ah_compute_stem_width( hinter, dimension, org_len,
edge->flags, edge2->flags ); edge->flags, edge2->flags );
cur_pos1 = ( org_pos + 32 ) & -64; cur_pos1 = FT_PIX_ROUND( org_pos );
delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center ); delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
if ( delta1 < 0 ) if ( delta1 < 0 )
delta1 = -delta1; delta1 = -delta1;
cur_pos2 = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len; cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len;
delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center ); delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
if ( delta2 < 0 ) if ( delta2 < 0 )
delta2 = -delta2; delta2 = -delta2;
@ -665,12 +665,12 @@
#else /* !FT_CONFIG_CHESTER_STEM */ #else /* !FT_CONFIG_CHESTER_STEM */
cur_pos1 = ( org_pos + 32 ) & -64; cur_pos1 = FT_PIX_ROUND( org_pos );
delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center ); delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center );
if ( delta1 < 0 ) if ( delta1 < 0 )
delta1 = -delta1; delta1 = -delta1;
cur_pos2 = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len; cur_pos2 = FT_PIX_ROUND( org_pos + org_len ) - cur_len;
delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center ); delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center );
if ( delta2 < 0 ) if ( delta2 < 0 )
delta2 = -delta2; delta2 = -delta2;
@ -764,12 +764,12 @@
ah_align_serif_edge( hinter, edge->serif, edge, dimension ); ah_align_serif_edge( hinter, edge->serif, edge, dimension );
else if ( !anchor ) else if ( !anchor )
{ {
edge->pos = ( edge->opos + 32 ) & -64; edge->pos = FT_PIX_ROUND( edge->opos );
anchor = edge; anchor = edge;
} }
else else
edge->pos = anchor->pos + edge->pos = anchor->pos +
( ( edge->opos-anchor->opos + 32 ) & -64 ); FT_PIX_ROUND( edge->opos - anchor->opos );
edge->flags |= AH_EDGE_DONE; edge->flags |= AH_EDGE_DONE;
@ -1299,15 +1299,16 @@
if ( delta2 < 32 ) if ( delta2 < 32 )
delta2 = 0; delta2 = 0;
else if ( delta2 < 64 ) else if ( delta2 < 64 )
delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & -32 ); delta2 = 32 + ( ( ( delta2 - 32 ) + 16 ) & ~31 );
else else
delta2 = ( delta2 + 32 ) & -64; delta2 = FT_PIX_ROUND( delta2 );
if ( delta < 0 ) if ( delta < 0 )
delta2 = -delta2; delta2 = -delta2;
scaled->blue_refs[n] = scaled->blue_refs[n] =
( FT_MulFix( design->blue_refs[n], y_scale ) + 32 ) & -64; FT_PIX_ROUND( FT_MulFix( design->blue_refs[n], y_scale ) );
scaled->blue_shoots[n] = scaled->blue_refs[n] + delta2; scaled->blue_shoots[n] = scaled->blue_refs[n] + delta2;
} }
@ -1551,8 +1552,8 @@
old_lsb = edge1->opos; old_lsb = edge1->opos;
new_lsb = edge1->pos; new_lsb = edge1->pos;
hinter->pp1.x = ( ( new_lsb - old_lsb ) + 32 ) & -64; hinter->pp1.x = FT_PIX_ROUND( new_lsb - old_lsb );
hinter->pp2.x = ( ( edge2->pos + old_rsb ) + 32 ) & -64; hinter->pp2.x = FT_PIX_ROUND( edge2->pos + old_rsb );
#if 0 #if 0
/* try to fix certain bad advance computations */ /* try to fix certain bad advance computations */
@ -1677,8 +1678,8 @@
x = FT_MulFix( subglyph->arg1, x_scale ); x = FT_MulFix( subglyph->arg1, x_scale );
y = FT_MulFix( subglyph->arg2, y_scale ); y = FT_MulFix( subglyph->arg2, y_scale );
x = ( x + 32 ) & -64; x = FT_PIX_ROUND(x);
y = ( y + 32 ) & -64; y = FT_PIX_ROUND(y);
} }
{ {
@ -1715,10 +1716,10 @@
FT_Outline_Translate( &gloader->base.outline, -hinter->pp1.x, 0 ); FT_Outline_Translate( &gloader->base.outline, -hinter->pp1.x, 0 );
FT_Outline_Get_CBox( &gloader->base.outline, &bbox ); FT_Outline_Get_CBox( &gloader->base.outline, &bbox );
bbox.xMin &= -64; bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
bbox.yMin &= -64; bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
bbox.xMax = ( bbox.xMax + 63 ) & -64; bbox.xMax = FT_PIX_CEIL( bbox.xMax );
bbox.yMax = ( bbox.yMax + 63 ) & -64; bbox.yMax = FT_PIX_CEIL( bbox.yMax );
slot->metrics.width = bbox.xMax - bbox.xMin; slot->metrics.width = bbox.xMax - bbox.xMin;
slot->metrics.height = bbox.yMax - bbox.yMin; slot->metrics.height = bbox.yMax - bbox.yMin;
@ -1733,7 +1734,7 @@
slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance, slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
x_scale ); x_scale );
slot->metrics.horiAdvance = ( slot->metrics.horiAdvance + 32 ) & -64; slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );
/* now copy outline into glyph slot */ /* now copy outline into glyph slot */
ah_loader_rewind( slot->internal->loader ); ah_loader_rewind( slot->internal->loader );
@ -1802,7 +1803,7 @@
if ( shoot > 0 ) if ( shoot > 0 )
{ {
FT_Pos scaled = FT_MulFix( shoot, y_scale ); FT_Pos scaled = FT_MulFix( shoot, y_scale );
FT_Pos fitted = ( scaled + 32 ) & -64; FT_Pos fitted = FT_PIX_ROUND( scaled );
if ( scaled != fitted ) if ( scaled != fitted )

View File

@ -74,8 +74,8 @@
FT_EXPORT_DEF( FT_Fixed ) FT_EXPORT_DEF( FT_Fixed )
FT_RoundFix( FT_Fixed a ) FT_RoundFix( FT_Fixed a )
{ {
return ( a >= 0 ) ? ( a + 0x8000L ) & -0x10000L return ( a >= 0 ) ? ( a + 0x8000L ) & ~0xFFFFL
: -((-a + 0x8000L ) & -0x10000L ); : -((-a + 0x8000L ) & ~0xFFFFL );
} }
@ -84,8 +84,8 @@
FT_EXPORT_DEF( FT_Fixed ) FT_EXPORT_DEF( FT_Fixed )
FT_CeilFix( FT_Fixed a ) FT_CeilFix( FT_Fixed a )
{ {
return ( a >= 0 ) ? ( a + 0xFFFFL ) & -0x10000L return ( a >= 0 ) ? ( a + 0xFFFFL ) & ~0xFFFFL
: -((-a + 0xFFFFL ) & -0x10000L ); : -((-a + 0xFFFFL ) & ~0xFFFFL );
} }
@ -94,8 +94,8 @@
FT_EXPORT_DEF( FT_Fixed ) FT_EXPORT_DEF( FT_Fixed )
FT_FloorFix( FT_Fixed a ) FT_FloorFix( FT_Fixed a )
{ {
return ( a >= 0 ) ? a & -0x10000L return ( a >= 0 ) ? a & ~0xFFFFL
: -((-a) & -0x10000L ); : -((-a) & ~0xFFFFL );
} }

View File

@ -205,7 +205,7 @@
if ( new_max > old_max ) if ( new_max > old_max )
{ {
new_max = ( new_max + 7 ) & -8; new_max = FT_PAD_CEIL( new_max, 8 );
if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) || if ( FT_RENEW_ARRAY( base->points, old_max, new_max ) ||
FT_RENEW_ARRAY( base->tags, old_max, new_max ) ) FT_RENEW_ARRAY( base->tags, old_max, new_max ) )
@ -225,7 +225,7 @@
n_contours; n_contours;
if ( new_max > old_max ) if ( new_max > old_max )
{ {
new_max = ( new_max + 3 ) & -4; new_max = FT_PAD_CEIL( new_max, 4 );
if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) ) if ( FT_RENEW_ARRAY( base->contours, old_max, new_max ) )
goto Exit; goto Exit;
@ -261,7 +261,7 @@
old_max = loader->max_subglyphs; old_max = loader->max_subglyphs;
if ( new_max > old_max ) if ( new_max > old_max )
{ {
new_max = ( new_max + 1 ) & -2; new_max = FT_PAD_CEIL( new_max, 2 );
if ( FT_RENEW_ARRAY( base->subglyphs, old_max, new_max ) ) if ( FT_RENEW_ARRAY( base->subglyphs, old_max, new_max ) )
goto Exit; goto Exit;

View File

@ -546,10 +546,10 @@
if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT || if ( bbox_mode == FT_GLYPH_BBOX_GRIDFIT ||
bbox_mode == FT_GLYPH_BBOX_PIXELS ) bbox_mode == FT_GLYPH_BBOX_PIXELS )
{ {
acbox->xMin &= -64; acbox->xMin = FT_PIX_FLOOR( acbox->xMin );
acbox->yMin &= -64; acbox->yMin = FT_PIX_FLOOR( acbox->yMin );
acbox->xMax = ( acbox->xMax + 63 ) & -64; acbox->xMax = FT_PIX_CEIL( acbox->xMax );
acbox->yMax = ( acbox->yMax + 63 ) & -64; acbox->yMax = FT_PIX_CEIL( acbox->yMax );
} }
/* convert to integer pixels if needed */ /* convert to integer pixels if needed */

View File

@ -1977,17 +1977,17 @@
{ {
/* 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_PIX_CEIL( FT_MulFix( face->ascender,
metrics->y_scale ) + 63 ) & -64; metrics->y_scale ) );
metrics->descender = ( FT_MulFix( face->descender, metrics->descender = FT_PIX_FLOOR( FT_MulFix( face->descender,
metrics->y_scale ) + 0 ) & -64; metrics->y_scale ) );
metrics->height = ( FT_MulFix( face->height, metrics->height = FT_PIX_ROUND( FT_MulFix( face->height,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) );
metrics->max_advance = ( FT_MulFix( face->max_advance_width, metrics->max_advance = FT_PIX_ROUND( FT_MulFix( face->max_advance_width,
metrics->x_scale ) + 32 ) & -64; metrics->x_scale ) );
} }
@ -2153,8 +2153,8 @@
if ( kern_mode != FT_KERNING_UNFITTED ) if ( kern_mode != FT_KERNING_UNFITTED )
{ {
akerning->x = ( akerning->x + 32 ) & -64; akerning->x = FT_PIX_ROUND( akerning->x );
akerning->y = ( akerning->y + 32 ) & -64; akerning->y = FT_PIX_ROUND( akerning->y );
} }
} }
} }
@ -2516,7 +2516,7 @@
FT_Face face; FT_Face face;
TT_CMapInfo cmap_info; TT_CMapInfo cmap_info;
if ( !charmap || !charmap->face ) if ( !charmap || !charmap->face )
return 0; return 0;

View File

@ -279,7 +279,7 @@
first = last + 1; first = last + 1;
} }
slot->metrics.horiAdvance = ( slot->metrics.horiAdvance + distance*4 ) & -64; slot->metrics.horiAdvance = ( slot->metrics.horiAdvance + distance*4 ) & ~63;
} }

View File

@ -271,9 +271,9 @@
/* round theta */ /* round theta */
if ( theta >= 0 ) if ( theta >= 0 )
theta = ( theta + 16 ) & -32; theta = FT_PAD_ROUND( theta, 32 );
else else
theta = - (( -theta + 16 ) & -32); theta = - FT_PAD_ROUND( -theta, 32 );
vec->x = x; vec->x = x;
vec->y = theta; vec->y = theta;

View File

@ -366,7 +366,7 @@
decoder->num_globals = cff->num_global_subrs; decoder->num_globals = cff->num_global_subrs;
decoder->globals = cff->global_subrs; decoder->globals = cff->global_subrs;
decoder->globals_bias = cff_compute_bias( decoder->num_globals ); decoder->globals_bias = cff_compute_bias( decoder->num_globals );
decoder->hint_mode = hint_mode; decoder->hint_mode = hint_mode;
} }
@ -2488,11 +2488,11 @@
if ( hinting ) if ( hinting )
{ {
metrics->horiAdvance = ( metrics->horiAdvance + 32 ) & -64; metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance );
metrics->vertAdvance = ( metrics->vertAdvance + 32 ) & -64; metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance );
metrics->vertBearingX = ( metrics->vertBearingX + 32 ) & -64; metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX );
metrics->vertBearingY = ( metrics->vertBearingY + 32 ) & -64; metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY );
} }
} }

View File

@ -412,11 +412,11 @@
if ( hinting ) if ( hinting )
{ {
metrics->horiAdvance = ( metrics->horiAdvance + 32 ) & -64; metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance );
metrics->vertAdvance = ( metrics->vertAdvance + 32 ) & -64; metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance );
metrics->vertBearingX = ( metrics->vertBearingX + 32 ) & -64; metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX );
metrics->vertBearingY = ( metrics->vertBearingY + 32 ) & -64; metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY );
} }
} }
@ -426,10 +426,10 @@
/* grid fit the bounding box if necessary */ /* grid fit the bounding box if necessary */
if ( hinting ) if ( hinting )
{ {
cbox.xMin &= -64; cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
cbox.yMin &= -64; cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
cbox.xMax = ( cbox.xMax + 63 ) & -64; cbox.xMax = FT_PIX_CEIL( cbox.xMax );
cbox.yMax = ( cbox.yMax + 63 ) & -64; cbox.yMax = FT_PIX_CEIL( cbox.yMax );
} }
metrics->width = cbox.xMax - cbox.xMin; metrics->width = cbox.xMax - cbox.xMin;

View File

@ -388,7 +388,7 @@
/* reallocate offsets array if needed */ /* reallocate offsets array if needed */
if ( num_subrs + 1 > max_offsets ) if ( num_subrs + 1 > max_offsets )
{ {
FT_UInt new_max = ( num_subrs + 1 + 3 ) & -4; FT_UInt new_max = FT_PAD_CEIL( num_subrs + 1, 4 );
if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) ) if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) )

View File

@ -276,7 +276,7 @@
/* re-allocate array when necessary */ /* re-allocate array when necessary */
if ( count > glyph->max_xy_control ) if ( count > glyph->max_xy_control )
{ {
FT_UInt new_max = ( count + 7 ) & -8; FT_UInt new_max = FT_PAD_CEIL( count, 8 );
if ( FT_RENEW_ARRAY( glyph->x_control, if ( FT_RENEW_ARRAY( glyph->x_control,

View File

@ -365,7 +365,7 @@
/* re-allocate when needed */ /* re-allocate when needed */
if ( phy_font->num_strikes + count > phy_font->max_strikes ) if ( phy_font->num_strikes + count > phy_font->max_strikes )
{ {
FT_UInt new_max = ( phy_font->num_strikes + count + 3 ) & -4; FT_UInt new_max = FT_PAD_CEIL( phy_font->num_strikes + count, 4 );
if ( FT_RENEW_ARRAY( phy_font->strikes, if ( FT_RENEW_ARRAY( phy_font->strikes,

View File

@ -635,7 +635,7 @@
glyph->root.metrics.height = (FT_Long)ysize << 6; glyph->root.metrics.height = (FT_Long)ysize << 6;
glyph->root.metrics.horiBearingX = xpos << 6; glyph->root.metrics.horiBearingX = xpos << 6;
glyph->root.metrics.horiBearingY = ypos << 6; glyph->root.metrics.horiBearingY = ypos << 6;
glyph->root.metrics.horiAdvance = ( ( advance >> 2 ) + 32 ) & -64; glyph->root.metrics.horiAdvance = FT_PIX_ROUND( ( advance >> 2 ) );
glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1; glyph->root.metrics.vertBearingX = - glyph->root.metrics.width >> 1;
glyph->root.metrics.vertBearingY = 0; glyph->root.metrics.vertBearingY = 0;
glyph->root.metrics.vertAdvance = size->root.metrics.height; glyph->root.metrics.vertAdvance = size->root.metrics.height;

View File

@ -181,7 +181,7 @@
/* increase size by 25% and round up to the nearest multiple /* increase size by 25% and round up to the nearest multiple
of 1024 */ of 1024 */
new_size += ( new_size >> 2 ) + 1; new_size += ( new_size >> 2 ) + 1;
new_size = ( new_size + 1023 ) & -1024; new_size = FT_PAD_CEIL( new_size, 1024 );
} }
error = reallocate_t1_table( table, new_size ); error = reallocate_t1_table( table, new_size );

View File

@ -375,11 +375,11 @@
len += delta; len += delta;
} }
else else
len = ( len + 32 ) & -64; len = FT_PIX_ROUND( len );
} }
if ( do_snapping ) if ( do_snapping )
len = ( len + 32 ) & -64; len = FT_PIX_ROUND( len );
return len; return len;
} }
@ -417,8 +417,8 @@
psh_hint_snap_stem_side_delta( FT_Fixed pos, psh_hint_snap_stem_side_delta( FT_Fixed pos,
FT_Fixed len ) FT_Fixed len )
{ {
FT_Fixed delta1 = ( ( pos + 32 ) & -64 ) - pos; FT_Fixed delta1 = FT_PIX_ROUND( pos ) - pos;
FT_Fixed delta2 = ( ( pos + len + 32 ) & -64 ) - pos - len; FT_Fixed delta2 = FT_PIX_ROUND( pos + len ) - pos - len;
if ( ABS( delta1 ) <= ABS( delta2 ) ) if ( ABS( delta1 ) <= ABS( delta2 ) )
@ -534,10 +534,10 @@
* around the nearest pixel center * around the nearest pixel center
*/ */
#if 1 #if 1
pos = ( pos + ( len >> 1 ) ) & -64; pos = FT_PIX_FLOOR( pos + ( len >> 1 ) );
#else #else
/* this seems to be a bug! */ /* this seems to be a bug! */
pos = ( pos + ( ( len >> 1 ) & -64 ) ); pos = pos + FT_PIX_FLOOR( len >> 1 );
#endif #endif
len = 64; len = 64;
} }
@ -562,7 +562,7 @@
if ( len < 64 ) if ( len < 64 )
len = 64; len = 64;
else else
len = ( len + 32 ) & -64; len = FT_PIX_ROUND( len );
switch ( align.align ) switch ( align.align )
{ {
@ -583,9 +583,9 @@
default: default:
hint->cur_len = len; hint->cur_len = len;
if ( len & 64 ) if ( len & 64 )
pos = ( ( pos + ( len >> 1 ) ) & -64 ) + 32; pos = FT_PIX_FLOOR( pos + ( len >> 1 ) ) + 32;
else else
pos = ( pos + ( len >> 1 ) + 32 ) & -64; pos = FT_PIX_ROUND( pos + ( len >> 1 ) );
hint->cur_pos = pos - ( len >> 1 ); hint->cur_pos = pos - ( len >> 1 );
hint->cur_len = len; hint->cur_len = len;
@ -739,13 +739,13 @@
if ( ( len / 64 ) & 1 ) if ( ( len / 64 ) & 1 )
{ {
delta_a = ( center & -64 ) + 32 - center; delta_a = FT_PIX_FLOOR( center ) + 32 - center;
delta_b = ( ( center + 32 ) & - 64 ) - center; delta_b = FT_PIX_ROUND( center ) - center;
} }
else else
{ {
delta_a = ( ( center + 32 ) & - 64 ) - center; delta_a = FT_PIX_ROUND( center ) - center;
delta_b = ( center & -64 ) + 32 - center; delta_b = FT_PIX_FLOOR( center ) + 32 - center;
} }
/* We choose between B) and C) above based on the amount /* We choose between B) and C) above based on the amount
@ -762,7 +762,6 @@
FT_Fixed side_delta = psh_hint_snap_stem_side_delta ( pos, FT_Fixed side_delta = psh_hint_snap_stem_side_delta ( pos,
len ); len );
if ( ABS( side_delta ) < ABS( delta_b ) ) if ( ABS( side_delta ) < ABS( delta_b ) )
pos += side_delta; pos += side_delta;
else else
@ -1940,7 +1939,7 @@
scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale ); scaled = FT_MulFix( globals->blues.normal_top.zones->org_ref, y_scale );
fitted = ( scaled + 32 ) & -64; fitted = FT_PIX_ROUND( scaled );
if (scaled != fitted ) { if (scaled != fitted ) {
y_scale = FT_MulDiv( y_scale, fitted, scaled ); y_scale = FT_MulDiv( y_scale, fitted, scaled );

View File

@ -448,7 +448,7 @@
zone->cur_delta = FT_MulFix( zone->org_delta, scale ); zone->cur_delta = FT_MulFix( zone->org_delta, scale );
/* round scaled reference position */ /* round scaled reference position */
zone->cur_ref = ( zone->cur_ref + 32 ) & -64; zone->cur_ref = FT_PIX_ROUND( zone->cur_ref );
#if 0 #if 0
if ( zone->cur_ref > zone->cur_top ) if ( zone->cur_ref > zone->cur_top )
@ -654,7 +654,7 @@
write->org = priv->standard_height[0]; write->org = priv->standard_height[0];
write++; write++;
read = priv->snap_heights; read = priv->snap_heights;
for ( count = priv->num_snap_heights; count > 0; count-- ) for ( count = priv->num_snap_heights; count > 0; count-- )
{ {

View File

@ -68,7 +68,7 @@
if ( new_max > old_max ) if ( new_max > old_max )
{ {
/* try to grow the table */ /* try to grow the table */
new_max = ( new_max + 7 ) & -8; new_max = FT_PAD_CEIL( new_max, 8 );
if ( !FT_RENEW_ARRAY( table->hints, old_max, new_max ) ) if ( !FT_RENEW_ARRAY( table->hints, old_max, new_max ) )
table->max_hints = new_max; table->max_hints = new_max;
} }
@ -142,7 +142,7 @@
if ( new_max > old_max ) if ( new_max > old_max )
{ {
new_max = ( new_max + 7 ) & -8; new_max = FT_PAD_CEIL( new_max, 8 );
if ( !FT_RENEW_ARRAY( mask->bytes, old_max, new_max ) ) if ( !FT_RENEW_ARRAY( mask->bytes, old_max, new_max ) )
mask->max_bits = new_max * 8; mask->max_bits = new_max * 8;
} }
@ -239,7 +239,7 @@
if ( new_max > old_max ) if ( new_max > old_max )
{ {
new_max = ( new_max + 7 ) & -8; new_max = FT_PAD_CEIL( new_max, 8 );
if ( !FT_RENEW_ARRAY( table->masks, old_max, new_max ) ) if ( !FT_RENEW_ARRAY( table->masks, old_max, new_max ) )
table->max_masks = new_max; table->max_masks = new_max;
} }
@ -1012,7 +1012,7 @@
FT_ERROR(( "ps_hints_t2mask: " FT_ERROR(( "ps_hints_t2mask: "
"called with invalid bitcount %d (instead of %d)\n", "called with invalid bitcount %d (instead of %d)\n",
bit_count, count1 + count2 )); bit_count, count1 + count2 ));
/* simply ignore the operator */ /* simply ignore the operator */
return; return;
} }
@ -1057,7 +1057,7 @@
FT_ERROR(( "ps_hints_t2counter: " FT_ERROR(( "ps_hints_t2counter: "
"called with invalid bitcount %d (instead of %d)\n", "called with invalid bitcount %d (instead of %d)\n",
bit_count, count1 + count2 )); bit_count, count1 + count2 ));
/* simply ignore the operator */ /* simply ignore the operator */
return; return;
} }

View File

@ -140,10 +140,10 @@
/* compute the control box, and grid fit it */ /* compute the control box, and grid fit it */
FT_Outline_Get_CBox( outline, &cbox ); FT_Outline_Get_CBox( outline, &cbox );
cbox.xMin &= -64; cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
cbox.yMin &= -64; cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
cbox.xMax = ( cbox.xMax + 63 ) & -64; cbox.xMax = FT_PIX_CEIL( cbox.xMax );
cbox.yMax = ( cbox.yMax + 63 ) & -64; cbox.yMax = FT_PIX_CEIL( cbox.yMax );
width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
@ -161,7 +161,7 @@
if ( !( mode & FT_RENDER_MODE_MONO ) ) if ( !( mode & FT_RENDER_MODE_MONO ) )
{ {
/* we pad to 32 bits, only for backwards compatibility with FT 1.x */ /* we pad to 32 bits, only for backwards compatibility with FT 1.x */
pitch = ( width + 3 ) & -4; pitch = FT_PAD_CEIL( width, 4 );
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
bitmap->num_grays = 256; bitmap->num_grays = 256;
} }
@ -193,9 +193,9 @@
/* render outline into the bitmap */ /* render outline into the bitmap */
error = render->raster_render( render->raster, &params ); error = render->raster_render( render->raster, &params );
FT_Outline_Translate( outline, cbox.xMin, cbox.yMin ); FT_Outline_Translate( outline, cbox.xMin, cbox.yMin );
if ( error ) if ( error )
goto Exit; goto Exit;

View File

@ -393,7 +393,7 @@
{ {
/* a 16-bit character code */ /* a 16-bit character code */
p += char_hi * 2; /* jump to key entry */ p += char_hi * 2; /* jump to key entry */
sub = subs + ( TT_PEEK_USHORT( p ) & -8 ); /* jump to sub-header */ sub = subs + ( FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 8 ) ); /* jump to sub-header */
/* check that the hi byte isn't a valid one-byte value */ /* check that the hi byte isn't a valid one-byte value */
if ( sub == subs ) if ( sub == subs )
@ -481,7 +481,7 @@
pos = (FT_UInt)( char_lo - start ); pos = (FT_UInt)( char_lo - start );
p += offset + pos * 2; p += offset + pos * 2;
charcode = ( charcode & -256 ) + char_lo; charcode = FT_PAD_FLOOR( charcode, 256 ) + char_lo;
for ( ; pos < count; pos++, charcode++ ) for ( ; pos < count; pos++, charcode++ )
{ {
@ -501,7 +501,7 @@
/* jump to next sub-header, i.e. higher byte value */ /* jump to next sub-header, i.e. higher byte value */
Next_SubHeader: Next_SubHeader:
charcode = ( charcode & -256 ) + 256; charcode = FT_PAD_FLOOR( charcode, 256 ) + 256;
} }
Exit: Exit:
@ -795,7 +795,7 @@
p = table + 6; p = table + 6;
num_segs2 = TT_PEEK_USHORT( p ) & -2; /* be paranoid! */ num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 ); /* be paranoid! */
#if 1 #if 1
/* Some fonts have more than 170 segments in their charmaps! */ /* Some fonts have more than 170 segments in their charmaps! */
@ -918,7 +918,7 @@
code = (FT_UInt)char_code + 1; code = (FT_UInt)char_code + 1;
p = table + 6; p = table + 6;
num_segs2 = TT_PEEK_USHORT(p) & -2; /* ensure even-ness */ num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT(p), 2 ); /* ensure even-ness */
#if 1 #if 1

View File

@ -132,10 +132,10 @@
/* compute the control box, and grid fit it */ /* compute the control box, and grid fit it */
FT_Outline_Get_CBox( outline, &cbox ); FT_Outline_Get_CBox( outline, &cbox );
cbox.xMin &= -64; cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
cbox.yMin &= -64; cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
cbox.xMax = ( cbox.xMax + 63 ) & -64; cbox.xMax = FT_PIX_CEIL( cbox.xMax );
cbox.yMax = ( cbox.yMax + 63 ) & -64; cbox.yMax = FT_PIX_CEIL( cbox.yMax );
width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );
@ -154,7 +154,7 @@
if ( hmul ) if ( hmul )
{ {
width = width * hmul; width = width * hmul;
pitch = ( width + 3 ) & -4; pitch = FT_PAD_CEIL( width, 4 );
} }
if ( vmul ) if ( vmul )

View File

@ -208,8 +208,8 @@
/* we need to use rounding in the following computations. Otherwise, /* we need to use rounding in the following computations. Otherwise,
* the resulting hinted outlines will be very slightly distorted * the resulting hinted outlines will be very slightly distorted
*/ */
dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & -64; dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & ~63;
dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64; dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & ~63;
} }
else else
{ {

View File

@ -690,12 +690,12 @@
FT_Pos x = zone->org[n_points-2].x; FT_Pos x = zone->org[n_points-2].x;
x = ( ( x + 32 ) & -64 ) - x; x = FT_PIX_ROUND( x ) - x;
translate_array( n_points, zone->org, x, 0 ); translate_array( n_points, zone->org, x, 0 );
org_to_cur( n_points, zone ); org_to_cur( n_points, zone );
zone->cur[n_points - 1].x = ( zone->cur[n_points - 1].x + 32 ) & -64; zone->cur[n_points - 1].x = FT_PIX_ROUND( zone->cur[n_points - 1].x );
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@ -1202,8 +1202,8 @@
if ( subglyph->flags & ROUND_XY_TO_GRID ) if ( subglyph->flags & ROUND_XY_TO_GRID )
{ {
x = ( x + 32 ) & -64; x = FT_PIX_ROUND( x );
y = ( y + 32 ) & -64; y = FT_PIX_ROUND( y );
} }
} }
} }
@ -1296,8 +1296,8 @@
/* if hinting, round the phantom points */ /* if hinting, round the phantom points */
if ( IS_HINTED( loader->load_flags ) ) if ( IS_HINTED( loader->load_flags ) )
{ {
pp1[0].x = ( ( loader->pp1.x + 32 ) & -64 ); pp1[0].x = FT_PIX_ROUND( loader->pp1.x );
pp1[1].x = ( ( loader->pp2.x + 32 ) & -64 ); pp1[1].x = FT_PIX_ROUND( loader->pp2.x );
} }
{ {
@ -1390,10 +1390,10 @@
if ( IS_HINTED( loader->load_flags ) ) if ( IS_HINTED( loader->load_flags ) )
{ {
/* grid-fit the bounding box */ /* grid-fit the bounding box */
bbox.xMin &= -64; bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
bbox.yMin &= -64; bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
bbox.xMax = ( bbox.xMax + 63 ) & -64; bbox.xMax = FT_PIX_CEIL( bbox.xMax );
bbox.yMax = ( bbox.yMax + 63 ) & -64; bbox.yMax = FT_PIX_CEIL( bbox.yMax );
} }
} }
else else
@ -1425,7 +1425,7 @@
/* don't forget to hint the advance when we need to */ /* don't forget to hint the advance when we need to */
if ( IS_HINTED( loader->load_flags ) ) if ( IS_HINTED( loader->load_flags ) )
glyph->metrics.horiAdvance = ( glyph->metrics.horiAdvance + 32 ) & -64; glyph->metrics.horiAdvance = FT_PIX_ROUND( glyph->metrics.horiAdvance );
/* Now take care of vertical metrics. In the case where there is */ /* Now take care of vertical metrics. In the case where there is */
/* no vertical information within the font (relatively common), make */ /* no vertical information within the font (relatively common), make */
@ -1538,9 +1538,9 @@
/* grid-fit them if necessary */ /* grid-fit them if necessary */
if ( IS_HINTED( loader->load_flags ) ) if ( IS_HINTED( loader->load_flags ) )
{ {
left &= -64; left = FT_PIX_FLOOR( left );
top = ( top + 63 ) & -64; top = FT_PIX_CEIL( top );
advance = ( advance + 32 ) & -64; advance = FT_PIX_ROUND( advance );
} }
glyph->metrics.vertBearingX = left; glyph->metrics.vertBearingX = left;

View File

@ -1781,7 +1781,7 @@
} }
else else
{ {
val = -( ( compensation - distance + 32 ) & -64 ); val = -FT_PIX_ROUND( compensation - distance );
if ( val > 0 ) if ( val > 0 )
val = 0; val = 0;
} }
@ -1817,13 +1817,13 @@
if ( distance >= 0 ) if ( distance >= 0 )
{ {
val = ( ( distance + compensation ) & -64 ) + 32; val = FT_PIX_FLOOR( distance + compensation ) + 32;
if ( distance && val < 0 ) if ( distance && val < 0 )
val = 0; val = 0;
} }
else else
{ {
val = -( ( (compensation - distance) & -64 ) + 32 ); val = -( FT_PIX_FLOOR( compensation - distance ) + 32 );
if ( val > 0 ) if ( val > 0 )
val = 0; val = 0;
} }
@ -1911,7 +1911,7 @@
} }
else else
{ {
val = -( ( compensation - distance + 63 ) & -64 ); val = - FT_PIX_CEIL( compensation - distance );
if ( val > 0 ) if ( val > 0 )
val = 0; val = 0;
} }
@ -1955,7 +1955,7 @@
} }
else else
{ {
val = -( ( compensation - distance + 16 ) & -32 ); val = -FT_PAD_ROUND( compensation - distance, 32 );
if ( val > 0 ) if ( val > 0 )
val = 0; val = 0;
} }
@ -2994,11 +2994,11 @@
#define DO_FLOOR \ #define DO_FLOOR \
args[0] &= -64; args[0] = FT_PIX_FLOOR( args[0] );
#define DO_CEILING \ #define DO_CEILING \
args[0] = ( args[0] + 63 ) & -64; args[0] = FT_PIX_CEIL( args[0] );
#define DO_RS \ #define DO_RS \
@ -5288,7 +5288,7 @@
{ {
*x = 0; *x = 0;
*y = d; *y = d;
} }
} }
else else
#endif #endif

View File

@ -12,7 +12,7 @@
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
/* */ /* s */
/***************************************************************************/ /***************************************************************************/
@ -590,14 +590,14 @@
} }
/* Compute root ascender, descender, text height, and max_advance */ /* Compute root ascender, descender, text height, and max_advance */
metrics->ascender = ( FT_MulFix( face->root.ascender, metrics->ascender = FT_PIX_ROUND( FT_MulFix( face->root.ascender,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) );
metrics->descender = ( FT_MulFix( face->root.descender, metrics->descender = FT_PIX_ROUND( FT_MulFix( face->root.descender,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) );
metrics->height = ( FT_MulFix( face->root.height, metrics->height = FT_PIX_ROUND( FT_MulFix( face->root.height,
metrics->y_scale ) + 32 ) & -64; metrics->y_scale ) );
metrics->max_advance = ( FT_MulFix( face->root.max_advance_width, metrics->max_advance = FT_PIX_ROUND( FT_MulFix( face->root.max_advance_width,
metrics->x_scale ) + 32 ) & -64; metrics->x_scale ) );
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
@ -748,7 +748,8 @@
sbit_metrics->descender = strike->hori.descender << 6; sbit_metrics->descender = strike->hori.descender << 6;
/* XXX: Is this correct? */ /* XXX: Is this correct? */
sbit_metrics->height = sbit_metrics->ascender - sbit_metrics->descender; sbit_metrics->height = sbit_metrics->ascender -
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 +

View File

@ -121,7 +121,7 @@
FT_UInt glyph_index ) FT_UInt glyph_index )
{ {
FT_Data glyph_data; FT_Data glyph_data;
FT_Error error = T1_Parse_Glyph_And_Get_Char_String( FT_Error error = T1_Parse_Glyph_And_Get_Char_String(
decoder, glyph_index, &glyph_data ); decoder, glyph_index, &glyph_data );
@ -187,7 +187,7 @@
error = T1_Parse_Glyph( &decoder, glyph_index ); error = T1_Parse_Glyph( &decoder, glyph_index );
if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance ) if ( glyph_index == 0 || decoder.builder.advance.x > *max_advance )
*max_advance = decoder.builder.advance.x; *max_advance = decoder.builder.advance.x;
/* ignore the error if one occurred - skip to next glyph */ /* ignore the error if one occurred - skip to next glyph */
} }
@ -374,11 +374,11 @@
if ( hinting ) if ( hinting )
{ {
metrics->horiAdvance = ( metrics->horiAdvance + 32 ) & -64; metrics->horiAdvance = FT_PIX_ROUND( metrics->horiAdvance );
metrics->vertAdvance = ( metrics->vertAdvance + 32 ) & -64; metrics->vertAdvance = FT_PIX_ROUND( metrics->vertAdvance );
metrics->vertBearingX = ( metrics->vertBearingX + 32 ) & -64; metrics->vertBearingX = FT_PIX_ROUND( metrics->vertBearingX );
metrics->vertBearingY = ( metrics->vertBearingY + 32 ) & -64; metrics->vertBearingY = FT_PIX_ROUND( metrics->vertBearingY );
} }
} }
@ -388,10 +388,10 @@
/* grid fit the bounding box if necessary */ /* grid fit the bounding box if necessary */
if ( hinting ) if ( hinting )
{ {
cbox.xMin &= -64; cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
cbox.yMin &= -64; cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
cbox.xMax = ( cbox.xMax+63 ) & -64; cbox.xMax = FT_PIX_CEIL( cbox.xMax );
cbox.yMax = ( cbox.yMax+63 ) & -64; cbox.yMax = FT_PIX_CEIL( cbox.yMax );
} }
metrics->width = cbox.xMax - cbox.xMin; metrics->width = cbox.xMax - cbox.xMin;