@ -56,6 +56,7 @@
# define USE_MY_METRICS 0x200
/*************************************************************************/
/* */
/* <Function> */
@ -83,12 +84,12 @@
/* */
LOCAL_FUNC
void TT_Get_Metrics ( TT_HoriHeader * header ,
T T_UInt index ,
T T_Short* bearing ,
T T_UShort* advance )
F T_UInt index ,
F T_Short* bearing ,
F T_UShort* advance )
{
TT_LongMetrics * longs_m ;
T T_UShort k = header - > number_Of_HMetrics ;
F T_UShort k = header - > number_Of_HMetrics ;
if ( index < k )
@ -113,10 +114,10 @@
/* */
static
void Get_HMetrics ( TT_Face face ,
T T_UInt index ,
T T_Bool check ,
T T_Short* lsb ,
T T_UShort* aw )
F T_UInt index ,
F T_Bool check ,
F T_Short* lsb ,
F T_UShort* aw )
{
TT_Get_Metrics ( & face - > horizontal , index , lsb , aw ) ;
@ -131,11 +132,10 @@
/* found in the font's `hdmx' table (if any). */
/* */
static
T T_Byte* Get_Advance_Widths ( TT_Face face ,
T T_UShort ppem )
F T_Byte* Get_Advance_Widths ( TT_Face face ,
F T_UShort ppem )
{
TT_UShort n ;
FT_UShort n ;
for ( n = 0 ; n < face - > hdmx . num_records ; n + + )
if ( face - > hdmx . records [ n ] . ppem = = ppem )
@ -146,10 +146,10 @@
# define cur_to_org( n, zone ) \
MEM_Copy ( ( zone ) - > org , ( zone ) - > cur , n * sizeof ( T T_Vector ) )
MEM_Copy ( ( zone ) - > org , ( zone ) - > cur , n * sizeof ( F T_Vector ) )
# define org_to_cur( n, zone ) \
MEM_Copy ( ( zone ) - > cur , ( zone ) - > org , n * sizeof ( T T_Vector ) )
MEM_Copy ( ( zone ) - > cur , ( zone ) - > org , n * sizeof ( F T_Vector ) )
/*************************************************************************/
@ -157,13 +157,12 @@
/* Translates an array of coordinates. */
/* */
static
void translate_array ( T T_UInt n ,
T T_Vector* coords ,
T T_Pos delta_x ,
T T_Pos delta_y )
void translate_array ( F T_UInt n ,
F T_Vector* coords ,
F T_Pos delta_x ,
F T_Pos delta_y )
{
TT_UInt k ;
FT_UInt k ;
if ( delta_x )
for ( k = 0 ; k < n ; k + + )
@ -181,12 +180,11 @@
/* assemble composite glyphs. */
/* */
static
void mount_zone ( F T_GlyphZone* source ,
F T_GlyphZone* target )
void mount_zone ( T T_GlyphZone* source ,
T T_GlyphZone* target )
{
TT_UInt np ;
TT_Int nc ;
FT_UInt np ;
FT_Int nc ;
np = source - > n_points ;
nc = source - > n_contours ;
@ -217,18 +215,18 @@
/* glyphs elements will be loaded with this routine. */
/* */
static
T T_Error Load_Simple ( TT_Loader * load ,
T T_UInt byte_count ,
T T_Int n_contours ,
T T_Bool debug )
F T_Error Load_Simple ( TT_Loader * load ,
F T_UInt byte_count ,
F T_Int n_contours ,
F T_Bool debug )
{
T T_Error error ;
F T_Error error ;
FT_Stream stream = load - > stream ;
F T_GlyphZone* zone = & load - > zone ;
T T_GlyphZone* zone = & load - > zone ;
TT_Face face = load - > face ;
T T_UShort n_ins ;
T T_Int n , n_points ;
F T_UShort n_ins ;
F T_Int n , n_points ;
/* simple check */
@ -304,9 +302,9 @@
/* reading the point tags */
{
T T_Byte* flag = load - > zone . tags ;
T T_Byte* limit = flag + n_points ;
T T_Byte c , count ;
F T_Byte* flag = load - > zone . tags ;
F T_Byte* limit = flag + n_points ;
F T_Byte c , count ;
for ( ; flag < limit ; flag + + )
@ -323,15 +321,15 @@
/* reading the X coordinates */
{
T T_Vector* vec = zone - > org ;
T T_Vector* limit = vec + n_points ;
T T_Byte* flag = zone - > tags ;
T T_Pos x = 0 ;
F T_Vector* vec = zone - > org ;
F T_Vector* limit = vec + n_points ;
F T_Byte* flag = zone - > tags ;
F T_Pos x = 0 ;
for ( ; vec < limit ; vec + + , flag + + )
{
T T_Pos y = 0 ;
F T_Pos y = 0 ;
if ( * flag & 2 )
@ -351,15 +349,15 @@
/* reading the Y coordinates */
{
T T_Vector* vec = zone - > org ;
T T_Vector* limit = vec + n_points ;
T T_Byte* flag = zone - > tags ;
T T_Pos x = 0 ;
F T_Vector* vec = zone - > org ;
F T_Vector* limit = vec + n_points ;
F T_Byte* flag = zone - > tags ;
F T_Pos x = 0 ;
for ( ; vec < limit ; vec + + , flag + + )
{
T T_Pos y = 0 ;
F T_Pos y = 0 ;
if ( * flag & 4 )
@ -384,8 +382,8 @@
/* We need the left side bearing and advance width. */
{
T T_Vector* pp1 ;
T T_Vector* pp2 ;
F T_Vector* pp1 ;
F T_Vector* pp2 ;
/* pp1 = xMin - lsb */
@ -422,10 +420,10 @@
}
else
{
T T_Vector* vec = zone - > org ;
T T_Vector* limit = vec + n_points ;
T T_Fixed x_scale = load - > size - > root . metrics . x_scale ;
T T_Fixed y_scale = load - > size - > root . metrics . y_scale ;
F T_Vector* vec = zone - > org ;
F T_Vector* limit = vec + n_points ;
F T_Fixed x_scale = load - > size - > root . metrics . x_scale ;
F T_Fixed y_scale = load - > size - > root . metrics . y_scale ;
/* first scale the glyph points */
@ -442,7 +440,7 @@
}
else
{
T T_Pos x = zone - > org [ n_points - 2 ] . x ;
F T_Pos x = zone - > org [ n_points - 2 ] . x ;
x = ( ( x + 32 ) & - 64 ) - x ;
@ -457,7 +455,7 @@
if ( n_ins > 0 )
{
load - > exec - > is_composite = FALSE ;
load - > exec - > pedantic_hinting = ( T T_Bool) ( load - > load_flags &
load - > exec - > pedantic_hinting = ( F T_Bool) ( load - > load_flags &
FT_LOAD_PEDANTIC ) ;
load - > exec - > pts = * zone ;
load - > exec - > pts . n_points + = 2 ;
@ -495,22 +493,22 @@
/* TT_Loader object. */
/* */
static
T T_Error load_truetype_glyph ( TT_Loader * loader ,
T T_UInt glyph_index )
F T_Error load_truetype_glyph ( TT_Loader * loader ,
F T_UInt glyph_index )
{
FT_Stream stream = loader - > stream ;
T T_Error error ;
F T_Error error ;
TT_Face face = loader - > face ;
T T_ULong offset ;
T T_Int num_subglyphs = 0 , contours_count ;
T T_UInt index , num_points , num_contours , count ;
T T_Fixed x_scale , y_scale ;
T T_ULong ins_offset ;
F T_ULong offset ;
F T_Int num_subglyphs = 0 , contours_count ;
F T_UInt index , num_points , num_contours , count ;
F T_Fixed x_scale , y_scale ;
F T_ULong ins_offset ;
/* check glyph index */
index = glyph_index ;
if ( index > = ( T T_UInt) face - > root . num_glyphs )
if ( index > = ( F T_UInt) face - > root . num_glyphs )
{
error = TT_Err_Invalid_Glyph_Index ;
goto Fail ;
@ -531,12 +529,12 @@
/* get horizontal metrics */
{
T T_Short left_bearing ;
T T_UShort advance_width ;
F T_Short left_bearing ;
F T_UShort advance_width ;
Get_HMetrics ( face , index ,
( T T_Bool) ! ( loader - > load_flags &
( F T_Bool) ! ( loader - > load_flags &
FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) ,
& left_bearing ,
& advance_width ) ;
@ -549,7 +547,7 @@
offset = face - > glyph_locations [ index ] ;
count = 0 ;
if ( index < ( T T_UInt) face - > num_locations - 1 )
if ( index < ( F T_UInt) face - > num_locations - 1 )
count = face - > glyph_locations [ index + 1 ] - offset ;
if ( count = = 0 )
@ -624,14 +622,14 @@
if ( contours_count > = 0 )
{
T T_UInt num_base_points ;
F T_UInt num_base_points ;
# ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
error = Load_Simple ( loader ,
count ,
contours_count ,
( T T_Bool) ( loader - > size & &
( F T_Bool) ( loader - > size & &
loader - > size - > debug ) ) ;
# else
error = Load_Simple ( loader , count , contours_count , 0 ) ;
@ -646,7 +644,7 @@
num_base_points = loader - > base . n_points ;
{
T T_UInt k ;
F T_UInt k ;
for ( k = 0 ; k < num_contours ; k + + )
@ -680,8 +678,8 @@
num_subglyphs = 0 ;
do
{
T T_Fixed xx , xy , yy , yx ;
T T_UInt total_subglyphs ;
F T_Fixed xx , xy , yy , yx ;
F T_UInt total_subglyphs ;
/* grow the `glyph->subglyphs' table if necessary */
@ -689,7 +687,7 @@
if ( total_subglyphs > = glyph - > max_subglyphs )
{
T T_UInt new_max = glyph - > max_subglyphs ;
F T_UInt new_max = glyph - > max_subglyphs ;
FT_Memory memory = loader - > face - > root . memory ;
@ -727,20 +725,20 @@
if ( subglyph - > flags & WE_HAVE_A_SCALE )
{
xx = ( T T_Fixed) GET_Short ( ) < < 2 ;
xx = ( F T_Fixed) GET_Short ( ) < < 2 ;
yy = xx ;
}
else if ( subglyph - > flags & WE_HAVE_AN_XY_SCALE )
{
xx = ( T T_Fixed) GET_Short ( ) < < 2 ;
yy = ( T T_Fixed) GET_Short ( ) < < 2 ;
xx = ( F T_Fixed) GET_Short ( ) < < 2 ;
yy = ( F T_Fixed) GET_Short ( ) < < 2 ;
}
else if ( subglyph - > flags & WE_HAVE_A_2X2 )
{
xx = ( T T_Fixed) GET_Short ( ) < < 2 ;
xy = ( T T_Fixed) GET_Short ( ) < < 2 ;
yx = ( T T_Fixed) GET_Short ( ) < < 2 ;
yy = ( T T_Fixed) GET_Short ( ) < < 2 ;
xx = ( F T_Fixed) GET_Short ( ) < < 2 ;
xy = ( F T_Fixed) GET_Short ( ) < < 2 ;
yx = ( F T_Fixed) GET_Short ( ) < < 2 ;
yy = ( F T_Fixed) GET_Short ( ) < < 2 ;
}
subglyph - > transform . xx = xx ;
@ -784,7 +782,7 @@
/*********************************************************************/
/* Now, read each subglyph independently.. */
{
T T_Int n , num_base_points , num_new_points ;
F T_Int n , num_base_points , num_new_points ;
subglyph = glyph - > subglyphs + glyph - > num_subglyphs ;
glyph - > num_subglyphs + = num_subglyphs ;
@ -792,8 +790,8 @@
for ( n = 0 ; n < num_subglyphs ; n + + , subglyph + + )
{
T T_Vector pp1 , pp2 ;
T T_Pos x , y ;
F T_Vector pp1 , pp2 ;
F T_Pos x , y ;
pp1 = loader - > pp1 ;
@ -827,14 +825,14 @@
WE_HAVE_AN_XY_SCALE |
WE_HAVE_A_2X2 ) )
{
T T_Vector* cur = loader - > zone . cur ;
T T_Vector* org = loader - > zone . org ;
T T_Vector* limit = cur + num_new_points ;
F T_Vector* cur = loader - > zone . cur ;
F T_Vector* org = loader - > zone . org ;
F T_Vector* limit = cur + num_new_points ;
for ( ; cur < limit ; cur + + , org + + )
{
T T_Pos nx , ny ;
F T_Pos nx , ny ;
nx = FT_MulFix ( cur - > x , subglyph - > transform . xx ) +
@ -861,12 +859,12 @@
if ( ! ( subglyph - > flags & ARGS_ARE_XY_VALUES ) )
{
T T_Int k = subglyph - > arg1 ;
T T_UInt l = subglyph - > arg2 ;
F T_Int k = subglyph - > arg1 ;
F T_UInt l = subglyph - > arg2 ;
if ( k > = num_base_points | |
l > = ( T T_UInt) num_new_points )
l > = ( F T_UInt) num_new_points )
{
error = TT_Err_Invalid_Composite ;
goto Fail ;
@ -913,11 +911,11 @@
loader - > exec & &
subglyph - > flags & WE_HAVE_INSTR )
{
T T_UShort n_ins ;
F T_UShort n_ins ;
TT_ExecContext exec = loader - > exec ;
T T_UInt n_points = loader - > base . n_points ;
F T_GlyphZone* pts ;
T T_Vector* pp1 ;
F T_UInt n_points = loader - > base . n_points ;
T T_GlyphZone* pts ;
F T_Vector* pp1 ;
/* read size of instructions */
@ -973,7 +971,7 @@
}
{
T T_UInt k ;
F T_UInt k ;
for ( k = 0 ; k < n_points ; k + + )
@ -987,7 +985,7 @@
{
exec - > is_composite = TRUE ;
exec - > pedantic_hinting =
( T T_Bool) ( loader - > load_flags & FT_LOAD_PEDANTIC ) ;
( F T_Bool) ( loader - > load_flags & FT_LOAD_PEDANTIC ) ;
error = TT_Run_Context ( exec , loader - > size - > debug ) ;
if ( error & & exec - > pedantic_hinting )
@ -1018,13 +1016,13 @@
static
void compute_glyph_metrics ( TT_Loader * loader ,
T T_UInt glyph_index )
F T_UInt glyph_index )
{
T T_UInt num_points = loader - > base . n_points ;
T T_UInt num_contours = loader - > base . n_contours ;
T T_BBox bbox ;
F T_UInt num_points = loader - > base . n_points ;
F T_UInt num_contours = loader - > base . n_contours ;
F T_BBox bbox ;
TT_Face face = loader - > face ;
T T_Fixed x_scale , y_scale ;
F T_Fixed x_scale , y_scale ;
TT_GlyphSlot glyph = loader - > glyph ;
TT_Size size = loader - > size ;
@ -1048,7 +1046,7 @@
if ( glyph - > format ! = ft_glyph_format_composite )
{
T T_UInt u ;
F T_UInt u ;
for ( u = 0 ; u < num_points + 2 ; u + + )
@ -1065,7 +1063,7 @@
glyph - > outline . n_contours = num_contours ;
/* translate array so that (0,0) is the glyph's origin */
translate_array ( ( T T_UShort) ( num_points + 2 ) ,
translate_array ( ( F T_UShort) ( num_points + 2 ) ,
glyph - > outline . points ,
- loader - > pp1 . x ,
0 ) ;
@ -1087,10 +1085,10 @@
/* get the device-independent scaled horizontal metrics; */
/* take care of fixed-pitch fonts... */
{
T T_Pos left_bearing ;
T T_Pos advance ;
F T_Pos left_bearing ;
F T_Pos advance ;
T T_Pos lsb2 , adv2 ;
F T_Pos lsb2 , adv2 ;
left_bearing = loader - > left_bearing ;
@ -1113,8 +1111,8 @@
if ( ! ( loader - > load_flags & FT_LOAD_NO_SCALE ) & &
loader - > load_flags & FT_LOAD_LINEAR )
{
T T_Pos em_size = face - > root . units_per_EM ;
T T_Pos pixel_size = ( T T_Pos) face - > root . size - > metrics . x_ppem < < 16 ;
F T_Pos em_size = face - > root . units_per_EM ;
F T_Pos pixel_size = ( F T_Pos) face - > root . size - > metrics . x_ppem < < 16 ;
lsb2 = FT_MulDiv ( lsb2 , pixel_size , em_size ) ;
@ -1133,13 +1131,13 @@
/* up some metrics by `hand'... */
{
T T_Short top_bearing ; /* vertical top side bearing (EM units) */
T T_UShort advance_height ; /* vertical advance height (EM units) */
F T_Short top_bearing ; /* vertical top side bearing (EM units) */
F T_UShort advance_height ; /* vertical advance height (EM units) */
T T_Pos left ; /* scaled vertical left side bearing */
T T_Pos Top ; /* scaled original vertical top side bearing */
T T_Pos top ; /* scaled vertical top side bearing */
T T_Pos advance ; /* scaled vertical advance height */
F T_Pos left ; /* scaled vertical left side bearing */
F T_Pos Top ; /* scaled original vertical top side bearing */
F T_Pos top ; /* scaled vertical top side bearing */
F T_Pos advance ; /* scaled vertical advance height */
/* Get the unscaled `tsb' and `ah' */
@ -1171,14 +1169,14 @@
if ( face - > os2 . version ! = 0xFFFF )
{
top_bearing = face - > os2 . sTypoLineGap / 2 ;
advance_height = ( T T_UShort) ( face - > os2 . sTypoAscender -
advance_height = ( F T_UShort) ( face - > os2 . sTypoAscender -
face - > os2 . sTypoDescender +
face - > os2 . sTypoLineGap ) ;
}
else
{
top_bearing = face - > horizontal . Line_Gap / 2 ;
advance_height = ( T T_UShort) ( face - > horizontal . Ascender +
advance_height = ( F T_UShort) ( face - > horizontal . Ascender +
face - > horizontal . Descender +
face - > horizontal . Line_Gap ) ;
}
@ -1205,16 +1203,16 @@
/* compute metrics2 fields */
{
T T_Pos vtb2 = top_bearing ;
T T_Pos adv2 = advance_height ;
F T_Pos vtb2 = top_bearing ;
F T_Pos adv2 = advance_height ;
/* scale to 16.16 format if required */
if ( ! ( loader - > load_flags & FT_LOAD_NO_SCALE ) & &
loader - > load_flags & FT_LOAD_LINEAR )
{
T T_Pos em_size = face - > root . units_per_EM ;
T T_Pos pixel_size = face - > root . size - > metrics . y_ppem ;
F T_Pos em_size = face - > root . units_per_EM ;
F T_Pos pixel_size = face - > root . size - > metrics . y_ppem ;
vtb2 = FT_MulDiv ( vtb2 , pixel_size , em_size ) ;
@ -1247,7 +1245,7 @@
if ( ! face - > postscript . isFixedPitch & & size & &
IS_HINTED ( loader - > load_flags ) )
{
T T_Byte* widths = Get_Advance_Widths ( face ,
F T_Byte* widths = Get_Advance_Widths ( face ,
size - > root . metrics . x_ppem ) ;
if ( widths )
glyph - > metrics . horiAdvance = widths [ glyph_index ] < < 6 ;
@ -1257,7 +1255,7 @@
#if 0
# ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
if ( loader - > exec )
glyph - > outline . dropout_mode = ( T T_Char) loader - > exec - > GS . scan_type ;
glyph - > outline . dropout_mode = ( F T_Char) loader - > exec - > GS . scan_type ;
# else
glyph - > outline . dropout_mode = 2 ;
# endif
@ -1298,18 +1296,18 @@
/* TrueType error code. 0 means success. */
/* */
LOCAL_FUNC
T T_Error TT_Load_Glyph ( TT_Size size ,
F T_Error TT_Load_Glyph ( TT_Size size ,
TT_GlyphSlot glyph ,
T T_UShort glyph_index ,
T T_UInt load_flags )
F T_UShort glyph_index ,
F T_UInt load_flags )
{
SFNT_Interface * sfnt ;
TT_Face face ;
FT_Stream stream ;
FT_Memory memory ;
T T_Error error ;
F T_Error error ;
TT_Loader loader ;
F T_GlyphZone* zone ;
T T_GlyphZone* zone ;
face = ( TT_Face ) glyph - > face ;
@ -1352,16 +1350,16 @@
glyph - > outline . n_points = 0 ;
glyph - > outline . n_contours = 0 ;
glyph - > metrics . width = ( T T_Pos) metrics . width < < 6 ;
glyph - > metrics . height = ( T T_Pos) metrics . height < < 6 ;
glyph - > metrics . width = ( F T_Pos) metrics . width < < 6 ;
glyph - > metrics . height = ( F T_Pos) metrics . height < < 6 ;
glyph - > metrics . horiBearingX = ( T T_Pos) metrics . horiBearingX < < 6 ;
glyph - > metrics . horiBearingY = ( T T_Pos) metrics . horiBearingY < < 6 ;
glyph - > metrics . horiAdvance = ( T T_Pos) metrics . horiAdvance < < 6 ;
glyph - > metrics . horiBearingX = ( F T_Pos) metrics . horiBearingX < < 6 ;
glyph - > metrics . horiBearingY = ( F T_Pos) metrics . horiBearingY < < 6 ;
glyph - > metrics . horiAdvance = ( F T_Pos) metrics . horiAdvance < < 6 ;
glyph - > metrics . vertBearingX = ( T T_Pos) metrics . vertBearingX < < 6 ;
glyph - > metrics . vertBearingY = ( T T_Pos) metrics . vertBearingY < < 6 ;
glyph - > metrics . vertAdvance = ( T T_Pos) metrics . vertAdvance < < 6 ;
glyph - > metrics . vertBearingX = ( F T_Pos) metrics . vertBearingX < < 6 ;
glyph - > metrics . vertBearingY = ( F T_Pos) metrics . vertBearingY < < 6 ;
glyph - > metrics . vertAdvance = ( F T_Pos) metrics . vertAdvance < < 6 ;
glyph - > format = ft_glyph_format_bitmap ;
return error ;
@ -1388,7 +1386,7 @@
/* update the glyph zone bounds */
zone = & ( ( TT_Driver ) face - > root . driver ) - > zone ;
error = F T_Update_GlyphZone( zone ,
error = T T_Update_GlyphZone( zone ,
face - > root . max_points ,
face - > root . max_contours ) ;
if ( error )