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

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

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

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

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

示例1: new_memory_stream

  /* Create a new memory stream from a buffer and a size. */  static FT_Error  new_memory_stream( FT_Library           library,                     FT_Byte*             base,                     FT_ULong             size,                     FT_Stream_CloseFunc  close,                     FT_Stream*           astream )  {    FT_Error   error;    FT_Memory  memory;    FT_Stream  stream;    if ( !library )      return FT_Err_Invalid_Library_Handle;    if ( !base )      return FT_Err_Invalid_Argument;    *astream = 0;    memory = library->memory;    if ( FT_NEW( stream ) )      goto Exit;    FT_Stream_OpenMemory( stream, base, size );    stream->close = close;    *astream = stream;  Exit:    return error;  }
开发者ID:gorlak,项目名称:panda3d-thirdparty,代码行数:33,


示例2: ftc_cmap_node_new

  ftc_cmap_node_new( FTC_Node   *ftcanode,                     FT_Pointer  ftcquery,                     FTC_Cache   cache )  {    FTC_CMapNode  *anode  = (FTC_CMapNode*)ftcanode;    FTC_CMapQuery  query  = (FTC_CMapQuery)ftcquery;    FT_Error       error;    FT_Memory      memory = cache->memory;    FTC_CMapNode   node   = NULL;    FT_UInt        nn;    if ( !FT_NEW( node ) )    {      node->face_id    = query->face_id;      node->cmap_index = query->cmap_index;      node->first      = (query->char_code / FTC_CMAP_INDICES_MAX) *                         FTC_CMAP_INDICES_MAX;      for ( nn = 0; nn < FTC_CMAP_INDICES_MAX; nn++ )        node->indices[nn] = FTC_CMAP_UNKNOWN;    }    *anode = node;    return error;  }
开发者ID:hamfirst,项目名称:StormBrewerEngine,代码行数:26,


示例3: afm_parser_init

  afm_parser_init( AFM_Parser  parser,                   FT_Memory   memory,                   FT_Byte*    base,                   FT_Byte*    limit )  {    AFM_Stream  stream;    FT_Error    error;    if ( FT_NEW( stream ) )      return error;    stream->cursor = stream->base = base;    stream->limit  = limit;    /* don't skip the first line during the first call */    stream->status = AFM_STREAM_STATUS_EOL;    parser->memory    = memory;    parser->stream    = stream;    parser->FontInfo  = NULL;    parser->get_index = NULL;    return PSaux_Err_Ok;  }
开发者ID:CarloMaker,项目名称:Urho3D,代码行数:25,


示例4: cf2_stack_init

  cf2_stack_init( FT_Memory  memory,                  FT_Error*  e,                  FT_UInt    stackSize )  {    FT_Error  error = FT_Err_Ok;     /* for FT_NEW */    CF2_Stack  stack = NULL;    if ( !FT_NEW( stack ) )    {      /* initialize the structure; FT_NEW zeroes it */      stack->memory = memory;      stack->error  = e;    }    /* allocate the stack buffer */    if ( FT_NEW_ARRAY( stack->buffer, stackSize ) )    {      FT_FREE( stack );      return NULL;    }    stack->stackSize = stackSize;    stack->top       = stack->buffer;     /* empty stack */    return stack;  }
开发者ID:1vanK,项目名称:Urho3D,代码行数:28,


示例5: FTC_INode_New

  FTC_INode_New( FTC_INode   *pinode,                 FTC_GQuery   gquery,                 FTC_Cache    cache )  {    FT_Memory  memory = cache->memory;    FT_Error   error;    FTC_INode  inode  = NULL;    if ( !FT_NEW( inode ) )    {      FTC_GNode         gnode  = FTC_GNODE( inode );      FTC_Family        family = gquery->family;      FT_UInt           gindex = gquery->gindex;      FTC_IFamilyClass  clazz  = FTC_CACHE__IFAMILY_CLASS( cache );      /* initialize its inner fields */      FTC_GNode_Init( gnode, gindex, family );      /* we will now load the glyph image */      error = clazz->family_load_glyph( family, gindex, cache,                                        &inode->glyph );      if ( error )      {        FTC_INode_Free( inode, cache );        inode = NULL;      }    }    *pinode = inode;    return error;  }
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:33,


示例6: FTC_Manager_New

  FTC_Manager_New( FT_Library          library,                   FT_UInt             max_faces,                   FT_UInt             max_sizes,                   FT_ULong            max_bytes,                   FTC_Face_Requester  requester,                   FT_Pointer          req_data,                   FTC_Manager        *amanager )  {    FT_Error     error;    FT_Memory    memory;    FTC_Manager  manager = 0;    if ( !library )      return FT_THROW( Invalid_Library_Handle );    if ( !amanager || !requester )      return FT_THROW( Invalid_Argument );    memory = library->memory;    if ( FT_NEW( manager ) )      goto Exit;    if ( max_faces == 0 )      max_faces = FTC_MAX_FACES_DEFAULT;    if ( max_sizes == 0 )      max_sizes = FTC_MAX_SIZES_DEFAULT;    if ( max_bytes == 0 )      max_bytes = FTC_MAX_BYTES_DEFAULT;    manager->library      = library;    manager->memory       = memory;    manager->max_weight   = max_bytes;    manager->request_face = requester;    manager->request_data = req_data;    FTC_MruList_Init( &manager->faces,                      &ftc_face_list_class,                      max_faces,                      manager,                      memory );    FTC_MruList_Init( &manager->sizes,                      &ftc_size_list_class,                      max_sizes,                      manager,                      memory );    *amanager = manager;  Exit:    return error;  }
开发者ID:ImageMagick,项目名称:ttf,代码行数:57,


示例7: FTC_SNode_New

  FTC_SNode_New( FTC_SNode  *psnode,                 FTC_GQuery  gquery,                 FTC_Cache   cache )  {    FT_Memory   memory = cache->memory;    FT_Error    error;    FTC_SNode   snode  = NULL;    FT_UInt     gindex = gquery->gindex;    FTC_Family  family = gquery->family;    FTC_SFamilyClass  clazz = FTC_CACHE_SFAMILY_CLASS( cache );    FT_UInt           total;    FT_UInt           node_count;    total = clazz->family_get_count( family, cache->manager );    if ( total == 0 || gindex >= total )    {      error = FT_THROW( Invalid_Argument );      goto Exit;    }    if ( !FT_NEW( snode ) )    {      FT_UInt  count, start;      start = gindex - ( gindex % FTC_SBIT_ITEMS_PER_NODE );      count = total - start;      if ( count > FTC_SBIT_ITEMS_PER_NODE )        count = FTC_SBIT_ITEMS_PER_NODE;      FTC_GNode_Init( FTC_GNODE( snode ), start, family );      snode->count = count;      for ( node_count = 0; node_count < count; node_count++ )      {        snode->sbits[node_count].width = 255;      }      error = ftc_snode_load( snode,                              cache->manager,                              gindex,                              NULL );      if ( error )      {        FTC_SNode_Free( snode, cache );        snode = NULL;      }    }  Exit:    *psnode = snode;    return error;  }
开发者ID:hsmith,项目名称:freetype,代码行数:55,


示例8: FT_Stream_OpenLZW

  FT_Stream_OpenLZW( FT_Stream  stream,                     FT_Stream  source )  {    FT_Error    error;    FT_Memory   memory;    FT_LZWFile  zip = NULL;    if ( !stream || !source )    {      error = FT_THROW( Invalid_Stream_Handle );      goto Exit;    }    memory = source->memory;    /*     *  Check the header right now; this prevents allocation of a huge     *  LZWFile object (400 KByte of heap memory) if not necessary.     *     *  Did I mention that you should never use .Z compressed font     *  files?     */    error = ft_lzw_check_header( source );    if ( error )      goto Exit;    FT_ZERO( stream );    stream->memory = memory;    if ( !FT_NEW( zip ) )    {      error = ft_lzw_file_init( zip, stream, source );      if ( error )      {        FT_FREE( zip );        goto Exit;      }      stream->descriptor.pointer = zip;    }    stream->size  = 0x7FFFFFFFL;  /* don't know the real size! */    stream->pos   = 0;    stream->base  = 0;    stream->read  = ft_lzw_stream_io;    stream->close = ft_lzw_stream_close;  Exit:    return error;  }
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:51,


示例9: FT_GlyphLoader_New

  FT_GlyphLoader_New( FT_Memory        memory,                      FT_GlyphLoader  *aloader )  {    FT_GlyphLoader  loader = NULL;    FT_Error        error;    if ( !FT_NEW( loader ) )    {      loader->memory = memory;      *aloader       = loader;    }    return error;  }
开发者ID:prestocore,项目名称:browser,代码行数:14,


示例10: ah_outline_new

  ah_outline_new( FT_Memory    memory,                  AH_Outline*  aoutline )  {    FT_Error     error;    AH_Outline   outline;    if ( !FT_NEW( outline ) )    {      outline->memory = memory;      *aoutline = outline;    }    return error;  }
开发者ID:AudriusButkevicius,项目名称:TurboVNC,代码行数:15,


示例11: cff_size_init

  cff_size_init( FT_Size  cffsize )         /* CFF_Size */  {    CFF_Size           size  = (CFF_Size)cffsize;    FT_Error           error = FT_Err_Ok;    PSH_Globals_Funcs  funcs = cff_size_get_globals_funcs( size );    if ( funcs )    {      CFF_Face      face     = (CFF_Face)cffsize->face;      CFF_Font      font     = (CFF_Font)face->extra.data;      CFF_Internal  internal = NULL;      PS_PrivateRec  priv;      FT_Memory      memory = cffsize->face->memory;      FT_UInt  i;      if ( FT_NEW( internal ) )        goto Exit;      cff_make_private_dict( &font->top_font, &priv );      error = funcs->create( cffsize->face->memory, &priv,                             &internal->topfont );      if ( error )        goto Exit;      for ( i = font->num_subfonts; i > 0; i-- )      {        CFF_SubFont  sub = font->subfonts[i - 1];        cff_make_private_dict( sub, &priv );        error = funcs->create( cffsize->face->memory, &priv,                               &internal->subfonts[i - 1] );        if ( error )          goto Exit;      }      cffsize->internal = (FT_Size_Internal)(void*)internal;    }    size->strike_index = 0xFFFFFFFFUL;  Exit:    return error;  }
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:48,


示例12: cf2_stack_init

  cf2_stack_init( FT_Memory  memory,                  FT_Error*  e )  {    FT_Error  error = FT_Err_Ok;     /* for FT_NEW */    CF2_Stack  stack = NULL;    if ( !FT_NEW( stack ) )    {      /* initialize the structure; FT_NEW zeroes it */      stack->memory = memory;      stack->error  = e;      stack->top    = &stack->buffer[0]; /* empty stack */    }    return stack;  }
开发者ID:AdmiralCurtiss,项目名称:pcsx2,代码行数:18,


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


示例14: FTC_Manager_New

  FTC_Manager_New( FT_Library          library,                   FT_UInt             max_faces,                   FT_UInt             max_sizes,                   FT_ULong            max_bytes,                   FTC_Face_Requester  requester,                   FT_Pointer          req_data,                   FTC_Manager        *amanager )  {    FT_Error     error;    FT_Memory    memory;    FTC_Manager  manager = 0;    if ( !library )      return FTC_Err_Invalid_Library_Handle;    memory = library->memory;    if ( FT_NEW( manager ) )      goto Exit;    if ( max_faces == 0 )      max_faces = FTC_MAX_FACES_DEFAULT;    if ( max_sizes == 0 )      max_sizes = FTC_MAX_SIZES_DEFAULT;    if ( max_bytes == 0 )      max_bytes = FTC_MAX_BYTES_DEFAULT;    error = FT_LruList_New( &ftc_face_list_class,                            max_faces,                            manager,                            memory,                            &manager->faces_list );    if ( error )      goto Exit;    error = FT_LruList_New( &ftc_size_list_class,                            max_sizes,                            manager,                            memory,                            &manager->sizes_list );    if ( error )      goto Exit;    manager->library      = library;    manager->max_weight   = max_bytes;    manager->cur_weight   = 0;    manager->request_face = requester;    manager->request_data = req_data;    ftc_family_table_init( &manager->families );    *amanager = manager;  Exit:    if ( error && manager )    {      FT_LruList_Destroy( manager->faces_list );      FT_LruList_Destroy( manager->sizes_list );      FT_FREE( manager );    }    return error;  }
开发者ID:8l,项目名称:inferno,代码行数:67,


示例15: psh_globals_new

  static FT_Error  psh_globals_new( FT_Memory     memory,                   T1_Private*   priv,                   PSH_Globals  *aglobals )  {    PSH_Globals  globals = NULL;    FT_Error     error;    if ( !FT_NEW( globals ) )    {      FT_UInt    count;      FT_Short*  read;      globals->memory = memory;      /* copy standard widths */      {        PSH_Dimension  dim   = &globals->dimension[1];        PSH_Width      write = dim->stdw.widths;        write->org = priv->standard_width[0];        write++;        read = priv->snap_widths;        for ( count = priv->num_snap_widths; count > 0; count-- )        {          write->org = *read;          write++;          read++;        }        dim->stdw.count = priv->num_snap_widths + 1;      }      /* copy standard heights */      {        PSH_Dimension  dim = &globals->dimension[0];        PSH_Width      write = dim->stdw.widths;        write->org = priv->standard_height[0];        write++;        read = priv->snap_heights;        for ( count = priv->num_snap_heights; count > 0; count-- )        {          write->org = *read;          write++;          read++;        }        dim->stdw.count = priv->num_snap_heights + 1;      }      /* copy blue zones */      psh_blues_set_zones( &globals->blues, priv->num_blue_values,                           priv->blue_values, priv->num_other_blues,                           priv->other_blues, priv->blue_fuzz, 0 );      psh_blues_set_zones( &globals->blues, priv->num_family_blues,                           priv->family_blues, priv->num_family_other_blues,                           priv->family_other_blues, priv->blue_fuzz, 1 );      /* limit the BlueScale value to `1 / max_of_blue_zone_heights' */      {        FT_Fixed  max_scale;        FT_Short  max_height = 1;        max_height = psh_calc_max_height( priv->num_blue_values,                                          priv->blue_values,                                          max_height );        max_height = psh_calc_max_height( priv->num_other_blues,                                          priv->other_blues,                                          max_height );        max_height = psh_calc_max_height( priv->num_family_blues,                                          priv->family_blues,                                          max_height );        max_height = psh_calc_max_height( priv->num_family_other_blues,                                          priv->family_other_blues,                                          max_height );        /* BlueScale is scaled 1000 times */        max_scale = FT_DivFix( 1000, max_height );        globals->blues.blue_scale = priv->blue_scale < max_scale                                      ? priv->blue_scale                                      : max_scale;      }      globals->blues.blue_shift = priv->blue_shift;      globals->blues.blue_fuzz  = priv->blue_fuzz;      globals->dimension[0].scale_mult  = 0;      globals->dimension[0].scale_delta = 0;      globals->dimension[1].scale_mult  = 0;      globals->dimension[1].scale_delta = 0;#ifdef DEBUG_HINTER//.........这里部分代码省略.........
开发者ID:hsmith,项目名称:freetype,代码行数:101,


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


示例17: ft_metaclass_get_class

  static FT_Class  ft_metaclass_get_class( FT_MetaClass  meta,                          FT_Type       ctype )  {    FT_ClassHNodeRec   keynode, *node, **pnode;    FT_Memory          memory;    FT_ClassRec*       clazz;    FT_Class           parent;    FT_Error           error;    keynode.hnode.hash = FT_TYPE_HASH( ctype );    keynode.type       = ctype;    pnode = (FT_ClassHNode*) ft_hash_lookup( &meta->type_to_class,                                             (FT_HashNode) &keynode );    node  = *pnode;    if ( node != NULL )    {      clazz = (FT_ClassRec*) node->clazz;      goto Exit;    }    memory = FT_CLASS__MEMORY(meta);    clazz  = NULL;    parent = NULL;    if ( ctype->super != NULL )    {      FT_ASSERT( ctype->super->class_size <= ctype->class_size );      FT_ASSERT( ctype->super->obj_size   <= ctype->obj_size   );      parent = ft_metaclass_get_class( meta, ctype->super );    }    if ( !FT_NEW( node ) )    {      if ( !FT_ALLOC( clazz, ctype->class_size ) )      {        if ( parent )          FT_MEM_COPY( (FT_ClassRec*)clazz, parent, parent->type->class_size );        clazz->object.clazz     = (FT_Class) meta;        clazz->object.ref_count = 1;        clazz->memory  = memory;        clazz->library = FT_CLASS__LIBRARY(meta);        clazz->super   = parent;        clazz->type    = ctype;        clazz->info    = NULL;        clazz->magic   = FT_MAGIC_CLASS;        clazz->class_done = ctype->class_done;        clazz->obj_size   = ctype->obj_size;        clazz->obj_init   = ctype->obj_init;        clazz->obj_done   = ctype->obj_done;        if ( parent )        {          if ( clazz->class_done == NULL )            clazz->class_done = parent->class_done;          if ( clazz->obj_init == NULL )            clazz->obj_init = parent->obj_init;          if ( clazz->obj_done == NULL )            clazz->obj_done = parent->obj_done;        }        /* find class initializer, if any */        {          FT_Type             ztype = ctype;          FT_Object_InitFunc  cinit = NULL;          do          {            cinit = ztype->class_init;            if ( cinit != NULL )              break;            ztype = ztype->super;          }          while ( ztype != NULL );          /* then call it when needed */          if ( cinit != NULL )            error = cinit( (FT_Object) clazz, NULL );        }      }      if (error)      {        if ( clazz )        {          /* we always call the class destructor when    */          /* an error was detected in the constructor !! */          if ( clazz->class_done )            clazz->class_done( (FT_Object) clazz );          FT_FREE( clazz );        }        FT_FREE( node );//.........这里部分代码省略.........
开发者ID:1tgr,项目名称:mobius,代码行数:101,


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


示例19: psh_globals_new

  static FT_Error  psh_globals_new( FT_Memory     memory,                   T1_Private*   priv,                   PSH_Globals  *aglobals )  {    PSH_Globals  globals;    FT_Error     error;    if ( !FT_NEW( globals ) )    {      FT_UInt    count;      FT_Short*  read;      globals->memory = memory;      /* copy standard widths */      {        PSH_Dimension  dim   = &globals->dimension[1];        PSH_Width      write = dim->stdw.widths;        write->org = priv->standard_width[0];        write++;        read = priv->snap_widths;        for ( count = priv->num_snap_widths; count > 0; count-- )        {          write->org = *read;          write++;          read++;        }        dim->stdw.count = priv->num_snap_widths + 1;      }      /* copy standard heights */      {        PSH_Dimension  dim = &globals->dimension[0];        PSH_Width      write = dim->stdw.widths;        write->org = priv->standard_height[0];        write++;        read = priv->snap_heights;        for ( count = priv->num_snap_heights; count > 0; count-- )        {          write->org = *read;          write++;          read++;        }        dim->stdw.count = priv->num_snap_heights + 1;      }      /* copy blue zones */      psh_blues_set_zones( &globals->blues, priv->num_blue_values,                           priv->blue_values, priv->num_other_blues,                           priv->other_blues, priv->blue_fuzz, 0 );      psh_blues_set_zones( &globals->blues, priv->num_family_blues,                           priv->family_blues, priv->num_family_other_blues,                           priv->family_other_blues, priv->blue_fuzz, 1 );      globals->blues.blue_scale = priv->blue_scale;      globals->blues.blue_shift = priv->blue_shift;      globals->blues.blue_fuzz  = priv->blue_fuzz;      globals->dimension[0].scale_mult  = 0;      globals->dimension[0].scale_delta = 0;      globals->dimension[1].scale_mult  = 0;      globals->dimension[1].scale_delta = 0;#ifdef DEBUG_HINTER      ps_debug_globals = globals;#endif    }    *aglobals = globals;    return error;  }
开发者ID:gzwplato,项目名称:VersyPDF,代码行数:82,


示例20: T1_Read_Metrics

  T1_Read_Metrics( FT_Face    t1_face,                   FT_Stream  stream )  {    PSAux_Service  psaux;    FT_Memory      memory = stream->memory;    AFM_ParserRec  parser;    AFM_FontInfo   fi;    FT_Error       error = T1_Err_Unknown_File_Format;    T1_Font        t1_font = &( (T1_Face)t1_face )->type1;    if ( FT_NEW( fi ) )      return error;    if ( FT_FRAME_ENTER( stream->size ) )    {      FT_FREE( fi );      return error;    }    fi->FontBBox  = t1_font->font_bbox;    fi->Ascender  = t1_font->font_bbox.yMax;    fi->Descender = t1_font->font_bbox.yMin;    psaux = (PSAux_Service)( (T1_Face)t1_face )->psaux;    if ( psaux && psaux->afm_parser_funcs )    {      error = psaux->afm_parser_funcs->init( &parser,                                             stream->memory,                                             stream->cursor,                                             stream->limit );      if ( !error )      {        parser.FontInfo  = fi;        parser.get_index = t1_get_index;        parser.user_data = t1_font;        error = psaux->afm_parser_funcs->parse( &parser );        psaux->afm_parser_funcs->done( &parser );      }    }    if ( error == T1_Err_Unknown_File_Format )    {      FT_Byte*  start = stream->cursor;      if ( stream->size > 6                              &&           start[0] == 0x00 && start[1] == 0x01          &&           FT_PEEK_ULONG_LE( start + 2 ) == stream->size )        error = T1_Read_PFM( t1_face, stream, fi );    }    if ( !error )    {      t1_font->font_bbox = fi->FontBBox;      t1_face->bbox.xMin =   fi->FontBBox.xMin             >> 16;      t1_face->bbox.yMin =   fi->FontBBox.yMin             >> 16;      t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFFU ) >> 16;      t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFFU ) >> 16;      t1_face->ascender  = (FT_Short)( ( fi->Ascender  + 0x8000U ) >> 16 );      t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000U ) >> 16 );      if ( fi->NumKernPair )      {        t1_face->face_flags |= FT_FACE_FLAG_KERNING;        ( (T1_Face)t1_face )->afm_data = fi;      }    }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:72,


示例21: FNT_Face_Init

static FT_ErrorFNT_Face_Init( FT_Stream      stream,               FNT_Face       face,               FT_Int         face_index,               FT_Int         num_params,               FT_Parameter*  params ){    FT_Error   error;    FT_Memory  memory = FT_FACE_MEMORY( face );    FT_UNUSED( num_params );    FT_UNUSED( params );    /* try to load font from a DLL */    error = fnt_face_get_dll_font( face, face_index );    if ( error )    {        /* this didn't work; try to load a single FNT font */        FNT_Font  font;        if ( FT_NEW( face->font ) )            goto Exit;        face->root.num_faces = 1;        font           = face->font;        font->offset   = 0;        font->fnt_size = stream->size;        error = fnt_font_load( font, stream );        if ( error )            goto Fail;    }    /* we now need to fill the root FT_Face fields */    /* with relevant information                   */    {        FT_Face   root = FT_FACE( face );        FNT_Font  font = face->font;        root->face_flags = FT_FACE_FLAG_FIXED_SIZES |                           FT_FACE_FLAG_HORIZONTAL;        if ( font->header.avg_width == font->header.max_width )            root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;        if ( font->header.italic )            root->style_flags |= FT_STYLE_FLAG_ITALIC;        if ( font->header.weight >= 800 )            root->style_flags |= FT_STYLE_FLAG_BOLD;        /* set up the `fixed_sizes' array */        if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )            goto Fail;        root->num_fixed_sizes = 1;        {            FT_Bitmap_Size*  bsize = root->available_sizes;            bsize->width  = font->header.avg_width;            bsize->height =                font->header.pixel_height + font->header.external_leading;            bsize->size   = font->header.nominal_point_size << 6;            bsize->x_ppem =                (FT_Pos)( ( font->header.horizontal_resolution * bsize->size + 36 )                          / 72 );            bsize->y_ppem =                (FT_Pos)( ( font->header.vertical_resolution* bsize->size + 36 )                          / 72 );        }        {            FT_CharMapRec  charmap;            charmap.encoding    = FT_ENCODING_UNICODE;            charmap.platform_id = 3;            charmap.encoding_id = 1;            charmap.face        = root;            error = FT_CMap_New( fnt_cmap_class,                                 NULL,                                 &charmap,                                 NULL );            if ( error )                goto Fail;            /* Select default charmap */            if ( root->num_charmaps )                root->charmap = root->charmaps[0];        }        /* setup remaining flags *///.........这里部分代码省略.........
开发者ID:1tgr,项目名称:mobius,代码行数:101,


示例22: tt_face_load_colr

  tt_face_load_colr( TT_Face    face,                     FT_Stream  stream )  {    FT_Error   error;    FT_Memory  memory = face->root.memory;    FT_Byte*  table = NULL;    FT_Byte*  p     = NULL;    Colr*  colr = NULL;    FT_ULong  base_glyph_offset, layer_offset;    FT_ULong  table_size;    /* `COLR' always needs `CPAL' */    if ( !face->cpal )      return FT_THROW( Invalid_File_Format );    error = face->goto_table( face, TTAG_COLR, stream, &table_size );    if ( error )      goto NoColr;    if ( table_size < COLR_HEADER_SIZE )      goto InvalidTable;    if ( FT_FRAME_EXTRACT( table_size, table ) )      goto NoColr;    p = table;    if ( FT_NEW( colr ) )      goto NoColr;    colr->version = FT_NEXT_USHORT( p );    if ( colr->version != 0 )      goto InvalidTable;    colr->num_base_glyphs = FT_NEXT_USHORT( p );    base_glyph_offset     = FT_NEXT_ULONG( p );    if ( base_glyph_offset >= table_size )      goto InvalidTable;    if ( colr->num_base_glyphs * BASE_GLYPH_SIZE >           table_size - base_glyph_offset )      goto InvalidTable;    layer_offset     = FT_NEXT_ULONG( p );    colr->num_layers = FT_NEXT_USHORT( p );    if ( layer_offset >= table_size )      goto InvalidTable;    if ( colr->num_layers * LAYER_SIZE > table_size - layer_offset )      goto InvalidTable;    colr->base_glyphs = (FT_Byte*)( table + base_glyph_offset );    colr->layers      = (FT_Byte*)( table + layer_offset      );    colr->table       = table;    colr->table_size  = table_size;    face->colr = colr;    return FT_Err_Ok;  InvalidTable:    error = FT_THROW( Invalid_Table );  NoColr:    FT_FRAME_RELEASE( table );    FT_FREE( colr );    return error;  }
开发者ID:ImageMagick,项目名称:ttf,代码行数:73,


示例23: FT_New_Face_From_SFNT

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


示例24: pfr_extra_item_load_kerning_pairs

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


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


示例26: cff_face_init

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


示例27: cff_face_init

//.........这里部分代码省略.........      {        /* 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;    }    /* now load and parse the CFF table in the file */    {      CFF_Font         cff;      CFF_FontRecDict  dict;      FT_Memory        memory = cffface->memory;      FT_Int32         flags;      FT_UInt          i;      if ( FT_NEW( cff ) )        goto Exit;      face->extra.data = cff;      error = cff_font_load( stream, face_index, cff );      if ( error )        goto Exit;      cff->pshinter = pshinter;      cff->psnames  = (void*)psnames;      /* Complement the root flags with some interesting information. */      /* Note that this is only necessary for pure CFF and CEF fonts; */      /* SFNT based fonts use the `name' table instead.               */      cffface->num_glyphs = cff->num_glyphs;      dict = &cff->top_font.font_dict;      /* we need the `PSNames' module for CFF and CEF formats */      /* which aren't CID-keyed                               */      if ( dict->cid_registry == 0xFFFFU && !psnames )      {        FT_ERROR(( "cff_face_init:" ));        FT_ERROR(( " cannot open CFF & CEF fonts/n" ));        FT_ERROR(( "              " ));        FT_ERROR(( " without the `PSNames' module/n" ));        goto Bad_Format;      }      if ( pure_cff )      {        char*  style_name = NULL;
开发者ID:AVarfolomeev,项目名称:picasso-graphic,代码行数:67,


示例28: T1_Read_Metrics

  T1_Read_Metrics( FT_Face    t1_face,                   FT_Stream  stream )  {    PSAux_Service  psaux;    FT_Memory      memory  = stream->memory;    AFM_ParserRec  parser;    AFM_FontInfo   fi      = NULL;    FT_Error       error   = FT_ERR( Unknown_File_Format );    T1_Font        t1_font = &( (T1_Face)t1_face )->type1;    if ( FT_NEW( fi )                   ||         FT_FRAME_ENTER( stream->size ) )      goto Exit;    fi->FontBBox  = t1_font->font_bbox;    fi->Ascender  = t1_font->font_bbox.yMax;    fi->Descender = t1_font->font_bbox.yMin;    psaux = (PSAux_Service)( (T1_Face)t1_face )->psaux;    if ( psaux->afm_parser_funcs )    {      error = psaux->afm_parser_funcs->init( &parser,                                             stream->memory,                                             stream->cursor,                                             stream->limit );      if ( !error )      {        parser.FontInfo  = fi;        parser.get_index = t1_get_index;        parser.user_data = t1_font;        error = psaux->afm_parser_funcs->parse( &parser );        psaux->afm_parser_funcs->done( &parser );      }    }    if ( FT_ERR_EQ( error, Unknown_File_Format ) )    {      FT_Byte*  start = stream->cursor;      /* MS Windows allows versions up to 0x3FF without complaining */      if ( stream->size > 6                              &&           start[1] < 4                                  &&           FT_PEEK_ULONG_LE( start + 2 ) == stream->size )        error = T1_Read_PFM( t1_face, stream, fi );    }    if ( !error )    {      t1_font->font_bbox = fi->FontBBox;      t1_face->bbox.xMin =   fi->FontBBox.xMin            >> 16;      t1_face->bbox.yMin =   fi->FontBBox.yMin            >> 16;      /* no `U' suffix here to 0xFFFF! */      t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFF ) >> 16;      t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFF ) >> 16;      /* no `U' suffix here to 0x8000! */      t1_face->ascender  = (FT_Short)( ( fi->Ascender  + 0x8000 ) >> 16 );      t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 );      if ( fi->NumKernPair )      {        t1_face->face_flags |= FT_FACE_FLAG_KERNING;        ( (T1_Face)t1_face )->afm_data = fi;        fi = NULL;      }    }
开发者ID:dmdware,项目名称:vec,代码行数:71,


示例29: woff_open_font

  static FT_Error  woff_open_font( FT_Stream  stream,                  TT_Face    face )  {    FT_Memory       memory = stream->memory;    FT_Error        error  = FT_Err_Ok;    WOFF_HeaderRec  woff;    WOFF_Table      tables  = NULL;    WOFF_Table*     indices = NULL;    FT_ULong        woff_offset;    FT_Byte*        sfnt        = NULL;    FT_Stream       sfnt_stream = NULL;    FT_Byte*        sfnt_header;    FT_ULong        sfnt_offset;    FT_Int          nn;    FT_ULong        old_tag = 0;    static const FT_Frame_Field  woff_header_fields[] =    {#undef  FT_STRUCTURE#define FT_STRUCTURE  WOFF_HeaderRec      FT_FRAME_START( 44 ),        FT_FRAME_ULONG ( signature ),        FT_FRAME_ULONG ( flavor ),        FT_FRAME_ULONG ( length ),        FT_FRAME_USHORT( num_tables ),        FT_FRAME_USHORT( reserved ),        FT_FRAME_ULONG ( totalSfntSize ),        FT_FRAME_USHORT( majorVersion ),        FT_FRAME_USHORT( minorVersion ),        FT_FRAME_ULONG ( metaOffset ),        FT_FRAME_ULONG ( metaLength ),        FT_FRAME_ULONG ( metaOrigLength ),        FT_FRAME_ULONG ( privOffset ),        FT_FRAME_ULONG ( privLength ),      FT_FRAME_END    };    FT_ASSERT( stream == face->root.stream );    FT_ASSERT( FT_STREAM_POS() == 0 );    if ( FT_STREAM_READ_FIELDS( woff_header_fields, &woff ) )      return error;    /* Make sure we don't recurse back here or hit TTC code. */    if ( woff.flavor == TTAG_wOFF || woff.flavor == TTAG_ttcf )      return FT_THROW( Invalid_Table );    /* Miscellaneous checks. */    if ( woff.length != stream->size                              ||         woff.num_tables == 0                                     ||         44 + woff.num_tables * 20UL >= woff.length               ||         12 + woff.num_tables * 16UL >= woff.totalSfntSize        ||         ( woff.totalSfntSize & 3 ) != 0                          ||         ( woff.metaOffset == 0 && ( woff.metaLength != 0     ||                                     woff.metaOrigLength != 0 ) ) ||         ( woff.metaLength != 0 && woff.metaOrigLength == 0 )     ||         ( woff.privOffset == 0 && woff.privLength != 0 )         )      return FT_THROW( Invalid_Table );    if ( FT_ALLOC( sfnt, woff.totalSfntSize ) ||         FT_NEW( sfnt_stream )                )      goto Exit;    sfnt_header = sfnt;    /* 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.     *///.........这里部分代码省略.........
开发者ID:johndpope,项目名称:Medusa,代码行数:101,



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


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