⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ttinterp.c

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 C
📖 第 1 页 / 共 5 页
字号:
  /* <Note>                                                                */  /*    Only the glyph loader and debugger should call this function.      */  /*                                                                       */  EXPORT_FUNC  TT_Error  TT_Save_Context( TT_ExecContext  exec,                             TT_Size         size )  {    TT_Int  i;    /* XXXX: Will probably disappear soon with all the code range */    /*       management, which is now rather obsolete.            */    /*                                                            */    size->num_function_defs    = exec->numFDefs;    size->num_instruction_defs = exec->numIDefs;    size->max_func = exec->maxFunc;    size->max_ins  = exec->maxIns;    for ( i = 0; i < TT_MAX_CODE_RANGES; i++ )      size->codeRangeTable[i] = exec->codeRangeTable[i];    return TT_Err_Ok;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    TT_Run_Context                                                     */  /*                                                                       */  /* <Description>                                                         */  /*    Executes one or more instructions in the execution context.        */  /*                                                                       */  /* <Input>                                                               */  /*    debug :: A Boolean flag.  If set, the function sets some internal  */  /*             variables and returns immediately, otherwise TT_RunIns()  */  /*             is called.                                                */  /*                                                                       */  /* <Input>                                                               */  /*    exec  :: A handle to the target execution context.                 */  /*                                                                       */  /* <Return>                                                              */  /*    TrueTyoe error code.  0 means success.                             */  /*                                                                       */  /* <Note>                                                                */  /*    Only the glyph loader and debugger should call this function.      */  /*                                                                       */  EXPORT_FUNC  TT_Error  TT_Run_Context( TT_ExecContext  exec,                            TT_Bool         debug )  {    TT_Error  error;    if ( (error = TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ))           != TT_Err_Ok )      return error;    exec->zp0 = exec->pts;    exec->zp1 = exec->pts;    exec->zp2 = exec->pts;    exec->GS.gep0 = 1;    exec->GS.gep1 = 1;    exec->GS.gep2 = 1;    exec->GS.projVector.x = 0x4000;    exec->GS.projVector.y = 0x0000;    exec->GS.freeVector = exec->GS.projVector;    exec->GS.dualVector = exec->GS.projVector;    exec->GS.round_state = 1;    exec->GS.loop        = 1;    /* some glyphs leave something on the stack. so we clean it */    /* before a new execution.                                  */    exec->top     = 0;    exec->callTop = 0;#if 1    return exec->face->interpreter( exec );#else    if ( !debug )      return TT_RunIns( exec );    else      return TT_Err_Ok;#endif  }  LOCAL_FUNC  const TT_GraphicsState  tt_default_graphics_state =  {    0, 0, 0,    { 0x4000, 0 },    { 0x4000, 0 },    { 0x4000, 0 },    1, 64, 1,    TRUE, 68, 0, 0, 9, 3,    0, FALSE, 2, 1, 1, 1  };  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    TT_New_Context                                                     */  /*                                                                       */  /* <Description>                                                         */  /*    Queries the face context for a given font.  Note that there is     */  /*    now a _single_ execution context in the TrueType driver which is   */  /*    shared among faces.                                                */  /*                                                                       */  /* <Input>                                                               */  /*    face :: A handle to the source face object.                        */  /*                                                                       */  /* <Return>                                                              */  /*    A handle to the execution context.  Initialized for `face'.        */  /*                                                                       */  /* <Note>                                                                */  /*    Only the glyph loader and debugger should call this function.      */  /*                                                                       */  EXPORT_FUNC  TT_ExecContext  TT_New_Context( TT_Face  face )  {    TT_Driver       driver = (TT_Driver)face->root.driver;    TT_ExecContext  exec;    FT_Memory       memory = driver->root.memory;    exec = driver->context;    if ( !driver->context )    {      TT_Error   error;      /* allocate object */      if ( ALLOC( exec, sizeof ( *exec ) ) )        goto Exit;      /* initialize it */      error = Init_Context( exec, face, memory );      if ( error )        goto Fail;      /* store it into the driver */      driver->context = exec;    }  Exit:    return driver->context;  Fail:    FREE( exec );    return 0;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    TT_Done_Context                                                    */  /*                                                                       */  /* <Description>                                                         */  /*    Discards an execution context.                                     */  /*                                                                       */  /* <Input>                                                               */  /*    exec :: A handle to the target execution context.                  */  /*                                                                       */  /* <Return>                                                              */  /*    TrueType error code.  0 means success.                             */  /*                                                                       */  /* <Note>                                                                */  /*    Only the glyph loader and debugger should call this function.      */  /*                                                                       */  EXPORT_FUNC  TT_Error  TT_Done_Context( TT_ExecContext  exec )  {    /* Nothing at all for now */    UNUSED( exec );    return TT_Err_Ok;  }  /*************************************************************************/  /*                                                                       */  /* Before an opcode is executed, the interpreter verifies that there are */  /* enough arguments on the stack, with the help of the Pop_Push_Count    */  /* table.                                                                */  /*                                                                       */  /* For each opcode, the first column gives the number of arguments that  */  /* are popped from the stack; the second one gives the number of those   */  /* that are pushed in result.                                            */  /*                                                                       */  /* Note that for opcodes with a varying number of parameters, either 0   */  /* or 1 arg is verified before execution, depending on the nature of the */  /* instruction:                                                          */  /*                                                                       */  /* - if the number of arguments is given by the bytecode stream or the   */  /*   loop variable, 0 is chosen.                                         */  /*                                                                       */  /* - if the first argument is a count n that is followed by arguments    */  /*   a1 .. an, then 1 is chosen.                                         */  /*                                                                       */  /*************************************************************************/#undef  PACK#define PACK( x, y )  ((x << 4) | y)  static  const TT_Byte  Pop_Push_Count[256] =  {    /* opcodes are gathered in groups of 16 */    /* please keep the spaces as they are   */    /*  SVTCA  y  */  PACK( 0, 0 ),    /*  SVTCA  x  */  PACK( 0, 0 ),    /*  SPvTCA y  */  PACK( 0, 0 ),    /*  SPvTCA x  */  PACK( 0, 0 ),    /*  SFvTCA y  */  PACK( 0, 0 ),    /*  SFvTCA x  */  PACK( 0, 0 ),    /*  SPvTL //  */  PACK( 2, 0 ),    /*  SPvTL +   */  PACK( 2, 0 ),    /*  SFvTL //  */  PACK( 2, 0 ),    /*  SFvTL +   */  PACK( 2, 0 ),    /*  SPvFS     */  PACK( 2, 0 ),    /*  SFvFS     */  PACK( 2, 0 ),    /*  GPV       */  PACK( 0, 2 ),    /*  GFV       */  PACK( 0, 2 ),    /*  SFvTPv    */  PACK( 0, 0 ),    /*  ISECT     */  PACK( 5, 0 ),    /*  SRP0      */  PACK( 1, 0 ),    /*  SRP1      */  PACK( 1, 0 ),    /*  SRP2      */  PACK( 1, 0 ),    /*  SZP0      */  PACK( 1, 0 ),    /*  SZP1      */  PACK( 1, 0 ),    /*  SZP2      */  PACK( 1, 0 ),    /*  SZPS      */  PACK( 1, 0 ),    /*  SLOOP     */  PACK( 1, 0 ),    /*  RTG       */  PACK( 0, 0 ),    /*  RTHG      */  PACK( 0, 0 ),    /*  SMD       */  PACK( 1, 0 ),    /*  ELSE      */  PACK( 0, 0 ),    /*  JMPR      */  PACK( 1, 0 ),    /*  SCvTCi    */  PACK( 1, 0 ),    /*  SSwCi     */  PACK( 1, 0 ),    /*  SSW       */  PACK( 1, 0 ),    /*  DUP       */  PACK( 1, 2 ),    /*  POP       */  PACK( 1, 0 ),    /*  CLEAR     */  PACK( 0, 0 ),    /*  SWAP      */  PACK( 2, 2 ),    /*  DEPTH     */  PACK( 0, 1 ),    /*  CINDEX    */  PACK( 1, 1 ),    /*  MINDEX    */  PACK( 1, 0 ),    /*  AlignPTS  */  PACK( 2, 0 ),    /*  INS_$28   */  PACK( 0, 0 ),    /*  UTP       */  PACK( 1, 0 ),    /*  LOOPCALL  */  PACK( 2, 0 ),    /*  CALL      */  PACK( 1, 0 ),    /*  FDEF      */  PACK( 1, 0 ),    /*  ENDF      */  PACK( 0, 0 ),    /*  MDAP[0]   */  PACK( 1, 0 ),    /*  MDAP[1]   */  PACK( 1, 0 ),    /*  IUP[0]    */  PACK( 0, 0 ),    /*  IUP[1]    */  PACK( 0, 0 ),    /*  SHP[0]    */  PACK( 0, 0 ),    /*  SHP[1]    */  PACK( 0, 0 ),    /*  SHC[0]    */  PACK( 1, 0 ),    /*  SHC[1]    */  PACK( 1, 0 ),    /*  SHZ[0]    */  PACK( 1, 0 ),    /*  SHZ[1]    */  PACK( 1, 0 ),    /*  SHPIX     */  PACK( 1, 0 ),    /*  IP        */  PACK( 0, 0 ),    /*  MSIRP[0]  */  PACK( 2, 0 ),    /*  MSIRP[1]  */  PACK( 2, 0 ),    /*  AlignRP   */  PACK( 0, 0 ),    /*  RTDG      */  PACK( 0, 0 ),    /*  MIAP[0]   */  PACK( 2, 0 ),    /*  MIAP[1]   */  PACK( 2, 0 ),    /*  NPushB    */  PACK( 0, 0 ),    /*  NPushW    */  PACK( 0, 0 ),    /*  WS        */  PACK( 2, 0 ),    /*  RS        */  PACK( 1, 1 ),    /*  WCvtP     */  PACK( 2, 0 ),    /*  RCvt      */  PACK( 1, 1 ),    /*  GC[0]     */  PACK( 1, 1 ),    /*  GC[1]     */  PACK( 1, 1 ),    /*  SCFS      */  PACK( 2, 0 ),    /*  MD[0]     */  PACK( 2, 1 ),    /*  MD[1]     */  PACK( 2, 1 ),    /*  MPPEM     */  PACK( 0, 1 ),    /*  MPS       */  PACK( 0, 1 ),    /*  FlipON    */  PACK( 0, 0 ),    /*  FlipOFF   */  PACK( 0, 0 ),    /*  DEBUG     */  PACK( 1, 0 ),    /*  LT        */  PACK( 2, 1 ),    /*  LTEQ      */  PACK( 2, 1 ),    /*  GT        */  PACK( 2, 1 ),    /*  GTEQ      */  PACK( 2, 1 ),    /*  EQ        */  PACK( 2, 1 ),    /*  NEQ       */  PACK( 2, 1 ),    /*  ODD       */  PACK( 1, 1 ),    /*  EVEN      */  PACK( 1, 1 ),    /*  IF        */  PACK( 1, 0 ),    /*  EIF       */  PACK( 0, 0 ),    /*  AND       */  PACK( 2, 1 ),    /*  OR        */  PACK( 2, 1 ),    /*  NOT       */  PACK( 1, 1 ),    /*  DeltaP1   */  PACK( 1, 0 ),    /*  SDB       */  PACK( 1, 0 ),

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -