2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* ftcmanag.c
|
|
|
|
*
|
|
|
|
* FreeType Cache Manager (body).
|
|
|
|
*
|
2022-01-11 10:54:10 +01:00
|
|
|
* Copyright (C) 2000-2022 by
|
2018-06-03 09:01:17 +02:00
|
|
|
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
*
|
|
|
|
* This file is part of the FreeType project, and may only be used,
|
|
|
|
* modified, and distributed under the terms of the FreeType project
|
|
|
|
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
|
|
* this file you indicate that you have read the license and
|
|
|
|
* understand and accept it fully.
|
|
|
|
*
|
|
|
|
*/
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/ftcache.h>
|
* include/freetype/cache/ftccache.h,
include/freetype/cache/ftccmap.h,
include/freetype/cache/ftcglyph.h
include/freetype/cache/ftcimage.h
include/freetype/cache/ftcmanag.h
include/freetype/cache/ftcmru.h
include/freetype/cache/ftcsbits.h:
removing these header files from the public include directory.
* include/freetype/config/ftheader.h:
changing the definition of FT_CACHE_INTERNAL_XXX_H macros to
redirect to FT_CACHE_H instead
* src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccache.h,
src/cache/ftccback.h, src/cache/ftccmap.c, src/cache/ftcglyph.c,
src/cache/ftcglyph.h, src/cache/ftcimage.c, src/cache/ftcimage.h,
src/cache/ftcmanag.c, src/cache/ftcmanag.h, src/cache/ftcmru.c,
src/cache/ftcmru.h, src/cache/ftcsbits.c, src/cache/ftcsbits.h:
modifications to prevent using the FT_CACHE_INTERNAL_XXX_H macros,
and grab the headers in 'src/cache' instead (see below).
2006-03-20 13:10:24 +01:00
|
|
|
#include "ftcmanag.h"
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftobjs.h>
|
|
|
|
#include <freetype/internal/ftdebug.h>
|
|
|
|
#include <freetype/ftsizes.h>
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2005-11-12 18:07:11 +01:00
|
|
|
#include "ftccback.h"
|
2003-12-24 14:37:58 +01:00
|
|
|
#include "ftcerror.h"
|
|
|
|
|
|
|
|
|
|
|
|
#undef FT_COMPONENT
|
2018-08-15 18:13:17 +02:00
|
|
|
#define FT_COMPONENT cache
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
static FT_Error
|
2003-12-26 08:26:08 +01:00
|
|
|
ftc_scaler_lookup_size( FTC_Manager manager,
|
|
|
|
FTC_Scaler scaler,
|
|
|
|
FT_Size *asize )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
|
|
|
FT_Face face;
|
|
|
|
FT_Size size = NULL;
|
|
|
|
FT_Error error;
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
error = FTC_Manager_LookupFace( manager, scaler->face_id, &face );
|
2003-12-26 08:26:08 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
error = FT_New_Size( face, &size );
|
2003-12-26 08:26:08 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
FT_Activate_Size( size );
|
|
|
|
|
|
|
|
if ( scaler->pixel )
|
|
|
|
error = FT_Set_Pixel_Sizes( face, scaler->width, scaler->height );
|
|
|
|
else
|
2015-02-25 06:57:16 +01:00
|
|
|
error = FT_Set_Char_Size( face,
|
|
|
|
(FT_F26Dot6)scaler->width,
|
|
|
|
(FT_F26Dot6)scaler->height,
|
|
|
|
scaler->x_res,
|
|
|
|
scaler->y_res );
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( error )
|
|
|
|
{
|
|
|
|
FT_Done_Size( size );
|
|
|
|
size = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
*asize = size;
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
typedef struct FTC_SizeNodeRec_
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_MruNodeRec node;
|
|
|
|
FT_Size size;
|
|
|
|
FTC_ScalerRec scaler;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
} FTC_SizeNodeRec, *FTC_SizeNode;
|
|
|
|
|
2009-09-27 09:55:44 +02:00
|
|
|
#define FTC_SIZE_NODE( x ) ( (FTC_SizeNode)( x ) )
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
FT_CALLBACK_DEF( void )
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
ftc_size_node_done( FTC_MruNode ftcnode,
|
|
|
|
FT_Pointer data )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
FTC_SizeNode node = (FTC_SizeNode)ftcnode;
|
|
|
|
FT_Size size = node->size;
|
|
|
|
FT_UNUSED( data );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( size )
|
|
|
|
FT_Done_Size( size );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-09 23:07:49 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Bool )
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
ftc_size_node_compare( FTC_MruNode ftcnode,
|
|
|
|
FT_Pointer ftcscaler )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
FTC_SizeNode node = (FTC_SizeNode)ftcnode;
|
|
|
|
FTC_Scaler scaler = (FTC_Scaler)ftcscaler;
|
|
|
|
FTC_Scaler scaler0 = &node->scaler;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2004-01-16 10:51:42 +01:00
|
|
|
if ( FTC_SCALER_COMPARE( scaler0, scaler ) )
|
|
|
|
{
|
|
|
|
FT_Activate_Size( node->size );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
ftc_size_node_init( FTC_MruNode ftcnode,
|
|
|
|
FT_Pointer ftcscaler,
|
|
|
|
FT_Pointer ftcmanager )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
FTC_SizeNode node = (FTC_SizeNode)ftcnode;
|
|
|
|
FTC_Scaler scaler = (FTC_Scaler)ftcscaler;
|
|
|
|
FTC_Manager manager = (FTC_Manager)ftcmanager;
|
|
|
|
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
node->scaler = scaler[0];
|
|
|
|
|
|
|
|
return ftc_scaler_lookup_size( manager, scaler, &node->size );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
ftc_size_node_reset( FTC_MruNode ftcnode,
|
|
|
|
FT_Pointer ftcscaler,
|
|
|
|
FT_Pointer ftcmanager )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
FTC_SizeNode node = (FTC_SizeNode)ftcnode;
|
|
|
|
FTC_Scaler scaler = (FTC_Scaler)ftcscaler;
|
|
|
|
FTC_Manager manager = (FTC_Manager)ftcmanager;
|
|
|
|
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
FT_Done_Size( node->size );
|
|
|
|
|
|
|
|
node->scaler = scaler[0];
|
|
|
|
|
|
|
|
return ftc_scaler_lookup_size( manager, scaler, &node->size );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-18 08:39:35 +01:00
|
|
|
static
|
Fix callback functions in cache module.
* src/cache/ftccback.h: New file for callback declarations.
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Use FT_CALLBACK_DEF.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class):
Use FT_CALLBACK_TABLE_DEF and local wrapper functions.
* src/cache/ftccache.c: Include ftccback.h.
(ftc_cache_init, ftc_cache_done): New wrapper functions which use
FT_LOCAL_DEF.
* src/cache/ftccmap.c: Include ftccback.h.
(ftc_cmap_cache_class): Use local wrapper functions.
* src/cache/ftcglyph.c: Include ftccback.h.
(ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcimage.c: Include ftccback.h.
(ftc_inode_free, ftc_inode_new, ftc_inode_weight): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcmanag.c (ftc_size_list_class, ftc_face_list_class):
Use FT_CALLBACK_TABLE_DEF.
* src/cache;/ftcsbits.c: Include ftccback.h.
(ftc_snode_free, ftc_snode_new, ftc_snode_weight,
ftc_snode_compare): New wrapper functions which use FT_LOCAL_DEF.
* src/cache/rules.mk (CACHE_DRV_H): Add ftccback.h.
2004-02-17 19:41:58 +01:00
|
|
|
const FTC_MruListClassRec ftc_size_list_class =
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
sizeof ( FTC_SizeNodeRec ),
|
2016-09-17 17:12:50 +02:00
|
|
|
|
|
|
|
ftc_size_node_compare, /* FTC_MruNode_CompareFunc node_compare */
|
|
|
|
ftc_size_node_init, /* FTC_MruNode_InitFunc node_init */
|
|
|
|
ftc_size_node_reset, /* FTC_MruNode_ResetFunc node_reset */
|
|
|
|
ftc_size_node_done /* FTC_MruNode_DoneFunc node_done */
|
2003-12-24 14:37:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/* helper function used by ftc_face_node_done */
|
2004-06-09 23:07:49 +02:00
|
|
|
static FT_Bool
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
ftc_size_node_compare_faceid( FTC_MruNode ftcnode,
|
|
|
|
FT_Pointer ftcface_id )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
FTC_SizeNode node = (FTC_SizeNode)ftcnode;
|
|
|
|
FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
|
|
|
|
|
|
|
|
|
2005-05-10 00:11:36 +02:00
|
|
|
return FT_BOOL( node->scaler.face_id == face_id );
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-04-24 16:43:37 +02:00
|
|
|
/* documentation is in ftcache.h */
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_Manager_LookupSize( FTC_Manager manager,
|
|
|
|
FTC_Scaler scaler,
|
|
|
|
FT_Size *asize )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
2009-09-27 09:55:44 +02:00
|
|
|
FT_Error error;
|
|
|
|
FTC_MruNode mrunode;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
|
2014-11-26 21:59:21 +01:00
|
|
|
if ( !asize || !scaler )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Argument );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
*asize = NULL;
|
|
|
|
|
|
|
|
if ( !manager )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Cache_Handle );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2004-02-01 17:59:06 +01:00
|
|
|
#ifdef FTC_INLINE
|
2004-01-16 10:51:42 +01:00
|
|
|
|
2004-02-01 17:59:06 +01:00
|
|
|
FTC_MRULIST_LOOKUP_CMP( &manager->sizes, scaler, ftc_size_node_compare,
|
2009-09-27 09:55:44 +02:00
|
|
|
mrunode, error );
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2004-02-01 17:59:06 +01:00
|
|
|
#else
|
2009-09-27 09:55:44 +02:00
|
|
|
error = FTC_MruList_Lookup( &manager->sizes, scaler, &mrunode );
|
2004-02-01 17:59:06 +01:00
|
|
|
#endif
|
2004-01-16 10:51:42 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( !error )
|
2009-09-27 09:55:44 +02:00
|
|
|
*asize = FTC_SIZE_NODE( mrunode )->size;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** FACE MRU IMPLEMENTATION *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
typedef struct FTC_FaceNodeRec_
|
|
|
|
{
|
|
|
|
FTC_MruNodeRec node;
|
|
|
|
FTC_FaceID face_id;
|
|
|
|
FT_Face face;
|
|
|
|
|
|
|
|
} FTC_FaceNodeRec, *FTC_FaceNode;
|
|
|
|
|
2009-09-27 09:55:44 +02:00
|
|
|
#define FTC_FACE_NODE( x ) ( ( FTC_FaceNode )( x ) )
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
ftc_face_node_init( FTC_MruNode ftcnode,
|
|
|
|
FT_Pointer ftcface_id,
|
|
|
|
FT_Pointer ftcmanager )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
FTC_FaceNode node = (FTC_FaceNode)ftcnode;
|
|
|
|
FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
|
|
|
|
FTC_Manager manager = (FTC_Manager)ftcmanager;
|
|
|
|
FT_Error error;
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
node->face_id = face_id;
|
|
|
|
|
|
|
|
error = manager->request_face( face_id,
|
|
|
|
manager->library,
|
|
|
|
manager->request_data,
|
|
|
|
&node->face );
|
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
/* destroy initial size object; it will be re-created later */
|
|
|
|
if ( node->face->size )
|
|
|
|
FT_Done_Size( node->face->size );
|
|
|
|
}
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( void )
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
ftc_face_node_done( FTC_MruNode ftcnode,
|
|
|
|
FT_Pointer ftcmanager )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
FTC_FaceNode node = (FTC_FaceNode)ftcnode;
|
|
|
|
FTC_Manager manager = (FTC_Manager)ftcmanager;
|
|
|
|
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
/* we must begin by removing all scalers for the target face */
|
|
|
|
/* from the manager's list */
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
FTC_MruList_RemoveSelection( &manager->sizes,
|
|
|
|
ftc_size_node_compare_faceid,
|
|
|
|
node->face_id );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
/* all right, we can discard the face now */
|
|
|
|
FT_Done_Face( node->face );
|
|
|
|
node->face = NULL;
|
|
|
|
node->face_id = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-06-09 23:07:49 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Bool )
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
ftc_face_node_compare( FTC_MruNode ftcnode,
|
|
|
|
FT_Pointer ftcface_id )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
FTC_FaceNode node = (FTC_FaceNode)ftcnode;
|
|
|
|
FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
|
|
|
|
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
return FT_BOOL( node->face_id == face_id );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-18 08:39:35 +01:00
|
|
|
static
|
Fix callback functions in cache module.
* src/cache/ftccback.h: New file for callback declarations.
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Use FT_CALLBACK_DEF.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class):
Use FT_CALLBACK_TABLE_DEF and local wrapper functions.
* src/cache/ftccache.c: Include ftccback.h.
(ftc_cache_init, ftc_cache_done): New wrapper functions which use
FT_LOCAL_DEF.
* src/cache/ftccmap.c: Include ftccback.h.
(ftc_cmap_cache_class): Use local wrapper functions.
* src/cache/ftcglyph.c: Include ftccback.h.
(ftc_gnode_compare, ftc_gcache_init, ftc_gcache_done): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcimage.c: Include ftccback.h.
(ftc_inode_free, ftc_inode_new, ftc_inode_weight): New wrapper
functions which use FT_LOCAL_DEF.
* src/cache/ftcmanag.c (ftc_size_list_class, ftc_face_list_class):
Use FT_CALLBACK_TABLE_DEF.
* src/cache;/ftcsbits.c: Include ftccback.h.
(ftc_snode_free, ftc_snode_new, ftc_snode_weight,
ftc_snode_compare): New wrapper functions which use FT_LOCAL_DEF.
* src/cache/rules.mk (CACHE_DRV_H): Add ftccback.h.
2004-02-17 19:41:58 +01:00
|
|
|
const FTC_MruListClassRec ftc_face_list_class =
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
* src/cache/ftcbasic.c (ftc_basic_family_compare,
ftc_basic_family_init, ftc_basic_family_get_count,
ftc_basic_family_load_bitmap, ftc_basic_family_load_glyph,
ftc_basic_gnode_compare_faceid): Adjust parameters and return types
to prototypes given in header files from include/freetype/cache.
Use casts to proper types locally.
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class): Remove
casts.
* src/cache/ftccback.h: Adjust parameters and return types to
prototypes given in header files from include/freetype/cache.
* src/cache/ftcimage.c (ftc_inode_free, ftc_inode_new,
ftc_inode_weight): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcsbits.c (ftc_snode_free, ftc_snode_new,
ftc_snode_weight, ftc_snode_compare): Adjust parameters and return
types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
* src/cache/ftccmap.c (ftc_cmap_node_free, ftc_cmap_node_new,
ftc_cmap_node_weight, ftc_cmap_node_compare,
ftc_cmap_node_remove_faceid): Adjust parameters and return types to
prototypes given in header files from include/freetype/cache. Use
casts to proper types locally.
(ftc_cmap_cache_class): Remove casts.
* src/cache/ftcglyph.c (ftc_gnode_compare, ftc_gcache_init,
ftc_gcache_done): Adjust parameters and return types to prototypes
given in header files from include/freetype/cache. Use casts to
proper types locally.
* src/cache/ftcmanag.c (ftc_size_node_done, ftc_size_node_compare,
ftc_size_node_init, ftc_size_node_reset,
ftc_size_node_compare_faceid, ftc_face_node_init,
ftc_face_node_done, ftc_face_node_compare: Adjust parameters and
return types to prototypes given in header files from
include/freetype/cache. Use casts to proper types locally.
(ftc_size_list_class, ftc_face_list_class): Remove casts.
* src/autohint/ahmodule.c (ft_autohinter_init, ft_autohinter_done):
Use FT_Module as parameter and do a cast to FT_AutoHinter locally.
(autohint_module_class): Remove casts.
* src/base/ftglyph.c (ft_bitmap_glyph_init, ft_bitmap_glyph_copy,
ft_bitmap_glyph_done, ft_bitmap_glyph_bbox, ft_outline_glyph_init,
ft_outline_glyph_done, ft_outline_glyph_copy,
ft_outline_glyph_transform, ft_outline_glyph_bbox,
ft_outline_glyph_prepare): Use FT_Glyph as parameter and do a cast
to FT_XXXGlyph locally.
Use FT_CALLBACK_DEF throughout.
(ft_bitmap_glyph_class, ft_outline_glyph_class): Remove casts.
* src/bdf/bdfdrivr.c (bdf_cmap_init, bdf_cmap_done,
bdf_cmap_char_index, bdf_cmap_char_next): Use FT_CMap as parameter
and do a cast to BDF_CMap locally.
(bdf_cmap_class): Remove casts.
2004-05-17 11:25:04 +02:00
|
|
|
sizeof ( FTC_FaceNodeRec),
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2016-09-17 17:12:50 +02:00
|
|
|
ftc_face_node_compare, /* FTC_MruNode_CompareFunc node_compare */
|
|
|
|
ftc_face_node_init, /* FTC_MruNode_InitFunc node_init */
|
|
|
|
NULL, /* FTC_MruNode_ResetFunc node_reset */
|
|
|
|
ftc_face_node_done /* FTC_MruNode_DoneFunc node_done */
|
2003-12-24 14:37:58 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* documentation is in ftcache.h */
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FTC_Manager_LookupFace( FTC_Manager manager,
|
|
|
|
FTC_FaceID face_id,
|
|
|
|
FT_Face *aface )
|
|
|
|
{
|
2009-09-27 09:55:44 +02:00
|
|
|
FT_Error error;
|
|
|
|
FTC_MruNode mrunode;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
|
2016-05-07 16:24:03 +02:00
|
|
|
if ( !aface )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Argument );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
*aface = NULL;
|
|
|
|
|
|
|
|
if ( !manager )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Cache_Handle );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
/* we break encapsulation for the sake of speed */
|
2004-02-01 17:59:06 +01:00
|
|
|
#ifdef FTC_INLINE
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2004-02-01 17:59:06 +01:00
|
|
|
FTC_MRULIST_LOOKUP_CMP( &manager->faces, face_id, ftc_face_node_compare,
|
2009-09-27 09:55:44 +02:00
|
|
|
mrunode, error );
|
2004-01-16 10:51:42 +01:00
|
|
|
|
2004-02-01 17:59:06 +01:00
|
|
|
#else
|
2009-09-27 09:55:44 +02:00
|
|
|
error = FTC_MruList_Lookup( &manager->faces, face_id, &mrunode );
|
2004-02-01 17:59:06 +01:00
|
|
|
#endif
|
2004-01-16 10:51:42 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( !error )
|
2009-09-27 09:55:44 +02:00
|
|
|
*aface = FTC_FACE_NODE( mrunode )->face;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** CACHE MANAGER ROUTINES *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/* documentation is in ftcache.h */
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
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;
|
2021-11-16 22:07:28 +01:00
|
|
|
FTC_Manager manager = NULL;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
if ( !library )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Library_Handle );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2014-11-26 21:59:21 +01:00
|
|
|
if ( !amanager || !requester )
|
|
|
|
return FT_THROW( Invalid_Argument );
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
memory = library->memory;
|
|
|
|
|
2021-09-03 04:58:50 +02:00
|
|
|
if ( FT_QNEW( manager ) )
|
2003-12-24 14:37:58 +01:00
|
|
|
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 );
|
|
|
|
|
2021-09-11 16:38:08 +02:00
|
|
|
manager->nodes_list = NULL;
|
2021-09-03 04:58:50 +02:00
|
|
|
manager->num_nodes = 0;
|
|
|
|
manager->num_caches = 0;
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
*amanager = manager;
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* documentation is in ftcache.h */
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( void )
|
|
|
|
FTC_Manager_Done( FTC_Manager manager )
|
|
|
|
{
|
|
|
|
FT_Memory memory;
|
|
|
|
FT_UInt idx;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !manager || !manager->library )
|
|
|
|
return;
|
|
|
|
|
|
|
|
memory = manager->memory;
|
|
|
|
|
|
|
|
/* now discard all caches */
|
|
|
|
for (idx = manager->num_caches; idx-- > 0; )
|
|
|
|
{
|
|
|
|
FTC_Cache cache = manager->caches[idx];
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( cache )
|
|
|
|
{
|
|
|
|
cache->clazz.cache_done( cache );
|
|
|
|
FT_FREE( cache );
|
|
|
|
manager->caches[idx] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
manager->num_caches = 0;
|
|
|
|
|
|
|
|
/* discard faces and sizes */
|
|
|
|
FTC_MruList_Done( &manager->sizes );
|
|
|
|
FTC_MruList_Done( &manager->faces );
|
|
|
|
|
|
|
|
manager->library = NULL;
|
|
|
|
manager->memory = NULL;
|
|
|
|
|
|
|
|
FT_FREE( manager );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* documentation is in ftcache.h */
|
|
|
|
|
|
|
|
FT_EXPORT_DEF( void )
|
|
|
|
FTC_Manager_Reset( FTC_Manager manager )
|
|
|
|
{
|
2014-11-26 21:59:21 +01:00
|
|
|
if ( !manager )
|
|
|
|
return;
|
|
|
|
|
|
|
|
FTC_MruList_Reset( &manager->sizes );
|
|
|
|
FTC_MruList_Reset( &manager->faces );
|
2013-06-09 08:20:54 +02:00
|
|
|
|
|
|
|
FTC_Manager_FlushN( manager, manager->num_nodes );
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_ERROR
|
|
|
|
|
2005-11-12 18:07:11 +01:00
|
|
|
static void
|
2003-12-24 14:37:58 +01:00
|
|
|
FTC_Manager_Check( FTC_Manager manager )
|
|
|
|
{
|
|
|
|
FTC_Node node, first;
|
|
|
|
|
|
|
|
|
|
|
|
first = manager->nodes_list;
|
|
|
|
|
|
|
|
/* check node weights */
|
|
|
|
if ( first )
|
|
|
|
{
|
2013-06-06 09:16:38 +02:00
|
|
|
FT_Offset weight = 0;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
node = first;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_Cache cache = manager->caches[node->cache_index];
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
if ( (FT_UInt)node->cache_index >= manager->num_caches )
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_TRACE0(( "FTC_Manager_Check: invalid node (cache index = %ld\n",
|
|
|
|
node->cache_index ));
|
2003-12-24 14:37:58 +01:00
|
|
|
else
|
|
|
|
weight += cache->clazz.node_weight( node, cache );
|
|
|
|
|
2016-01-12 21:40:53 +01:00
|
|
|
node = FTC_NODE_NEXT( node );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
} while ( node != first );
|
|
|
|
|
|
|
|
if ( weight != manager->cur_weight )
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_TRACE0(( "FTC_Manager_Check: invalid weight %ld instead of %ld\n",
|
|
|
|
manager->cur_weight, weight ));
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* check circular list */
|
|
|
|
if ( first )
|
|
|
|
{
|
|
|
|
FT_UFast count = 0;
|
|
|
|
|
|
|
|
|
|
|
|
node = first;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
count++;
|
2016-01-12 21:40:53 +01:00
|
|
|
node = FTC_NODE_NEXT( node );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
} while ( node != first );
|
|
|
|
|
|
|
|
if ( count != manager->num_nodes )
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_TRACE0(( "FTC_Manager_Check:"
|
|
|
|
" invalid cache node count %d instead of %d\n",
|
|
|
|
manager->num_nodes, count ));
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* FT_DEBUG_ERROR */
|
|
|
|
|
|
|
|
|
|
|
|
/* `Compress' the manager's data, i.e., get rid of old cache nodes */
|
|
|
|
/* that are not referenced anymore in order to limit the total */
|
|
|
|
/* memory used by the cache. */
|
|
|
|
|
|
|
|
/* documentation is in ftcmanag.h */
|
|
|
|
|
* src/cache/ftccache.c, (ftc_node_mru_up, FTC_Cache_Lookup)
[!FTC_INLINE]: Compile conditionally.
* src/cache/ftccache.h: Updated.
* src/cache/ftcglyph.c (FTC_GNode_Init, FTC_GNode_UnselectFamily,
FTC_GNode_Done, FTC_GNode_Compare, FTC_Family_Init, FTC_GCache_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_GCache_Init, FTC_GCache_Done): Commented out.
(FTC_GCache_Lookup) [!FTC_INLINE]: Compile conditionally.
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftcglyph.h: Updated.
* src/cache/ftcimage.c (FTC_INode_Free, FTC_INode_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_INode_Weight): Commented out.
* src/cache/ftcimage.h: Updated.
* src/cache/ftmanag.c (FTC_Manager_Compress,
FTC_Manager_RegisterCache, FTC_Manager_FlushN):
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftmanag.h: Updated.
* src/cache/ftcsbits.c (FTC_SNode_Free, FTC_SNode_New,
FTC_SNode_Compare): s/FT_EXPORT/FT_LOCAL/.
(FTC_SNode_Weight): Commented out.
* src/cache/ftcsbits.h: Updated.
2006-03-22 16:30:41 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2003-12-24 14:37:58 +01:00
|
|
|
FTC_Manager_Compress( FTC_Manager manager )
|
|
|
|
{
|
|
|
|
FTC_Node node, first;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !manager )
|
|
|
|
return;
|
|
|
|
|
|
|
|
first = manager->nodes_list;
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_ERROR
|
|
|
|
FTC_Manager_Check( manager );
|
|
|
|
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %d\n",
|
|
|
|
manager->cur_weight, manager->max_weight,
|
|
|
|
manager->num_nodes ));
|
2003-12-24 14:37:58 +01:00
|
|
|
#endif
|
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( manager->cur_weight < manager->max_weight || !first )
|
2003-12-24 14:37:58 +01:00
|
|
|
return;
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/* go to last node -- it's a circular list */
|
2016-01-12 21:40:53 +01:00
|
|
|
node = FTC_NODE_PREV( first );
|
2003-12-24 14:37:58 +01:00
|
|
|
do
|
|
|
|
{
|
|
|
|
FTC_Node prev;
|
|
|
|
|
|
|
|
|
2016-01-12 21:40:53 +01:00
|
|
|
prev = ( node == first ) ? NULL : FTC_NODE_PREV( node );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
if ( node->ref_count <= 0 )
|
|
|
|
ftc_node_destroy( node, manager );
|
|
|
|
|
|
|
|
node = prev;
|
|
|
|
|
|
|
|
} while ( node && manager->cur_weight > manager->max_weight );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* documentation is in ftcmanag.h */
|
|
|
|
|
* src/cache/ftccache.c, (ftc_node_mru_up, FTC_Cache_Lookup)
[!FTC_INLINE]: Compile conditionally.
* src/cache/ftccache.h: Updated.
* src/cache/ftcglyph.c (FTC_GNode_Init, FTC_GNode_UnselectFamily,
FTC_GNode_Done, FTC_GNode_Compare, FTC_Family_Init, FTC_GCache_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_GCache_Init, FTC_GCache_Done): Commented out.
(FTC_GCache_Lookup) [!FTC_INLINE]: Compile conditionally.
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftcglyph.h: Updated.
* src/cache/ftcimage.c (FTC_INode_Free, FTC_INode_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_INode_Weight): Commented out.
* src/cache/ftcimage.h: Updated.
* src/cache/ftmanag.c (FTC_Manager_Compress,
FTC_Manager_RegisterCache, FTC_Manager_FlushN):
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftmanag.h: Updated.
* src/cache/ftcsbits.c (FTC_SNode_Free, FTC_SNode_New,
FTC_SNode_Compare): s/FT_EXPORT/FT_LOCAL/.
(FTC_SNode_Weight): Commented out.
* src/cache/ftcsbits.h: Updated.
2006-03-22 16:30:41 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2003-12-24 14:37:58 +01:00
|
|
|
FTC_Manager_RegisterCache( FTC_Manager manager,
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_CacheClass clazz,
|
|
|
|
FTC_Cache *acache )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
2013-03-14 17:50:49 +01:00
|
|
|
FT_Error error = FT_ERR( Invalid_Argument );
|
2003-12-24 14:37:58 +01:00
|
|
|
FTC_Cache cache = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
if ( manager && clazz && acache )
|
|
|
|
{
|
|
|
|
FT_Memory memory = manager->memory;
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( manager->num_caches >= FTC_MAX_CACHES )
|
|
|
|
{
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Too_Many_Caches );
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_ERROR(( "FTC_Manager_RegisterCache:"
|
|
|
|
" too many registered caches\n" ));
|
2003-12-24 14:37:58 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2021-09-12 20:32:22 +02:00
|
|
|
if ( !FT_QALLOC( cache, clazz->cache_size ) )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
|
|
|
cache->manager = manager;
|
|
|
|
cache->memory = memory;
|
|
|
|
cache->clazz = clazz[0];
|
|
|
|
cache->org_class = clazz;
|
|
|
|
|
|
|
|
/* THIS IS VERY IMPORTANT! IT WILL WRETCH THE MANAGER */
|
|
|
|
/* IF IT IS NOT SET CORRECTLY */
|
|
|
|
cache->index = manager->num_caches;
|
|
|
|
|
|
|
|
error = clazz->cache_init( cache );
|
|
|
|
if ( error )
|
|
|
|
{
|
|
|
|
clazz->cache_done( cache );
|
|
|
|
FT_FREE( cache );
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
manager->caches[manager->num_caches++] = cache;
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
2009-03-12 09:07:49 +01:00
|
|
|
if ( acache )
|
|
|
|
*acache = cache;
|
2003-12-24 14:37:58 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
* src/cache/ftccache.c, (ftc_node_mru_up, FTC_Cache_Lookup)
[!FTC_INLINE]: Compile conditionally.
* src/cache/ftccache.h: Updated.
* src/cache/ftcglyph.c (FTC_GNode_Init, FTC_GNode_UnselectFamily,
FTC_GNode_Done, FTC_GNode_Compare, FTC_Family_Init, FTC_GCache_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_GCache_Init, FTC_GCache_Done): Commented out.
(FTC_GCache_Lookup) [!FTC_INLINE]: Compile conditionally.
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftcglyph.h: Updated.
* src/cache/ftcimage.c (FTC_INode_Free, FTC_INode_New):
s/FT_EXPORT/FT_LOCAL/.
(FTC_INode_Weight): Commented out.
* src/cache/ftcimage.h: Updated.
* src/cache/ftmanag.c (FTC_Manager_Compress,
FTC_Manager_RegisterCache, FTC_Manager_FlushN):
s/FT_EXPORT/FT_LOCAL/.
* src/cache/ftmanag.h: Updated.
* src/cache/ftcsbits.c (FTC_SNode_Free, FTC_SNode_New,
FTC_SNode_Compare): s/FT_EXPORT/FT_LOCAL/.
(FTC_SNode_Weight): Commented out.
* src/cache/ftcsbits.h: Updated.
2006-03-22 16:30:41 +01:00
|
|
|
FT_LOCAL_DEF( FT_UInt )
|
2003-12-24 14:37:58 +01:00
|
|
|
FTC_Manager_FlushN( FTC_Manager manager,
|
2003-12-26 08:26:08 +01:00
|
|
|
FT_UInt count )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
|
|
|
FTC_Node first = manager->nodes_list;
|
|
|
|
FTC_Node node;
|
|
|
|
FT_UInt result;
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
/* try to remove `count' nodes from the list */
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( !first ) /* empty list! */
|
2003-12-24 14:37:58 +01:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* go to last node - it's a circular list */
|
2016-01-12 21:40:53 +01:00
|
|
|
node = FTC_NODE_PREV(first);
|
2003-12-24 14:37:58 +01:00
|
|
|
for ( result = 0; result < count; )
|
|
|
|
{
|
2016-01-12 21:40:53 +01:00
|
|
|
FTC_Node prev = FTC_NODE_PREV( node );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/* don't touch locked nodes */
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( node->ref_count <= 0 )
|
|
|
|
{
|
|
|
|
ftc_node_destroy( node, manager );
|
|
|
|
result++;
|
|
|
|
}
|
|
|
|
|
2004-07-18 09:15:18 +02:00
|
|
|
if ( node == first )
|
2003-12-24 14:37:58 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
node = prev;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-04-24 16:43:37 +02:00
|
|
|
/* documentation is in ftcache.h */
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
FT_EXPORT_DEF( void )
|
|
|
|
FTC_Manager_RemoveFaceID( FTC_Manager manager,
|
|
|
|
FTC_FaceID face_id )
|
|
|
|
{
|
|
|
|
FT_UInt nn;
|
|
|
|
|
2014-11-26 21:59:21 +01:00
|
|
|
|
2016-05-07 16:24:03 +02:00
|
|
|
if ( !manager )
|
2014-11-26 21:59:21 +01:00
|
|
|
return;
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/* this will remove all FTC_SizeNode that correspond to
|
|
|
|
* the face_id as well
|
|
|
|
*/
|
2009-07-31 17:30:18 +02:00
|
|
|
FTC_MruList_RemoveSelection( &manager->faces,
|
2010-04-14 21:25:30 +02:00
|
|
|
ftc_face_node_compare,
|
2009-07-31 17:30:18 +02:00
|
|
|
face_id );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
for ( nn = 0; nn < manager->num_caches; nn++ )
|
|
|
|
FTC_Cache_RemoveFaceID( manager->caches[nn], face_id );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-04-24 16:43:37 +02:00
|
|
|
/* documentation is in ftcache.h */
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
FT_EXPORT_DEF( void )
|
|
|
|
FTC_Node_Unref( FTC_Node node,
|
|
|
|
FTC_Manager manager )
|
|
|
|
{
|
2014-11-26 21:59:21 +01:00
|
|
|
if ( node &&
|
|
|
|
manager &&
|
|
|
|
(FT_UInt)node->cache_index < manager->num_caches )
|
2003-12-24 14:37:58 +01:00
|
|
|
node->ref_count--;
|
|
|
|
}
|
|
|
|
|
2006-02-17 09:07:09 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
/* END */
|