@ -122,7 +122,7 @@
FT_UInt glyph_index )
{
TT_Face face = loader - > face ;
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
TT_Driver driver = ( TT_Driver ) FT_FACE_DRIVER ( face ) ;
# endif
@ -153,7 +153,7 @@
loader - > top_bearing = top_bearing ;
loader - > vadvance = advance_height ;
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_38 & &
loader - > exec )
{
@ -165,7 +165,7 @@
/* backwards compatibility mode on and off. */
sph_set_tweaks ( loader , glyph_index ) ;
}
# endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
# endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
if ( ! loader - > linear_def )
{
@ -733,7 +733,8 @@
TT_Hint_Glyph ( TT_Loader loader ,
FT_Bool is_composite )
{
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
TT_Face face = loader - > face ;
TT_Driver driver = ( TT_Driver ) FT_FACE_DRIVER ( face ) ;
# endif
@ -816,13 +817,23 @@
# endif
/* save glyph phantom points */
loader - > pp1 = zone - > cur [ zone - > n_points - 4 ] ;
loader - > pp2 = zone - > cur [ zone - > n_points - 3 ] ;
loader - > pp3 = zone - > cur [ zone - > n_points - 2 ] ;
loader - > pp4 = zone - > cur [ zone - > n_points - 1 ] ;
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
/* Save possibly modified glyph phantom points unless in v40 backwards */
/* compatibility mode, where no movement on the x axis means no reason */
/* to change bearings or advance widths. */
if ( ! ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_40 & &
! loader - > exec - > backwards_compatibility ) )
{
# endif
loader - > pp1 = zone - > cur [ zone - > n_points - 4 ] ;
loader - > pp2 = zone - > cur [ zone - > n_points - 3 ] ;
loader - > pp3 = zone - > cur [ zone - > n_points - 2 ] ;
loader - > pp4 = zone - > cur [ zone - > n_points - 1 ] ;
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
}
# endif
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_38 )
{
if ( loader - > exec - > sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN )
@ -831,7 +842,7 @@
else if ( loader - > exec - > sph_tweak_flags & SPH_TWEAK_EMBOLDEN )
FT_Outline_EmboldenXY ( & loader - > gloader - > current . outline , 24 , 0 ) ;
}
# endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
# endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
return FT_Err_Ok ;
}
@ -897,7 +908,7 @@
}
{
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
TT_Face face = loader - > face ;
TT_Driver driver = ( TT_Driver ) FT_FACE_DRIVER ( face ) ;
@ -916,7 +927,7 @@
FT_Bool do_scale = FALSE ;
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_38 )
{
@ -947,7 +958,7 @@
}
else
# endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
# endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
{
/* scale the glyph */
@ -1078,7 +1089,7 @@
: - subglyph - > transform . yx ;
int c = subglyph - > transform . xy > 0 ? subglyph - > transform . xy
: - subglyph - > transform . xy ;
int d = subglyph - > transform . yy > 0 ? subglyph - > transform . yy
int d = subglyph - > transform . yy > 0 ? subglyph - > transform . yy
: - subglyph - > transform . yy ;
int m = a > b ? a : b ;
int n = c > d ? c : d ;
@ -1324,7 +1335,8 @@
* ( 3 ) for everything else .
*
*/
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
/* XXX merge infinality + lean datafields? */
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
# define TT_LOADER_SET_PP( loader ) \
do \
@ -1350,7 +1362,7 @@
( loader ) - > pp4 . y = ( loader ) - > pp3 . y - ( loader ) - > vadvance ; \
} while ( 0 )
# else /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
# else /* !TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
# define TT_LOADER_SET_PP( loader ) \
do \
@ -1366,7 +1378,7 @@
( loader ) - > pp4 . y = ( loader ) - > pp3 . y - ( loader ) - > vadvance ; \
} while ( 0 )
# endif /* !TT_CONFIG_OPTION_SUBPIXEL_HINTING */
# endif /* !TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
/* a utility function to retrieve i-th node from given FT_List */
@ -1978,7 +1990,8 @@
FT_UInt glyph_index )
{
TT_Face face = loader - > face ;
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
TT_Driver driver = ( TT_Driver ) FT_FACE_DRIVER ( face ) ;
# endif
@ -2005,11 +2018,18 @@
glyph - > metrics . horiBearingY = bbox . yMax ;
glyph - > metrics . horiAdvance = loader - > pp2 . x - loader - > pp1 . x ;
/* adjust advance width to the value contained in the hdmx table */
/* unless FT_LOAD_COMPUTE_METRICS is set */
if ( ! face - > postscript . isFixedPitch & &
IS_HINTED ( loader - > load_flags ) & &
! ( loader - > load_flags & FT_LOAD_COMPUTE_METRICS ) )
/* Adjust advance width to the value contained in the hdmx table */
/* unless FT_LOAD_COMPUTE_METRICS is set or backwards compatibility */
/* mode of the v40 interpreter is active. See `ttinterp.h' for */
/* details on backwards compatibility mode. */
if (
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
! ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_40 & &
( loader - > exec & & loader - > exec - > backwards_compatibility ) ) & &
# endif
! face - > postscript . isFixedPitch & &
IS_HINTED ( loader - > load_flags ) & &
! ( loader - > load_flags & FT_LOAD_COMPUTE_METRICS ) )
{
FT_Byte * widthp ;
@ -2018,7 +2038,7 @@
size - > root . metrics . x_ppem ,
glyph_index ) ;
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_38 )
{
@ -2036,7 +2056,7 @@
}
else
# endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
# endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
{
if ( widthp )
@ -2225,6 +2245,10 @@
# ifdef TT_USE_BYTECODE_INTERPRETER
FT_Bool pedantic = FT_BOOL ( load_flags & FT_LOAD_PEDANTIC ) ;
# endif
# if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
TT_Driver driver = ( TT_Driver ) FT_FACE_DRIVER ( ( TT_Face ) glyph - > face ) ;
# endif
face = ( TT_Face ) glyph - > face ;
@ -2238,11 +2262,13 @@
if ( IS_HINTED ( load_flags ) & & ! glyf_table_only )
{
TT_ExecContext exec ;
FT_Bool grayscale ;
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
TT_Driver driver = ( TT_Driver ) FT_FACE_DRIVER ( face ) ;
FT_Bool grayscale = TRUE ;
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
FT_Bool subpixel_hinting_lean ;
FT_Bool grayscale_cleartype ;
# endif
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
FT_Bool subpixel_hinting = FALSE ;
#if 0
@ -2254,7 +2280,7 @@
FT_Bool subpixel_positioned ;
FT_Bool gray_cleartype ;
# endif
# endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
# endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
FT_Bool reexecute = FALSE ;
@ -2275,7 +2301,26 @@
if ( ! exec )
return FT_THROW ( Could_Not_Find_Context ) ;
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_40 )
{
subpixel_hinting_lean = TRUE ;
grayscale_cleartype = ! FT_BOOL ( load_flags &
FT_LOAD_TARGET_LCD | |
load_flags &
FT_LOAD_TARGET_LCD_V ) ;
exec - > vertical_lcd_lean = FT_BOOL ( load_flags &
FT_LOAD_TARGET_LCD_V ) ;
}
else
{
subpixel_hinting_lean = FALSE ;
grayscale_cleartype = FALSE ;
exec - > vertical_lcd_lean = FALSE ;
}
# endif
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_38 )
{
@ -2332,18 +2377,23 @@
}
else
# endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
# endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
{
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_40 )
grayscale = FT_BOOL ( ! subpixel_hinting_lean & &
FT_LOAD_TARGET_MODE ( load_flags ) ! =
FT_RENDER_MODE_MONO ) ;
else
# endif
grayscale = FT_BOOL ( FT_LOAD_TARGET_MODE ( load_flags ) ! =
FT_RENDER_MODE_MONO ) ;
}
FT_RENDER_MODE_MONO ) ;
error = TT_Load_Context ( exec , face , size ) ;
if ( error )
return error ;
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_38 )
{
@ -2371,9 +2421,37 @@
}
else
# endif /* TT_CONFIG_OPTION_SUBPIXEL_HINTING */
# endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
{
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_40 )
{
/* a change from mono to subpixel rendering (and vice versa) */
/* requires a re-execution of the CVT program */
if ( subpixel_hinting_lean ! = exec - > subpixel_hinting_lean )
{
FT_TRACE4 ( ( " tt_loader_init: subpixel hinting change, "
" re-executing `prep' table \n " ) ) ;
exec - > subpixel_hinting_lean = subpixel_hinting_lean ;
reexecute = TRUE ;
}
/* a change from colored to grayscale subpixel rendering (and */
/* vice versa) requires a re-execution of the CVT program */
if ( grayscale_cleartype ! = exec - > grayscale_cleartype )
{
FT_TRACE4 ( ( " tt_loader_init: grayscale subpixel hinting change, "
" re-executing `prep' table \n " ) ) ;
exec - > grayscale_cleartype = grayscale_cleartype ;
reexecute = TRUE ;
}
}
# endif
/* a change from mono to grayscale rendering (and vice versa) */
/* requires a re-execution of the CVT program */
if ( grayscale ! = exec - > grayscale )
@ -2406,10 +2484,11 @@
if ( exec - > GS . instruct_control & 2 )
exec - > GS = tt_default_graphics_state ;
# ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
# ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
/* check whether we have a font hinted for ClearType -- */
/* note that this flag can also be modified in a glyph's bytecode */
if ( exec - > GS . instruct_control & 4 )
if ( driver - > interpreter_version = = TT_INTERPRETER_VERSION_38 & &
exec - > GS . instruct_control & 4 )
exec - > ignore_x_mode = 0 ;
# endif