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

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

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

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

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

示例1: ft_glyphslot_clear

  static void  ft_glyphslot_clear( FT_GlyphSlot  slot )  {    /* free bitmap if needed */    if ( slot->flags & FT_GLYPH_OWN_BITMAP )    {      FT_Memory  memory = FT_FACE_MEMORY( slot->face );      FT_FREE( slot->bitmap.buffer );      slot->flags &= ~FT_GLYPH_OWN_BITMAP;    }    /* clear all public fields in the glyph slot */    FT_ZERO( &slot->metrics );    FT_ZERO( &slot->outline );    FT_ZERO( &slot->bitmap );    slot->bitmap_left   = 0;    slot->bitmap_top    = 0;    slot->num_subglyphs = 0;    slot->subglyphs     = 0;    slot->control_data  = 0;    slot->control_len   = 0;    slot->other         = 0;    slot->format        = ft_glyph_format_none;    slot->linearHoriAdvance = 0;    slot->linearVertAdvance = 0;  }
开发者ID:dikerex,项目名称:theqvd,代码行数:30,


示例2: af_loader_init

  af_loader_init( AF_Loader      loader,                  AF_GlyphHints  hints )  {    FT_ZERO( loader );    loader->hints = hints;  }
开发者ID:ImageMagick,项目名称:ttf,代码行数:7,


示例3: cf2_getSeacComponent

  cf2_getSeacComponent( CFF_Decoder*  decoder,                        CF2_UInt      code,                        CF2_Buffer    buf )  {    CF2_Int   gid;    FT_Byte*  charstring;    FT_ULong  len;    FT_Error  error;    FT_ASSERT( decoder );    FT_ZERO( buf );    gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code );    if ( gid < 0 )      return FT_THROW( Invalid_Glyph_Format );    error = cff_get_glyph_data( decoder->builder.face,                                gid,                                &charstring,                                &len );    /* TODO: for now, just pass the FreeType error through */    if ( error )      return error;    /* assume input has been validated */    FT_ASSERT( charstring + len >= charstring );    buf->start = charstring;    buf->end   = charstring + len;    buf->ptr   = buf->start;    return FT_Err_Ok;  }
开发者ID:100GPing100,项目名称:Lamby2D,代码行数:35,


示例4: tt_glyphzone_new

  tt_glyphzone_new( FT_Memory     memory,                    FT_UShort     maxPoints,                    FT_Short      maxContours,                    TT_GlyphZone  zone )  {    FT_Error  error;    FT_ZERO( zone );    zone->memory = memory;    if ( FT_NEW_ARRAY( zone->org,      maxPoints   ) ||         FT_NEW_ARRAY( zone->cur,      maxPoints   ) ||         FT_NEW_ARRAY( zone->orus,     maxPoints   ) ||         FT_NEW_ARRAY( zone->tags,     maxPoints   ) ||         FT_NEW_ARRAY( zone->contours, maxContours ) )    {      tt_glyphzone_done( zone );    }    else    {      zone->max_points   = maxPoints;      zone->max_contours = maxContours;    }    return error;  }
开发者ID:CCExtractor,项目名称:ccextractor,代码行数:27,


示例5: cf2_hintmask_init

  cf2_hintmask_init( CF2_HintMask  hintmask,                     FT_Error*     error )  {    FT_ZERO( hintmask );    hintmask->error = error;  }
开发者ID:1nt3g3r,项目名称:libgdx,代码行数:7,


示例6: main

  int main( int    argc,            char** argv )  {    FT_Library       library;    FT_StreamRec     stream;    FT_Error         error = FT_Err_Ok;    AFM_FontInfoRec  fi;    if ( argc < 2 )      return FT_ERR( Invalid_Argument );    error = FT_Init_FreeType( &library );    if ( error )      return error;    FT_ZERO( &stream );    error = FT_Stream_Open( &stream, argv[1] );    if ( error )      goto Exit;    stream.memory = library->memory;    FT_ZERO( &fi );    error = parse_afm( library, &stream, &fi );    if ( !error )    {      FT_Memory  memory = library->memory;      dump_fontinfo( &fi );      if ( fi.KernPairs )        FT_FREE( fi.KernPairs );      if ( fi.TrackKerns )        FT_FREE( fi.TrackKerns );    }    else      printf( "parse error/n" );    FT_Stream_Close( &stream );  Exit:    FT_Done_FreeType( library );    return error;  }
开发者ID:litao1009,项目名称:SimpleRoom,代码行数:47,


示例7: af_loader_init

  af_loader_init( AF_Loader  loader,                  FT_Memory  memory )  {    FT_ZERO( loader );    af_glyph_hints_init( &loader->hints, memory );    return FT_GlyphLoader_New( memory, &loader->gloader );  }
开发者ID:OpenXIP,项目名称:xip-libraries,代码行数:9,


示例8: af_loader_init

  af_loader_init( AF_Loader      loader,                  AF_GlyphHints  hints )  {    FT_ZERO( loader );    loader->hints = hints;#ifdef FT_DEBUG_AUTOFIT    _af_debug_hints = loader->hints;#endif  }
开发者ID:Clever-Boy,项目名称:XLE,代码行数:10,


示例9: pfr_glyph_init

  pfr_glyph_init( PFR_Glyph       glyph,                  FT_GlyphLoader  loader )  {    FT_ZERO( glyph );    glyph->loader     = loader;    glyph->path_begun = 0;    FT_GlyphLoader_Rewind( loader );  }
开发者ID:Angeldude,项目名称:MuseScore,代码行数:10,


示例10: af_loader_init

  af_loader_init( AF_Loader  loader,                  FT_Memory  memory )  {    FT_ZERO( loader );    af_glyph_hints_init( &loader->hints, memory );#ifdef FT_DEBUG_AUTOFIT    _af_debug_hints = &loader->hints;#endif    return FT_GlyphLoader_New( memory, &loader->gloader );  }
开发者ID:Sonophoto,项目名称:Soar-SC,代码行数:11,


示例11: af_loader_load_glyph

  af_loader_load_glyph( AF_Loader  loader,                        FT_Face    face,                        FT_UInt    gindex,                        FT_UInt32  load_flags )  {    FT_Error      error;    FT_Size       size = face->size;    AF_ScalerRec  scaler;    if ( !size )      return AF_Err_Invalid_Argument;    FT_ZERO( &scaler );    scaler.face    = face;    scaler.x_scale = size->metrics.x_scale;    scaler.x_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */    scaler.y_scale = size->metrics.y_scale;    scaler.y_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */    scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );    scaler.flags       = 0;  /* XXX: fix this */    error = af_loader_reset( loader, face );    if ( !error )    {      AF_ScriptMetrics  metrics;      error = af_face_globals_get_metrics( loader->globals, gindex,                                           &metrics );      if ( !error )      {        loader->metrics = metrics;        if ( metrics->clazz->script_metrics_scale )          metrics->clazz->script_metrics_scale( metrics, &scaler );        else          metrics->scaler = scaler;        load_flags |=  FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;        load_flags &= ~FT_LOAD_RENDER;        error = metrics->clazz->script_hints_init( &loader->hints, metrics );        if ( error )          goto Exit;        error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 );      }    }  Exit:    return error;  }
开发者ID:allanw1,项目名称:Arianrhod,代码行数:54,


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


示例13: t42_glyphslot_clear

  static void  t42_glyphslot_clear( FT_GlyphSlot  slot )  {    /* free bitmap if needed */    ft_glyphslot_free_bitmap( slot );    /* clear all public fields in the glyph slot */    FT_ZERO( &slot->metrics );    FT_ZERO( &slot->outline );    FT_ZERO( &slot->bitmap );    slot->bitmap_left   = 0;    slot->bitmap_top    = 0;    slot->num_subglyphs = 0;    slot->subglyphs     = 0;    slot->control_data  = 0;    slot->control_len   = 0;    slot->other         = 0;    slot->format        = FT_GLYPH_FORMAT_NONE;    slot->linearHoriAdvance = 0;    slot->linearVertAdvance = 0;  }
开发者ID:0uyangsheng,项目名称:xbmc,代码行数:23,


示例14: af_loader_init

  af_loader_init( AF_Module  module )  {    AF_Loader  loader = module->loader;    FT_Memory  memory = module->root.library->memory;    FT_ZERO( loader );    af_glyph_hints_init( &loader->hints, memory );#ifdef FT_DEBUG_AUTOFIT    _af_debug_hints = &loader->hints;#endif    return FT_GlyphLoader_New( memory, &loader->gloader );  }
开发者ID:2or3,项目名称:PlaygroundOSS,代码行数:14,


示例15: FT_Stream_OpenBzip2

  FT_Stream_OpenBzip2( FT_Stream  stream,                       FT_Stream  source )  {    FT_Error      error;    FT_Memory     memory;    FT_BZip2File  zip = NULL;    if ( !stream || !source )    {      error = FT_THROW( Invalid_Stream_Handle );      goto Exit;    }    memory = source->memory;    /*     *  check the header right now; this prevents allocating unnecessary     *  objects when we don't need them     */    error = ft_bzip2_check_header( source );    if ( error )      goto Exit;    FT_ZERO( stream );    stream->memory = memory;    if ( !FT_QNEW( zip ) )    {      error = ft_bzip2_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_bzip2_stream_io;    stream->close = ft_bzip2_stream_close;  Exit:    return error;  }
开发者ID:RSATom,项目名称:Qt,代码行数:48,


示例16: cf2_initLocalRegionBuffer

  cf2_initLocalRegionBuffer( CFF_Decoder*  decoder,                             CF2_UInt      idx,                             CF2_Buffer    buf )  {    FT_ASSERT( decoder && ( decoder->locals || decoder->num_locals == 0 ) );    FT_ZERO( buf );    idx += decoder->locals_bias;    if ( idx >= decoder->num_locals )      return TRUE;     /* error */    buf->start =    buf->ptr   = decoder->locals[idx];    buf->end   = decoder->locals[idx + 1];    return FALSE;      /* success */  }
开发者ID:PrinttingGroup,项目名称:SumatraPDF_SpecialPrint,代码行数:18,


示例17: af_loader_init

  af_loader_init( AF_Loader  loader,                  FT_Memory  memory )  {    FT_Error  error;    FT_ZERO( loader );    af_glyph_hints_init( &loader->hints, memory );    error = FT_GlyphLoader_New( memory, &loader->gloader );    if ( !error )    {      error = FT_GlyphLoader_CreateExtra( loader->gloader );      if ( error )      {        FT_GlyphLoader_Done( loader->gloader );        loader->gloader = NULL;      }    }    return error;  }
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:21,


示例18: ft_mem_table_new

  static FT_MemTable  ft_mem_table_new( FT_Memory  memory )  {    FT_MemTable  table;    table = (FT_MemTable)memory->alloc( memory, sizeof ( *table ) );    if ( !table )      goto Exit;    FT_ZERO( table );    table->size  = FT_MEM_SIZE_MIN;    table->nodes = 0;    table->memory = memory;    table->memory_user = memory->user;    table->alloc   = memory->alloc;    table->realloc = memory->realloc;    table->free    = memory->free;    table->buckets = (FT_MemNode *)                       memory->alloc(                         memory,                         table->size * (FT_Long)sizeof ( FT_MemNode ) );    if ( table->buckets )      FT_ARRAY_ZERO( table->buckets, table->size );    else    {      memory->free( memory, table );      table = NULL;    }  Exit:    return table;  }
开发者ID:93i,项目名称:godot,代码行数:38,


示例19: cff_font_load

  cff_font_load( 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;    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_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( &font->string_index,                                       stream, 0 ) )              ||         FT_SET_ERROR( cff_index_init( &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;    if ( FT_STREAM_SEEK( base_offset + dict->charstrings_offset ) )      goto Exit;    error = cff_index_init( &font->charstrings_index, stream, 0 );    if ( error )      goto Exit;    /* now, check for a CID font */    if ( dict->cid_registry != 0xFFFFU )    {      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 ) )//.........这里部分代码省略.........
开发者ID:Ali-il,项目名称:gamekit,代码行数:101,


示例20: tt_face_load_bdf_props

  static FT_Error  tt_face_load_bdf_props( TT_Face    face,                          FT_Stream  stream )  {    TT_BDF    bdf = &face->bdf;    FT_ULong  length;    FT_Error  error;    FT_ZERO( bdf );    error = tt_face_goto_table( face, TTAG_BDF, stream, &length );    if ( error                                  ||         length < 8                             ||         FT_FRAME_EXTRACT( length, bdf->table ) )    {      error = FT_THROW( Invalid_Table );      goto Exit;    }    bdf->table_end = bdf->table + length;    {      FT_Byte*   p           = bdf->table;      FT_UInt    version     = FT_NEXT_USHORT( p );      FT_UInt    num_strikes = FT_NEXT_USHORT( p );      FT_ULong   strings     = FT_NEXT_ULONG ( p );      FT_UInt    count;      FT_Byte*   strike;      if ( version != 0x0001                 ||           strings < 8                       ||           ( strings - 8 ) / 4 < num_strikes ||           strings + 1 > length              )      {        goto BadTable;      }      bdf->num_strikes  = num_strikes;      bdf->strings      = bdf->table + strings;      bdf->strings_size = length - strings;      count  = bdf->num_strikes;      p      = bdf->table + 8;      strike = p + count * 4;      for ( ; count > 0; count-- )      {        FT_UInt  num_items = FT_PEEK_USHORT( p + 2 );        /*         *  We don't need to check the value sets themselves, since this         *  is done later.         */        strike += 10 * num_items;        p += 4;      }      if ( strike > bdf->strings )        goto BadTable;    }    bdf->loaded = 1;  Exit:    return error;  BadTable:    FT_FRAME_RELEASE( bdf->table );    FT_ZERO( bdf );    error = FT_THROW( Invalid_Table );    goto Exit;  }
开发者ID:erdincay,项目名称:vcxsrv-linux2windows,代码行数:76,


示例21: FT_Stream_OpenGzip

FT_Stream_OpenGzip( FT_Stream  stream,                    FT_Stream  source ){    FT_Error     error;    FT_Memory    memory = source->memory;    FT_GZipFile  zip;    /*     *  check the header right now; this prevents allocating un-necessary     *  objects when we don't need them     */    error = ft_gzip_check_header( source );    if ( error )        goto Exit;    FT_ZERO( stream );    stream->memory = memory;    if ( !FT_QNEW( zip ) )    {        error = ft_gzip_file_init( zip, stream, source );        if ( error )        {            FT_FREE( zip );            goto Exit;        }        stream->descriptor.pointer = zip;    }    /*     *  We use the following trick to try to dramatically improve the     *  performance while dealing with small files.  If the original stream     *  size is less than a certain threshold, we try to load the whole font     *  file into memory.  This saves us from using the 32KB buffer needed     *  to inflate the file, plus the two 4KB intermediate input/output     *  buffers used in the `FT_GZipFile' structure.     */    {        FT_ULong  zip_size = ft_gzip_get_uncompressed_size( source );        if ( zip_size != 0 && zip_size < 40 * 1024 )        {            FT_Byte*  zip_buff;            if ( !FT_ALLOC( zip_buff, zip_size ) )            {                FT_ULong  count;                count = ft_gzip_file_io( zip, 0, zip_buff, zip_size );                if ( count == zip_size )                {                    ft_gzip_file_done( zip );                    FT_FREE( zip );                    stream->descriptor.pointer = NULL;                    stream->size  = zip_size;                    stream->pos   = 0;                    stream->base  = zip_buff;                    stream->read  = NULL;                    stream->close = ft_gzip_stream_close;                    goto Exit;                }                ft_gzip_file_io( zip, 0, NULL, 0 );                FT_FREE( zip_buff );            }            error = 0;        }    }    stream->size  = 0x7FFFFFFFL;  /* don't know the real size! */    stream->pos   = 0;    stream->base  = 0;    stream->read  = ft_gzip_stream_io;    stream->close = ft_gzip_stream_close;Exit:    return error;}
开发者ID:bowlofstew,项目名称:Aquaria,代码行数:86,


示例22: ah_outline_compute_segments

//.........这里部分代码省略.........              /* compute segment size */              min_pos = max_pos = point->v;              v = segment->first->v;              if ( v < min_pos )                min_pos = v;              if ( v > max_pos )                max_pos = v;              segment->min_coord = min_pos;              segment->max_coord = max_pos;              on_edge = 0;              num_segments++;              segment++;              /* fallthrough */            }          }          /* now exit if we are at the start/end point */          if ( point == last )          {            if ( passed )              break;            passed = 1;          }          if ( !on_edge && ABS( point->out_dir ) == major_dir )          {            /* this is the start of a new segment! */            segment_dir = point->out_dir;            /* clear all segment fields */            FT_ZERO( segment );            segment->dir      = segment_dir;            segment->flags    = AH_EDGE_NORMAL;            min_pos = max_pos = point->u;            segment->first    = point;            segment->last     = point;            segment->contour  = contour;            on_edge           = 1;#ifdef AH_HINT_METRICS            if ( point == max_point )              max_point = 0;            if ( point == min_point )              min_point = 0;#endif          }          point = point->next;        }      } /* contours */#ifdef AH_HINT_METRICS      /* we need to ensure that there are edges on the left-most and  */      /* right-most points of the glyph in order to hint the metrics; */      /* we do this by inserting fake segments when needed            */      if ( dimension == 0 )      {        AH_Point  point       =  outline->points;        AH_Point  point_limit =  point + outline->num_points;
开发者ID:AudriusButkevicius,项目名称:TurboVNC,代码行数:66,


示例23: af_loader_load_glyph

  af_loader_load_glyph( AF_Loader  loader,                        AF_Module  module,                        FT_Face    face,                        FT_UInt    gindex,                        FT_Int32   load_flags )  {    FT_Error      error;    FT_Size       size   = face->size;    AF_ScalerRec  scaler;    if ( !size )      return FT_THROW( Invalid_Size_Handle );    FT_ZERO( &scaler );    scaler.face    = face;    scaler.x_scale = size->metrics.x_scale;    scaler.x_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */    scaler.y_scale = size->metrics.y_scale;    scaler.y_delta = 0;  /* XXX: TODO: add support for sub-pixel hinting */    scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );    scaler.flags       = 0;  /* XXX: fix this */    error = af_loader_reset( loader, module, face );    if ( !error )    {      AF_StyleMetrics  metrics;      FT_UInt          options = AF_STYLE_NONE_DFLT;#ifdef FT_OPTION_AUTOFIT2      /* XXX: undocumented hook to activate the latin2 writing system */      if ( load_flags & ( 1UL << 20 ) )        options = AF_STYLE_LTN2_DFLT;#endif      error = af_face_globals_get_metrics( loader->globals, gindex,                                           options, &metrics );      if ( !error )      {#ifdef FT_CONFIG_OPTION_PIC        AF_FaceGlobals         globals = loader->globals;#endif        AF_StyleClass          style_class = metrics->style_class;        AF_WritingSystemClass  writing_system_class =          AF_WRITING_SYSTEM_CLASSES_GET[style_class->writing_system];        loader->metrics = metrics;        if ( writing_system_class->style_metrics_scale )          writing_system_class->style_metrics_scale( metrics, &scaler );        else          metrics->scaler = scaler;        load_flags |=  FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;        load_flags &= ~FT_LOAD_RENDER;        if ( writing_system_class->style_hints_init )        {          error = writing_system_class->style_hints_init( loader->hints,                                                          metrics );          if ( error )            goto Exit;        }        error = af_loader_load_g( loader, &scaler, gindex, load_flags );      }    }  Exit:    return error;  }
开发者ID:hsmith,项目名称:freetype,代码行数:74,


示例24: cf2_decoder_parse_charstrings

  cf2_decoder_parse_charstrings( CFF_Decoder*  decoder,                                 FT_Byte*      charstring_base,                                 FT_ULong      charstring_len )  {    FT_Memory  memory;    FT_Error   error = FT_Err_Ok;    CF2_Font   font;    FT_ASSERT( decoder && decoder->cff );    memory = decoder->builder.memory;    /* CF2 data is saved here across glyphs */    font = (CF2_Font)decoder->cff->cf2_instance.data;    /* on first glyph, allocate instance structure */    if ( decoder->cff->cf2_instance.data == NULL )    {      decoder->cff->cf2_instance.finalizer =        (FT_Generic_Finalizer)cf2_free_instance;      if ( FT_ALLOC( decoder->cff->cf2_instance.data,                     sizeof ( CF2_FontRec ) ) )        return FT_THROW( Out_Of_Memory );      font = (CF2_Font)decoder->cff->cf2_instance.data;      font->memory = memory;      /* initialize a client outline, to be shared by each glyph rendered */      cf2_outline_init( &font->outline, font->memory, &font->error );    }    /* save decoder; it is a stack variable and will be different on each */    /* call                                                               */    font->decoder         = decoder;    font->outline.decoder = decoder;    {      /* build parameters for Adobe engine */      CFF_Builder*  builder = &decoder->builder;      CFF_Driver    driver  = (CFF_Driver)FT_FACE_DRIVER( builder->face );      /* local error */      FT_Error       error2 = FT_Err_Ok;      CF2_BufferRec  buf;      CF2_Matrix     transform;      CF2_F16Dot16   glyphWidth;      FT_Bool  hinted;      FT_Bool  scaled;      /* FreeType has already looked up the GID; convert to         */      /* `RegionBuffer', assuming that the input has been validated */      FT_ASSERT( charstring_base + charstring_len >= charstring_base );      FT_ZERO( &buf );      buf.start =      buf.ptr   = charstring_base;      buf.end   = charstring_base + charstring_len;      FT_ZERO( &transform );      cf2_getScaleAndHintFlag( decoder,                               &transform.a,                               &transform.d,                               &hinted,                               &scaled );      font->renderingFlags = 0;      if ( hinted )        font->renderingFlags |= CF2_FlagsHinted;      if ( scaled && !driver->no_stem_darkening )        font->renderingFlags |= CF2_FlagsDarkened;      font->darkenParams[0] = driver->darken_params[0];      font->darkenParams[1] = driver->darken_params[1];      font->darkenParams[2] = driver->darken_params[2];      font->darkenParams[3] = driver->darken_params[3];      font->darkenParams[4] = driver->darken_params[4];      font->darkenParams[5] = driver->darken_params[5];      font->darkenParams[6] = driver->darken_params[6];      font->darkenParams[7] = driver->darken_params[7];      /* now get an outline for this glyph;      */      /* also get units per em to validate scale */      font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder );      if ( scaled )      {        error2 = cf2_checkTransform( &transform, font->unitsPerEm );        if ( error2 )          return error2;      }      error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth );      if ( error2 )//.........这里部分代码省略.........
开发者ID:100GPing100,项目名称:Lamby2D,代码行数:101,


示例25: af_cjk_hints_compute_edges

//.........这里部分代码省略.........              link1 = seg1->link;              if ( link1 )              {                dist2 = AF_SEGMENT_DIST( link, link1 );                if ( dist2 >= edge_distance_threshold )                  break;              }            } while ( ( seg1 = seg1->edge_next ) != edge->first );            if ( dist2 >= edge_distance_threshold )              continue;          }          best  = dist;          found = edge;        }      }      if ( !found )      {        AF_Edge  edge;        /* insert a new edge in the list and */        /* sort according to the position    */        error = af_axis_hints_new_edge( axis, seg->pos,                                        (AF_Direction)seg->dir,                                        memory, &edge );        if ( error )          goto Exit;        /* add the segment to the new edge's list */        FT_ZERO( edge );        edge->first    = seg;        edge->last     = seg;        edge->fpos     = seg->pos;        edge->opos     = edge->pos = FT_MulFix( seg->pos, scale );        seg->edge_next = seg;        edge->dir      = seg->dir;      }      else      {        /* if an edge was found, simply add the segment to the edge's */        /* list                                                       */        seg->edge_next         = found->first;        found->last->edge_next = seg;        found->last            = seg;      }    }    /*********************************************************************/    /*                                                                   */    /* Good, we now compute each edge's properties according to segments */    /* found on its position.  Basically, these are as follows.          */    /*                                                                   */    /*  - edge's main direction                                          */    /*  - stem edge, serif edge or both (which defaults to stem then)    */    /*  - rounded edge, straight or both (which defaults to straight)    */    /*  - link for edge                                                  */    /*                                                                   */    /*********************************************************************/    /* first of all, set the `edge' field in each segment -- this is     */    /* required in order to compute edge links                           */
开发者ID:Chingliu,项目名称:EAWebkit,代码行数:67,


示例26: af_loader_load_glyph

  af_loader_load_glyph( AF_Loader  loader,                        AF_Module  module,                        FT_Face    face,                        FT_UInt    glyph_index,                        FT_Int32   load_flags )  {    FT_Error  error;    FT_Size           size          = face->size;    FT_Size_Internal  size_internal = size->internal;    FT_GlyphSlot      slot          = face->glyph;    FT_Slot_Internal  slot_internal = slot->internal;    FT_GlyphLoader    gloader       = slot_internal->loader;    AF_GlyphHints          hints         = loader->hints;    AF_ScalerRec           scaler;    AF_StyleMetrics        style_metrics;    FT_UInt                style_options = AF_STYLE_NONE_DFLT;    AF_StyleClass          style_class;    AF_WritingSystemClass  writing_system_class;    if ( !size )      return FT_THROW( Invalid_Size_Handle );    FT_ZERO( &scaler );    if ( !size_internal->autohint_metrics.x_scale                          ||         size_internal->autohint_mode != FT_LOAD_TARGET_MODE( load_flags ) )    {      /* switching between hinting modes usually means different scaling */      /* values; this later on enforces recomputation of everything      */      /* related to the current size                                     */      size_internal->autohint_mode    = FT_LOAD_TARGET_MODE( load_flags );      size_internal->autohint_metrics = size->metrics;#ifdef AF_CONFIG_OPTION_TT_SIZE_METRICS      {        FT_Size_Metrics*  size_metrics = &size_internal->autohint_metrics;        /* set metrics to integer values and adjust scaling accordingly; */        /* this is the same setup as with TrueType fonts, cf. function   */        /* `tt_size_reset' in file `ttobjs.c'                            */        size_metrics->ascender  = FT_PIX_ROUND(                                    FT_MulFix( face->ascender,                                               size_metrics->y_scale ) );        size_metrics->descender = FT_PIX_ROUND(                                    FT_MulFix( face->descender,                                               size_metrics->y_scale ) );        size_metrics->height    = FT_PIX_ROUND(                                    FT_MulFix( face->height,                                               size_metrics->y_scale ) );        size_metrics->x_scale     = FT_DivFix( size_metrics->x_ppem << 6,                                               face->units_per_EM );        size_metrics->y_scale     = FT_DivFix( size_metrics->y_ppem << 6,                                               face->units_per_EM );        size_metrics->max_advance = FT_PIX_ROUND(                                      FT_MulFix( face->max_advance_width,                                                 size_metrics->x_scale ) );      }#endif /* AF_CONFIG_OPTION_TT_SIZE_METRICS */    }    /*     * TODO: This code currently doesn't support fractional advance widths,     * i.e., placing hinted glyphs at anything other than integer     * x-positions.  This is only relevant for the warper code, which     * scales and shifts glyphs to optimize blackness of stems (hinting on     * the x-axis by nature places things on pixel integers, hinting on the     * y-axis only, i.e., LIGHT mode, doesn't touch the x-axis).  The delta     * values of the scaler would need to be adjusted.     */    scaler.face    = face;    scaler.x_scale = size_internal->autohint_metrics.x_scale;    scaler.x_delta = 0;    scaler.y_scale = size_internal->autohint_metrics.y_scale;    scaler.y_delta = 0;    scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );    scaler.flags       = 0;    /* note that the fallback style can't be changed anymore */    /* after the first call of `af_loader_load_glyph'        */    error = af_loader_reset( loader, module, face );    if ( error )      goto Exit;#ifdef FT_OPTION_AUTOFIT2    /* XXX: undocumented hook to activate the latin2 writing system. */    if ( load_flags & ( 1UL << 20 ) )      style_options = AF_STYLE_LTN2_DFLT;#endif    /*     * Glyphs (really code points) are assigned to scripts.  Script     * analysis is done lazily: For each glyph that passes through here,     * the corresponding script analyzer is called, but returns immediately//.........这里部分代码省略.........
开发者ID:ImageMagick,项目名称:ttf,代码行数:101,


示例27: af_loader_load_glyph

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


示例28: cf2_blues_init

  cf2_blues_init( CF2_Blues  blues,                  CF2_Font   font )  {    /* pointer to parsed font object */    CFF_Decoder*  decoder = font->decoder;    CF2_Fixed  zoneHeight;    CF2_Fixed  maxZoneHeight = 0;    CF2_Fixed  csUnitsPerPixel;    size_t  numBlueValues;    size_t  numOtherBlues;    size_t  numFamilyBlues;    size_t  numFamilyOtherBlues;    FT_Pos*  blueValues;    FT_Pos*  otherBlues;    FT_Pos*  familyBlues;    FT_Pos*  familyOtherBlues;    size_t     i;    CF2_Fixed  emBoxBottom, emBoxTop;    CF2_Int  unitsPerEm = font->unitsPerEm;    if ( unitsPerEm == 0 )      unitsPerEm = 1000;    FT_ZERO( blues );    blues->scale = font->innerTransform.d;    cf2_getBlueMetrics( decoder,                        &blues->blueScale,                        &blues->blueShift,                        &blues->blueFuzz );    cf2_getBlueValues( decoder, &numBlueValues, &blueValues );    cf2_getOtherBlues( decoder, &numOtherBlues, &otherBlues );    cf2_getFamilyBlues( decoder, &numFamilyBlues, &familyBlues );    cf2_getFamilyOtherBlues( decoder, &numFamilyOtherBlues, &familyOtherBlues );    /*     * synthetic em box hint heuristic     *     * Apply this when ideographic dictionary (LanguageGroup 1) has no     * real alignment zones.  Adobe tools generate dummy zones at -250 and     * 1100 for a 1000 unit em.  Fonts with ICF-based alignment zones     * should not enable the heuristic.  When the heuristic is enabled,     * the font's blue zones are ignored.     *     */    /* get em box from OS/2 typoAscender/Descender                      */    /* TODO: FreeType does not parse these metrics.  Skip them for now. */#if 0    FCM_getHorizontalLineMetrics( &e,                                  font->font,                                  &ascender,                                  &descender,                                  &linegap );    if ( ascender - descender == unitsPerEm )    {      emBoxBottom = cf2_intToFixed( descender );      emBoxTop    = cf2_intToFixed( ascender );    }    else#endif    {      emBoxBottom = CF2_ICF_Bottom;      emBoxTop    = CF2_ICF_Top;    }    if ( cf2_getLanguageGroup( decoder ) == 1                   &&         ( numBlueValues == 0                                 ||           ( numBlueValues == 4                             &&             cf2_blueToFixed( blueValues[0] ) < emBoxBottom &&             cf2_blueToFixed( blueValues[1] ) < emBoxBottom &&             cf2_blueToFixed( blueValues[2] ) > emBoxTop    &&             cf2_blueToFixed( blueValues[3] ) > emBoxTop    ) ) )    {      /*       * Construct hint edges suitable for synthetic ghost hints at top       * and bottom of em box.  +-CF2_MIN_COUNTER allows for unhinted       * features above or below the last hinted edge.  This also gives a       * net 1 pixel boost to the height of ideographic glyphs.       *       * Note: Adjust synthetic hints outward by epsilon (0x.0001) to       *       avoid interference.  E.g., some fonts have real hints at       *       880 and -120.       */      blues->emBoxBottomEdge.csCoord = emBoxBottom - CF2_FIXED_EPSILON;      blues->emBoxBottomEdge.dsCoord = cf2_fixedRound(                                         FT_MulFix(                                           blues->emBoxBottomEdge.csCoord,                                           blues->scale ) ) -                                       CF2_MIN_COUNTER;      blues->emBoxBottomEdge.scale   = blues->scale;      blues->emBoxBottomEdge.flags   = CF2_GhostBottom |//.........这里部分代码省略.........
开发者ID:DjinCN,项目名称:libFreeType2,代码行数:101,



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


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