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

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

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

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

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

示例1: tt_face_load_gasp

  tt_face_load_gasp( TT_Face    face,                     FT_Stream  stream )  {    FT_Error   error;    FT_Memory  memory = stream->memory;    FT_UInt        j,num_ranges;    TT_GaspRange   gaspranges;    /* the gasp table is optional */    error = face->goto_table( face, TTAG_gasp, stream, 0 );    if ( error )      goto Exit;    if ( FT_FRAME_ENTER( 4L ) )      goto Exit;    face->gasp.version   = FT_GET_USHORT();    face->gasp.numRanges = FT_GET_USHORT();    FT_FRAME_EXIT();    /* only support versions 0 and 1 of the table */    if ( face->gasp.version >= 2 )    {      face->gasp.numRanges = 0;      error = SFNT_Err_Invalid_Table;      goto Exit;    }    num_ranges = face->gasp.numRanges;    FT_TRACE3(( "numRanges: %u/n", num_ranges ));    if ( FT_QNEW_ARRAY( gaspranges, num_ranges ) ||         FT_FRAME_ENTER( num_ranges * 4L )      )      goto Exit;    face->gasp.gaspRanges = gaspranges;    for ( j = 0; j < num_ranges; j++ )    {      gaspranges[j].maxPPEM  = FT_GET_USHORT();      gaspranges[j].gaspFlag = FT_GET_USHORT();      FT_TRACE3(( "gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x/n",                  j,                  gaspranges[j].maxPPEM,                  gaspranges[j].gaspFlag ));    }    FT_FRAME_EXIT();  Exit:    return error;  }
开发者ID:howardgao-mt,项目名称:myd3dlib,代码行数:56,


示例2: check_type1_format

  static FT_Error  check_type1_format( FT_Stream    stream,                      const char*  header_string,                      size_t       header_length )  {    FT_Error   error;    FT_UShort  tag;    FT_Long    size;    if ( FT_STREAM_SEEK( 0 ) )      goto Exit;    error = read_pfb_tag( stream, &tag, &size );    if ( error )      goto Exit;    if ( tag != 0x8001U && FT_STREAM_SEEK( 0 ) )      goto Exit;    if ( !FT_FRAME_ENTER( header_length ) )    {      error = 0;      if ( ft_memcmp( stream->cursor, header_string, header_length ) != 0 )        error = T1_Err_Unknown_File_Format;      FT_FRAME_EXIT();    }  Exit:    return error;  }
开发者ID:dfizban,项目名称:remixos-usb-tool,代码行数:33,


示例3: read_data_from_FT_Stream

  static void  read_data_from_FT_Stream( png_structp  png,                            png_bytep    data,                            png_size_t   length )  {    FT_Error   error;    png_voidp  p      = png_get_io_ptr( png );    FT_Stream  stream = (FT_Stream)p;    if ( FT_FRAME_ENTER( length ) )    {      FT_Error*  e = (FT_Error*)png_get_error_ptr( png );      *e = FT_THROW( Invalid_Stream_Read );      png_error( png, NULL );      return;    }    memcpy( data, stream->cursor, length );    FT_FRAME_EXIT();  }
开发者ID:ONLYOFFICE,项目名称:core,代码行数:25,


示例4: T1_Read_Metrics

  T1_Read_Metrics( FT_Face    t1_face,                   FT_Stream  stream )  {    FT_Error  error;    FT_Byte*  start;    if ( FT_FRAME_ENTER( stream->size ) )      return error;    start = (FT_Byte*)stream->cursor;    if ( stream->size >= ft_strlen( "StartFontMetrics" )    &&         ft_strncmp( (const char*)start, "StartFontMetrics",                     ft_strlen( "StartFontMetrics" ) ) == 0 )      error = T1_Read_AFM( t1_face, stream );    else if ( stream->size > 6                                &&              start[0] == 0x00 && start[1] == 0x01            &&              LITTLE_ENDIAN_UINT( start + 2 ) == stream->size )      error = T1_Read_PFM( t1_face, stream );    else      error = T1_Err_Unknown_File_Format;    FT_FRAME_EXIT();    return error;  }
开发者ID:Bracket-,项目名称:psp-ports,代码行数:29,


示例5: cff_index_load_offsets

  static FT_Error  cff_index_load_offsets( CFF_Index  idx )  {    FT_Error   error  = 0;    FT_Stream  stream = idx->stream;    FT_Memory  memory = stream->memory;    if ( idx->count > 0 && idx->offsets == NULL )    {      FT_Byte    offsize = idx->off_size;      FT_ULong   data_size;      FT_Byte*   p;      FT_Byte*   p_end;      FT_ULong*  poff;      data_size = (FT_ULong)( idx->count + 1 ) * offsize;      if ( FT_NEW_ARRAY( idx->offsets, idx->count + 1 ) ||           FT_STREAM_SEEK( idx->start + 3 )             ||           FT_FRAME_ENTER( data_size )                  )        goto Exit;      poff   = idx->offsets;      p      = (FT_Byte*)stream->cursor;      p_end  = p + data_size;      switch ( offsize )      {      case 1:        for ( ; p < p_end; p++, poff++ )          poff[0] = p[0];        break;      case 2:        for ( ; p < p_end; p += 2, poff++ )          poff[0] = FT_PEEK_USHORT( p );        break;      case 3:        for ( ; p < p_end; p += 3, poff++ )          poff[0] = FT_PEEK_OFF3( p );        break;      default:        for ( ; p < p_end; p += 4, poff++ )          poff[0] = FT_PEEK_ULONG( p );      }      FT_FRAME_EXIT();    }  Exit:    if ( error )      FT_FREE( idx->offsets );    return error;  }
开发者ID:Ali-il,项目名称:gamekit,代码行数:59,


示例6: tt_synth_sfnt_checksum

static FT_UInt32tt_synth_sfnt_checksum( FT_Stream  stream,                        FT_ULong   length ){    FT_Error   error;    FT_UInt32  checksum = 0;    FT_UInt    i;    if ( FT_FRAME_ENTER( length ) )        return 0;    for ( ; length > 3; length -= 4 )        checksum += (FT_UInt32)FT_GET_ULONG();    for ( i = 3; length > 0; length--, i-- )        checksum += (FT_UInt32)FT_GET_BYTE() << ( i * 8 );    FT_FRAME_EXIT();    return checksum;}
开发者ID:Ruw-Van,项目名称:krkrz,代码行数:22,


示例7: check_type1_format

  static FT_Error  check_type1_format( FT_Stream    stream,                      const char*  header_string,                      size_t       header_length )  {    FT_Error   error;    FT_UShort  tag;    FT_ULong   dummy;    if ( FT_STREAM_SEEK( 0 ) )      goto Exit;    error = read_pfb_tag( stream, &tag, &dummy );    if ( error )      goto Exit;    /* We assume that the first segment in a PFB is always encoded as   */    /* text.  This might be wrong (and the specification doesn't insist */    /* on that), but we have never seen a counterexample.               */    if ( tag != 0x8001U && FT_STREAM_SEEK( 0 ) )      goto Exit;    if ( !FT_FRAME_ENTER( header_length ) )    {      error = FT_Err_Ok;      if ( ft_memcmp( stream->cursor, header_string, header_length ) != 0 )        error = FT_THROW( Unknown_File_Format );      FT_FRAME_EXIT();    }  Exit:    return error;  }
开发者ID:PrinttingGroup,项目名称:SumatraPDF_SpecialPrint,代码行数:36,


示例8: _tt_check_patents_in_range

  static FT_Bool  _tt_check_patents_in_range( FT_Stream  stream,                              FT_ULong   size )  {    FT_Bool   result = FALSE;    FT_Error  error;    FT_Bytes  p, end;    if ( FT_FRAME_ENTER( size ) )      return 0;    p   = stream->cursor;    end = p + size;    while ( p < end )    {      switch (p[0])      {      case 0x06:  /* SPvTL // */      case 0x07:  /* SPvTL +  */      case 0x08:  /* SFvTL // */      case 0x09:  /* SFvTL +  */      case 0x0A:  /* SPvFS    */      case 0x0B:  /* SFvFS    */        result = TRUE;        goto Exit;      case 0x40:        if ( p + 1 >= end )          goto Exit;        p += p[1] + 2;        break;      case 0x41:        if ( p + 1 >= end )          goto Exit;        p += p[1] * 2 + 2;        break;      case 0x71:  /* DELTAP2 */      case 0x72:  /* DELTAP3 */      case 0x73:  /* DELTAC0 */      case 0x74:  /* DELTAC1 */      case 0x75:  /* DELTAC2 */        result = TRUE;        goto Exit;      case 0xB0:      case 0xB1:      case 0xB2:      case 0xB3:      case 0xB4:      case 0xB5:      case 0xB6:      case 0xB7:        p += ( p[0] - 0xB0 ) + 2;        break;      case 0xB8:      case 0xB9:      case 0xBA:      case 0xBB:      case 0xBC:      case 0xBD:      case 0xBE:      case 0xBF:        p += ( p[0] - 0xB8 ) * 2 + 3;        break;      default:        p += 1;        break;      }    }  Exit:    FT_UNUSED( error );    FT_FRAME_EXIT();    return result;  }
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:83,


示例9: tt_face_load_name

//.........这里部分代码省略.........        FT_FRAME_USHORT( format ),        FT_FRAME_USHORT( numNameRecords ),        FT_FRAME_USHORT( storageOffset ),      FT_FRAME_END    };    static const FT_Frame_Field  name_record_fields[] =    {#undef  FT_STRUCTURE#define FT_STRUCTURE  TT_NameEntryRec      /* no FT_FRAME_START */        FT_FRAME_USHORT( platformID ),        FT_FRAME_USHORT( encodingID ),        FT_FRAME_USHORT( languageID ),        FT_FRAME_USHORT( nameID ),        FT_FRAME_USHORT( stringLength ),        FT_FRAME_USHORT( stringOffset ),      FT_FRAME_END    };    table         = &face->name_table;    table->stream = stream;    error = face->goto_table( face, TTAG_name, stream, &table_len );    if ( error )      goto Exit;    table_pos = FT_STREAM_POS();    if ( FT_STREAM_READ_FIELDS( name_table_fields, table ) )      goto Exit;    /* Some popular Asian fonts have an invalid `storageOffset' value   */    /* (it should be at least "6 + 12*num_names").  However, the string */    /* offsets, computed as "storageOffset + entry->stringOffset", are  */    /* valid pointers within the name table...                          */    /*                                                                  */    /* We thus can't check `storageOffset' right now.                   */    /*                                                                  */    storage_start = table_pos + 6 + 12*table->numNameRecords;    storage_limit = table_pos + table_len;    if ( storage_start > storage_limit )    {      FT_ERROR(( "tt_face_load_name: invalid `name' table/n" ));      error = SFNT_Err_Name_Table_Missing;      goto Exit;    }    /* Allocate the array of name records. */    count                 = table->numNameRecords;    table->numNameRecords = 0;    if ( FT_NEW_ARRAY( table->names, count ) ||         FT_FRAME_ENTER( count * 12 )        )      goto Exit;    /* Load the name records and determine how much storage is needed */    /* to hold the strings themselves.                                */    {      TT_NameEntryRec*  entry = table->names;      for ( ; count > 0; count-- )      {        if ( FT_STREAM_READ_FIELDS( name_record_fields, entry ) )          continue;        /* check that the name is not empty */        if ( entry->stringLength == 0 )          continue;        /* check that the name string is within the table */        entry->stringOffset += table_pos + table->storageOffset;        if ( entry->stringOffset                       < storage_start ||             entry->stringOffset + entry->stringLength > storage_limit )        {          /* invalid entry - ignore it */          entry->stringOffset = 0;          entry->stringLength = 0;          continue;        }        entry++;      }      table->numNameRecords = (FT_UInt)( entry - table->names );    }    FT_FRAME_EXIT();    /* everything went well, update face->num_names */    face->num_names = (FT_UShort) table->numNameRecords;  Exit:    return error;  }
开发者ID:howardgao-mt,项目名称:myd3dlib,代码行数:101,


示例10: tt_face_load_font_dir

  tt_face_load_font_dir( TT_Face    face,                         FT_Stream  stream )  {    SFNT_HeaderRec  sfnt;    FT_Error        error;    FT_Memory       memory = stream->memory;    TT_TableRec*    entry;    FT_Int          nn;    static const FT_Frame_Field  offset_table_fields[] =    {#undef  FT_STRUCTURE#define FT_STRUCTURE  SFNT_HeaderRec      FT_FRAME_START( 8 ),        FT_FRAME_USHORT( num_tables ),        FT_FRAME_USHORT( search_range ),        FT_FRAME_USHORT( entry_selector ),        FT_FRAME_USHORT( range_shift ),      FT_FRAME_END    };    FT_TRACE2(( "tt_face_load_font_dir: %08p/n", face ));    /* read the offset table */    sfnt.offset = FT_STREAM_POS();    if ( FT_READ_ULONG( sfnt.format_tag )                    ||         FT_STREAM_READ_FIELDS( offset_table_fields, &sfnt ) )      goto Exit;    /* many fonts don't have these fields set correctly */#if 0    if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 )        ||         sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 )      return SFNT_Err_Unknown_File_Format;#endif    /* load the table directory */    FT_TRACE2(( "-- Number of tables: %10u/n",    sfnt.num_tables ));    FT_TRACE2(( "-- Format version:   0x%08lx/n", sfnt.format_tag ));    /* check first */    error = check_table_dir( &sfnt, stream );    if ( error )    {      FT_TRACE2(( "tt_face_load_font_dir:"                  " invalid table directory for TrueType/n" ));      goto Exit;    }    face->num_tables = sfnt.num_tables;    face->format_tag = sfnt.format_tag;    if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )      goto Exit;    if ( FT_STREAM_SEEK( sfnt.offset + 12 )       ||         FT_FRAME_ENTER( face->num_tables * 16L ) )      goto Exit;    entry = face->dir_tables;    for ( nn = 0; nn < sfnt.num_tables; nn++ )    {      entry->Tag      = FT_GET_TAG4();      entry->CheckSum = FT_GET_ULONG();      entry->Offset   = FT_GET_LONG();      entry->Length   = FT_GET_LONG();      /* ignore invalid tables */      if ( entry->Offset + entry->Length > stream->size )        continue;      else      {        FT_TRACE2(( "  %c%c%c%c  -  %08lx  -  %08lx/n",                    (FT_Char)( entry->Tag >> 24 ),                    (FT_Char)( entry->Tag >> 16 ),                    (FT_Char)( entry->Tag >> 8  ),                    (FT_Char)( entry->Tag       ),                    entry->Offset,                    entry->Length ));        entry++;      }    }    FT_FRAME_EXIT();    FT_TRACE2(( "table directory loaded/n/n" ));  Exit:    return error;  }
开发者ID:howardgao-mt,项目名称:myd3dlib,代码行数:97,


示例11: pfr_phy_font_load

//.........这里部分代码省略.........    num_aux = PFR_NEXT_ULONG( p );        PFR_CHECK( num_aux );    p += num_aux;    /* read the blue values */    {      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 + ( p - stream->cursor );      if ( FT_NEW_ARRAY( phy_font->chars, count ) )        goto Fail;      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( count * Size );      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();  Exit:    return error;    Too_Short:    error = PFR_Err_Invalid_Table;    FT_ERROR(( "pfr_phy_font_load: invalid physical font table/n" ));    goto Fail;  }
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:101,


示例12: 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   buffer[256 + 10];    FT_Int    buff_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 valid CID-keyed font]/n" ));      error = CID_Err_Unknown_File_Format;    }    FT_FRAME_EXIT();    if ( error )      goto Exit;  Again:    /* now, read the rest of the file until we find a `StartData' */    buff_len = 256;    for (;;)    {      FT_Byte*  p;      FT_ULong  top_position;      /* fill input buffer */      limit     = buffer + 256;      buff_len -= 256;      if ( buff_len > 0 )        FT_MEM_MOVE( buffer, limit, buff_len );      p = buffer + buff_len;      if ( FT_STREAM_READ( p, 256 + 10 - buff_len ) )        goto Exit;      top_position = FT_STREAM_POS() - buff_len;      buff_len     = 256 + 10;      /* look for `StartData' */      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 = (FT_ULong)( top_position - ( limit - p ) + 10 );          goto Found;        }      }    }  Found:    /* we have found the start of the binary data.  We will now     */    /* rewind and extract the frame corresponding to the 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;    parser->num_dict       = -1;    /* Finally, we check whether `StartData' was real -- it could be  */    /* in a comment or string.  We also get its arguments to find out */    /* whether the data is represented in binary or hex format.       */    arg1 = parser->root.cursor;    cid_parser_skip_PS_token( parser );    cid_parser_skip_spaces  ( parser );    arg2 = parser->root.cursor;    cid_parser_skip_PS_token( parser );    cid_parser_skip_spaces  ( parser );    limit = parser->root.limit;    cur   = parser->root.cursor;//.........这里部分代码省略.........
开发者ID:allanw1,项目名称:Arianrhod,代码行数:101,


示例13: fnt_face_get_dll_font

static FT_Errorfnt_face_get_dll_font( FNT_Face  face,                       FT_Int    face_index ){    FT_Error         error;    FT_Stream        stream = FT_FACE( face )->stream;    FT_Memory        memory = FT_FACE( face )->memory;    WinMZ_HeaderRec  mz_header;    face->font = 0;    /* does it begin with an MZ header? */    if ( FT_STREAM_SEEK( 0 )                                      ||            FT_STREAM_READ_FIELDS( winmz_header_fields, &mz_header ) )        goto Exit;    error = FNT_Err_Unknown_File_Format;    if ( mz_header.magic == WINFNT_MZ_MAGIC )    {        /* yes, now look for an NE header in the file */        WinNE_HeaderRec  ne_header;        if ( FT_STREAM_SEEK( mz_header.lfanew )                       ||                FT_STREAM_READ_FIELDS( winne_header_fields, &ne_header ) )            goto Exit;        error = FNT_Err_Unknown_File_Format;        if ( ne_header.magic == WINFNT_NE_MAGIC )        {            /* good, now look into the resource table for each FNT resource */            FT_ULong   res_offset  = mz_header.lfanew +                                     ne_header.resource_tab_offset;            FT_UShort  size_shift;            FT_UShort  font_count  = 0;            FT_ULong   font_offset = 0;            if ( FT_STREAM_SEEK( res_offset )                    ||                    FT_FRAME_ENTER( ne_header.rname_tab_offset -                                    ne_header.resource_tab_offset ) )                goto Exit;            size_shift = FT_GET_USHORT_LE();            for (;;)            {                FT_UShort  type_id, count;                type_id = FT_GET_USHORT_LE();                if ( !type_id )                    break;                count = FT_GET_USHORT_LE();                if ( type_id == 0x8008U )                {                    font_count  = count;                    font_offset = (FT_ULong)( FT_STREAM_POS() + 4 +                                              ( stream->cursor - stream->limit ) );                    break;                }                stream->cursor += 4 + count * 12;            }            FT_FRAME_EXIT();            if ( !font_count || !font_offset )            {                FT_TRACE2(( "this file doesn't contain any FNT resources!/n" ));                error = FNT_Err_Unknown_File_Format;                goto Exit;            }            face->root.num_faces = font_count;            if ( face_index >= font_count )            {                error = FNT_Err_Bad_Argument;                goto Exit;            }            if ( FT_NEW( face->font ) )                goto Exit;            if ( FT_STREAM_SEEK( font_offset + face_index * 12 ) ||                    FT_FRAME_ENTER( 12 )                            )                goto Fail;            face->font->offset     = (FT_ULong)FT_GET_USHORT_LE() << size_shift;            face->font->fnt_size   = (FT_ULong)FT_GET_USHORT_LE() << size_shift;            face->font->size_shift = size_shift;            stream->cursor += 8;            FT_FRAME_EXIT();//.........这里部分代码省略.........
开发者ID:1tgr,项目名称:mobius,代码行数:101,


示例14: cff_subfont_load

  static FT_Error  cff_subfont_load( CFF_SubFont  font,                    CFF_Index    idx,                    FT_UInt      font_index,                    FT_Stream    stream,                    FT_ULong     base_offset )  {    FT_Error         error;    CFF_ParserRec    parser;    FT_Byte*         dict = NULL;    FT_ULong         dict_len;    CFF_FontRecDict  top  = &font->font_dict;    CFF_Private      priv = &font->private_dict;    cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict );    /* set defaults */    FT_MEM_ZERO( top, sizeof ( *top ) );    top->underline_position  = -100L << 16;    top->underline_thickness = 50L << 16;    top->charstring_type     = 2;    top->font_matrix.xx      = 0x10000L;    top->font_matrix.yy      = 0x10000L;    top->cid_count           = 8720;    /* we use the implementation specific SID value 0xFFFF to indicate */    /* missing entries                                                 */    top->version             = 0xFFFFU;    top->notice              = 0xFFFFU;    top->copyright           = 0xFFFFU;    top->full_name           = 0xFFFFU;    top->family_name         = 0xFFFFU;    top->weight              = 0xFFFFU;    top->embedded_postscript = 0xFFFFU;    top->cid_registry        = 0xFFFFU;    top->cid_ordering        = 0xFFFFU;    top->cid_font_name       = 0xFFFFU;    error = cff_index_access_element( idx, font_index, &dict, &dict_len );    if ( !error )      error = cff_parser_run( &parser, dict, dict + dict_len );    cff_index_forget_element( idx, &dict );    if ( error )      goto Exit;    /* if it is a CID font, we stop there */    if ( top->cid_registry != 0xFFFFU )      goto Exit;    /* parse the private dictionary, if any */    if ( top->private_offset && top->private_size )    {      /* set defaults */      FT_MEM_ZERO( priv, sizeof ( *priv ) );      priv->blue_shift       = 7;      priv->blue_fuzz        = 1;      priv->lenIV            = -1;      priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L );      priv->blue_scale       = (FT_Fixed)( 0.039625 * 0x10000L * 1000 );      cff_parser_init( &parser, CFF_CODE_PRIVATE, priv );      if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) ||           FT_FRAME_ENTER( font->font_dict.private_size )                 )        goto Exit;      error = cff_parser_run( &parser,                              (FT_Byte*)stream->cursor,                              (FT_Byte*)stream->limit );      FT_FRAME_EXIT();      if ( error )        goto Exit;      /* ensure that `num_blue_values' is even */      priv->num_blue_values &= ~1;    }    /* read the local subrs, if any */    if ( priv->local_subrs_offset )    {      if ( FT_STREAM_SEEK( base_offset + top->private_offset +                           priv->local_subrs_offset ) )        goto Exit;      error = cff_index_init( &font->local_subrs_index, stream, 1 );      if ( error )        goto Exit;      font->num_local_subrs = font->local_subrs_index.count;      error = cff_index_get_pointers( &font->local_subrs_index,                                      &font->local_subrs );      if ( error )        goto Exit;    }//.........这里部分代码省略.........
开发者ID:Ali-il,项目名称:gamekit,代码行数:101,


示例15: cff_charset_load

  static FT_Error  cff_charset_load( CFF_Charset  charset,                    FT_UInt      num_glyphs,                    FT_Stream    stream,                    FT_ULong     base_offset,                    FT_ULong     offset,                    FT_Bool      invert )  {    FT_Memory  memory = stream->memory;    FT_Error   error  = CFF_Err_Ok;    FT_UShort  glyph_sid;    /* If the the offset is greater than 2, we have to parse the */    /* charset table.                                            */    if ( offset > 2 )    {      FT_UInt  j;      charset->offset = base_offset + offset;      /* Get the format of the table. */      if ( FT_STREAM_SEEK( charset->offset ) ||           FT_READ_BYTE( charset->format )   )        goto Exit;      /* Allocate memory for sids. */      if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )        goto Exit;      /* assign the .notdef glyph */      charset->sids[0] = 0;      switch ( charset->format )      {      case 0:        if ( num_glyphs > 0 )        {          if ( FT_FRAME_ENTER( ( num_glyphs - 1 ) * 2 ) )            goto Exit;          for ( j = 1; j < num_glyphs; j++ )            charset->sids[j] = FT_GET_USHORT();          FT_FRAME_EXIT();        }        break;      case 1:      case 2:        {          FT_UInt  nleft;          FT_UInt  i;          j = 1;          while ( j < num_glyphs )          {            /* Read the first glyph sid of the range. */            if ( FT_READ_USHORT( glyph_sid ) )              goto Exit;            /* Read the number of glyphs in the range.  */            if ( charset->format == 2 )            {              if ( FT_READ_USHORT( nleft ) )                goto Exit;            }            else            {              if ( FT_READ_BYTE( nleft ) )                goto Exit;            }            /* Fill in the range of sids -- `nleft + 1' glyphs. */            for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ )              charset->sids[j] = glyph_sid;          }        }        break;      default:        FT_ERROR(( "cff_charset_load: invalid table format!/n" ));        error = CFF_Err_Invalid_File_Format;        goto Exit;      }    }    else    {      /* Parse default tables corresponding to offset == 0, 1, or 2.  */      /* CFF specification intimates the following:                   */      /*                                                              */      /* In order to use a predefined charset, the following must be  */      /* true: The charset constructed for the glyphs in the font's   */      /* charstrings dictionary must match the predefined charset in  */      /* the first num_glyphs.                                        */      charset->offset = offset;  /* record charset type *///.........这里部分代码省略.........
开发者ID:Ali-il,项目名称:gamekit,代码行数:101,


示例16: pfr_sort_kerning_pairs

  static FT_Error  pfr_sort_kerning_pairs( FT_Stream    stream,                          PFR_PhyFont  phy_font )  {    FT_Error      error;    FT_Memory     memory = stream->memory;    PFR_KernPair  pairs;    PFR_KernItem  item;    PFR_Char      chars     = phy_font->chars;    FT_UInt       num_chars = phy_font->num_chars;    FT_UInt       count;   /* create kerning pairs array    */    if ( FT_NEW_ARRAY( phy_font->kern_pairs, phy_font->num_kern_pairs ) )      goto Exit;   /* load all kerning items into the array,    * converting character codes into glyph indices    */    pairs = phy_font->kern_pairs;    item  = phy_font->kern_items;    count = 0;    for ( ; item; item = item->next )    {      FT_UInt   limit = count + item->pair_count;      FT_Byte*  p;      if ( limit > phy_font->num_kern_pairs )      {        error = PFR_Err_Invalid_Table;        goto Exit;      }      if ( FT_STREAM_SEEK( item->offset )                       ||           FT_FRAME_ENTER( item->pair_count * item->pair_size ) )        goto Exit;      p = stream->cursor;      for ( ; count < limit; count++ )      {        PFR_KernPair  pair = pairs + count;        FT_UInt       char1, char2;        FT_Int        kerning;        if ( item->flags & PFR_KERN_2BYTE_CHAR )        {          char1 = FT_NEXT_USHORT( p );          char2 = FT_NEXT_USHORT( p );        }        else        {          char1 = FT_NEXT_BYTE( p );          char2 = FT_NEXT_BYTE( p );        }        if ( item->flags & PFR_KERN_2BYTE_ADJ )          kerning = item->base_adj + FT_NEXT_SHORT( p );        else          kerning = item->base_adj + FT_NEXT_CHAR( p );        pair->glyph1  = pfr_get_gindex( chars, num_chars, char1 );        pair->glyph2  = pfr_get_gindex( chars, num_chars, char2 );        pair->kerning = kerning;      }      FT_FRAME_EXIT();    }   /* sort the resulting array    */    ft_qsort( pairs, count,              sizeof ( PFR_KernPairRec ),              pfr_compare_kern_pairs );  Exit:    if ( error )    {     /* disable kerning data in case of error      */      phy_font->num_kern_pairs = 0;    }    return error;  }
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:90,


示例17: cff_new_index

  static FT_Error  cff_new_index( CFF_Index  idx,                 FT_Stream  stream,                 FT_Bool    load )  {    FT_Error   error;    FT_Memory  memory = stream->memory;    FT_UShort  count;    FT_MEM_ZERO( idx, sizeof ( *idx ) );    idx->stream = stream;    if ( !FT_READ_USHORT( count ) &&         count > 0                )    {      FT_Byte*   p;      FT_Byte    offsize;      FT_ULong   data_size;      FT_ULong*  poff;      /* there is at least one element; read the offset size,           */      /* then access the offset table to compute the index's total size */      if ( FT_READ_BYTE( offsize ) )        goto Exit;      idx->stream   = stream;      idx->count    = count;      idx->off_size = offsize;      data_size     = (FT_ULong)( count + 1 ) * offsize;      if ( FT_NEW_ARRAY( idx->offsets, count + 1 ) ||           FT_FRAME_ENTER( data_size )             )        goto Exit;      poff = idx->offsets;      p    = (FT_Byte*)stream->cursor;      for ( ; (FT_Short)count >= 0; count-- )      {        poff[0] = cff_get_offset( p, offsize );        poff++;        p += offsize;      }      FT_FRAME_EXIT();      idx->data_offset = FT_STREAM_POS();      data_size        = poff[-1] - 1;      if ( load )      {        /* load the data */        if ( FT_FRAME_EXTRACT( data_size, idx->bytes ) )          goto Exit;      }      else      {        /* skip the data */        if ( FT_STREAM_SKIP( data_size ) )          goto Exit;      }    }  Exit:    if ( error )      FT_FREE( idx->offsets );    return error;  }
开发者ID:OS2World,项目名称:LIB-SDL,代码行数:71,


示例18: 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_UInt        fd_select;    FT_Stream      stream       = face->cid_stream;    FT_Error       error        = CID_Err_Ok;    FT_Byte*       charstring   = 0;    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_TRACE4(( "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 = (FT_UInt)cid_get_offset( &p, (FT_Byte)cid->fd_bytes );      if ( glyph_data.length != 0 )      {        glyph_length = 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 = 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    = (FT_UInt) cid_get_offset( &p, (FT_Byte)cid->fd_bytes );      off1         = (FT_ULong)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_UInt)cid->num_dicts )      {        error = CID_Err_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_Int        cs_offset;      /* Set up subrs */      decoder->num_subrs = cid_subrs->num_subrs;//.........这里部分代码省略.........
开发者ID:0302zq,项目名称:libgdx,代码行数:101,


示例19: CID_New_Parser

  CID_New_Parser( CID_Parser*    parser,                  FT_Stream      stream,                  FT_Memory      memory,                  PSAux_Service  psaux )  {    FT_Error  error;    FT_ULong  base_offset, offset, ps_len;    FT_Byte   buffer[256 + 10];    FT_Int    buff_len;    FT_MEM_SET( parser, 0, 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 valid CID-keyed font]/n" ));      error = CID_Err_Unknown_File_Format;    }    FT_FRAME_EXIT();    if ( error )      goto Exit;    /* now, read the rest of the file, until we find a `StartData' */    buff_len = 256;    for (;;)    {      FT_Byte   *p, *limit = buffer + 256;      FT_ULong  top_position;      /* fill input buffer */      buff_len -= 256;      if ( buff_len > 0 )        FT_MEM_MOVE( buffer, limit, buff_len );      p = buffer + buff_len;      if ( FT_STREAM_READ( p, 256 + 10 - buff_len ) )        goto Exit;      top_position = FT_STREAM_POS() - buff_len;      buff_len = 256 + 10;      /* look for `StartData' */      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 = (FT_ULong)( top_position - ( limit - p ) + 10 );          goto Found;        }      }    }  Found:    /* we have found the start of the binary data.  We will now        */    /* rewind and extract the frame of corresponding to the 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;    parser->num_dict       = -1;  Exit:    return error;  }
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:86,


示例20: sfnt_open_font

/* synthesized into a TTC with one offset table.              */static FT_Errorsfnt_open_font(FT_Stream stream,               TT_Face face){    FT_Memory memory = stream->memory;    FT_Error  error;    FT_ULong  tag, offset;    static const FT_Frame_Field ttc_header_fields[] =    {#undef  FT_STRUCTURE#define FT_STRUCTURE TTC_HeaderRec        FT_FRAME_START(8),        FT_FRAME_LONG(version),        FT_FRAME_LONG(count),        FT_FRAME_END    };    face->ttc_header.tag     = 0;    face->ttc_header.version = 0;    face->ttc_header.count   = 0;    offset = FT_STREAM_POS();    if (FT_READ_ULONG(tag))        return error;    if (tag != 0x00010000UL &&        tag != TTAG_ttcf &&        tag != TTAG_OTTO &&        tag != TTAG_true &&        tag != TTAG_typ1 &&        tag != 0x00020000UL)        return SFNT_Err_Unknown_File_Format;    face->ttc_header.tag = TTAG_ttcf;    if (tag == TTAG_ttcf)    {        FT_Int n;        FT_TRACE3(("sfnt_open_font: file is a collection/n"));        if (FT_STREAM_READ_FIELDS(ttc_header_fields, &face->ttc_header))            return error;        /* now read the offsets of each font in the file */        if (FT_NEW_ARRAY(face->ttc_header.offsets, face->ttc_header.count))            return error;        if (FT_FRAME_ENTER(face->ttc_header.count * 4L))            return error;        for (n = 0; n < face->ttc_header.count; n++)            face->ttc_header.offsets[n] = FT_GET_ULONG();        FT_FRAME_EXIT();    }    else    {        FT_TRACE3(("sfnt_open_font: synthesize TTC/n"));        face->ttc_header.version = 1 << 16;        face->ttc_header.count   = 1;        if (FT_NEW(face->ttc_header.offsets))            return error;        face->ttc_header.offsets[0] = offset;    }    return error;}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:77,


示例21: pfr_log_font_load

//.........这里部分代码省略.........    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 )      {        PFR_CHECK( 1 );        log_font->phys_size += (FT_UInt32)PFR_NEXT_BYTE( p ) << 16;      }    }  Fail:    FT_FRAME_EXIT();  Exit:    return error;  Too_Short:    FT_ERROR(( "pfr_log_font_load: invalid logical font table/n" ));    error = FT_THROW( Invalid_Table );    goto Fail;  }
开发者ID:ImageMagick,项目名称:ttf,代码行数:101,


示例22: tt_face_load_hmtx

//.........这里部分代码省略.........      face->vertical.number_Of_VMetrics = 0;      longs  = (TT_LongMetrics*)lm;      shorts = (TT_ShortMetrics**)sm;    }    else    {      void*   lm = &face->horizontal.long_metrics;      void**  sm = &face->horizontal.short_metrics;      error = face->goto_table( face, TTAG_hmtx, stream, &table_len );      if ( error )        goto Fail;      num_longs = face->horizontal.number_Of_HMetrics;      if ( (FT_ULong)num_longs > table_len / 4 )        num_longs = (FT_Long)( table_len / 4 );      face->horizontal.number_Of_HMetrics = 0;      longs  = (TT_LongMetrics*)lm;      shorts = (TT_ShortMetrics**)sm;    }    /* never trust derived values */    num_shorts         = face->max_profile.numGlyphs - num_longs;    num_shorts_checked = ( table_len - num_longs * 4L ) / 2;    if ( num_shorts < 0 )    {      FT_ERROR(( "%cmtx has more metrics than glyphs./n" ));      /* Adobe simply ignores this problem.  So we shall do the same. */#if 0      error = vertical ? SFNT_Err_Invalid_Vert_Metrics                       : SFNT_Err_Invalid_Horiz_Metrics;      goto Exit;#else      num_shorts = 0;#endif    }    if ( FT_QNEW_ARRAY( *longs,  num_longs  ) ||         FT_QNEW_ARRAY( *shorts, num_shorts ) )      goto Fail;    if ( FT_FRAME_ENTER( table_len ) )      goto Fail;    p = stream->cursor;    {      TT_LongMetrics  cur   = *longs;      TT_LongMetrics  limit = cur + num_longs;      for ( ; cur < limit; cur++ )      {        cur->advance = FT_NEXT_USHORT( p );        cur->bearing = FT_NEXT_SHORT( p );      }    }    /* do we have an inconsistent number of metric values? */    {      TT_ShortMetrics*  cur   = *shorts;      TT_ShortMetrics*  limit = cur +                                FT_MIN( num_shorts, num_shorts_checked );      for ( ; cur < limit; cur++ )        *cur = FT_NEXT_SHORT( p );      /* We fill up the missing left side bearings with the     */      /* last valid value.  Since this will occur for buggy CJK */      /* fonts usually only, nothing serious will happen.       */      if ( num_shorts > num_shorts_checked && num_shorts_checked > 0 )      {        FT_Short  val = (*shorts)[num_shorts_checked - 1];        limit = *shorts + num_shorts;        for ( ; cur < limit; cur++ )          *cur = val;      }    }    FT_FRAME_EXIT();    if ( vertical )      face->vertical.number_Of_VMetrics = (FT_UShort)num_longs;    else      face->horizontal.number_Of_HMetrics = (FT_UShort)num_longs;  Fail:    return error;  }
开发者ID:sloopdoom,项目名称:ftgles-gles2,代码行数:101,


示例23: t42_parser_init

  t42_parser_init( T42_Parser     parser,                   FT_Stream      stream,                   FT_Memory      memory,                   PSAux_Service  psaux )  {    FT_Error  error = FT_Err_Ok;    FT_Long   size;    psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );    parser->stream    = stream;    parser->base_len  = 0;    parser->base_dict = 0;    parser->in_memory = 0;    /*******************************************************************/    /*                                                                 */    /* Here a short summary of what is going on:                       */    /*                                                                 */    /*   When creating a new Type 42 parser, we try to locate and load */    /*   the base dictionary, loading the whole font into memory.      */    /*                                                                 */    /*   When `loading' the base dictionary, we only set up pointers   */    /*   in the case of a memory-based stream.  Otherwise, we allocate */    /*   and load the base dictionary in it.                           */    /*                                                                 */    /*   parser->in_memory is set if we have a memory stream.          */    /*                                                                 */    if ( FT_STREAM_SEEK( 0L ) ||         FT_FRAME_ENTER( 17 ) )      goto Exit;    if ( ft_memcmp( stream->cursor, "%!PS-TrueTypeFont", 17 ) != 0 )    {      FT_TRACE2(( "  not a Type42 font/n" ));      error = FT_THROW( Unknown_File_Format );    }    FT_FRAME_EXIT();    if ( error || FT_STREAM_SEEK( 0 ) )      goto Exit;    size = stream->size;    /* now, try to load `size' bytes of the `base' dictionary we */    /* found previously                                          */    /* if it is a memory-based resource, set up pointers */    if ( !stream->read )    {      parser->base_dict = (FT_Byte*)stream->base + stream->pos;      parser->base_len  = size;      parser->in_memory = 1;      /* check that the `size' field is valid */      if ( FT_STREAM_SKIP( size ) )        goto Exit;    }    else    {      /* read segment in memory */      if ( FT_ALLOC( parser->base_dict, size )       ||           FT_STREAM_READ( parser->base_dict, size ) )        goto Exit;      parser->base_len = size;    }    parser->root.base   = parser->base_dict;    parser->root.cursor = parser->base_dict;    parser->root.limit  = parser->root.cursor + parser->base_len;  Exit:    if ( error && !parser->in_memory )      FT_FREE( parser->base_dict );    return error;  }
开发者ID:03050903,项目名称:libgdx,代码行数:81,


示例24: sfnt_open_font

  /* synthesized into a TTC with one offset table.              */  static FT_Error  sfnt_open_font( FT_Stream  stream,                  TT_Face    face )  {    FT_Memory  memory = stream->memory;    FT_Error   error;    FT_ULong   tag, offset;    static const FT_Frame_Field  ttc_header_fields[] =    {#undef  FT_STRUCTURE#define FT_STRUCTURE  TTC_HeaderRec      FT_FRAME_START( 8 ),        FT_FRAME_LONG( version ),        FT_FRAME_LONG( count   ),  /* this is ULong in the specs */      FT_FRAME_END    };    face->ttc_header.tag     = 0;    face->ttc_header.version = 0;    face->ttc_header.count   = 0;    offset = FT_STREAM_POS();    if ( FT_READ_ULONG( tag ) )      return error;    if ( tag != 0x00010000UL &&         tag != TTAG_ttcf    &&         tag != TTAG_OTTO    &&         tag != TTAG_true    &&         tag != TTAG_typ1    &&         tag != 0x00020000UL )    {      FT_TRACE2(( "  not a font using the SFNT container format/n" ));      return FT_THROW( Unknown_File_Format );    }    face->ttc_header.tag = TTAG_ttcf;    if ( tag == TTAG_ttcf )    {      FT_Int  n;      FT_TRACE3(( "sfnt_open_font: file is a collection/n" ));      if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) )        return error;      if ( face->ttc_header.count == 0 )        return FT_THROW( Invalid_Table );      /* a rough size estimate: let's conservatively assume that there   */      /* is just a single table info in each subfont header (12 + 16*1 = */      /* 28 bytes), thus we have (at least) `12 + 4*count' bytes for the */      /* size of the TTC header plus `28*count' bytes for all subfont    */      /* headers                                                         */      if ( (FT_ULong)face->ttc_header.count > stream->size / ( 28 + 4 ) )        return FT_THROW( Array_Too_Large );      /* now read the offsets of each font in the file */      if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )        return error;      if ( FT_FRAME_ENTER( face->ttc_header.count * 4L ) )        return error;      for ( n = 0; n < face->ttc_header.count; n++ )        face->ttc_header.offsets[n] = FT_GET_ULONG();      FT_FRAME_EXIT();    }    else    {      FT_TRACE3(( "sfnt_open_font: synthesize TTC/n" ));      face->ttc_header.version = 1 << 16;      face->ttc_header.count   = 1;      if ( FT_NEW( face->ttc_header.offsets ) )        return error;      face->ttc_header.offsets[0] = offset;    }    return error;  }
开发者ID:kobolabs,项目名称:qt-everywhere-4.8.0,代码行数:91,


示例25: cff_encoding_load

  static FT_Error  cff_encoding_load( CFF_Encoding  encoding,                     CFF_Charset   charset,                     FT_UInt       num_glyphs,                     FT_Stream     stream,                     FT_ULong      base_offset,                     FT_ULong      offset )  {    FT_Error   error = CFF_Err_Ok;    FT_UInt    count;    FT_UInt    j;    FT_UShort  glyph_sid;    FT_UInt    glyph_code;    /* Check for charset->sids.  If we do not have this, we fail. */    if ( !charset->sids )    {      error = CFF_Err_Invalid_File_Format;      goto Exit;    }    /* Zero out the code to gid/sid mappings. */    for ( j = 0; j < 256; j++ )    {      encoding->sids [j] = 0;      encoding->codes[j] = 0;    }    /* Note: The encoding table in a CFF font is indexed by glyph index;  */    /* the first encoded glyph index is 1.  Hence, we read the character  */    /* code (`glyph_code') at index j and make the assignment:            */    /*                                                                    */    /*    encoding->codes[glyph_code] = j + 1                             */    /*                                                                    */    /* We also make the assignment:                                       */    /*                                                                    */    /*    encoding->sids[glyph_code] = charset->sids[j + 1]               */    /*                                                                    */    /* This gives us both a code to GID and a code to SID mapping.        */    if ( offset > 1 )    {      encoding->offset = base_offset + offset;      /* we need to parse the table to determine its size */      if ( FT_STREAM_SEEK( encoding->offset ) ||           FT_READ_BYTE( encoding->format )   ||           FT_READ_BYTE( count )              )        goto Exit;      switch ( encoding->format & 0x7F )      {      case 0:        {          FT_Byte*  p;          /* By convention, GID 0 is always ".notdef" and is never */          /* coded in the font.  Hence, the number of codes found  */          /* in the table is `count+1'.                            */          /*                                                       */          encoding->count = count + 1;          if ( FT_FRAME_ENTER( count ) )            goto Exit;          p = (FT_Byte*)stream->cursor;          for ( j = 1; j <= count; j++ )          {            glyph_code = *p++;            /* Make sure j is not too big. */            if ( j < num_glyphs )            {              /* Assign code to GID mapping. */              encoding->codes[glyph_code] = (FT_UShort)j;              /* Assign code to SID mapping. */              encoding->sids[glyph_code] = charset->sids[j];            }          }          FT_FRAME_EXIT();        }        break;      case 1:        {          FT_UInt  nleft;          FT_UInt  i = 1;          FT_UInt  k;          encoding->count = 0;          /* Parse the Format1 ranges. */          for ( j = 0;  j < count; j++, i += nleft )          {//.........这里部分代码省略.........
开发者ID:Ali-il,项目名称:gamekit,代码行数:101,


示例26: pfr_face_get_kerning

  pfr_face_get_kerning( PFR_Face    face,                        FT_UInt     glyph1,                        FT_UInt     glyph2,                        FT_Vector*  kerning )  {    FT_Error      error;    PFR_PhyFont   phy_font = &face->phy_font;    PFR_KernItem  item     = phy_font->kern_items;    FT_UInt32     idx      = PFR_KERN_INDEX( glyph1, glyph2 );    kerning->x = 0;    kerning->y = 0;    /* find the kerning item containing our pair */    while ( item )    {      if ( item->pair1 <= idx && idx <= item->pair2 )        goto Found_Item;      item = item->next;    }    /* not found */    goto Exit;  Found_Item:    {      /* perform simply binary search within the item */      FT_UInt    min, mid, max;      FT_Stream  stream = face->root.stream;      FT_Byte*   p;      if ( FT_STREAM_SEEK( item->offset )                       ||           FT_FRAME_ENTER( item->pair_count * item->pair_size ) )        goto Exit;      min = 0;      max = item->pair_count;      while ( min < max )      {        FT_UInt  char1, char2, charcode;        mid = ( min + max ) >> 1;        p   = stream->cursor + mid*item->pair_size;        if ( item->flags & PFR_KERN_2BYTE_CHAR )        {          char1 = FT_NEXT_USHORT( p );          char2 = FT_NEXT_USHORT( p );        }        else        {          char1 = FT_NEXT_USHORT( p );          char2 = FT_NEXT_USHORT( p );        }        charcode = PFR_KERN_INDEX( char1, char2 );        if ( idx == charcode )        {          if ( item->flags & PFR_KERN_2BYTE_ADJ )            kerning->x = item->base_adj + FT_NEXT_SHORT( p );          else            kerning->x = item->base_adj + FT_NEXT_CHAR( p );          break;        }        if ( idx > charcode )          min = mid + 1;        else          max = mid;      }      FT_FRAME_EXIT();    }  Exit:    return 0;  }
开发者ID:8l,项目名称:inferno,代码行数:81,


示例27: 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:ImageMagick,项目名称:ttf,代码行数:101,


示例28: pfr_face_get_kerning

//.........这里部分代码省略.........    pair  = PFR_KERN_INDEX( code1, code2 );    /* now search the list of kerning items */    {        PFR_KernItem  item   = phy_font->kern_items;        FT_Stream     stream = pfrface->stream;        for ( ; item; item = item->next )        {            if ( pair >= item->pair1 && pair <= item->pair2 )                goto FoundPair;        }        goto Exit;FoundPair: /* we found an item, now parse it and find the value if any */        if ( FT_STREAM_SEEK( item->offset )                       ||                FT_FRAME_ENTER( item->pair_count * item->pair_size ) )            goto Exit;        {            FT_UInt    count       = item->pair_count;            FT_UInt    size        = item->pair_size;            FT_UInt    power       = 1 << FT_MSB( count );            FT_UInt    probe       = power * size;            FT_UInt    extra       = count - power;            FT_Byte*   base        = stream->cursor;            FT_Bool    twobytes    = FT_BOOL( item->flags & 1 );            FT_Bool    twobyte_adj = FT_BOOL( item->flags & 2 );            FT_Byte*   p;            FT_UInt32  cpair;            if ( extra > 0 )            {                p = base + extra * size;                if ( twobytes )                    cpair = FT_NEXT_ULONG( p );                else                    cpair = PFR_NEXT_KPAIR( p );                if ( cpair == pair )                    goto Found;                if ( cpair < pair )                {                    if ( twobyte_adj )                        p += 2;                    else                        p++;                    base = p;                }            }            while ( probe > size )            {                probe >>= 1;                p       = base + probe;                if ( twobytes )                    cpair = FT_NEXT_ULONG( p );                else                    cpair = PFR_NEXT_KPAIR( p );                if ( cpair == pair )                    goto Found;                if ( cpair < pair )                    base += probe;            }            p = base;            if ( twobytes )                cpair = FT_NEXT_ULONG( p );            else                cpair = PFR_NEXT_KPAIR( p );            if ( cpair == pair )            {                FT_Int  value;Found:                if ( twobyte_adj )                    value = FT_PEEK_SHORT( p );                else                    value = p[0];                kerning->x = item->base_adj + value;            }        }        FT_FRAME_EXIT();    }Exit:    return error;}
开发者ID:structuresound,项目名称:freetype,代码行数:101,


示例29: get_sfnt_postscript_name

  static const char*  get_sfnt_postscript_name( TT_Face  face )  {    FT_Int       n, found_win, found_apple;    const char*  result = NULL;    /* shouldn't happen, but just in case to avoid memory leaks */    if ( face->root.internal->postscript_name )      return face->root.internal->postscript_name;    /* scan the name table to see whether we have a Postscript name here, */    /* either in Macintosh or Windows platform encodings                  */    found_win   = -1;    found_apple = -1;    for ( n = 0; n < face->num_names; n++ )    {      TT_NameEntryRec*  name = face->name_table.names + n;      if ( name->nameID == 6 && name->stringLength > 0 )      {        if ( name->platformID == 3     &&             name->encodingID == 1     &&             name->languageID == 0x409 )          found_win = n;        if ( name->platformID == 1 &&             name->encodingID == 0 &&             name->languageID == 0 )          found_apple = n;      }    }    if ( found_win != -1 )    {      FT_Memory         memory = face->root.memory;      TT_NameEntryRec*  name   = face->name_table.names + found_win;      FT_UInt           len    = name->stringLength / 2;      FT_Error          error;      if ( !FT_ALLOC( result, name->stringLength + 1 ) )      {        FT_Stream   stream = face->name_table.stream;        FT_String*  r      = (FT_String*)result;        FT_Byte*    p      = (FT_Byte*)name->string;        if ( FT_STREAM_SEEK( name->stringOffset ) ||             FT_FRAME_ENTER( name->stringLength ) )        {          FT_FREE( result );          name->stringLength = 0;          name->stringOffset = 0;          FT_FREE( name->string );          goto Exit;        }        p = (FT_Byte*)stream->cursor;        for ( ; len > 0; len--, p += 2 )        {          if ( p[0] == 0 && p[1] >= 32 && p[1] < 128 )            *r++ = p[1];        }        *r = '/0';        FT_FRAME_EXIT();      }      goto Exit;    }    if ( found_apple != -1 )    {      FT_Memory         memory = face->root.memory;      TT_NameEntryRec*  name   = face->name_table.names + found_apple;      FT_UInt           len    = name->stringLength;      FT_Error          error;      if ( !FT_ALLOC( result, len + 1 ) )      {        FT_Stream  stream = face->name_table.stream;        if ( FT_STREAM_SEEK( name->stringOffset ) ||             FT_STREAM_READ( result, len )        )        {          name->stringOffset = 0;          name->stringLength = 0;          FT_FREE( name->string );          FT_FREE( result );          goto Exit;        }        ((char*)result)[len] = '/0';      }    }//.........这里部分代码省略.........
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:101,


示例30: 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:hsmith,项目名称:freetype,代码行数:101,



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


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