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

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

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

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

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

示例1: sfnt_init_face

  sfnt_init_face( FT_Stream      stream,                  TT_Face        face,                  FT_Int         face_index,                  FT_Int         num_params,                  FT_Parameter*  params )  {    FT_Error        error;    FT_Library      library = face->root.driver->root.library;    SFNT_Service    sfnt;    /* for now, parameters are unused */    FT_UNUSED( num_params );    FT_UNUSED( params );    sfnt = (SFNT_Service)face->sfnt;    if ( !sfnt )    {      sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );      if ( !sfnt )      {        FT_ERROR(( "sfnt_init_face: cannot access `sfnt' module/n" ));        return FT_THROW( Missing_Module );      }      face->sfnt       = sfnt;      face->goto_table = sfnt->goto_table;    }    FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );    FT_TRACE2(( "SFNT driver/n" ));    error = sfnt_open_font( stream, face );    if ( error )      return error;    /* Stream may have changed in sfnt_open_font. */    stream = face->root.stream;    FT_TRACE2(( "sfnt_init_face: %08p, %ld/n", face, face_index ));    if ( face_index < 0 )      face_index = 0;    if ( face_index >= face->ttc_header.count )      return FT_THROW( Invalid_Argument );    if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )      return error;    /* check that we have a valid TrueType file */    error = sfnt->load_font_dir( face, stream );    if ( error )      return error;    face->root.num_faces  = face->ttc_header.count;    face->root.face_index = face_index;    return error;  }
开发者ID:johndpope,项目名称:Medusa,代码行数:62,


示例2: pfr_face_init

  pfr_face_init( FT_Stream      stream,                 FT_Face        pfrface,                 FT_Int         face_index,                 FT_Int         num_params,                 FT_Parameter*  params )  {    PFR_Face  face = (PFR_Face)pfrface;    FT_Error  error;    FT_UNUSED( num_params );    FT_UNUSED( params );    FT_TRACE2(( "PFR driver/n" ));    /* load the header and check it */    error = pfr_header_load( &face->header, stream );    if ( error )      goto Exit;    if ( !pfr_header_check( &face->header ) )    {      FT_TRACE2(( "  not a PFR font/n" ));      error = FT_THROW( Unknown_File_Format );      goto Exit;    }    /* check face index */    {      FT_UInt  num_faces;      error = pfr_log_font_count( stream,                                  face->header.log_dir_offset,                                  &num_faces );      if ( error )        goto Exit;      pfrface->num_faces = num_faces;    }    if ( face_index < 0 )      goto Exit;    if ( face_index >= pfrface->num_faces )    {      FT_ERROR(( "pfr_face_init: invalid face index/n" ));      error = FT_THROW( Invalid_Argument );      goto Exit;    }    /* load the face */    error = pfr_log_font_load(               &face->log_font, stream, face_index,               face->header.log_dir_offset,               FT_BOOL( face->header.phy_font_max_size_high != 0 ) );    if ( error )      goto Exit;    /* now load the physical font descriptor */    error = pfr_phy_font_load( &face->phy_font, stream,                               face->log_font.phys_offset,                               face->log_font.phys_size );    if ( error )      goto Exit;    /* now set up all root face fields */    {      PFR_PhyFont  phy_font = &face->phy_font;      pfrface->face_index = face_index;      pfrface->num_glyphs = phy_font->num_chars + 1;      pfrface->face_flags = FT_FACE_FLAG_SCALABLE;      /* if all characters point to the same gps_offset 0, we */      /* assume that the font only contains bitmaps           */      {        FT_UInt  nn;        for ( nn = 0; nn < phy_font->num_chars; nn++ )          if ( phy_font->chars[nn].gps_offset != 0 )            break;        if ( nn == phy_font->num_chars )        {          if ( phy_font->num_strikes > 0 )            pfrface->face_flags = 0;        /* not scalable */          else          {            FT_ERROR(( "pfr_face_init: font doesn't contain glyphs/n" ));            error = FT_THROW( Invalid_File_Format );            goto Exit;          }        }      }      if ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 )        pfrface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;//.........这里部分代码省略.........
开发者ID:03050903,项目名称:Urho3D,代码行数:101,


示例3: sfnt_load_face

  sfnt_load_face( FT_Stream      stream,                  TT_Face        face,                  FT_Int         face_index,                  FT_Int         num_params,                  FT_Parameter*  params )  {    FT_Error      error, psnames_error;    FT_Bool       has_outline;    FT_Bool       is_apple_sbit;    SFNT_Service  sfnt = (SFNT_Service)face->sfnt;    FT_UNUSED( face_index );    FT_UNUSED( num_params );    FT_UNUSED( params );    /* Load tables */    /* We now support two SFNT-based bitmapped font formats.  They */    /* are recognized easily as they do not include a `glyf'       */    /* table.                                                      */    /*                                                             */    /* The first format comes from Apple, and uses a table named   */    /* `bhed' instead of `head' to store the font header (using    */    /* the same format).  It also doesn't include horizontal and   */    /* vertical metrics tables (i.e. `hhea' and `vhea' tables are  */    /* missing).                                                   */    /*                                                             */    /* The other format comes from Microsoft, and is used with     */    /* WinCE/PocketPC.  It looks like a standard TTF, except that  */    /* it doesn't contain outlines.                                */    /*                                                             */    FT_TRACE2(( "sfnt_load_face: %08p/n/n", face ));    /* do we have outlines in there? */#ifdef FT_CONFIG_OPTION_INCREMENTAL    has_outline   = FT_BOOL( face->root.internal->incremental_interface != 0 ||                             tt_face_lookup_table( face, TTAG_glyf )    != 0 ||                             tt_face_lookup_table( face, TTAG_CFF )     != 0 );#else    has_outline   = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 ||                             tt_face_lookup_table( face, TTAG_CFF )  != 0 );#endif    is_apple_sbit = 0;    /* if this font doesn't contain outlines, we try to load */    /* a `bhed' table                                        */    if ( !has_outline && sfnt->load_bhed )    {      LOAD_( bhed );      is_apple_sbit = FT_BOOL( !error );    }    /* load the font header (`head' table) if this isn't an Apple */    /* sbit font file                                             */    if ( !is_apple_sbit )    {      LOAD_( head );      if ( error )        goto Exit;    }    if ( face->header.Units_Per_EM == 0 )    {      error = SFNT_Err_Invalid_Table;      goto Exit;    }    /* the following tables are often not present in embedded TrueType */    /* fonts within PDF documents, so don't check for them.            */    LOAD_( maxp );    LOAD_( cmap );    /* the following tables are optional in PCL fonts -- */    /* don't check for errors                            */    LOAD_( name );    LOAD_( post );    psnames_error = error;    /* do not load the metrics headers and tables if this is an Apple */    /* sbit font file                                                 */    if ( !is_apple_sbit )    {      /* load the `hhea' and `hmtx' tables */      LOADM_( hhea, 0 );      if ( !error )      {        LOADM_( hmtx, 0 );        if ( error == SFNT_Err_Table_Missing )        {          error = SFNT_Err_Hmtx_Table_Missing;#ifdef FT_CONFIG_OPTION_INCREMENTAL          /* If this is an incrementally loaded font and there are */          /* overriding metrics, tolerate a missing `hmtx' table.  */          if ( face->root.internal->incremental_interface          &&//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:101,


示例4: 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,


示例5: t42_parser_init

  t42_parser_init( T42_Parser     parser,                   FT_Stream      stream,                   FT_Memory      memory,                   PSAux_Service  psaux )  {    FT_Error  error = T42_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 = T42_Err_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:7heaven,项目名称:softart,代码行数:81,


示例6: 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,


示例7: tt_face_init

  tt_face_init( FT_Stream      stream,                FT_Face        ttface,      /* TT_Face */                FT_Int         face_index,                FT_Int         num_params,                FT_Parameter*  params )  {    FT_Error      error;    FT_Library    library;    SFNT_Service  sfnt;    TT_Face       face = (TT_Face)ttface;    FT_TRACE2(( "TTF driver/n" ));    library = ttface->driver->root.library;    sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );    if ( !sfnt )    {      FT_ERROR(( "tt_face_init: cannot access `sfnt' module/n" ));      error = FT_THROW( Missing_Module );      goto Exit;    }    /* create input stream from resource */    if ( FT_STREAM_SEEK( 0 ) )      goto Exit;    /* check that we have a valid TrueType file */    FT_TRACE2(( "  " ));    error = sfnt->init_face( stream, face, face_index, num_params, params );    /* Stream may have changed. */    stream = face->root.stream;    if ( error )      goto Exit;    /* We must also be able to accept Mac/GX fonts, as well as OT ones. */    /* The 0x00020000 tag is completely undocumented; some fonts from   */    /* Arphic made for Chinese Windows 3.1 have this.                   */    if ( face->format_tag != 0x00010000L  && /* MS fonts                             */         face->format_tag != 0x00020000L  && /* CJK fonts for Win 3.1                */         face->format_tag != TTAG_true    && /* Mac fonts                            */         face->format_tag != TTAG_0xA5kbd && /* `Keyboard.dfont' (legacy Mac OS X)   */         face->format_tag != TTAG_0xA5lst )  /* `LastResort.dfont' (legacy Mac OS X) */    {      FT_TRACE2(( "  not a TTF font/n" ));      goto Bad_Format;    }#ifdef TT_USE_BYTECODE_INTERPRETER    ttface->face_flags |= FT_FACE_FLAG_HINTER;#endif    /* If we are performing a simple font format check, exit immediately. */    if ( face_index < 0 )      return FT_Err_Ok;    /* Load font directory */    error = sfnt->load_face( stream, face, face_index, num_params, params );    if ( error )      goto Exit;    if ( tt_check_trickyness( ttface ) )      ttface->face_flags |= FT_FACE_FLAG_TRICKY;    error = tt_face_load_hdmx( face, stream );    if ( error )      goto Exit;    if ( FT_IS_SCALABLE( ttface ) )    {#ifdef FT_CONFIG_OPTION_INCREMENTAL      if ( !ttface->internal->incremental_interface )#endif      {        error = tt_face_load_loca( face, stream );        /* having a (non-zero) `glyf' table without */        /* a `loca' table is not valid              */        if ( face->glyf_len && FT_ERR_EQ( error, Table_Missing ) )          goto Exit;        if ( error )          goto Exit;      }      /* `fpgm', `cvt', and `prep' are optional */      error = tt_face_load_cvt( face, stream );      if ( error && FT_ERR_NEQ( error, Table_Missing ) )        goto Exit;      error = tt_face_load_fpgm( face, stream );      if ( error && FT_ERR_NEQ( error, Table_Missing ) )        goto Exit;      error = tt_face_load_prep( face, stream );      if ( error && FT_ERR_NEQ( error, Table_Missing ) )        goto Exit;//.........这里部分代码省略.........
开发者ID:CCExtractor,项目名称:ccextractor,代码行数:101,


示例8: T42_Face_Init

  T42_Face_Init( FT_Stream      stream,                 FT_Face        t42face,       /* T42_Face */                 FT_Int         face_index,                 FT_Int         num_params,                 FT_Parameter*  params )  {    T42_Face            face  = (T42_Face)t42face;    FT_Error            error;    FT_Service_PsCMaps  psnames;    PSAux_Service       psaux;    FT_Face             root  = (FT_Face)&face->root;    T1_Font             type1 = &face->type1;    PS_FontInfo         info  = &type1->font_info;    FT_UNUSED( num_params );    FT_UNUSED( params );    FT_UNUSED( stream );    face->ttf_face       = NULL;    face->root.num_faces = 1;    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );    face->psnames = psnames;    face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),                                           "psaux" );    psaux = (PSAux_Service)face->psaux;    if ( !psaux )    {      FT_ERROR(( "T42_Face_Init: cannot access `psaux' module/n" ));      error = FT_THROW( Missing_Module );      goto Exit;    }    FT_TRACE2(( "Type 42 driver/n" ));    /* open the tokenizer, this will also check the font format */    error = T42_Open_Face( face );    if ( error )      goto Exit;    /* if we just wanted to check the format, leave successfully now */    if ( face_index < 0 )      goto Exit;    /* check the face index */    if ( ( face_index & 0xFFFF ) > 0 )    {      FT_ERROR(( "T42_Face_Init: invalid face index/n" ));      error = FT_THROW( Invalid_Argument );      goto Exit;    }    /* Now load the font program into the face object */    /* Init the face object fields */    /* Now set up root face fields */    root->num_glyphs   = type1->num_glyphs;    root->num_charmaps = 0;    root->face_index   = 0;    root->face_flags |= FT_FACE_FLAG_SCALABLE    |                        FT_FACE_FLAG_HORIZONTAL  |                        FT_FACE_FLAG_GLYPH_NAMES;    if ( info->is_fixed_pitch )      root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;    /* We only set this flag if we have the patented bytecode interpreter. */    /* There are no known `tricky' Type42 fonts that could be loaded with  */    /* the unpatented interpreter.                                         */#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER    root->face_flags |= FT_FACE_FLAG_HINTER;#endif    /* XXX: TODO -- add kerning with .afm support */    /* get style name -- be careful, some broken fonts only */    /* have a `/FontName' dictionary entry!                 */    root->family_name = info->family_name;    /* assume "Regular" style if we don't know better */    root->style_name = (char *)"Regular";    if ( root->family_name )    {      char*  full   = info->full_name;      char*  family = root->family_name;      if ( full )      {        while ( *full )        {          if ( *full == *family )          {            family++;            full++;          }          else//.........这里部分代码省略.........
开发者ID:1nt3g3r,项目名称:libgdx,代码行数:101,


示例9: 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_ULong  read_len = 256 + 10;        FT_Byte*  p        = buffer;        for ( offset = FT_STREAM_POS(); ; offset += 256 )        {            FT_ULong  stream_len;            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 += (FT_ULong)( p - buffer + 10 );                    goto Found;                }                else if ( p[1] == 's' && ft_strncmp( (char*)p, "/sfnts", 6 ) == 0 )                {                    offset += (FT_ULong)( 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:Johnny-Martin,项目名称:ComBase,代码行数: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 FT_THROW( 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 ));    if ( sfnt.format_tag != TTAG_OTTO )    {      /* 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;    FT_TRACE2(( "/n"                "  tag    offset    length   checksum/n"                "  ----------------------------------/n" ));    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  %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->CheckSum ));        entry++;      }    }    FT_FRAME_EXIT();//.........这里部分代码省略.........
开发者ID:03050903,项目名称:godot,代码行数:101,


示例11: PCF_Face_Init

  PCF_Face_Init( FT_Stream      stream,                 PCF_Face       face,                 FT_Int         face_index,                 FT_Int         num_params,                 FT_Parameter*  params )  {    FT_Error  error = PCF_Err_Ok;    FT_UNUSED( num_params );    FT_UNUSED( params );    FT_UNUSED( face_index );    error = pcf_load_font( stream, face );    if ( error )      goto Fail;    /* set-up charmap */    {      FT_String  *charset_registry, *charset_encoding;      FT_Bool     unicode_charmap  = 0;      charset_registry = face->charset_registry;      charset_encoding = face->charset_encoding;      if ( ( charset_registry != NULL ) &&           ( charset_encoding != NULL ) )      {        if ( !ft_strcmp( face->charset_registry, "ISO10646" )     ||             ( !ft_strcmp( face->charset_registry, "ISO8859" ) &&               !ft_strcmp( face->charset_encoding, "1" )       )  )          unicode_charmap = 1;      }#ifdef FT_CONFIG_OPTION_USE_CMAPS      {        FT_CharMapRec  charmap;        charmap.face        = FT_FACE( face );        charmap.encoding    = ft_encoding_none;        charmap.platform_id = 0;        charmap.encoding_id = 0;        if ( unicode_charmap )        {          charmap.encoding    = ft_encoding_unicode;          charmap.platform_id = 3;          charmap.encoding_id = 1;        }        error = FT_CMap_New( &pcf_cmap_class, NULL, &charmap, NULL );        /* Select default charmap */        if (face->root.num_charmaps)          face->root.charmap = face->root.charmaps[0];      }#else  /* !FT_CONFIG_OPTION_USE_CMAPS */      /* XXX: charmaps.  For now, report unicode for Unicode and Latin 1 */      face->root.charmaps     = &face->charmap_handle;      face->root.num_charmaps = 1;      face->charmap.encoding    = ft_encoding_none;      face->charmap.platform_id = 0;      face->charmap.encoding_id = 0;      if ( unicode_charmap )      {        face->charmap.encoding    = ft_encoding_unicode;        face->charmap.platform_id = 3;        face->charmap.encoding_id = 1;      }      face->charmap.face   = &face->root;      face->charmap_handle = &face->charmap;      face->root.charmap   = face->charmap_handle;#endif /* !FT_CONFIG_OPTION_USE_CMAPS */    }  Exit:    return error;  Fail:    FT_TRACE2(( "[not a valid PCF file]/n" ));    error = PCF_Err_Unknown_File_Format;  /* error */    goto Exit;  }
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:93,


示例12: cff_font_load

  cff_font_load( FT_Stream  stream,                 FT_Int     face_index,                 CFF_Font   font )  {    static const FT_Frame_Field  cff_header_fields[] =    {#undef  FT_STRUCTURE#define FT_STRUCTURE  CFF_FontRec      FT_FRAME_START( 4 ),        FT_FRAME_BYTE( version_major ),        FT_FRAME_BYTE( version_minor ),        FT_FRAME_BYTE( header_size ),        FT_FRAME_BYTE( absolute_offsize ),      FT_FRAME_END    };    FT_Error         error;    FT_Memory        memory = stream->memory;    FT_ULong         base_offset;    CFF_FontRecDict  dict;    FT_ZERO( font );    font->stream = stream;    font->memory = memory;    dict         = &font->top_font.font_dict;    base_offset  = FT_STREAM_POS();    /* read CFF font header */    if ( FT_STREAM_READ_FIELDS( cff_header_fields, font ) )      goto Exit;    /* check format */    if ( font->version_major   != 1 ||         font->header_size      < 4 ||         font->absolute_offsize > 4 )    {      FT_TRACE2(( "[not a CFF font header!]/n" ));      error = CFF_Err_Unknown_File_Format;      goto Exit;    }    /* skip the rest of the header */    if ( FT_STREAM_SKIP( font->header_size - 4 ) )      goto Exit;    /* read the name, top dict, string and global subrs index */    if ( FT_SET_ERROR( cff_new_index( &font->name_index,         stream, 0 )) ||         FT_SET_ERROR( cff_new_index( &font->font_dict_index,    stream, 0 )) ||         FT_SET_ERROR( cff_new_index( &font->string_index,       stream, 0 )) ||         FT_SET_ERROR( cff_new_index( &font->global_subrs_index, stream, 1 )) )      goto Exit;    /* well, we don't really forget the `disabled' fonts... */    font->num_faces = font->name_index.count;    if ( face_index >= (FT_Int)font->num_faces )    {      FT_ERROR(( "cff_font_load: incorrect face index = %d/n",                 face_index ));      error = CFF_Err_Invalid_Argument;    }    /* in case of a font format check, simply exit now */    if ( face_index < 0 )      goto Exit;    /* now, parse the top-level font dictionary */    error = cff_subfont_load( &font->top_font,                              &font->font_dict_index,                              face_index,                              stream,                              base_offset );    if ( error )      goto Exit;    /* now, check for a CID font */    if ( dict->cid_registry )    {      CFF_IndexRec  fd_index;      CFF_SubFont   sub;      FT_UInt       idx;      /* this is a CID-keyed font, we must now allocate a table of */      /* sub-fonts, then load each of them separately              */      if ( FT_STREAM_SEEK( base_offset + dict->cid_fd_array_offset ) )        goto Exit;      error = cff_new_index( &fd_index, stream, 0 );      if ( error )        goto Exit;      if ( fd_index.count > CFF_MAX_CID_FONTS )      {        FT_ERROR(( "cff_font_load: FD array too large in CID font/n" ));        goto Fail_CID;      }      /* allocate & read each font dict independently *///.........这里部分代码省略.........
开发者ID:1tgr,项目名称:mobius,代码行数:101,


示例13: 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;    TT_TableRec*    limit;    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 ) )      return error;    /* 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(( "-- Tables count:   %12u/n",  sfnt.num_tables ));    FT_TRACE2(( "-- Format version: %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!/n" ));      return error;    }    face->num_tables = sfnt.num_tables;    face->format_tag = sfnt.format_tag;    if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )      return error;    if ( FT_STREAM_SEEK( sfnt.offset + 12 )       ||         FT_FRAME_ENTER( face->num_tables * 16L ) )      return error;    entry = face->dir_tables;    limit = entry + face->num_tables;    for ( ; entry < limit; entry++ )    {      entry->Tag      = FT_GET_TAG4();      entry->CheckSum = FT_GET_ULONG();      entry->Offset   = FT_GET_LONG();      entry->Length   = FT_GET_LONG();      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 ));    }    FT_FRAME_EXIT();    FT_TRACE2(( "table directory loaded/n/n" ));    return error;  }
开发者ID:ShaneIsley,项目名称:challengeq3,代码行数:89,


示例14: 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;#if 0    FT_FACE_FIND_GLOBAL_SERVICE( face, sfnt,     SFNT );    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames,  POSTSCRIPT_NAMES );    FT_FACE_FIND_GLOBAL_SERVICE( face, pshinter, POSTSCRIPT_HINTER );    if ( !sfnt )      goto Bad_Format;#else    sfnt = (SFNT_Service)FT_Get_Module_Interface(             library, "sfnt" );    if ( !sfnt )      goto Bad_Format;    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );    pshinter = (PSHinter_Service)FT_Get_Module_Interface(                 library, "pshinter" );#endif    /* 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 a valid OpenType/CFF font]/n" ));        goto Bad_Format;      }      /* if we are performing a simple font format check, exit immediately */      if ( face_index < 0 )        return CFF_Err_Ok;      /* UNDOCUMENTED!  A CFF in an SFNT can have only a single font. */      if ( face_index > 0 )      {        FT_ERROR(( "cff_face_init: invalid face index/n" ));        error = CFF_Err_Invalid_Argument;        goto Exit;      }      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, 0, num_params, params );        if ( error )          goto Exit;      }      else      {        /* load the `cmap' table explicitly */        error = sfnt->load_cmap( face, stream );        if ( error )          goto Exit;        /* XXX: we don't load the GPOS table, as OpenType Layout     */        /* support will be added later to a layout library on top of */        /* FreeType 2                                                */      }      /* 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 = CFF_Err_Ok;    }//.........这里部分代码省略.........
开发者ID:howardgao-mt,项目名称:myd3dlib,代码行数:101,


示例15: 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:LumaDigital,项目名称:AtomicGameEngine,代码行数:101,


示例16: tt_face_init

  tt_face_init( FT_Stream      stream,                FT_Face        ttface,      /* TT_Face */                FT_Int         face_index,                FT_Int         num_params,                FT_Parameter*  params )  {    FT_Error      error;    FT_Library    library;    SFNT_Service  sfnt;    TT_Face       face = (TT_Face)ttface;    library = face->root.driver->root.library;    sfnt    = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );    if ( !sfnt )      goto Bad_Format;    /* create input stream from resource */    if ( FT_STREAM_SEEK( 0 ) )      goto Exit;    /* check that we have a valid TrueType file */    error = sfnt->init_face( stream, face, face_index, num_params, params );    if ( error )      goto Exit;    /* We must also be able to accept Mac/GX fonts, as well as OT ones. */    /* The 0x00020000 tag is completely undocumented; some fonts from   */    /* Arphic made for Chinese Windows 3.1 have this.                   */    if ( face->format_tag != 0x00010000L &&    /* MS fonts  */         face->format_tag != 0x00020000L &&    /* CJK fonts for Win 3.1 */         face->format_tag != TTAG_true   )     /* Mac fonts */    {      FT_TRACE2(( "[not a valid TTF font]/n" ));      goto Bad_Format;    }#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER    face->root.face_flags |= FT_FACE_FLAG_HINTER;#endif    /* If we are performing a simple font format check, exit immediately. */    if ( face_index < 0 )      return TT_Err_Ok;    /* Load font directory */    error = sfnt->load_face( stream, face, face_index, num_params, params );    if ( error )      goto Exit;    error = tt_face_load_hdmx( face, stream );    if ( error )      goto Exit;    if ( face->root.face_flags & FT_FACE_FLAG_SCALABLE )    {#ifdef FT_CONFIG_OPTION_INCREMENTAL      if ( !face->root.internal->incremental_interface )        error = tt_face_load_loca( face, stream );      if ( !error )        error = tt_face_load_cvt( face, stream )  ||                tt_face_load_fpgm( face, stream ) ||                tt_face_load_prep( face, stream );#else      if ( !error )        error = tt_face_load_loca( face, stream ) ||                tt_face_load_cvt( face, stream )  ||                tt_face_load_fpgm( face, stream ) ||                tt_face_load_prep( face, stream );#endif    }#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING    /* Determine whether unpatented hinting is to be used for this face. */    face->unpatented_hinting = FT_BOOL       ( library->debug_hooks[ FT_DEBUG_HOOK_UNPATENTED_HINTING ] != NULL );    {      int  i;      for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )        if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )          face->unpatented_hinting = TRUE;    }#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING */    /* initialize standard glyph loading routines */    TT_Init_Glyph_Loading( face );  Exit:    return error;//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:101,


示例17: T1_Face_Init

  T1_Face_Init( FT_Stream      stream,                FT_Face        t1face,          /* T1_Face */                FT_Int         face_index,                FT_Int         num_params,                FT_Parameter*  params )  {    T1_Face             face = (T1_Face)t1face;    FT_Error            error;    FT_Service_PsCMaps  psnames;    PSAux_Service       psaux;    T1_Font             type1 = &face->type1;    PS_FontInfo         info = &type1->font_info;    FT_UNUSED( num_params );    FT_UNUSED( params );    FT_UNUSED( stream );    face->root.num_faces = 1;    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );    face->psnames = psnames;    face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),                                           "psaux" );    psaux = (PSAux_Service)face->psaux;    if ( !psaux )    {      FT_ERROR(( "T1_Face_Init: cannot access `psaux' module/n" ));      error = FT_THROW( Missing_Module );      goto Exit;    }    face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),                                              "pshinter" );    FT_TRACE2(( "Type 1 driver/n" ));    /* open the tokenizer; this will also check the font format */    error = T1_Open_Face( face );    if ( error )      goto Exit;    /* if we just wanted to check the format, leave successfully now */    if ( face_index < 0 )      goto Exit;    /* check the face index */    if ( ( face_index & 0xFFFF ) > 0 )    {      FT_ERROR(( "T1_Face_Init: invalid face index/n" ));      error = FT_THROW( Invalid_Argument );      goto Exit;    }    /* now load the font program into the face object */    /* initialize the face object fields */    /* set up root face fields */    {      FT_Face  root = (FT_Face)&face->root;      root->num_glyphs = type1->num_glyphs;      root->face_index = 0;      root->face_flags |= FT_FACE_FLAG_SCALABLE    |                          FT_FACE_FLAG_HORIZONTAL  |                          FT_FACE_FLAG_GLYPH_NAMES |                          FT_FACE_FLAG_HINTER;      if ( info->is_fixed_pitch )        root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;      if ( face->blend )        root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;      /* The following code to extract the family and the style is very   */      /* simplistic and might get some things wrong.  For a full-featured */      /* algorithm you might have a look at the whitepaper given at       */      /*                                                                  */      /*   http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */      /* get style name -- be careful, some broken fonts only */      /* have a `/FontName' dictionary entry!                 */      root->family_name = info->family_name;      root->style_name  = NULL;      if ( root->family_name )      {        char*  full   = info->full_name;        char*  family = root->family_name;        if ( full )        {          FT_Bool  the_same = TRUE;//.........这里部分代码省略.........
开发者ID:1vanK,项目名称:Urho3D,代码行数:101,


示例18: sfnt_load_face

  sfnt_load_face( FT_Stream      stream,                  TT_Face        face,                  FT_Int         face_index,                  FT_Int         num_params,                  FT_Parameter*  params )  {    FT_Error      error;#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES    FT_Error      psnames_error;#endif    FT_Bool       has_outline;    FT_Bool       is_apple_sbit;    FT_Bool       ignore_preferred_family    = FALSE;    FT_Bool       ignore_preferred_subfamily = FALSE;    SFNT_Service  sfnt = (SFNT_Service)face->sfnt;    FT_UNUSED( face_index );    /* Check parameters */    {      FT_Int  i;      for ( i = 0; i < num_params; i++ )      {        if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY )          ignore_preferred_family = TRUE;        else if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY )          ignore_preferred_subfamily = TRUE;      }    }    /* Load tables */    /* We now support two SFNT-based bitmapped font formats.  They */    /* are recognized easily as they do not include a `glyf'       */    /* table.                                                      */    /*                                                             */    /* The first format comes from Apple, and uses a table named   */    /* `bhed' instead of `head' to store the font header (using    */    /* the same format).  It also doesn't include horizontal and   */    /* vertical metrics tables (i.e. `hhea' and `vhea' tables are  */    /* missing).                                                   */    /*                                                             */    /* The other format comes from Microsoft, and is used with     */    /* WinCE/PocketPC.  It looks like a standard TTF, except that  */    /* it doesn't contain outlines.                                */    /*                                                             */    FT_TRACE2(( "sfnt_load_face: %08p/n/n", face ));    /* do we have outlines in there? */#ifdef FT_CONFIG_OPTION_INCREMENTAL    has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 ||                           tt_face_lookup_table( face, TTAG_glyf )    != 0 ||                           tt_face_lookup_table( face, TTAG_CFF )     != 0 );#else    has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 ||                           tt_face_lookup_table( face, TTAG_CFF )  != 0 );#endif    is_apple_sbit = 0;    /* if this font doesn't contain outlines, we try to load */    /* a `bhed' table                                        */    if ( !has_outline && sfnt->load_bhed )    {      LOAD_( bhed );      is_apple_sbit = FT_BOOL( !error );    }    /* load the font header (`head' table) if this isn't an Apple */    /* sbit font file                                             */    if ( !is_apple_sbit )    {      LOAD_( head );      if ( error )        goto Exit;    }    if ( face->header.Units_Per_EM == 0 )    {      error = FT_THROW( Invalid_Table );      goto Exit;    }    /* the following tables are often not present in embedded TrueType */    /* fonts within PDF documents, so don't check for them.            */    LOAD_( maxp );    LOAD_( cmap );    /* the following tables are optional in PCL fonts -- */    /* don't check for errors                            */    LOAD_( name );    LOAD_( post );//.........这里部分代码省略.........
开发者ID:kobolabs,项目名称:qt-everywhere-4.8.0,代码行数:101,


示例19: CFF_Face_Init

  CFF_Face_Init( FT_Stream      stream,                 CFF_Face       face,                 FT_Int         face_index,                 FT_Int         num_params,                 FT_Parameter*  params )  {    FT_Error          error;    SFNT_Service      sfnt;    PSNames_Service   psnames;    PSHinter_Service  pshinter;    FT_Bool           pure_cff    = 1;    FT_Bool           sfnt_format = 0;    sfnt = (SFNT_Service)FT_Get_Module_Interface(             face->root.driver->root.library, "sfnt" );    if ( !sfnt )      goto Bad_Format;    psnames = (PSNames_Service)FT_Get_Module_Interface(                face->root.driver->root.library, "psnames" );    pshinter = (PSHinter_Service)FT_Get_Module_Interface(                 face->root.driver->root.library, "pshinter" );    /* create input stream from resource */    if ( FT_STREAM_SEEK( 0 ) )      goto Exit;    /* check that we have a valid OpenType file */    error = sfnt->init_face( stream, face, face_index, num_params, params );    if ( !error )    {      if ( face->format_tag != 0x4F54544FL )  /* `OTTO'; OpenType/CFF font */      {        FT_TRACE2(( "[not a valid OpenType/CFF font]/n" ));        goto Bad_Format;      }      /* if we are performing a simple font format check, exit immediately */      if ( face_index < 0 )        return CFF_Err_Ok;      sfnt_format = 1;      /* now, the font can be either an OpenType/CFF font, or an SVG CEF */      /* font in the later 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 by hand */        error = sfnt->load_charmaps( face, stream );        if ( error )          goto Exit;        /* XXX: we don't load the GPOS table, as OpenType Layout     */        /* support will be added later to a layout library on top of */        /* FreeType 2                                                */      }      /* 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 = CFF_Err_Ok;    }    /* now load and parse the CFF table in the file */    {      CFF_Font   cff;      FT_Memory  memory = face->root.memory;      FT_Face    root;      FT_UInt    flags;      if ( FT_NEW( cff ) )        goto Exit;      face->extra.data = cff;      error = CFF_Load_Font( stream, face_index, cff );      if ( error )        goto Exit;      cff->pshinter = pshinter;//.........这里部分代码省略.........
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:101,


示例20: 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,


示例21: pfr_extra_item_load_kerning_pairs

  pfr_extra_item_load_kerning_pairs( FT_Byte*     p,                                     FT_Byte*     limit,                                     PFR_PhyFont  phy_font )  {    FT_Int        count;    FT_UShort     base_adj;    FT_UInt       flags;    FT_UInt       num_pairs;    PFR_KernPair  pairs;    FT_Error      error  = 0;    FT_Memory     memory = phy_font->memory;    /* XXX: there may be multiple extra items for kerning */    if ( phy_font->kern_pairs != NULL )      goto Exit;    FT_TRACE2(( "pfr_extra_item_load_kerning_pairs()/n" ));        PFR_CHECK( 4 );    num_pairs = PFR_NEXT_BYTE( p );    base_adj  = PFR_NEXT_SHORT( p );    flags     = PFR_NEXT_BYTE( p );    #ifndef PFR_CONFIG_NO_CHECKS    count = 3;        if ( flags & PFR_KERN_2BYTE_CHAR )      count += 2;        if ( flags & PFR_KERN_2BYTE_ADJ )      count += 1;    PFR_CHECK( num_pairs * count );#endif    if ( FT_NEW_ARRAY( pairs, num_pairs ) )      goto Exit;        phy_font->num_kern_pairs = num_pairs;    phy_font->kern_pairs     = pairs;        for (count = num_pairs ; count > 0; count--, pairs++ )    {      if ( flags & PFR_KERN_2BYTE_CHAR )      {        pairs->glyph1 = PFR_NEXT_USHORT( p );        pairs->glyph2 = PFR_NEXT_USHORT( p );      }      else      {        pairs->glyph1 = PFR_NEXT_BYTE( p );        pairs->glyph2 = PFR_NEXT_BYTE( p );      }           if ( flags & PFR_KERN_2BYTE_ADJ )        pairs->kerning.x = base_adj + PFR_NEXT_SHORT( p );      else        pairs->kerning.x = base_adj + PFR_NEXT_INT8( p );      pairs->kerning.y = 0;      FT_TRACE2(( "kerning %d <-> %d : %ld/n",                   pairs->glyph1, pairs->glyph2, pairs->kerning.x ));    }        Exit:    return error;    Too_Short:    error = PFR_Err_Invalid_Table;    FT_ERROR(( "pfr_extra_item_load_kerning_pairs: "               "invalid kerning pairs table/n" ));    goto Exit;  }                                 
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:76,


示例22: 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,


示例23: cff_font_load

  cff_font_load( FT_Library library,                 FT_Stream  stream,                 FT_Int     face_index,                 CFF_Font   font,                 FT_Bool    pure_cff )  {    static const FT_Frame_Field  cff_header_fields[] =    {#undef  FT_STRUCTURE#define FT_STRUCTURE  CFF_FontRec      FT_FRAME_START( 4 ),        FT_FRAME_BYTE( version_major ),        FT_FRAME_BYTE( version_minor ),        FT_FRAME_BYTE( header_size ),        FT_FRAME_BYTE( absolute_offsize ),      FT_FRAME_END    };    FT_Error         error;    FT_Memory        memory = stream->memory;    FT_ULong         base_offset;    CFF_FontRecDict  dict;    CFF_IndexRec     string_index;    FT_UInt          subfont_index;    FT_ZERO( font );    FT_ZERO( &string_index );    font->stream = stream;    font->memory = memory;    dict         = &font->top_font.font_dict;    base_offset  = FT_STREAM_POS();    /* read CFF font header */    if ( FT_STREAM_READ_FIELDS( cff_header_fields, font ) )      goto Exit;    /* check format */    if ( font->version_major   != 1 ||         font->header_size      < 4 ||         font->absolute_offsize > 4 )    {      FT_TRACE2(( "  not a CFF font header/n" ));      error = FT_THROW( Unknown_File_Format );      goto Exit;    }    /* skip the rest of the header */    if ( FT_STREAM_SKIP( font->header_size - 4 ) )      goto Exit;    /* read the name, top dict, string and global subrs index */    if ( FT_SET_ERROR( cff_index_init( &font->name_index,                                       stream, 0 ) )                  ||         FT_SET_ERROR( cff_index_init( &font->font_dict_index,                                       stream, 0 ) )                  ||         FT_SET_ERROR( cff_index_init( &string_index,                                       stream, 1 ) )                  ||         FT_SET_ERROR( cff_index_init( &font->global_subrs_index,                                       stream, 1 ) )                  ||         FT_SET_ERROR( cff_index_get_pointers( &string_index,                                               &font->strings,                                               &font->string_pool ) ) )      goto Exit;    font->num_strings = string_index.count;    if ( pure_cff )    {      /* well, we don't really forget the `disabled' fonts... */      subfont_index = (FT_UInt)( face_index & 0xFFFF );      if ( face_index > 0 && subfont_index >= font->name_index.count )      {        FT_ERROR(( "cff_font_load:"                   " invalid subfont index for pure CFF font (%d)/n",                   subfont_index ));        error = FT_THROW( Invalid_Argument );        goto Exit;      }      font->num_faces = font->name_index.count;    }    else    {      subfont_index = 0;      if ( font->name_index.count > 1 )      {        FT_ERROR(( "cff_font_load:"                   " invalid CFF font with multiple subfonts/n"                   "              "                   " in SFNT wrapper/n" ));        error = FT_THROW( Invalid_File_Format );        goto Exit;      }    }//.........这里部分代码省略.........
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:101,


示例24: cid_face_init

  cid_face_init( FT_Stream      stream,                 FT_Face        cidface,        /* CID_Face */                 FT_Int         face_index,                 FT_Int         num_params,                 FT_Parameter*  params )  {    CID_Face          face = (CID_Face)cidface;    FT_Error          error;    PSAux_Service     psaux;    PSHinter_Service  pshinter;    FT_UNUSED( num_params );    FT_UNUSED( params );    FT_UNUSED( stream );    cidface->num_faces = 1;    psaux = (PSAux_Service)face->psaux;    if ( !psaux )    {      psaux = (PSAux_Service)FT_Get_Module_Interface(                FT_FACE_LIBRARY( face ), "psaux" );      if ( !psaux )      {        FT_ERROR(( "cid_face_init: cannot access `psaux' module/n" ));        error = FT_THROW( Missing_Module );        goto Exit;      }      face->psaux = psaux;    }    pshinter = (PSHinter_Service)face->pshinter;    if ( !pshinter )    {      pshinter = (PSHinter_Service)FT_Get_Module_Interface(                   FT_FACE_LIBRARY( face ), "pshinter" );      face->pshinter = pshinter;    }    FT_TRACE2(( "CID driver/n" ));    /* open the tokenizer; this will also check the font format */    if ( FT_STREAM_SEEK( 0 ) )      goto Exit;    error = cid_face_open( face, face_index );    if ( error )      goto Exit;    /* if we just wanted to check the format, leave successfully now */    if ( face_index < 0 )      goto Exit;    /* check the face index */    /* XXX: handle CID fonts with more than a single face */    if ( face_index != 0 )    {      FT_ERROR(( "cid_face_init: invalid face index/n" ));      error = FT_THROW( Invalid_Argument );      goto Exit;    }    /* now load the font program into the face object */    /* initialize the face object fields */    /* set up root face fields */    {      CID_FaceInfo  cid  = &face->cid;      PS_FontInfo   info = &cid->font_info;      cidface->num_glyphs   = cid->cid_count;      cidface->num_charmaps = 0;      cidface->face_index = face_index;      cidface->face_flags = FT_FACE_FLAG_SCALABLE   | /* scalable outlines */                            FT_FACE_FLAG_HORIZONTAL | /* horizontal data   */                            FT_FACE_FLAG_HINTER;      /* has native hinter */      if ( info->is_fixed_pitch )        cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;      /* XXX: TODO: add kerning with .afm support */      /* get style name -- be careful, some broken fonts only */      /* have a /FontName dictionary entry!                   */      cidface->family_name = info->family_name;      /* assume "Regular" style if we don't know better */      cidface->style_name = (char *)"Regular";      if ( cidface->family_name )      {        char*  full   = info->full_name;        char*  family = cidface->family_name;//.........这里部分代码省略.........
开发者ID:erichocean,项目名称:myos.android.libraries,代码行数:101,


示例25: T1_New_Parser

  T1_New_Parser( T1_Parser      parser,                 FT_Stream      stream,                 FT_Memory      memory,                 PSAux_Service  psaux )  {    FT_Error   error;    FT_UShort  tag;    FT_ULong   size;    psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );    parser->stream       = stream;    parser->base_len     = 0;    parser->base_dict    = 0;    parser->private_len  = 0;    parser->private_dict = 0;    parser->in_pfb       = 0;    parser->in_memory    = 0;    parser->single_block = 0;    /* check the header format */    error = check_type1_format( stream, "%!PS-AdobeFont", 14 );    if ( error )    {      if ( error != T1_Err_Unknown_File_Format )        goto Exit;      error = check_type1_format( stream, "%!FontType", 10 );      if ( error )      {        FT_TRACE2(( "[not a Type1 font]/n" ));        goto Exit;      }    }    /******************************************************************/    /*                                                                */    /* Here a short summary of what is going on:                      */    /*                                                                */    /*   When creating a new Type 1 parser, we try to locate and load */    /*   the base dictionary if this is possible (i.e., for PFB       */    /*   files).  Otherwise, we load the whole font into memory.      */    /*                                                                */    /*   When `loading' the base dictionary, we only setup pointers   */    /*   in the case of a memory-based stream.  Otherwise, we         */    /*   allocate and load the base dictionary in it.                 */    /*                                                                */    /*   parser->in_pfb is set if we are in a binary (`.pfb') font.   */    /*   parser->in_memory is set if we have a memory stream.         */    /*                                                                */    /* try to compute the size of the base dictionary;     */    /* look for a Postscript binary file tag, i.e., 0x8001 */    if ( FT_STREAM_SEEK( 0L ) )      goto Exit;    error = read_pfb_tag( stream, &tag, &size );    if ( error )      goto Exit;    if ( tag != 0x8001U )    {      /* assume that this is a PFA file for now; an error will */      /* be produced later when more things are checked        */      if ( FT_STREAM_SEEK( 0L ) )        goto Exit;      size = stream->size;    }    else      parser->in_pfb = 1;    /* 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 -- this is clumsy, but so does the format */      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://.........这里部分代码省略.........
开发者ID:0309,项目名称:cocos2d-x,代码行数:101,


示例26: 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;    FT_TRACE2(( "pfr_extra_item_load_kerning_pairs()/n" ));    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 + ( 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:neodyme60,项目名称:Xli,代码行数:93,


示例27: check_table_dir

  static FT_Error  check_table_dir( SFNT_Header  sfnt,                   FT_Stream    stream )  {    FT_Error   error;    FT_UShort  nn, valid_entries = 0;    FT_UInt    has_head = 0, has_sing = 0, has_meta = 0;    FT_ULong   offset = sfnt->offset + 12;    static const FT_Frame_Field  table_dir_entry_fields[] =    {#undef  FT_STRUCTURE#define FT_STRUCTURE  TT_TableRec      FT_FRAME_START( 16 ),        FT_FRAME_ULONG( Tag ),        FT_FRAME_ULONG( CheckSum ),        FT_FRAME_ULONG( Offset ),        FT_FRAME_ULONG( Length ),      FT_FRAME_END    };    if ( FT_STREAM_SEEK( offset ) )      goto Exit;    for ( nn = 0; nn < sfnt->num_tables; nn++ )    {      TT_TableRec  table;      if ( FT_STREAM_READ_FIELDS( table_dir_entry_fields, &table ) )      {        nn--;        FT_TRACE2(( "check_table_dir:"                    " can read only %d table%s in font (instead of %d)/n",                    nn, nn == 1 ? "" : "s", sfnt->num_tables ));        sfnt->num_tables = nn;        break;      }      /* we ignore invalid tables */      if ( table.Offset + table.Length > stream->size )      {		//BUGID: 53876, the cmap table is invalid, the font file couldn't be used.		if (table.Tag == TTAG_cmap) break;        FT_TRACE2(( "check_table_dir: table entry %d invalid/n", nn ));        continue;      }      else        valid_entries++;      if ( table.Tag == TTAG_head || table.Tag == TTAG_bhed )      {        FT_UInt32  magic;#ifndef TT_CONFIG_OPTION_EMBEDDED_BITMAPS        if ( table.Tag == TTAG_head )#endif          has_head = 1;        /*         * The table length should be 0x36, but certain font tools make it         * 0x38, so we will just check that it is greater.         *         * Note that according to the specification, the table must be         * padded to 32-bit lengths, but this doesn't apply to the value of         * its `Length' field!         *         */        if ( table.Length < 0x36 )        {          FT_TRACE2(( "check_table_dir: `head' table too small/n" ));          error = FT_THROW( Table_Missing );          goto Exit;        }        if ( FT_STREAM_SEEK( table.Offset + 12 ) ||             FT_READ_ULONG( magic )              )          goto Exit;        if ( magic != 0x5F0F3CF5UL )        {          FT_TRACE2(( "check_table_dir:"                      " no magic number found in `head' table/n"));          error = FT_THROW( Table_Missing );          goto Exit;        }        if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) )          goto Exit;      }      else if ( table.Tag == TTAG_SING )        has_sing = 1;      else if ( table.Tag == TTAG_META )        has_meta = 1;    }    sfnt->num_tables = valid_entries;//.........这里部分代码省略.........
开发者ID:WHS-TechOps,项目名称:Aviator,代码行数:101,


示例28: woff_open_font

//.........这里部分代码省略.........    /* Write sfnt header. */    {      FT_UInt  searchRange, entrySelector, rangeShift, x;      x             = woff.num_tables;      entrySelector = 0;      while ( x )      {        x            >>= 1;        entrySelector += 1;      }      entrySelector--;      searchRange = ( 1 << entrySelector ) * 16;      rangeShift  = woff.num_tables * 16 - searchRange;      WRITE_ULONG ( sfnt_header, woff.flavor );      WRITE_USHORT( sfnt_header, woff.num_tables );      WRITE_USHORT( sfnt_header, searchRange );      WRITE_USHORT( sfnt_header, entrySelector );      WRITE_USHORT( sfnt_header, rangeShift );    }    /* While the entries in the sfnt header must be sorted by the */    /* tag value, the tables themselves are not.  We thus have to */    /* sort them by offset and check that they don't overlap.     */    if ( FT_NEW_ARRAY( tables, woff.num_tables )  ||         FT_NEW_ARRAY( indices, woff.num_tables ) )      goto Exit;    FT_TRACE2(( "/n"                "  tag    offset    compLen  origLen  checksum/n"                "  -------------------------------------------/n" ));    if ( FT_FRAME_ENTER( 20L * woff.num_tables ) )      goto Exit;    for ( nn = 0; nn < woff.num_tables; nn++ )    {      WOFF_Table  table = tables + nn;      table->Tag        = FT_GET_TAG4();      table->Offset     = FT_GET_ULONG();      table->CompLength = FT_GET_ULONG();      table->OrigLength = FT_GET_ULONG();      table->CheckSum   = FT_GET_ULONG();      FT_TRACE2(( "  %c%c%c%c  %08lx  %08lx  %08lx  %08lx/n",                  (FT_Char)( table->Tag >> 24 ),                  (FT_Char)( table->Tag >> 16 ),                  (FT_Char)( table->Tag >> 8  ),                  (FT_Char)( table->Tag       ),                  table->Offset,                  table->CompLength,                  table->OrigLength,                  table->CheckSum ));      if ( table->Tag <= old_tag )      {        FT_FRAME_EXIT();        error = FT_THROW( Invalid_Table );        goto Exit;      }
开发者ID:johndpope,项目名称:Medusa,代码行数:67,



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


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