[truetype] Reset cvt and storage in context load.

Currently the cvt and storage are saved and restored in `TT_RunIns`.
However, this is too granular as the cvt and storage area should be set to
the original cvt and storage area only when setting up the hinting context.
This allows for the cvt and storage area to be modified while parsing
multiple glyphs, as is the case with composite glyphs.

* src/truetype/ttinterp.h (TT_ExecContextRec): Remove `origCvt` and
`origStorage`.

* src/truetype/ttinterp.c (TT_RunIns): Don't save and restore the cvt and
storage area.
(Modify_CVT_Check, Ins_WS): Switch from "if in glyph and using original data
do copy on write" to "if in glyph and not using glyph specific data do copy
on write".
This commit is contained in:
Ben Wagner 2023-01-05 21:07:26 -05:00 committed by Werner Lemberg
parent ebe7e9128c
commit 3481b15443
2 changed files with 2 additions and 15 deletions

View File

@ -1527,9 +1527,8 @@
static void
Modify_CVT_Check( TT_ExecContext exc )
{
/* TT_RunIns sets origCvt and restores cvt to origCvt when done. */
if ( exc->iniRange == tt_coderange_glyph &&
exc->cvt == exc->origCvt )
exc->cvt != exc->glyfCvt )
{
exc->error = Update_Max( exc->memory,
&exc->glyfCvtSize,
@ -3115,10 +3114,8 @@
}
else
{
/* TT_RunIns sets origStorage and restores storage to origStorage */
/* when done. */
if ( exc->iniRange == tt_coderange_glyph &&
exc->storage == exc->origStorage )
exc->storage != exc->glyfStorage )
{
FT_ULong tmp = (FT_ULong)exc->glyfStoreSize;
@ -7832,8 +7829,6 @@
exc->func_move_cvt = Move_CVT;
}
exc->origCvt = exc->cvt;
exc->origStorage = exc->storage;
exc->iniRange = exc->curRange;
Compute_Funcs( exc );
@ -8594,9 +8589,6 @@
ins_counter,
ins_counter == 1 ? "" : "s" ));
exc->cvt = exc->origCvt;
exc->storage = exc->origStorage;
return FT_Err_Ok;
LErrorCodeOverflow_:
@ -8606,9 +8598,6 @@
if ( exc->error && !exc->instruction_trap )
FT_TRACE1(( " The interpreter returned error 0x%x\n", exc->error ));
exc->cvt = exc->origCvt;
exc->storage = exc->origStorage;
return exc->error;
}

View File

@ -193,7 +193,6 @@ FT_BEGIN_HEADER
FT_Long* cvt; /* ! */
FT_ULong glyfCvtSize;
FT_Long* glyfCvt; /* cvt working copy for glyph */
FT_Long* origCvt;
FT_UInt glyphSize; /* ! glyph instructions buffer size */
FT_Byte* glyphIns; /* ! glyph instructions buffer */
@ -224,7 +223,6 @@ FT_BEGIN_HEADER
FT_Long* storage; /* ! storage area */
FT_UShort glyfStoreSize;
FT_Long* glyfStorage; /* storage working copy for glyph */
FT_Long* origStorage;
FT_F26Dot6 period; /* values used for the */
FT_F26Dot6 phase; /* `SuperRounding' */