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

📄 ttinterp.c

📁 source code: Covert TXT to PDF
💻 C
📖 第 1 页 / 共 5 页
字号:
    return (FT_Short)( ( CUR.code[CUR.IP - 2] << 8 ) +                         CUR.code[CUR.IP - 1]      );  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    Ins_Goto_CodeRange                                                 */  /*                                                                       */  /* <Description>                                                         */  /*    Goes to a certain code range in the instruction stream.            */  /*                                                                       */  /* <Input>                                                               */  /*    aRange :: The index of the code range.                             */  /*                                                                       */  /*    aIP    :: The new IP address in the code range.                    */  /*                                                                       */  /* <Return>                                                              */  /*    SUCCESS or FAILURE.                                                */  /*                                                                       */  static FT_Bool  Ins_Goto_CodeRange( EXEC_OP_ FT_Int    aRange,                               FT_ULong  aIP )  {    TT_CodeRange*  range;    if ( aRange < 1 || aRange > 3 )    {      CUR.error = TT_Err_Bad_Argument;      return FAILURE;    }    range = &CUR.codeRangeTable[aRange - 1];    if ( range->base == NULL )     /* invalid coderange */    {      CUR.error = TT_Err_Invalid_CodeRange;      return FAILURE;    }    /* NOTE: Because the last instruction of a program may be a CALL */    /*       which will return to the first byte *after* the code    */    /*       range, we test for AIP <= Size, instead of AIP < Size.  */    if ( aIP > range->size )    {      CUR.error = TT_Err_Code_Overflow;      return FAILURE;    }    CUR.code     = range->base;    CUR.codeSize = range->size;    CUR.IP       = aIP;    CUR.curRange = aRange;    return SUCCESS;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    Direct_Move                                                        */  /*                                                                       */  /* <Description>                                                         */  /*    Moves a point by a given distance along the freedom vector.  The   */  /*    point will be `touched'.                                           */  /*                                                                       */  /* <Input>                                                               */  /*    point    :: The index of the point to move.                        */  /*                                                                       */  /*    distance :: The distance to apply.                                 */  /*                                                                       */  /* <InOut>                                                               */  /*    zone     :: The affected glyph zone.                               */  /*                                                                       */  static void  Direct_Move( EXEC_OP_ TT_GlyphZone*  zone,                        FT_UShort      point,                        FT_F26Dot6     distance )  {    FT_F26Dot6 v;    v = CUR.GS.freeVector.x;    if ( v != 0 )    {#ifdef NO_APPLE_PATENT      if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )        zone->cur[point].x += distance;#else      zone->cur[point].x += TT_MULDIV( distance,                                       v * 0x10000L,                                       CUR.F_dot_P );#endif      zone->tags[point] |= FT_Curve_Tag_Touch_X;    }    v = CUR.GS.freeVector.y;    if ( v != 0 )    {#ifdef NO_APPLE_PATENT      if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )        zone->cur[point].y += distance;#else      zone->cur[point].y += TT_MULDIV( distance,                                       v * 0x10000L,                                       CUR.F_dot_P );#endif      zone->tags[point] |= FT_Curve_Tag_Touch_Y;    }  }  /*************************************************************************/  /*                                                                       */  /* Special versions of Direct_Move()                                     */  /*                                                                       */  /*   The following versions are used whenever both vectors are both      */  /*   along one of the coordinate unit vectors, i.e. in 90% of the cases. */  /*                                                                       */  /*************************************************************************/  static void  Direct_Move_X( EXEC_OP_ TT_GlyphZone*  zone,                          FT_UShort      point,                          FT_F26Dot6     distance )  {    FT_UNUSED_EXEC;    zone->cur[point].x += distance;    zone->tags[point]  |= FT_Curve_Tag_Touch_X;  }  static void  Direct_Move_Y( EXEC_OP_ TT_GlyphZone*  zone,                          FT_UShort      point,                          FT_F26Dot6     distance )  {    FT_UNUSED_EXEC;    zone->cur[point].y += distance;    zone->tags[point]  |= FT_Curve_Tag_Touch_Y;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    Round_None                                                         */  /*                                                                       */  /* <Description>                                                         */  /*    Does not round, but adds engine compensation.                      */  /*                                                                       */  /* <Input>                                                               */  /*    distance     :: The distance (not) to round.                       */  /*                                                                       */  /*    compensation :: The engine compensation.                           */  /*                                                                       */  /* <Return>                                                              */  /*    The compensated distance.                                          */  /*                                                                       */  /* <Note>                                                                */  /*    The TrueType specification says very few about the relationship    */  /*    between rounding and engine compensation.  However, it seems from  */  /*    the description of super round that we should add the compensation */  /*    before rounding.                                                   */  /*                                                                       */  static FT_F26Dot6  Round_None( EXEC_OP_ FT_F26Dot6  distance,                       FT_F26Dot6  compensation )  {    FT_F26Dot6  val;    FT_UNUSED_EXEC;    if ( distance >= 0 )    {      val = distance + compensation;      if ( val < 0 )        val = 0;    }    else {      val = distance - compensation;      if ( val > 0 )        val = 0;    }    return val;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    Round_To_Grid                                                      */  /*                                                                       */  /* <Description>                                                         */  /*    Rounds value to grid after adding engine compensation.             */  /*                                                                       */  /* <Input>                                                               */  /*    distance     :: The distance to round.                             */  /*                                                                       */  /*    compensation :: The engine compensation.                           */  /*                                                                       */  /* <Return>                                                              */  /*    Rounded distance.                                                  */  /*                                                                       */  static FT_F26Dot6  Round_To_Grid( EXEC_OP_ FT_F26Dot6  distance,                          FT_F26Dot6  compensation )  {    FT_F26Dot6  val;    FT_UNUSED_EXEC;    if ( distance >= 0 )    {      val = distance + compensation + 32;      if ( val > 0 )        val &= ~63;      else        val = 0;    }    else    {      val = -( ( compensation - distance + 32 ) & -64 );      if ( val > 0 )        val = 0;    }    return  val;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    Round_To_Half_Grid                                                 */  /*                                                                       */  /* <Description>                                                         */  /*    Rounds value to half grid after adding engine compensation.        */  /*                                                                       */  /* <Input>                                                               */  /*    distance     :: The distance to round.                             */  /*                                                                       */  /*    compensation :: The engine compensation.                           */  /*                                                                       */  /* <Return>                                                              */  /*    Rounded distance.                                                  */  /*                                                                       */  static FT_F26Dot6  Round_To_Half_Grid( EXEC_OP_ FT_F26Dot6  distance,                               FT_F26Dot6  compensation )  {    FT_F26Dot6  val;    FT_UNUSED_EXEC;    if ( distance >= 0 )    {      val = ( ( distance + compensation ) & -64 ) + 32;      if ( val < 0 )        val = 0;    }    else    {      val = -( ( (compensation - distance) & -64 ) + 32 );      if ( val > 0 )        val = 0;    }    return val;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    Round_Down_To_Grid                                                 */  /*                                                                       */  /* <Description>                                                         */  /*    Rounds value down to grid after adding engine compensation.        */  /*                                                                       */  /* <Input>                                                               */  /*    distance     :: The distance to round.                             */  /*                                                                       */  /*    compensation :: The engine compensation.                           */  /*                                                                       */  /* <Return>                                                              */  /*    Rounded distance.                                                  */  /*                                                                       */  static FT_F26Dot6  Round_Down_To_Grid( EXEC_OP_ FT_F26Dot6  distance,                               FT_F26Dot6  compensation )  {    FT_F26Dot6  val;    FT_UNUSED_EXEC;    if ( distance >= 0 )    {      val = distance + compensation;      if ( val > 0 )        val &= ~63;      else  

⌨️ 快捷键说明

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