2000-08-23 23:11:13 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftcache.h */
|
|
|
|
/* */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* FreeType Cache subsystem (specification). */
|
2000-08-23 23:11:13 +02:00
|
|
|
/* */
|
2013-05-10 07:58:47 +02:00
|
|
|
/* Copyright 1996-2008, 2010, 2013 by */
|
2000-08-23 23:11:13 +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-08-24 18:29:15 +02:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#ifndef __FTCACHE_H__
|
|
|
|
#define __FTCACHE_H__
|
2000-08-23 23:11:13 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_GLYPH_H
|
|
|
|
|
2000-10-12 07:05:40 +02:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_BEGIN_HEADER
|
2000-08-23 23:11:13 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
|
2006-04-01 11:14:12 +02:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* <Section>
|
|
|
|
* cache_subsystem
|
|
|
|
*
|
|
|
|
* <Title>
|
|
|
|
* Cache Sub-System
|
|
|
|
*
|
|
|
|
* <Abstract>
|
2008-06-26 21:56:51 +02:00
|
|
|
* How to cache face, size, and glyph data with FreeType~2.
|
2006-04-01 11:14:12 +02:00
|
|
|
*
|
|
|
|
* <Description>
|
2008-06-26 21:56:51 +02:00
|
|
|
* This section describes the FreeType~2 cache sub-system, which is used
|
2006-04-01 11:14:12 +02:00
|
|
|
* to limit the number of concurrently opened @FT_Face and @FT_Size
|
|
|
|
* objects, as well as caching information like character maps and glyph
|
|
|
|
* images while limiting their maximum memory usage.
|
|
|
|
*
|
2006-05-12 10:00:13 +02:00
|
|
|
* Note that all types and functions begin with the `FTC_' prefix.
|
2006-04-01 11:14:12 +02:00
|
|
|
*
|
2006-04-01 20:49:07 +02:00
|
|
|
* The cache is highly portable and thus doesn't know anything about the
|
|
|
|
* fonts installed on your system, or how to access them. This implies
|
2006-04-01 11:14:12 +02:00
|
|
|
* the following scheme:
|
|
|
|
*
|
2006-04-01 20:49:07 +02:00
|
|
|
* First, available or installed font faces are uniquely identified by
|
|
|
|
* @FTC_FaceID values, provided to the cache by the client. Note that
|
|
|
|
* the cache only stores and compares these values, and doesn't try to
|
2006-04-01 11:14:12 +02:00
|
|
|
* interpret them in any way.
|
|
|
|
*
|
2006-04-01 20:49:07 +02:00
|
|
|
* Second, the cache calls, only when needed, a client-provided function
|
2010-10-01 07:48:01 +02:00
|
|
|
* to convert an @FTC_FaceID into a new @FT_Face object. The latter is
|
2006-04-01 20:49:07 +02:00
|
|
|
* then completely managed by the cache, including its termination
|
2010-10-01 07:48:01 +02:00
|
|
|
* through @FT_Done_Face. To monitor termination of face objects, the
|
|
|
|
* finalizer callback in the `generic' field of the @FT_Face object can
|
|
|
|
* be used, which might also be used to store the @FTC_FaceID of the
|
|
|
|
* face.
|
2006-04-01 11:14:12 +02:00
|
|
|
*
|
2006-04-01 20:49:07 +02:00
|
|
|
* Clients are free to map face IDs to anything else. The most simple
|
|
|
|
* usage is to associate them to a (pathname,face_index) pair that is
|
|
|
|
* used to call @FT_New_Face. However, more complex schemes are also
|
|
|
|
* possible.
|
2006-04-01 11:14:12 +02:00
|
|
|
*
|
2006-04-01 20:49:07 +02:00
|
|
|
* Note that for the cache to work correctly, the face ID values must be
|
|
|
|
* *persistent*, which means that the contents they point to should not
|
2006-04-01 11:14:12 +02:00
|
|
|
* change at runtime, or that their value should not become invalid.
|
|
|
|
*
|
2006-04-01 20:49:07 +02:00
|
|
|
* If this is unavoidable (e.g., when a font is uninstalled at runtime),
|
2006-04-01 11:14:12 +02:00
|
|
|
* you should call @FTC_Manager_RemoveFaceID as soon as possible, to let
|
|
|
|
* the cache get rid of any references to the old @FTC_FaceID it may
|
2006-04-01 20:49:07 +02:00
|
|
|
* keep internally. Failure to do so will lead to incorrect behaviour
|
2006-04-01 11:14:12 +02:00
|
|
|
* or even crashes.
|
|
|
|
*
|
2006-04-01 20:49:07 +02:00
|
|
|
* To use the cache, start with calling @FTC_Manager_New to create a new
|
|
|
|
* @FTC_Manager object, which models a single cache instance. You can
|
|
|
|
* then look up @FT_Face and @FT_Size objects with
|
|
|
|
* @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively.
|
2006-04-01 11:14:12 +02:00
|
|
|
*
|
|
|
|
* If you want to use the charmap caching, call @FTC_CMapCache_New, then
|
|
|
|
* later use @FTC_CMapCache_Lookup to perform the equivalent of
|
|
|
|
* @FT_Get_Char_Index, only much faster.
|
|
|
|
*
|
|
|
|
* If you want to use the @FT_Glyph caching, call @FTC_ImageCache, then
|
|
|
|
* later use @FTC_ImageCache_Lookup to retrieve the corresponding
|
|
|
|
* @FT_Glyph objects from the cache.
|
|
|
|
*
|
2006-04-01 20:49:07 +02:00
|
|
|
* If you need lots of small bitmaps, it is much more memory efficient
|
|
|
|
* to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This
|
|
|
|
* returns @FTC_SBitRec structures, which are used to store small
|
|
|
|
* bitmaps directly. (A small bitmap is one whose metrics and
|
|
|
|
* dimensions all fit into 8-bit integers).
|
2006-04-01 11:14:12 +02:00
|
|
|
*
|
2006-04-01 20:49:07 +02:00
|
|
|
* We hope to also provide a kerning cache in the near future.
|
2006-04-01 11:14:12 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* <Order>
|
|
|
|
* FTC_Manager
|
|
|
|
* FTC_FaceID
|
|
|
|
* FTC_Face_Requester
|
|
|
|
*
|
|
|
|
* FTC_Manager_New
|
|
|
|
* FTC_Manager_Reset
|
|
|
|
* FTC_Manager_Done
|
|
|
|
* FTC_Manager_LookupFace
|
|
|
|
* FTC_Manager_LookupSize
|
|
|
|
* FTC_Manager_RemoveFaceID
|
|
|
|
*
|
|
|
|
* FTC_Node
|
|
|
|
* FTC_Node_Unref
|
|
|
|
*
|
|
|
|
* FTC_ImageCache
|
|
|
|
* FTC_ImageCache_New
|
|
|
|
* FTC_ImageCache_Lookup
|
|
|
|
*
|
|
|
|
* FTC_SBit
|
|
|
|
* FTC_SBitCache
|
|
|
|
* FTC_SBitCache_New
|
|
|
|
* FTC_SBitCache_Lookup
|
|
|
|
*
|
|
|
|
* FTC_CMapCache
|
|
|
|
* FTC_CMapCache_New
|
|
|
|
* FTC_CMapCache_Lookup
|
|
|
|
*
|
|
|
|
*************************************************************************/
|
2001-01-11 10:27:49 +01:00
|
|
|
|
2000-08-23 23:11:13 +02:00
|
|
|
|
2000-08-24 18:29:15 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** BASIC TYPE DEFINITIONS *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
2000-08-23 23:11:13 +02:00
|
|
|
|
|
|
|
|
2006-04-01 20:49:07 +02:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* @type: FTC_FaceID
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* An opaque pointer type that is used to identity face objects. The
|
|
|
|
* contents of such objects is application-dependent.
|
|
|
|
*
|
|
|
|
* These pointers are typically used to point to a user-defined
|
|
|
|
* structure containing a font file path, and face index.
|
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* Never use NULL as a valid @FTC_FaceID.
|
|
|
|
*
|
2013-09-03 11:33:10 +02:00
|
|
|
* Face IDs are passed by the client to the cache manager that calls,
|
2006-04-01 20:49:07 +02:00
|
|
|
* when needed, the @FTC_Face_Requester to translate them into new
|
|
|
|
* @FT_Face objects.
|
|
|
|
*
|
|
|
|
* If the content of a given face ID changes at runtime, or if the value
|
|
|
|
* becomes invalid (e.g., when uninstalling a font), you should
|
|
|
|
* immediately call @FTC_Manager_RemoveFaceID before any other cache
|
|
|
|
* function.
|
|
|
|
*
|
|
|
|
* Failure to do so will result in incorrect behaviour or even
|
|
|
|
* memory leaks and crashes.
|
|
|
|
*/
|
2008-06-03 22:53:49 +02:00
|
|
|
typedef FT_Pointer FTC_FaceID;
|
2000-08-23 23:11:13 +02:00
|
|
|
|
|
|
|
|
2006-04-01 20:49:07 +02:00
|
|
|
/************************************************************************
|
|
|
|
*
|
|
|
|
* @functype:
|
|
|
|
* FTC_Face_Requester
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A callback function provided by client applications. It is used by
|
|
|
|
* the cache manager to translate a given @FTC_FaceID into a new valid
|
|
|
|
* @FT_Face object, on demand.
|
|
|
|
*
|
|
|
|
* <Input>
|
|
|
|
* face_id ::
|
|
|
|
* The face ID to resolve.
|
|
|
|
*
|
|
|
|
* library ::
|
|
|
|
* A handle to a FreeType library object.
|
|
|
|
*
|
|
|
|
* req_data ::
|
|
|
|
* Application-provided request data (see note below).
|
|
|
|
*
|
|
|
|
* <Output>
|
|
|
|
* aface ::
|
|
|
|
* A new @FT_Face handle.
|
|
|
|
*
|
|
|
|
* <Return>
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2006-04-01 20:49:07 +02:00
|
|
|
*
|
|
|
|
* <Note>
|
|
|
|
* The third parameter `req_data' is the same as the one passed by the
|
|
|
|
* client when @FTC_Manager_New is called.
|
|
|
|
*
|
|
|
|
* The face requester should not perform funny things on the returned
|
|
|
|
* face object, like creating a new @FT_Size for it, or setting a
|
|
|
|
* transformation through @FT_Set_Transform!
|
|
|
|
*/
|
2001-06-28 09:17:51 +02:00
|
|
|
typedef FT_Error
|
|
|
|
(*FTC_Face_Requester)( FTC_FaceID face_id,
|
|
|
|
FT_Library library,
|
|
|
|
FT_Pointer request_data,
|
|
|
|
FT_Face* aface );
|
2000-08-23 23:11:13 +02:00
|
|
|
|
2006-04-01 11:14:12 +02:00
|
|
|
/* */
|
2001-12-05 02:22:05 +01:00
|
|
|
|
2000-08-23 23:11:13 +02:00
|
|
|
|
2000-08-24 18:29:15 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** CACHE MANAGER OBJECT *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Type> */
|
|
|
|
/* FTC_Manager */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2006-04-01 11:14:12 +02:00
|
|
|
/* This object corresponds to one instance of the cache-subsystem. */
|
|
|
|
/* It is used to cache one or more @FT_Face objects, along with */
|
|
|
|
/* corresponding @FT_Size objects. */
|
|
|
|
/* */
|
2006-04-01 20:49:07 +02:00
|
|
|
/* The manager intentionally limits the total number of opened */
|
|
|
|
/* @FT_Face and @FT_Size objects to control memory usage. See the */
|
|
|
|
/* `max_faces' and `max_sizes' parameters of @FTC_Manager_New. */
|
2006-04-01 11:14:12 +02:00
|
|
|
/* */
|
2006-04-01 20:49:07 +02:00
|
|
|
/* The manager is also used to cache `nodes' of various types while */
|
|
|
|
/* limiting their total memory usage. */
|
2006-04-01 11:14:12 +02:00
|
|
|
/* */
|
|
|
|
/* All limitations are enforced by keeping lists of managed objects */
|
|
|
|
/* in most-recently-used order, and flushing old nodes to make room */
|
|
|
|
/* for new ones. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2000-08-23 23:11:13 +02:00
|
|
|
typedef struct FTC_ManagerRec_* FTC_Manager;
|
|
|
|
|
|
|
|
|
2001-12-05 16:59:33 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Type> */
|
|
|
|
/* FTC_Node */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* An opaque handle to a cache node object. Each cache node is */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* reference-counted. A node with a count of~0 might be flushed */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* out of a full cache whenever a lookup request is performed. */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
2010-04-14 15:47:04 +02:00
|
|
|
/* If you look up nodes, you have the ability to `acquire' them, */
|
|
|
|
/* i.e., to increment their reference count. This will prevent the */
|
|
|
|
/* node from being flushed out of the cache until you explicitly */
|
|
|
|
/* `release' it (see @FTC_Node_Unref). */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
2003-07-25 07:57:21 +02:00
|
|
|
/* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. */
|
2001-12-05 16:59:33 +01:00
|
|
|
/* */
|
2001-12-20 18:49:10 +01:00
|
|
|
typedef struct FTC_NodeRec_* FTC_Node;
|
2001-12-05 16:59:33 +01:00
|
|
|
|
|
|
|
|
2000-08-24 18:29:15 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_Manager_New */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* Create a new cache manager. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
2006-04-01 20:49:07 +02:00
|
|
|
/* library :: The parent FreeType library handle to use. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2006-04-01 20:49:07 +02:00
|
|
|
/* max_faces :: Maximum number of opened @FT_Face objects managed by */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* this cache instance. Use~0 for defaults. */
|
2006-04-01 11:14:12 +02:00
|
|
|
/* */
|
2006-04-01 20:49:07 +02:00
|
|
|
/* max_sizes :: Maximum number of opened @FT_Size objects managed by */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* this cache instance. Use~0 for defaults. */
|
2006-04-01 11:14:12 +02:00
|
|
|
/* */
|
2006-04-01 20:49:07 +02:00
|
|
|
/* max_bytes :: Maximum number of bytes to use for cached data nodes. */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* Use~0 for defaults. Note that this value does not */
|
2006-04-13 18:31:02 +02:00
|
|
|
/* account for managed @FT_Face and @FT_Size objects. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2006-04-01 20:49:07 +02:00
|
|
|
/* requester :: An application-provided callback used to translate */
|
|
|
|
/* face IDs into real @FT_Face objects. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2006-04-01 20:49:07 +02:00
|
|
|
/* req_data :: A generic pointer that is passed to the requester */
|
|
|
|
/* each time it is called (see @FTC_Face_Requester). */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* <Output> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* amanager :: A handle to a new manager object. 0~in case of */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* failure. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* FreeType error code. 0~means success. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( 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 );
|
2000-08-23 23:11:13 +02:00
|
|
|
|
2000-10-12 07:05:40 +02:00
|
|
|
|
2000-08-24 18:29:15 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_Manager_Reset */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* Empty a given cache manager. This simply gets rid of all the */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* currently cached @FT_Face and @FT_Size objects within the manager. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2000-11-06 05:33:56 +01:00
|
|
|
/* <InOut> */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* manager :: A handle to the manager. */
|
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FTC_Manager_Reset( FTC_Manager manager );
|
2000-08-24 18:29:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_Manager_Done */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* Destroy a given manager after emptying it. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* manager :: A handle to the target cache manager object. */
|
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FTC_Manager_Done( FTC_Manager manager );
|
2000-08-24 18:29:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
2003-12-26 08:26:08 +01:00
|
|
|
/* FTC_Manager_LookupFace */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* Retrieve the @FT_Face object that corresponds to a given face ID */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* through a cache manager. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* manager :: A handle to the cache manager. */
|
|
|
|
/* */
|
|
|
|
/* face_id :: The ID of the face object. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* aface :: A handle to the face object. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* FreeType error code. 0~means success. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* The returned @FT_Face object is always owned by the manager. You */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* should never try to discard it yourself. */
|
|
|
|
/* */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* The @FT_Face object doesn't necessarily have a current size object */
|
2013-05-28 22:37:10 +02:00
|
|
|
/* (i.e., face->size can be~0). If you need a specific `font size', */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* use @FTC_Manager_LookupSize instead. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* Never change the face's transformation matrix (i.e., never call */
|
2001-12-20 18:49:10 +01:00
|
|
|
/* the @FT_Set_Transform function) on a returned face! If you need */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* to transform glyphs, do it yourself after glyph loading. */
|
|
|
|
/* */
|
2006-04-01 11:14:12 +02:00
|
|
|
/* When you perform a lookup, out-of-memory errors are detected */
|
|
|
|
/* _within_ the lookup and force incremental flushes of the cache */
|
|
|
|
/* until enough memory is released for the lookup to succeed. */
|
|
|
|
/* */
|
2006-05-12 10:00:13 +02:00
|
|
|
/* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */
|
|
|
|
/* already been completely flushed, and still no memory was available */
|
|
|
|
/* for the operation. */
|
2006-04-01 11:14:12 +02:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
2003-12-19 22:23:58 +01:00
|
|
|
FTC_Manager_LookupFace( FTC_Manager manager,
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_FaceID face_id,
|
|
|
|
FT_Face *aface );
|
2000-10-12 07:05:40 +02:00
|
|
|
|
2000-08-23 23:11:13 +02:00
|
|
|
|
2004-01-16 10:07:59 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Struct> */
|
|
|
|
/* FTC_ScalerRec */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A structure used to describe a given character size in either */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* pixels or points to the cache manager. See */
|
|
|
|
/* @FTC_Manager_LookupSize. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
|
|
|
/* <Fields> */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* face_id :: The source face ID. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* width :: The character width. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* height :: The character height. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
2007-06-11 06:55:58 +02:00
|
|
|
/* pixel :: A Boolean. If 1, the `width' and `height' fields are */
|
|
|
|
/* interpreted as integer pixel character sizes. */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* Otherwise, they are expressed as 1/64th of points. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* x_res :: Only used when `pixel' is value~0 to indicate the */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* horizontal resolution in dpi. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* y_res :: Only used when `pixel' is value~0 to indicate the */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* vertical resolution in dpi. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* This type is mainly used to retrieve @FT_Size objects through the */
|
|
|
|
/* cache manager. */
|
|
|
|
/* */
|
|
|
|
typedef struct FTC_ScalerRec_
|
|
|
|
{
|
|
|
|
FTC_FaceID face_id;
|
|
|
|
FT_UInt width;
|
|
|
|
FT_UInt height;
|
|
|
|
FT_Int pixel;
|
|
|
|
FT_UInt x_res;
|
|
|
|
FT_UInt y_res;
|
|
|
|
|
2008-05-28 23:51:57 +02:00
|
|
|
} FTC_ScalerRec;
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Struct> */
|
|
|
|
/* FTC_Scaler */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A handle to an @FTC_ScalerRec structure. */
|
|
|
|
/* */
|
|
|
|
typedef struct FTC_ScalerRec_* FTC_Scaler;
|
2004-01-16 10:07:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_Manager_LookupSize */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* Retrieve the @FT_Size object that corresponds to a given */
|
2006-05-12 10:00:13 +02:00
|
|
|
/* @FTC_ScalerRec pointer through a cache manager. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* manager :: A handle to the cache manager. */
|
|
|
|
/* */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* scaler :: A scaler handle. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* asize :: A handle to the size object. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* FreeType error code. 0~means success. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* The returned @FT_Size object is always owned by the manager. You */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* should never try to discard it by yourself. */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* */
|
2004-01-22 10:07:12 +01:00
|
|
|
/* You can access the parent @FT_Face object simply as `size->face' */
|
|
|
|
/* if you need it. Note that this object is also owned by the */
|
2004-01-16 10:07:59 +01:00
|
|
|
/* manager. */
|
|
|
|
/* */
|
2006-04-01 11:14:12 +02:00
|
|
|
/* <Note> */
|
|
|
|
/* When you perform a lookup, out-of-memory errors are detected */
|
|
|
|
/* _within_ the lookup and force incremental flushes of the cache */
|
|
|
|
/* until enough memory is released for the lookup to succeed. */
|
|
|
|
/* */
|
2006-05-12 10:00:13 +02:00
|
|
|
/* If a lookup fails with `FT_Err_Out_Of_Memory' the cache has */
|
|
|
|
/* already been completely flushed, and still no memory is available */
|
|
|
|
/* for the operation. */
|
2006-04-01 11:14:12 +02:00
|
|
|
/* */
|
2004-01-16 10:07:59 +01:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_Manager_LookupSize( FTC_Manager manager,
|
|
|
|
FTC_Scaler scaler,
|
|
|
|
FT_Size *asize );
|
|
|
|
|
|
|
|
|
2000-08-24 18:29:15 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* FTC_Node_Unref */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* Decrement a cache node's internal reference count. When the count */
|
|
|
|
/* reaches 0, it is not destroyed but becomes eligible for subsequent */
|
|
|
|
/* cache flushes. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* node :: The cache node handle. */
|
|
|
|
/* */
|
|
|
|
/* manager :: The cache manager handle. */
|
|
|
|
/* */
|
|
|
|
FT_EXPORT( void )
|
|
|
|
FTC_Node_Unref( FTC_Node node,
|
|
|
|
FTC_Manager manager );
|
|
|
|
|
|
|
|
|
2006-04-22 14:24:52 +02:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FTC_Manager_RemoveFaceID
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A special function used to indicate to the cache manager that
|
|
|
|
* a given @FTC_FaceID is no longer valid, either because its
|
|
|
|
* content changed, or because it was deallocated or uninstalled.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* manager ::
|
|
|
|
* The cache manager handle.
|
|
|
|
*
|
|
|
|
* face_id ::
|
|
|
|
* The @FTC_FaceID to be removed.
|
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* This function flushes all nodes from the cache corresponding to this
|
|
|
|
* `face_id', with the exception of nodes with a non-null reference
|
|
|
|
* count.
|
|
|
|
*
|
|
|
|
* Such nodes are however modified internally so as to never appear
|
|
|
|
* in later lookups with the same `face_id' value, and to be immediately
|
|
|
|
* destroyed when released by all their users.
|
|
|
|
*
|
|
|
|
*/
|
2003-12-19 22:23:58 +01:00
|
|
|
FT_EXPORT( void )
|
|
|
|
FTC_Manager_RemoveFaceID( FTC_Manager manager,
|
2003-12-26 08:26:08 +01:00
|
|
|
FTC_FaceID face_id );
|
2003-12-19 22:23:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Section> */
|
|
|
|
/* cache_subsystem */
|
|
|
|
/* */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2005-10-27 23:28:35 +02:00
|
|
|
/*************************************************************************
|
2003-12-19 22:23:58 +01:00
|
|
|
*
|
|
|
|
* @type:
|
2005-10-27 23:28:35 +02:00
|
|
|
* FTC_CMapCache
|
2003-12-19 22:23:58 +01:00
|
|
|
*
|
|
|
|
* @description:
|
2006-04-13 18:31:02 +02:00
|
|
|
* An opaque handle used to model a charmap cache. This cache is to
|
2005-10-27 23:28:35 +02:00
|
|
|
* hold character codes -> glyph indices mappings.
|
|
|
|
*
|
2003-12-19 22:23:58 +01:00
|
|
|
*/
|
|
|
|
typedef struct FTC_CMapCacheRec_* FTC_CMapCache;
|
|
|
|
|
|
|
|
|
2005-10-27 23:28:35 +02:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FTC_CMapCache_New
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Create a new charmap cache.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* manager ::
|
|
|
|
* A handle to the cache manager.
|
|
|
|
*
|
|
|
|
* @output:
|
|
|
|
* acache ::
|
|
|
|
* A new cache handle. NULL in case of error.
|
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* FreeType error code. 0~means success.
|
2005-10-27 23:28:35 +02:00
|
|
|
*
|
|
|
|
* @note:
|
|
|
|
* Like all other caches, this one will be destroyed with the cache
|
|
|
|
* manager.
|
|
|
|
*
|
|
|
|
*/
|
2003-12-19 22:23:58 +01:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_CMapCache_New( FTC_Manager manager,
|
|
|
|
FTC_CMapCache *acache );
|
|
|
|
|
|
|
|
|
2005-10-27 23:28:35 +02:00
|
|
|
/************************************************************************
|
|
|
|
*
|
|
|
|
* @function:
|
|
|
|
* FTC_CMapCache_Lookup
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* Translate a character code into a glyph index, using the charmap
|
|
|
|
* cache.
|
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* cache ::
|
|
|
|
* A charmap cache handle.
|
|
|
|
*
|
|
|
|
* face_id ::
|
|
|
|
* The source face ID.
|
|
|
|
*
|
|
|
|
* cmap_index ::
|
2008-09-12 18:27:48 +02:00
|
|
|
* The index of the charmap in the source face. Any negative value
|
|
|
|
* means to use the cache @FT_Face's default charmap.
|
2005-10-27 23:28:35 +02:00
|
|
|
*
|
|
|
|
* char_code ::
|
|
|
|
* The character code (in the corresponding charmap).
|
|
|
|
*
|
|
|
|
* @return:
|
2008-06-26 21:56:51 +02:00
|
|
|
* Glyph index. 0~means `no glyph'.
|
2005-10-27 23:28:35 +02:00
|
|
|
*
|
|
|
|
*/
|
2003-12-19 22:23:58 +01:00
|
|
|
FT_EXPORT( FT_UInt )
|
|
|
|
FTC_CMapCache_Lookup( FTC_CMapCache cache,
|
|
|
|
FTC_FaceID face_id,
|
* include/freetype/ftcache.h,
include/freetype/cache/ftcmanag.h,
include/freetype/cache/ftccache.h,
include/freetype/cache/ftcmanag.h,
include/freetype/cache/ftcmru.h (added),
include/freetype/cache/ftlru.h (removed),
include/freetype/cache/ftcsbits.h,
include/freetype/cache/ftcimage.h,
include/freetype/cache/ftcglyph.h,
src/cache/ftcmru.c,
src/cache/ftcmanag.c,
src/cache/ftccache.c,
src/cache/ftcglyph.c,
src/cache/ftcimage.c,
src/cache/ftcsbits.c,
src/cache/ftccmap.c,
src/cache/ftcbasic.c (added),
src/cache/ftclru.c (removed):
*Complete* rewrite of the cache sub-system to "solve" the
following points:
- all public APIs have been moved to FT_CACHE_H, everything
under "include/freetype/cache" is only needed by client
applications that want to implement their own caches
- a new function named FTC_Manager_RemoveFaceID to deal
with the uninstallation of FaceIDs
- the image and sbit cache are now abstract classes, that
can be extended much more easily by client applications
- better performance in certain areas. Further optimizations
to come shortly anyway...
- the FTC_CMapCache_Lookup function has changed its signature,
charmaps can now only be retrieved by index
- FTC_Manager_Lookup_Face => FTC_Manager_LookupFace
FTC_Manager_Lookup_Size => FTC_Manager_LookupSize (still in
private header for the moment)
2003-12-22 22:53:37 +01:00
|
|
|
FT_Int cmap_index,
|
2003-12-19 22:23:58 +01:00
|
|
|
FT_UInt32 char_code );
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Section> */
|
|
|
|
/* cache_subsystem */
|
|
|
|
/* */
|
2003-12-26 08:26:08 +01:00
|
|
|
/*************************************************************************/
|
2003-12-19 22:23:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** IMAGE CACHE OBJECT *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2006-04-22 14:24:52 +02:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FTC_ImageTypeRec
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure used to model the type of images in a glyph cache.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* face_id ::
|
|
|
|
* The face ID.
|
|
|
|
*
|
|
|
|
* width ::
|
|
|
|
* The width in pixels.
|
|
|
|
*
|
|
|
|
* height ::
|
|
|
|
* The height in pixels.
|
|
|
|
*
|
|
|
|
* flags ::
|
|
|
|
* The load flags, as in @FT_Load_Glyph.
|
|
|
|
*
|
|
|
|
*/
|
2003-12-19 22:23:58 +01:00
|
|
|
typedef struct FTC_ImageTypeRec_
|
|
|
|
{
|
2005-10-27 23:28:35 +02:00
|
|
|
FTC_FaceID face_id;
|
|
|
|
FT_Int width;
|
|
|
|
FT_Int height;
|
|
|
|
FT_Int32 flags;
|
2003-12-19 22:23:58 +01:00
|
|
|
|
|
|
|
} FTC_ImageTypeRec;
|
|
|
|
|
2006-04-22 14:24:52 +02:00
|
|
|
|
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* @type:
|
|
|
|
* FTC_ImageType
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A handle to an @FTC_ImageTypeRec structure.
|
|
|
|
*
|
|
|
|
*/
|
2006-02-19 17:12:18 +01:00
|
|
|
typedef struct FTC_ImageTypeRec_* FTC_ImageType;
|
2003-12-19 22:23:58 +01:00
|
|
|
|
|
|
|
|
2006-02-19 17:12:18 +01:00
|
|
|
/* */
|
|
|
|
|
|
|
|
|
|
|
|
#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
|
|
|
|
( (d1)->face_id == (d2)->face_id && \
|
|
|
|
(d1)->width == (d2)->width && \
|
|
|
|
(d1)->flags == (d2)->flags )
|
2006-02-17 18:23:13 +01:00
|
|
|
|
2003-12-19 22:23:58 +01:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Type> */
|
|
|
|
/* FTC_ImageCache */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2013-05-28 22:37:10 +02:00
|
|
|
/* A handle to a glyph image cache object. They are designed to */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* hold many distinct glyph images while not exceeding a certain */
|
|
|
|
/* memory threshold. */
|
|
|
|
/* */
|
|
|
|
typedef struct FTC_ImageCacheRec_* FTC_ImageCache;
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_ImageCache_New */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* Create a new glyph image cache. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* manager :: The parent manager for the image cache. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* acache :: A handle to the new glyph image cache object. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* FreeType error code. 0~means success. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_ImageCache_New( FTC_Manager manager,
|
|
|
|
FTC_ImageCache *acache );
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_ImageCache_Lookup */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* Retrieve a given glyph image from a glyph image cache. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* cache :: A handle to the source glyph image cache. */
|
|
|
|
/* */
|
|
|
|
/* type :: A pointer to a glyph image type descriptor. */
|
|
|
|
/* */
|
|
|
|
/* gindex :: The glyph index to retrieve. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2000-11-06 05:33:56 +01:00
|
|
|
/* <Output> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* aglyph :: The corresponding @FT_Glyph object. 0~in case of */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* failure. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* anode :: Used to return the address of of the corresponding cache */
|
|
|
|
/* node after incrementing its reference count (see note */
|
|
|
|
/* below). */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* FreeType error code. 0~means success. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* The returned glyph is owned and managed by the glyph image cache. */
|
|
|
|
/* Never try to transform or discard it manually! You can however */
|
|
|
|
/* create a copy with @FT_Glyph_Copy and modify the new one. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2003-12-26 08:26:08 +01:00
|
|
|
/* If `anode' is _not_ NULL, it receives the address of the cache */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* node containing the glyph image, after increasing its reference */
|
2006-05-12 10:00:13 +02:00
|
|
|
/* count. This ensures that the node (as well as the @FT_Glyph) will */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* always be kept in the cache until you call @FTC_Node_Unref to */
|
2003-12-26 08:26:08 +01:00
|
|
|
/* `release' it. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
2003-12-26 08:26:08 +01:00
|
|
|
/* If `anode' is NULL, the cache node is left unchanged, which means */
|
2006-05-12 10:00:13 +02:00
|
|
|
/* that the @FT_Glyph could be flushed out of the cache on the next */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* call to one of the caching sub-system APIs. Don't assume that it */
|
|
|
|
/* is persistent! */
|
|
|
|
/* */
|
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_ImageCache_Lookup( FTC_ImageCache cache,
|
|
|
|
FTC_ImageType type,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FT_Glyph *aglyph,
|
|
|
|
FTC_Node *anode );
|
|
|
|
|
|
|
|
|
2007-05-11 16:36:24 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_ImageCache_LookupScaler */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* A variant of @FTC_ImageCache_Lookup that uses an @FTC_ScalerRec */
|
|
|
|
/* to specify the face ID and its size. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* cache :: A handle to the source glyph image cache. */
|
|
|
|
/* */
|
|
|
|
/* scaler :: A pointer to a scaler descriptor. */
|
|
|
|
/* */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* load_flags :: The corresponding load flags. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* gindex :: The glyph index to retrieve. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
|
|
|
/* <Output> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* aglyph :: The corresponding @FT_Glyph object. 0~in case of */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* failure. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* anode :: Used to return the address of of the corresponding */
|
|
|
|
/* cache node after incrementing its reference count */
|
|
|
|
/* (see note below). */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* FreeType error code. 0~means success. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* The returned glyph is owned and managed by the glyph image cache. */
|
|
|
|
/* Never try to transform or discard it manually! You can however */
|
|
|
|
/* create a copy with @FT_Glyph_Copy and modify the new one. */
|
|
|
|
/* */
|
|
|
|
/* If `anode' is _not_ NULL, it receives the address of the cache */
|
|
|
|
/* node containing the glyph image, after increasing its reference */
|
|
|
|
/* count. This ensures that the node (as well as the @FT_Glyph) will */
|
|
|
|
/* always be kept in the cache until you call @FTC_Node_Unref to */
|
|
|
|
/* `release' it. */
|
|
|
|
/* */
|
|
|
|
/* If `anode' is NULL, the cache node is left unchanged, which means */
|
|
|
|
/* that the @FT_Glyph could be flushed out of the cache on the next */
|
|
|
|
/* call to one of the caching sub-system APIs. Don't assume that it */
|
|
|
|
/* is persistent! */
|
|
|
|
/* */
|
2008-11-05 15:34:29 +01:00
|
|
|
/* Calls to @FT_Set_Char_Size and friends have no effect on cached */
|
|
|
|
/* glyphs; you should always use the FreeType cache API instead. */
|
|
|
|
/* */
|
2007-05-11 16:36:24 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_ImageCache_LookupScaler( FTC_ImageCache cache,
|
|
|
|
FTC_Scaler scaler,
|
|
|
|
FT_ULong load_flags,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FT_Glyph *aglyph,
|
|
|
|
FTC_Node *anode );
|
|
|
|
|
2007-05-14 20:53:58 +02:00
|
|
|
|
2003-12-19 22:23:58 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Type> */
|
|
|
|
/* FTC_SBit */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* <Description> */
|
|
|
|
/* A handle to a small bitmap descriptor. See the @FTC_SBitRec */
|
|
|
|
/* structure for details. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2003-12-19 22:23:58 +01:00
|
|
|
typedef struct FTC_SBitRec_* FTC_SBit;
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Struct> */
|
|
|
|
/* FTC_SBitRec */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A very compact structure used to describe a small glyph bitmap. */
|
|
|
|
/* */
|
|
|
|
/* <Fields> */
|
|
|
|
/* width :: The bitmap width in pixels. */
|
|
|
|
/* */
|
|
|
|
/* height :: The bitmap height in pixels. */
|
|
|
|
/* */
|
|
|
|
/* left :: The horizontal distance from the pen position to the */
|
|
|
|
/* left bitmap border (a.k.a. `left side bearing', or */
|
|
|
|
/* `lsb'). */
|
|
|
|
/* */
|
|
|
|
/* top :: The vertical distance from the pen position (on the */
|
|
|
|
/* baseline) to the upper bitmap border (a.k.a. `top */
|
|
|
|
/* side bearing'). The distance is positive for upwards */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* y~coordinates. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
|
|
|
/* format :: The format of the glyph bitmap (monochrome or gray). */
|
|
|
|
/* */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* max_grays :: Maximum gray level value (in the range 1 to~255). */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
|
|
|
/* pitch :: The number of bytes per bitmap line. May be positive */
|
|
|
|
/* or negative. */
|
|
|
|
/* */
|
|
|
|
/* xadvance :: The horizontal advance width in pixels. */
|
|
|
|
/* */
|
|
|
|
/* yadvance :: The vertical advance height in pixels. */
|
|
|
|
/* */
|
2003-12-26 08:26:08 +01:00
|
|
|
/* buffer :: A pointer to the bitmap pixels. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
|
|
|
typedef struct FTC_SBitRec_
|
|
|
|
{
|
|
|
|
FT_Byte width;
|
|
|
|
FT_Byte height;
|
|
|
|
FT_Char left;
|
|
|
|
FT_Char top;
|
|
|
|
|
|
|
|
FT_Byte format;
|
|
|
|
FT_Byte max_grays;
|
|
|
|
FT_Short pitch;
|
|
|
|
FT_Char xadvance;
|
|
|
|
FT_Char yadvance;
|
|
|
|
|
|
|
|
FT_Byte* buffer;
|
|
|
|
|
|
|
|
} FTC_SBitRec;
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Type> */
|
|
|
|
/* FTC_SBitCache */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A handle to a small bitmap cache. These are special cache objects */
|
|
|
|
/* used to store small glyph bitmaps (and anti-aliased pixmaps) in a */
|
|
|
|
/* much more efficient way than the traditional glyph image cache */
|
|
|
|
/* implemented by @FTC_ImageCache. */
|
|
|
|
/* */
|
|
|
|
typedef struct FTC_SBitCacheRec_* FTC_SBitCache;
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_SBitCache_New */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* Create a new cache to store small glyph bitmaps. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* manager :: A handle to the source cache manager. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* acache :: A handle to the new sbit cache. NULL in case of error. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* FreeType error code. 0~means success. */
|
2000-08-24 18:29:15 +02:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_EXPORT( FT_Error )
|
2003-12-19 22:23:58 +01:00
|
|
|
FTC_SBitCache_New( FTC_Manager manager,
|
|
|
|
FTC_SBitCache *acache );
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_SBitCache_Lookup */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* Look up a given small glyph bitmap in a given sbit cache and */
|
2003-12-26 08:26:08 +01:00
|
|
|
/* `lock' it to prevent its flushing from the cache until needed. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* cache :: A handle to the source sbit cache. */
|
|
|
|
/* */
|
|
|
|
/* type :: A pointer to the glyph image type descriptor. */
|
|
|
|
/* */
|
|
|
|
/* gindex :: The glyph index. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* sbit :: A handle to a small bitmap descriptor. */
|
|
|
|
/* */
|
|
|
|
/* anode :: Used to return the address of of the corresponding cache */
|
|
|
|
/* node after incrementing its reference count (see note */
|
|
|
|
/* below). */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* FreeType error code. 0~means success. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* The small bitmap descriptor and its bit buffer are owned by the */
|
|
|
|
/* cache and should never be freed by the application. They might */
|
|
|
|
/* as well disappear from memory on the next cache lookup, so don't */
|
|
|
|
/* treat them as persistent data. */
|
|
|
|
/* */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* The descriptor's `buffer' field is set to~0 to indicate a missing */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* glyph bitmap. */
|
|
|
|
/* */
|
2003-12-26 08:26:08 +01:00
|
|
|
/* If `anode' is _not_ NULL, it receives the address of the cache */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* node containing the bitmap, after increasing its reference count. */
|
|
|
|
/* This ensures that the node (as well as the image) will always be */
|
2003-12-26 08:26:08 +01:00
|
|
|
/* kept in the cache until you call @FTC_Node_Unref to `release' it. */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* */
|
2003-12-26 08:26:08 +01:00
|
|
|
/* If `anode' is NULL, the cache node is left unchanged, which means */
|
2003-12-19 22:23:58 +01:00
|
|
|
/* that the bitmap could be flushed out of the cache on the next */
|
|
|
|
/* call to one of the caching sub-system APIs. Don't assume that it */
|
|
|
|
/* is persistent! */
|
|
|
|
/* */
|
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_SBitCache_Lookup( FTC_SBitCache cache,
|
|
|
|
FTC_ImageType type,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FTC_SBit *sbit,
|
|
|
|
FTC_Node *anode );
|
|
|
|
|
2007-05-14 20:53:58 +02:00
|
|
|
|
2007-05-11 16:36:24 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FTC_SBitCache_LookupScaler */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* A variant of @FTC_SBitCache_Lookup that uses an @FTC_ScalerRec */
|
|
|
|
/* to specify the face ID and its size. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* cache :: A handle to the source sbit cache. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* scaler :: A pointer to the scaler descriptor. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* load_flags :: The corresponding load flags. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* gindex :: The glyph index. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
|
|
|
/* <Output> */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* sbit :: A handle to a small bitmap descriptor. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
2007-05-14 20:53:58 +02:00
|
|
|
/* anode :: Used to return the address of of the corresponding */
|
|
|
|
/* cache node after incrementing its reference count */
|
|
|
|
/* (see note below). */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* FreeType error code. 0~means success. */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* The small bitmap descriptor and its bit buffer are owned by the */
|
|
|
|
/* cache and should never be freed by the application. They might */
|
|
|
|
/* as well disappear from memory on the next cache lookup, so don't */
|
|
|
|
/* treat them as persistent data. */
|
|
|
|
/* */
|
2008-06-26 21:56:51 +02:00
|
|
|
/* The descriptor's `buffer' field is set to~0 to indicate a missing */
|
2007-05-11 16:36:24 +02:00
|
|
|
/* glyph bitmap. */
|
|
|
|
/* */
|
|
|
|
/* If `anode' is _not_ NULL, it receives the address of the cache */
|
|
|
|
/* node containing the bitmap, after increasing its reference count. */
|
|
|
|
/* This ensures that the node (as well as the image) will always be */
|
|
|
|
/* kept in the cache until you call @FTC_Node_Unref to `release' it. */
|
|
|
|
/* */
|
|
|
|
/* If `anode' is NULL, the cache node is left unchanged, which means */
|
|
|
|
/* that the bitmap could be flushed out of the cache on the next */
|
|
|
|
/* call to one of the caching sub-system APIs. Don't assume that it */
|
|
|
|
/* is persistent! */
|
|
|
|
/* */
|
|
|
|
FT_EXPORT( FT_Error )
|
|
|
|
FTC_SBitCache_LookupScaler( FTC_SBitCache cache,
|
|
|
|
FTC_Scaler scaler,
|
|
|
|
FT_ULong load_flags,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FTC_SBit *sbit,
|
|
|
|
FTC_Node *anode );
|
|
|
|
|
2000-10-31 21:42:18 +01:00
|
|
|
|
* builds/amiga/src/base/ftsystem.c, devel/ftoption.h
include/freetype/ftcache.h, include/freetype/ftoutln.h,
include/freetype/cache/ftccache.h, include/freetype/cache/ftccmap.h,
include/freetype/config/ftoption.h, include/freetype/internal/ftcalc.h,
include/freetype/internal/ftdriver.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h, include/freetype/internal/ftrfork.h,
include/freetype/internal/psaux.h, include/freetype/internal/sfnt.h,
include/freetype/internal/t1types.h, include/freetype/internal/tttypes.h,
src/base/ftcalc.c, src/base/ftdbgmem.c, src/base/ftobjs.c,
src/base/ftsystem.c, src/base/ftutil.c, src/bdf/bdfdrivr.c,
src/cache/ftccache.c, src/cache/ftccback.h, src/cache/ftccmap.c,
src/cache/ftcmanag.c, src/cff/cffdrivr.c, src/cid/cidriver.c,
src/pcf/pcfdrivr.c, src/pfr/pfrdrivr.c, src/psaux/psauxmod.c,
src/sfnt/sfdriver.c, src/truetype/ttdriver.c, src/type1/t1driver.c,
src/type1/t1objs.c, src/type42/t42drivr.c, src/winfonts/winfnt.c:
massive changes to the internals to respect the internal object layouts
and exported functions of FreeType 2.1.7. Note that the cache sub-system
cannot be fully retrofitted, unfortunately.
2006-02-16 23:45:31 +01:00
|
|
|
/* */
|
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
FT_END_HEADER
|
2000-08-24 18:29:15 +02:00
|
|
|
|
2000-12-01 00:12:33 +01:00
|
|
|
#endif /* __FTCACHE_H__ */
|
2000-08-24 18:29:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|