Commits (2)
  • Alexei Podtelezhnikov's avatar
    [truetype] Limit INSTCTRL appication within specs. · a35b081e
    Alexei Podtelezhnikov authored
    * src/truetype/ttinterp.c (Ins_INSTCTRL): Limit its global effects
    to the CVT program and local effects to the glyph program.
    
    This also fixes an Infinality buglet. The `ignore_x_mode` should be
    locally unset by the glyph program.
    a35b081e
  • Alexei Podtelezhnikov's avatar
    [truetype] Relocate subpixel flag setting. · 7809007a
    Alexei Podtelezhnikov authored
    `TT_RunIns` is too busy to deal with subpixel flags. It is better
    to set them in `tt_loader_init`, which is executed before each
    glyph program.
    
    * src/truetype/ttinterp.c (TT_RunIns): Move the flag setting from
    here...
    * src/truetype/ttgload.c (tt_loader_init): ... to here.
    7809007a
......@@ -2719,8 +2719,35 @@
/* note that this flag can also be modified in a glyph's bytecode */
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
exec->GS.instruct_control & 4 )
exec->ignore_x_mode = 0;
#endif
exec->ignore_x_mode = FALSE;
exec->iup_called = FALSE;
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
/*
* Toggle backward compatibility according to what font wants, except
* when
*
* 1) we have a `tricky' font that heavily relies on the interpreter to
* render glyphs correctly, for example DFKai-SB, or
* 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
*
* In those cases, backward compatibility needs to be turned off to get
* correct rendering. The rendering is then completely up to the
* font's programming.
*
*/
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
subpixel_hinting_lean &&
!FT_IS_TRICKY( glyph->face ) )
exec->backward_compatibility = !( exec->GS.instruct_control & 4 );
else
exec->backward_compatibility = FALSE;
exec->iupx_called = FALSE;
exec->iupy_called = FALSE;
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */
exec->pedantic_hinting = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
loader->exec = exec;
......
......@@ -5260,16 +5260,21 @@
}
}
exc->GS.instruct_control &= ~(FT_Byte)Kf;
exc->GS.instruct_control |= (FT_Byte)L;
/* INSTCTRL should only be used in the CVT program */
if ( exc->iniRange == tt_coderange_cvt )
{
exc->GS.instruct_control &= ~(FT_Byte)Kf;
exc->GS.instruct_control |= (FT_Byte)L;
}
if ( K == 3 )
/* except to change the subpixel flags temporarily */
else if ( exc->iniRange == tt_coderange_glyph && K == 3 )
{
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
/* INSTCTRL modifying flag 3 also has an effect */
/* outside of the CVT program */
if ( SUBPIXEL_HINTING_INFINALITY )
exc->ignore_x_mode = FT_BOOL( L == 4 );
exc->ignore_x_mode = !FT_BOOL( L == 4 );
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
......@@ -5280,6 +5285,8 @@
exc->backward_compatibility = !FT_BOOL( L == 4 );
#endif
}
else if ( exc->pedantic_hinting )
exc->error = FT_THROW( Invalid_Reference );
}
......@@ -7755,35 +7762,6 @@
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
exc->iup_called = FALSE;
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
/*
* Toggle backward compatibility according to what font wants, except
* when
*
* 1) we have a `tricky' font that heavily relies on the interpreter to
* render glyphs correctly, for example DFKai-SB, or
* 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
*
* In those cases, backward compatibility needs to be turned off to get
* correct rendering. The rendering is then completely up to the
* font's programming.
*
*/
if ( SUBPIXEL_HINTING_MINIMAL &&
exc->subpixel_hinting_lean &&
!FT_IS_TRICKY( &exc->face->root ) )
exc->backward_compatibility = !( exc->GS.instruct_control & 4 );
else
exc->backward_compatibility = FALSE;
exc->iupx_called = FALSE;
exc->iupy_called = FALSE;
#endif
/* We restrict the number of twilight points to a reasonable, */
/* heuristic value to avoid slow execution of malformed bytecode. */
num_twilight_points = FT_MAX( 30,
......