2003-12-24 14:37:58 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftccmap.c */
|
|
|
|
/* */
|
|
|
|
/* FreeType CharMap cache (body) */
|
|
|
|
/* */
|
2010-07-12 21:13:22 +02:00
|
|
|
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
|
|
|
|
/* 2010 by */
|
2003-12-24 14:37:58 +01: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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_FREETYPE_H
|
|
|
|
#include FT_CACHE_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"
|
2003-12-24 14:37:58 +01:00
|
|
|
#include FT_INTERNAL_MEMORY_H
|
[cache] Notice if a cache query induced the node list change.
Some node comparators (comparing the cache node content and
the properties specified by the query) can flush the cache
node to prevent the cache inflation. The change may
invalidate the pointers to the node obtained before the node
comparison, so the change should be noticed to the caller.
The problem caused by the cache node changing is reported by
Harsha, see Savannah bug #31923.
* src/cache/ftccache.h (FTC_Node_CompareFunc): Add new
argument `FT_Bool* list_changed' to indicate the change of
the cached nodes to the caller.
(FTC_CACHE_LOOKUP_CMP): Watch the change of the cached nodes
by `_list_changed'.
(FTC_CACHE_TRYLOOP_END): Take new macro argument `_list_changed'
and update it when FTC_Manager_FlushN() flushes any nodes.
* src/cache/ftccback.h (ftc_snode_compare): Updated to fit
with new FTC_Node_CompareFunc type. (ftc_gnode_compare): Ditto.
* src/cache/ftcbasic.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_basic_gnode_compare_faceid):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
* src/cache/ftccmap.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_cmap_node_compare):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
(ftc_cmap_node_remove_faceid): Ditto.
* src/cache/ftccache.c (FTC_Cache_NewNode): Pass a NULL
pointer to FTC_CACHE_TRYLOOP_END(), because the result is
not needed. (FTC_Cache_Lookup): Watch the change of the cache
nodes by `list_changed'. (FTC_Cache_RemoveFaceID): Ditto.
* src/cache/ftcglyph.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_gnode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway, it is always FALSE. (FTC_GNode_Compare):
New argument `FT_Bool* list_changed' to be passed to
ftc_gnode_compare().
* src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto.
* src/cache/ftcsbits.c (ftc_snode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway. It is updated by FTC_CACHE_TRYLOOP().
(FTC_SNode_Compare): New argument `FT_Bool* list_changed'
to be passed to ftc_snode_compare().
* src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09 14:49:07 +01:00
|
|
|
#include FT_INTERNAL_OBJECTS_H
|
2003-12-24 14:37:58 +01:00
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
|
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
|
|
|
#include "ftccback.h"
|
2003-12-24 14:37:58 +01:00
|
|
|
#include "ftcerror.h"
|
|
|
|
|
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_cache
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2006-02-23 23:35:26 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
|
|
|
|
|
|
|
typedef enum FTC_OldCMapType_
|
|
|
|
{
|
|
|
|
FTC_OLD_CMAP_BY_INDEX = 0,
|
|
|
|
FTC_OLD_CMAP_BY_ENCODING = 1,
|
|
|
|
FTC_OLD_CMAP_BY_ID = 2
|
|
|
|
|
|
|
|
} FTC_OldCMapType;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct FTC_OldCMapIdRec_
|
|
|
|
{
|
|
|
|
FT_UInt platform;
|
|
|
|
FT_UInt encoding;
|
|
|
|
|
|
|
|
} FTC_OldCMapIdRec, *FTC_OldCMapId;
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct FTC_OldCMapDescRec_
|
|
|
|
{
|
|
|
|
FTC_FaceID face_id;
|
|
|
|
FTC_OldCMapType type;
|
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
FT_UInt index;
|
|
|
|
FT_Encoding encoding;
|
|
|
|
FTC_OldCMapIdRec id;
|
|
|
|
|
|
|
|
} u;
|
|
|
|
|
|
|
|
} FTC_OldCMapDescRec, *FTC_OldCMapDesc;
|
|
|
|
|
|
|
|
#endif /* FT_CONFIG_OLD_INTERNALS */
|
|
|
|
|
2006-02-25 07:24:28 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Each FTC_CMapNode contains a simple array to map a range of character */
|
|
|
|
/* codes to equivalent glyph indices. */
|
|
|
|
/* */
|
|
|
|
/* For now, the implementation is very basic: Each node maps a range of */
|
|
|
|
/* 128 consecutive character codes to their corresponding glyph indices. */
|
|
|
|
/* */
|
|
|
|
/* We could do more complex things, but I don't think it is really very */
|
|
|
|
/* useful. */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/* number of glyph indices / character code per node */
|
|
|
|
#define FTC_CMAP_INDICES_MAX 128
|
|
|
|
|
|
|
|
/* compute a query/node hash */
|
2009-03-20 16:10:26 +01:00
|
|
|
#define FTC_CMAP_HASH( faceid, index, charcode ) \
|
2010-10-24 19:07:52 +02:00
|
|
|
( _FTC_FACE_ID_HASH( faceid ) + 211 * (index) + \
|
2009-03-20 16:10:26 +01:00
|
|
|
( (charcode) / FTC_CMAP_INDICES_MAX ) )
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
/* the charmap query */
|
|
|
|
typedef struct FTC_CMapQueryRec_
|
|
|
|
{
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_FaceID face_id;
|
|
|
|
FT_UInt cmap_index;
|
|
|
|
FT_UInt32 char_code;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
} FTC_CMapQueryRec, *FTC_CMapQuery;
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
#define FTC_CMAP_QUERY( x ) ((FTC_CMapQuery)(x))
|
|
|
|
#define FTC_CMAP_QUERY_HASH( x ) \
|
|
|
|
FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->char_code )
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
/* the cmap cache node */
|
2003-12-24 14:37:58 +01:00
|
|
|
typedef struct FTC_CMapNodeRec_
|
|
|
|
{
|
|
|
|
FTC_NodeRec node;
|
|
|
|
FTC_FaceID face_id;
|
|
|
|
FT_UInt cmap_index;
|
|
|
|
FT_UInt32 first; /* first character in node */
|
|
|
|
FT_UInt16 indices[FTC_CMAP_INDICES_MAX]; /* array of glyph indices */
|
|
|
|
|
|
|
|
} FTC_CMapNodeRec, *FTC_CMapNode;
|
|
|
|
|
|
|
|
#define FTC_CMAP_NODE( x ) ( (FTC_CMapNode)( x ) )
|
2003-12-26 08:26:08 +01:00
|
|
|
#define FTC_CMAP_NODE_HASH( x ) \
|
|
|
|
FTC_CMAP_HASH( (x)->face_id, (x)->cmap_index, (x)->first )
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
/* if (indices[n] == FTC_CMAP_UNKNOWN), we assume that the corresponding */
|
|
|
|
/* glyph indices haven't been queried through FT_Get_Glyph_Index() yet */
|
|
|
|
#define FTC_CMAP_UNKNOWN ( (FT_UInt16)-1 )
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** CHARMAP NODES *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
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_cmap_node_free( FTC_Node ftcnode,
|
|
|
|
FTC_Cache cache )
|
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_CMapNode node = (FTC_CMapNode)ftcnode;
|
|
|
|
FT_Memory memory = cache->memory;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
FT_FREE( node );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* initialize a new cmap node */
|
|
|
|
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_cmap_node_new( FTC_Node *ftcanode,
|
|
|
|
FT_Pointer ftcquery,
|
|
|
|
FTC_Cache cache )
|
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_CMapNode *anode = (FTC_CMapNode*)ftcanode;
|
|
|
|
FTC_CMapQuery query = (FTC_CMapQuery)ftcquery;
|
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory = cache->memory;
|
2010-07-12 21:13:22 +02:00
|
|
|
FTC_CMapNode node = NULL;
|
* 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
|
|
|
FT_UInt nn;
|
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 ( !FT_NEW( node ) )
|
|
|
|
{
|
|
|
|
node->face_id = query->face_id;
|
|
|
|
node->cmap_index = query->cmap_index;
|
|
|
|
node->first = (query->char_code / FTC_CMAP_INDICES_MAX) *
|
|
|
|
FTC_CMAP_INDICES_MAX;
|
|
|
|
|
|
|
|
for ( nn = 0; nn < FTC_CMAP_INDICES_MAX; nn++ )
|
|
|
|
node->indices[nn] = FTC_CMAP_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
*anode = node;
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* compute the weight of a given cmap node */
|
2009-07-31 17:32:10 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Offset )
|
* 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_cmap_node_weight( FTC_Node cnode,
|
|
|
|
FTC_Cache cache )
|
2003-12-24 14:37:58 +01:00
|
|
|
{
|
|
|
|
FT_UNUSED( cnode );
|
* 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
|
|
|
FT_UNUSED( cache );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
return sizeof ( *cnode );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* compare a cmap node to a given query */
|
|
|
|
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_cmap_node_compare( FTC_Node ftcnode,
|
|
|
|
FT_Pointer ftcquery,
|
[cache] Notice if a cache query induced the node list change.
Some node comparators (comparing the cache node content and
the properties specified by the query) can flush the cache
node to prevent the cache inflation. The change may
invalidate the pointers to the node obtained before the node
comparison, so the change should be noticed to the caller.
The problem caused by the cache node changing is reported by
Harsha, see Savannah bug #31923.
* src/cache/ftccache.h (FTC_Node_CompareFunc): Add new
argument `FT_Bool* list_changed' to indicate the change of
the cached nodes to the caller.
(FTC_CACHE_LOOKUP_CMP): Watch the change of the cached nodes
by `_list_changed'.
(FTC_CACHE_TRYLOOP_END): Take new macro argument `_list_changed'
and update it when FTC_Manager_FlushN() flushes any nodes.
* src/cache/ftccback.h (ftc_snode_compare): Updated to fit
with new FTC_Node_CompareFunc type. (ftc_gnode_compare): Ditto.
* src/cache/ftcbasic.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_basic_gnode_compare_faceid):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
* src/cache/ftccmap.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_cmap_node_compare):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
(ftc_cmap_node_remove_faceid): Ditto.
* src/cache/ftccache.c (FTC_Cache_NewNode): Pass a NULL
pointer to FTC_CACHE_TRYLOOP_END(), because the result is
not needed. (FTC_Cache_Lookup): Watch the change of the cache
nodes by `list_changed'. (FTC_Cache_RemoveFaceID): Ditto.
* src/cache/ftcglyph.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_gnode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway, it is always FALSE. (FTC_GNode_Compare):
New argument `FT_Bool* list_changed' to be passed to
ftc_gnode_compare().
* src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto.
* src/cache/ftcsbits.c (ftc_snode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway. It is updated by FTC_CACHE_TRYLOOP().
(FTC_SNode_Compare): New argument `FT_Bool* list_changed'
to be passed to ftc_snode_compare().
* src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09 14:49:07 +01:00
|
|
|
FTC_Cache cache,
|
|
|
|
FT_Bool* list_changed )
|
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_CMapNode node = (FTC_CMapNode)ftcnode;
|
|
|
|
FTC_CMapQuery query = (FTC_CMapQuery)ftcquery;
|
|
|
|
FT_UNUSED( cache );
|
|
|
|
|
|
|
|
|
[cache] Notice if a cache query induced the node list change.
Some node comparators (comparing the cache node content and
the properties specified by the query) can flush the cache
node to prevent the cache inflation. The change may
invalidate the pointers to the node obtained before the node
comparison, so the change should be noticed to the caller.
The problem caused by the cache node changing is reported by
Harsha, see Savannah bug #31923.
* src/cache/ftccache.h (FTC_Node_CompareFunc): Add new
argument `FT_Bool* list_changed' to indicate the change of
the cached nodes to the caller.
(FTC_CACHE_LOOKUP_CMP): Watch the change of the cached nodes
by `_list_changed'.
(FTC_CACHE_TRYLOOP_END): Take new macro argument `_list_changed'
and update it when FTC_Manager_FlushN() flushes any nodes.
* src/cache/ftccback.h (ftc_snode_compare): Updated to fit
with new FTC_Node_CompareFunc type. (ftc_gnode_compare): Ditto.
* src/cache/ftcbasic.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_basic_gnode_compare_faceid):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
* src/cache/ftccmap.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_cmap_node_compare):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
(ftc_cmap_node_remove_faceid): Ditto.
* src/cache/ftccache.c (FTC_Cache_NewNode): Pass a NULL
pointer to FTC_CACHE_TRYLOOP_END(), because the result is
not needed. (FTC_Cache_Lookup): Watch the change of the cache
nodes by `list_changed'. (FTC_Cache_RemoveFaceID): Ditto.
* src/cache/ftcglyph.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_gnode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway, it is always FALSE. (FTC_GNode_Compare):
New argument `FT_Bool* list_changed' to be passed to
ftc_gnode_compare().
* src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto.
* src/cache/ftcsbits.c (ftc_snode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway. It is updated by FTC_CACHE_TRYLOOP().
(FTC_SNode_Compare): New argument `FT_Bool* list_changed'
to be passed to ftc_snode_compare().
* src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09 14:49:07 +01:00
|
|
|
if ( list_changed )
|
|
|
|
*list_changed = FALSE;
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( node->face_id == query->face_id &&
|
|
|
|
node->cmap_index == query->cmap_index )
|
|
|
|
{
|
|
|
|
FT_UInt32 offset = (FT_UInt32)( query->char_code - node->first );
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
return FT_BOOL( offset < FTC_CMAP_INDICES_MAX );
|
|
|
|
}
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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_cmap_node_remove_faceid( FTC_Node ftcnode,
|
|
|
|
FT_Pointer ftcface_id,
|
[cache] Notice if a cache query induced the node list change.
Some node comparators (comparing the cache node content and
the properties specified by the query) can flush the cache
node to prevent the cache inflation. The change may
invalidate the pointers to the node obtained before the node
comparison, so the change should be noticed to the caller.
The problem caused by the cache node changing is reported by
Harsha, see Savannah bug #31923.
* src/cache/ftccache.h (FTC_Node_CompareFunc): Add new
argument `FT_Bool* list_changed' to indicate the change of
the cached nodes to the caller.
(FTC_CACHE_LOOKUP_CMP): Watch the change of the cached nodes
by `_list_changed'.
(FTC_CACHE_TRYLOOP_END): Take new macro argument `_list_changed'
and update it when FTC_Manager_FlushN() flushes any nodes.
* src/cache/ftccback.h (ftc_snode_compare): Updated to fit
with new FTC_Node_CompareFunc type. (ftc_gnode_compare): Ditto.
* src/cache/ftcbasic.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_basic_gnode_compare_faceid):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
* src/cache/ftccmap.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_cmap_node_compare):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
(ftc_cmap_node_remove_faceid): Ditto.
* src/cache/ftccache.c (FTC_Cache_NewNode): Pass a NULL
pointer to FTC_CACHE_TRYLOOP_END(), because the result is
not needed. (FTC_Cache_Lookup): Watch the change of the cache
nodes by `list_changed'. (FTC_Cache_RemoveFaceID): Ditto.
* src/cache/ftcglyph.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_gnode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway, it is always FALSE. (FTC_GNode_Compare):
New argument `FT_Bool* list_changed' to be passed to
ftc_gnode_compare().
* src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto.
* src/cache/ftcsbits.c (ftc_snode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway. It is updated by FTC_CACHE_TRYLOOP().
(FTC_SNode_Compare): New argument `FT_Bool* list_changed'
to be passed to ftc_snode_compare().
* src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09 14:49:07 +01:00
|
|
|
FTC_Cache cache,
|
|
|
|
FT_Bool* list_changed )
|
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_CMapNode node = (FTC_CMapNode)ftcnode;
|
|
|
|
FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
|
|
|
|
FT_UNUSED( cache );
|
|
|
|
|
[cache] Notice if a cache query induced the node list change.
Some node comparators (comparing the cache node content and
the properties specified by the query) can flush the cache
node to prevent the cache inflation. The change may
invalidate the pointers to the node obtained before the node
comparison, so the change should be noticed to the caller.
The problem caused by the cache node changing is reported by
Harsha, see Savannah bug #31923.
* src/cache/ftccache.h (FTC_Node_CompareFunc): Add new
argument `FT_Bool* list_changed' to indicate the change of
the cached nodes to the caller.
(FTC_CACHE_LOOKUP_CMP): Watch the change of the cached nodes
by `_list_changed'.
(FTC_CACHE_TRYLOOP_END): Take new macro argument `_list_changed'
and update it when FTC_Manager_FlushN() flushes any nodes.
* src/cache/ftccback.h (ftc_snode_compare): Updated to fit
with new FTC_Node_CompareFunc type. (ftc_gnode_compare): Ditto.
* src/cache/ftcbasic.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_basic_gnode_compare_faceid):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
* src/cache/ftccmap.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_cmap_node_compare):
New argument `FT_Bool* list_changed' to indicate the change
of the cache nodes, anyway, it is always FALSE.
(ftc_cmap_node_remove_faceid): Ditto.
* src/cache/ftccache.c (FTC_Cache_NewNode): Pass a NULL
pointer to FTC_CACHE_TRYLOOP_END(), because the result is
not needed. (FTC_Cache_Lookup): Watch the change of the cache
nodes by `list_changed'. (FTC_Cache_RemoveFaceID): Ditto.
* src/cache/ftcglyph.c: Include FT_INTERNAL_OBJECTS_H to
use TRUE/FALSE macros. (ftc_gnode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway, it is always FALSE. (FTC_GNode_Compare):
New argument `FT_Bool* list_changed' to be passed to
ftc_gnode_compare().
* src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto.
* src/cache/ftcsbits.c (ftc_snode_compare): New argument
`FT_Bool* list_changed' to indicate the change of the cache
nodes, anyway. It is updated by FTC_CACHE_TRYLOOP().
(FTC_SNode_Compare): New argument `FT_Bool* list_changed'
to be passed to ftc_snode_compare().
* src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
2011-01-09 14:49:07 +01:00
|
|
|
if ( list_changed )
|
|
|
|
*list_changed = FALSE;
|
2003-12-24 14:37:58 +01:00
|
|
|
return FT_BOOL( node->face_id == face_id );
|
|
|
|
}
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** GLYPH IMAGE CACHE *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_TABLE_DEF
|
|
|
|
const FTC_CacheClassRec ftc_cmap_cache_class =
|
|
|
|
{
|
* 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_cmap_node_new,
|
|
|
|
ftc_cmap_node_weight,
|
|
|
|
ftc_cmap_node_compare,
|
|
|
|
ftc_cmap_node_remove_faceid,
|
|
|
|
ftc_cmap_node_free,
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
sizeof ( FTC_CacheRec ),
|
* 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_cache_init,
|
|
|
|
ftc_cache_done,
|
2003-12-24 14:37:58 +01:00
|
|
|
};
|
|
|
|
|
2003-12-26 08:26:08 +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 )
|
|
|
|
FTC_CMapCache_New( FTC_Manager manager,
|
|
|
|
FTC_CMapCache *acache )
|
|
|
|
{
|
|
|
|
return FTC_Manager_RegisterCache( manager,
|
2003-12-26 08:26:08 +01:00
|
|
|
&ftc_cmap_cache_class,
|
2003-12-24 14:37:58 +01:00
|
|
|
FTC_CACHE_P( acache ) );
|
|
|
|
}
|
2003-12-26 08:26:08 +01:00
|
|
|
|
|
|
|
|
2006-02-17 18:23:13 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
2006-02-19 17:12:18 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Unfortunately, it is not possible to support binary backwards
|
|
|
|
* compatibility in the cmap cache. The FTC_CMapCache_Lookup signature
|
|
|
|
* changes were too deep, and there is no clever hackish way to detect
|
|
|
|
* what kind of structure we are being passed.
|
|
|
|
*
|
|
|
|
* On the other hand it seems that no production code is using this
|
|
|
|
* function on Unix distributions.
|
|
|
|
*/
|
|
|
|
|
2006-02-17 18:23:13 +01:00
|
|
|
#endif
|
|
|
|
|
2006-02-19 17:12:18 +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_UInt )
|
|
|
|
FTC_CMapCache_Lookup( FTC_CMapCache cmap_cache,
|
|
|
|
FTC_FaceID face_id,
|
|
|
|
FT_Int cmap_index,
|
|
|
|
FT_UInt32 char_code )
|
|
|
|
{
|
|
|
|
FTC_Cache cache = FTC_CACHE( cmap_cache );
|
|
|
|
FTC_CMapQueryRec query;
|
2009-09-27 09:55:44 +02:00
|
|
|
FTC_Node node;
|
2003-12-24 14:37:58 +01:00
|
|
|
FT_Error error;
|
|
|
|
FT_UInt gindex = 0;
|
2010-10-24 19:07:52 +02:00
|
|
|
FT_PtrDist hash;
|
2008-09-02 04:34:29 +02:00
|
|
|
FT_Int no_cmap_change = 0;
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2008-09-12 18:27:48 +02:00
|
|
|
|
|
|
|
if ( cmap_index < 0 )
|
2008-09-02 04:34:29 +02:00
|
|
|
{
|
2008-09-12 18:27:48 +02:00
|
|
|
/* Treat a negative cmap index as a special value, meaning that you */
|
|
|
|
/* don't want to change the FT_Face's character map through this */
|
|
|
|
/* call. This can be useful if the face requester callback already */
|
|
|
|
/* sets the face's charmap to the appropriate value. */
|
|
|
|
|
2008-09-02 04:34:29 +02:00
|
|
|
no_cmap_change = 1;
|
|
|
|
cmap_index = 0;
|
|
|
|
}
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
if ( !cache )
|
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_TRACE0(( "FTC_CMapCache_Lookup: bad arguments, returning 0\n" ));
|
2003-12-24 14:37:58 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-02-23 23:35:26 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
|
2006-02-25 07:24:28 +01:00
|
|
|
|
|
|
|
/*
|
2010-07-04 13:14:18 +02:00
|
|
|
* If cmap_index is greater than the maximum number of cachable
|
|
|
|
* charmaps, we assume the request is from a legacy rogue client
|
|
|
|
* using old internal header. See include/config/ftoption.h.
|
2006-02-25 07:24:28 +01:00
|
|
|
*/
|
2010-07-04 13:14:18 +02:00
|
|
|
if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE && !no_cmap_change )
|
2006-02-23 23:35:26 +01:00
|
|
|
{
|
|
|
|
FTC_OldCMapDesc desc = (FTC_OldCMapDesc) face_id;
|
|
|
|
|
2006-02-25 07:24:28 +01:00
|
|
|
|
2006-02-24 00:18:13 +01:00
|
|
|
char_code = (FT_UInt32)cmap_index;
|
2006-02-23 23:35:26 +01:00
|
|
|
query.face_id = desc->face_id;
|
|
|
|
|
2006-02-23 23:59:52 +01:00
|
|
|
|
2006-02-23 23:35:26 +01:00
|
|
|
switch ( desc->type )
|
|
|
|
{
|
2006-02-25 07:24:28 +01:00
|
|
|
case FTC_OLD_CMAP_BY_INDEX:
|
|
|
|
query.cmap_index = desc->u.index;
|
|
|
|
query.char_code = (FT_UInt32)cmap_index;
|
|
|
|
break;
|
2006-02-23 23:35:26 +01:00
|
|
|
|
2006-02-25 07:24:28 +01:00
|
|
|
case FTC_OLD_CMAP_BY_ENCODING:
|
|
|
|
{
|
|
|
|
FT_Face face;
|
2006-02-23 23:57:31 +01:00
|
|
|
|
|
|
|
|
2006-02-25 07:24:28 +01:00
|
|
|
error = FTC_Manager_LookupFace( cache->manager, desc->face_id,
|
|
|
|
&face );
|
|
|
|
if ( error )
|
|
|
|
return 0;
|
2006-02-24 00:18:13 +01:00
|
|
|
|
2006-02-25 07:24:28 +01:00
|
|
|
FT_Select_Charmap( face, desc->u.encoding );
|
2006-02-23 23:57:31 +01:00
|
|
|
|
2006-02-25 07:24:28 +01:00
|
|
|
return FT_Get_Char_Index( face, char_code );
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 0;
|
2006-02-23 23:35:26 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2006-02-25 07:24:28 +01:00
|
|
|
|
2006-02-23 23:35:26 +01:00
|
|
|
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
|
2006-02-25 07:24:28 +01:00
|
|
|
|
2006-02-23 23:35:26 +01:00
|
|
|
{
|
|
|
|
query.face_id = face_id;
|
|
|
|
query.cmap_index = (FT_UInt)cmap_index;
|
|
|
|
query.char_code = char_code;
|
|
|
|
}
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
hash = FTC_CMAP_HASH( face_id, cmap_index, char_code );
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query,
|
|
|
|
node, error );
|
|
|
|
#else
|
2009-09-27 09:55:44 +02:00
|
|
|
error = FTC_Cache_Lookup( cache, hash, &query, &node );
|
2004-02-01 17:59:06 +01:00
|
|
|
#endif
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
2009-09-28 20:19:47 +02:00
|
|
|
FT_ASSERT( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first ) <
|
|
|
|
FTC_CMAP_INDICES_MAX );
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2006-02-24 00:03:39 +01:00
|
|
|
/* something rotten can happen with rogue clients */
|
2009-09-28 20:19:47 +02:00
|
|
|
if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >=
|
|
|
|
FTC_CMAP_INDICES_MAX ) )
|
2010-07-04 13:14:18 +02:00
|
|
|
return 0; /* XXX: should return appropriate error */
|
2006-02-24 00:03:39 +01:00
|
|
|
|
2009-09-28 20:19:47 +02:00
|
|
|
gindex = FTC_CMAP_NODE( node )->indices[char_code -
|
|
|
|
FTC_CMAP_NODE( node )->first];
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( gindex == FTC_CMAP_UNKNOWN )
|
|
|
|
{
|
2003-12-26 08:26:08 +01:00
|
|
|
FT_Face face;
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
|
|
|
|
gindex = 0;
|
|
|
|
|
2009-09-28 20:19:47 +02:00
|
|
|
error = FTC_Manager_LookupFace( cache->manager,
|
|
|
|
FTC_CMAP_NODE( node )->face_id,
|
|
|
|
&face );
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
2010-07-04 13:14:18 +02:00
|
|
|
#ifdef FT_MAX_CHARMAP_CACHEABLE
|
|
|
|
/* something rotten can happen with rogue clients */
|
|
|
|
if ( cmap_index > FT_MAX_CHARMAP_CACHEABLE )
|
|
|
|
return 0; /* XXX: should return appropriate error */
|
|
|
|
#endif
|
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )
|
|
|
|
{
|
|
|
|
FT_CharMap old, cmap = NULL;
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
old = face->charmap;
|
2003-12-26 08:26:08 +01:00
|
|
|
cmap = face->charmaps[cmap_index];
|
2003-12-24 14:37:58 +01:00
|
|
|
|
2008-09-02 04:34:29 +02:00
|
|
|
if ( old != cmap && !no_cmap_change )
|
2003-12-24 14:37:58 +01:00
|
|
|
FT_Set_Charmap( face, cmap );
|
|
|
|
|
|
|
|
gindex = FT_Get_Char_Index( face, char_code );
|
|
|
|
|
2008-09-02 04:34:29 +02:00
|
|
|
if ( old != cmap && !no_cmap_change )
|
2003-12-24 14:37:58 +01:00
|
|
|
FT_Set_Charmap( face, old );
|
|
|
|
}
|
|
|
|
|
2009-09-28 20:19:47 +02:00
|
|
|
FTC_CMAP_NODE( node )->indices[char_code -
|
|
|
|
FTC_CMAP_NODE( node )->first]
|
|
|
|
= (FT_UShort)gindex;
|
2003-12-24 14:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return gindex;
|
|
|
|
}
|
|
|
|
|
2003-12-26 08:26:08 +01:00
|
|
|
|
2003-12-24 14:37:58 +01:00
|
|
|
/* END */
|