adding updated cache header files
This commit is contained in:
parent
d38a4f6593
commit
9b11b9e3e4
|
@ -0,0 +1,211 @@
|
||||||
|
/***************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* ftcglyph.h */
|
||||||
|
/* */
|
||||||
|
/* FreeType glyph image (FT_Glyph) cache.. */
|
||||||
|
/* */
|
||||||
|
/* 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. */
|
||||||
|
/* */
|
||||||
|
/* */
|
||||||
|
/* 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 **********/
|
||||||
|
/********* **********/
|
||||||
|
/**************************************************************************/
|
||||||
|
/**************************************************************************/
|
||||||
|
/**************************************************************************/
|
||||||
|
/**************************************************************************/
|
||||||
|
/**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef FTCGLYPH_H
|
||||||
|
#define FTCGLYPH_H
|
||||||
|
|
||||||
|
#include <freetype/cache/ftcmanag.h>
|
||||||
|
#include <freetype/ftglyph.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* maximum number of queues per image cache, must be < 256 */
|
||||||
|
#define FTC_MAX_GLYPH_QUEUES 16
|
||||||
|
|
||||||
|
#define FTC_QUEUE_HASH_SIZE_DEFAULT 64
|
||||||
|
|
||||||
|
typedef struct FTC_Glyph_QueueRec_* FTC_Glyph_Queue;
|
||||||
|
typedef struct FTC_GlyphNodeRec_* FTC_GlyphNode;
|
||||||
|
typedef struct FTC_Glyph_CacheRec_* FTC_Glyph_Cache;
|
||||||
|
|
||||||
|
typedef struct FTC_GlyphNodeRec_
|
||||||
|
{
|
||||||
|
FTC_CacheNodeRec root;
|
||||||
|
|
||||||
|
/* link.data contains a handle to a FT_Glyph object */
|
||||||
|
FT_ListNodeRec link;
|
||||||
|
|
||||||
|
FT_UShort glyph_index;
|
||||||
|
FT_UShort queue_index;
|
||||||
|
|
||||||
|
} FTC_GlyphNodeRec;
|
||||||
|
|
||||||
|
|
||||||
|
#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)
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
/* the corresponding LRU glyph list node. That's a bit hackish.. */
|
||||||
|
#define FTC_LISTNODE_TO_GLYPHNODE( p ) \
|
||||||
|
( (FTC_GlyphNode)( (char*)(p) - \
|
||||||
|
offsetof( FTC_GlyphNodeRec,link ) ) )
|
||||||
|
|
||||||
|
#define FTC_GLYPHNODE_TO_LRUNODE(n) ((FT_ListNode)(n))
|
||||||
|
#define FTC_LRUNODE_TO_GLYPHNODE(n) ((FTC_GlyphNode)(n))
|
||||||
|
|
||||||
|
|
||||||
|
/* glyph queue methods *****************************************************/
|
||||||
|
|
||||||
|
typedef FT_Error (*FTC_Glyph_Queue_InitFunc) ( FTC_Glyph_Queue queue,
|
||||||
|
FT_Pointer type );
|
||||||
|
|
||||||
|
typedef void (*FTC_Glyph_Queue_DoneFunc) ( FTC_Glyph_Queue queue );
|
||||||
|
|
||||||
|
typedef FT_Bool (*FTC_Glyph_Queue_CompareFunc)( FTC_Glyph_Queue queue,
|
||||||
|
FT_Pointer type );
|
||||||
|
|
||||||
|
typedef FT_Error (*FTC_Glyph_Queue_NewNodeFunc)( FTC_Glyph_Queue queue,
|
||||||
|
FT_UInt gindex,
|
||||||
|
FTC_GlyphNode *anode );
|
||||||
|
|
||||||
|
typedef void (*FTC_Glyph_Queue_DestroyNodeFunc)( FTC_GlyphNode node,
|
||||||
|
FTC_Glyph_Queue queue );
|
||||||
|
|
||||||
|
|
||||||
|
typedef FT_ULong (*FTC_Glyph_Queue_SizeNodeFunc)( FTC_GlyphNode node,
|
||||||
|
FTC_Glyph_Queue queue );
|
||||||
|
|
||||||
|
typedef struct FTC_Glyph_Queue_Class_
|
||||||
|
{
|
||||||
|
FT_UInt queue_byte_size;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
} 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;
|
||||||
|
|
||||||
|
|
||||||
|
/* the abstract glyph cache class */
|
||||||
|
typedef struct FTC_Glyph_Cache_Class_
|
||||||
|
{
|
||||||
|
FTC_Cache_Class root;
|
||||||
|
FTC_Glyph_Queue_Class* queue_class;
|
||||||
|
|
||||||
|
} FTC_Glyph_Cache_Class;
|
||||||
|
|
||||||
|
|
||||||
|
/* the abstract glyph cache object */
|
||||||
|
typedef struct FTC_Glyph_CacheRec_
|
||||||
|
{
|
||||||
|
FTC_CacheRec root;
|
||||||
|
FT_Lru queues_lru; /* static queues lru list */
|
||||||
|
FTC_Glyph_Queue last_queue; /* small cache */
|
||||||
|
|
||||||
|
} FTC_Glyph_CacheRec;
|
||||||
|
|
||||||
|
|
||||||
|
/* these function are exported so that they can be called from */
|
||||||
|
/* user-provided cache classes.. otherwise, they're really */
|
||||||
|
/* pars of the cache sub-system internals.. */
|
||||||
|
/* */
|
||||||
|
|
||||||
|
FT_EXPORT_FUNC(void) FTC_GlyphNode_Init( FTC_GlyphNode node,
|
||||||
|
FTC_Glyph_Queue queue,
|
||||||
|
FT_UInt gindex );
|
||||||
|
|
||||||
|
#define FTC_GlyphNode_Ref(n) \
|
||||||
|
FTC_CACHENODE_TO_DATA_P(&(n)->root)->ref_count++
|
||||||
|
|
||||||
|
#define FTC_GlyphNode_Unref(n) \
|
||||||
|
FTC_CACHENODE_TO_DATA_P(&(n)->root)->ref_count--
|
||||||
|
|
||||||
|
|
||||||
|
FT_EXPORT_DEF(void) FTC_Destroy_Glyph_Node( FTC_GlyphNode node,
|
||||||
|
FTC_Glyph_Cache cache );
|
||||||
|
|
||||||
|
|
||||||
|
FT_EXPORT_DEF(FT_Error) FTC_Glyph_Cache_Init( FTC_Glyph_Cache cache );
|
||||||
|
|
||||||
|
FT_EXPORT_DEF(void) FTC_Glyph_Cache_Done( FTC_Glyph_Cache cache );
|
||||||
|
|
||||||
|
FT_EXPORT_DEF(FT_Error) FTC_Glyph_Queue_New(
|
||||||
|
FTC_Glyph_Cache cache,
|
||||||
|
FT_Pointer type,
|
||||||
|
FTC_Glyph_Queue *aqueue );
|
||||||
|
|
||||||
|
FT_EXPORT_DEF(FT_Error) FTC_Glyph_Queue_Lookup_Node(
|
||||||
|
FTC_Glyph_Queue queue,
|
||||||
|
FT_UInt glyph_index,
|
||||||
|
FTC_GlyphNode* anode );
|
||||||
|
|
||||||
|
|
||||||
|
FT_EXPORT_DEF(FT_Error) FTC_Glyph_Cache_Init( FTC_Glyph_Cache cache );
|
||||||
|
|
||||||
|
FT_EXPORT_DEF(void) FTC_Glyph_Cache_Done( FTC_Glyph_Cache cache );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FTCIMAGE_H */
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
|
@ -220,7 +220,7 @@
|
||||||
/* */
|
/* */
|
||||||
/* This must be greater than 4kByte. */
|
/* This must be greater than 4kByte. */
|
||||||
/* */
|
/* */
|
||||||
#define FT_RENDER_POOL_SIZE 16384
|
#define FT_RENDER_POOL_SIZE 32768
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -310,7 +310,7 @@
|
||||||
/* By undefining this, you will only compile the code necessary to load */
|
/* By undefining this, you will only compile the code necessary to load */
|
||||||
/* TrueType glyphs without hinting. */
|
/* TrueType glyphs without hinting. */
|
||||||
/* */
|
/* */
|
||||||
#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
|
@ -98,11 +98,12 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Struct> */
|
/* <Struct> */
|
||||||
/* FTC_SizeRec */
|
/* FTC_FontRec */
|
||||||
/* */
|
/* */
|
||||||
/* <Description> */
|
/* <Description> */
|
||||||
/* A simple structure used to describe a given `font size' to the */
|
/* A simple structure used to describe a given `font' to the cache */
|
||||||
/* cache manager. */
|
/* manager. Note that a "font" is the combination of a given face */
|
||||||
|
/* with a given character size.. */
|
||||||
/* */
|
/* */
|
||||||
/* <Fields> */
|
/* <Fields> */
|
||||||
/* face_id :: The ID of the face to use. */
|
/* face_id :: The ID of the face to use. */
|
||||||
|
@ -111,24 +112,24 @@
|
||||||
/* */
|
/* */
|
||||||
/* pix_height :: The character height in integer pixels. */
|
/* pix_height :: The character height in integer pixels. */
|
||||||
/* */
|
/* */
|
||||||
typedef struct FTC_SizeRec_
|
typedef struct FTC_FontRec_
|
||||||
{
|
{
|
||||||
FTC_FaceID face_id;
|
FTC_FaceID face_id;
|
||||||
FT_UShort pix_width;
|
FT_UShort pix_width;
|
||||||
FT_UShort pix_height;
|
FT_UShort pix_height;
|
||||||
|
|
||||||
} FTC_SizeRec;
|
} FTC_FontRec;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Type> */
|
/* <Type> */
|
||||||
/* FTC_SizeID */
|
/* FTC_Font */
|
||||||
/* */
|
/* */
|
||||||
/* <Description> */
|
/* <Description> */
|
||||||
/* A simple handle to a FTC_SizeRec structure. */
|
/* A simple handle to a FTC_FontRec structure. */
|
||||||
/* */
|
/* */
|
||||||
typedef FTC_SizeRec* FTC_SizeID;
|
typedef FTC_FontRec* FTC_Font;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -171,6 +172,9 @@
|
||||||
/* max_sizes :: Maximum number of sizes to keep alive in manager. */
|
/* max_sizes :: Maximum number of sizes to keep alive in manager. */
|
||||||
/* Use 0 for defaults. */
|
/* Use 0 for defaults. */
|
||||||
/* */
|
/* */
|
||||||
|
/* max_bytes :: Maximum number of bytes to use for cached data. */
|
||||||
|
/* Use 0 for defaults. */
|
||||||
|
/* */
|
||||||
/* requester :: An application-provided callback used to translate */
|
/* requester :: An application-provided callback used to translate */
|
||||||
/* face IDs into real FT_Face objects. */
|
/* face IDs into real FT_Face objects. */
|
||||||
/* */
|
/* */
|
||||||
|
@ -187,6 +191,7 @@
|
||||||
FT_EXPORT_DEF( FT_Error ) FTC_Manager_New( FT_Library library,
|
FT_EXPORT_DEF( FT_Error ) FTC_Manager_New( FT_Library library,
|
||||||
FT_UInt max_faces,
|
FT_UInt max_faces,
|
||||||
FT_UInt max_sizes,
|
FT_UInt max_sizes,
|
||||||
|
FT_ULong max_bytes,
|
||||||
FTC_Face_Requester requester,
|
FTC_Face_Requester requester,
|
||||||
FT_Pointer req_data,
|
FT_Pointer req_data,
|
||||||
FTC_Manager* amanager );
|
FTC_Manager* amanager );
|
||||||
|
@ -298,11 +303,24 @@
|
||||||
/* that you can call FT_Load_Glyph() with the face if you need to. */
|
/* that you can call FT_Load_Glyph() with the face if you need to. */
|
||||||
/* */
|
/* */
|
||||||
FT_EXPORT_DEF( FT_Error ) FTC_Manager_Lookup_Size( FTC_Manager manager,
|
FT_EXPORT_DEF( FT_Error ) FTC_Manager_Lookup_Size( FTC_Manager manager,
|
||||||
FTC_SizeID size_id,
|
FTC_Font font,
|
||||||
FT_Face* aface,
|
FT_Face* aface,
|
||||||
FT_Size* asize );
|
FT_Size* asize );
|
||||||
|
|
||||||
|
|
||||||
|
/* a cache class is used to describe a unique cache type to the */
|
||||||
|
/* manager.. */
|
||||||
|
typedef struct FTC_Cache_Class_ FTC_Cache_Class;
|
||||||
|
typedef struct FTC_CacheRec_* FTC_Cache;
|
||||||
|
|
||||||
|
|
||||||
|
/* this must be used internally for the moment */
|
||||||
|
FT_EXPORT_DEF( FT_Error ) FTC_Manager_Register_Cache(
|
||||||
|
FTC_Manager manager,
|
||||||
|
FTC_Cache_Class* clazz,
|
||||||
|
FTC_Cache *acache );
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -375,7 +393,7 @@
|
||||||
/* */
|
/* */
|
||||||
typedef struct FTC_Image_Desc_
|
typedef struct FTC_Image_Desc_
|
||||||
{
|
{
|
||||||
FTC_SizeRec size;
|
FTC_FontRec font;
|
||||||
FT_UInt image_type;
|
FT_UInt image_type;
|
||||||
|
|
||||||
} FTC_Image_Desc;
|
} FTC_Image_Desc;
|
||||||
|
@ -405,9 +423,6 @@
|
||||||
/* <Input> */
|
/* <Input> */
|
||||||
/* manager :: The parent manager for the image cache. */
|
/* manager :: The parent manager for the image cache. */
|
||||||
/* */
|
/* */
|
||||||
/* max_bytes :: The maximum amount of memory that will be used to */
|
|
||||||
/* store glyph images. */
|
|
||||||
/* */
|
|
||||||
/* <Output> */
|
/* <Output> */
|
||||||
/* acache :: A handle to the new glyph image cache object. */
|
/* acache :: A handle to the new glyph image cache object. */
|
||||||
/* */
|
/* */
|
||||||
|
@ -415,24 +430,9 @@
|
||||||
/* FreeType error code. 0 means success. */
|
/* FreeType error code. 0 means success. */
|
||||||
/* */
|
/* */
|
||||||
FT_EXPORT_DEF( FT_Error ) FTC_Image_Cache_New( FTC_Manager manager,
|
FT_EXPORT_DEF( FT_Error ) FTC_Image_Cache_New( FTC_Manager manager,
|
||||||
FT_ULong max_bytes,
|
|
||||||
FTC_Image_Cache* acache );
|
FTC_Image_Cache* acache );
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* FTC_Image_Cache_Done */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* Destroys a given glyph image cache (and all glyphs within it). */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* manager :: The parent manager for the image cache. */
|
|
||||||
/* */
|
|
||||||
FT_EXPORT_DEF( void ) FTC_Image_Cache_Done( FTC_Image_Cache cache );
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Function> */
|
/* <Function> */
|
||||||
|
|
|
@ -163,6 +163,11 @@
|
||||||
FT_ERRORDEF( FT_Err_Raster_Negative_Height, 0x0063, \
|
FT_ERRORDEF( FT_Err_Raster_Negative_Height, 0x0063, \
|
||||||
"negative height while rastering" )
|
"negative height while rastering" )
|
||||||
|
|
||||||
|
/* cache errors */
|
||||||
|
|
||||||
|
FT_ERRORDEF( FT_Err_Too_Many_Caches, 0x0070, \
|
||||||
|
"too many registered caches" )
|
||||||
|
|
||||||
/* range 0x400 - 0x4FF is reserved for TrueType specific stuff */
|
/* range 0x400 - 0x4FF is reserved for TrueType specific stuff */
|
||||||
|
|
||||||
/* range 0x500 - 0x5FF is reserved for CFF specific stuff */
|
/* range 0x500 - 0x5FF is reserved for CFF specific stuff */
|
||||||
|
|
|
@ -63,6 +63,9 @@
|
||||||
trace_raster, /* rasterizer (ftraster.c) */
|
trace_raster, /* rasterizer (ftraster.c) */
|
||||||
trace_stream, /* stream manager (ftstream.c) */
|
trace_stream, /* stream manager (ftstream.c) */
|
||||||
|
|
||||||
|
/* Cache sub-system */
|
||||||
|
trace_cache,
|
||||||
|
|
||||||
/* SFNT driver components */
|
/* SFNT driver components */
|
||||||
trace_sfobjs, /* SFNT object handler (sfobjs.c) */
|
trace_sfobjs, /* SFNT object handler (sfobjs.c) */
|
||||||
trace_ttcmap, /* charmap handler (ttcmap.c) */
|
trace_ttcmap, /* charmap handler (ttcmap.c) */
|
||||||
|
|
Loading…
Reference in New Issue