2000-10-28 15:17:11 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftcchunk.h */
|
|
|
|
/* */
|
|
|
|
/* FreeType chunk cache (specification). */
|
|
|
|
/* */
|
2001-06-28 19:49:10 +02:00
|
|
|
/* Copyright 2000-2001 by */
|
2000-10-28 15:17:11 +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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Important: The functions defined in this file are only used to */
|
|
|
|
/* implement an abstract chunk cache class. You need to */
|
|
|
|
/* provide additional logic to implement a complete cache. */
|
|
|
|
/* For example, see `ftcmetrx.h' and `ftcmetrx.c' which */
|
|
|
|
/* implement a glyph metrics cache based on this code. */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/********* *********/
|
2000-11-08 01:24:58 +01:00
|
|
|
/********* WARNING, THIS IS BETA CODE. *********/
|
2000-10-28 15:17:11 +02:00
|
|
|
/********* *********/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#ifndef __FTCCHUNK_H__
|
|
|
|
#define __FTCCHUNK_H__
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2000-12-04 23:53:55 +01:00
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_CACHE_H
|
|
|
|
#include FT_CACHE_MANAGER_H
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_BEGIN_HEADER
|
2000-10-28 15:17:11 +02:00
|
|
|
|
|
|
|
|
2000-10-31 18:49:07 +01:00
|
|
|
/* maximum number of chunk sets in a given chunk cache */
|
2000-12-14 00:44:37 +01:00
|
|
|
#define FTC_MAX_CHUNK_SETS 16
|
2000-10-28 15:17:11 +02:00
|
|
|
|
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
typedef struct FTC_ChunkNodeRec_* FTC_ChunkNode;
|
2000-10-28 15:17:11 +02:00
|
|
|
typedef struct FTC_ChunkSetRec_* FTC_ChunkSet;
|
2001-10-26 18:58:27 +02:00
|
|
|
typedef struct FTC_ChunkCacheRec_* FTC_ChunkCache;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 18:49:07 +01:00
|
|
|
typedef struct FTC_ChunkNodeRec_
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2001-10-26 18:58:27 +02:00
|
|
|
FTC_NodeRec node;
|
|
|
|
FTC_ChunkSet cset;
|
|
|
|
FT_UShort item_count;
|
|
|
|
FT_UShort item_start;
|
|
|
|
FT_Byte* items;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
} FTC_ChunkNodeRec;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2001-10-26 18:58:27 +02:00
|
|
|
#define FTC_CHUNK_NODE(x) ((FTC_ChunkNode)(x))
|
2000-10-31 18:49:07 +01:00
|
|
|
|
2001-10-26 18:58:27 +02:00
|
|
|
/* a chunk set is used to categorize chunks of a given type */
|
|
|
|
typedef struct FTC_ChunkSetRec_
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2001-10-26 18:58:27 +02:00
|
|
|
FT_LruNodeRec lru;
|
|
|
|
FT_UFast hash;
|
|
|
|
FTC_ChunkCache ccache;
|
|
|
|
FT_Fast num_chunks;
|
|
|
|
FT_UInt item_total; /* total number of glyphs in set */
|
|
|
|
FT_UInt item_size; /* size of each glyph item in set */
|
|
|
|
FT_UInt item_count; /* number of glyph items per chunk */
|
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
} FTC_ChunkSetRec;
|
|
|
|
|
2001-10-26 18:58:27 +02:00
|
|
|
#define FTC_CHUNK_SET(x) ((FTC_ChunkSet)(x))
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2001-10-26 18:58:27 +02:00
|
|
|
#define FTC_CHUNK_SET_MEMORY(x) ((x)->ccache->cache.memory)
|
|
|
|
|
|
|
|
/* the abstract chunk cache class */
|
|
|
|
typedef struct FTC_ChunkCacheRec_
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2001-10-26 18:58:27 +02:00
|
|
|
FTC_CacheRec cache;
|
|
|
|
FT_LruList cset_lru; /* LRU list of chunk sets */
|
|
|
|
|
|
|
|
} FTC_ChunkCacheRec;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2001-10-26 18:58:27 +02:00
|
|
|
#define FTC_CHUNK_CACHE(x) ((FTC_ChunkCache)(x))
|
2000-10-28 15:17:11 +02:00
|
|
|
|
|
|
|
|
2001-10-26 18:58:27 +02:00
|
|
|
typedef struct FTC_ChunkQueryRec_
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2001-10-26 18:58:27 +02:00
|
|
|
/* input */
|
|
|
|
FT_UInt gindex; /* glyph index */
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2001-10-26 18:58:27 +02:00
|
|
|
/* output */
|
|
|
|
FTC_ChunkSet cset;
|
|
|
|
|
|
|
|
} FTC_ChunkQueryRec, *FTC_ChunkQuery;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 18:49:07 +01:00
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* These functions are exported so that they can be called from */
|
2000-10-31 18:49:07 +01:00
|
|
|
/* user-provided cache classes; otherwise, they are really part of the */
|
2000-10-28 15:17:11 +02:00
|
|
|
/* cache sub-system internals. */
|
|
|
|
/* */
|
|
|
|
|
2001-06-28 19:49:10 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
2001-10-26 18:58:27 +02:00
|
|
|
ftc_chunk_node_init( FTC_ChunkNode node,
|
|
|
|
FTC_ChunkSet cset,
|
|
|
|
FT_UInt index,
|
|
|
|
FT_Bool alloc );
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-11-06 20:29:06 +01:00
|
|
|
/* chunk set objects */
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2001-06-28 19:49:10 +02:00
|
|
|
FT_EXPORT( void )
|
2001-10-26 18:58:27 +02:00
|
|
|
ftc_chunk_node_done( FTC_ChunkNode node );
|
2000-10-28 15:17:11 +02:00
|
|
|
|
|
|
|
|
2001-06-28 19:49:10 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
2001-10-26 18:58:27 +02:00
|
|
|
ftc_chunk_set_init( FTC_ChunkSet cset,
|
|
|
|
FT_UInt item_size,
|
|
|
|
FT_UInt item_count,
|
|
|
|
FT_UInt item_total,
|
|
|
|
FTC_ChunkCache cache );
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2001-10-26 18:58:27 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
ftc_chunk_set_done( FTC_ChunkSet cset );
|
2000-11-06 20:29:06 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* chunk cache objects */
|
|
|
|
|
2001-06-28 19:49:10 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
2001-10-26 18:58:27 +02:00
|
|
|
ftc_chunk_cache_init( FTC_ChunkCache cache,
|
|
|
|
FT_LruList_Class cset_class );
|
2000-11-06 20:29:06 +01:00
|
|
|
|
2001-06-28 19:49:10 +02:00
|
|
|
FT_EXPORT( void )
|
2001-10-26 18:58:27 +02:00
|
|
|
ftc_chunk_cache_done( FTC_ChunkCache cache );
|
|
|
|
|
2000-11-06 20:29:06 +01:00
|
|
|
|
2001-06-28 19:49:10 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
2001-10-26 18:58:27 +02:00
|
|
|
ftc_chunk_cache_lookup( FTC_ChunkCache cache,
|
|
|
|
FTC_ChunkQuery query,
|
|
|
|
FTC_ChunkNode *anode );
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2001-10-26 18:58:27 +02:00
|
|
|
/* */
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_END_HEADER
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#endif /* __FTCCHUNK_H__ */
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 18:49:07 +01:00
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
/* END */
|