/**************************************************************************** * * ttinterp.h * * TrueType bytecode interpreter (specification). * * Copyright (C) 1996-2023 by * David Turner, Robert Wilhelm, and Werner Lemberg. * * This file is part of the FreeType project, and may only be used, * modified, and distributed under the terms of the FreeType project * license, LICENSE.TXT. By continuing to use, modify, or distribute * this file you indicate that you have read the license and * understand and accept it fully. * */ #ifndef TTINTERP_H_ #define TTINTERP_H_ #include "ttobjs.h" FT_BEGIN_HEADER /************************************************************************** * * Rounding mode constants. */ #define TT_Round_Off … #define TT_Round_To_Half_Grid … #define TT_Round_To_Grid … #define TT_Round_To_Double_Grid … #define TT_Round_Up_To_Grid … #define TT_Round_Down_To_Grid … #define TT_Round_Super … #define TT_Round_Super_45 … /************************************************************************** * * Function types used by the interpreter, depending on various modes * (e.g. the rounding mode, whether to render a vertical or horizontal * line etc). * */ /* Rounding function */ TT_Round_Func; /* Point displacement along the freedom vector routine */ TT_Move_Func; /* Distance projection along one of the projection vectors */ TT_Project_Func; /* getting current ppem. Take care of non-square pixels if necessary */ TT_Cur_Ppem_Func; /* reading a cvt value. Take care of non-square pixels if necessary */ TT_Get_CVT_Func; /* setting or moving a cvt value. Take care of non-square pixels */ /* if necessary */ TT_Set_CVT_Func; /************************************************************************** * * This structure defines a call record, used to manage function calls. */ TT_CallStack; /************************************************************************** * * The main structure for the interpreter which collects all necessary * variables and states. * * Members that are initialized by `TT_Load_Context` are marked with '!'. * Members that are initialized by `TT_Run_Context` are marked with '@'. */ TT_ExecContextRec; extern const TT_GraphicsState tt_default_graphics_state; #ifdef TT_USE_BYTECODE_INTERPRETER FT_LOCAL( void ) TT_Goto_CodeRange( TT_ExecContext exec, FT_Int range, FT_Long IP ); FT_LOCAL( void ) TT_Set_CodeRange( TT_ExecContext exec, FT_Int range, void* base, FT_Long length ); FT_LOCAL( void ) TT_Clear_CodeRange( TT_ExecContext exec, FT_Int range ); #endif /* TT_USE_BYTECODE_INTERPRETER */ /************************************************************************** * * @Function: * TT_New_Context * * @Description: * Create a `TT_ExecContext`. Note that there is now an execution * context per `TT_Size` that is not shared among faces. * * @Input: * driver :: * A handle to the driver, used for memory allocation. * * @Return: * A handle to a new empty execution context. * * @Note: * Only the glyph loader and debugger should call this function. * (And right now only the glyph loader uses it.) */ FT_EXPORT( TT_ExecContext ) TT_New_Context( TT_Driver driver ); #ifdef TT_USE_BYTECODE_INTERPRETER FT_LOCAL( void ) TT_Done_Context( TT_ExecContext exec ); FT_LOCAL( FT_Error ) TT_Load_Context( TT_ExecContext exec, TT_Face face, TT_Size size ); FT_LOCAL( void ) TT_Save_Context( TT_ExecContext exec, TT_Size ins ); FT_LOCAL( FT_Error ) TT_Run_Context( TT_ExecContext exec ); #endif /* TT_USE_BYTECODE_INTERPRETER */ /************************************************************************** * * @Function: * TT_RunIns * * @Description: * Executes one or more instruction in the execution context. This * is the main function of the TrueType opcode interpreter. * * @Input: * exec :: * A handle to the target execution context. * * @Return: * FreeType error code. 0 means success. * * @Note: * Only the object manager and debugger should call this function. * * This function is publicly exported because it is directly * invoked by the TrueType debugger. */ FT_EXPORT( FT_Error ) TT_RunIns( void* exec ); FT_END_HEADER #endif /* TTINTERP_H_ */ /* END */