ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

ttinterp.h
Go to the documentation of this file.
00001 /***************************************************************************/
00002 /*                                                                         */
00003 /*  ttinterp.h                                                             */
00004 /*                                                                         */
00005 /*    TrueType bytecode interpreter (specification).                       */
00006 /*                                                                         */
00007 /*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 by       */
00008 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
00009 /*                                                                         */
00010 /*  This file is part of the FreeType project, and may only be used,       */
00011 /*  modified, and distributed under the terms of the FreeType project      */
00012 /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
00013 /*  this file you indicate that you have read the license and              */
00014 /*  understand and accept it fully.                                        */
00015 /*                                                                         */
00016 /***************************************************************************/
00017 
00018 
00019 #ifndef __TTINTERP_H__
00020 #define __TTINTERP_H__
00021 
00022 #include <ft2build.h>
00023 #include "ttobjs.h"
00024 
00025 
00026 FT_BEGIN_HEADER
00027 
00028 
00029 #ifndef TT_CONFIG_OPTION_STATIC_INTERPRETER /* indirect implementation */
00030 
00031 #define EXEC_OP_   TT_ExecContext  exc,
00032 #define EXEC_OP    TT_ExecContext  exc
00033 #define EXEC_ARG_  exc,
00034 #define EXEC_ARG   exc
00035 
00036 #else                                       /* static implementation */
00037 
00038 #define EXEC_OP_   /* void */
00039 #define EXEC_OP    /* void */
00040 #define EXEC_ARG_  /* void */
00041 #define EXEC_ARG   /* void */
00042 
00043 #endif /* TT_CONFIG_OPTION_STATIC_INTERPRETER */
00044 
00045 
00046   /*************************************************************************/
00047   /*                                                                       */
00048   /* Rounding mode constants.                                              */
00049   /*                                                                       */
00050 #define TT_Round_Off             5
00051 #define TT_Round_To_Half_Grid    0
00052 #define TT_Round_To_Grid         1
00053 #define TT_Round_To_Double_Grid  2
00054 #define TT_Round_Up_To_Grid      4
00055 #define TT_Round_Down_To_Grid    3
00056 #define TT_Round_Super           6
00057 #define TT_Round_Super_45        7
00058 
00059 
00060   /*************************************************************************/
00061   /*                                                                       */
00062   /* Function types used by the interpreter, depending on various modes    */
00063   /* (e.g. the rounding mode, whether to render a vertical or horizontal   */
00064   /* line etc).                                                            */
00065   /*                                                                       */
00066   /*************************************************************************/
00067 
00068   /* Rounding function */
00069   typedef FT_F26Dot6
00070   (*TT_Round_Func)( EXEC_OP_ FT_F26Dot6  distance,
00071                              FT_F26Dot6  compensation );
00072 
00073   /* Point displacement along the freedom vector routine */
00074   typedef void
00075   (*TT_Move_Func)( EXEC_OP_ TT_GlyphZone  zone,
00076                             FT_UShort     point,
00077                             FT_F26Dot6    distance );
00078 
00079   /* Distance projection along one of the projection vectors */
00080   typedef FT_F26Dot6
00081   (*TT_Project_Func)( EXEC_OP_ FT_Pos   dx,
00082                                FT_Pos   dy );
00083 
00084   /* reading a cvt value.  Take care of non-square pixels if necessary */
00085   typedef FT_F26Dot6
00086   (*TT_Get_CVT_Func)( EXEC_OP_ FT_ULong  idx );
00087 
00088   /* setting or moving a cvt value.  Take care of non-square pixels  */
00089   /* if necessary                                                    */
00090   typedef void
00091   (*TT_Set_CVT_Func)( EXEC_OP_ FT_ULong    idx,
00092                                FT_F26Dot6  value );
00093 
00094 
00095   /*************************************************************************/
00096   /*                                                                       */
00097   /* This structure defines a call record, used to manage function calls.  */
00098   /*                                                                       */
00099   typedef struct  TT_CallRec_
00100   {
00101     FT_Int   Caller_Range;
00102     FT_Long  Caller_IP;
00103     FT_Long  Cur_Count;
00104     FT_Long  Cur_Restart;
00105 
00106   } TT_CallRec, *TT_CallStack;
00107 
00108 
00109   /*************************************************************************/
00110   /*                                                                       */
00111   /* The main structure for the interpreter which collects all necessary   */
00112   /* variables and states.                                                 */
00113   /*                                                                       */
00114   typedef struct  TT_ExecContextRec_
00115   {
00116     TT_Face            face;
00117     TT_Size            size;
00118     FT_Memory          memory;
00119 
00120     /* instructions state */
00121 
00122     FT_Error           error;      /* last execution error */
00123 
00124     FT_Long            top;        /* top of exec. stack   */
00125 
00126     FT_UInt            stackSize;  /* size of exec. stack  */
00127     FT_Long*           stack;      /* current exec. stack  */
00128 
00129     FT_Long            args;
00130     FT_UInt            new_top;    /* new top after exec.  */
00131 
00132     TT_GlyphZoneRec    zp0,        /* zone records */
00133                        zp1,
00134                        zp2,
00135                        pts,
00136                        twilight;
00137 
00138     FT_Size_Metrics    metrics;
00139     TT_Size_Metrics    tt_metrics; /* size metrics */
00140 
00141     TT_GraphicsState   GS;         /* current graphics state */
00142 
00143     FT_Int             curRange;  /* current code range number   */
00144     FT_Byte*           code;      /* current code range          */
00145     FT_Long            IP;        /* current instruction pointer */
00146     FT_Long            codeSize;  /* size of current range       */
00147 
00148     FT_Byte            opcode;    /* current opcode              */
00149     FT_Int             length;    /* length of current opcode    */
00150 
00151     FT_Bool            step_ins;  /* true if the interpreter must */
00152                                   /* increment IP after ins. exec */
00153     FT_ULong           cvtSize;
00154     FT_Long*           cvt;
00155 
00156     FT_UInt            glyphSize; /* glyph instructions buffer size */
00157     FT_Byte*           glyphIns;  /* glyph instructions buffer */
00158 
00159     FT_UInt            numFDefs;  /* number of function defs         */
00160     FT_UInt            maxFDefs;  /* maximum number of function defs */
00161     TT_DefArray        FDefs;     /* table of FDefs entries          */
00162 
00163     FT_UInt            numIDefs;  /* number of instruction defs */
00164     FT_UInt            maxIDefs;  /* maximum number of ins defs */
00165     TT_DefArray        IDefs;     /* table of IDefs entries     */
00166 
00167     FT_UInt            maxFunc;   /* maximum function index     */
00168     FT_UInt            maxIns;    /* maximum instruction index  */
00169 
00170     FT_Int             callTop,    /* top of call stack during execution */
00171                        callSize;   /* size of call stack */
00172     TT_CallStack       callStack;  /* call stack */
00173 
00174     FT_UShort          maxPoints;    /* capacity of this context's `pts' */
00175     FT_Short           maxContours;  /* record, expressed in points and  */
00176                                      /* contours.                        */
00177 
00178     TT_CodeRangeTable  codeRangeTable;  /* table of valid code ranges */
00179                                         /* useful for the debugger   */
00180 
00181     FT_UShort          storeSize;  /* size of current storage */
00182     FT_Long*           storage;    /* storage area            */
00183 
00184     FT_F26Dot6         period;     /* values used for the */
00185     FT_F26Dot6         phase;      /* `SuperRounding'     */
00186     FT_F26Dot6         threshold;
00187 
00188 #if 0
00189     /* this seems to be unused */
00190     FT_Int             cur_ppem;   /* ppem along the current proj vector */
00191 #endif
00192 
00193     FT_Bool            instruction_trap; /* If `True', the interpreter will */
00194                                          /* exit after each instruction     */
00195 
00196     TT_GraphicsState   default_GS;       /* graphics state resulting from   */
00197                                          /* the prep program                */
00198     FT_Bool            is_composite;     /* true if the glyph is composite  */
00199     FT_Bool            pedantic_hinting; /* true if pedantic interpretation */
00200 
00201     /* latest interpreter additions */
00202 
00203     FT_Long            F_dot_P;    /* dot product of freedom and projection */
00204                                    /* vectors                               */
00205     TT_Round_Func      func_round; /* current rounding function             */
00206 
00207     TT_Project_Func    func_project,   /* current projection function */
00208                        func_dualproj,  /* current dual proj. function */
00209                        func_freeProj;  /* current freedom proj. func  */
00210 
00211     TT_Move_Func       func_move;      /* current point move function */
00212     TT_Move_Func       func_move_orig; /* move original position function */
00213 
00214     TT_Get_CVT_Func    func_read_cvt;  /* read a cvt entry              */
00215     TT_Set_CVT_Func    func_write_cvt; /* write a cvt entry (in pixels) */
00216     TT_Set_CVT_Func    func_move_cvt;  /* incr a cvt entry (in pixels)  */
00217 
00218     FT_Bool            grayscale;      /* are we hinting for grayscale? */
00219 
00220   } TT_ExecContextRec;
00221 
00222 
00223   extern const TT_GraphicsState  tt_default_graphics_state;
00224 
00225 
00226   FT_LOCAL( FT_Error )
00227   TT_Goto_CodeRange( TT_ExecContext  exec,
00228                      FT_Int          range,
00229                      FT_Long         IP );
00230 
00231   FT_LOCAL( FT_Error )
00232   TT_Set_CodeRange( TT_ExecContext  exec,
00233                     FT_Int          range,
00234                     void*           base,
00235                     FT_Long         length );
00236 
00237   FT_LOCAL( FT_Error )
00238   TT_Clear_CodeRange( TT_ExecContext  exec,
00239                       FT_Int          range );
00240 
00241 
00242   FT_LOCAL( FT_Error )
00243   Update_Max( FT_Memory  memory,
00244               FT_ULong*  size,
00245               FT_Long    multiplier,
00246               void*      _pbuff,
00247               FT_ULong   new_max );
00248 
00249 
00250   /*************************************************************************/
00251   /*                                                                       */
00252   /* <Function>                                                            */
00253   /*    TT_New_Context                                                     */
00254   /*                                                                       */
00255   /* <Description>                                                         */
00256   /*    Queries the face context for a given font.  Note that there is     */
00257   /*    now a _single_ execution context in the TrueType driver which is   */
00258   /*    shared among faces.                                                */
00259   /*                                                                       */
00260   /* <Input>                                                               */
00261   /*    face :: A handle to the source face object.                        */
00262   /*                                                                       */
00263   /* <Return>                                                              */
00264   /*    A handle to the execution context.  Initialized for `face'.        */
00265   /*                                                                       */
00266   /* <Note>                                                                */
00267   /*    Only the glyph loader and debugger should call this function.      */
00268   /*                                                                       */
00269   FT_EXPORT( TT_ExecContext )
00270   TT_New_Context( TT_Driver  driver );
00271 
00272   FT_LOCAL( FT_Error )
00273   TT_Done_Context( TT_ExecContext  exec );
00274 
00275   FT_LOCAL( FT_Error )
00276   TT_Load_Context( TT_ExecContext  exec,
00277                    TT_Face         face,
00278                    TT_Size         size );
00279 
00280   FT_LOCAL( FT_Error )
00281   TT_Save_Context( TT_ExecContext  exec,
00282                    TT_Size         ins );
00283 
00284   FT_LOCAL( FT_Error )
00285   TT_Run_Context( TT_ExecContext  exec,
00286                   FT_Bool         debug );
00287 
00288 
00289   /*************************************************************************/
00290   /*                                                                       */
00291   /* <Function>                                                            */
00292   /*    TT_RunIns                                                          */
00293   /*                                                                       */
00294   /* <Description>                                                         */
00295   /*    Executes one or more instruction in the execution context.  This   */
00296   /*    is the main function of the TrueType opcode interpreter.           */
00297   /*                                                                       */
00298   /* <Input>                                                               */
00299   /*    exec :: A handle to the target execution context.                  */
00300   /*                                                                       */
00301   /* <Return>                                                              */
00302   /*    FreeType error code.  0 means success.                             */
00303   /*                                                                       */
00304   /* <Note>                                                                */
00305   /*    Only the object manager and debugger should call this function.    */
00306   /*                                                                       */
00307   /*    This function is publicly exported because it is directly          */
00308   /*    invoked by the TrueType debugger.                                  */
00309   /*                                                                       */
00310   FT_EXPORT( FT_Error )
00311   TT_RunIns( TT_ExecContext  exec );
00312 
00313 
00314 FT_END_HEADER
00315 
00316 #endif /* __TTINTERP_H__ */
00317 
00318 
00319 /* END */

Generated on Fri May 25 2012 04:32:34 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.