[truetype] Deduplicate 'codeRangeTable'.

* src/truetype/ttinterp.c (TT_Load_Context, TT_Save_Context): Do not
copy 'codeRangeTable'.
* src/truetype/ttobjs.h (TT_Size): Remove 'codeRangeTable'.
(TT_CodeRange_Tag, TT_CodeRange, TT_DefArray): Moved to...
* src/truetype/ttinterp.h: ... this header.1
This commit is contained in:
Alexei Podtelezhnikov
2025-06-22 12:13:48 -04:00
parent c9cbfacb80
commit 36ddd0cba1
3 changed files with 56 additions and 81 deletions

View File

@@ -270,7 +270,6 @@
TT_Face face,
TT_Size size )
{
FT_Int i;
FT_Memory memory = exec->memory;
@@ -281,9 +280,6 @@
FT_FREE( exec->glyphIns );
exec->glyphSize = 0;
for ( i = 0; i < TT_MAX_CODE_RANGES; i++ )
exec->codeRangeTable[i] = size->codeRangeTable[i];
exec->pointSize = size->point_size;
exec->tt_metrics = size->ttmetrics;
exec->metrics = *size->metrics;
@@ -317,9 +313,6 @@
TT_Save_Context( TT_ExecContext exec,
TT_Size size )
{
FT_Int i;
/* UNDOCUMENTED! */
/* Only these GS values can be modified by the CVT program. */
@@ -333,9 +326,6 @@
size->GS.instruct_control = exec->GS.instruct_control;
size->GS.scan_control = exec->GS.scan_control;
size->GS.scan_type = exec->GS.scan_type;
for ( i = 0; i < TT_MAX_CODE_RANGES; i++ )
size->codeRangeTable[i] = exec->codeRangeTable[i];
}

View File

@@ -39,6 +39,60 @@ FT_BEGIN_HEADER
#define TT_Round_Super_45 7
/**************************************************************************
*
* EXECUTION SUBTABLES
*
* These sub-tables relate to instruction execution.
*
*/
#define TT_MAX_CODE_RANGES 3
/**************************************************************************
*
* There can only be 3 active code ranges at once:
* - the Font Program
* - the CVT Program
* - a glyph's instructions set
*/
typedef enum TT_CodeRange_Tag_
{
tt_coderange_none = 0,
tt_coderange_font,
tt_coderange_cvt,
tt_coderange_glyph
} TT_CodeRange_Tag;
typedef struct TT_CodeRange_
{
FT_Byte* base;
FT_Long size;
} TT_CodeRange;
typedef TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES];
/**************************************************************************
*
* Defines a function/instruction definition record.
*/
typedef struct TT_DefRecord_
{
FT_Int range; /* in which code range is it located? */
FT_Long start; /* where does it start? */
FT_Long end; /* where does it end? */
FT_UInt opc; /* function #, or instruction code */
FT_Bool active; /* is it active? */
} TT_DefRecord, *TT_DefArray;
/**************************************************************************
*
* Function types used by the interpreter, depending on various modes

View File

@@ -53,6 +53,8 @@ FT_BEGIN_HEADER
typedef FT_GlyphSlot TT_GlyphSlot;
#ifdef TT_USE_BYTECODE_INTERPRETER
/**************************************************************************
*
* @Struct:
@@ -98,8 +100,6 @@ FT_BEGIN_HEADER
} TT_GraphicsState;
#ifdef TT_USE_BYTECODE_INTERPRETER
FT_LOCAL( void )
tt_glyphzone_done( FT_Memory memory,
TT_GlyphZone zone );
@@ -114,73 +114,6 @@ FT_BEGIN_HEADER
/**************************************************************************
*
* EXECUTION SUBTABLES
*
* These sub-tables relate to instruction execution.
*
*/
#define TT_MAX_CODE_RANGES 3
/**************************************************************************
*
* There can only be 3 active code ranges at once:
* - the Font Program
* - the CVT Program
* - a glyph's instructions set
*/
typedef enum TT_CodeRange_Tag_
{
tt_coderange_none = 0,
tt_coderange_font,
tt_coderange_cvt,
tt_coderange_glyph
} TT_CodeRange_Tag;
typedef struct TT_CodeRange_
{
FT_Byte* base;
FT_Long size;
} TT_CodeRange;
typedef TT_CodeRange TT_CodeRangeTable[TT_MAX_CODE_RANGES];
/**************************************************************************
*
* Defines a function/instruction definition record.
*/
typedef struct TT_DefRecord_
{
FT_Int range; /* in which code range is it located? */
FT_Long start; /* where does it start? */
FT_Long end; /* where does it end? */
FT_UInt opc; /* function #, or instruction code */
FT_Bool active; /* is it active? */
} TT_DefRecord, *TT_DefArray;
/**************************************************************************
*
* Subglyph transformation record.
*/
typedef struct TT_Transform_
{
FT_Fixed xx, xy; /* transformation matrix coefficients */
FT_Fixed yx, yy;
FT_F26Dot6 ox, oy; /* offsets */
} TT_Transform;
/**************************************************************************
*
* A note regarding non-squared pixels:
@@ -290,8 +223,6 @@ FT_BEGIN_HEADER
FT_Long point_size; /* for the `MPS' bytecode instruction */
TT_CodeRangeTable codeRangeTable;
TT_GraphicsState GS;
TT_GlyphZoneRec twilight; /* The instance's twilight zone */