[truetype] Simplify logic of rendering modes.
This patch unifies the subpixel and non-subpixel cases. * src/truetype/ttinterp.h (TT_ExecContextRec): Remove `grayscale_hinting'; all code should refer to `grayscale' instead. Remove unused `native_hinting' member. Rename `subpixel_hinting' member to `subpixel. * src/truetype/ttgload.c (TT_LOADER_SET_PP): Updated. (tt_loader_init): Updated. * src/truetype/ttinterp.c (Ins_GETINFO): Simplify. Updated.
This commit is contained in:
parent
e9d95aa06b
commit
8bb09b0fe4
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2013-12-11 Infinality <infinality@infinality.net>
|
||||
|
||||
[truetype] Simplify logic of rendering modes.
|
||||
|
||||
This patch unifies the subpixel and non-subpixel cases.
|
||||
|
||||
* src/truetype/ttinterp.h (TT_ExecContextRec): Remove
|
||||
`grayscale_hinting'; all code should refer to `grayscale' instead.
|
||||
Remove unused `native_hinting' member.
|
||||
Rename `subpixel_hinting' member to `subpixel.
|
||||
|
||||
* src/truetype/ttgload.c (TT_LOADER_SET_PP): Updated.
|
||||
(tt_loader_init): Updated.
|
||||
|
||||
* src/truetype/ttinterp.c (Ins_GETINFO): Simplify.
|
||||
Updated.
|
||||
|
||||
2013-12-11 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[documentation] Add section how to include FreeType header files.
|
||||
|
@ -1352,12 +1352,10 @@
|
||||
#define TT_LOADER_SET_PP( loader ) \
|
||||
do \
|
||||
{ \
|
||||
FT_Bool subpixel_ = loader->exec \
|
||||
? loader->exec->subpixel_hinting \
|
||||
: 0; \
|
||||
FT_Bool grayscale_ = loader->exec \
|
||||
? loader->exec->grayscale_hinting \
|
||||
: 0; \
|
||||
FT_Bool subpixel_ = loader->exec ? loader->exec->subpixel \
|
||||
: 0; \
|
||||
FT_Bool grayscale_ = loader->exec ? loader->exec->grayscale \
|
||||
: 0; \
|
||||
FT_Bool use_aw_2_ = (FT_Bool)( subpixel_ && grayscale_ ); \
|
||||
\
|
||||
\
|
||||
@ -2108,8 +2106,7 @@
|
||||
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
|
||||
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
|
||||
|
||||
FT_Bool subpixel_hinting = FALSE;
|
||||
FT_Bool grayscale_hinting = TRUE;
|
||||
FT_Bool subpixel = FALSE;
|
||||
|
||||
#if 0
|
||||
/* not used yet */
|
||||
@ -2142,24 +2139,24 @@
|
||||
|
||||
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
|
||||
{
|
||||
subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags )
|
||||
!= FT_RENDER_MODE_MONO ) &&
|
||||
SPH_OPTION_SET_SUBPIXEL );
|
||||
subpixel = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) !=
|
||||
FT_RENDER_MODE_MONO ) &&
|
||||
SPH_OPTION_SET_SUBPIXEL );
|
||||
|
||||
if ( subpixel_hinting )
|
||||
grayscale = grayscale_hinting = FALSE;
|
||||
if ( subpixel )
|
||||
grayscale = FALSE;
|
||||
else if ( SPH_OPTION_SET_GRAYSCALE )
|
||||
{
|
||||
grayscale = grayscale_hinting = TRUE;
|
||||
subpixel_hinting = FALSE;
|
||||
grayscale = TRUE;
|
||||
subpixel = FALSE;
|
||||
}
|
||||
else
|
||||
grayscale = grayscale_hinting = FALSE;
|
||||
grayscale = FALSE;
|
||||
|
||||
if ( FT_IS_TRICKY( glyph->face ) )
|
||||
subpixel_hinting = grayscale_hinting = FALSE;
|
||||
subpixel = FALSE;
|
||||
|
||||
exec->ignore_x_mode = subpixel_hinting || grayscale_hinting;
|
||||
exec->ignore_x_mode = subpixel || grayscale;
|
||||
exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
|
||||
if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )
|
||||
exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
|
||||
@ -2202,24 +2199,24 @@
|
||||
{
|
||||
/* a change from mono to subpixel rendering (and vice versa) */
|
||||
/* requires a re-execution of the CVT program */
|
||||
if ( subpixel_hinting != exec->subpixel_hinting )
|
||||
if ( subpixel != exec->subpixel )
|
||||
{
|
||||
FT_TRACE4(( "tt_loader_init: subpixel hinting change,"
|
||||
" re-executing `prep' table\n" ));
|
||||
|
||||
exec->subpixel_hinting = subpixel_hinting;
|
||||
reexecute = TRUE;
|
||||
exec->subpixel = subpixel;
|
||||
reexecute = TRUE;
|
||||
}
|
||||
|
||||
/* a change from mono to grayscale rendering (and vice versa) */
|
||||
/* requires a re-execution of the CVT program */
|
||||
if ( grayscale != exec->grayscale_hinting )
|
||||
if ( grayscale != exec->grayscale )
|
||||
{
|
||||
FT_TRACE4(( "tt_loader_init: grayscale hinting change,"
|
||||
" re-executing `prep' table\n" ));
|
||||
|
||||
exec->grayscale_hinting = grayscale_hinting;
|
||||
reexecute = TRUE;
|
||||
exec->grayscale = grayscale;
|
||||
reexecute = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -7820,13 +7820,6 @@
|
||||
CUR.ignore_x_mode &&
|
||||
CUR.rasterizer_version >= TT_INTERPRETER_VERSION_35 )
|
||||
{
|
||||
/********************************/
|
||||
/* HINTING FOR GRAYSCALE */
|
||||
/* Selector Bit: 5 */
|
||||
/* Return Bit(s): 12 */
|
||||
/* */
|
||||
if ( ( args[0] & 32 ) != 0 && CUR.grayscale_hinting )
|
||||
K |= 1 << 12;
|
||||
|
||||
if ( CUR.rasterizer_version >= 37 )
|
||||
{
|
||||
@ -7835,7 +7828,7 @@
|
||||
/* Selector Bit: 6 */
|
||||
/* Return Bit(s): 13 */
|
||||
/* */
|
||||
if ( ( args[0] & 64 ) != 0 && CUR.subpixel_hinting )
|
||||
if ( ( args[0] & 64 ) != 0 && CUR.subpixel )
|
||||
K |= 1 << 13;
|
||||
|
||||
/********************************/
|
||||
|
@ -263,12 +263,10 @@ FT_BEGIN_HEADER
|
||||
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
|
||||
TT_Round_Func func_round_sphn; /* subpixel rounding function */
|
||||
|
||||
FT_Bool grayscale_hinting; /* Using grayscale hinting? */
|
||||
FT_Bool subpixel_hinting; /* Using subpixel hinting? */
|
||||
FT_Bool native_hinting; /* Using native hinting? */
|
||||
FT_Bool subpixel; /* Using subpixel hinting? */
|
||||
FT_Bool ignore_x_mode; /* Standard rendering mode for */
|
||||
/* subpixel hinting. On if gray */
|
||||
/* or subpixel hinting is on ) */
|
||||
/* or subpixel hinting is on. */
|
||||
|
||||
/* The following 4 aren't fully implemented but here for MS rasterizer */
|
||||
/* compatibility. */
|
||||
|
Loading…
Reference in New Issue
Block a user