您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FT_THROW函数代码示例

51自学网 2021-06-01 20:44:48
  C++
这篇教程C++ FT_THROW函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FT_THROW函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_THROW函数的具体用法?C++ FT_THROW怎么用?C++ FT_THROW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了FT_THROW函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: FT_Outline_EmboldenXY

  FT_Outline_EmboldenXY( FT_Outline*  outline,                         FT_Pos       xstrength,                         FT_Pos       ystrength )  {    FT_Vector*  points;    FT_Int      c, first, last;    FT_Int      orientation;    if ( !outline )      return FT_THROW( Invalid_Outline );    xstrength /= 2;    ystrength /= 2;    if ( xstrength == 0 && ystrength == 0 )      return FT_Err_Ok;    orientation = FT_Outline_Get_Orientation( outline );    if ( orientation == FT_ORIENTATION_NONE )    {      if ( outline->n_contours )        return FT_THROW( Invalid_Argument );      else        return FT_Err_Ok;    }    points = outline->points;    first = 0;    for ( c = 0; c < outline->n_contours; c++ )    {      FT_Vector  in, out, anchor, shift;      FT_Fixed   l_in, l_out, l_anchor = 0, l, q, d;      FT_Int     i, j, k;      l_in = 0;      last = outline->contours[c];      /* pacify compiler */      in.x = in.y = anchor.x = anchor.y = 0;      /* Counter j cycles though the points; counter i advances only  */      /* when points are moved; anchor k marks the first moved point. */      for ( i = last, j = first, k = -1;            j != i && i != k;            j = j < last ? j + 1 : first )      {        if ( j != k )        {          out.x = points[j].x - points[i].x;          out.y = points[j].y - points[i].y;          l_out = (FT_Fixed)FT_Vector_NormLen( &out );          if ( l_out == 0 )            continue;        }        else        {          out   = anchor;          l_out = l_anchor;        }        if ( l_in != 0 )        {          if ( k < 0 )          {            k        = i;            anchor   = in;            l_anchor = l_in;          }          d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y );          /* shift only if turn is less than ~160 degrees */          if ( d > -0xF000L )          {            d = d + 0x10000L;            /* shift components along lateral bisector in proper orientation */            shift.x = in.y + out.y;            shift.y = in.x + out.x;            if ( orientation == FT_ORIENTATION_TRUETYPE )              shift.x = -shift.x;            else              shift.y = -shift.y;            /* restrict shift magnitude to better handle collapsing segments */            q = FT_MulFix( out.x, in.y ) - FT_MulFix( out.y, in.x );            if ( orientation == FT_ORIENTATION_TRUETYPE )              q = -q;            l = FT_MIN( l_in, l_out );            /* non-strict inequalities avoid divide-by-zero when q == l == 0 */            if ( FT_MulFix( xstrength, q ) <= FT_MulFix( l, d ) )              shift.x = FT_MulDiv( shift.x, xstrength, d );            else              shift.x = FT_MulDiv( shift.x, l, q );//.........这里部分代码省略.........
开发者ID:CCExtractor,项目名称:ccextractor,代码行数:101,


示例2: FT_Stream_Open

  FT_Stream_Open( FT_Stream    stream,                  const char*  filepathname )  {    int          file;    struct stat  stat_buf;    if ( !stream )      return FT_THROW( Invalid_Stream_Handle );    /* open the file */    file = open( filepathname, O_RDONLY );    if ( file < 0 )    {      FT_ERROR(( "FT_Stream_Open:" ));      FT_ERROR(( " could not open `%s'/n", filepathname ));      return FT_THROW( Cannot_Open_Resource );    }    /* Here we ensure that a "fork" will _not_ duplicate   */    /* our opened input streams on Unix.  This is critical */    /* since it avoids some (possible) access control      */    /* issues and cleans up the kernel file table a bit.   */    /*                                                     */#ifdef F_SETFD#ifdef FD_CLOEXEC    (void)fcntl( file, F_SETFD, FD_CLOEXEC );#else    (void)fcntl( file, F_SETFD, 1 );#endif /* FD_CLOEXEC */#endif /* F_SETFD */    if ( fstat( file, &stat_buf ) < 0 )    {      FT_ERROR(( "FT_Stream_Open:" ));      FT_ERROR(( " could not `fstat' file `%s'/n", filepathname ));      goto Fail_Map;    }    /* XXX: TODO -- real 64bit platform support                        */    /*                                                                 */    /* `stream->size' is typedef'd to unsigned long (in `ftsystem.h'); */    /* `stat_buf.st_size', however, is usually typedef'd to off_t      */    /* (in sys/stat.h).                                                */    /* On some platforms, the former is 32bit and the latter is 64bit. */    /* To avoid overflow caused by fonts in huge files larger than     */    /* 2GB, do a test.  Temporary fix proposed by Sean McBride.        */    /*                                                                 */    if ( stat_buf.st_size > LONG_MAX )    {      FT_ERROR(( "FT_Stream_Open: file is too big/n" ));      goto Fail_Map;    }    else if ( stat_buf.st_size == 0 )    {      FT_ERROR(( "FT_Stream_Open: zero-length file/n" ));      goto Fail_Map;    }    /* This cast potentially truncates a 64bit to 32bit! */    stream->size = (unsigned long)stat_buf.st_size;    stream->pos  = 0;    stream->base = (unsigned char *)mmap( NULL,                                          stream->size,                                          PROT_READ,                                          MAP_FILE | MAP_PRIVATE,                                          file,                                          0 );    /* on some RTOS, mmap might return 0 */    if ( (long)stream->base != -1 && stream->base != NULL )      stream->close = ft_close_stream_by_munmap;    else    {      ssize_t  total_read_count;      FT_ERROR(( "FT_Stream_Open:" ));      FT_ERROR(( " could not `mmap' file `%s'/n", filepathname ));      stream->base = (unsigned char*)ft_alloc( NULL, stream->size );      if ( !stream->base )      {        FT_ERROR(( "FT_Stream_Open:" ));        FT_ERROR(( " could not `alloc' memory/n" ));        goto Fail_Map;      }      total_read_count = 0;      do      {        ssize_t  read_count;        read_count = read( file,                           stream->base + total_read_count,                           stream->size - total_read_count );        if ( read_count <= 0 )//.........这里部分代码省略.........
开发者ID:03050903,项目名称:libgdx,代码行数:101,


示例3: FT_Get_Glyph

  FT_Get_Glyph( FT_GlyphSlot  slot,                FT_Glyph     *aglyph )  {    FT_Library  library;    FT_Error    error;    FT_Glyph    glyph;    const FT_Glyph_Class*  clazz = NULL;    if ( !slot )      return FT_THROW( Invalid_Slot_Handle );    library = slot->library;    if ( !aglyph )      return FT_THROW( Invalid_Argument );    /* if it is a bitmap, that's easy :-) */    if ( slot->format == FT_GLYPH_FORMAT_BITMAP )      clazz = FT_BITMAP_GLYPH_CLASS_GET;    /* if it is an outline */    else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )      clazz = FT_OUTLINE_GLYPH_CLASS_GET;    else    {      /* try to find a renderer that supports the glyph image format */      FT_Renderer  render = FT_Lookup_Renderer( library, slot->format, 0 );      if ( render )        clazz = &render->glyph_class;    }    if ( !clazz )    {      error = FT_THROW( Invalid_Glyph_Format );      goto Exit;    }    /* create FT_Glyph object */    error = ft_new_glyph( library, clazz, &glyph );    if ( error )      goto Exit;    /* copy advance while converting 26.6 to 16.16 format */    glyph->advance.x = slot->advance.x * 1024;    glyph->advance.y = slot->advance.y * 1024;    /* now import the image from the glyph slot */    error = clazz->glyph_init( glyph, slot );    /* if an error occurred, destroy the glyph */    if ( error )      FT_Done_Glyph( glyph );    else      *aglyph = glyph;  Exit:    return error;  }
开发者ID:hsmith,项目名称:freetype,代码行数:63,


示例4: ft_gzip_check_header

  /* check and skip .gz header - we don't support `transparent' compression */  static FT_Error  ft_gzip_check_header( FT_Stream  stream )  {    FT_Error  error;    FT_Byte   head[4];    if ( FT_STREAM_SEEK( 0 )       ||         FT_STREAM_READ( head, 4 ) )      goto Exit;    /* head[0] && head[1] are the magic numbers;    */    /* head[2] is the method, and head[3] the flags */    if ( head[0] != 0x1f              ||         head[1] != 0x8b              ||         head[2] != Z_DEFLATED        ||        (head[3] & FT_GZIP_RESERVED)  )    {      error = FT_THROW( Invalid_File_Format );      goto Exit;    }    /* skip time, xflags and os code */    (void)FT_STREAM_SKIP( 6 );    /* skip the extra field */    if ( head[3] & FT_GZIP_EXTRA_FIELD )    {      FT_UInt  len;      if ( FT_READ_USHORT_LE( len ) ||           FT_STREAM_SKIP( len )    )        goto Exit;    }    /* skip original file name */    if ( head[3] & FT_GZIP_ORIG_NAME )      for (;;)      {        FT_UInt  c;        if ( FT_READ_BYTE( c ) )          goto Exit;        if ( c == 0 )          break;      }    /* skip .gz comment */    if ( head[3] & FT_GZIP_COMMENT )      for (;;)      {        FT_UInt  c;        if ( FT_READ_BYTE( c ) )          goto Exit;        if ( c == 0 )          break;      }    /* skip CRC */    if ( head[3] & FT_GZIP_HEAD_CRC )      if ( FT_STREAM_SKIP( 2 ) )        goto Exit;  Exit:    return error;  }
开发者ID:burningsun,项目名称:pecker_framework,代码行数:73,


示例5: FT_Stream_ReadFields

  FT_Stream_ReadFields( FT_Stream              stream,                        const FT_Frame_Field*  fields,                        void*                  structure )  {    FT_Error  error;    FT_Bool   frame_accessed = 0;    FT_Byte*  cursor;    if ( !fields )      return FT_THROW( Invalid_Argument );    if ( !stream )      return FT_THROW( Invalid_Stream_Handle );    cursor = stream->cursor;    error = FT_Err_Ok;    do    {      FT_ULong  value;      FT_Int    sign_shift;      FT_Byte*  p;      switch ( fields->value )      {      case ft_frame_start:  /* access a new frame */        error = FT_Stream_EnterFrame( stream, fields->offset );        if ( error )          goto Exit;        frame_accessed = 1;        cursor         = stream->cursor;        fields++;        continue;  /* loop! */      case ft_frame_bytes:  /* read a byte sequence */      case ft_frame_skip:   /* skip some bytes      */        {          FT_UInt  len = fields->size;          if ( cursor + len > stream->limit )          {            error = FT_THROW( Invalid_Stream_Operation );            goto Exit;          }          if ( fields->value == ft_frame_bytes )          {            p = (FT_Byte*)structure + fields->offset;            FT_MEM_COPY( p, cursor, len );          }          cursor += len;          fields++;          continue;        }      case ft_frame_byte:      case ft_frame_schar:  /* read a single byte */        value = FT_NEXT_BYTE( cursor );        sign_shift = 24;        break;      case ft_frame_short_be:      case ft_frame_ushort_be:  /* read a 2-byte big-endian short */        value = FT_NEXT_USHORT( cursor) ;        sign_shift = 16;        break;      case ft_frame_short_le:      case ft_frame_ushort_le:  /* read a 2-byte little-endian short */        value = FT_NEXT_USHORT_LE( cursor );        sign_shift = 16;        break;      case ft_frame_long_be:      case ft_frame_ulong_be:  /* read a 4-byte big-endian long */        value = FT_NEXT_ULONG( cursor );        sign_shift = 0;        break;      case ft_frame_long_le:      case ft_frame_ulong_le:  /* read a 4-byte little-endian long */        value = FT_NEXT_ULONG_LE( cursor );        sign_shift = 0;        break;      case ft_frame_off3_be:      case ft_frame_uoff3_be:  /* read a 3-byte big-endian long */        value = FT_NEXT_UOFF3( cursor );        sign_shift = 8;        break;      case ft_frame_off3_le:      case ft_frame_uoff3_le:  /* read a 3-byte little-endian long */        value = FT_NEXT_UOFF3_LE( cursor );        sign_shift = 8;        break;//.........这里部分代码省略.........
开发者ID:OpenTechEngine,项目名称:OpenTechBFG,代码行数:101,


示例6: ftc_snode_load

  /*   * This function tries to load a small bitmap within a given FTC_SNode.   * Note that it returns a non-zero error code _only_ in the case of   * out-of-memory condition.  For all other errors (e.g., corresponding   * to a bad font file), this function will mark the sbit as `unavailable'   * and return a value of 0.   *   * You should also read the comment within the @ftc_snode_compare   * function below to see how out-of-memory is handled during a lookup.   */  static FT_Error  ftc_snode_load( FTC_SNode    snode,                  FTC_Manager  manager,                  FT_UInt      gindex,                  FT_ULong    *asize )  {    FT_Error          error;    FTC_GNode         gnode  = FTC_GNODE( snode );    FTC_Family        family = gnode->family;    FT_Memory         memory = manager->memory;    FT_Face           face;    FTC_SBit          sbit;    FTC_SFamilyClass  clazz;    if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count )    {      FT_ERROR(( "ftc_snode_load: invalid glyph index" ));      return FT_THROW( Invalid_Argument );    }    sbit  = snode->sbits + ( gindex - gnode->gindex );    clazz = (FTC_SFamilyClass)family->clazz;    sbit->buffer = 0;    error = clazz->family_load_glyph( family, gindex, manager, &face );    if ( error )      goto BadGlyph;    {      FT_Int        temp;      FT_GlyphSlot  slot   = face->glyph;      FT_Bitmap*    bitmap = &slot->bitmap;      FT_Pos        xadvance, yadvance; /* FT_GlyphSlot->advance.{x|y} */      if ( slot->format != FT_GLYPH_FORMAT_BITMAP )      {        FT_TRACE0(( "ftc_snode_load:"                    " glyph loaded didn't return a bitmap/n" ));        goto BadGlyph;      }      /* Check whether our values fit into 8-bit containers!    */      /* If this is not the case, our bitmap is too large       */      /* and we will leave it as `missing' with sbit.buffer = 0 */#define CHECK_CHAR( d )  ( temp = (FT_Char)d, (FT_Int) temp == (FT_Int) d )#define CHECK_BYTE( d )  ( temp = (FT_Byte)d, (FT_UInt)temp == (FT_UInt)d )      /* horizontal advance in pixels */      xadvance = ( slot->advance.x + 32 ) >> 6;      yadvance = ( slot->advance.y + 32 ) >> 6;      if ( !CHECK_BYTE( bitmap->rows  )     ||           !CHECK_BYTE( bitmap->width )     ||           !CHECK_CHAR( bitmap->pitch )     ||           !CHECK_CHAR( slot->bitmap_left ) ||           !CHECK_CHAR( slot->bitmap_top  ) ||           !CHECK_CHAR( xadvance )          ||           !CHECK_CHAR( yadvance )          )      {        FT_TRACE2(( "ftc_snode_load:"                    " glyph too large for small bitmap cache/n"));        goto BadGlyph;      }      sbit->width     = (FT_Byte)bitmap->width;      sbit->height    = (FT_Byte)bitmap->rows;      sbit->pitch     = (FT_Char)bitmap->pitch;      sbit->left      = (FT_Char)slot->bitmap_left;      sbit->top       = (FT_Char)slot->bitmap_top;      sbit->xadvance  = (FT_Char)xadvance;      sbit->yadvance  = (FT_Char)yadvance;      sbit->format    = (FT_Byte)bitmap->pixel_mode;      sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);      /* copy the bitmap into a new buffer -- ignore error */      error = ftc_sbit_copy_bitmap( sbit, bitmap, memory );      /* now, compute size */      if ( asize )        *asize = (FT_ULong)FT_ABS( sbit->pitch ) * sbit->height;    } /* glyph loading successful */    /* ignore the errors that might have occurred --   */    /* we mark unloaded glyphs with `sbit.buffer == 0' */    /* and `width == 255', `height == 0'               *///.........这里部分代码省略.........
开发者ID:ImageMagick,项目名称:ttf,代码行数:101,


示例7: FT_New_Face_From_SFNT

  /* Create a new FT_Face from an SFNT resource, specified by res ID. */  static FT_Error  FT_New_Face_From_SFNT( FT_Library  library,                         ResID       sfnt_id,                         FT_Long     face_index,                         FT_Face*    aface )  {    Handle     sfnt = NULL;    FT_Byte*   sfnt_data;    size_t     sfnt_size;    FT_Error   error  = FT_Err_Ok;    FT_Memory  memory = library->memory;    int        is_cff, is_sfnt_ps;    sfnt = GetResource( TTAG_sfnt, sfnt_id );    if ( sfnt == NULL )      return FT_THROW( Invalid_Handle );    sfnt_size = (FT_ULong)GetHandleSize( sfnt );    if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )    {      ReleaseResource( sfnt );      return error;    }    ft_memcpy( sfnt_data, *sfnt, sfnt_size );    ReleaseResource( sfnt );    is_cff     = sfnt_size > 4 && !ft_memcmp( sfnt_data, "OTTO", 4 );    is_sfnt_ps = sfnt_size > 4 && !ft_memcmp( sfnt_data, "typ1", 4 );    if ( is_sfnt_ps )    {      FT_Stream  stream;      if ( FT_NEW( stream ) )        goto Try_OpenType;      FT_Stream_OpenMemory( stream, sfnt_data, sfnt_size );      if ( !open_face_PS_from_sfnt_stream( library,                                           stream,                                           face_index,                                           0, NULL,                                           aface ) )      {        FT_Stream_Close( stream );        FT_FREE( stream );        FT_FREE( sfnt_data );        goto Exit;      }      FT_FREE( stream );    }  Try_OpenType:    error = open_face_from_buffer( library,                                   sfnt_data,                                   sfnt_size,                                   face_index,                                   is_cff ? "cff" : "truetype",                                   aface );  Exit:    return error;  }
开发者ID:qaisjp,项目名称:green-candy,代码行数:65,


示例8: load_format_25

  static FT_Error  load_format_25( TT_Face    face,                  FT_Stream  stream,                  FT_ULong   post_limit )  {    FT_Memory  memory = stream->memory;    FT_Error   error;    FT_Int     num_glyphs;    FT_Char*   offset_table = NULL;    FT_UNUSED( post_limit );    /* UNDOCUMENTED!  This value appears only in the Apple TT specs. */    if ( FT_READ_USHORT( num_glyphs ) )      goto Exit;    /* check the number of glyphs */    if ( num_glyphs > face->max_profile.numGlyphs || num_glyphs > 258 )    {      error = FT_THROW( Invalid_File_Format );      goto Exit;    }    if ( FT_NEW_ARRAY( offset_table, num_glyphs )   ||         FT_STREAM_READ( offset_table, num_glyphs ) )      goto Fail;    /* now check the offset table */    {      FT_Int  n;      for ( n = 0; n < num_glyphs; n++ )      {        FT_Long  idx = (FT_Long)n + offset_table[n];        if ( idx < 0 || idx > num_glyphs )        {          error = FT_THROW( Invalid_File_Format );          goto Fail;        }      }    }    /* OK, set table fields and exit successfully */    {      TT_Post_25  table = &face->postscript_names.names.format_25;      table->num_glyphs = (FT_UShort)num_glyphs;      table->offsets    = offset_table;    }    return FT_Err_Ok;  Fail:    FT_FREE( offset_table );  Exit:    return error;  }
开发者ID:theqvd,项目名称:vcxsrv,代码行数:64,


示例9: tt_face_get_ps_name

  tt_face_get_ps_name( TT_Face      face,                       FT_UInt      idx,                       FT_String**  PSname )  {    FT_Error       error;    TT_Post_Names  names;    FT_Fixed       format;#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES    FT_Service_PsCMaps  psnames;#endif    if ( !face )      return FT_THROW( Invalid_Face_Handle );    if ( idx >= (FT_UInt)face->max_profile.numGlyphs )      return FT_THROW( Invalid_Glyph_Index );#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES    psnames = (FT_Service_PsCMaps)face->psnames;    if ( !psnames )      return FT_THROW( Unimplemented_Feature );#endif    names = &face->postscript_names;    /* `.notdef' by default */    *PSname = MAC_NAME( 0 );    format = face->postscript.FormatType;    if ( format == 0x00010000L )    {      if ( idx < 258 )                    /* paranoid checking */        *PSname = MAC_NAME( idx );    }    else if ( format == 0x00020000L )    {      TT_Post_20  table = &names->names.format_20;      if ( !names->loaded )      {        error = load_post_names( face );        if ( error )          goto End;      }      if ( idx < (FT_UInt)table->num_glyphs )      {        FT_UShort  name_index = table->glyph_indices[idx];        if ( name_index < 258 )          *PSname = MAC_NAME( name_index );        else          *PSname = (FT_String*)table->glyph_names[name_index - 258];      }    }    else if ( format == 0x00028000L )    {      TT_Post_25  table = &names->names.format_25;      if ( !names->loaded )      {        error = load_post_names( face );        if ( error )          goto End;      }      if ( idx < (FT_UInt)table->num_glyphs )    /* paranoid checking */        *PSname = MAC_NAME( (FT_Int)idx + table->offsets[idx] );    }    /* nothing to do for format == 0x00030000L */  End:    return FT_Err_Ok;  }
开发者ID:theqvd,项目名称:vcxsrv,代码行数:81,


示例10: pfr_phy_font_load

//.........这里部分代码省略.........    {      FT_UInt  n, count;      PFR_CHECK( 1 );      phy_font->num_blue_values = count = PFR_NEXT_BYTE( p );      PFR_CHECK( count * 2 );      if ( FT_NEW_ARRAY( phy_font->blue_values, count ) )        goto Fail;      for ( n = 0; n < count; n++ )        phy_font->blue_values[n] = PFR_NEXT_SHORT( p );    }    PFR_CHECK( 8 );    phy_font->blue_fuzz  = PFR_NEXT_BYTE( p );    phy_font->blue_scale = PFR_NEXT_BYTE( p );    phy_font->vertical.standard   = PFR_NEXT_USHORT( p );    phy_font->horizontal.standard = PFR_NEXT_USHORT( p );    /* read the character descriptors */    {      FT_UInt  n, count, Size;      phy_font->num_chars    = count = PFR_NEXT_USHORT( p );      phy_font->chars_offset = offset + (FT_Offset)( p - stream->cursor );      Size = 1 + 1 + 2;      if ( flags & PFR_PHY_2BYTE_CHARCODE )        Size += 1;      if ( flags & PFR_PHY_PROPORTIONAL )        Size += 2;      if ( flags & PFR_PHY_ASCII_CODE )        Size += 1;      if ( flags & PFR_PHY_2BYTE_GPS_SIZE )        Size += 1;      if ( flags & PFR_PHY_3BYTE_GPS_OFFSET )        Size += 1;      PFR_CHECK_SIZE( count * Size );      if ( FT_NEW_ARRAY( phy_font->chars, count ) )        goto Fail;      for ( n = 0; n < count; n++ )      {        PFR_Char  cur = &phy_font->chars[n];        cur->char_code = ( flags & PFR_PHY_2BYTE_CHARCODE )                         ? PFR_NEXT_USHORT( p )                         : PFR_NEXT_BYTE( p );        cur->advance   = ( flags & PFR_PHY_PROPORTIONAL )                         ? PFR_NEXT_SHORT( p )                         : phy_font->standard_advance;#if 0        cur->ascii     = ( flags & PFR_PHY_ASCII_CODE )                         ? PFR_NEXT_BYTE( p )                         : 0;#else        if ( flags & PFR_PHY_ASCII_CODE )          p += 1;#endif        cur->gps_size  = ( flags & PFR_PHY_2BYTE_GPS_SIZE )                         ? PFR_NEXT_USHORT( p )                         : PFR_NEXT_BYTE( p );        cur->gps_offset = ( flags & PFR_PHY_3BYTE_GPS_OFFSET )                          ? PFR_NEXT_ULONG( p )                          : PFR_NEXT_USHORT( p );      }    }    /* that's it! */  Fail:    FT_FRAME_EXIT();    /* save position of bitmap info */    phy_font->bct_offset = FT_STREAM_POS();    phy_font->cursor     = NULL;  Exit:    return error;  Too_Short:    error = FT_THROW( Invalid_Table );    FT_ERROR(( "pfr_phy_font_load: invalid physical font table/n" ));    goto Fail;  }
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:101,


示例11: load_format_20

  static FT_Error  load_format_20( TT_Face    face,                  FT_Stream  stream,                  FT_ULong   post_limit )  {    FT_Memory   memory = stream->memory;    FT_Error    error;    FT_Int      num_glyphs;    FT_UShort   num_names;    FT_UShort*  glyph_indices = NULL;    FT_Char**   name_strings  = NULL;    if ( FT_READ_USHORT( num_glyphs ) )      goto Exit;    /* UNDOCUMENTED!  The number of glyphs in this table can be smaller */    /* than the value in the maxp table (cf. cyberbit.ttf).             */    /* There already exist fonts which have more than 32768 glyph names */    /* in this table, so the test for this threshold has been dropped.  */    if ( num_glyphs > face->max_profile.numGlyphs )    {      error = FT_THROW( Invalid_File_Format );      goto Exit;    }    /* load the indices */    {      FT_Int  n;      if ( FT_NEW_ARRAY ( glyph_indices, num_glyphs ) ||           FT_FRAME_ENTER( num_glyphs * 2L )          )        goto Fail;      for ( n = 0; n < num_glyphs; n++ )        glyph_indices[n] = FT_GET_USHORT();      FT_FRAME_EXIT();    }    /* compute number of names stored in table */    {      FT_Int  n;      num_names = 0;      for ( n = 0; n < num_glyphs; n++ )      {        FT_Int  idx;        idx = glyph_indices[n];        if ( idx >= 258 )        {          idx -= 257;          if ( idx > num_names )            num_names = (FT_UShort)idx;        }      }    }    /* now load the name strings */    {      FT_UShort  n;      if ( FT_NEW_ARRAY( name_strings, num_names ) )        goto Fail;      for ( n = 0; n < num_names; n++ )      {        FT_UInt  len;        if ( FT_STREAM_POS() >= post_limit )          break;        else        {          FT_TRACE6(( "load_format_20: %d byte left in post table/n",                      post_limit - FT_STREAM_POS() ));          if ( FT_READ_BYTE( len ) )            goto Fail1;        }        if ( len > post_limit                   ||             FT_STREAM_POS() > post_limit - len )        {          FT_Int  d = (FT_Int)post_limit - (FT_Int)FT_STREAM_POS();          FT_ERROR(( "load_format_20:"                     " exceeding string length (%d),"                     " truncating at end of post table (%d byte left)/n",//.........这里部分代码省略.........
开发者ID:theqvd,项目名称:vcxsrv,代码行数:101,


示例12: pfr_extra_item_load_kerning_pairs

  pfr_extra_item_load_kerning_pairs( FT_Byte*     p,                                     FT_Byte*     limit,                                     PFR_PhyFont  phy_font )  {    PFR_KernItem  item   = NULL;    FT_Error      error  = FT_Err_Ok;    FT_Memory     memory = phy_font->memory;    if ( FT_NEW( item ) )      goto Exit;    PFR_CHECK( 4 );    item->pair_count = PFR_NEXT_BYTE( p );    item->base_adj   = PFR_NEXT_SHORT( p );    item->flags      = PFR_NEXT_BYTE( p );    item->offset     = phy_font->offset +                       (FT_Offset)( p - phy_font->cursor );#ifndef PFR_CONFIG_NO_CHECKS    item->pair_size = 3;    if ( item->flags & PFR_KERN_2BYTE_CHAR )      item->pair_size += 2;    if ( item->flags & PFR_KERN_2BYTE_ADJ )      item->pair_size += 1;    PFR_CHECK( item->pair_count * item->pair_size );#endif    /* load first and last pairs into the item to speed up */    /* lookup later...                                     */    if ( item->pair_count > 0 )    {      FT_UInt   char1, char2;      FT_Byte*  q;      if ( item->flags & PFR_KERN_2BYTE_CHAR )      {        q     = p;        char1 = PFR_NEXT_USHORT( q );        char2 = PFR_NEXT_USHORT( q );        item->pair1 = PFR_KERN_INDEX( char1, char2 );        q = p + item->pair_size * ( item->pair_count - 1 );        char1 = PFR_NEXT_USHORT( q );        char2 = PFR_NEXT_USHORT( q );        item->pair2 = PFR_KERN_INDEX( char1, char2 );      }      else      {        q     = p;        char1 = PFR_NEXT_BYTE( q );        char2 = PFR_NEXT_BYTE( q );        item->pair1 = PFR_KERN_INDEX( char1, char2 );        q = p + item->pair_size * ( item->pair_count - 1 );        char1 = PFR_NEXT_BYTE( q );        char2 = PFR_NEXT_BYTE( q );        item->pair2 = PFR_KERN_INDEX( char1, char2 );      }      /* add new item to the current list */      item->next                 = NULL;      *phy_font->kern_items_tail = item;      phy_font->kern_items_tail  = &item->next;      phy_font->num_kern_pairs  += item->pair_count;    }    else    {      /* empty item! */      FT_FREE( item );    }  Exit:    return error;  Too_Short:    FT_FREE( item );    error = FT_THROW( Invalid_Table );    FT_ERROR(( "pfr_extra_item_load_kerning_pairs:"               " invalid kerning pairs table/n" ));    goto Exit;  }
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:92,


示例13: pfr_extra_item_load_bitmap_info

  pfr_extra_item_load_bitmap_info( FT_Byte*     p,                                   FT_Byte*     limit,                                   PFR_PhyFont  phy_font )  {    FT_Memory   memory = phy_font->memory;    PFR_Strike  strike;    FT_UInt     flags0;    FT_UInt     n, count, size1;    FT_Error    error = FT_Err_Ok;    PFR_CHECK( 5 );    p     += 3;  /* skip bctSize */    flags0 = PFR_NEXT_BYTE( p );    count  = PFR_NEXT_BYTE( p );    /* re-allocate when needed */    if ( phy_font->num_strikes + count > phy_font->max_strikes )    {      FT_UInt  new_max = FT_PAD_CEIL( phy_font->num_strikes + count, 4 );      if ( FT_RENEW_ARRAY( phy_font->strikes,                           phy_font->num_strikes,                           new_max ) )        goto Exit;      phy_font->max_strikes = new_max;    }    size1 = 1 + 1 + 1 + 2 + 2 + 1;    if ( flags0 & PFR_STRIKE_2BYTE_XPPM )      size1++;    if ( flags0 & PFR_STRIKE_2BYTE_YPPM )      size1++;    if ( flags0 & PFR_STRIKE_3BYTE_SIZE )      size1++;    if ( flags0 & PFR_STRIKE_3BYTE_OFFSET )      size1++;    if ( flags0 & PFR_STRIKE_2BYTE_COUNT )      size1++;    strike = phy_font->strikes + phy_font->num_strikes;    PFR_CHECK( count * size1 );    for ( n = 0; n < count; n++, strike++ )    {      strike->x_ppm       = ( flags0 & PFR_STRIKE_2BYTE_XPPM )                            ? PFR_NEXT_USHORT( p )                            : PFR_NEXT_BYTE( p );      strike->y_ppm       = ( flags0 & PFR_STRIKE_2BYTE_YPPM )                            ? PFR_NEXT_USHORT( p )                            : PFR_NEXT_BYTE( p );      strike->flags       = PFR_NEXT_BYTE( p );      strike->bct_size    = ( flags0 & PFR_STRIKE_3BYTE_SIZE )                            ? PFR_NEXT_ULONG( p )                            : PFR_NEXT_USHORT( p );      strike->bct_offset  = ( flags0 & PFR_STRIKE_3BYTE_OFFSET )                            ? PFR_NEXT_ULONG( p )                            : PFR_NEXT_USHORT( p );      strike->num_bitmaps = ( flags0 & PFR_STRIKE_2BYTE_COUNT )                            ? PFR_NEXT_USHORT( p )                            : PFR_NEXT_BYTE( p );    }    phy_font->num_strikes += count;  Exit:    return error;  Too_Short:    error = FT_THROW( Invalid_Table );    FT_ERROR(( "pfr_extra_item_load_bitmap_info:"               " invalid bitmap info table/n" ));    goto Exit;  }
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:87,


示例14: pfr_log_font_load

  pfr_log_font_load( PFR_LogFont  log_font,                     FT_Stream    stream,                     FT_UInt      idx,                     FT_UInt32    section_offset,                     FT_Bool      size_increment )  {    FT_UInt    num_log_fonts;    FT_UInt    flags;    FT_UInt32  offset;    FT_UInt32  size;    FT_Error   error;    if ( FT_STREAM_SEEK( section_offset ) ||         FT_READ_USHORT( num_log_fonts )  )      goto Exit;    if ( idx >= num_log_fonts )      return FT_THROW( Invalid_Argument );    if ( FT_STREAM_SKIP( idx * 5 ) ||         FT_READ_USHORT( size )    ||         FT_READ_UOFF3 ( offset )  )      goto Exit;    /* save logical font size and offset */    log_font->size   = size;    log_font->offset = offset;    /* now, check the rest of the table before loading it */    {      FT_Byte*  p;      FT_Byte*  limit;      FT_UInt   local;      if ( FT_STREAM_SEEK( offset ) ||           FT_FRAME_ENTER( size )   )        goto Exit;      p     = stream->cursor;      limit = p + size;      PFR_CHECK( 13 );      log_font->matrix[0] = PFR_NEXT_LONG( p );      log_font->matrix[1] = PFR_NEXT_LONG( p );      log_font->matrix[2] = PFR_NEXT_LONG( p );      log_font->matrix[3] = PFR_NEXT_LONG( p );      flags = PFR_NEXT_BYTE( p );      local = 0;      if ( flags & PFR_LOG_STROKE )      {        local++;        if ( flags & PFR_LOG_2BYTE_STROKE )          local++;        if ( ( flags & PFR_LINE_JOIN_MASK ) == PFR_LINE_JOIN_MITER )          local += 3;      }      if ( flags & PFR_LOG_BOLD )      {        local++;        if ( flags & PFR_LOG_2BYTE_BOLD )          local++;      }      PFR_CHECK( local );      if ( flags & PFR_LOG_STROKE )      {        log_font->stroke_thickness = ( flags & PFR_LOG_2BYTE_STROKE )                                     ? PFR_NEXT_SHORT( p )                                     : PFR_NEXT_BYTE( p );        if ( ( flags & PFR_LINE_JOIN_MASK ) == PFR_LINE_JOIN_MITER )          log_font->miter_limit = PFR_NEXT_LONG( p );      }      if ( flags & PFR_LOG_BOLD )      {        log_font->bold_thickness = ( flags & PFR_LOG_2BYTE_BOLD )                                   ? PFR_NEXT_SHORT( p )                                   : PFR_NEXT_BYTE( p );      }      if ( flags & PFR_LOG_EXTRA_ITEMS )      {        error = pfr_extra_items_skip( &p, limit );        if ( error )          goto Fail;      }      PFR_CHECK( 5 );      log_font->phys_size   = PFR_NEXT_USHORT( p );      log_font->phys_offset = PFR_NEXT_ULONG( p );      if ( size_increment )      {//.........这里部分代码省略.........
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:101,


示例15: cid_load_glyph

  cid_load_glyph( T1_Decoder  decoder,                  FT_UInt     glyph_index )  {    CID_Face       face = (CID_Face)decoder->builder.face;    CID_FaceInfo   cid  = &face->cid;    FT_Byte*       p;    FT_ULong       fd_select;    FT_Stream      stream       = face->cid_stream;    FT_Error       error        = FT_Err_Ok;    FT_Byte*       charstring   = NULL;    FT_Memory      memory       = face->root.memory;    FT_ULong       glyph_length = 0;    PSAux_Service  psaux        = (PSAux_Service)face->psaux;#ifdef FT_CONFIG_OPTION_INCREMENTAL    FT_Incremental_InterfaceRec *inc =                                  face->root.internal->incremental_interface;#endif    FT_TRACE1(( "cid_load_glyph: glyph index %d/n", glyph_index ));#ifdef FT_CONFIG_OPTION_INCREMENTAL    /* For incremental fonts get the character data using */    /* the callback function.                             */    if ( inc )    {      FT_Data  glyph_data;      error = inc->funcs->get_glyph_data( inc->object,                                          glyph_index, &glyph_data );      if ( error )        goto Exit;      p         = (FT_Byte*)glyph_data.pointer;      fd_select = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );      if ( glyph_data.length != 0 )      {        glyph_length = (FT_ULong)( glyph_data.length - cid->fd_bytes );        (void)FT_ALLOC( charstring, glyph_length );        if ( !error )          ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,                     glyph_length );      }      inc->funcs->free_glyph_data( inc->object, &glyph_data );      if ( error )        goto Exit;    }    else#endif /* FT_CONFIG_OPTION_INCREMENTAL */    /* For ordinary fonts read the CID font dictionary index */    /* and charstring offset from the CIDMap.                */    {      FT_UInt   entry_len = (FT_UInt)( cid->fd_bytes + cid->gd_bytes );      FT_ULong  off1;      if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset +                           glyph_index * entry_len )               ||           FT_FRAME_ENTER( 2 * entry_len )                         )        goto Exit;      p            = (FT_Byte*)stream->cursor;      fd_select    = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );      off1         = cid_get_offset( &p, (FT_Byte)cid->gd_bytes );      p           += cid->fd_bytes;      glyph_length = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1;      FT_FRAME_EXIT();      if ( fd_select >= (FT_ULong)cid->num_dicts )      {        error = FT_THROW( Invalid_Offset );        goto Exit;      }      if ( glyph_length == 0 )        goto Exit;      if ( FT_ALLOC( charstring, glyph_length ) )        goto Exit;      if ( FT_STREAM_READ_AT( cid->data_offset + off1,                              charstring, glyph_length ) )        goto Exit;    }    /* Now set up the subrs array and parse the charstrings. */    {      CID_FaceDict  dict;      CID_Subrs     cid_subrs = face->subrs + fd_select;      FT_UInt       cs_offset;      /* Set up subrs */      decoder->num_subrs = cid_subrs->num_subrs;//.........这里部分代码省略.........
开发者ID:Blitzker,项目名称:assfilter,代码行数:101,


示例16: cid_parser_new

  cid_parser_new( CID_Parser*    parser,                  FT_Stream      stream,                  FT_Memory      memory,                  PSAux_Service  psaux )  {    FT_Error  error;    FT_ULong  base_offset, offset, ps_len;    FT_Byte   *cur, *limit;    FT_Byte   *arg1, *arg2;    FT_MEM_ZERO( parser, sizeof ( *parser ) );    psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );    parser->stream = stream;    base_offset = FT_STREAM_POS();    /* first of all, check the font format in the header */    if ( FT_FRAME_ENTER( 31 ) )      goto Exit;    if ( ft_strncmp( (char *)stream->cursor,                     "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) )    {      FT_TRACE2(( "  not a CID-keyed font/n" ));      error = FT_THROW( Unknown_File_Format );    }    FT_FRAME_EXIT();    if ( error )      goto Exit;  Again:    /* now, read the rest of the file until we find */    /* `StartData' or `/sfnts'                      */    {      FT_Byte   buffer[256 + 10];      FT_Long   read_len = 256 + 10; /* same as signed FT_Stream->size */      FT_Byte*  p        = buffer;      for ( offset = FT_STREAM_POS(); ; offset += 256 )      {        FT_Long  stream_len; /* same as signed FT_Stream->size */        stream_len = stream->size - FT_STREAM_POS();        if ( stream_len == 0 )        {          FT_TRACE2(( "cid_parser_new: no `StartData' keyword found/n" ));          error = FT_THROW( Invalid_File_Format );          goto Exit;        }        read_len = FT_MIN( read_len, stream_len );        if ( FT_STREAM_READ( p, read_len ) )          goto Exit;        if ( read_len < 256 )          p[read_len]  = '/0';        limit = p + read_len - 10;        for ( p = buffer; p < limit; p++ )        {          if ( p[0] == 'S' && ft_strncmp( (char*)p, "StartData", 9 ) == 0 )          {            /* save offset of binary data after `StartData' */            offset += p - buffer + 10;            goto Found;          }          else if ( p[1] == 's' && ft_strncmp( (char*)p, "/sfnts", 6 ) == 0 )          {            offset += p - buffer + 7;            goto Found;          }        }        FT_MEM_MOVE( buffer, p, 10 );        read_len = 256;        p = buffer + 10;      }    }  Found:    /* We have found the start of the binary data or the `/sfnts' token. */    /* Now rewind and extract the frame corresponding to this PostScript */    /* section.                                                          */    ps_len = offset - base_offset;    if ( FT_STREAM_SEEK( base_offset )                  ||         FT_FRAME_EXTRACT( ps_len, parser->postscript ) )      goto Exit;    parser->data_offset    = offset;    parser->postscript_len = ps_len;    parser->root.base      = parser->postscript;    parser->root.cursor    = parser->postscript;    parser->root.limit     = parser->root.cursor + ps_len;//.........这里部分代码省略.........
开发者ID:dmdware,项目名称:vec,代码行数:101,


示例17: Load_SBit_Png

  Load_SBit_Png( FT_GlyphSlot     slot,                 FT_Int           x_offset,                 FT_Int           y_offset,                 FT_Int           pix_bits,                 TT_SBit_Metrics  metrics,                 FT_Memory        memory,                 FT_Byte*         data,                 FT_UInt          png_len,                 FT_Bool          populate_map_and_metrics )  {    FT_Bitmap    *map   = &slot->bitmap;    FT_Error      error = FT_Err_Ok;    FT_StreamRec  stream;    png_structp  png;    png_infop    info;    png_uint_32  imgWidth, imgHeight;    int         bitdepth, color_type, interlace;    FT_Int      i;    png_byte*  *rows = NULL; /* pacify compiler */    if ( x_offset < 0 ||         y_offset < 0 )    {      error = FT_THROW( Invalid_Argument );      goto Exit;    }    if ( !populate_map_and_metrics                            &&         ( (FT_UInt)x_offset + metrics->width  > map->width ||           (FT_UInt)y_offset + metrics->height > map->rows  ||           pix_bits != 32                                   ||           map->pixel_mode != FT_PIXEL_MODE_BGRA            ) )    {      error = FT_THROW( Invalid_Argument );      goto Exit;    }    FT_Stream_OpenMemory( &stream, data, png_len );    png = png_create_read_struct( PNG_LIBPNG_VER_STRING,                                  &error,                                  error_callback,                                  warning_callback );    if ( !png )    {      error = FT_THROW( Out_Of_Memory );      goto Exit;    }    info = png_create_info_struct( png );    if ( !info )    {      error = FT_THROW( Out_Of_Memory );      png_destroy_read_struct( &png, NULL, NULL );      goto Exit;    }    if ( ft_setjmp( png_jmpbuf( png ) ) )    {      error = FT_THROW( Invalid_File_Format );      goto DestroyExit;    }    png_set_read_fn( png, &stream, read_data_from_FT_Stream );    png_read_info( png, info );    png_get_IHDR( png, info,                  &imgWidth, &imgHeight,                  &bitdepth, &color_type, &interlace,                  NULL, NULL );    if ( error                                        ||         ( !populate_map_and_metrics                &&           ( (FT_Int)imgWidth  != metrics->width  ||             (FT_Int)imgHeight != metrics->height ) ) )      goto DestroyExit;    if ( populate_map_and_metrics )    {      FT_ULong  size;      metrics->width  = (FT_UShort)imgWidth;      metrics->height = (FT_UShort)imgHeight;      map->width      = metrics->width;      map->rows       = metrics->height;      map->pixel_mode = FT_PIXEL_MODE_BGRA;      map->pitch      = (int)( map->width * 4 );      map->num_grays  = 256;      /* reject too large bitmaps similarly to the rasterizer */      if ( map->rows > 0x7FFF || map->width > 0x7FFF )      {        error = FT_THROW( Array_Too_Large );        goto DestroyExit;      }//.........这里部分代码省略.........
开发者ID:hsmith,项目名称:freetype,代码行数:101,


示例18: af_face_globals_get_metrics

  af_face_globals_get_metrics( AF_FaceGlobals    globals,                               FT_UInt           gindex,                               FT_UInt           options,                               AF_StyleMetrics  *ametrics )  {    AF_StyleMetrics  metrics = NULL;    AF_Style               style = (AF_Style)options;    AF_WritingSystemClass  writing_system_class;    AF_StyleClass          style_class;    FT_Error  error = FT_Err_Ok;    if ( gindex >= (FT_ULong)globals->glyph_count )    {      error = FT_THROW( Invalid_Argument );      goto Exit;    }    /* if we have a forced style (via `options'), use it, */    /* otherwise look into `glyph_styles' array           */    if ( style == AF_STYLE_NONE_DFLT || style + 1 >= AF_STYLE_MAX )      style = (AF_Style)( globals->glyph_styles[gindex] &                          AF_STYLE_UNASSIGNED           );    style_class          = AF_STYLE_CLASSES_GET[style];    writing_system_class = AF_WRITING_SYSTEM_CLASSES_GET                             [style_class->writing_system];    metrics = globals->metrics[style];    if ( metrics == NULL )    {      /* create the global metrics object if necessary */      FT_Memory  memory = globals->face->memory;      if ( FT_ALLOC( metrics, writing_system_class->style_metrics_size ) )        goto Exit;      metrics->style_class = style_class;      metrics->globals     = globals;      if ( writing_system_class->style_metrics_init )      {        error = writing_system_class->style_metrics_init( metrics,                                                          globals->face );        if ( error )        {          if ( writing_system_class->style_metrics_done )            writing_system_class->style_metrics_done( metrics );          FT_FREE( metrics );          goto Exit;        }      }      globals->metrics[style] = metrics;    }  Exit:    *ametrics = metrics;    return error;  }
开发者ID:AaronNGray,项目名称:texlive-libs,代码行数:65,


示例19: read_lwfn

  /* Read Type 1 data from the POST resources inside the LWFN file,     return a PFB buffer.  This is somewhat convoluted because the FT2     PFB parser wants the ASCII header as one chunk, and the LWFN     chunks are often not organized that way, so we glue chunks     of the same type together. */  static FT_Error  read_lwfn( FT_Memory      memory,             ResFileRefNum  res,             FT_Byte**      pfb_data,             FT_ULong*      size )  {    FT_Error       error = FT_Err_Ok;    ResID          res_id;    unsigned char  *buffer, *p, *size_p = NULL;    FT_ULong       total_size = 0;    FT_ULong       old_total_size = 0;    FT_ULong       post_size, pfb_chunk_size;    Handle         post_data;    char           code, last_code;    UseResFile( res );    /* First pass: load all POST resources, and determine the size of */    /* the output buffer.                                             */    res_id    = 501;    last_code = -1;    for (;;)    {      post_data = Get1Resource( TTAG_POST, res_id++ );      if ( post_data == NULL )        break;  /* we are done */      code = (*post_data)[0];      if ( code != last_code )      {        if ( code == 5 )          total_size += 2; /* just the end code */        else          total_size += 6; /* code + 4 bytes chunk length */      }      total_size += GetHandleSize( post_data ) - 2;      last_code = code;      /* detect integer overflows */      if ( total_size < old_total_size )      {        error = FT_THROW( Array_Too_Large );        goto Error;      }      old_total_size = total_size;    }    if ( FT_ALLOC( buffer, (FT_Long)total_size ) )      goto Error;    /* Second pass: append all POST data to the buffer, add PFB fields. */    /* Glue all consecutive chunks of the same type together.           */    p              = buffer;    res_id         = 501;    last_code      = -1;    pfb_chunk_size = 0;    for (;;)    {      post_data = Get1Resource( TTAG_POST, res_id++ );      if ( post_data == NULL )        break;  /* we are done */      post_size = (FT_ULong)GetHandleSize( post_data ) - 2;      code = (*post_data)[0];      if ( code != last_code )      {        if ( last_code != -1 )        {          /* we are done adding a chunk, fill in the size field */          if ( size_p != NULL )          {            *size_p++ = (FT_Byte)(   pfb_chunk_size         & 0xFF );            *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 8  ) & 0xFF );            *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 16 ) & 0xFF );            *size_p++ = (FT_Byte)( ( pfb_chunk_size >> 24 ) & 0xFF );          }          pfb_chunk_size = 0;        }        *p++ = 0x80;        if ( code == 5 )          *p++ = 0x03;  /* the end */        else if ( code == 2 )          *p++ = 0x02;  /* binary segment */        else          *p++ = 0x01;  /* ASCII segment */        if ( code != 5 )//.........这里部分代码省略.........
开发者ID:qaisjp,项目名称:green-candy,代码行数:101,


示例20: af_shaper_get_coverage

  FT_Error  af_shaper_get_coverage( AF_FaceGlobals  globals,                          AF_StyleClass   style_class,                          FT_UShort*      gstyles,                          FT_Bool         default_script )  {    hb_face_t*  face;    hb_set_t*  gsub_lookups = NULL; /* GSUB lookups for a given script */    hb_set_t*  gsub_glyphs  = NULL; /* glyphs covered by GSUB lookups  */    hb_set_t*  gpos_lookups = NULL; /* GPOS lookups for a given script */    hb_set_t*  gpos_glyphs  = NULL; /* glyphs covered by GPOS lookups  */    hb_script_t      script;    const hb_tag_t*  coverage_tags;    hb_tag_t         script_tags[] = { HB_TAG_NONE,                                       HB_TAG_NONE,                                       HB_TAG_NONE,                                       HB_TAG_NONE };    hb_codepoint_t  idx;#ifdef FT_DEBUG_LEVEL_TRACE    int             count;#endif    if ( !globals || !style_class || !gstyles )      return FT_THROW( Invalid_Argument );    face = hb_font_get_face( globals->hb_font );    coverage_tags = coverages[style_class->coverage];    script        = scripts[style_class->script];    /* Convert a HarfBuzz script tag into the corresponding OpenType */    /* tag or tags -- some Indic scripts like Devanagari have an old */    /* and a new set of features.                                    */    hb_ot_tags_from_script( script,                            &script_tags[0],                            &script_tags[1] );    /* `hb_ot_tags_from_script' usually returns HB_OT_TAG_DEFAULT_SCRIPT */    /* as the second tag.  We change that to HB_TAG_NONE except for the  */    /* default script.                                                   */    if ( default_script )    {      if ( script_tags[0] == HB_TAG_NONE )        script_tags[0] = HB_OT_TAG_DEFAULT_SCRIPT;      else      {        if ( script_tags[1] == HB_TAG_NONE )          script_tags[1] = HB_OT_TAG_DEFAULT_SCRIPT;        else if ( script_tags[1] != HB_OT_TAG_DEFAULT_SCRIPT )          script_tags[2] = HB_OT_TAG_DEFAULT_SCRIPT;      }    }    else    {      /* we use non-standard tags like `khms' for special purposes;       */      /* HarfBuzz maps them to `DFLT', which we don't want to handle here */      if ( script_tags[0] == HB_OT_TAG_DEFAULT_SCRIPT )        goto Exit;      if ( script_tags[1] == HB_OT_TAG_DEFAULT_SCRIPT )        script_tags[1] = HB_TAG_NONE;    }    gsub_lookups = hb_set_create();    hb_ot_layout_collect_lookups( face,                                  HB_OT_TAG_GSUB,                                  script_tags,                                  NULL,                                  coverage_tags,                                  gsub_lookups );    if ( hb_set_is_empty( gsub_lookups ) )      goto Exit; /* nothing to do */    FT_TRACE4(( "GSUB lookups (style `%s'):/n"                " ",                af_style_names[style_class->style] ));#ifdef FT_DEBUG_LEVEL_TRACE    count = 0;#endif    gsub_glyphs = hb_set_create();    for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); )    {#ifdef FT_DEBUG_LEVEL_TRACE      FT_TRACE4(( " %d", idx ));      count++;#endif      /* get output coverage of GSUB feature */      hb_ot_layout_lookup_collect_glyphs( face,                                          HB_OT_TAG_GSUB,                                          idx,                                          NULL,                                          NULL,//.........这里部分代码省略.........
开发者ID:93i,项目名称:godot,代码行数:101,


示例21: FT_New_Face_From_FOND

  FT_New_Face_From_FOND( FT_Library  library,                         Handle      fond,                         FT_Long     face_index,                         FT_Face*    aface )  {    short     have_sfnt, have_lwfn = 0;    ResID     sfnt_id, fond_id;    OSType    fond_type;    Str255    fond_name;    Str255    lwfn_file_name;    UInt8     path_lwfn[PATH_MAX];    OSErr     err;    FT_Error  error = FT_Err_Ok;    GetResInfo( fond, &fond_id, &fond_type, fond_name );    if ( ResError() != noErr || fond_type != TTAG_FOND )      return FT_THROW( Invalid_File_Format );    parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );    if ( lwfn_file_name[0] )    {      ResFileRefNum  res;      res = HomeResFile( fond );      if ( noErr != ResError() )        goto found_no_lwfn_file;      {        UInt8  path_fond[PATH_MAX];        FSRef  ref;        err = FSGetForkCBInfo( res, kFSInvalidVolumeRefNum,                               NULL, NULL, NULL, &ref, NULL );        if ( noErr != err )          goto found_no_lwfn_file;        err = FSRefMakePath( &ref, path_fond, sizeof ( path_fond ) );        if ( noErr != err )          goto found_no_lwfn_file;        error = lookup_lwfn_by_fond( path_fond, lwfn_file_name,                                     path_lwfn, sizeof ( path_lwfn ) );        if ( !error )          have_lwfn = 1;      }    }    if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )      error = FT_New_Face_From_LWFN( library,                                     path_lwfn,                                     face_index,                                     aface );    else      error = FT_THROW( Unknown_File_Format );  found_no_lwfn_file:    if ( have_sfnt && error )      error = FT_New_Face_From_SFNT( library,                                     sfnt_id,                                     face_index,                                     aface );    return error;  }
开发者ID:qaisjp,项目名称:green-candy,代码行数:68,


示例22: af_loader_load_g

//.........这里部分代码省略.........          }          num_points     = gloader->base.outline.n_points;          num_new_points = num_points - num_base_points;          /* now perform the transformation required for this subglyph */          if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE    |                                   FT_SUBGLYPH_FLAG_XY_SCALE |                                   FT_SUBGLYPH_FLAG_2X2      ) )          {            FT_Vector*  cur   = gloader->base.outline.points +                                num_base_points;            FT_Vector*  limit = cur + num_new_points;            for ( ; cur < limit; cur++ )              FT_Vector_Transform( cur, &subglyph->transform );          }          /* apply offset */          if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ) )          {            FT_Int      k = subglyph->arg1;            FT_UInt     l = subglyph->arg2;            FT_Vector*  p1;            FT_Vector*  p2;            if ( start_point + k >= num_base_points         ||                               l >= (FT_UInt)num_new_points )            {              error = FT_THROW( Invalid_Composite );              goto Exit;            }            l += num_base_points;            /* for now, only use the current point coordinates; */            /* we eventually may consider another approach      */            p1 = gloader->base.outline.points + start_point + k;            p2 = gloader->base.outline.points + start_point + l;            x = p1->x - p2->x;            y = p1->y - p2->y;          }          else          {            x = FT_MulFix( subglyph->arg1, hints->x_scale ) + hints->x_delta;            y = FT_MulFix( subglyph->arg2, hints->y_scale ) + hints->y_delta;            x = FT_PIX_ROUND( x );            y = FT_PIX_ROUND( y );          }          {            FT_Outline  dummy = gloader->base.outline;            dummy.points  += num_base_points;            dummy.n_points = (short)num_new_points;            FT_Outline_Translate( &dummy, x, y );          }        }
开发者ID:DjinCN,项目名称:libFreeType2,代码行数:67,


示例23: FT_Stream_EnterFrame

  FT_Stream_EnterFrame( FT_Stream  stream,                        FT_ULong   count )  {    FT_Error  error = FT_Err_Ok;    FT_ULong  read_bytes;    /* check for nested frame access */    FT_ASSERT( stream && stream->cursor == 0 );    if ( stream->read )    {      /* allocate the frame in memory */      FT_Memory  memory = stream->memory;      /* simple sanity check */      if ( count > stream->size )      {        FT_ERROR(( "FT_Stream_EnterFrame:"                   " frame size (%lu) larger than stream size (%lu)/n",                   count, stream->size ));        error = FT_THROW( Invalid_Stream_Operation );        goto Exit;      }#ifdef FT_DEBUG_MEMORY      /* assume _ft_debug_file and _ft_debug_lineno are already set */      stream->base = (unsigned char*)ft_mem_qalloc( memory, count, &error );      if ( error )        goto Exit;#else      if ( FT_QALLOC( stream->base, count ) )        goto Exit;#endif      /* read it */      read_bytes = stream->read( stream, stream->pos,                                 stream->base, count );      if ( read_bytes < count )      {        FT_ERROR(( "FT_Stream_EnterFrame:"                   " invalid read; expected %lu bytes, got %lu/n",                   count, read_bytes ));        FT_FREE( stream->base );        error = FT_THROW( Invalid_Stream_Operation );      }      stream->cursor = stream->base;      stream->limit  = stream->cursor + count;      stream->pos   += read_bytes;    }    else    {      /* check current and new position */      if ( stream->pos >= stream->size        ||           stream->size - stream->pos < count )      {        FT_ERROR(( "FT_Stream_EnterFrame:"                   " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx/n",                   stream->pos, count, stream->size ));        error = FT_THROW( Invalid_Stream_Operation );        goto Exit;      }      /* set cursor */      stream->cursor = stream->base + stream->pos;      stream->limit  = stream->cursor + count;      stream->pos   += count;    }  Exit:    return error;  }
开发者ID:OpenTechEngine,项目名称:OpenTechBFG,代码行数:75,


示例24: af_loader_load_glyph

  af_loader_load_glyph( AF_Module  module,                        FT_Face    face,                        FT_UInt    gindex,                        FT_Int32   load_flags )  {    FT_Error      error;    FT_Size       size   = face->size;    AF_Loader     loader = module->loader;    AF_ScalerRec  scaler;    if ( !size )      return FT_THROW( Invalid_Argument );    FT_ZERO( &scaler );    scaler.face    = face;    scaler.x_scale = size->metrics.x_scale;    scaler.x_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */    scaler.y_scale = size->metrics.y_scale;    scaler.y_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */    scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );    scaler.flags       = 0;  /* XXX: fix this */    error = af_loader_reset( module, face );    if ( !error )    {      AF_ScriptMetrics  metrics;      FT_UInt           options = 0;#ifdef FT_OPTION_AUTOFIT2      /* XXX: undocumented hook to activate the latin2 hinter */      if ( load_flags & ( 1UL << 20 ) )        options = 2;#endif      error = af_face_globals_get_metrics( loader->globals, gindex,                                           options, &metrics );      if ( !error )      {        loader->metrics = metrics;        if ( metrics->clazz->script_metrics_scale )          metrics->clazz->script_metrics_scale( metrics, &scaler );        else          metrics->scaler = scaler;        load_flags |=  FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;        load_flags &= ~FT_LOAD_RENDER;        if ( metrics->clazz->script_hints_init )        {          error = metrics->clazz->script_hints_init( &loader->hints,                                                     metrics );          if ( error )            goto Exit;        }        error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 );      }    }  Exit:    return error;  }
开发者ID:DjinCN,项目名称:libFreeType2,代码行数:66,


示例25: cff_face_init

  cff_face_init( FT_Stream      stream,                 FT_Face        cffface,        /* CFF_Face */                 FT_Int         face_index,                 FT_Int         num_params,                 FT_Parameter*  params )  {    CFF_Face            face        = (CFF_Face)cffface;    FT_Error            error;    SFNT_Service        sfnt;    FT_Service_PsCMaps  psnames;    PSHinter_Service    pshinter;    FT_Bool             pure_cff    = 1;    FT_Bool             sfnt_format = 0;    FT_Library          library     = cffface->driver->root.library;    sfnt = (SFNT_Service)FT_Get_Module_Interface(             library, "sfnt" );    if ( !sfnt )    {      FT_ERROR(( "cff_face_init: cannot access `sfnt' module/n" ));      error = FT_THROW( Missing_Module );      goto Exit;    }    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );    pshinter = (PSHinter_Service)FT_Get_Module_Interface(                 library, "pshinter" );    FT_TRACE2(( "CFF driver/n" ));    /* create input stream from resource */    if ( FT_STREAM_SEEK( 0 ) )      goto Exit;    /* check whether we have a valid OpenType file */    error = sfnt->init_face( stream, face, face_index, num_params, params );    if ( !error )    {      if ( face->format_tag != TTAG_OTTO )  /* `OTTO'; OpenType/CFF font */      {        FT_TRACE2(( "  not an OpenType/CFF font/n" ));        error = FT_THROW( Unknown_File_Format );        goto Exit;      }      /* if we are performing a simple font format check, exit immediately */      if ( face_index < 0 )        return FT_Err_Ok;      sfnt_format = 1;      /* now, the font can be either an OpenType/CFF font, or an SVG CEF */      /* font; in the latter case it doesn't have a `head' table         */      error = face->goto_table( face, TTAG_head, stream, 0 );      if ( !error )      {        pure_cff = 0;        /* load font directory */        error = sfnt->load_face( stream, face, face_index,                                 num_params, params );        if ( error )          goto Exit;      }      else      {        /* load the `cmap' table explicitly */        error = sfnt->load_cmap( face, stream );        if ( error )          goto Exit;      }      /* now load the CFF part of the file */      error = face->goto_table( face, TTAG_CFF, stream, 0 );      if ( error )        goto Exit;    }    else    {      /* rewind to start of file; we are going to load a pure-CFF font */      if ( FT_STREAM_SEEK( 0 ) )        goto Exit;      error = FT_Err_Ok;    }    /* now load and parse the CFF table in the file */    {      CFF_Font         cff = NULL;      CFF_FontRecDict  dict;      FT_Memory        memory = cffface->memory;      FT_Int32         flags;      FT_UInt          i;      if ( FT_NEW( cff ) )        goto Exit;      face->extra.data = cff;//.........这里部分代码省略.........
开发者ID:hsmith,项目名称:freetype,代码行数:101,


示例26: cf2_interpT2CharString

//.........这里部分代码省略.........                        &font->blues,                        translation );    /*     * Initialize state for width parsing.  From the CFF Spec:     *     *   The first stack-clearing operator, which must be one of hstem,     *   hstemhm, vstem, vstemhm, cntrmask, hintmask, hmoveto, vmoveto,     *   rmoveto, or endchar, takes an additional argument - the width (as     *   described earlier), which may be expressed as zero or one numeric     *   argument.     *     * What we implement here uses the first validly specified width, but     * does not detect errors for specifying more than one width.     *     * If one of the above operators occurs without explicitly specifying     * a width, we assume the default width.     *     */    haveWidth = FALSE;    *width    = cf2_getDefaultWidthX( decoder );    /*     * Note: at this point, all pointers to resources must be NULL     * and all local objects must be initialized.     * There must be no branches to exit: above this point.     *     */    /* allocate an operand stack */    opStack = cf2_stack_init( memory, error );    if ( !opStack )    {      lastError = FT_THROW( Out_Of_Memory );      goto exit;    }    /* initialize subroutine stack by placing top level charstring as */    /* first element (max depth plus one for the charstring)          */    /* Note: Caller owns and must finalize the first charstring.      */    /*       Our copy of it does not change that requirement.         */    cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 );    charstring  = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack );    *charstring = *buf;    /* structure copy */    charstringIndex = 0;       /* entry is valid now */    /* catch errors so far */    if ( *error )      goto exit;    /* main interpreter loop */    while ( 1 )    {      if ( cf2_buf_isEnd( charstring ) )      {        /* If we've reached the end of the charstring, simulate a */        /* cf2_cmdRETURN or cf2_cmdENDCHAR.                       */        if ( charstringIndex )          op1 = cf2_cmdRETURN;  /* end of buffer for subroutine */        else          op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */      }      else        op1 = (FT_Byte)cf2_buf_readByte( charstring );
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:67,


示例27: af_face_globals_get_metrics

  af_face_globals_get_metrics( AF_FaceGlobals     globals,                               FT_UInt            gindex,                               FT_UInt            options,                               AF_ScriptMetrics  *ametrics )  {    AF_ScriptMetrics  metrics = NULL;    FT_UInt           gidx;    AF_ScriptClass    clazz;    FT_UInt           script     = options & 15;    const FT_Offset   script_max = sizeof ( AF_SCRIPT_CLASSES_GET ) /                                     sizeof ( AF_SCRIPT_CLASSES_GET[0] );    FT_Error          error      = FT_Err_Ok;    if ( gindex >= (FT_ULong)globals->glyph_count )    {      error = FT_THROW( Invalid_Argument );      goto Exit;    }    gidx = script;    if ( gidx == 0 || gidx + 1 >= script_max )      gidx = globals->glyph_scripts[gindex] & AF_SCRIPT_NONE;    clazz = AF_SCRIPT_CLASSES_GET[gidx];    if ( script == 0 )      script = clazz->script;    metrics = globals->metrics[clazz->script];    if ( metrics == NULL )    {      /* create the global metrics object if necessary */      FT_Memory  memory = globals->face->memory;      if ( FT_ALLOC( metrics, clazz->script_metrics_size ) )        goto Exit;      metrics->clazz   = clazz;      metrics->globals = globals;      if ( clazz->script_metrics_init )      {        error = clazz->script_metrics_init( metrics, globals->face );        if ( error )        {          if ( clazz->script_metrics_done )            clazz->script_metrics_done( metrics );          FT_FREE( metrics );          goto Exit;        }      }      globals->metrics[clazz->script] = metrics;    }  Exit:    *ametrics = metrics;    return error;  }
开发者ID:DjinCN,项目名称:libFreeType2,代码行数:62,


示例28: cid_slot_load_glyph

  cid_slot_load_glyph( FT_GlyphSlot  cidglyph,      /* CID_GlyphSlot */                       FT_Size       cidsize,       /* CID_Size      */                       FT_UInt       glyph_index,                       FT_Int32      load_flags )  {    CID_GlyphSlot  glyph = (CID_GlyphSlot)cidglyph;    FT_Error       error;    T1_DecoderRec  decoder;    CID_Face       face = (CID_Face)cidglyph->face;    FT_Bool        hinting;    PSAux_Service  psaux = (PSAux_Service)face->psaux;    FT_Matrix      font_matrix;    FT_Vector      font_offset;    if ( glyph_index >= (FT_UInt)face->root.num_glyphs )    {      error = FT_THROW( Invalid_Argument );      goto Exit;    }    if ( load_flags & FT_LOAD_NO_RECURSE )      load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;    glyph->x_scale = cidsize->metrics.x_scale;    glyph->y_scale = cidsize->metrics.y_scale;    cidglyph->outline.n_points   = 0;    cidglyph->outline.n_contours = 0;    hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE   ) == 0 &&                       ( load_flags & FT_LOAD_NO_HINTING ) == 0 );    cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;    error = psaux->t1_decoder_funcs->init( &decoder,                                           cidglyph->face,                                           cidsize,                                           cidglyph,                                           0, /* glyph names -- XXX */                                           0, /* blend == 0 */                                           hinting,                                           FT_LOAD_TARGET_MODE( load_flags ),                                           cid_load_glyph );    if ( error )      goto Exit;    /* TODO: initialize decoder.len_buildchar and decoder.buildchar */    /*       if we ever support CID-keyed multiple master fonts     */    /* set up the decoder */    decoder.builder.no_recurse = FT_BOOL(      ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) );    error = cid_load_glyph( &decoder, glyph_index );    if ( error )      goto Exit;    font_matrix = decoder.font_matrix;    font_offset = decoder.font_offset;    /* save new glyph tables */    psaux->t1_decoder_funcs->done( &decoder );    /* now set the metrics -- this is rather simple, as    */    /* the left side bearing is the xMin, and the top side */    /* bearing the yMax                                    */    cidglyph->outline.flags &= FT_OUTLINE_OWNER;    cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;    /* for composite glyphs, return only left side bearing and */    /* advance width                                           */    if ( load_flags & FT_LOAD_NO_RECURSE )    {      FT_Slot_Internal  internal = cidglyph->internal;      cidglyph->metrics.horiBearingX =        FIXED_TO_INT( decoder.builder.left_bearing.x );      cidglyph->metrics.horiAdvance =        FIXED_TO_INT( decoder.builder.advance.x );      internal->glyph_matrix      = font_matrix;      internal->glyph_delta       = font_offset;      internal->glyph_transformed = 1;    }    else    {      FT_BBox            cbox;      FT_Glyph_Metrics*  metrics = &cidglyph->metrics;      FT_Vector          advance;      /* copy the _unscaled_ advance width */      metrics->horiAdvance =        FIXED_TO_INT( decoder.builder.advance.x );      cidglyph->linearHoriAdvance =        FIXED_TO_INT( decoder.builder.advance.x );      cidglyph->internal->glyph_transformed = 0;//.........这里部分代码省略.........
开发者ID:Blitzker,项目名称:assfilter,代码行数:101,


示例29: af_property_set

  static FT_Error  af_property_set( FT_Module    ft_module,                   const char*  property_name,                   const void*  value,                   FT_Bool      value_is_string )  {    FT_Error   error  = FT_Err_Ok;    AF_Module  module = (AF_Module)ft_module;#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES    FT_UNUSED( value_is_string );#endif    if ( !ft_strcmp( property_name, "fallback-script" ) )    {      FT_UInt*  fallback_script;      FT_UInt   ss;#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES      if ( value_is_string )        return FT_THROW( Invalid_Argument );#endif      fallback_script = (FT_UInt*)value;      /* We translate the fallback script to a fallback style that uses */      /* `fallback-script' as its script and `AF_COVERAGE_NONE' as its  */      /* coverage value.                                                */      for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )      {        AF_StyleClass  style_class = AF_STYLE_CLASSES_GET[ss];        if ( (FT_UInt)style_class->script == *fallback_script &&             style_class->coverage == AF_COVERAGE_DEFAULT     )        {          module->fallback_style = ss;          break;        }      }      if ( !AF_STYLE_CLASSES_GET[ss] )      {        FT_TRACE0(( "af_property_set: Invalid value %d for property `%s'/n",                    fallback_script, property_name ));        return FT_THROW( Invalid_Argument );      }      return error;    }    else if ( !ft_strcmp( property_name, "default-script" ) )    {      FT_UInt*  default_script;#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES      if ( value_is_string )        return FT_THROW( Invalid_Argument );#endif      default_script = (FT_UInt*)value;      module->default_script = *default_script;      return error;    }    else if ( !ft_strcmp( property_name, "increase-x-height" ) )    {      FT_Prop_IncreaseXHeight*  prop;      AF_FaceGlobals            globals;#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES      if ( value_is_string )        return FT_THROW( Invalid_Argument );#endif      prop = (FT_Prop_IncreaseXHeight*)value;      error = af_property_get_face_globals( prop->face, &globals, module );      if ( !error )        globals->increase_x_height = prop->limit;      return error;    }#ifdef AF_CONFIG_OPTION_USE_WARPER    else if ( !ft_strcmp( property_name, "warping" ) )    {#ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES      if ( value_is_string )      {        const char*  s = (const char*)value;        long         w = ft_strtol( s, NULL, 10 );        if ( w == 0 )          module->warping = 0;        else if ( w == 1 )//.........这里部分代码省略.........
开发者ID:reactos,项目名称:reactos,代码行数:101,


示例30: FT_Outline_Decompose

  FT_Outline_Decompose( FT_Outline*              outline,                        const FT_Outline_Funcs*  func_interface,                        void*                    user )  {#undef  SCALED#define SCALED( x )  ( ( (x) < 0 ? -( -(x) << shift )             /                                 :  (  (x) << shift ) ) - delta )    FT_Vector   v_last;    FT_Vector   v_control;    FT_Vector   v_start;    FT_Vector*  point;    FT_Vector*  limit;    char*       tags;    FT_Error    error;    FT_Int   n;         /* index of contour in outline     */    FT_UInt  first;     /* index of first point in contour */    FT_Int   tag;       /* current point's state           */    FT_Int   shift;    FT_Pos   delta;    if ( !outline )      return FT_THROW( Invalid_Outline );    if ( !func_interface )      return FT_THROW( Invalid_Argument );    shift = func_interface->shift;    delta = func_interface->delta;    first = 0;    for ( n = 0; n < outline->n_contours; n++ )    {      FT_Int  last;  /* index of last point in contour */      FT_TRACE5(( "FT_Outline_Decompose: Outline %d/n", n ));      last = outline->contours[n];      if ( last < 0 )        goto Invalid_Outline;      limit = outline->points + last;      v_start   = outline->points[first];      v_start.x = SCALED( v_start.x );      v_start.y = SCALED( v_start.y );      v_last   = outline->points[last];      v_last.x = SCALED( v_last.x );      v_last.y = SCALED( v_last.y );      v_control = v_start;      point = outline->points + first;      tags  = outline->tags   + first;      tag   = FT_CURVE_TAG( tags[0] );      /* A contour cannot start with a cubic control point! */      if ( tag == FT_CURVE_TAG_CUBIC )        goto Invalid_Outline;      /* check first point to determine origin */      if ( tag == FT_CURVE_TAG_CONIC )      {        /* first point is conic control.  Yes, this happens. */        if ( FT_CURVE_TAG( outline->tags[last] ) == FT_CURVE_TAG_ON )        {          /* start at last point if it is on the curve */          v_start = v_last;          limit--;        }        else        {          /* if both first and last points are conic,         */          /* start at their middle and record its position    */          /* for closure                                      */          v_start.x = ( v_start.x + v_last.x ) / 2;          v_start.y = ( v_start.y + v_last.y ) / 2;       /* v_last = v_start; */        }        point--;        tags--;      }      FT_TRACE5(( "  move to (%.2f, %.2f)/n",                  v_start.x / 64.0, v_start.y / 64.0 ));      error = func_interface->move_to( &v_start, user );      if ( error )        goto Exit;      while ( point < limit )      {        point++;        tags++;//.........这里部分代码省略.........
开发者ID:CCExtractor,项目名称:ccextractor,代码行数:101,



注:本文中的FT_THROW函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ FT_TRACE0函数代码示例
C++ FT_Set_Charmap函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。