From 2e3455b135967b9e0e9d3cec52f0bb4a3da1f9e1 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 10 Dec 2021 22:05:51 -0500 Subject: [PATCH] [truetype] Limit INSTCTRL appication within specs. * src/truetype/ttinterp.c (Ins_INSTCTRL): Limit its global effects to the CVT program and local effects to the glyph program. --- src/truetype/ttinterp.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index ee8e1523f..cb17e25eb 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -5260,10 +5260,15 @@ } } - 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 */