⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftcsbits.c

📁 下载来的一个看图软件的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
        /* add the size of a given glyph image */        size += pitch * sbit->height;      }    }    return size;  }  FT_CALLBACK_DEF( FT_Bool )  ftc_sbit_node_compare( FTC_SBitNode   snode,                         FTC_SBitQuery  squery,                         FTC_Cache      cache )  {    FTC_GlyphQuery  gquery = FTC_GLYPH_QUERY( squery );    FTC_GlyphNode   gnode  = FTC_GLYPH_NODE( snode );    FT_Bool         result;    result = ftc_glyph_node_compare( gnode, gquery );    if ( result )    {      /* check if we need to load the glyph bitmap now */      FT_UInt   gindex = gquery->gindex;      FTC_SBit  sbit   = snode->sbits + ( gindex - gnode->item_start );      if ( sbit->buffer == NULL && sbit->width != 255 )      {        FT_ULong  size;        if ( !ftc_sbit_node_load(                snode, cache->manager,                FTC_SBIT_FAMILY( FTC_QUERY( squery )->family ),                gindex, &size ) )          cache->manager->cur_weight += size;      }    }    return result;  }  /*************************************************************************/  /*************************************************************************/  /*****                                                               *****/  /*****                     SBITS FAMILIES                            *****/  /*****                                                               *****/  /*************************************************************************/  /*************************************************************************/  FT_CALLBACK_DEF( FT_Error )  ftc_sbit_family_init( FTC_SBitFamily  sfam,                        FTC_SBitQuery   squery,                        FTC_Cache       cache )  {    FTC_Manager  manager = cache->manager;    FT_Error     error;    FT_Face      face;    sfam->type = squery->type;    /* we need to compute "cquery.item_total" now */    error = FTC_Manager_Lookup_Face( manager,                                     squery->type.font.face_id,                                     &face );    if ( !error )    {      error = ftc_glyph_family_init( FTC_GLYPH_FAMILY( sfam ),                                     FTC_IMAGE_TYPE_HASH( &sfam->type ),                                     FTC_SBIT_ITEMS_PER_NODE,                                     face->num_glyphs,                                     FTC_GLYPH_QUERY( squery ),                                     cache );    }    return error;  }  FT_CALLBACK_DEF( FT_Bool )  ftc_sbit_family_compare( FTC_SBitFamily  sfam,                           FTC_SBitQuery   squery )  {    FT_Bool  result;    /* we need to set the "cquery.cset" field or our query for */    /* faster glyph comparisons in ftc_sbit_node_compare       */    /*                                                         */    result = FT_BOOL( FTC_IMAGE_TYPE_COMPARE( &sfam->type, &squery->type ) );    if ( result )      FTC_GLYPH_FAMILY_FOUND( sfam, squery );    return result;  }  /*************************************************************************/  /*************************************************************************/  /*****                                                               *****/  /*****                     SBITS CACHE                               *****/  /*****                                                               *****/  /*************************************************************************/  /*************************************************************************/  FT_CALLBACK_TABLE_DEF  const FTC_Cache_ClassRec  ftc_sbit_cache_class =  {    sizeof ( FTC_CacheRec ),    (FTC_Cache_InitFunc) ftc_cache_init,    (FTC_Cache_ClearFunc)ftc_cache_clear,    (FTC_Cache_DoneFunc) ftc_cache_done,    sizeof ( FTC_SBitFamilyRec ),    (FTC_Family_InitFunc)   ftc_sbit_family_init,    (FTC_Family_CompareFunc)ftc_sbit_family_compare,    (FTC_Family_DoneFunc)   ftc_glyph_family_done,    sizeof ( FTC_SBitNodeRec ),    (FTC_Node_InitFunc)   ftc_sbit_node_init,    (FTC_Node_WeightFunc) ftc_sbit_node_weight,    (FTC_Node_CompareFunc)ftc_sbit_node_compare,    (FTC_Node_DoneFunc)   ftc_sbit_node_done  };  /* documentation is in ftcsbits.h */  FT_EXPORT_DEF( FT_Error )  FTC_SBitCache_New( FTC_Manager     manager,                     FTC_SBitCache  *acache )  {    return FTC_Manager_Register_Cache( manager,                                       &ftc_sbit_cache_class,                                       (FTC_Cache*)acache );  }  /* documentation is in ftcsbits.h */#ifdef FTC_CACHE_USE_INLINE#define GEN_CACHE_FAMILY_COMPARE( f, q, c ) \          ftc_sbit_family_compare( (FTC_SBitFamily)(f), (FTC_SBitQuery)(q) )#define GEN_CACHE_NODE_COMPARE( n, q, c ) \          ftc_sbit_node_compare( (FTC_SBitNode)(n), (FTC_SBitQuery)(q), c )#define GEN_CACHE_LOOKUP  ftc_sbit_cache_lookup#include "ftccache.i"#else  /* !FTC_CACHE_USE_INLINE */#define ftc_sbit_cache_lookup  ftc_cache_lookup#endif /* !FTC_CACHE_USE_INLINE */  FT_EXPORT_DEF( FT_Error )  FTC_SBitCache_Lookup( FTC_SBitCache   cache,                        FTC_ImageType   type,                        FT_UInt         gindex,                        FTC_SBit       *ansbit,                        FTC_Node       *anode )  {    FT_Error          error;    FTC_SBitQueryRec  squery;    FTC_SBitNode      node;    /* other argument checks delayed to ftc_cache_lookup */    if ( !ansbit )      return FTC_Err_Invalid_Argument;    *ansbit = NULL;    if ( anode )      *anode = NULL;    squery.gquery.gindex = gindex;    squery.type          = *type;    error = ftc_sbit_cache_lookup( FTC_CACHE( cache ),                                   FTC_QUERY( &squery ),                                   (FTC_Node*)&node );    if ( !error )    {      *ansbit = node->sbits + ( gindex - FTC_GLYPH_NODE( node )->item_start );      if ( anode )      {        *anode = FTC_NODE( node );        FTC_NODE( node )->ref_count++;      }    }    return error;  }  /* backwards-compatibility functions */  FT_EXPORT_DEF( FT_Error )  FTC_SBit_Cache_New( FTC_Manager      manager,                      FTC_SBit_Cache  *acache )  {    return FTC_SBitCache_New( manager, (FTC_SBitCache*)acache );  }  FT_EXPORT_DEF( FT_Error )  FTC_SBit_Cache_Lookup( FTC_SBit_Cache   cache,                         FTC_Image_Desc*  desc,                         FT_UInt          gindex,                         FTC_SBit        *ansbit )  {    FTC_ImageTypeRec  type0;    if ( !desc )      return FTC_Err_Invalid_Argument;    type0.font  = desc->font;    type0.flags = 0;    /* convert image type flags to load flags */    {      FT_UInt  load_flags = FT_LOAD_DEFAULT;      FT_UInt  type       = desc->image_type;      /* determine load flags, depending on the font description's */      /* image type                                                */      if ( ftc_image_format( type ) == ftc_image_format_bitmap )      {        if ( type & ftc_image_flag_monochrome )          load_flags |= FT_LOAD_MONOCHROME;        /* disable embedded bitmaps loading if necessary */        if ( type & ftc_image_flag_no_sbits )          load_flags |= FT_LOAD_NO_BITMAP;      }      else      {        /* we want an outline, don't load embedded bitmaps */        load_flags |= FT_LOAD_NO_BITMAP;        if ( type & ftc_image_flag_unscaled )          load_flags |= FT_LOAD_NO_SCALE;      }      /* always render glyphs to bitmaps */      load_flags |= FT_LOAD_RENDER;      if ( type & ftc_image_flag_unhinted )        load_flags |= FT_LOAD_NO_HINTING;      if ( type & ftc_image_flag_autohinted )        load_flags |= FT_LOAD_FORCE_AUTOHINT;      type0.flags = load_flags;    }    return FTC_SBitCache_Lookup( (FTC_SBitCache)cache,                                  &type0,                                  gindex,                                  ansbit,                                  NULL );  }/* END */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -