Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
FreeType
FreeType
Commits
71441881
Commit
71441881
authored
Sep 15, 2000
by
David Turner
Browse files
adding updated cache header files
parent
2c4a21d3
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/freetype/cache/ftcglyph.h
0 → 100644
View file @
71441881
/***************************************************************************/
/* */
/* 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 */
include/freetype/config/ftoption.h
View file @
71441881
...
...
@@ -220,7 +220,7 @@
/* */
/* 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 */
/* TrueType glyphs without hinting. */
/* */
#
un
def TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#def
ine
TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/*************************************************************************/
...
...
include/freetype/ftcache.h
View file @
71441881
...
...
@@ -98,11 +98,12 @@
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_
Size
Rec */
/* FTC_
Font
Rec */
/* */
/* <Description> */
/* A simple structure used to describe a given `font size' to the */
/* cache manager. */
/* A simple structure used to describe a given `font' to the cache */
/* manager. Note that a "font" is the combination of a given face */
/* with a given character size.. */
/* */
/* <Fields> */
/* face_id :: The ID of the face to use. */
...
...
@@ -111,24 +112,24 @@
/* */
/* pix_height :: The character height in integer pixels. */
/* */
typedef
struct
FTC_
Size
Rec_
typedef
struct
FTC_
Font
Rec_
{
FTC_FaceID
face_id
;
FT_UShort
pix_width
;
FT_UShort
pix_height
;
}
FTC_
Size
Rec
;
}
FTC_
Font
Rec
;
/*************************************************************************/
/* */
/* <Type> */
/* FTC_
SizeID
*/
/* FTC_
Font
*/
/* */
/* <Description> */
/* A simple handle to a FTC_
Size
Rec structure. */
/* A simple handle to a FTC_
Font
Rec structure. */
/* */
typedef
FTC_
Size
Rec
*
FTC_
SizeID
;
typedef
FTC_
Font
Rec
*
FTC_
Font
;
/*************************************************************************/
...
...
@@ -171,6 +172,9 @@
/* max_sizes :: Maximum number of sizes to keep alive in manager. */
/* 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 */
/* face IDs into real FT_Face objects. */
/* */
...
...
@@ -187,6 +191,7 @@
FT_EXPORT_DEF
(
FT_Error
)
FTC_Manager_New
(
FT_Library
library
,
FT_UInt
max_faces
,
FT_UInt
max_sizes
,
FT_ULong
max_bytes
,
FTC_Face_Requester
requester
,
FT_Pointer
req_data
,
FTC_Manager
*
amanager
);
...
...
@@ -298,10 +303,23 @@
/* 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
,
FTC_
SizeID
size_id
,
FTC_
Font
font
,
FT_Face
*
aface
,
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
);
/*************************************************************************/
/*************************************************************************/
...
...
@@ -349,12 +367,12 @@
ftc_image_flag_unscaled
=
128
,
ftc_image_flag_no_sbits
=
256
,
ftc_image_mono
=
ftc_image_format_bitmap
|
ftc_image_flag_monochrome
,
/* monochrome bitmap */
ftc_image_mono
=
ftc_image_format_bitmap
|
ftc_image_flag_monochrome
,
/* monochrome bitmap */
ftc_image_grays
=
ftc_image_format_bitmap
,
/* anti-aliased bitmap */
ftc_image_grays
=
ftc_image_format_bitmap
,
/* anti-aliased bitmap */
ftc_image_outline
=
ftc_image_format_outline
/* scaled outline */
ftc_image_outline
=
ftc_image_format_outline
/* scaled outline */
}
FTC_Image_Type
;
...
...
@@ -375,7 +393,7 @@
/* */
typedef
struct
FTC_Image_Desc_
{
FTC_
Size
Rec
size
;
FTC_
Font
Rec
font
;
FT_UInt
image_type
;
}
FTC_Image_Desc
;
...
...
@@ -405,9 +423,6 @@
/* <Input> */
/* manager :: The parent manager for the image cache. */
/* */
/* max_bytes :: The maximum amount of memory that will be used to */
/* store glyph images. */
/* */
/* <Output> */
/* acache :: A handle to the new glyph image cache object. */
/* */
...
...
@@ -415,24 +430,9 @@
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT_DEF
(
FT_Error
)
FTC_Image_Cache_New
(
FTC_Manager
manager
,
FT_ULong
max_bytes
,
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> */
...
...
include/freetype/fterrors.h
View file @
71441881
...
...
@@ -163,6 +163,11 @@
FT_ERRORDEF
(
FT_Err_Raster_Negative_Height
,
0x0063
,
\
"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 0x500 - 0x5FF is reserved for CFF specific stuff */
...
...
include/freetype/internal/ftdebug.h
View file @
71441881
...
...
@@ -63,6 +63,9 @@
trace_raster
,
/* rasterizer (ftraster.c) */
trace_stream
,
/* stream manager (ftstream.c) */
/* Cache sub-system */
trace_cache
,
/* SFNT driver components */
trace_sfobjs
,
/* SFNT object handler (sfobjs.c) */
trace_ttcmap
,
/* charmap handler (ttcmap.c) */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment