2000-10-29 01:34:45 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
2000-12-09 01:45:38 +01:00
|
|
|
/* ftcimage.h */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* FreeType Image cache (specification). */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
2001-06-28 19:49:10 +02:00
|
|
|
/* Copyright 2000-2001 by */
|
2000-10-29 01:34:45 +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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
2000-10-31 18:49:07 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Each image cache really manages FT_Glyph objects. */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#ifndef __FTCIMAGE_H__
|
|
|
|
#define __FTCIMAGE_H__
|
2000-10-29 01:34:45 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_CACHE_H
|
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
|
|
|
|
FT_BEGIN_HEADER
|
2000-10-29 01:34:45 +02:00
|
|
|
|
|
|
|
|
2001-01-11 10:27:49 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Section> */
|
|
|
|
/* cache_subsystem */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2001-06-28 19:49:10 +02:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** IMAGE CACHE OBJECT *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
2000-12-14 00:44:37 +01:00
|
|
|
#define FTC_IMAGE_FORMAT( x ) ( (x) & 7 )
|
2000-10-29 01:34:45 +02:00
|
|
|
|
|
|
|
|
2001-12-20 18:49:10 +01:00
|
|
|
#define ftc_image_format_bitmap 0x0000
|
|
|
|
#define ftc_image_format_outline 0x0001
|
2000-10-29 01:34:45 +02:00
|
|
|
|
2001-12-20 18:49:10 +01:00
|
|
|
#define ftc_image_format_mask 0x000F
|
2001-12-05 18:24:34 +01:00
|
|
|
|
2001-12-20 18:49:10 +01:00
|
|
|
#define ftc_image_flag_monochrome 0x0010
|
|
|
|
#define ftc_image_flag_unhinted 0x0020
|
|
|
|
#define ftc_image_flag_autohinted 0x0040
|
|
|
|
#define ftc_image_flag_unscaled 0x0080
|
|
|
|
#define ftc_image_flag_no_sbits 0x0100
|
2000-10-29 01:34:45 +02:00
|
|
|
|
2000-10-31 18:49:07 +01:00
|
|
|
/* monochrome bitmap */
|
2000-12-14 00:44:37 +01:00
|
|
|
#define ftc_image_mono ftc_image_format_bitmap | \
|
2001-01-10 12:15:48 +01:00
|
|
|
ftc_image_flag_monochrome
|
2001-12-05 18:24:34 +01:00
|
|
|
|
2000-10-31 18:49:07 +01:00
|
|
|
/* anti-aliased bitmap */
|
2000-12-14 00:44:37 +01:00
|
|
|
#define ftc_image_grays ftc_image_format_bitmap
|
2001-12-05 16:59:33 +01:00
|
|
|
|
2000-10-31 18:49:07 +01:00
|
|
|
/* scaled outline */
|
2000-12-14 00:44:37 +01:00
|
|
|
#define ftc_image_outline ftc_image_format_outline
|
2000-10-29 01:34:45 +02:00
|
|
|
|
|
|
|
|
2001-12-05 16:59:33 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Struct> */
|
|
|
|
/* FTC_ImageDesc */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A simple structure used to describe a given glyph image category. */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* Note that this is different from @FTC_Image_Desc. */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
|
|
|
/* <Fields> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* size :: An @FTC_SizeRec used to describe the glyph's face and */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* size. */
|
|
|
|
/* */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* type :: The glyph image's type. Note that it is a 32-bit uint. */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* This type deprecates @FTC_Image_Desc. */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
|
|
|
typedef struct FTC_ImageDesc_
|
|
|
|
{
|
|
|
|
FTC_FontRec font;
|
|
|
|
FT_UInt32 type;
|
|
|
|
|
|
|
|
} FTC_ImageDesc;
|
|
|
|
|
|
|
|
/* */
|
|
|
|
|
2001-12-20 18:49:10 +01:00
|
|
|
#define FTC_IMAGE_DESC_COMPARE( d1, d2 ) \
|
|
|
|
( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
|
|
|
|
(d1)->type == (d2)->type )
|
|
|
|
|
|
|
|
#define FTC_IMAGE_DESC_HASH( d ) \
|
|
|
|
(FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \
|
|
|
|
( (d)->type << 4 ) )
|
|
|
|
|
2001-12-05 16:59:33 +01:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Type> */
|
|
|
|
/* FTC_ImageCache */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A handle to an glyph image cache object. They are designed to */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* hold many distinct glyph images while not exceeding a certain */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* memory threshold. */
|
|
|
|
/* */
|
|
|
|
typedef struct FTC_ImageCacheRec_* FTC_ImageCache;
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_ImageCache_New */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Creates a new glyph image cache. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* manager :: The parent manager for the image cache. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* acache :: A handle to the new glyph image cache object. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* FreeType error code. 0 means success. */
|
|
|
|
/* */
|
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_ImageCache_New( FTC_Manager manager,
|
|
|
|
FTC_ImageCache *acache );
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_ImageCache_Lookup */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* Retrieves a given glyph image from a glyph image cache and */
|
|
|
|
/* `acquires' it. This prevents the glyph image from being flushed */
|
|
|
|
/* out of the cache, until @FTC_Image_Cache_Release is called. */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* cache :: A handle to the source glyph image cache. */
|
|
|
|
/* */
|
|
|
|
/* desc :: A pointer to a glyph image descriptor. */
|
|
|
|
/* */
|
|
|
|
/* gindex :: The glyph index to retrieve. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* failure. */
|
|
|
|
/* */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* anode :: An opaque cache node pointer that will be used to */
|
|
|
|
/* release the glyph once it becomes unuseful. Can be */
|
|
|
|
/* NULL, in which case this function will have the same */
|
|
|
|
/* effect as @FTC_Image_Cache_Release. XXX */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* FreeType error code. 0 means success. */
|
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* The returned glyph is owned and managed by the glyph image cache. */
|
|
|
|
/* Never try to transform or discard it manually! You can however */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* create a copy with @FT_Glyph_Copy and modify the new one. */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
|
|
|
/* Because the glyph image cache limits the total amount of memory */
|
|
|
|
/* taken by the glyphs it holds, the returned glyph might disappear */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* on a later invocation of this function! It is a cache after */
|
|
|
|
/* all... */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_ImageCache_Lookup( FTC_ImageCache cache,
|
|
|
|
FTC_ImageDesc* desc,
|
2001-12-20 18:49:10 +01:00
|
|
|
FT_UInt gindex,
|
|
|
|
FT_Glyph *aglyph,
|
|
|
|
FTC_Node *anode );
|
2001-12-05 16:59:33 +01:00
|
|
|
|
|
|
|
/* */
|
|
|
|
|
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Struct> */
|
|
|
|
/* FTC_Image_Desc */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* THIS TYPE IS DEPRECATED. Use @FTC_ImageDesc instead. */
|
|
|
|
/* */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* A simple structure used to describe a given glyph image category. */
|
|
|
|
/* */
|
|
|
|
/* <Fields> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* size :: An @FTC_SizeRec used to describe the glyph's face */
|
|
|
|
/* and size. */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
|
|
|
/* image_type :: The glyph image's type. */
|
|
|
|
/* */
|
|
|
|
typedef struct FTC_Image_Desc_
|
|
|
|
{
|
|
|
|
FTC_FontRec font;
|
|
|
|
FT_UInt image_type;
|
|
|
|
|
|
|
|
} FTC_Image_Desc;
|
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Type> */
|
|
|
|
/* FTC_Image_Cache */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* THIS TYPE IS DEPRECATED. Use @FTC_ImageCache instead. */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
2001-12-05 16:59:33 +01:00
|
|
|
typedef FTC_ImageCache FTC_Image_Cache;
|
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_Image_Cache_New */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* THIS FUNCTION IS DEPRECATED. Use @FTC_ImageCache_New instead. */
|
|
|
|
/* */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* Creates a new glyph image cache. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
2000-10-31 18:49:07 +01:00
|
|
|
/* manager :: The parent manager for the image cache. */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
|
|
|
/* <Output> */
|
2000-10-31 18:49:07 +01:00
|
|
|
/* acache :: A handle to the new glyph image cache object. */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* FreeType error code. 0 means success. */
|
|
|
|
/* */
|
2001-06-28 19:49:10 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_Image_Cache_New( FTC_Manager manager,
|
|
|
|
FTC_Image_Cache *acache );
|
2000-10-29 01:34:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_Image_Cache_Lookup */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* THIS FUNCTION IS DEPRECATED. Use @FTC_ImageCache_Lookup instead. */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* cache :: A handle to the source glyph image cache. */
|
|
|
|
/* */
|
|
|
|
/* desc :: A pointer to a glyph image descriptor. */
|
|
|
|
/* */
|
|
|
|
/* gindex :: The glyph index to retrieve. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* failure. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-10-31 18:49:07 +01:00
|
|
|
/* FreeType error code. 0 means success. */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
2000-10-31 18:49:07 +01:00
|
|
|
/* The returned glyph is owned and managed by the glyph image cache. */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* Never try to transform or discard it manually! You can however */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* create a copy with @FT_Glyph_Copy and modify the new one. */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
|
|
|
/* Because the glyph image cache limits the total amount of memory */
|
|
|
|
/* taken by the glyphs it holds, the returned glyph might disappear */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* on a later invocation of this function! It is a cache after */
|
|
|
|
/* all... */
|
2000-10-29 01:34:45 +02:00
|
|
|
/* */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* Use this function to "lock" the glyph as long as it is needed. */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
2001-06-28 19:49:10 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_Image_Cache_Lookup( FTC_Image_Cache cache,
|
|
|
|
FTC_Image_Desc* desc,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FT_Glyph *aglyph );
|
2000-10-29 01:34:45 +02:00
|
|
|
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
2001-01-11 10:27:49 +01:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_END_HEADER
|
2000-10-29 01:34:45 +02:00
|
|
|
|
2001-12-20 18:49:10 +01:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#endif /* __FTCIMAGE_H__ */
|
2000-10-29 01:34:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|