Пример #1
0
  FTC_ImageCache_LookupScaler( FTC_ImageCache  cache,
                               FTC_Scaler      scaler,
                               FT_ULong        load_flags,
                               FT_UInt         gindex,
                               FT_Glyph       *aglyph,
                               FTC_Node       *anode )
  {
    FTC_BasicQueryRec  query;
    FTC_INode          node = 0;  /* make compiler happy */
    FT_Error           error;
    FT_UInt32          hash;


    /* some argument checks are delayed to FTC_Cache_Lookup */
    if ( !aglyph || !scaler )
    {
      error = FTC_Err_Invalid_Argument;
      goto Exit;
    }

    *aglyph = NULL;
    if ( anode )
      *anode  = NULL;

    query.attrs.scaler     = scaler[0];
    query.attrs.load_flags = load_flags;

    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;

    FTC_GCACHE_LOOKUP_CMP( cache,
                           ftc_basic_family_compare,
                           FTC_GNode_Compare,
                           hash, gindex,
                           &query,
                           node,
                           error );
    if ( !error )
    {
      *aglyph = FTC_INODE( node )->glyph;

      if ( anode )
      {
        *anode = FTC_NODE( node );
        FTC_NODE( node )->ref_count++;
      }
    }

  Exit:
    return error;
  }
Пример #2
0
  FTC_SBitCache_LookupScaler( FTC_SBitCache  cache,
                              FTC_Scaler     scaler,
                              FT_ULong       load_flags,
                              FT_UInt        gindex,
                              FTC_SBit      *ansbit,
                              FTC_Node      *anode )
  {
    FT_Error           error;
    FTC_BasicQueryRec  query;
    FTC_SNode          node = 0; /* make compiler happy */
    FT_UInt32          hash;


    if ( anode )
        *anode = NULL;

    /* other argument checks delayed to FTC_Cache_Lookup */
    if ( !ansbit || !scaler )
        return FTC_Err_Invalid_Argument;

    *ansbit = NULL;

    query.attrs.scaler     = scaler[0];
    query.attrs.load_flags = load_flags;

    /* beware, the hash must be the same for all glyph ranges! */
    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
             gindex / FTC_SBIT_ITEMS_PER_NODE;

    FTC_GCACHE_LOOKUP_CMP( cache,
                           ftc_basic_family_compare,
                           FTC_SNode_Compare,
                           hash, gindex,
                           &query,
                           node,
                           error );
    if ( error )
      goto Exit;

    *ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex );

    if ( anode )
    {
      *anode = FTC_NODE( node );
      FTC_NODE( node )->ref_count++;
    }

  Exit:
    return error;
  }
Пример #3
0
 FTC_GNode_Compare( FTC_GNode   gnode,
                    FTC_GQuery  gquery,
                    FTC_Cache   cache ) /*GB : clang*/
 {
   FT_UNUSED( cache );
   return ftc_gnode_compare( FTC_NODE( gnode ), gquery, NULL );
 }
Пример #4
0
 FTC_GNode_Compare( FTC_GNode   gnode,
                    FTC_GQuery  gquery,
                    FTC_Cache   cache,
                    FT_Bool*    list_changed )
 {
   return ftc_gnode_compare( FTC_NODE( gnode ), gquery,
                             cache, list_changed );
 }
Пример #5
0
  ftc_glyph_node_done( FTC_GlyphNode  gnode,
                       FTC_Cache      cache )
  {
    /* finalize the node */
    gnode->item_count = 0;
    gnode->item_start = 0;

    ftc_node_done( FTC_NODE( gnode ), cache );
  }
Пример #6
0
  FTC_ImageCache_Lookup( FTC_ImageCache  cache,
                         FTC_ImageType   type,
                         FT_UInt         gindex,
                         FT_Glyph       *aglyph,
                         FTC_Node       *anode )
  {
    FTC_ImageQueryRec  iquery;
    FTC_ImageNode      node;
    FT_Error           error;


    /* some argument checks are delayed to ftc_cache_lookup */
    if ( !aglyph )
      return FTC_Err_Invalid_Argument;

    if ( anode )
      *anode  = NULL;

    iquery.gquery.gindex = gindex;
    iquery.type          = *type;

    error = ftc_cache_lookup( FTC_CACHE( cache ),
                              FTC_QUERY( &iquery ),
                              (FTC_Node*)&node );
    if ( !error )
    {
      *aglyph = node->glyph;

      if ( anode )
      {
        *anode = (FTC_Node)node;
        FTC_NODE( node )->ref_count++;
      }
    }

    return error;
  }
Пример #7
0
 FTC_SNode_Free( FTC_SNode  snode,
                 FTC_Cache  cache )
 {
   ftc_snode_free( FTC_NODE( snode ), cache );
 }
Пример #8
0
 FTC_SNode_Weight( FTC_SNode  snode )
 {
   return ftc_snode_weight( FTC_NODE( snode ), NULL );
 }
Пример #9
0
 FTC_INode_Free( FTC_INode  inode,
                 FTC_Cache  cache )
 {
   ftc_inode_free( FTC_NODE( inode ), cache );
 }
Пример #10
0
 FTC_INode_Weight( FTC_INode  inode )
 {
   return ftc_inode_weight( FTC_NODE( inode ), NULL );
 }
Пример #11
0
 FTC_GNode_Compare( FTC_GNode   gnode,
                    FTC_GQuery  gquery )
 {
   return ftc_gnode_compare( FTC_NODE( gnode ), gquery, NULL );
 }
Пример #12
0
FTC_SBitCache_Lookup( FTC_SBitCache  cache,
                      FTC_ImageType  type,
                      FT_UInt        gindex,
                      FTC_SBit      *ansbit,
                      FTC_Node      *anode )
{
    FT_Error           error;
    FTC_BasicQueryRec  query;
    FTC_SNode          node = 0; /* make compiler happy */
    FT_UInt32          hash;


    if ( anode )
        *anode = NULL;

    /* other argument checks delayed to FTC_Cache_Lookup */
    if ( !ansbit )
        return FTC_Err_Invalid_Argument;

    *ansbit = NULL;

    query.attrs.scaler.face_id = type->face_id;
    query.attrs.scaler.width   = type->width;
    query.attrs.scaler.height  = type->height;
    query.attrs.scaler.pixel   = 1;
    query.attrs.load_flags     = type->flags;

    query.attrs.scaler.x_res   = 0;  /* make compilers happy */
    query.attrs.scaler.y_res   = 0;

    /* beware, the hash must be the same for all glyph ranges! */
    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
           gindex / FTC_SBIT_ITEMS_PER_NODE;

#if 1  /* inlining is about 50% faster! */
    FTC_GCACHE_LOOKUP_CMP( cache,
                           ftc_basic_family_compare,
                           FTC_SNode_Compare,
                           hash, gindex,
                           &query,
                           node,
                           error );
#else
    error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
                               hash,
                               gindex,
                               FTC_GQUERY( &query ),
                               (FTC_Node*)&node );
#endif
    if ( error )
        goto Exit;

    *ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex );

    if ( anode )
    {
        *anode = FTC_NODE( node );
        FTC_NODE( node )->ref_count++;
    }

Exit:
    return error;
}
Пример #13
0
FTC_ImageCache_Lookup( FTC_ImageCache  cache,
                       FTC_ImageType   type,
                       FT_UInt         gindex,
                       FT_Glyph       *aglyph,
                       FTC_Node       *anode )
{
    FTC_BasicQueryRec  query;
    FTC_INode          node = 0;  /* make compiler happy */
    FT_Error           error;
    FT_UInt32          hash;


    /* some argument checks are delayed to FTC_Cache_Lookup */
    if ( !aglyph )
    {
        error = FTC_Err_Invalid_Argument;
        goto Exit;
    }

    *aglyph = NULL;
    if ( anode )
        *anode  = NULL;

    query.attrs.scaler.face_id = type->face_id;
    query.attrs.scaler.width   = type->width;
    query.attrs.scaler.height  = type->height;
    query.attrs.scaler.pixel   = 1;
    query.attrs.load_flags     = type->flags;

    query.attrs.scaler.x_res   = 0;  /* make compilers happy */
    query.attrs.scaler.y_res   = 0;

    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;

#if 1  /* inlining is about 50% faster! */
    FTC_GCACHE_LOOKUP_CMP( cache,
                           ftc_basic_family_compare,
                           FTC_GNode_Compare,
                           hash, gindex,
                           &query,
                           node,
                           error );
#else
    error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
                               hash, gindex,
                               FTC_GQUERY( &query ),
                               (FTC_Node*) &node );
#endif
    if ( !error )
    {
        *aglyph = FTC_INODE( node )->glyph;

        if ( anode )
        {
            *anode = FTC_NODE( node );
            FTC_NODE( node )->ref_count++;
        }
    }

Exit:
    return error;
}
Пример #14
0
  FTC_SBitCache_Lookup( FTC_SBitCache  cache,
                        FTC_ImageType  type,
                        FT_UInt        gindex,
                        FTC_SBit      *ansbit,
                        FTC_Node      *anode )
  {
    FT_Error           error;
    FTC_BasicQueryRec  query;
    FTC_SNode          node = 0; /* make compiler happy */
    FT_UInt32          hash;


    if ( anode )
      *anode = NULL;

    /* other argument checks delayed to FTC_Cache_Lookup */
    if ( !ansbit )
      return FTC_Err_Invalid_Argument;

    *ansbit = NULL;

#ifdef FT_CONFIG_OPTION_OLD_INTERNALS

    /*  This one is a major hack used to detect whether we are passed a
     *  regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
     */
    if ( type->width >= 0x10000 )
    {
      FTC_OldImageDesc  desc = (FTC_OldImageDesc)type;


      query.attrs.scaler.face_id = desc->font.face_id;
      query.attrs.scaler.width   = desc->font.pix_width;
      query.attrs.scaler.height  = desc->font.pix_height;
      query.attrs.load_flags     = desc->flags;
    }
    else

#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */

    {
      query.attrs.scaler.face_id = type->face_id;
      query.attrs.scaler.width   = type->width;
      query.attrs.scaler.height  = type->height;
      query.attrs.load_flags     = type->flags;
    }

    query.attrs.scaler.pixel = 1;
    query.attrs.scaler.x_res = 0;  /* make compilers happy */
    query.attrs.scaler.y_res = 0;

    /* beware, the hash must be the same for all glyph ranges! */
    hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
           gindex / FTC_SBIT_ITEMS_PER_NODE;

#if 1  /* inlining is about 50% faster! */
    FTC_GCACHE_LOOKUP_CMP( cache,
                           ftc_basic_family_compare,
                           FTC_SNode_Compare,
                           hash, gindex,
                           &query,
                           node,
                           error );
#else
    error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
                               hash,
                               gindex,
                               FTC_GQUERY( &query ),
                               (FTC_Node*)&node );
#endif
    if ( error )
      goto Exit;

    *ansbit = node->sbits + ( gindex - FTC_GNODE( node )->gindex );

    if ( anode )
    {
      *anode = FTC_NODE( node );
      FTC_NODE( node )->ref_count++;
    }

  Exit:
    return error;
  }
Пример #15
0
 FTC_SNode_Compare( FTC_SNode   snode,
                    FTC_GQuery  gquery,
                    FTC_Cache   cache )
 {
   return ftc_snode_compare( FTC_NODE( snode ), gquery, cache );
 }