• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FT_NEW函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了FT_NEW函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:ftmac.c


示例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,代码来源:ftccmap.c


示例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,代码来源:afmparse.c


示例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,代码来源:cf2stack.c


示例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,代码来源:ftcimage.c


示例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,代码来源:ftcmanag.c


示例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,代码来源:ftcsbits.c


示例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,代码来源:ftlzw.c


示例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,代码来源:ftgloadr.c


示例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,代码来源:ahglyph.c


示例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,代码来源:cffobjs.c


示例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,代码来源:cf2stack.c


示例13: 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),
        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,代码来源:sfobjs.c


示例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,代码来源:ftcmanag.c


示例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,代码来源:pshglob.c


示例16: fnt_face_get_dll_font

static FT_Error
fnt_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,代码来源:winfnt.c


示例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,代码来源:ftobject.c


示例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,代码来源:cffobjs.c


示例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,代码来源:pshglob.c


示例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,代码来源:t1afm.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FT_NEW_ARRAY函数代码示例发布时间:2022-05-30
下一篇:
C++ FT_MulFix函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap