Al-Qurtas-Islamic-bank-The-.../include/freetype/cache/ftcglyph.h

223 lines
8.8 KiB
C
Raw Normal View History

2000-09-16 00:50:59 +02:00
/***************************************************************************/
/* */
/* ftcglyph.h */
/* */
2000-10-12 07:05:40 +02:00
/* FreeType glyph image (FT_Glyph) cache (specification). */
2000-09-16 00:50:59 +02:00
/* */
/* Copyright 2000 by */
/* 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. */
/* */
/***************************************************************************/
2000-10-12 07:05:40 +02:00
/*************************************************************************/
/* */
/* Important: The functions defined in this file are only used to */
/* implement an abstract glyph cache class. You need to */
/* provide additional logic to implement a complete cache. */
/* For example, see `ftcimage.h' and `ftcimage.c' which */
/* implement a FT_Glyph cache based on this code. */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/********* *********/
/********* WARNING, THIS IS ALPHA CODE, THIS API *********/
/********* IS DUE TO CHANGE UNTIL STRICTLY NOTIFIED BY THE *********/
/********* FREETYPE DEVELOPMENT TEAM *********/
/********* *********/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
2000-09-16 00:50:59 +02:00
#ifndef FTCGLYPH_H
#define FTCGLYPH_H
2000-10-12 07:05:40 +02:00
2000-09-16 00:50:59 +02:00
#include <freetype/cache/ftcmanag.h>
#include <freetype/ftglyph.h>
#include <stddef.h>
2000-10-12 07:05:40 +02:00
2000-09-16 00:50:59 +02:00
#ifdef __cplusplus
extern "C" {
#endif
2000-10-12 07:05:40 +02:00
/* maximum number of queues per image cache; must be < 256 */
2000-09-16 00:50:59 +02:00
#define FTC_MAX_GLYPH_QUEUES 16
#define FTC_QUEUE_HASH_SIZE_DEFAULT 64
2000-10-12 07:05:40 +02:00
typedef struct FTC_Glyph_QueueRec_* FTC_Glyph_Queue;
typedef struct FTC_GlyphNodeRec_* FTC_GlyphNode;
typedef struct FTC_Glyph_CacheRec_* FTC_Glyph_Cache;
2000-09-16 00:50:59 +02:00
typedef struct FTC_GlyphNodeRec_
{
FTC_CacheNodeRec root;
/* link.data contains a handle to a FT_Glyph object */
FT_ListNodeRec link;
2000-10-12 03:22:29 +02:00
2000-09-16 00:50:59 +02:00
FT_UShort glyph_index;
FT_UShort queue_index;
2000-10-12 03:22:29 +02:00
2000-09-16 00:50:59 +02:00
} FTC_GlyphNodeRec;
2000-10-12 07:05:40 +02:00
#define FTC_GLYPHNODE_GET_GLYPH( n ) \
( (FT_Glyph)((n)->link.data) )
#define FTC_GLYPHNODE_SET_GLYPH( n, g ) \
do \
{ \
(n)->link.data = (g); \
} while ( 0 )
2000-09-16 00:50:59 +02:00
/* this macro is used to extract a handle to the bucket's lru list */
/* corresponding to a given image node */
#define FTC_GLYPHNODE_TO_LISTNODE( n ) \
( (FT_ListNode)&(n)->link )
/* this macro is used to extract a handle to a given image node from */
2000-10-12 07:05:40 +02:00
/* the corresponding LRU glyph list node. That's a bit hackish... */
#define FTC_LISTNODE_TO_GLYPHNODE( p ) \
( (FTC_GlyphNode)( (char*)(p) - \
2000-09-16 00:50:59 +02:00
offsetof( FTC_GlyphNodeRec,link ) ) )
2000-10-12 07:05:40 +02:00
#define FTC_GLYPHNODE_TO_LRUNODE( n ) ( (FT_ListNode)(n) )
#define FTC_LRUNODE_TO_GLYPHNODE( n ) ( (FTC_GlyphNode)(n) )
2000-09-16 00:50:59 +02:00
2000-10-12 07:05:40 +02:00
/*************************************************************************/
/* */
/* Glyph queue methods. */
/* */
2000-09-16 00:50:59 +02:00
2000-10-12 07:05:40 +02:00
typedef FT_Error (*FTC_Glyph_Queue_InitFunc)( FTC_Glyph_Queue queue,
FT_Pointer type );
2000-10-12 03:22:29 +02:00
2000-10-12 07:05:40 +02:00
typedef void (*FTC_Glyph_Queue_DoneFunc)( FTC_Glyph_Queue queue );
2000-10-12 03:22:29 +02:00
2000-10-12 07:05:40 +02:00
typedef FT_Bool (*FTC_Glyph_Queue_CompareFunc)( FTC_Glyph_Queue queue,
FT_Pointer type );
2000-09-16 00:50:59 +02:00
typedef FT_Error (*FTC_Glyph_Queue_NewNodeFunc)( FTC_Glyph_Queue queue,
FT_UInt gindex,
2000-10-12 07:05:40 +02:00
FTC_GlyphNode* anode );
2000-09-16 00:50:59 +02:00
typedef void (*FTC_Glyph_Queue_DestroyNodeFunc)( FTC_GlyphNode node,
FTC_Glyph_Queue queue );
2000-10-12 03:22:29 +02:00
2000-09-16 00:50:59 +02:00
typedef FT_ULong (*FTC_Glyph_Queue_SizeNodeFunc)( FTC_GlyphNode node,
FTC_Glyph_Queue queue );
2000-10-12 07:05:40 +02:00
typedef struct FTC_Glyph_Queue_Class_
2000-09-16 00:50:59 +02:00
{
FT_UInt queue_byte_size;
2000-10-12 03:22:29 +02:00
2000-09-16 00:50:59 +02:00
FTC_Glyph_Queue_InitFunc init;
FTC_Glyph_Queue_DoneFunc done;
FTC_Glyph_Queue_CompareFunc compare;
FTC_Glyph_Queue_NewNodeFunc new_node;
FTC_Glyph_Queue_SizeNodeFunc size_node;
FTC_Glyph_Queue_DestroyNodeFunc destroy_node;
2000-10-12 03:22:29 +02:00
2000-09-16 00:50:59 +02:00
} FTC_Glyph_Queue_Class;
typedef struct FTC_Glyph_QueueRec_
{
FTC_Glyph_Cache cache;
FTC_Manager manager;
FT_Memory memory;
FTC_Glyph_Queue_Class* clazz;
FTC_Image_Desc descriptor;
FT_UInt hash_size;
FT_List buckets;
FT_UInt queue_index; /* index in parent cache */
} FTC_Glyph_QueueRec;
2000-10-12 07:05:40 +02:00
/* the abstract glyph cache class */
typedef struct FTC_Glyph_Cache_Class_
2000-09-16 00:50:59 +02:00
{
FTC_Cache_Class root;
FTC_Glyph_Queue_Class* queue_class;
2000-10-12 03:22:29 +02:00
2000-09-16 00:50:59 +02:00
} FTC_Glyph_Cache_Class;
2000-10-12 07:05:40 +02:00
/* the abstract glyph cache object */
2000-09-16 00:50:59 +02:00
typedef struct FTC_Glyph_CacheRec_
{
2000-10-12 07:05:40 +02:00
FTC_CacheRec root;
FT_Lru queues_lru; /* static queues lru list */
FTC_Glyph_Queue last_queue; /* small cache */
2000-09-16 00:50:59 +02:00
} FTC_Glyph_CacheRec;
2000-10-12 07:05:40 +02:00
/*************************************************************************/
/* */
/* These functions are exported so that they can be called from */
/* user-provided cache classes; otherwise, they are really parts of the */
/* cache sub-system internals. */
/* */
2000-09-16 00:50:59 +02:00
2000-10-12 07:05:40 +02:00
FT_EXPORT_FUNC( void ) FTC_GlyphNode_Init( FTC_GlyphNode node,
FTC_Glyph_Queue queue,
FT_UInt gindex );
2000-10-12 03:22:29 +02:00
2000-10-12 07:05:40 +02:00
#define FTC_GlyphNode_Ref( n ) \
FTC_CACHENODE_TO_DATA_P( &(n)->root )->ref_count++
2000-09-16 00:50:59 +02:00
2000-10-12 07:05:40 +02:00
#define FTC_GlyphNode_Unref( n ) \
FTC_CACHENODE_TO_DATA_P( &(n)->root )->ref_count--
2000-09-16 00:50:59 +02:00
2000-10-12 07:05:40 +02:00
FT_EXPORT_DEF( void ) FTC_Destroy_Glyph_Node( FTC_GlyphNode node,
FTC_Glyph_Cache cache );
2000-09-16 00:50:59 +02:00
2000-10-12 07:05:40 +02:00
FT_EXPORT_DEF( FT_Error ) FTC_Glyph_Cache_Init( FTC_Glyph_Cache cache );
2000-09-16 00:50:59 +02:00
2000-10-12 07:05:40 +02:00
FT_EXPORT_DEF( void ) FTC_Glyph_Cache_Done( FTC_Glyph_Cache cache );
2000-09-16 00:50:59 +02:00
2000-10-12 07:05:40 +02:00
FT_EXPORT_DEF( FT_Error ) FTC_Glyph_Queue_New( FTC_Glyph_Cache cache,
FT_Pointer type,
FTC_Glyph_Queue* aqueue );
2000-09-16 00:50:59 +02:00
2000-10-12 07:05:40 +02:00
FT_EXPORT_DEF( FT_Error ) FTC_Glyph_Queue_Lookup_Node(
FTC_Glyph_Queue queue,
FT_UInt glyph_index,
FTC_GlyphNode* anode );
2000-09-16 00:50:59 +02:00
#ifdef __cplusplus
}
#endif
#endif /* FTCIMAGE_H */
/* END */