Upgrade to version 2.1.8

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8126 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm
2004-06-22 14:03:16 +00:00
parent 196f29a0bd
commit 1754568b9c
427 changed files with 39571 additions and 25363 deletions
+152 -184
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType internal cache interface (specification). */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -20,9 +20,7 @@
#define __FTCCACHE_H__
/* define to allow cache lookup inlining */
#define FTC_CACHE_USE_INLINE
#include FT_CACHE_INTERNAL_MRU_H
FT_BEGIN_HEADER
@@ -30,13 +28,7 @@ FT_BEGIN_HEADER
typedef struct FTC_CacheRec_* FTC_Cache;
/* handle to cache class */
typedef const struct FTC_Cache_ClassRec_* FTC_Cache_Class;
/* handle to cache node family */
typedef struct FTC_FamilyRec_* FTC_Family;
/* handle to cache root query */
typedef struct FTC_QueryRec_* FTC_Query;
typedef const struct FTC_CacheClassRec_* FTC_CacheClass;
/*************************************************************************/
@@ -62,12 +54,11 @@ FT_BEGIN_HEADER
/* structure size should be 20 bytes on 32-bits machines */
typedef struct FTC_NodeRec_
{
FTC_Node mru_next; /* circular mru list pointer */
FTC_Node mru_prev; /* circular mru list pointer */
FTC_Node link; /* used for hashing */
FT_UInt32 hash; /* used for hashing too */
FT_UShort fam_index; /* index of family the node belongs to */
FT_Short ref_count; /* reference count for this node */
FTC_MruNodeRec mru; /* circular mru list pointer */
FTC_Node link; /* used for hashing */
FT_UInt32 hash; /* used for hashing too */
FT_UShort cache_index; /* index of cache the node belongs to */
FT_Short ref_count; /* reference count for this node */
} FTC_NodeRec;
@@ -75,6 +66,9 @@ FT_BEGIN_HEADER
#define FTC_NODE( x ) ( (FTC_Node)(x) )
#define FTC_NODE_P( x ) ( (FTC_Node*)(x) )
#define FTC_NODE__NEXT(x) FTC_NODE( (x)->mru.next )
#define FTC_NODE__PREV(x) FTC_NODE( (x)->mru.prev )
/*************************************************************************/
/* */
@@ -83,83 +77,12 @@ FT_BEGIN_HEADER
/* cache sub-system internals. */
/* */
/* can be used as a FTC_Node_DoneFunc */
FT_EXPORT( void )
ftc_node_done( FTC_Node node,
FTC_Cache cache );
/* reserved for manager's use */
FT_EXPORT( void )
ftc_node_destroy( FTC_Node node,
FTC_Manager manager );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CACHE QUERY DEFINITIONS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* A structure modelling a cache node query. The following fields must */
/* all be set by the @FTC_Family_CompareFunc method of a cache's family */
/* list. */
/* */
typedef struct FTC_QueryRec_
{
FTC_Family family;
FT_UFast hash;
} FTC_QueryRec;
#define FTC_QUERY( x ) ( (FTC_Query)(x) )
#define FTC_QUERY_P( x ) ( (FTC_Query*)(x) )
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CACHE FAMILY DEFINITIONS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
typedef struct FTC_FamilyRec_
{
FT_LruNodeRec lru;
FTC_Cache cache;
FT_UInt num_nodes;
FT_UInt fam_index;
} FTC_FamilyRec;
#define FTC_FAMILY( x ) ( (FTC_Family)(x) )
#define FTC_FAMILY_P( x ) ( (FTC_Family*)(x) )
/*************************************************************************/
/* */
/* These functions are exported so that they can be called from */
/* user-provided cache classes; otherwise, they are really part of the */
/* cache sub-system internals. */
/* */
/* must be called by any FTC_Node_InitFunc routine */
FT_EXPORT( FT_Error )
ftc_family_init( FTC_Family family,
FTC_Query query,
FTC_Cache cache );
/* can be used as a FTC_Family_DoneFunc; otherwise, must be called */
/* by any family finalizer function */
FT_EXPORT( void )
ftc_family_done( FTC_Family family );
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -168,64 +91,12 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/* each cache really implements a dynamic hash table to manage its nodes */
typedef struct FTC_CacheRec_
{
FTC_Manager manager;
FT_Memory memory;
FTC_Cache_Class clazz;
FT_UInt cache_index; /* in manager's table */
FT_Pointer cache_data; /* used by cache node methods */
FT_UFast p;
FT_UFast mask;
FT_Long slack;
FTC_Node* buckets;
FT_LruList_ClassRec family_class;
FT_LruList families;
} FTC_CacheRec;
#define FTC_CACHE( x ) ( (FTC_Cache)(x) )
#define FTC_CACHE_P( x ) ( (FTC_Cache*)(x) )
/* initialize a given cache */
typedef FT_Error
(*FTC_Cache_InitFunc)( FTC_Cache cache );
/* clear a cache */
typedef void
(*FTC_Cache_ClearFunc)( FTC_Cache cache );
/* finalize a given cache */
typedef void
(*FTC_Cache_DoneFunc)( FTC_Cache cache );
typedef FT_Error
(*FTC_Family_InitFunc)( FTC_Family family,
FTC_Query query,
FTC_Cache cache );
typedef FT_Int
(*FTC_Family_CompareFunc)( FTC_Family family,
FTC_Query query );
typedef void
(*FTC_Family_DoneFunc)( FTC_Family family,
FTC_Cache cache );
/* initialize a new cache node */
typedef FT_Error
(*FTC_Node_InitFunc)( FTC_Node node,
FT_Pointer type,
FTC_Cache cache );
(*FTC_Node_NewFunc)( FTC_Node *pnode,
FT_Pointer query,
FTC_Cache cache );
/* compute the weight of a given cache node */
typedef FT_ULong
(*FTC_Node_WeightFunc)( FTC_Node node,
FTC_Cache cache );
@@ -236,62 +107,159 @@ FT_BEGIN_HEADER
FT_Pointer key,
FTC_Cache cache );
/* finalize a given cache node */
typedef void
(*FTC_Node_DoneFunc)( FTC_Node node,
(*FTC_Node_FreeFunc)( FTC_Node node,
FTC_Cache cache );
typedef FT_Error
(*FTC_Cache_InitFunc)( FTC_Cache cache );
typedef struct FTC_Cache_ClassRec_
typedef void
(*FTC_Cache_DoneFunc)( FTC_Cache cache );
typedef struct FTC_CacheClassRec_
{
FT_UInt cache_size;
FTC_Cache_InitFunc cache_init;
FTC_Cache_ClearFunc cache_clear;
FTC_Cache_DoneFunc cache_done;
FTC_Node_NewFunc node_new;
FTC_Node_WeightFunc node_weight;
FTC_Node_CompareFunc node_compare;
FTC_Node_CompareFunc node_remove_faceid;
FTC_Node_FreeFunc node_free;
FT_UInt family_size;
FTC_Family_InitFunc family_init;
FTC_Family_CompareFunc family_compare;
FTC_Family_DoneFunc family_done;
FT_UInt cache_size;
FTC_Cache_InitFunc cache_init;
FTC_Cache_DoneFunc cache_done;
FT_UInt node_size;
FTC_Node_InitFunc node_init;
FTC_Node_WeightFunc node_weight;
FTC_Node_CompareFunc node_compare;
FTC_Node_DoneFunc node_done;
} FTC_Cache_ClassRec;
} FTC_CacheClassRec;
/* */
/* each cache really implements a dynamic hash table to manage its nodes */
typedef struct FTC_CacheRec_
{
FT_UFast p;
FT_UFast mask;
FT_Long slack;
FTC_Node* buckets;
FTC_CacheClassRec clazz; /* local copy, for speed */
FTC_Manager manager;
FT_Memory memory;
FT_UInt index; /* in manager's table */
FTC_CacheClass org_class; /* original class pointer */
} FTC_CacheRec;
/*************************************************************************/
/* */
/* These functions are exported so that they can be called from */
/* user-provided cache classes; otherwise, they are really part of the */
/* cache sub-system internals. */
/* */
#define FTC_CACHE( x ) ( (FTC_Cache)(x) )
#define FTC_CACHE_P( x ) ( (FTC_Cache*)(x) )
/* can be used directly as FTC_Cache_DoneFunc(), or called by custom */
/* cache finalizers */
FT_EXPORT( void )
ftc_cache_done( FTC_Cache cache );
/* can be used directly as FTC_Cache_ClearFunc(), or called by custom */
/* cache clear routines */
FT_EXPORT( void )
ftc_cache_clear( FTC_Cache cache );
/* initalize the hash table within the cache */
/* default cache initialize */
FT_EXPORT( FT_Error )
ftc_cache_init( FTC_Cache cache );
FTC_Cache_Init( FTC_Cache cache );
/* can be called when the key's hash value has been computed */
/* default cache finalizer */
FT_EXPORT( void )
FTC_Cache_Done( FTC_Cache cache );
/* Call this function to lookup the cache. If no corresponding
* node is found, a new one is automatically created. This function
* is capable of flushing the cache adequately to make room for the
* new cache object.
*/
FT_EXPORT( FT_Error )
ftc_cache_lookup( FTC_Cache cache,
FTC_Query query,
FTC_Node *anode );
FTC_Cache_Lookup( FTC_Cache cache,
FT_UInt32 hash,
FT_Pointer query,
FTC_Node *anode );
FT_EXPORT( FT_Error )
FTC_Cache_NewNode( FTC_Cache cache,
FT_UInt32 hash,
FT_Pointer query,
FTC_Node *anode );
/* Remove all nodes that relate to a given face_id. This is useful
* when un-installing fonts. Note that if a cache node relates to
* the face_id, but is locked (i.e., has 'ref_count > 0'), the node
* will _not_ be destroyed, but its internal face_id reference will
* be modified.
*
* The final result will be that the node will never come back
* in further lookup requests, and will be flushed on demand from
* the cache normally when its reference count reaches 0.
*/
FT_EXPORT( void )
FTC_Cache_RemoveFaceID( FTC_Cache cache,
FTC_FaceID face_id );
#ifdef FTC_INLINE
#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \
FT_BEGIN_STMNT \
FTC_Node *_bucket, *_pnode, _node; \
FTC_Cache _cache = FTC_CACHE(cache); \
FT_UInt32 _hash = (FT_UInt32)(hash); \
FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \
FT_UInt _idx; \
\
\
error = 0; \
node = NULL; \
_idx = _hash & _cache->mask; \
if ( _idx < _cache->p ) \
_idx = _hash & ( _cache->mask*2 + 1 ); \
\
_bucket = _pnode = _cache->buckets + _idx; \
for (;;) \
{ \
_node = *_pnode; \
if ( _node == NULL ) \
goto _NewNode; \
\
if ( _node->hash == _hash && _nodcomp( _node, query, _cache ) ) \
break; \
\
_pnode = &_node->link; \
} \
\
if ( _node != *_bucket ) \
{ \
*_pnode = _node->link; \
_node->link = *_bucket; \
*_bucket = _node; \
} \
\
{ \
FTC_Manager _manager = _cache->manager; \
\
\
if ( _node != _manager->nodes_list ) \
FTC_MruNode_Up( (FTC_MruNode*)&_manager->nodes_list, \
(FTC_MruNode)_node ); \
} \
goto _Ok; \
\
_NewNode: \
error = FTC_Cache_NewNode( _cache, _hash, query, &_node ); \
\
_Ok: \
*(FTC_Node*)&(node) = _node; \
FT_END_STMNT
#else /* !FTC_INLINE */
#define FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ) \
FT_BEGIN_STMNT \
error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, \
(FTC_Node*)&(node) ); \
FT_END_STMNT
#endif /* !FTC_INLINE */
/* */
@@ -301,4 +269,4 @@ FT_END_HEADER
#endif /* __FTCCACHE_H__ */
/* END */
/* END */
+7 -7
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType charmap cache (specification). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -36,7 +36,7 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* @type: */
/* FTC_CmapCache */
/* FTC_CMapCache */
/* */
/* @description: */
/* An opaque handle used to manager a charmap cache. This cache is */
@@ -54,8 +54,8 @@ FT_BEGIN_HEADER
/* A handle to an @FTC_CMapDescRec structure used to describe a given */
/* charmap in a charmap cache. */
/* */
/* Each @FTC_CMapDesc describes which charmap (of which @FTC_Face) we */
/* want to use in @FTC_CMapCache_Lookup. */
/* Each @FTC_CMapDesc describes which charmap (of which @FTC_FaceID) */
/* we want to use in @FTC_CMapCache_Lookup. */
/* */
typedef struct FTC_CMapDescRec_* FTC_CMapDesc;
@@ -66,8 +66,8 @@ FT_BEGIN_HEADER
/* FTC_CMapType */
/* */
/* @description: */
/* The list of valid @FTC_CMap types. They indicate how we want to */
/* address a charmap within an @FTC_FaceID. */
/* The list of valid @FTC_CMapDesc types. They indicate how we want */
/* to address a charmap within an @FTC_FaceID. */
/* */
/* @values: */
/* FTC_CMAP_BY_INDEX :: */
@@ -213,4 +213,4 @@ FT_END_HEADER
#endif /* __FTCCMAP_H__ */
/* END */
/* END */
+201 -99
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType abstract glyph cache (specification). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -16,13 +16,84 @@
/***************************************************************************/
/*
*
* FTC_GCache is an _abstract_ cache object optimized to store glyph
* data. It works as follows:
*
* - It manages FTC_GNode objects. Each one of them can hold one or more
* glyph `items'. Item types are not specified in the FTC_GCache but
* in classes that extend it.
*
* - Glyph attributes, like face ID, character size, render mode, etc.,
* can be grouped into abstract `glyph families'. This avoids storing
* the attributes within the FTC_GCache, since it is likely that many
* FTC_GNodes will belong to the same family in typical uses.
*
* - Each FTC_GNode is thus an FTC_Node with two additional fields:
*
* * gindex: A glyph index, or the first index in a glyph range.
* * family: A pointer to a glyph `family'.
*
* - Family types are not fully specific in the FTC_Family type, but
* by classes that extend it.
*
* Note that both FTC_ImageCache and FTC_SBitCache extend FTC_GCache.
* They share an FTC_Family sub-class called FTC_BasicFamily which is
* used to store the following data: face ID, pixel/point sizes, load
* flags. For more details see the file `src/cache/ftcbasic.c'.
*
* Client applications can extend FTC_GNode with their own FTC_GNode
* and FTC_Family sub-classes to implement more complex caches (e.g.,
* handling automatic synthesis, like obliquing & emboldening, colored
* glyphs, etc.).
*
* See also the FTC_ICache & FTC_SCache classes in `ftcimage.h' and
* `ftcsbits.h', which both extend FTC_GCache with additional
* optimizations.
*
* A typical FTC_GCache implementation must provide at least the
* following:
*
* - FTC_GNode sub-class, e.g. MyNode, with relevant methods:
* my_node_new (must call FTC_GNode_Init)
* my_node_free (must call FTC_GNode_Done)
* my_node_compare (must call FTC_GNode_Compare)
* my_node_remove_faceid (must call ftc_gnode_unselect in case
* of match)
*
* - FTC_Family sub-class, e.g. MyFamily, with relevant methods:
* my_family_compare
* my_family_init
* my_family_reset (optional)
* my_family_done
*
* - FTC_GQuery sub-class, e.g. MyQuery, to hold cache-specific query
* data.
*
* - Constant structures for a FTC_GNodeClass.
*
* - MyCacheNew() can be implemented easily as a call to the convenience
* function FTC_GCache_New.
*
* - MyCacheLookup with a call to FTC_GCache_Lookup. This function will
* automatically:
*
* - Search for the corresponding family in the cache, or create
* a new one if necessary. Put it in FTC_GQUERY(myquery).family
*
* - Call FTC_Cache_Lookup.
*
* If it returns NULL, you should create a new node, then call
* ftc_cache_add as usual.
*/
/*************************************************************************/
/* */
/* 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. */
/* */
/*************************************************************************/
@@ -47,99 +118,53 @@
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_MANAGER_H
#include <stddef.h>
#include FT_CACHE_INTERNAL_MANAGER_H
FT_BEGIN_HEADER
/* each glyph set is characterized by a "glyph set type" which must be */
/* defined by sub-classes */
typedef struct FTC_GlyphFamilyRec_* FTC_GlyphFamily;
/*
* We can group glyphs into `families'. Each family correspond to a
* given face ID, character size, transform, etc.
*
* Families are implemented as MRU list nodes. They are
* reference-counted.
*/
/* handle to a glyph cache node */
typedef struct FTC_GlyphNodeRec_* FTC_GlyphNode;
/* size should be 24 + chunk size on 32-bit machines; */
/* note that the node's hash is ((gfam->hash << 16) | glyph_index) -- */
/* this _must_ be set properly by the glyph node initializer */
/* */
typedef struct FTC_GlyphNodeRec_
typedef struct FTC_FamilyRec_
{
FTC_NodeRec node;
FT_UShort item_count;
FT_UShort item_start;
FTC_MruNodeRec mrunode;
FT_UInt num_nodes; /* current number of nodes in this family */
FTC_Cache cache;
FTC_MruListClass clazz;
} FTC_GlyphNodeRec;
} FTC_FamilyRec, *FTC_Family;
#define FTC_FAMILY(x) ( (FTC_Family)(x) )
#define FTC_FAMILY_P(x) ( (FTC_Family*)(x) )
#define FTC_GLYPH_NODE( x ) ( (FTC_GlyphNode)(x) )
#define FTC_GLYPH_NODE_P( x ) ( (FTC_GlyphNode*)(x) )
typedef struct FTC_GlyphQueryRec_
typedef struct FTC_GNodeRec_
{
FTC_QueryRec query;
FT_UInt gindex;
FTC_NodeRec node;
FTC_Family family;
FT_UInt gindex;
} FTC_GlyphQueryRec, *FTC_GlyphQuery;
} FTC_GNodeRec, *FTC_GNode;
#define FTC_GNODE( x ) ( (FTC_GNode)(x) )
#define FTC_GNODE_P( x ) ( (FTC_GNode*)(x) )
#define FTC_GLYPH_QUERY( x ) ( (FTC_GlyphQuery)(x) )
/* a glyph set is used to categorize glyphs of a given type */
typedef struct FTC_GlyphFamilyRec_
typedef struct FTC_GQueryRec_
{
FTC_FamilyRec family;
FT_UInt32 hash;
FT_UInt item_total; /* total number of glyphs in family */
FT_UInt item_count; /* number of glyph items per node */
FT_UInt gindex;
FTC_Family family;
} FTC_GlyphFamilyRec;
} FTC_GQueryRec, *FTC_GQuery;
#define FTC_GLYPH_FAMILY( x ) ( (FTC_GlyphFamily)(x) )
#define FTC_GLYPH_FAMILY_P( x ) ( (FTC_GlyphFamily*)(x) )
#define FTC_GLYPH_FAMILY_MEMORY( x ) FTC_FAMILY(x)->cache->memory
/* each glyph node contains a 'chunk' of glyph items; */
/* translate a glyph index into a chunk index */
#define FTC_GLYPH_FAMILY_CHUNK( gfam, gindex ) \
( ( gindex ) / FTC_GLYPH_FAMILY( gfam )->item_count )
/* find a glyph index's chunk, and return its start index */
#define FTC_GLYPH_FAMILY_START( gfam, gindex ) \
( FTC_GLYPH_FAMILY_CHUNK( gfam, gindex ) * \
FTC_GLYPH_FAMILY( gfam )->item_count )
/* compute a glyph request's hash value */
#define FTC_GLYPH_FAMILY_HASH( gfam, gindex ) \
( (FT_UFast)( \
( FTC_GLYPH_FAMILY( gfam )->hash << 16 ) | \
( FTC_GLYPH_FAMILY_CHUNK( gfam, gindex ) & 0xFFFF ) ) )
/* must be called in an FTC_Family_CompareFunc to update the query */
/* whenever a glyph set is matched in the lookup, or when it */
/* is created */
#define FTC_GLYPH_FAMILY_FOUND( gfam, gquery ) \
do \
{ \
FTC_QUERY( gquery )->family = FTC_FAMILY( gfam ); \
FTC_QUERY( gquery )->hash = \
FTC_GLYPH_FAMILY_HASH( gfam, \
FTC_GLYPH_QUERY( gquery )->gindex ); \
} while ( 0 )
/* retrieve glyph index of glyph node */
#define FTC_GLYPH_NODE_GINDEX( x ) \
( (FT_UInt)( FTC_GLYPH_NODE( x )->node.hash & 0xFFFF ) )
#define FTC_GQUERY( x ) ( (FTC_GQuery)(x) )
/*************************************************************************/
@@ -151,43 +176,120 @@ FT_BEGIN_HEADER
/* must be called by derived FTC_Node_InitFunc routines */
FT_EXPORT( void )
ftc_glyph_node_init( FTC_GlyphNode node,
FT_UInt gindex, /* glyph index for node */
FTC_GlyphFamily gfam );
FTC_GNode_Init( FTC_GNode node,
FT_UInt gindex, /* glyph index for node */
FTC_Family family );
/* returns TRUE iff the query's glyph index correspond to the node; */
/* this assumes that the "family" and "hash" fields of the query are */
/* already correctly set */
FT_EXPORT( FT_Bool )
ftc_glyph_node_compare( FTC_GlyphNode gnode,
FTC_GlyphQuery gquery );
FTC_GNode_Compare( FTC_GNode gnode,
FTC_GQuery gquery );
/* call this function to clear a node's family -- this is necessary */
/* to implement the `node_remove_faceid' cache method correctly */
FT_EXPORT( void )
FTC_GNode_UnselectFamily( FTC_GNode gnode,
FTC_Cache cache );
/* must be called by derived FTC_Node_DoneFunc routines */
FT_EXPORT( void )
ftc_glyph_node_done( FTC_GlyphNode node,
FTC_Cache cache );
FTC_GNode_Done( FTC_GNode node,
FTC_Cache cache );
/* must be called by derived FTC_Family_InitFunc; */
/* calls "ftc_family_init" */
FT_EXPORT( FT_Error )
ftc_glyph_family_init( FTC_GlyphFamily gfam,
FT_UInt32 hash,
FT_UInt item_count,
FT_UInt item_total,
FTC_GlyphQuery gquery,
FTC_Cache cache );
FT_EXPORT( void )
ftc_glyph_family_done( FTC_GlyphFamily gfam );
FTC_Family_Init( FTC_Family family,
FTC_Cache cache );
typedef struct FTC_GCacheRec_
{
FTC_CacheRec cache;
FTC_MruListRec families;
} FTC_GCacheRec, *FTC_GCache;
#define FTC_GCACHE( x ) ((FTC_GCache)(x))
/* can be used as @FTC_Cache_InitFunc */
FT_EXPORT( FT_Error )
FTC_GCache_Init( FTC_GCache cache );
/* can be used as @FTC_Cache_DoneFunc */
FT_EXPORT( void )
FTC_GCache_Done( FTC_GCache cache );
/* the glyph cache class adds fields for the family implementation */
typedef struct FTC_GCacheClassRec_
{
FTC_CacheClassRec clazz;
FTC_MruListClass family_class;
} FTC_GCacheClassRec;
typedef const FTC_GCacheClassRec* FTC_GCacheClass;
#define FTC_GCACHE_CLASS( x ) ((FTC_GCacheClass)(x))
#define FTC_CACHE__GCACHE_CLASS( x ) \
FTC_GCACHE_CLASS( FTC_CACHE(x)->org_class )
#define FTC_CACHE__FAMILY_CLASS( x ) \
((FTC_MruListClass) FTC_CACHE__GCACHE_CLASS(x)->family_class)
/* convenience function; use it instead of FTC_Manager_Register_Cache */
FT_EXPORT( FT_Error )
FTC_GCache_New( FTC_Manager manager,
FTC_GCacheClass clazz,
FTC_GCache *acache );
FT_EXPORT( FT_Error )
FTC_GCache_Lookup( FTC_GCache cache,
FT_UInt32 hash,
FT_UInt gindex,
FTC_GQuery query,
FTC_Node *anode );
#ifdef FTC_INLINE
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \
gindex, query, node, error ) \
FT_BEGIN_STMNT \
FTC_GCache _gcache = FTC_GCACHE( cache ); \
FTC_GQuery _gquery = (FTC_GQuery)( query ); \
FTC_MruNode_CompareFunc _fcompare = (FTC_MruNode_CompareFunc)(famcmp); \
\
\
_gquery->gindex = (gindex); \
\
FTC_MRULIST_LOOKUP_CMP( &_gcache->families, _gquery, _fcompare, \
_gquery->family, error ); \
if ( !error ) \
FTC_CACHE_LOOKUP_CMP( cache, nodecmp, hash, query, node, error ); \
FT_END_STMNT
/* */
#else /* !FTC_INLINE */
#define FTC_GCACHE_LOOKUP_CMP( cache, famcmp, nodecmp, hash, \
gindex, query, node, error ) \
FT_BEGIN_STMNT \
error = FTC_GCache_Lookup( FTC_GCACHE( cache ), hash, gindex, \
FTC_GQUERY( query ), (FTC_Node*)&(node) ); \
FT_END_STMNT
#endif /* !FTC_INLINE */
FT_END_HEADER
#endif /* __FTCGLYPH_H__ */
/* END */
/* END */
+51 -259
View File
@@ -2,9 +2,9 @@
/* */
/* ftcimage.h */
/* */
/* FreeType Image cache (specification). */
/* FreeType Generic Image cache (specification) */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -16,6 +16,15 @@
/***************************************************************************/
/*
* FTC_ICache is an _abstract_ cache used to store a single FT_Glyph
* image per cache node.
*
* FTC_ICache extends FTC_GCache. For an implementation example,
* see FTC_ImageCache in `src/cache/ftbasic.c'.
*/
/*************************************************************************/
/* */
/* Each image cache really manages FT_Glyph objects. */
@@ -29,284 +38,67 @@
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_INTERNAL_GLYPH_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* cache_subsystem */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** IMAGE CACHE OBJECT *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/**************************************************************************
*
* @struct:
* FTC_ImageTypeRec
*
* @description:
* A simple structure used to describe the type of glyph image to be
* loaded into the cache.
*
* @fields:
* font :: An @FTC_FontRec used to describe the glyph's face and size.
*
* flags :: The load flags to be applied when loading the glyph; see
* the @FT_LOAD_XXX constants for details.
*
* @note:
* This type completely replaces the @FTC_Image_Desc structure which is
* now obsolete.
*/
typedef struct FTC_ImageTypeRec_
/* the FT_Glyph image node type - we store only 1 glyph per node */
typedef struct FTC_INodeRec_
{
FTC_FontRec font;
FT_Int32 flags;
FTC_GNodeRec gnode;
FT_Glyph glyph;
} FTC_ImageTypeRec;
} FTC_INodeRec, *FTC_INode;
typedef struct FTC_ImageTypeRec_* FTC_ImageType;
#define FTC_INODE( x ) ( (FTC_INode)( x ) )
#define FTC_INODE_GINDEX( x ) FTC_GNODE(x)->gindex
#define FTC_INODE_FAMILY( x ) FTC_GNODE(x)->family
/* */
typedef FT_Error
(*FTC_IFamily_LoadGlyphFunc)( FTC_Family family,
FT_UInt gindex,
FTC_Cache cache,
FT_Glyph *aglyph );
#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
(d1)->flags == (d2)->flags )
#define FTC_IMAGE_TYPE_HASH( d ) \
(FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \
( (d)->flags << 4 ) )
/*************************************************************************/
/* */
/* <Type> */
/* FTC_ImageCache */
/* */
/* <Description> */
/* A handle to an glyph image cache object. They are designed to */
/* hold many distinct glyph images while not exceeding a certain */
/* 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> */
/* Retrieves a given glyph image from a glyph image cache. */
/* */
/* <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. */
/* */
/* <Output> */
/* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
/* failure. */
/* */
/* anode :: Used to return the address of of the corresponding cache */
/* node after incrementing its reference count (see note */
/* below). */
/* */
/* <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 */
/* 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! */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_Lookup( FTC_ImageCache cache,
FTC_ImageType type,
FT_UInt gindex,
FT_Glyph *aglyph,
FTC_Node *anode );
/* */
#define ftc_image_format( x ) ( (x) & 7 )
#define ftc_image_format_bitmap 0x0000
#define ftc_image_format_outline 0x0001
#define ftc_image_format_mask 0x000F
#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
/* monochrome bitmap */
#define ftc_image_mono ftc_image_format_bitmap | \
ftc_image_flag_monochrome
/* anti-aliased bitmap */
#define ftc_image_grays ftc_image_format_bitmap
/* scaled outline */
#define ftc_image_outline ftc_image_format_outline
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_Image_Desc */
/* */
/* <Description> */
/* THIS TYPE IS DEPRECATED. Use @FTC_ImageDesc instead. */
/* */
/* A simple structure used to describe a given glyph image category. */
/* */
/* <Fields> */
/* size :: An @FTC_SizeRec used to describe the glyph's face */
/* and size. */
/* */
/* image_type :: The glyph image's type. */
/* */
typedef struct FTC_Image_Desc_
typedef struct FTC_IFamilyClassRec_
{
FTC_FontRec font;
FT_UInt image_type;
FTC_MruListClassRec clazz;
FTC_IFamily_LoadGlyphFunc family_load_glyph;
} FTC_Image_Desc;
} FTC_IFamilyClassRec;
typedef const FTC_IFamilyClassRec* FTC_IFamilyClass;
#define FTC_IFAMILY_CLASS( x ) ((FTC_IFamilyClass)(x))
#define FTC_CACHE__IFAMILY_CLASS( x ) \
FTC_IFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS(x)->family_class )
/*************************************************************************/
/* */
/* <Type> */
/* FTC_Image_Cache */
/* */
/* <Description> */
/* THIS TYPE IS DEPRECATED. Use @FTC_ImageCache instead. */
/* */
typedef FTC_ImageCache FTC_Image_Cache;
/* can be used as a @FTC_Node_FreeFunc */
FT_EXPORT( void )
FTC_INode_Free( FTC_INode inode,
FTC_Cache cache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Image_Cache_New */
/* */
/* <Description> */
/* THIS FUNCTION IS DEPRECATED. Use @FTC_ImageCache_New instead. */
/* */
/* 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. */
/* */
/* Can be used as @FTC_Node_NewFunc. `gquery.index' and `gquery.family'
* must be set correctly. This function will call the `family_load_glyph'
* method to load the FT_Glyph into the cache node.
*/
FT_EXPORT( FT_Error )
FTC_Image_Cache_New( FTC_Manager manager,
FTC_Image_Cache *acache );
FTC_INode_New( FTC_INode *pinode,
FTC_GQuery gquery,
FTC_Cache cache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Image_Cache_Lookup */
/* */
/* <Description> */
/* THIS FUNCTION IS DEPRECATED. Use @FTC_ImageCache_Lookup instead. */
/* */
/* <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> */
/* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
/* failure. */
/* */
/* <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 */
/* create a copy with @FT_Glyph_Copy and modify the new one. */
/* */
/* Because the glyph image cache limits the total amount of memory */
/* taken by the glyphs it holds, the returned glyph might disappear */
/* on a later invocation of this function! It is a cache after */
/* all... */
/* */
/* Use this function to "lock" the glyph as long as it is needed. */
/* */
FT_EXPORT( FT_Error )
FTC_Image_Cache_Lookup( FTC_Image_Cache cache,
FTC_Image_Desc* desc,
FT_UInt gindex,
FT_Glyph *aglyph );
/* can be used as @FTC_Node_WeightFunc */
FT_EXPORT( FT_ULong )
FTC_INode_Weight( FTC_INode inode );
/* */
FT_END_HEADER
#endif /* __FTCIMAGE_H__ */
/* END */
/* END */
+34 -103
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType Cache Manager (specification). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -65,7 +65,7 @@
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_INTERNAL_LRU_H
#include FT_CACHE_INTERNAL_MRU_H
#include FT_CACHE_INTERNAL_CACHE_H
@@ -88,91 +88,25 @@ FT_BEGIN_HEADER
#define FTC_MAX_CACHES 16
typedef struct FTC_FamilyEntryRec_
{
FTC_Family family;
FTC_Cache cache;
FT_UInt index;
FT_UInt link;
} FTC_FamilyEntryRec, *FTC_FamilyEntry;
#define FTC_FAMILY_ENTRY_NONE ( (FT_UInt)-1 )
typedef struct FTC_FamilyTableRec_
{
FT_UInt count;
FT_UInt size;
FTC_FamilyEntry entries;
FT_UInt free;
} FTC_FamilyTableRec, *FTC_FamilyTable;
FT_EXPORT( FT_Error )
ftc_family_table_alloc( FTC_FamilyTable table,
FT_Memory memory,
FTC_FamilyEntry *aentry );
FT_EXPORT( void )
ftc_family_table_free( FTC_FamilyTable table,
FT_UInt idx );
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_ManagerRec */
/* */
/* <Description> */
/* The cache manager structure. */
/* */
/* <Fields> */
/* library :: A handle to a FreeType library instance. */
/* */
/* faces_list :: The lru list of @FT_Face objects in the cache. */
/* */
/* sizes_list :: The lru list of @FT_Size objects in the cache. */
/* */
/* max_weight :: The maximum cache pool weight. */
/* */
/* cur_weight :: The current cache pool weight. */
/* */
/* num_nodes :: The current number of nodes in the manager. */
/* */
/* nodes_list :: The global lru list of all cache nodes. */
/* */
/* caches :: A table of installed/registered cache objects. */
/* */
/* request_data :: User-provided data passed to the requester. */
/* */
/* request_face :: User-provided function used to implement a mapping */
/* between abstract @FTC_FaceID values and real */
/* @FT_Face objects. */
/* */
/* families :: Global table of families. */
/* */
typedef struct FTC_ManagerRec_
{
FT_Library library;
FT_LruList faces_list;
FT_LruList sizes_list;
FT_Memory memory;
FTC_Node nodes_list;
FT_ULong max_weight;
FT_ULong cur_weight;
FT_UInt num_nodes;
FTC_Node nodes_list;
FTC_Cache caches[FTC_MAX_CACHES];
FT_UInt num_caches;
FTC_MruListRec faces;
FTC_MruListRec sizes;
FT_Pointer request_data;
FTC_Face_Requester request_face;
FTC_FamilyTableRec families;
} FTC_ManagerRec;
@@ -201,44 +135,41 @@ FT_BEGIN_HEADER
FTC_Manager_Compress( FTC_Manager manager );
/* try to flush `count' old nodes from the cache; return the number
* of really flushed nodes
*/
FT_EXPORT( FT_UInt )
FTC_Manager_FlushN( FTC_Manager manager,
FT_UInt count );
/* this must be used internally for the moment */
FT_EXPORT( FT_Error )
FTC_Manager_Register_Cache( FTC_Manager manager,
FTC_Cache_Class clazz,
FTC_Cache *acache );
FTC_Manager_RegisterCache( FTC_Manager manager,
FTC_CacheClass clazz,
FTC_Cache *acache );
/* */
/* can be called to increment a node's reference count */
FT_EXPORT( void )
FTC_Node_Ref( FTC_Node node,
FTC_Manager manager );
#define FTC_SCALER_COMPARE( a, b ) \
( (a)->face_id == (b)->face_id && \
(a)->width == (b)->width && \
(a)->height == (b)->height && \
((a)->pixel != 0) == ((b)->pixel != 0) && \
( (a)->pixel || \
( (a)->x_res == (b)->x_res && \
(a)->y_res == (b)->y_res ) ) )
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Node_Unref */
/* */
/* <Description> */
/* Decrement a cache node's internal reference count. When the count */
/* reaches 0, it is not destroyed but becomes eligible for subsequent */
/* cache flushes. */
/* */
/* <Input> */
/* node :: The cache node handle. */
/* */
/* manager :: The cache manager handle. */
/* */
FT_EXPORT( void )
FTC_Node_Unref( FTC_Node node,
FTC_Manager manager );
#define FTC_SCALER_HASH( q ) \
( FTC_FACE_ID_HASH( (q)->face_id ) + \
(q)->width + (q)->height*7 + \
( (q)->pixel ? 0 : ( (q)->x_res*33 ^ (q)->y_res*61 ) ) )
/* */
FT_END_HEADER
#endif /* __FTCMANAG_H__ */
/* END */
/* END */
+246
View File
@@ -0,0 +1,246 @@
/***************************************************************************/
/* */
/* ftcmru.h */
/* */
/* Simple MRU list-cache (specification). */
/* */
/* Copyright 2000-2001, 2003, 2004 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. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* An MRU is a list that cannot hold more than a certain number of */
/* elements (`max_elements'). All elements in the list are sorted in */
/* least-recently-used order, i.e., the `oldest' element is at the tail */
/* of the list. */
/* */
/* When doing a lookup (either through `Lookup()' or `Lookup_Node()'), */
/* the list is searched for an element with the corresponding key. If */
/* it is found, the element is moved to the head of the list and is */
/* returned. */
/* */
/* If no corresponding element is found, the lookup routine will try to */
/* obtain a new element with the relevant key. If the list is already */
/* full, the oldest element from the list is discarded and replaced by a */
/* new one; a new element is added to the list otherwise. */
/* */
/* Note that it is possible to pre-allocate the element list nodes. */
/* This is handy if `max_elements' is sufficiently small, as it saves */
/* allocations/releases during the lookup process. */
/* */
/*************************************************************************/
#ifndef __FTCMRU_H__
#define __FTCMRU_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
#define xxFT_DEBUG_ERROR
#define FTC_INLINE
FT_BEGIN_HEADER
typedef struct FTC_MruNodeRec_* FTC_MruNode;
typedef struct FTC_MruNodeRec_
{
FTC_MruNode next;
FTC_MruNode prev;
} FTC_MruNodeRec;
FT_EXPORT( void )
FTC_MruNode_Prepend( FTC_MruNode *plist,
FTC_MruNode node );
FT_EXPORT( void )
FTC_MruNode_Up( FTC_MruNode *plist,
FTC_MruNode node );
FT_EXPORT( void )
FTC_MruNode_Remove( FTC_MruNode *plist,
FTC_MruNode node );
typedef struct FTC_MruListRec_* FTC_MruList;
typedef struct FTC_MruListClassRec_ const * FTC_MruListClass;
typedef FT_Int
(*FTC_MruNode_CompareFunc)( FTC_MruNode node,
FT_Pointer key );
typedef FT_Error
(*FTC_MruNode_InitFunc)( FTC_MruNode node,
FT_Pointer key,
FT_Pointer data );
typedef FT_Error
(*FTC_MruNode_ResetFunc)( FTC_MruNode node,
FT_Pointer key,
FT_Pointer data );
typedef void
(*FTC_MruNode_DoneFunc)( FTC_MruNode node,
FT_Pointer data );
typedef struct FTC_MruListClassRec_
{
FT_UInt node_size;
FTC_MruNode_CompareFunc node_compare;
FTC_MruNode_InitFunc node_init;
FTC_MruNode_ResetFunc node_reset;
FTC_MruNode_DoneFunc node_done;
} FTC_MruListClassRec;
typedef struct FTC_MruListRec_
{
FT_UInt num_nodes;
FT_UInt max_nodes;
FTC_MruNode nodes;
FT_Pointer data;
FTC_MruListClassRec clazz;
FT_Memory memory;
} FTC_MruListRec;
FT_EXPORT( void )
FTC_MruList_Init( FTC_MruList list,
FTC_MruListClass clazz,
FT_UInt max_nodes,
FT_Pointer data,
FT_Memory memory );
FT_EXPORT( void )
FTC_MruList_Reset( FTC_MruList list );
FT_EXPORT( void )
FTC_MruList_Done( FTC_MruList list );
FT_EXPORT( FTC_MruNode )
FTC_MruList_Find( FTC_MruList list,
FT_Pointer key );
FT_EXPORT( FT_Error )
FTC_MruList_New( FTC_MruList list,
FT_Pointer key,
FTC_MruNode *anode );
FT_EXPORT( FT_Error )
FTC_MruList_Lookup( FTC_MruList list,
FT_Pointer key,
FTC_MruNode *pnode );
FT_EXPORT( void )
FTC_MruList_Remove( FTC_MruList list,
FTC_MruNode node );
FT_EXPORT( void )
FTC_MruList_RemoveSelection( FTC_MruList list,
FTC_MruNode_CompareFunc selection,
FT_Pointer key );
#ifdef FTC_INLINE
#define FTC_MRULIST_LOOKUP_CMP( list, key, compare, node, error ) \
FT_BEGIN_STMNT \
FTC_MruNode* _pfirst = &(list)->nodes; \
FTC_MruNode_CompareFunc _compare = (FTC_MruNode_CompareFunc)(compare); \
FTC_MruNode _first, _node; \
\
\
error = 0; \
_first = *(_pfirst); \
_node = NULL; \
\
if ( _first ) \
{ \
_node = _first; \
do \
{ \
if ( _compare( _node, (key) ) ) \
{ \
if ( _node != _first ) \
FTC_MruNode_Up( _pfirst, _node ); \
\
*(FTC_MruNode*)&(node) = _node; \
goto _MruOk; \
} \
_node = _node->next; \
\
} while ( _node != _first) ; \
} \
\
error = FTC_MruList_New( (list), (key), (FTC_MruNode*)&(node) ); \
_MruOk: \
; \
FT_END_STMNT
#define FTC_MRULIST_LOOKUP( list, key, node, error ) \
FTC_MRULIST_LOOKUP_CMP( list, key, (list)->clazz.node_compare, node, error )
#else /* !FTC_INLINE */
#define FTC_MRULIST_LOOKUP( list, key, node, error ) \
error = FTC_MruList_Lookup( (list), (key), (FTC_MruNode*)&(node) )
#endif /* !FTC_INLINE */
#define FTC_MRULIST_LOOP( list, node ) \
FT_BEGIN_STMNT \
FTC_MruNode _first = (list)->nodes; \
\
\
if ( _first ) \
{ \
FTC_MruNode _node = _first; \
\
\
do \
{ \
*(FTC_MruNode*)&(node) = _node;
#define FTC_MRULIST_LOOP_END() \
_node = _node->next; \
\
} while ( _node != _first ); \
} \
FT_END_STMNT
/* */
FT_END_HEADER
#endif /* __FTCMRU_H__ */
/* END */
+50 -229
View File
@@ -4,7 +4,7 @@
/* */
/* A small-bitmap cache (specification). */
/* */
/* Copyright 2000-2001, 2002 by */
/* Copyright 2000-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,254 +22,75 @@
#include <ft2build.h>
#include FT_CACHE_H
#include FT_CACHE_IMAGE_H
#include FT_CACHE_INTERNAL_GLYPH_H
FT_BEGIN_HEADER
#define FTC_SBIT_ITEMS_PER_NODE 16
/*************************************************************************/
/* */
/* <Section> */
/* cache_subsystem */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBit */
/* */
/* <Description> */
/* A handle to a small bitmap descriptor. See the @FTC_SBitRec */
/* structure for details. */
/* */
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 */
/* Y coordinates. */
/* */
/* format :: The format of the glyph bitmap (monochrome or gray). */
/* */
/* max_grays :: Maximum gray level value (in the range 1 to 255). */
/* */
/* 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. */
/* */
/* buffer :: A pointer to the bitmap pixels. */
/* */
typedef struct FTC_SBitRec_
typedef struct FTC_SNodeRec_
{
FT_Byte width;
FT_Byte height;
FT_Char left;
FT_Char top;
FTC_GNodeRec gnode;
FT_UInt count;
FTC_SBitRec sbits[FTC_SBIT_ITEMS_PER_NODE];
FT_Byte format;
FT_Byte max_grays;
FT_Short pitch;
FT_Char xadvance;
FT_Char yadvance;
FT_Byte* buffer;
} FTC_SBitRec;
} FTC_SNodeRec, *FTC_SNode;
/*************************************************************************/
/* */
/* <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;
#define FTC_SNODE( x ) ( (FTC_SNode)( x ) )
#define FTC_SNODE_GINDEX( x ) FTC_GNODE( x )->gindex
#define FTC_SNODE_FAMILY( x ) FTC_GNODE( x )->family
typedef FT_UInt
(*FTC_SFamily_GetCountFunc)( FTC_Family family,
FTC_Manager manager );
typedef FT_Error
(*FTC_SFamily_LoadGlyphFunc)( FTC_Family family,
FT_UInt gindex,
FTC_Manager manager,
FT_Face *aface );
typedef struct FTC_SFamilyClassRec_
{
FTC_MruListClassRec clazz;
FTC_SFamily_GetCountFunc family_get_count;
FTC_SFamily_LoadGlyphFunc family_load_glyph;
} FTC_SFamilyClassRec;
typedef const FTC_SFamilyClassRec* FTC_SFamilyClass;
#define FTC_SFAMILY_CLASS( x ) ((FTC_SFamilyClass)(x))
#define FTC_CACHE__SFAMILY_CLASS( x ) \
FTC_SFAMILY_CLASS( FTC_CACHE__GCACHE_CLASS( x )->family_class )
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBit_Cache */
/* */
/* <Description> */
/* DEPRECATED. Use @FTC_SBitCache instead. */
/* */
typedef FTC_SBitCache FTC_SBit_Cache;
FT_EXPORT( void )
FTC_SNode_Free( FTC_SNode snode,
FTC_Cache cache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_New */
/* */
/* <Description> */
/* Creates a new cache to store small glyph bitmaps. */
/* */
/* <Input> */
/* manager :: A handle to the source cache manager. */
/* */
/* <Output> */
/* acache :: A handle to the new sbit cache. NULL in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_New( FTC_Manager manager,
FTC_SBitCache *acache );
FTC_SNode_New( FTC_SNode *psnode,
FTC_GQuery gquery,
FTC_Cache cache );
FT_EXPORT( FT_ULong )
FTC_SNode_Weight( FTC_SNode inode );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_Lookup */
/* */
/* <Description> */
/* Looks up a given small glyph bitmap in a given sbit cache and */
/* "lock" it to prevent its flushing from the cache until needed */
/* */
/* <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> */
/* FreeType error code. 0 means success. */
/* */
/* <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. */
/* */
/* The descriptor's `buffer' field is set to 0 to indicate a missing */
/* 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_Lookup( FTC_SBitCache cache,
FTC_ImageType type,
FT_UInt gindex,
FTC_SBit *sbit,
FTC_Node *anode );
FT_EXPORT( FT_Bool )
FTC_SNode_Compare( FTC_SNode snode,
FTC_GQuery gquery,
FTC_Cache cache );
/* */
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBit_Cache_New */
/* */
/* <Description> */
/* DEPRECATED. Use @FTC_SBitCache_New instead. */
/* */
/* Creates a new cache to store small glyph bitmaps. */
/* */
/* <Input> */
/* manager :: A handle to the source cache manager. */
/* */
/* <Output> */
/* acache :: A handle to the new sbit cache. NULL in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT( FT_Error )
FTC_SBit_Cache_New( FTC_Manager manager,
FTC_SBit_Cache *acache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBit_Cache_Lookup */
/* */
/* <Description> */
/* DEPRECATED. Use @FTC_SBitCache_Lookup instead. */
/* */
/* Looks up a given small glyph bitmap in a given sbit cache. */
/* */
/* <Input> */
/* cache :: A handle to the source sbit cache. */
/* */
/* desc :: A pointer to the glyph image descriptor. */
/* */
/* gindex :: The glyph index. */
/* */
/* <Output> */
/* sbit :: A handle to a small bitmap descriptor. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <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. */
/* */
/* The descriptor's `buffer' field is set to 0 to indicate a missing */
/* glyph bitmap. */
/* */
FT_EXPORT( FT_Error )
FTC_SBit_Cache_Lookup( FTC_SBit_Cache cache,
FTC_Image_Desc* desc,
FT_UInt gindex,
FTC_SBit *sbit );
FT_END_HEADER
#endif /* __FTCSBITS_H__ */
/* END */
/* END */
-202
View File
@@ -1,202 +0,0 @@
/***************************************************************************/
/* */
/* ftlru.h */
/* */
/* Simple LRU list-cache (specification). */
/* */
/* Copyright 2000-2001 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. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* An LRU is a list that cannot hold more than a certain number of */
/* elements (`max_elements'). All elements in the list are sorted in */
/* least-recently-used order, i.e., the `oldest' element is at the tail */
/* of the list. */
/* */
/* When doing a lookup (either through `Lookup()' or `Lookup_Node()'), */
/* the list is searched for an element with the corresponding key. If */
/* it is found, the element is moved to the head of the list and is */
/* returned. */
/* */
/* If no corresponding element is found, the lookup routine will try to */
/* obtain a new element with the relevant key. If the list is already */
/* full, the oldest element from the list is discarded and replaced by a */
/* new one; a new element is added to the list otherwise. */
/* */
/* Note that it is possible to pre-allocate the element list nodes. */
/* This is handy if `max_elements' is sufficiently small, as it saves */
/* allocations/releases during the lookup process. */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/********* *********/
/********* WARNING, THIS IS BETA CODE. *********/
/********* *********/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
#ifndef __FTLRU_H__
#define __FTLRU_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/* generic list key type */
typedef FT_Pointer FT_LruKey;
/* a list list handle */
typedef struct FT_LruListRec_* FT_LruList;
/* a list class handle */
typedef const struct FT_LruList_ClassRec_* FT_LruList_Class;
/* a list node handle */
typedef struct FT_LruNodeRec_* FT_LruNode;
/* the list node structure */
typedef struct FT_LruNodeRec_
{
FT_LruNode next;
FT_LruKey key;
} FT_LruNodeRec;
/* the list structure */
typedef struct FT_LruListRec_
{
FT_Memory memory;
FT_LruList_Class clazz;
FT_LruNode nodes;
FT_UInt max_nodes;
FT_UInt num_nodes;
FT_Pointer data;
} FT_LruListRec;
/* initialize a list list */
typedef FT_Error
(*FT_LruList_InitFunc)( FT_LruList list );
/* finalize a list list */
typedef void
(*FT_LruList_DoneFunc)( FT_LruList list );
/* this method is used to initialize a new list element node */
typedef FT_Error
(*FT_LruNode_InitFunc)( FT_LruNode node,
FT_LruKey key,
FT_Pointer data );
/* this method is used to finalize a given list element node */
typedef void
(*FT_LruNode_DoneFunc)( FT_LruNode node,
FT_Pointer data );
/* If defined, this method is called when the list if full */
/* during the lookup process -- it is used to change the contents */
/* of a list element node instead of calling `done_element()', */
/* then `init_element()'. Set it to 0 for default behaviour. */
typedef FT_Error
(*FT_LruNode_FlushFunc)( FT_LruNode node,
FT_LruKey new_key,
FT_Pointer data );
/* If defined, this method is used to compare a list element node */
/* with a given key during a lookup. If set to 0, the `key' */
/* fields will be directly compared instead. */
typedef FT_Bool
(*FT_LruNode_CompareFunc)( FT_LruNode node,
FT_LruKey key,
FT_Pointer data );
/* A selector is used to indicate whether a given list element node */
/* is part of a selection for FT_LruList_Remove_Selection(). The */
/* functrion must return true (i.e., non-null) to indicate that the */
/* node is part of it. */
typedef FT_Bool
(*FT_LruNode_SelectFunc)( FT_LruNode node,
FT_Pointer data,
FT_Pointer list_data );
/* LRU class */
typedef struct FT_LruList_ClassRec_
{
FT_UInt list_size;
FT_LruList_InitFunc list_init; /* optional */
FT_LruList_DoneFunc list_done; /* optional */
FT_UInt node_size;
FT_LruNode_InitFunc node_init; /* MANDATORY */
FT_LruNode_DoneFunc node_done; /* optional */
FT_LruNode_FlushFunc node_flush; /* optional */
FT_LruNode_CompareFunc node_compare; /* optional */
} FT_LruList_ClassRec;
/* The following functions must be exported in the case where */
/* applications would want to write their own cache classes. */
FT_EXPORT( FT_Error )
FT_LruList_New( FT_LruList_Class clazz,
FT_UInt max_elements,
FT_Pointer user_data,
FT_Memory memory,
FT_LruList *alist );
FT_EXPORT( void )
FT_LruList_Reset( FT_LruList list );
FT_EXPORT( void )
FT_LruList_Destroy ( FT_LruList list );
FT_EXPORT( FT_Error )
FT_LruList_Lookup( FT_LruList list,
FT_LruKey key,
FT_LruNode *anode );
FT_EXPORT( void )
FT_LruList_Remove( FT_LruList list,
FT_LruNode node );
FT_EXPORT( void )
FT_LruList_Remove_Selection( FT_LruList list,
FT_LruNode_SelectFunc select_func,
FT_Pointer select_data );
/* */
FT_END_HEADER
#endif /* __FTLRU_H__ */
/* END */
@@ -4,7 +4,7 @@
/* */
/* ANSI-specific configuration file (specification only). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -58,24 +58,37 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* The number of bytes in an `int' type. */
#if FT_UINT_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_INT 4
#elif FT_UINT_MAX == 0xFFFFU
#define FT_SIZEOF_INT 2
#elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU
#define FT_SIZEOF_INT 8
#else
#error "Unsupported number of bytes in `int' type!"
/* There are systems (like the Texas Instruments 'C54x) where a `char' */
/* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */
/* `int' has 16 bits also for this system, sizeof(int) gives 1 which */
/* is probably unexpected. */
/* */
/* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
/* `char' type. */
#ifndef FT_CHAR_BIT
#define FT_CHAR_BIT CHAR_BIT
#endif
/* The number of bytes in a `long' type. */
#if FT_ULONG_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_LONG 4
#elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
#define FT_SIZEOF_LONG 8
/* The size of an `int' type. */
#if FT_UINT_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
#elif FT_UINT_MAX == 0xFFFFU
#define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
#elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU
#define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
#else
#error "Unsupported number of bytes in `long' type!"
#error "Unsupported size of `int' type!"
#endif
/* The size of a `long' type. */
#if FT_ULONG_MAX == 0xFFFFFFFFUL
#define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
#elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
#define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
#else
#error "Unsupported size of `long' type!"
#endif
@@ -108,7 +121,8 @@ FT_BEGIN_HEADER
/* This is the only necessary change, so it is defined here instead */
/* providing a new configuration file. */
/* */
#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
( defined( __MWERKS__ ) && defined( macintosh ) )
#define FT_MACINTOSH 1
#endif
@@ -122,12 +136,12 @@ FT_BEGIN_HEADER
typedef signed short FT_Int16;
typedef unsigned short FT_UInt16;
#if FT_SIZEOF_INT == 4
#if FT_SIZEOF_INT == (32 / FT_CHAR_BIT)
typedef signed int FT_Int32;
typedef unsigned int FT_UInt32;
#elif FT_SIZEOF_LONG == 4
#elif FT_SIZEOF_LONG == (32 / FT_CHAR_BIT)
typedef signed long FT_Int32;
typedef unsigned long FT_UInt32;
@@ -136,13 +150,13 @@ FT_BEGIN_HEADER
#error "no 32bit type found -- please check your configuration files"
#endif
/* now, lookup for an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= 4
/* look up an integer type that is at least 32 bits */
#if FT_SIZEOF_INT >= (32 / FT_CHAR_BIT)
typedef int FT_Fast;
typedef unsigned int FT_UFast;
#elif FT_SIZEOF_LONG >= 4
#elif FT_SIZEOF_LONG >= (32 / FT_CHAR_BIT)
typedef long FT_Fast;
typedef unsigned long FT_UFast;
@@ -152,7 +166,7 @@ FT_BEGIN_HEADER
/* determine whether we have a 64-bit int type for platforms without */
/* Autoconf */
#if FT_SIZEOF_LONG == 8
#if FT_SIZEOF_LONG == (64 / FT_CHAR_BIT)
/* FT_LONG64 must be defined if a 64-bit type is available */
#define FT_LONG64
@@ -177,10 +191,10 @@ FT_BEGIN_HEADER
/* Watcom doesn't provide 64-bit data types */
#elif defined( __MWKS__ ) /* Metrowerks CodeWarrior */
#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
/* I don't know if it provides 64-bit data types, any suggestion */
/* is welcome. */
#define FT_LONG64
#define FT_INT64 long long int
#elif defined( __GNUC__ )
@@ -188,7 +202,12 @@ FT_BEGIN_HEADER
#define FT_LONG64
#define FT_INT64 long long int
#endif /* FT_SIZEOF_LONG == 8 */
#endif /* FT_SIZEOF_LONG == (64 / FT_CHAR_BIT) */
#define FT_BEGIN_STMNT do {
#define FT_END_STMNT } while ( 0 )
#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
/*************************************************************************/
@@ -331,4 +350,4 @@ FT_END_HEADER
#endif /* __FTCONFIG_H__ */
/* END */
/* END */
@@ -4,7 +4,7 @@
/* */
/* Build macros of the FreeType 2 library. */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -150,6 +150,7 @@
#define FT_CONFIG_MODULES_H <freetype/config/ftmodule.h>
#endif
/* public headers */
/*************************************************************************/
@@ -281,7 +282,7 @@
/* A macro used in #include statements to name the file containing */
/* the module management API of FreeType 2. */
/* */
#define FT_MODULE_H <freetype/ftmodule.h>
#define FT_MODULE_H <freetype/ftmodapi.h>
/*************************************************************************/
@@ -373,6 +374,18 @@
#define FT_GZIP_H <freetype/ftgzip.h>
/*************************************************************************/
/* */
/* @macro: */
/* FT_LZW_H */
/* */
/* @description: */
/* A macro used in #include statements to name the file containing */
/* the definitions of an API to support for LZW-compressed files. */
/* */
#define FT_LZW_H <freetype/ftlzw.h>
/*************************************************************************/
/* */
/* @macro: */
@@ -384,6 +397,7 @@
/* */
#define FT_WINFONTS_H <freetype/ftwinfnt.h>
/*************************************************************************/
/* */
/* @macro: */
@@ -433,7 +447,10 @@
/* see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need */
/* to store small glyph bitmaps, as it will use less memory. */
/* */
#define FT_CACHE_IMAGE_H <freetype/cache/ftcimage.h>
/* This macro is deprecated. Simply include @FT_CACHE_H to have all */
/* glyph image-related cache declarations. */
/* */
#define FT_CACHE_IMAGE_H FT_CACHE_H
/*************************************************************************/
@@ -450,7 +467,10 @@
/* in @FT_CACHE_IMAGE_H if you want to cache arbitrary glyph images, */
/* including scalable outlines. */
/* */
#define FT_CACHE_SMALL_BITMAPS_H <freetype/cache/ftcsbits.h>
/* This macro is deprecated. Simply include @FT_CACHE_H to have all */
/* small bitmaps-related cache declarations. */
/* */
#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H
/*************************************************************************/
@@ -462,7 +482,10 @@
/* A macro used in #include statements to name the file containing */
/* the `charmap' API of the FreeType 2 cache sub-system. */
/* */
#define FT_CACHE_CHARMAP_H <freetype/cache/ftccmap.h>
/* This macro is deprecated. Simply include @FT_CACHE_H to have all */
/* charmap-based cache declarations. */
/* */
#define FT_CACHE_CHARMAP_H FT_CACHE_H
/*************************************************************************/
@@ -508,28 +531,34 @@
/* */
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
#define FT_STROKER_H <freetype/ftstroker.h>
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
#define FT_STROKER_H <freetype/ftstroke.h>
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
#define FT_ERROR_DEFINITIONS_H <freetype/fterrdef.h>
#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h>
#define FT_CACHE_MANAGER_H <freetype/cache/ftcmanag.h>
#define FT_CACHE_INTERNAL_LRU_H <freetype/cache/ftlru.h>
#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h>
#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h>
#define FT_CACHE_INTERNAL_MRU_H <freetype/cache/ftcmru.h>
#define FT_CACHE_INTERNAL_MANAGER_H <freetype/cache/ftcmanag.h>
#define FT_CACHE_INTERNAL_CACHE_H <freetype/cache/ftccache.h>
#define FT_CACHE_INTERNAL_GLYPH_H <freetype/cache/ftcglyph.h>
#define FT_CACHE_INTERNAL_IMAGE_H <freetype/cache/ftcimage.h>
#define FT_CACHE_INTERNAL_SBITS_H <freetype/cache/ftcsbits.h>
#define FT_XFREE86_H <freetype/ftxf86.h>
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
#define FT_XFREE86_H <freetype/ftxf86.h>
#define FT_INCREMENTAL_H <freetype/ftincrem.h>
#define FT_TRUETYPE_UNPATENTED_H <freetype/ttunpat.h>
/* now include internal headers definitions from <freetype/internal/...> */
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
#define FT_INTERNAL_INTERNAL_H <freetype/internal/internal.h>
#include FT_INTERNAL_INTERNAL_H
#endif /* __FT2_BUILD_H__ */
/* END */
/* END */
@@ -16,4 +16,4 @@ FT_USE_MODULE(t1_driver_class)
FT_USE_MODULE(t42_driver_class)
FT_USE_MODULE(pfr_driver_class)
FT_USE_MODULE(winfnt_driver_class)
+108 -38
View File
@@ -4,7 +4,7 @@
/* */
/* User-selectable configuration macros (specification only). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -81,32 +81,46 @@ FT_BEGIN_HEADER
/* by FreeType to speed up some computations. However, this will create */
/* some problems when compiling the library in strict ANSI mode. */
/* */
/* For this reason, the use of 64-bit ints is normally disabled when */
/* For this reason, the use of 64-bit integers is normally disabled when */
/* the __STDC__ macro is defined. You can however disable this by */
/* defining here the macro FT_CONFIG_OPTION_FORCE_INT64. */
/* defining the macro FT_CONFIG_OPTION_FORCE_INT64 here. */
/* */
/* For most compilers, this will only create compilation warnings */
/* when building the library. */
/* For most compilers, this will only create compilation warnings when */
/* building the library. */
/* */
/* ObNote: The compiler-specific 64-bit integers are detected in the */
/* file "ftconfig.h" either statically, or through Autoconf */
/* on platforms that support it. */
/* file "ftconfig.h" either statically or through the */
/* `configure' script on supported platforms. */
/* */
#undef FT_CONFIG_OPTION_FORCE_INT64
/*************************************************************************/
/* */
/* LZW-compressed file support. */
/* */
/* FreeType now handles font files that have been compressed with the */
/* 'compress' program. This is mostly used to parse many of the PCF */
/* files that come with various X11 distributions. The implementation */
/* uses NetBSD's `zopen' to partially uncompress the file on the fly */
/* (see src/lzw/ftgzip.c). */
/* */
/* Define this macro if you want to enable this `feature'. */
/* */
#define FT_CONFIG_OPTION_USE_LZW
/*************************************************************************/
/* */
/* Gzip-compressed file support. */
/* */
/* FreeType now handles font files that have been compressed with the */
/* 'gzip' program. This is mostly used to parse many of the PCF files */
/* that come with XFree86. The implementation uses 'zlib' to */
/* partially uncompress the file on the fly (see src/base/ftgzip.c). */
/* 'gzip' program. This is mostly used to parse many of the PCF files */
/* that come with XFree86. The implementation uses `zlib' to */
/* partially uncompress the file on the fly (see src/gzip/ftgzip.c). */
/* */
/* Define this macro if you want to enable this "feature". Note that */
/* this will however force you to link the zlib to any program that */
/* also uses FreeType. */
/* Define this macro if you want to enable this `feature'. See also */
/* the macro FT_CONFIG_OPTION_SYSTEM_ZLIB below. */
/* */
#define FT_CONFIG_OPTION_USE_ZLIB
@@ -116,18 +130,18 @@ FT_BEGIN_HEADER
/* ZLib library selection */
/* */
/* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */
/* It allows FreeType's "ftgzip" component to link to the system's */
/* installation of the ZLib library. This is useful on systems like */
/* It allows FreeType's `ftgzip' component to link to the system's */
/* installation of the ZLib library. This is useful on systems like */
/* Unix or VMS where it generally is already available. */
/* */
/* If you let it undefined, the component will use its own copy */
/* of the zlib sources instead. These have been modified to be */
/* of the zlib sources instead. These have been modified to be */
/* included directly within the component and *not* export external */
/* function names. This allows you to link any program with FreeType */
/* function names. This allows you to link any program with FreeType */
/* _and_ ZLib without linking conflicts. */
/* */
/* do not #undef this macro here, since the build system might */
/* define for certain configurations */
/* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */
/* */
/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
@@ -167,6 +181,9 @@ FT_BEGIN_HEADER
/* will be later automatically defined as `extern return_type' to */
/* allow normal compilation. */
/* */
/* Do not #undef these macros here since the build system might define */
/* them for certain configurations only. */
/* */
/* #define FT_EXPORT(x) extern x */
/* #define FT_EXPORT_DEF(x) x */
@@ -214,6 +231,42 @@ FT_BEGIN_HEADER
#define FT_CONFIG_OPTION_ADOBE_GLYPH_LIST
/*************************************************************************/
/* */
/* Support for Mac fonts */
/* */
/* Define this macro if you want support for outline fonts in Mac */
/* format (mac dfont, mac resource, macbinary containing a mac */
/* resource) on non-Mac platforms. */
/* */
/* Note that the `FOND' resource isn't checked. */
/* */
#define FT_CONFIG_OPTION_MAC_FONTS
/*************************************************************************/
/* */
/* Guessing methods to access embedded resource forks */
/* */
/* Enable extra Mac fonts support on non-Mac platforms (e.g. */
/* GNU/Linux). */
/* */
/* Resource forks which include fonts data are stored sometimes in */
/* locations which users or developers don't expected. In some cases, */
/* resource forks start with some offset from the head of a file. In */
/* other cases, the actual resource fork is stored in file different */
/* from what the user specifies. If this option is activated, */
/* FreeType tries to guess whether such offsets or different file */
/* names must be used. */
/* */
/* Note that normal, direct access of resource forks is controlled via */
/* the FT_CONFIG_OPTION_MAC_FONTS option. */
/* */
#ifdef FT_CONFIG_OPTION_MAC_FONTS
#define FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK
#endif
/*************************************************************************/
/* */
/* Allow the use of FT_Incremental_Interface to load typefaces that */
@@ -221,7 +274,7 @@ FT_BEGIN_HEADER
/* This allows FreeType to be used with the PostScript language, using */
/* the GhostScript interpreter. */
/* */
/* #define FT_CONFIG_OPTION_INCREMENTAL */
/* #define FT_CONFIG_OPTION_INCREMENTAL */
/*************************************************************************/
@@ -229,7 +282,7 @@ FT_BEGIN_HEADER
/* The size in bytes of the render pool used by the scan-line converter */
/* to do all of its work. */
/* */
/* This must be greater than 4kByte. */
/* This must be greater than 4KByte. */
/* */
#define FT_RENDER_POOL_SIZE 16384L
@@ -258,8 +311,11 @@ FT_BEGIN_HEADER
/* */
/* Don't define any of these macros to compile in `release' mode! */
/* */
/* #define FT_DEBUG_LEVEL_ERROR */
/* #define FT_DEBUG_LEVEL_TRACE */
/* Do not #undef these macros here since the build system might define */
/* them for certain configurations only. */
/* */
/* #define FT_DEBUG_LEVEL_ERROR */
/* #define FT_DEBUG_LEVEL_TRACE */
/*************************************************************************/
@@ -272,10 +328,12 @@ FT_BEGIN_HEADER
/* should define FT_DEBUG_MEMORY here. */
/* */
/* Note that the memory debugger is only activated at runtime when */
/* when the _environment_ variable "FT_DEBUG_MEMORY" is also defined! */
/* when the _environment_ variable "FT2_DEBUG_MEMORY" is defined also! */
/* */
/* #define FT_DEBUG_MEMORY */
/* Do not #undef this macro here since the build system might define */
/* it for certain configurations only. */
/* */
/* #define FT_DEBUG_MEMORY */
/*************************************************************************/
@@ -375,12 +433,24 @@ FT_BEGIN_HEADER
/* By undefining this, you will only compile the code necessary to load */
/* TrueType glyphs without hinting. */
/* */
/* do not #undef this macro here, since the build system might */
/* define for certain configurations */
/* Do not #undef this macro here, since the build system might */
/* define it for certain configurations only. */
/* */
/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_UNPATENTED_HINTING (in addition to */
/* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented */
/* work-around hinting system. Note that for the moment, the algorithm */
/* is only used when selected at runtime through the parameter tag */
/* FT_PARAM_TAG_UNPATENTED_HINTING; or when the debug hook */
/* FT_DEBUG_HOOK_UNPATENTED_HINTING is globally actived */
/* */
#define TT_CONFIG_OPTION_UNPATENTED_HINTING
/*************************************************************************/
/* */
/* Define TT_CONFIG_OPTION_INTERPRETER_SWITCH to compile the TrueType */
@@ -470,21 +540,21 @@ FT_BEGIN_HEADER
/* */
/*
* the FT_CONFIG_OPTION_CHESTER_XXXX macros are used to toggle some recent
* improvements to the auto-hinter contributed by David Chester. They will
* most likely disappear completely in the next release. For now, you should
* always keep them defined
* The FT_CONFIG_OPTION_CHESTER_XXXX macros are used to toggle some recent
* improvements to the auto-hinter contributed by David Chester. They will
* most likely disappear completely in the next release. For now, you
* should always keep them defined.
*
*/
#define FT_CONFIG_OPTION_CHESTER_HINTS
#ifdef FT_CONFIG_OPTION_CHESTER_HINTS
# define FT_CONFIG_CHESTER_SMALL_F
# define FT_CONFIG_CHESTER_ASCENDER
# define FT_CONFIG_CHESTER_SERIF
# define FT_CONFIG_CHESTER_STEM
# define FT_CONFIG_CHESTER_BLUE_SCALE
#define FT_CONFIG_CHESTER_SMALL_F
#define FT_CONFIG_CHESTER_ASCENDER
#define FT_CONFIG_CHESTER_SERIF
#define FT_CONFIG_CHESTER_STEM
#define FT_CONFIG_CHESTER_BLUE_SCALE
#endif /* FT_CONFIG_OPTION_CHESTER_HINTS */
@@ -494,4 +564,4 @@ FT_END_HEADER
#endif /* __FTOPTION_H__ */
/* END */
/* END */
@@ -5,7 +5,7 @@
/* ANSI-specific library and header configuration file (specification */
/* only). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -73,23 +73,27 @@
#include <ctype.h>
#define ft_isalnum isalnum
#define ft_isupper isupper
#define ft_islower islower
#define ft_xdigit isxdigit
#define ft_isalnum isalnum
#define ft_isupper isupper
#define ft_islower islower
#define ft_isdigit isdigit
#define ft_isxdigit isxdigit
#include <string.h>
#define ft_strlen strlen
#define ft_strcmp strcmp
#define ft_strncmp strncmp
#define ft_memcpy memcpy
#define ft_strcpy strcpy
#define ft_strncpy strncpy
#define ft_memset memset
#define ft_memmove memmove
#define ft_memcmp memcmp
#define ft_memcpy memcpy
#define ft_memmove memmove
#define ft_memset memset
#define ft_strcat strcat
#define ft_strcmp strcmp
#define ft_strcpy strcpy
#define ft_strlen strlen
#define ft_strncmp strncmp
#define ft_strncpy strncpy
#define ft_strrchr strrchr
#include <stdio.h>
@@ -108,7 +112,7 @@
#define ft_qsort qsort
#define ft_exit exit /* only used to exit from unhandled exceptions */
#define ft_atoi atoi
#define ft_atol atol
/**********************************************************************/
@@ -137,4 +141,4 @@
#endif /* __FTSTDLIB_H__ */
/* END */
/* END */
+287 -137
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType high-level API and common types (specification only). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -16,6 +16,15 @@
/***************************************************************************/
#ifndef FT_FREETYPE_H
#error "`ft2build.h' hasn't been included yet!"
#error "Please always use macros to include FreeType header files."
#error "Example:"
#error " #include <ft2build.h>"
#error " #include FT_FREETYPE_H"
#endif
#ifndef __FREETYPE_H__
#define __FREETYPE_H__
@@ -35,7 +44,7 @@
/* */
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 1
#define FREETYPE_PATCH 4
#define FREETYPE_PATCH 8
#include <ft2build.h>
@@ -113,7 +122,6 @@ FT_BEGIN_HEADER
/* FT_New_Memory_Face */
/* FT_Open_Face */
/* FT_Open_Args */
/* FT_Open_Flags */
/* FT_Parameter */
/* FT_Attach_File */
/* FT_Attach_Stream */
@@ -126,6 +134,12 @@ FT_BEGIN_HEADER
/* FT_Get_Name_Index */
/* FT_Load_Char */
/* */
/* FT_OPEN_MEMORY */
/* FT_OPEN_STREAM */
/* FT_OPEN_PATHNAME */
/* FT_OPEN_DRIVER */
/* FT_OPEN_PARAMS */
/* */
/* FT_LOAD_DEFAULT */
/* FT_LOAD_RENDER */
/* FT_LOAD_MONOCHROME */
@@ -142,6 +156,12 @@ FT_BEGIN_HEADER
/* FT_LOAD_NO_RECURSE */
/* FT_LOAD_PEDANTIC */
/* */
/* FT_LOAD_TARGET_NORMAL */
/* FT_LOAD_TARGET_LIGHT */
/* FT_LOAD_TARGET_MONO */
/* FT_LOAD_TARGET_LCD */
/* FT_LOAD_TARGET_LCD_V */
/* */
/* FT_Render_Glyph */
/* FT_Render_Mode */
/* FT_Get_Kerning */
@@ -162,9 +182,10 @@ FT_BEGIN_HEADER
/* FT_Glyph_Metrics */
/* */
/* <Description> */
/* A structure used to model the metrics of a single glyph. Note */
/* that values are expressed in 26.6 fractional pixel format or in */
/* font units, depending on context. */
/* A structure used to model the metrics of a single glyph. The */
/* values are expressed in 26.6 fractional pixel format; if the flag */
/* FT_LOAD_NO_SCALE is used, values are returned in font units */
/* instead. */
/* */
/* <Fields> */
/* width :: The glyph's width. */
@@ -205,21 +226,62 @@ FT_BEGIN_HEADER
/* FT_Bitmap_Size */
/* */
/* <Description> */
/* An extremely simple structure used to model the size of a bitmap */
/* strike (i.e., a bitmap instance of the font for a given */
/* resolution) in a fixed-size font face. This is used for the */
/* `available_sizes' field of the FT_Face_Properties structure. */
/* This structure models the size of a bitmap strike (i.e., a bitmap */
/* instance of the font for a given resolution) in a fixed-size font */
/* face. It is used for the `available_sizes' field of the */
/* @FT_FaceRec structure. */
/* */
/* <Fields> */
/* height :: The character height in pixels. */
/* height :: The (vertical) baseline-to-baseline distance in pixels. */
/* It makes most sense to define the height of a bitmap */
/* font in this way. */
/* */
/* width :: The character width in pixels. */
/* width :: The average width of the font (in pixels). Since the */
/* algorithms to compute this value are different for the */
/* various bitmap formats, it can only give an additional */
/* hint if the `height' value isn't sufficient to select */
/* the proper font. For monospaced fonts the average width */
/* is the same as the maximum width. */
/* */
/* size :: The point size in 26.6 fractional format this font shall */
/* represent (for a given vertical resolution). */
/* */
/* x_ppem :: The horizontal ppem value (in 26.6 fractional format). */
/* */
/* y_ppem :: The vertical ppem value (in 26.6 fractional format). */
/* */
/* <Note> */
/* The values in this structure are taken from the bitmap font. If */
/* the font doesn't provide a parameter it is set to zero to indicate */
/* that the information is not available. */
/* */
/* The following formula converts from dpi to ppem: */
/* */
/* ppem = size * dpi / 72 */
/* */
/* where `size' is in points. */
/* */
/* Windows FNT: */
/* The `size', `x_ppem', and `y_ppem' parameters are not reliable: */
/* There exist fonts (e.g. app850.fon) which have a wrong size for */
/* some subfonts; since FNT files don't contain ppem but dpi values */
/* the computed x_ppem and y_ppem numbers are thus wrong also. */
/* */
/* TrueType embedded bitmaps: */
/* `size', `width', and `height' values are not contained in the */
/* bitmap strike itself. They are computed from the global font */
/* parameters. */
/* */
typedef struct FT_Bitmap_Size_
{
FT_Short height;
FT_Short width;
FT_Pos size;
FT_Pos x_ppem;
FT_Pos y_ppem;
} FT_Bitmap_Size;
@@ -386,6 +448,10 @@ FT_BEGIN_HEADER
/* @FT_Open_Face), the library looks for a Unicode charmap within */
/* the list and automatically activates it. */
/* */
/* <Also> */
/* The @FT_CharMapRec details the publicly accessible fields of a */
/* given character map. */
/* */
typedef struct FT_CharMapRec_* FT_CharMap;
@@ -403,7 +469,7 @@ FT_BEGIN_HEADER
/* should redefine this macro in case of problems to something like */
/* this: */
/* */
/* #define FT_ENC_TAG( value, a, b, c, d ) (value) */
/* #define FT_ENC_TAG( value, a, b, c, d ) value */
/* */
/* to get a simple enumeration without assigning special numbers. */
/* */
@@ -452,30 +518,28 @@ FT_BEGIN_HEADER
/* mathematical symbols in the 32..255 character code range. For */
/* more information, see `http://www.ceviz.net/symbol.htm'. */
/* */
/* FT_ENCODING_MS_SJIS :: */
/* Corresponds to Microsoft's Japanese SJIS encoding. More info */
/* FT_ENCODING_SJIS :: */
/* Corresponds to Japanese SJIS encoding. More info at */
/* at `http://langsupport.japanreference.com/encoding.shtml'. */
/* See note on multi-byte encodings below. */
/* */
/* FT_ENCODING_MS_GB2312 :: */
/* Corresponds to the encoding system for Simplified Chinese, as */
/* used in China. Only found in some TrueType fonts. */
/* FT_ENCODING_GB2312 :: */
/* Corresponds to an encoding system for Simplified Chinese as used */
/* used in mainland China. */
/* */
/* FT_ENCODING_MS_BIG5 :: */
/* Corresponds to the encoding system for Traditional Chinese, as */
/* used in Taiwan and Hong Kong. Only found in some TrueType fonts. */
/* FT_ENCODING_BIG5 :: */
/* Corresponds to an encoding system for Traditional Chinese as used */
/* in Taiwan and Hong Kong. */
/* */
/* FT_ENCODING_MS_WANSUNG :: */
/* FT_ENCODING_WANSUNG :: */
/* Corresponds to the Korean encoding system known as Wansung. */
/* This is a Microsoft encoding that is only found in some TrueType */
/* fonts. For more information, see */
/* For more information see */
/* `http://www.microsoft.com/typography/unicode/949.txt'. */
/* */
/* FT_ENCODING_MS_JOHAB :: */
/* FT_ENCODING_JOHAB :: */
/* The Korean standard character set (KS C-5601-1992), which */
/* corresponds to Windows code page 1361. This character set */
/* corresponds to MS Windows code page 1361. This character set */
/* includes all possible Hangeul character combinations. */
/* Only found on some rare TrueType fonts. */
/* */
/* FT_ENCODING_ADOBE_LATIN_1 :: */
/* Corresponds to a Latin-1 encoding as defined in a Type 1 */
@@ -483,7 +547,7 @@ FT_BEGIN_HEADER
/* */
/* FT_ENCODING_ADOBE_STANDARD :: */
/* Corresponds to the Adobe Standard encoding, as found in Type 1, */
/* CFF, and OpenType/CFF fonts. It is limited to 256character */
/* CFF, and OpenType/CFF fonts. It is limited to 256 character */
/* codes. */
/* */
/* FT_ENCODING_ADOBE_EXPERT :: */
@@ -504,6 +568,21 @@ FT_BEGIN_HEADER
/* This value is deprecated and was never used nor reported by */
/* FreeType. Don't use or test for it. */
/* */
/* FT_ENCODING_MS_SJIS :: */
/* Same as FT_ENCODING_SJIS. Deprecated. */
/* */
/* FT_ENCODING_MS_GB2312 :: */
/* Same as FT_ENCODING_GB2312. Deprecated. */
/* */
/* FT_ENCODING_MS_BIG5 :: */
/* Same as FT_ENCODING_BIG5. Deprecated. */
/* */
/* FT_ENCODING_MS_WANSUNG :: */
/* Same as FT_ENCODING_WANSUNG. Deprecated. */
/* */
/* FT_ENCODING_MS_JOHAB :: */
/* Same as FT_ENCODING_JOHAB. Deprecated. */
/* */
/* <Note> */
/* By default, FreeType automatically synthetizes a Unicode charmap */
/* for Postscript fonts, using their glyph names dictionaries. */
@@ -511,6 +590,37 @@ FT_BEGIN_HEADER
/* the font file, for the cases when they are needed, with the Adobe */
/* values as well. */
/* */
/* FT_ENCODING_NONE is set by the BDF and PCF drivers if the charmap */
/* is neither Unicode nor ISO-8859-1 (otherwise it is set to */
/* FT_ENCODING_UNICODE). Use `FT_Get_BDF_Charset_ID' to find out */
/* which encoding is really present. If, for example, the */
/* `cs_registry' field is `KOI8' and the `cs_encoding' field is `R', */
/* the font is encoded in KOI8-R. */
/* */
/* FT_ENCODING_NONE is always set (with a single exception) by the */
/* winfonts driver. Use `FT_Get_WinFNT_Header' and examine the */
/* `charset' field of the `FT_WinFNT_HeaderRec' structure to find out */
/* which encoding is really present. For example, FT_WinFNT_ID_CP1251 */
/* (204) means Windows code page 1251 (for Russian). */
/* */
/* FT_ENCODING_NONE is set if `platform_id' is `TT_PLATFORM_MACINTOSH' */
/* and `encoding_id' is not `TT_MAC_ID_ROMAN' (otherwise it is set to */
/* FT_ENCODING_APPLE_ROMAN). */
/* */
/* If `platform_id' is `TT_PLATFORM_MACINTOSH', use the function */
/* `FT_Get_CMap_Language_ID' to query the Mac language ID which may be */
/* needed to be able to distinguish Apple encoding variants. See */
/* */
/* http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/README.TXT */
/* */
/* to get an idea how to do that. Basically, if the language ID is 0, */
/* dont use it, otherwise subtract 1 from the language ID. Then */
/* examine `encoding_id'. If, for example, `encoding_id' is */
/* `TT_MAC_ID_ROMAN' and the language ID (minus 1) is */
/* `TT_MAC_LANGID_GREEK', it is the Greek encoding, not Roman. */
/* `TT_MAC_ID_ARABIC' with `TT_MAC_LANGID_FARSI' means the Farsi */
/* variant the Arabic encoding. */
/* */
typedef enum FT_Encoding_
{
FT_ENC_TAG( FT_ENCODING_NONE, 0, 0, 0, 0 ),
@@ -518,11 +628,18 @@ FT_BEGIN_HEADER
FT_ENC_TAG( FT_ENCODING_MS_SYMBOL, 's', 'y', 'm', 'b' ),
FT_ENC_TAG( FT_ENCODING_UNICODE, 'u', 'n', 'i', 'c' ),
FT_ENC_TAG( FT_ENCODING_MS_SJIS, 's', 'j', 'i', 's' ),
FT_ENC_TAG( FT_ENCODING_MS_GB2312, 'g', 'b', ' ', ' ' ),
FT_ENC_TAG( FT_ENCODING_MS_BIG5, 'b', 'i', 'g', '5' ),
FT_ENC_TAG( FT_ENCODING_MS_WANSUNG, 'w', 'a', 'n', 's' ),
FT_ENC_TAG( FT_ENCODING_MS_JOHAB, 'j', 'o', 'h', 'a' ),
FT_ENC_TAG( FT_ENCODING_SJIS, 's', 'j', 'i', 's' ),
FT_ENC_TAG( FT_ENCODING_GB2312, 'g', 'b', ' ', ' ' ),
FT_ENC_TAG( FT_ENCODING_BIG5, 'b', 'i', 'g', '5' ),
FT_ENC_TAG( FT_ENCODING_WANSUNG, 'w', 'a', 'n', 's' ),
FT_ENC_TAG( FT_ENCODING_JOHAB, 'j', 'o', 'h', 'a' ),
/* for backwards compatibility */
FT_ENCODING_MS_SJIS = FT_ENCODING_SJIS,
FT_ENCODING_MS_GB2312 = FT_ENCODING_GB2312,
FT_ENCODING_MS_BIG5 = FT_ENCODING_BIG5,
FT_ENCODING_MS_WANSUNG = FT_ENCODING_WANSUNG,
FT_ENCODING_MS_JOHAB = FT_ENCODING_JOHAB,
FT_ENC_TAG( FT_ENCODING_ADOBE_STANDARD, 'A', 'D', 'O', 'B' ),
FT_ENC_TAG( FT_ENCODING_ADOBE_EXPERT, 'A', 'D', 'B', 'E' ),
@@ -550,11 +667,11 @@ FT_BEGIN_HEADER
/* ft_encoding_unicode :: see @FT_ENCODING_UNICODE */
/* ft_encoding_latin_2 :: see @FT_ENCODING_OLD_LATIN_2 */
/* ft_encoding_symbol :: see @FT_ENCODING_MS_SYMBOL */
/* ft_encoding_sjis :: see @FT_ENCODING_MS_SJIS */
/* ft_encoding_gb2312 :: see @FT_ENCODING_MS_GB2312 */
/* ft_encoding_big5 :: see @FT_ENCODING_MS_BIG5 */
/* ft_encoding_wansung :: see @FT_ENCODING_MS_WANSUNG */
/* ft_encoding_johab :: see @FT_ENCODING_MS_JOHAB */
/* ft_encoding_sjis :: see @FT_ENCODING_SJIS */
/* ft_encoding_gb2312 :: see @FT_ENCODING_GB2312 */
/* ft_encoding_big5 :: see @FT_ENCODING_BIG5 */
/* ft_encoding_wansung :: see @FT_ENCODING_WANSUNG */
/* ft_encoding_johab :: see @FT_ENCODING_JOHAB */
/* */
/* ft_encoding_adobe_standard :: see @FT_ENCODING_ADOBE_STANDARD */
/* ft_encoding_adobe_expert :: see @FT_ENCODING_ADOBE_EXPERT */
@@ -563,21 +680,21 @@ FT_BEGIN_HEADER
/* */
/* ft_encoding_apple_roman :: see @FT_ENCODING_APPLE_ROMAN */
/* */
#define ft_encoding_none FT_ENCODING_NONE
#define ft_encoding_unicode FT_ENCODING_UNICODE
#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
#define ft_encoding_sjis FT_ENCODING_MS_SJIS
#define ft_encoding_gb2312 FT_ENCODING_MS_GB2312
#define ft_encoding_big5 FT_ENCODING_MS_BIG5
#define ft_encoding_wansung FT_ENCODING_MS_WANSUNG
#define ft_encoding_johab FT_ENCODING_MS_JOHAB
#define ft_encoding_none FT_ENCODING_NONE
#define ft_encoding_unicode FT_ENCODING_UNICODE
#define ft_encoding_symbol FT_ENCODING_MS_SYMBOL
#define ft_encoding_latin_1 FT_ENCODING_ADOBE_LATIN_1
#define ft_encoding_latin_2 FT_ENCODING_OLD_LATIN_2
#define ft_encoding_sjis FT_ENCODING_SJIS
#define ft_encoding_gb2312 FT_ENCODING_GB2312
#define ft_encoding_big5 FT_ENCODING_BIG5
#define ft_encoding_wansung FT_ENCODING_WANSUNG
#define ft_encoding_johab FT_ENCODING_JOHAB
#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
#define ft_encoding_adobe_standard FT_ENCODING_ADOBE_STANDARD
#define ft_encoding_adobe_expert FT_ENCODING_ADOBE_EXPERT
#define ft_encoding_adobe_custom FT_ENCODING_ADOBE_CUSTOM
#define ft_encoding_apple_roman FT_ENCODING_APPLE_ROMAN
/*************************************************************************/
@@ -651,10 +768,12 @@ FT_BEGIN_HEADER
/* collection (i.e., a file which embeds */
/* several faces), this is the total number of */
/* faces found in the resource. 1 by default. */
/* Accessing non-existent face indices causes */
/* an error. */
/* */
/* face_index :: The index of the face in its font file. */
/* Usually, this is 0 for all normal font */
/* formats. It can be more in the case of */
/* formats. It can be > 0 in the case of */
/* collections (which embed several fonts in a */
/* single resource/file). */
/* */
@@ -692,8 +811,8 @@ FT_BEGIN_HEADER
/* */
/* num_fixed_sizes :: The number of fixed sizes available in this */
/* face. This should be set to 0 for scalable */
/* fonts, unless its face includes a complete */
/* set of glyphs (called a `strike') for the */
/* fonts, unless its face includes a set of */
/* glyphs (called a `strike') for the */
/* specified sizes. */
/* */
/* available_sizes :: An array of sizes specifying the available */
@@ -743,10 +862,11 @@ FT_BEGIN_HEADER
/* descender :: The face's descender is the vertical */
/* distance from the baseline to the */
/* bottommost point of any glyph in the face. */
/* This field's value is *negative*, expressed */
/* in font units. Some font designs use a */
/* value different from `bbox.yMin'. Only */
/* relevant for scalable formats. */
/* This field's value is *negative* for values */
/* below the baseline. It is expressed in */
/* font units. Some font designs use a value */
/* different from `bbox.yMin'. Only relevant */
/* for scalable formats. */
/* */
/* height :: The face's height is the vertical distance */
/* from one baseline to the next when writing */
@@ -854,7 +974,7 @@ FT_BEGIN_HEADER
/* FT_FACE_FLAG_XXX */
/* */
/* <Description> */
/* A list of bit flags used in the 'face_flags' field of the */
/* A list of bit flags used in the `face_flags' field of the */
/* @FT_FaceRec structure. They inform client applications of */
/* properties of the corresponding face. */
/* */
@@ -862,7 +982,7 @@ FT_BEGIN_HEADER
/* FT_FACE_FLAG_SCALABLE :: */
/* Indicates that the face provides vectorial outlines. This */
/* doesn't prevent embedded bitmaps, i.e., a face can have both */
/* this bit and @FT_FACE_FLAG_FIXED_SIZES set */
/* this bit and @FT_FACE_FLAG_FIXED_SIZES set. */
/* */
/* FT_FACE_FLAG_FIXED_SIZES :: */
/* Indicates that the face contains `fixed sizes', i.e., bitmap */
@@ -901,9 +1021,9 @@ FT_BEGIN_HEADER
/* */
/* FT_FACE_FLAG_GLYPH_NAMES :: */
/* Indicates that the font contains glyph names that can be */
/* retrieved through @FT_Get_Glyph_Names. Note that some TrueType */
/* retrieved through @FT_Get_Glyph_Name. Note that some TrueType */
/* fonts contain broken glyph name tables. Use the function */
/* @FT_Has_PS_Glyph_Name when needed. */
/* @FT_Has_PS_Glyph_Names when needed. */
/* */
/* FT_FACE_FLAG_EXTERNAL_STREAM :: */
/* Used internally by FreeType to indicate that a face's stream was */
@@ -1016,12 +1136,12 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* @macro: */
/* FT_IS_FIXED_SIZES( face ) */
/* FT_HAS_FIXED_SIZES( face ) */
/* */
/* @description: */
/* A macro that returns true whenever a face object contains some */
/* embedded bitmaps. See the `fixed_sizes' field of the @FT_FaceRec */
/* structure. */
/* embedded bitmaps. See the `available_sizes' field of the */
/* @FT_FaceRec structure. */
/* */
#define FT_HAS_FIXED_SIZES( face ) \
( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
@@ -1050,7 +1170,7 @@ FT_BEGIN_HEADER
/* */
/* @description: */
/* A macro that returns true whenever a face object contains some */
/* glyph names that can be accessed through @FT_Get_Glyph_Names. */
/* glyph names that can be accessed through @FT_Get_Glyph_Name. */
/* */
#define FT_HAS_GLYPH_NAMES( face ) \
( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES )
@@ -1130,10 +1250,12 @@ FT_BEGIN_HEADER
/* units to fractional (26.6) pixel coordinates. */
/* */
/* ascender :: The ascender, expressed in 26.6 fixed point */
/* pixels. Always positive. */
/* pixels. Positive for ascenders above the */
/* baseline. */
/* */
/* descender :: The descender, expressed in 26.6 fixed point */
/* pixels. Always negative. */
/* pixels. Negative for descenders below the */
/* baseline. */
/* */
/* height :: The text height, expressed in 26.6 fixed point */
/* pixels. Always positive. */
@@ -1142,12 +1264,12 @@ FT_BEGIN_HEADER
/* fixed point pixels. Always positive. */
/* */
/* <Note> */
/* The values of `ascender', `descender', and `height' are only the */
/* scaled versions of `face->ascender', `face->descender', and */
/* `face->height'. */
/* For scalable fonts, the values of `ascender', `descender', and */
/* `height' are scaled versions of `face->ascender', */
/* `face->descender', and `face->height', respectively. */
/* */
/* Unfortunately, due to glyph hinting, these values might not be */
/* exact for certain fonts, they thus must be treated as unreliable */
/* exact for certain fonts. They thus must be treated as unreliable */
/* with an error margin of at least one pixel! */
/* */
/* Indeed, the only way to get the exact pixel ascender and descender */
@@ -1161,7 +1283,7 @@ FT_BEGIN_HEADER
FT_UShort y_ppem; /* vertical pixels per EM */
FT_Fixed x_scale; /* two scales used to convert font units */
FT_Fixed y_scale; /* to 26.6 frac. pixel coordinates.. */
FT_Fixed y_scale; /* to 26.6 frac. pixel coordinates */
FT_Pos ascender; /* ascender in 26.6 frac. pixels */
FT_Pos descender; /* descender in 26.6 frac. pixels */
@@ -1311,16 +1433,18 @@ FT_BEGIN_HEADER
/* */
/* outline :: The outline descriptor for the current glyph */
/* image if its format is */
/* ft_glyph_bitmap_outline. */
/* FT_GLYPH_FORMAT_OUTLINE. */
/* */
/* num_subglyphs :: The number of subglyphs in a composite glyph. */
/* This format is only valid for the composite */
/* glyph format, that should normally only be */
/* loaded with the FT_LOAD_NO_RECURSE flag. */
/* This field is only valid for the composite */
/* glyph format that should normally only be */
/* loaded with the @FT_LOAD_NO_RECURSE flag. */
/* For now this is internal to FreeType. */
/* */
/* subglyphs :: An array of subglyph descriptors for */
/* composite glyphs. There are `num_subglyphs' */
/* elements in there. */
/* elements in there. Currently internal to */
/* FreeType. */
/* */
/* control_data :: Certain font drivers can also return the */
/* control data for a given glyph image (e.g. */
@@ -1359,7 +1483,7 @@ FT_BEGIN_HEADER
FT_Library library;
FT_Face face;
FT_GlyphSlot next;
FT_UInt flags;
FT_UInt reserved; /* retained for binary compatibility */
FT_Generic generic;
FT_Glyph_Metrics metrics;
@@ -1474,13 +1598,13 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Open_Flags */
/* FT_OPEN_XXX */
/* */
/* <Description> */
/* An enumeration used to list the bit flags used within the */
/* `flags' field of the @FT_Open_Args structure. */
/* A list of bit-field constants used within the `flags' field of the */
/* @FT_Open_Args structure. */
/* */
/* <Fields> */
/* <Values> */
/* FT_OPEN_MEMORY :: This is a memory-based stream. */
/* */
/* FT_OPEN_STREAM :: Copy the stream from the `stream' field. */
@@ -1492,35 +1616,31 @@ FT_BEGIN_HEADER
/* */
/* FT_OPEN_PARAMS :: Use the `num_params' & `params' field. */
/* */
/* ft_open_memory :: deprecated. use @FT_OPEN_MEMORY instead */
/* ft_open_memory :: Deprecated; use @FT_OPEN_MEMORY instead. */
/* */
/* ft_open_stream :: deprecated. use @FT_OPEN_STREAM instead */
/* ft_open_stream :: Deprecated; use @FT_OPEN_STREAM instead. */
/* */
/* ft_open_pathname :: deprecated. use @FT_OPEN_PATHNAME instead */
/* ft_open_pathname :: Deprecated; use @FT_OPEN_PATHNAME instead. */
/* */
/* ft_open_driver :: deprecated, use @FT_OPEN_DRIVER instead */
/* ft_open_driver :: Deprecated; use @FT_OPEN_DRIVER instead. */
/* */
/* ft_open_params :: deprecated, use @FT_OPEN_PARAMS instead */
/* ft_open_params :: Deprecated; use @FT_OPEN_PARAMS instead. */
/* */
/* <Note> */
/* The `FT_OPEN_MEMORY', `FT_OPEN_STREAM', and `FT_OPEN_PATHNAME' */
/* flags are mutually exclusive. */
/* */
typedef enum
{
FT_OPEN_MEMORY = 1,
FT_OPEN_STREAM = 2,
FT_OPEN_PATHNAME = 4,
FT_OPEN_DRIVER = 8,
FT_OPEN_PARAMS = 16
#define FT_OPEN_MEMORY 0x1
#define FT_OPEN_STREAM 0x2
#define FT_OPEN_PATHNAME 0x4
#define FT_OPEN_DRIVER 0x8
#define FT_OPEN_PARAMS 0x10
} FT_Open_Flags;
#define ft_open_memory FT_OPEN_MEMORY /* deprecated */
#define ft_open_stream FT_OPEN_STREAM /* deprecated */
#define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
#define ft_open_driver FT_OPEN_DRIVER /* deprecated */
#define ft_open_params FT_OPEN_PARAMS /* deprecated */
#define ft_open_memory FT_OPEN_MEMORY /* deprecated */
#define ft_open_stream FT_OPEN_STREAM /* deprecated */
#define ft_open_pathname FT_OPEN_PATHNAME /* deprecated */
#define ft_open_driver FT_OPEN_DRIVER /* deprecated */
#define ft_open_params FT_OPEN_PARAMS /* deprecated */
/*************************************************************************/
@@ -1602,14 +1722,14 @@ FT_BEGIN_HEADER
/* */
typedef struct FT_Open_Args_
{
FT_Open_Flags flags;
const FT_Byte* memory_base;
FT_Long memory_size;
FT_String* pathname;
FT_Stream stream;
FT_Module driver;
FT_Int num_params;
FT_Parameter* params;
FT_UInt flags;
const FT_Byte* memory_base;
FT_Long memory_size;
FT_String* pathname;
FT_Stream stream;
FT_Module driver;
FT_Int num_params;
FT_Parameter* params;
} FT_Open_Args;
@@ -1631,6 +1751,7 @@ FT_BEGIN_HEADER
/* */
/* face_index :: The index of the face within the resource. The */
/* first face has index 0. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. */
/* */
@@ -1644,9 +1765,9 @@ FT_BEGIN_HEADER
/* */
/* @FT_New_Face can be used to determine and/or check the font format */
/* of a given font resource. If the `face_index' field is negative, */
/* the function will _not_ return any face handle in `aface'. Its */
/* return value should be 0 if the font format is recognized, or */
/* non-zero otherwise. */
/* the function will _not_ return any face handle in `aface'; the */
/* return value is 0 if the font format is recognized, or non-zero */
/* otherwise. */
/* */
/* Each new face object created with this function also owns a */
/* default @FT_Size object, accessible as `face->size'. */
@@ -1677,6 +1798,7 @@ FT_BEGIN_HEADER
/* */
/* face_index :: The index of the face within the resource. The */
/* first face has index 0. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. */
/* */
@@ -1696,8 +1818,8 @@ FT_BEGIN_HEADER
/* @FT_New_Memory_Face can be used to determine and/or check the font */
/* format of a given font resource. If the `face_index' field is */
/* negative, the function will _not_ return any face handle in */
/* `aface'. Its return value should be 0 if the font format is */
/* recognized, or non-zero otherwise. */
/* `aface'; the return value is 0 if the font format is recognized, */
/* or non-zero otherwise. */
/* */
FT_EXPORT( FT_Error )
FT_New_Memory_Face( FT_Library library,
@@ -1726,6 +1848,7 @@ FT_BEGIN_HEADER
/* */
/* face_index :: The index of the face within the resource. The */
/* first face has index 0. */
/* */
/* <Output> */
/* aface :: A handle to a new face object. */
/* */
@@ -1737,11 +1860,11 @@ FT_BEGIN_HEADER
/* slot for the face object which can be accessed directly through */
/* `face->glyph'. */
/* */
/* @FT_Open_Face can be used to determine and/or check the font */
/* @FT_Open_Face can be used to determine and/or check the font */
/* format of a given font resource. If the `face_index' field is */
/* negative, the function will _not_ return any face handle in */
/* `*face'. Its return value should be 0 if the font format is */
/* recognized, or non-zero otherwise. */
/* `*face'; the return value is 0 if the font format is recognized, */
/* or non-zero otherwise. */
/* */
FT_EXPORT( FT_Error )
FT_Open_Face( FT_Library library,
@@ -1853,7 +1976,7 @@ FT_BEGIN_HEADER
/* character dimensions is zero, its value is set equal to the other. */
/* */
/* <InOut> */
/* size :: A handle to a target size object. */
/* face :: A handle to a target face object. */
/* */
/* <Input> */
/* char_width :: The character width, in 26.6 fractional points. */
@@ -1870,7 +1993,7 @@ FT_BEGIN_HEADER
/* */
/* <Note> */
/* When dealing with fixed-size faces (i.e., non-scalable formats), */
/* use the function @FT_Set_Pixel_Sizes. */
/* @FT_Set_Pixel_Sizes provides a more convenient interface. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Char_Size( FT_Face face,
@@ -1903,7 +2026,6 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* */
/* <Note> */
/* The values of `pixel_width' and `pixel_height' correspond to the */
/* pixel values of the _typographic_ character size, which are NOT */
@@ -1919,6 +2041,11 @@ FT_BEGIN_HEADER
/* guarantee in any way that you will get glyph bitmaps that all fit */
/* within an 8x8 cell (sometimes even far from it). */
/* */
/* For bitmap fonts, `pixel_height' usually is a reliable value for */
/* the height of the bitmap cell. Drivers for bitmap font formats */
/* which contain a single bitmap strike only (BDF, PCF, FNT) ignore */
/* `pixel_width'. */
/* */
FT_EXPORT( FT_Error )
FT_Set_Pixel_Sizes( FT_Face face,
FT_UInt pixel_width,
@@ -1939,7 +2066,9 @@ FT_BEGIN_HEADER
/* will be loaded. */
/* */
/* <Input> */
/* glyph_index :: The index of the glyph in the font file. */
/* glyph_index :: The index of the glyph in the font file. For */
/* CID-keyed fonts (either in PS or in CFF format) */
/* this argument specifies the CID value. */
/* */
/* load_flags :: A flag indicating what to load for this glyph. The */
/* @FT_LOAD_XXX constants can be used to control the */
@@ -2010,7 +2139,7 @@ FT_BEGIN_HEADER
FT_Int32 load_flags );
/****************************************************************************
/***************************************************************************
*
* @enum:
* FT_LOAD_XXX
@@ -2130,7 +2259,23 @@ FT_BEGIN_HEADER
* outlines. This doesn't prevent native format-specific hinters from
* being used. This can be important for certain fonts where unhinted
* output is better than auto-hinted one.
*
* FT_LOAD_TARGET_NORMAL ::
* Use hinting for @FT_RENDER_MODE_NORMAL.
*
* FT_LOAD_TARGET_LIGHT ::
* Use hinting for @FT_RENDER_MODE_LIGHT.
*
* FT_LOAD_TARGET_MONO ::
* Use hinting for @FT_RENDER_MODE_MONO.
*
* FT_LOAD_TARGET_LCD ::
* Use hinting for @FT_RENDER_MODE_LCD.
*
* FT_LOAD_TARGET_LCD_V ::
* Use hinting for @FT_RENDER_MODE_LCD_V.
*/
#define FT_LOAD_DEFAULT 0x0
#define FT_LOAD_NO_SCALE 0x1
#define FT_LOAD_NO_HINTING 0x2
#define FT_LOAD_RENDER 0x4
@@ -2160,7 +2305,7 @@ FT_BEGIN_HEADER
#define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD )
#define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V )
#define FT_LOAD_DEFAULT 0x0
/* */
/*************************************************************************/
@@ -2186,7 +2331,7 @@ FT_BEGIN_HEADER
/* The transformation is only applied to scalable image formats after */
/* the glyph has been loaded. It means that hinting is unaltered by */
/* the transformation and is performed on the character size given in */
/* the last call to @FT_Set_Char_Sizes or @FT_Set_Pixel_Sizes. */
/* the last call to @FT_Set_Char_Size or @FT_Set_Pixel_Sizes. */
/* */
FT_EXPORT( void )
FT_Set_Transform( FT_Face face,
@@ -2205,18 +2350,24 @@ FT_BEGIN_HEADER
/* conversion performed on the outline, as well as specific */
/* hinting optimizations. */
/* */
/* For bitmap fonts the `bitmap->pixel_mode' field in the */
/* @FT_GlyphSlotRec structure gives the format of the returned */
/* bitmap. */
/* */
/* <Values> */
/* FT_RENDER_MODE_NORMAL :: */
/* This is the default render mode; it corresponds to 8-bit */
/* anti-aliased bitmaps, using 256 levels of opacity. */
/* */
/* FT_RENDER_MODE_LIGHT :: */
/* This is similar to @FT_RENDER_MODE_NORMAL, except that this */
/* changes the hinting to prevent stem width quantization. This */
/* results in glyph shapes that are more similar to the original, */
/* while being a bit more fuzzy ("better shapes", instead of */
/* "better contrast" if you want :-) THIS IS STILL EXPERIMENTAL, */
/* FOR NOW, THIS WILL PRODUCE RESULTS SIMILAR TO NORMAL MODE !! */
/* This is similar to @FT_RENDER_MODE_NORMAL -- you have to use */
/* @FT_LOAD_TARGET_LIGHT in calls to @FT_Load_Glyph to get any */
/* effect since the rendering process no longer influences the */
/* positioning of glyph outlines. */
/* */
/* The resulting glyph shapes are more similar to the original, */
/* while being a bit more fuzzy (`better shapes' instead of `better */
/* contrast', so to say. */
/* */
/* FT_RENDER_MODE_MONO :: */
/* This mode corresponds to 1-bit bitmaps. */
@@ -2225,8 +2376,7 @@ FT_BEGIN_HEADER
/* This mode corresponds to horizontal RGB/BGR sub-pixel displays, */
/* like LCD-screens. It produces 8-bit bitmaps that are 3 times */
/* the width of the original glyph outline in pixels, and which use */
/* the @FT_PIXEL_MODE_LCD mode. THIS IS STILL EXPERIMENTAL, DO NOT */
/* USE FOR NOW !! */
/* the @FT_PIXEL_MODE_LCD mode. */
/* */
/* FT_RENDER_MODE_LCD_V :: */
/* This mode corresponds to vertical RGB/BGR sub-pixel displays */
@@ -2237,8 +2387,7 @@ FT_BEGIN_HEADER
/* <Note> */
/* The LCD-optimized glyph bitmaps produced by FT_Render_Glyph are */
/* _not filtered_ to reduce color-fringes. It is up to the caller to */
/* perform this pass. THIS IS STILL EXPERIMENTAL, DO NOT USE FOR NOW */
/* !! */
/* perform this pass. */
/* */
typedef enum FT_Render_Mode_
{
@@ -2770,7 +2919,7 @@ FT_BEGIN_HEADER
/* <Note> */
/* The optimization for FT_DivFix() is simple: If (a << 16) fits in */
/* 32 bits, then the division is computed directly. Otherwise, we */
/* use a specialized version of the old @FT_MulDiv64. */
/* use a specialized version of @FT_MulDiv. */
/* */
FT_EXPORT( FT_Long )
FT_DivFix( FT_Long a,
@@ -2862,4 +3011,5 @@ FT_END_HEADER
#endif /* __FREETYPE_H__ */
/* END */
+8 -2
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType exact bbox computation (specification). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -34,6 +34,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -80,4 +86,4 @@ FT_END_HEADER
#endif /* __FTBBOX_H__ */
/* END */
/* END */
+52 -34
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType API for accessing BDF-specific strings (specification). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,6 +22,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -49,22 +55,22 @@ FT_BEGIN_HEADER
* FT_PropertyType
*
* @description:
* list of BDF property types
* A list of BDF property types.
*
* @values:
* BDF_PROPERTY_TYPE_NONE ::
* value 0 is used to indicate a missing property
* Value 0 is used to indicate a missing property.
*
* BDF_PROPERTY_TYPE_ATOM ::
* property is a string atom
* Property is a string atom.
*
* BDF_PROPERTY_TYPE_INTEGER ::
* property is a 32-bit signed integer
* Property is a 32-bit signed integer.
*
* BDF_PROPERTY_TYPE_CARDINAL ::
* property is a 32-bit unsigned integer
* Property is a 32-bit unsigned integer.
*/
typedef enum
typedef enum BDF_PropertyType_
{
BDF_PROPERTY_TYPE_NONE = 0,
BDF_PROPERTY_TYPE_ATOM = 1,
@@ -76,34 +82,44 @@ FT_BEGIN_HEADER
/**********************************************************************
*
* @type: BDF_Property
* @type:
* BDF_Property
*
* @description:
* handle to a @BDF_PropertyRec structure used to model a given
* BDF/PCF property
* A handle to a @BDF_PropertyRec structure to model a given
* BDF/PCF property.
*/
typedef struct BDF_PropertyRec_* BDF_Property;
typedef struct BDF_PropertyRec_* BDF_Property;
/**********************************************************************
*
* @struct: BDF_PropertyRec
* @struct:
* BDF_PropertyRec
*
* @description:
* models a given BDF/PCF property
* This structure models a given BDF/PCF property.
*
* @note:
* type :: property type
* u.atom :: atom string, when type is @BDF_PROPERTY_TYPE_ATOM
* u.integer :: signed integer, when type is @BDF_PROPERTY_TYPE_INTEGER
* u.cardinal :: unsigned integer, when type is @BDF_PROPERTY_TYPE_CARDINAL
* @fields:
* type ::
* The property type.
*
* u.atom ::
* The atom string, if type is @BDF_PROPERTY_TYPE_ATOM.
*
* u.integer ::
* A signed integer, if type is @BDF_PROPERTY_TYPE_INTEGER.
*
* u.cardinal ::
* An unsigned integer, if type is @BDF_PROPERTY_TYPE_CARDINAL.
*/
typedef struct BDF_PropertyRec_
typedef struct BDF_PropertyRec_
{
BDF_PropertyType type;
BDF_PropertyType type;
union {
const char* atom;
FT_Int32 integer;
FT_UInt32 cardinal;
const char* atom;
FT_Int32 integer;
FT_UInt32 cardinal;
} u;
@@ -121,7 +137,7 @@ FT_BEGIN_HEADER
*
* @input:
* face ::
* handle to input face
* A handle to the input face.
*
* @output:
* acharset_encoding ::
@@ -131,7 +147,7 @@ FT_BEGIN_HEADER
* Charset registry, as a C string, owned by the face.
*
* @return:
* FreeType rror code. 0 means success.
* FreeType error code. 0 means success.
*
* @note:
* This function only works with BDF faces, returning an error otherwise.
@@ -141,31 +157,33 @@ FT_BEGIN_HEADER
const char* *acharset_encoding,
const char* *acharset_registry );
/**********************************************************************
*
* @function:
* FT_Get_BDF_Property
*
* @description:
* Retrieves a BDF property from a BDF or PCF font file
* Retrieves a BDF property from a BDF or PCF font file.
*
* @input:
* face :: handle to input face
* name :: property name
* face :: A handle to the input face.
*
* name :: The property name.
*
* @output:
* aproperty :: the property
* aproperty :: The property.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* This function works with BDF _and_ PCF fonts. It returns an error
* otherwise. it also returns an error when the property is not in the
* This function works with BDF _and_ PCF fonts. It returns an error
* otherwise. It also returns an error if the property is not in the
* font.
*
* in case of error, "aproperty->type" is always set to
* @BDF_PROPERTY_TYPE_NONE
* In case of error, "aproperty->type" is always set to
* @BDF_PROPERTY_TYPE_NONE.
*/
FT_EXPORT( FT_Error )
FT_Get_BDF_Property( FT_Face face,
@@ -179,4 +197,4 @@ FT_END_HEADER
#endif /* __FTBDF_H__ */
/* END */
/* END */
+461 -52
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType Cache subsystem (specification). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -63,15 +63,14 @@ FT_BEGIN_HEADER
/* FTC_Face_Requester */
/* */
/* FTC_Manager_New */
/* FTC_Manager_Lookup_Face */
/* FTC_Manager_Lookup_Size */
/* FTC_Manager_LookupFace */
/* FTC_Manager_LookupSize */
/* */
/* FTC_Node */
/* FTC_Node_Ref */
/* FTC_Node_Unref */
/* */
/* FTC_Font */
/* FTC_ImageDesc */
/* FTC_ImageCache */
/* FTC_ImageCache_New */
/* FTC_ImageCache_Lookup */
@@ -109,10 +108,10 @@ FT_BEGIN_HEADER
/* FTC_FaceID */
/* */
/* <Description> */
/* A generic pointer type that is used to identity face objects. The */
/* An opaque pointer type that is used to identity face objects. The */
/* contents of such objects is application-dependent. */
/* */
typedef FT_Pointer FTC_FaceID;
typedef struct FTC_FaceIDRec_* FTC_FaceID;
/*************************************************************************/
@@ -242,9 +241,9 @@ FT_BEGIN_HEADER
/* If you lookup 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_Release). */
/* it (see @FTC_Node_Unref). */
/* */
/* See also @FTC_BitsetCache_Lookup and @FTC_ImageCache_Lookup. */
/* See also @FTC_SBitCache_Lookup and @FTC_ImageCache_Lookup. */
/* */
typedef struct FTC_NodeRec_* FTC_Node;
@@ -258,22 +257,16 @@ FT_BEGIN_HEADER
/* Creates a new cache manager. */
/* */
/* <Input> */
/* library :: The parent FreeType library handle to use. */
/* library :: The parent FreeType library handle to use. */
/* */
/* max_faces :: Maximum number of faces to keep alive in manager. */
/* Use 0 for defaults. */
/* max_bytes :: Maximum number of bytes to use for cached data. */
/* Use 0 for defaults. */
/* */
/* max_sizes :: Maximum number of sizes to keep alive in manager. */
/* Use 0 for defaults. */
/* requester :: An application-provided callback used to translate */
/* face IDs into real @FT_Face objects. */
/* */
/* 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. */
/* */
/* req_data :: A generic pointer that is passed to the requester */
/* each time it is called (see @FTC_Face_Requester). */
/* req_data :: A generic pointer that is passed to the requester */
/* each time it is called (see @FTC_Face_Requester). */
/* */
/* <Output> */
/* amanager :: A handle to a new manager object. 0 in case of */
@@ -326,7 +319,7 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_Lookup_Face */
/* FTC_Manager_LookupFace */
/* */
/* <Description> */
/* Retrieves the @FT_Face object that corresponds to a given face ID */
@@ -349,67 +342,483 @@ FT_BEGIN_HEADER
/* */
/* The @FT_Face object doesn't necessarily have a current size object */
/* (i.e., face->size can be 0). If you need a specific `font size', */
/* use @FTC_Manager_Lookup_Size instead. */
/* use @FTC_Manager_LookupSize instead. */
/* */
/* Never change the face's transformation matrix (i.e., never call */
/* the @FT_Set_Transform function) on a returned face! If you need */
/* to transform glyphs, do it yourself after glyph loading. */
/* */
FT_EXPORT( FT_Error )
FTC_Manager_Lookup_Face( FTC_Manager manager,
FTC_FaceID face_id,
FT_Face *aface );
FTC_Manager_LookupFace( FTC_Manager manager,
FTC_FaceID face_id,
FT_Face *aface );
/*************************************************************************/
/* */
/* <Struct> */
/* FTC_ScalerRec */
/* */
/* <Description> */
/* A structure used to describe a given character size in either */
/* pixels or points to the cache manager. See */
/* @FTC_Manager_LookupSize. */
/* */
/* <Fields> */
/* face_id :: The source face ID. */
/* */
/* width :: The character width. */
/* */
/* height :: The character height. */
/* */
/* pixel :: A Boolean. If TRUE, the `width' and `height' fields */
/* are interpreted as integer pixel character sizes. */
/* Otherwise, they are expressed as 1/64th of points. */
/* */
/* x_res :: Only used when `pixel' is FALSE to indicate the */
/* horizontal resolution in dpi. */
/* */
/* y_res :: Only used when `pixel' is FALSE to indicate the */
/* vertical resolution in dpi. */
/* */
/* <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;
} FTC_ScalerRec, *FTC_Scaler;
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Manager_Lookup_Size */
/* FTC_Manager_LookupSize */
/* */
/* <Description> */
/* Retrieves the @FT_Face and @FT_Size objects that correspond to a */
/* given @FTC_SizeID. */
/* Retrieve the @FT_Size object that corresponds to a given */
/* @FTC_Scaler through a cache manager. */
/* */
/* <Input> */
/* manager :: A handle to the cache manager. */
/* */
/* size_id :: The ID of the `font size' to use. */
/* scaler :: A scaler handle. */
/* */
/* <Output> */
/* aface :: A pointer to the handle of the face object. Set it to */
/* zero if you don't need it. */
/* */
/* asize :: A pointer to the handle of the size object. Set it to */
/* zero if you don't need it. */
/* asize :: A handle to the size object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The returned @FT_Face object is always owned by the manager. You */
/* should never try to discard it yourself. */
/* The returned @FT_Size object is always owned by the manager. You */
/* should never try to discard it by yourself. */
/* */
/* Never change the face's transformation matrix (i.e., never call */
/* the @FT_Set_Transform function) on a returned face! If you need */
/* to transform glyphs, do it yourself after glyph loading. */
/* */
/* Similarly, the returned @FT_Size object is always owned by the */
/* manager. You should never try to discard it, and never change its */
/* settings with @FT_Set_Pixel_Sizes or @FT_Set_Char_Size! */
/* */
/* The returned size object is the face's current size, which means */
/* that you can call @FT_Load_Glyph with the face if you need to. */
/* 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 */
/* manager. */
/* */
FT_EXPORT( FT_Error )
FTC_Manager_Lookup_Size( FTC_Manager manager,
FTC_Font font,
FT_Face *aface,
FT_Size *asize );
FTC_Manager_LookupSize( FTC_Manager manager,
FTC_Scaler scaler,
FT_Size *asize );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_Node_Unref */
/* */
/* <Description> */
/* Decrement a cache node's internal reference count. When the count */
/* reaches 0, it is not destroyed but becomes eligible for subsequent */
/* cache flushes. */
/* */
/* <Input> */
/* node :: The cache node handle. */
/* */
/* manager :: The cache manager handle. */
/* */
FT_EXPORT( void )
FTC_Node_Unref( FTC_Node node,
FTC_Manager manager );
/* remove all nodes belonging to a given face_id */
FT_EXPORT( void )
FTC_Manager_RemoveFaceID( FTC_Manager manager,
FTC_FaceID face_id );
/*************************************************************************/
/* */
/* <Section> */
/* cache_subsystem */
/* */
/*************************************************************************/
/************************************************************************
*
* @type:
* FTC_CMapCache
*
* @description:
* An opaque handle used to manager a charmap cache. This cache is
* to hold character codes -> glyph indices mappings.
*/
typedef struct FTC_CMapCacheRec_* FTC_CMapCache;
/*************************************************************************/
/* */
/* @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: */
/* FreeType error code. 0 means success. */
/* */
/* @note: */
/* Like all other caches, this one will be destroyed with the cache */
/* manager. */
/* */
FT_EXPORT( FT_Error )
FTC_CMapCache_New( FTC_Manager manager,
FTC_CMapCache *acache );
/* retrieve the index of a given charmap */
FT_EXPORT( FT_Int )
FT_Get_CharMap_Index( FT_CharMap charmap );
/*************************************************************************/
/* */
/* @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 :: source face id */
/* */
/* cmap_index :: index of charmap in source face */
/* */
/* char_code :: The character code (in the corresponding charmap). */
/* */
/* @return: */
/* Glyph index. 0 means `no glyph'. */
/* */
FT_EXPORT( FT_UInt )
FTC_CMapCache_Lookup( FTC_CMapCache cache,
FTC_FaceID face_id,
FT_Int cmap_index,
FT_UInt32 char_code );
/*************************************************************************/
/* */
/* <Section> */
/* cache_subsystem */
/* */
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** IMAGE CACHE OBJECT *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
typedef struct FTC_ImageTypeRec_
{
FTC_FaceID face_id;
FT_Int width;
FT_Int height;
FT_Int32 flags;
} FTC_ImageTypeRec;
typedef struct FTC_ImageTypeRec_* FTC_ImageType;
/* */
#define FTC_IMAGE_TYPE_COMPARE( d1, d2 ) \
( FTC_FONT_COMPARE( &(d1)->font, &(d2)->font ) && \
(d1)->flags == (d2)->flags )
#define FTC_IMAGE_TYPE_HASH( d ) \
(FT_UFast)( FTC_FONT_HASH( &(d)->font ) ^ \
( (d)->flags << 4 ) )
/*************************************************************************/
/* */
/* <Type> */
/* FTC_ImageCache */
/* */
/* <Description> */
/* A handle to an glyph image cache object. They are designed to */
/* hold many distinct glyph images while not exceeding a certain */
/* 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> */
/* Retrieves a given glyph image from a glyph image cache. */
/* */
/* <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. */
/* */
/* <Output> */
/* aglyph :: The corresponding @FT_Glyph object. 0 in case of */
/* failure. */
/* */
/* anode :: Used to return the address of of the corresponding cache */
/* node after incrementing its reference count (see note */
/* below). */
/* */
/* <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 */
/* 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! */
/* */
FT_EXPORT( FT_Error )
FTC_ImageCache_Lookup( FTC_ImageCache cache,
FTC_ImageType type,
FT_UInt gindex,
FT_Glyph *aglyph,
FTC_Node *anode );
/*************************************************************************/
/* */
/* <Type> */
/* FTC_SBit */
/* */
/* <Description> */
/* A handle to a small bitmap descriptor. See the @FTC_SBitRec */
/* structure for details. */
/* */
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 */
/* Y coordinates. */
/* */
/* format :: The format of the glyph bitmap (monochrome or gray). */
/* */
/* max_grays :: Maximum gray level value (in the range 1 to 255). */
/* */
/* 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. */
/* */
/* buffer :: A pointer to the bitmap pixels. */
/* */
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> */
/* Creates a new cache to store small glyph bitmaps. */
/* */
/* <Input> */
/* manager :: A handle to the source cache manager. */
/* */
/* <Output> */
/* acache :: A handle to the new sbit cache. NULL in case of error. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT( FT_Error )
FTC_SBitCache_New( FTC_Manager manager,
FTC_SBitCache *acache );
/*************************************************************************/
/* */
/* <Function> */
/* FTC_SBitCache_Lookup */
/* */
/* <Description> */
/* Looks up a given small glyph bitmap in a given sbit cache and */
/* `lock' it to prevent its flushing from the cache until needed. */
/* */
/* <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> */
/* FreeType error code. 0 means success. */
/* */
/* <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. */
/* */
/* The descriptor's `buffer' field is set to 0 to indicate a missing */
/* 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_Lookup( FTC_SBitCache cache,
FTC_ImageType type,
FT_UInt gindex,
FTC_SBit *sbit,
FTC_Node *anode );
/* */
FT_END_HEADER
#endif /* __FTCACHE_H__ */
/* END */
/* END */
+1 -1
View File
@@ -66,4 +66,4 @@
/* module_management */
/* */
/***************************************************************************/
+166 -83
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType error codes (specification). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -31,118 +31,201 @@
/* generic errors */
FT_NOERRORDEF_( Ok, 0x00, "no error" )
FT_NOERRORDEF_( Ok, 0x00, \
"no error" )
FT_ERRORDEF_( Cannot_Open_Resource, 0x01, "cannot open resource" )
FT_ERRORDEF_( Unknown_File_Format, 0x02, "unknown file format" )
FT_ERRORDEF_( Invalid_File_Format, 0x03, "broken file" )
FT_ERRORDEF_( Invalid_Version, 0x04, "invalid FreeType version" )
FT_ERRORDEF_( Lower_Module_Version, 0x05, "module version is too low" )
FT_ERRORDEF_( Invalid_Argument, 0x06, "invalid argument" )
FT_ERRORDEF_( Unimplemented_Feature, 0x07, "unimplemented feature" )
FT_ERRORDEF_( Invalid_Table, 0x08, "broken table" )
FT_ERRORDEF_( Invalid_Offset, 0x09, "broken offset within table" )
FT_ERRORDEF_( Cannot_Open_Resource, 0x01, \
"cannot open resource" )
FT_ERRORDEF_( Unknown_File_Format, 0x02, \
"unknown file format" )
FT_ERRORDEF_( Invalid_File_Format, 0x03, \
"broken file" )
FT_ERRORDEF_( Invalid_Version, 0x04, \
"invalid FreeType version" )
FT_ERRORDEF_( Lower_Module_Version, 0x05, \
"module version is too low" )
FT_ERRORDEF_( Invalid_Argument, 0x06, \
"invalid argument" )
FT_ERRORDEF_( Unimplemented_Feature, 0x07, \
"unimplemented feature" )
FT_ERRORDEF_( Invalid_Table, 0x08, \
"broken table" )
FT_ERRORDEF_( Invalid_Offset, 0x09, \
"broken offset within table" )
/* glyph/character errors */
FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, "invalid glyph index" )
FT_ERRORDEF_( Invalid_Character_Code, 0x11, "invalid character code" )
FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, "unsupported glyph image format" )
FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, "cannot render this glyph format" )
FT_ERRORDEF_( Invalid_Outline, 0x14, "invalid outline" )
FT_ERRORDEF_( Invalid_Composite, 0x15, "invalid composite glyph" )
FT_ERRORDEF_( Too_Many_Hints, 0x16, "too many hints" )
FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, "invalid pixel size" )
FT_ERRORDEF_( Invalid_Glyph_Index, 0x10, \
"invalid glyph index" )
FT_ERRORDEF_( Invalid_Character_Code, 0x11, \
"invalid character code" )
FT_ERRORDEF_( Invalid_Glyph_Format, 0x12, \
"unsupported glyph image format" )
FT_ERRORDEF_( Cannot_Render_Glyph, 0x13, \
"cannot render this glyph format" )
FT_ERRORDEF_( Invalid_Outline, 0x14, \
"invalid outline" )
FT_ERRORDEF_( Invalid_Composite, 0x15, \
"invalid composite glyph" )
FT_ERRORDEF_( Too_Many_Hints, 0x16, \
"too many hints" )
FT_ERRORDEF_( Invalid_Pixel_Size, 0x17, \
"invalid pixel size" )
/* handle errors */
FT_ERRORDEF_( Invalid_Handle, 0x20, "invalid object handle" )
FT_ERRORDEF_( Invalid_Library_Handle, 0x21, "invalid library handle" )
FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, "invalid module handle" )
FT_ERRORDEF_( Invalid_Face_Handle, 0x23, "invalid face handle" )
FT_ERRORDEF_( Invalid_Size_Handle, 0x24, "invalid size handle" )
FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, "invalid glyph slot handle" )
FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, "invalid charmap handle" )
FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, "invalid cache manager handle" )
FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, "invalid stream handle" )
FT_ERRORDEF_( Invalid_Handle, 0x20, \
"invalid object handle" )
FT_ERRORDEF_( Invalid_Library_Handle, 0x21, \
"invalid library handle" )
FT_ERRORDEF_( Invalid_Driver_Handle, 0x22, \
"invalid module handle" )
FT_ERRORDEF_( Invalid_Face_Handle, 0x23, \
"invalid face handle" )
FT_ERRORDEF_( Invalid_Size_Handle, 0x24, \
"invalid size handle" )
FT_ERRORDEF_( Invalid_Slot_Handle, 0x25, \
"invalid glyph slot handle" )
FT_ERRORDEF_( Invalid_CharMap_Handle, 0x26, \
"invalid charmap handle" )
FT_ERRORDEF_( Invalid_Cache_Handle, 0x27, \
"invalid cache manager handle" )
FT_ERRORDEF_( Invalid_Stream_Handle, 0x28, \
"invalid stream handle" )
/* driver errors */
FT_ERRORDEF_( Too_Many_Drivers, 0x30, "too many modules" )
FT_ERRORDEF_( Too_Many_Extensions, 0x31, "too many extensions" )
FT_ERRORDEF_( Too_Many_Drivers, 0x30, \
"too many modules" )
FT_ERRORDEF_( Too_Many_Extensions, 0x31, \
"too many extensions" )
/* memory errors */
FT_ERRORDEF_( Out_Of_Memory, 0x40, "out of memory" )
FT_ERRORDEF_( Unlisted_Object, 0x41, "unlisted object" )
FT_ERRORDEF_( Out_Of_Memory, 0x40, \
"out of memory" )
FT_ERRORDEF_( Unlisted_Object, 0x41, \
"unlisted object" )
/* stream errors */
FT_ERRORDEF_( Cannot_Open_Stream, 0x51, "cannot open stream" )
FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, "invalid stream seek" )
FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, "invalid stream skip" )
FT_ERRORDEF_( Invalid_Stream_Read, 0x54, "invalid stream read" )
FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, "invalid stream operation" )
FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, "invalid frame operation" )
FT_ERRORDEF_( Nested_Frame_Access, 0x57, "nested frame access" )
FT_ERRORDEF_( Invalid_Frame_Read, 0x58, "invalid frame read" )
FT_ERRORDEF_( Cannot_Open_Stream, 0x51, \
"cannot open stream" )
FT_ERRORDEF_( Invalid_Stream_Seek, 0x52, \
"invalid stream seek" )
FT_ERRORDEF_( Invalid_Stream_Skip, 0x53, \
"invalid stream skip" )
FT_ERRORDEF_( Invalid_Stream_Read, 0x54, \
"invalid stream read" )
FT_ERRORDEF_( Invalid_Stream_Operation, 0x55, \
"invalid stream operation" )
FT_ERRORDEF_( Invalid_Frame_Operation, 0x56, \
"invalid frame operation" )
FT_ERRORDEF_( Nested_Frame_Access, 0x57, \
"nested frame access" )
FT_ERRORDEF_( Invalid_Frame_Read, 0x58, \
"invalid frame read" )
/* raster errors */
FT_ERRORDEF_( Raster_Uninitialized, 0x60, "raster uninitialized" )
FT_ERRORDEF_( Raster_Corrupted, 0x61, "raster corrupted" )
FT_ERRORDEF_( Raster_Overflow, 0x62, "raster overflow" )
FT_ERRORDEF_( Raster_Negative_Height, 0x63, "negative height while rastering" )
FT_ERRORDEF_( Raster_Uninitialized, 0x60, \
"raster uninitialized" )
FT_ERRORDEF_( Raster_Corrupted, 0x61, \
"raster corrupted" )
FT_ERRORDEF_( Raster_Overflow, 0x62, \
"raster overflow" )
FT_ERRORDEF_( Raster_Negative_Height, 0x63, \
"negative height while rastering" )
/* cache errors */
FT_ERRORDEF_( Too_Many_Caches, 0x70, "too many registered caches" )
FT_ERRORDEF_( Too_Many_Caches, 0x70, \
"too many registered caches" )
/* TrueType and SFNT errors */
FT_ERRORDEF_( Invalid_Opcode, 0x80, "invalid opcode" )
FT_ERRORDEF_( Too_Few_Arguments, 0x81, "too few arguments" )
FT_ERRORDEF_( Stack_Overflow, 0x82, "stack overflow" )
FT_ERRORDEF_( Code_Overflow, 0x83, "code overflow" )
FT_ERRORDEF_( Bad_Argument, 0x84, "bad argument" )
FT_ERRORDEF_( Divide_By_Zero, 0x85, "division by zero" )
FT_ERRORDEF_( Invalid_Reference, 0x86, "invalid reference" )
FT_ERRORDEF_( Debug_OpCode, 0x87, "found debug opcode" )
FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, "found ENDF opcode in execution stream" )
FT_ERRORDEF_( Nested_DEFS, 0x89, "nested DEFS" )
FT_ERRORDEF_( Invalid_CodeRange, 0x8A, "invalid code range" )
FT_ERRORDEF_( Execution_Too_Long, 0x8B, "execution context too long" )
FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, "too many function definitions" )
FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, "too many instruction definitions" )
FT_ERRORDEF_( Table_Missing, 0x8E, "SFNT font table missing" )
FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, "horizontal header (hhea) table missing" )
FT_ERRORDEF_( Locations_Missing, 0x90, "locations (loca) table missing" )
FT_ERRORDEF_( Name_Table_Missing, 0x91, "name table missing" )
FT_ERRORDEF_( CMap_Table_Missing, 0x92, "character map (cmap) table missing" )
FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, "horizontal metrics (hmtx) table missing" )
FT_ERRORDEF_( Post_Table_Missing, 0x94, "PostScript (post) table missing" )
FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, "invalid horizontal metrics" )
FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, "invalid character map (cmap) format" )
FT_ERRORDEF_( Invalid_PPem, 0x97, "invalid ppem value" )
FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, "invalid vertical metrics" )
FT_ERRORDEF_( Could_Not_Find_Context, 0x99, "could not find context" )
FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, "invalid PostScript (post) table format" )
FT_ERRORDEF_( Invalid_Post_Table, 0x9B, "invalid PostScript (post) table" )
FT_ERRORDEF_( Invalid_Opcode, 0x80, \
"invalid opcode" )
FT_ERRORDEF_( Too_Few_Arguments, 0x81, \
"too few arguments" )
FT_ERRORDEF_( Stack_Overflow, 0x82, \
"stack overflow" )
FT_ERRORDEF_( Code_Overflow, 0x83, \
"code overflow" )
FT_ERRORDEF_( Bad_Argument, 0x84, \
"bad argument" )
FT_ERRORDEF_( Divide_By_Zero, 0x85, \
"division by zero" )
FT_ERRORDEF_( Invalid_Reference, 0x86, \
"invalid reference" )
FT_ERRORDEF_( Debug_OpCode, 0x87, \
"found debug opcode" )
FT_ERRORDEF_( ENDF_In_Exec_Stream, 0x88, \
"found ENDF opcode in execution stream" )
FT_ERRORDEF_( Nested_DEFS, 0x89, \
"nested DEFS" )
FT_ERRORDEF_( Invalid_CodeRange, 0x8A, \
"invalid code range" )
FT_ERRORDEF_( Execution_Too_Long, 0x8B, \
"execution context too long" )
FT_ERRORDEF_( Too_Many_Function_Defs, 0x8C, \
"too many function definitions" )
FT_ERRORDEF_( Too_Many_Instruction_Defs, 0x8D, \
"too many instruction definitions" )
FT_ERRORDEF_( Table_Missing, 0x8E, \
"SFNT font table missing" )
FT_ERRORDEF_( Horiz_Header_Missing, 0x8F, \
"horizontal header (hhea) table missing" )
FT_ERRORDEF_( Locations_Missing, 0x90, \
"locations (loca) table missing" )
FT_ERRORDEF_( Name_Table_Missing, 0x91, \
"name table missing" )
FT_ERRORDEF_( CMap_Table_Missing, 0x92, \
"character map (cmap) table missing" )
FT_ERRORDEF_( Hmtx_Table_Missing, 0x93, \
"horizontal metrics (hmtx) table missing" )
FT_ERRORDEF_( Post_Table_Missing, 0x94, \
"PostScript (post) table missing" )
FT_ERRORDEF_( Invalid_Horiz_Metrics, 0x95, \
"invalid horizontal metrics" )
FT_ERRORDEF_( Invalid_CharMap_Format, 0x96, \
"invalid character map (cmap) format" )
FT_ERRORDEF_( Invalid_PPem, 0x97, \
"invalid ppem value" )
FT_ERRORDEF_( Invalid_Vert_Metrics, 0x98, \
"invalid vertical metrics" )
FT_ERRORDEF_( Could_Not_Find_Context, 0x99, \
"could not find context" )
FT_ERRORDEF_( Invalid_Post_Table_Format, 0x9A, \
"invalid PostScript (post) table format" )
FT_ERRORDEF_( Invalid_Post_Table, 0x9B, \
"invalid PostScript (post) table" )
/* CFF, CID, and Type 1 errors */
FT_ERRORDEF_( Syntax_Error, 0xA0, "opcode syntax error" )
FT_ERRORDEF_( Stack_Underflow, 0xA1, "argument stack underflow" )
FT_ERRORDEF_( Syntax_Error, 0xA0, \
"opcode syntax error" )
FT_ERRORDEF_( Stack_Underflow, 0xA1, \
"argument stack underflow" )
FT_ERRORDEF_( Ignore, 0xA2, \
"ignore" )
/* BDF errors */
FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, "`STARTFONT' field missing" )
FT_ERRORDEF_( Missing_Font_Field, 0xB1, "`FONT' field missing" )
FT_ERRORDEF_( Missing_Size_Field, 0xB2, "`SIZE' field missing" )
FT_ERRORDEF_( Missing_Chars_Field, 0xB3, "`CHARS' field missing" )
FT_ERRORDEF_( Missing_Startchar_Field, 0xB4, "`STARTCHAR' field missing" )
FT_ERRORDEF_( Missing_Encoding_Field, 0xB5, "`ENCODING' field missing" )
FT_ERRORDEF_( Missing_Bbx_Field, 0xB6, "`BBX' field missing" )
FT_ERRORDEF_( Missing_Startfont_Field, 0xB0, \
"`STARTFONT' field missing" )
FT_ERRORDEF_( Missing_Font_Field, 0xB1, \
"`FONT' field missing" )
FT_ERRORDEF_( Missing_Size_Field, 0xB2, \
"`SIZE' field missing" )
FT_ERRORDEF_( Missing_Chars_Field, 0xB3, \
"`CHARS' field missing" )
FT_ERRORDEF_( Missing_Startchar_Field, 0xB4, \
"`STARTCHAR' field missing" )
FT_ERRORDEF_( Missing_Encoding_Field, 0xB5, \
"`ENCODING' field missing" )
FT_ERRORDEF_( Missing_Bbx_Field, 0xB6, \
"`BBX' field missing" )
/* END */
/* END */
+5 -3
View File
@@ -155,10 +155,12 @@
/* this macro is used to define an error */
#define FT_ERRORDEF_( e, v, s ) FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
#define FT_ERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v + FT_ERR_BASE, s )
/* this is only used for FT_Err_Ok, which must be 0! */
#define FT_NOERRORDEF_( e, v, s ) FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
#define FT_NOERRORDEF_( e, v, s ) \
FT_ERRORDEF( FT_ERR_CAT( FT_ERR_PREFIX, e ), v, s )
#ifdef FT_ERROR_START_LIST
@@ -202,4 +204,4 @@
#endif /* __FTERRORS_H__ */
/* END */
/* END */
+77 -29
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType convenience functions to handle glyphs (specification). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -36,6 +36,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -235,7 +241,8 @@ FT_BEGIN_HEADER
/* FT_Glyph_Copy */
/* */
/* <Description> */
/* A function used to copy a glyph image. */
/* A function used to copy a glyph image. Note that the created */
/* @FT_Glyph object must be released with @FT_Done_Glyph. */
/* */
/* <Input> */
/* source :: A handle to the source glyph object. */
@@ -282,7 +289,64 @@ FT_BEGIN_HEADER
FT_Matrix* matrix,
FT_Vector* delta );
/* */
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Glyph_BBox_Mode */
/* */
/* <Description> */
/* The mode how the values of @FT_Glyph_Get_CBox are returned. */
/* */
/* <Values> */
/* FT_GLYPH_BBOX_UNSCALED :: */
/* Return unscaled font units. */
/* */
/* FT_GLYPH_BBOX_SUBPIXELS :: */
/* Return unfitted 26.6 coordinates. */
/* */
/* FT_GLYPH_BBOX_GRIDFIT :: */
/* Return grid-fitted 26.6 coordinates. */
/* */
/* FT_GLYPH_BBOX_TRUNCATE :: */
/* Return coordinates in integer pixels. */
/* */
/* FT_GLYPH_BBOX_PIXELS :: */
/* Return grid-fitted pixel coordinates. */
/* */
typedef enum FT_Glyph_BBox_Mode_
{
FT_GLYPH_BBOX_UNSCALED = 0,
FT_GLYPH_BBOX_SUBPIXELS = 0,
FT_GLYPH_BBOX_GRIDFIT = 1,
FT_GLYPH_BBOX_TRUNCATE = 2,
FT_GLYPH_BBOX_PIXELS = 3
} FT_Glyph_BBox_Mode;
/*************************************************************************/
/* */
/* <Enum> */
/* ft_glyph_bbox_xxx */
/* */
/* <Description> */
/* These constants are deprecated. Use the corresponding */
/* @FT_Glyph_BBox_Mode values instead. */
/* */
/* <Values> */
/* ft_glyph_bbox_unscaled :: see @FT_GLYPH_BBOX_UNSCALED */
/* ft_glyph_bbox_subpixels :: see @FT_GLYPH_BBOX_SUBPIXELS */
/* ft_glyph_bbox_gridfit :: see @FT_GLYPH_BBOX_GRIDFIT */
/* ft_glyph_bbox_truncate :: see @FT_GLYPH_BBOX_TRUNCATE */
/* ft_glyph_bbox_pixels :: see @FT_GLYPH_BBOX_PIXELS */
/* */
#define ft_glyph_bbox_unscaled FT_GLYPH_BBOX_UNSCALED
#define ft_glyph_bbox_subpixels FT_GLYPH_BBOX_SUBPIXELS
#define ft_glyph_bbox_gridfit FT_GLYPH_BBOX_GRIDFIT
#define ft_glyph_bbox_truncate FT_GLYPH_BBOX_TRUNCATE
#define ft_glyph_bbox_pixels FT_GLYPH_BBOX_PIXELS
/*************************************************************************/
/* */
@@ -316,11 +380,9 @@ FT_BEGIN_HEADER
/* convention. */
/* */
/* If the glyph has been loaded with FT_LOAD_NO_SCALE, `bbox_mode' */
/* must be set to `ft_glyph_bbox_unscaled' to get unscaled font */
/* units. */
/* */
/* If `bbox_mode' is set to `ft_glyph_bbox_subpixels' the bbox */
/* coordinates are returned in 26.6 pixels (i.e. 1/64th of pixels). */
/* must be set to `FT_GLYPH_BBOX_UNSCALED' to get unscaled font */
/* units in 26.6 pixel format. The value `FT_GLYPH_BBOX_SUBPIXELS' */
/* is another name for this constant. */
/* */
/* Note that the maximum coordinates are exclusive, which means that */
/* one can compute the width and height of the glyph image (be it in */
@@ -330,7 +392,7 @@ FT_BEGIN_HEADER
/* height = bbox.yMax - bbox.yMin; */
/* */
/* Note also that for 26.6 coordinates, if `bbox_mode' is set to */
/* `ft_glyph_bbox_gridfit', the coordinates will also be grid-fitted, */
/* `FT_GLYPH_BBOX_GRIDFIT', the coordinates will also be grid-fitted, */
/* which corresponds to: */
/* */
/* bbox.xMin = FLOOR(bbox.xMin); */
@@ -339,23 +401,11 @@ FT_BEGIN_HEADER
/* bbox.yMax = CEILING(bbox.yMax); */
/* */
/* To get the bbox in pixel coordinates, set `bbox_mode' to */
/* `ft_glyph_bbox_truncate'. */
/* `FT_GLYPH_BBOX_TRUNCATE'. */
/* */
/* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */
/* to `ft_glyph_bbox_pixels'. */
/* to `FT_GLYPH_BBOX_PIXELS'. */
/* */
/* The default value for `bbox_mode' is `ft_glyph_bbox_pixels'. */
/* */
enum
{
ft_glyph_bbox_unscaled = 0, /* return unscaled font units */
ft_glyph_bbox_subpixels = 0, /* return unfitted 26.6 coordinates */
ft_glyph_bbox_gridfit = 1, /* return grid-fitted 26.6 coordinates */
ft_glyph_bbox_truncate = 2, /* return coordinates in integer pixels */
ft_glyph_bbox_pixels = 3 /* return grid-fitted pixel coordinates */
};
FT_EXPORT( void )
FT_Glyph_Get_CBox( FT_Glyph glyph,
FT_UInt bbox_mode,
@@ -391,8 +441,7 @@ FT_BEGIN_HEADER
/* */
/* <Note> */
/* The glyph image is translated with the `origin' vector before */
/* rendering. In case of error, it it translated back to its */
/* original position and the glyph is left untouched. */
/* rendering. */
/* */
/* The first parameter is a pointer to a FT_Glyph handle, that will */
/* be replaced by this function. Typically, you would use (omitting */
@@ -413,7 +462,7 @@ FT_BEGIN_HEADER
/* // convert to a bitmap (default render mode + destroy old) */
/* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP ) */
/* { */
/* error = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_default, */
/* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_DEFAULT, */
/* 0, 1 ); */
/* if ( error ) // glyph unchanged */
/* ... */
@@ -430,8 +479,7 @@ FT_BEGIN_HEADER
/* } */
/* */
/* */
/* This function will always fail if the glyph's format isn't */
/* scalable. */
/* This function does nothing if the glyph format isn't scalable. */
/* */
FT_EXPORT( FT_Error )
FT_Glyph_To_Bitmap( FT_Glyph* the_glyph,
@@ -514,4 +562,4 @@ FT_END_HEADER
#endif /* __FTGLYPH_H__ */
/* END */
/* END */
+36 -22
View File
@@ -4,7 +4,7 @@
/* */
/* Gzip-compressed stream support. */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,6 +22,13 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
@@ -40,47 +47,54 @@ FT_BEGIN_HEADER
/* */
/*************************************************************************/
/************************************************************************
*
* @type: FT_Stream_OpenGzip
* @function:
* FT_Stream_OpenGzip
*
* @description:
* open a new stream to parse gzip-compressed font files. This is
* Open a new stream to parse gzip-compressed font files. This is
* mainly used to support the compressed *.pcf.gz fonts that come
* with XFree86
* with XFree86.
*
* @input:
* stream :: target embedding stream
* source :: source stream, used to
* stream :: The target embedding stream.
*
* source :: The source stream.
*
* @return:
* error code. 0 means success
* FreeType error code. 0 means success.
*
* @note:
* the source stream must be opened _before_ calling this function.
* The source stream must be opened _before_ calling this function.
*
* calling @FT_Stream_Close on the new stream will *not* call
* @FT_Stream_Close on the source stream. None of the stream objects
* will be released to the heap.
* Calling the internal function FT_Stream_Close on the new stream will
* *not* call FT_Stream_Close on the source stream. None of the stream
* objects will be released to the heap.
*
* the stream implementation is very basic, and resets the decompression
* process each time seeking backwards is needed within the stream
* The stream implementation is very basic and resets the decompression
* process each time seeking backwards is needed within the stream.
*
* in certain builds of the library, gzip compression recognition is
* automatic when calling @FT_New_Face or @FT_Open_Face. This means that
* if no font driver is capable of handling the raw compressed file,
* the library will try to open a gzip stream from it and re-open
* the face with it.
* In certain builds of the library, gzip compression recognition is
* automatically handled when calling @FT_New_Face or @FT_Open_Face.
* This means that if no font driver is capable of handling the raw
* compressed file, the library will try to open a gzipped stream from
* it and re-open the face with it.
*
* this function may return "FT_Err_Unimplemented" if your build of
* This function may return "FT_Err_Unimplemented" if your build of
* FreeType was not compiled with zlib support.
*/
FT_EXPORT( FT_Error )
FT_Stream_OpenGzip( FT_Stream stream,
FT_Stream source );
FT_Stream_OpenGzip( FT_Stream stream,
FT_Stream source );
/* */
FT_END_HEADER
#endif /* __FTGZIP_H__ */
#endif /* __FTGZIP_H__ */
/* END */
+30 -35
View File
@@ -5,7 +5,7 @@
/* FreeType glyph image formats and default raster interface */
/* (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -53,8 +53,8 @@ FT_BEGIN_HEADER
/* <Description> */
/* The type FT_Pos is a 32-bit integer used to store vectorial */
/* coordinates. Depending on the context, these can represent */
/* distances in integer font units, or 26.6 fixed float pixel */
/* coordinates. */
/* distances in integer font units, or 16,16, or 26.6 fixed float */
/* pixel coordinates. */
/* */
typedef signed long FT_Pos;
@@ -261,7 +261,8 @@ FT_BEGIN_HEADER
/* `FT_PIXEL_MODE_GRAY'; it gives the number of gray */
/* levels used in the bitmap. */
/* */
/* pixel_mode :: The pixel_mode, i.e., how pixel bits are stored. */
/* pixel_mode :: The pixel mode, i.e., how pixel bits are stored. */
/* See @FT_Pixel_Mode for possible values. */
/* */
/* palette_mode :: This field is only used with paletted pixel modes; */
/* it indicates how the palette is stored. */
@@ -357,11 +358,11 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Outline_Flags */
/* FT_OUTLINE_FLAGS */
/* */
/* <Description> */
/* A simple type used to enumerates the flags in an outline's */
/* `outline_flags' field. */
/* A list of bit-field constants use for the flags in an outline's */
/* `flags' field. */
/* */
/* <Values> */
/* FT_OUTLINE_NONE :: Value 0 is reserved. */
@@ -414,27 +415,24 @@ FT_BEGIN_HEADER
/* completely ignored by a given */
/* scan-converter. */
/* */
typedef enum FT_Outline_Flags_
{
FT_OUTLINE_NONE = 0,
FT_OUTLINE_OWNER = 1,
FT_OUTLINE_EVEN_ODD_FILL = 2,
FT_OUTLINE_REVERSE_FILL = 4,
FT_OUTLINE_IGNORE_DROPOUTS = 8,
FT_OUTLINE_HIGH_PRECISION = 256,
FT_OUTLINE_SINGLE_PASS = 512
#define FT_OUTLINE_NONE 0x0
#define FT_OUTLINE_OWNER 0x1
#define FT_OUTLINE_EVEN_ODD_FILL 0x2
#define FT_OUTLINE_REVERSE_FILL 0x4
#define FT_OUTLINE_IGNORE_DROPOUTS 0x8
} FT_Outline_Flags;
#define FT_OUTLINE_HIGH_PRECISION 0x100
#define FT_OUTLINE_SINGLE_PASS 0x200
/*************************************************************************
*
* @enum:
* ft_outline_xxx
* ft_outline_flags
*
* @description:
* These constants are deprecated. Please use the corresponding
* @FT_OUTLINE_XXX values.
* @FT_OUTLINE_FLAGS values.
*
* @values:
* ft_outline_none :: See @FT_OUTLINE_NONE.
@@ -659,7 +657,7 @@ FT_BEGIN_HEADER
/* should redefine this macro in case of problems to something like */
/* this: */
/* */
/* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) (value) */
/* #define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 ) value */
/* */
/* to get a simple enumeration without assigning special numbers. */
/* */
@@ -689,8 +687,8 @@ FT_BEGIN_HEADER
/* */
/* FT_GLYPH_FORMAT_COMPOSITE :: */
/* The glyph image is a composite of several other images. This */
/* format is _only_ used with @FT_LOAD_FLAG_NO_RECURSE, and is */
/* used to report compound glyphs (like accented characters). */
/* format is _only_ used with @FT_LOAD_NO_RECURSE, and is used to */
/* report compound glyphs (like accented characters). */
/* */
/* FT_GLYPH_FORMAT_BITMAP :: */
/* The glyph image is a bitmap, and can be described as an */
@@ -937,11 +935,11 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Raster_Flag */
/* FT_RASTER_FLAG_XXX */
/* */
/* <Description> */
/* An enumeration to list the bit flags as used in the `flags' field */
/* of a FT_Raster_Params structure. */
/* A list of bit flag constants as used in the `flags' field of a */
/* @FT_Raster_Params structure. */
/* */
/* <Values> */
/* FT_RASTER_FLAG_DEFAULT :: This value is 0. */
@@ -949,7 +947,7 @@ FT_BEGIN_HEADER
/* FT_RASTER_FLAG_AA :: This flag is set to indicate that an */
/* anti-aliased glyph image should be */
/* generated. Otherwise, it will be */
/* monochrome (1-bit) */
/* monochrome (1-bit). */
/* */
/* FT_RASTER_FLAG_DIRECT :: This flag is set to indicate direct */
/* rendering. In this mode, client */
@@ -974,15 +972,12 @@ FT_BEGIN_HEADER
/* in direct rendering mode where all spans */
/* are generated if no clipping box is set. */
/* */
typedef enum
{
FT_RASTER_FLAG_DEFAULT = 0,
FT_RASTER_FLAG_AA = 1,
FT_RASTER_FLAG_DIRECT = 2,
FT_RASTER_FLAG_CLIP = 4
} FT_Raster_Flag;
#define FT_RASTER_FLAG_DEFAULT 0x0
#define FT_RASTER_FLAG_AA 0x1
#define FT_RASTER_FLAG_DIRECT 0x2
#define FT_RASTER_FLAG_CLIP 0x4
/* deprecated */
#define ft_raster_flag_default FT_RASTER_FLAG_DEFAULT
#define ft_raster_flag_aa FT_RASTER_FLAG_AA
#define ft_raster_flag_direct FT_RASTER_FLAG_DIRECT
@@ -1238,4 +1233,4 @@ FT_END_HEADER
#endif /* __FTIMAGE_H__ */
/* END */
/* END */
+14 -9
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType incremental loading (specification). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,6 +22,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -186,10 +192,10 @@ FT_BEGIN_HEADER
*/
typedef FT_Error
(*FT_Incremental_GetGlyphMetricsFunc)
( FT_Incremental incremental,
FT_UInt glyph_index,
FT_Bool vertical,
FT_Incremental_MetricsRec *ametrics );
( FT_Incremental incremental,
FT_UInt glyph_index,
FT_Bool vertical,
FT_Incremental_MetricsRec *ametrics );
/**************************************************************************
@@ -199,7 +205,7 @@ FT_BEGIN_HEADER
*
* @description:
* A table of functions for accessing fonts that load data
* incrementally. Used in @FT_Incremental_Interface.
* incrementally. Used in @FT_Incremental_InterfaceRec.
*
* @fields:
* get_glyph_data ::
@@ -246,8 +252,7 @@ FT_BEGIN_HEADER
* parameter.data = &inc_int;
*
* // set up FT_Open_Args structure
* open_args.flags = (FT_Open_Flags)( FT_OPEN_PATHNAME |
* FT_OPEN_PARAMS );
* open_args.flags = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;
* open_args.pathname = my_font_pathname;
* open_args.num_params = 1;
* open_args.params = &parameter; // we use one optional argument
@@ -284,4 +289,4 @@ FT_END_HEADER
#endif /* __FTINCREM_H__ */
/* END */
/* END */
+8 -2
View File
@@ -4,7 +4,7 @@
/* */
/* Generic list support for FreeType (specification). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -31,6 +31,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -265,4 +271,4 @@ FT_END_HEADER
#endif /* __FTLIST_H__ */
/* END */
/* END */
+99
View File
@@ -0,0 +1,99 @@
/***************************************************************************/
/* */
/* ftlzw.h */
/* */
/* LZW-compressed stream support. */
/* */
/* Copyright 2004 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. */
/* */
/***************************************************************************/
#ifndef __FTLZW_H__
#define __FTLZW_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* lzw */
/* */
/* <Title> */
/* LZW Streams */
/* */
/* <Abstract> */
/* Using LZW-compressed font files */
/* */
/* <Description> */
/* This section contains the declaration of LZW-specific functions. */
/* */
/*************************************************************************/
/************************************************************************
*
* @function:
* FT_Stream_OpenLZW
*
* @description:
* Open a new stream to parse LZW-compressed font files. This is
* mainly used to support the compressed *.pcf.Z fonts that come
* with XFree86.
*
* @input:
* stream :: The target embedding stream.
*
* source :: The source stream.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* The source stream must be opened _before_ calling this function.
*
* Calling the internal function FT_Stream_Close on the new stream will
* *not* call FT_Stream_Close on the source stream. None of the stream
* objects will be released to the heap.
*
* The stream implementation is very basic and resets the decompression
* process each time seeking backwards is needed within the stream
*
* In certain builds of the library, LZW compression recognition is
* automatically handled when calling @FT_New_Face or @FT_Open_Face.
* This means that if no font driver is capable of handling the raw
* compressed file, the library will try to open a LZW stream from it
* and re-open the face with it.
*
* This function may return "FT_Err_Unimplemented" if your build of
* FreeType was not compiled with LZW support.
*/
FT_EXPORT( FT_Error )
FT_Stream_OpenLZW( FT_Stream stream,
FT_Stream source );
/* */
FT_END_HEADER
#endif /* __FTLZW_H__ */
/* END */
+40 -6
View File
@@ -4,7 +4,7 @@
/* */
/* Additional Mac-specific API. */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2004 by */
/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -111,10 +111,44 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_EXPORT_DEF( FT_Error )
FT_GetFile_From_Mac_Name( char* fontName,
FSSpec* pathSpec,
FT_Long* face_index );
FT_EXPORT( FT_Error )
FT_GetFile_From_Mac_Name( const char* fontName,
FSSpec* pathSpec,
FT_Long* face_index );
/*************************************************************************/
/* */
/* <Function> */
/* FT_New_Face_From_FSSpec */
/* */
/* <Description> */
/* Creates a new face object from a given resource and typeface index */
/* using an FSSpec to the font file. */
/* */
/* <InOut> */
/* library :: A handle to the library resource. */
/* */
/* <Input> */
/* spec :: FSSpec to the font file. */
/* */
/* face_index :: The index of the face within the resource. The */
/* first face has index 0. */
/* <Output> */
/* aface :: A handle to a new face object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* @FT_New_Face_From_FSSpec is identical to @FT_New_Face except */
/* it accepts an FSSpec instead of a path. */
/* */
FT_EXPORT( FT_Error )
FT_New_Face_From_FSSpec( FT_Library library,
const FSSpec *spec,
FT_Long face_index,
FT_Face *aface );
/* */
@@ -125,4 +159,4 @@ FT_END_HEADER
#endif /* __FTMAC_H__ */
/* END */
/* END */
+1 -16
View File
@@ -100,21 +100,6 @@ FT_BEGIN_HEADER
/* */
typedef FT_Error
(*FT_Get_MM_Func)( FT_Face face,
FT_Multi_Master* master );
typedef FT_Error
(*FT_Set_MM_Design_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
typedef FT_Error
(*FT_Set_MM_Blend_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
/*************************************************************************/
/* */
/* <Function> */
@@ -200,4 +185,4 @@ FT_END_HEADER
#endif /* __FTMM_H__ */
/* END */
/* END */
@@ -1,10 +1,10 @@
/***************************************************************************/
/* */
/* ftmodule.h */
/* ftmodapi.h */
/* */
/* FreeType modules public interface (specification). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -16,13 +16,19 @@
/***************************************************************************/
#ifndef __FTMODULE_H__
#define __FTMODULE_H__
#ifndef __FTMODAPI_H__
#define __FTMODAPI_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -46,25 +52,31 @@ FT_BEGIN_HEADER
/* module bit flags */
typedef enum FT_Module_Flags_
{
ft_module_font_driver = 1, /* this module is a font driver */
ft_module_renderer = 2, /* this module is a renderer */
ft_module_hinter = 4, /* this module is a glyph hinter */
ft_module_styler = 8, /* this module is a styler */
#define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */
#define FT_MODULE_RENDERER 2 /* this module is a renderer */
#define FT_MODULE_HINTER 4 /* this module is a glyph hinter */
#define FT_MODULE_STYLER 8 /* this module is a styler */
ft_module_driver_scalable = 0x100, /* the driver supports scalable */
/* fonts */
ft_module_driver_no_outlines = 0x200, /* the driver does not support */
/* vector outlines */
ft_module_driver_has_hinter = 0x400 /* the driver provides its own */
/* hinter */
} FT_Module_Flags;
#define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */
/* scalable fonts */
#define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */
/* support vector outlines */
#define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */
/* own hinter */
typedef void
(*FT_Module_Interface)( void );
/* deprecated values */
#define ft_module_font_driver FT_MODULE_FONT_DRIVER
#define ft_module_renderer FT_MODULE_RENDERER
#define ft_module_hinter FT_MODULE_HINTER
#define ft_module_styler FT_MODULE_STYLER
#define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE
#define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES
#define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER
typedef FT_Pointer FT_Module_Interface;
typedef FT_Error
(*FT_Module_Constructor)( FT_Module module );
@@ -72,7 +84,7 @@ FT_BEGIN_HEADER
typedef void
(*FT_Module_Destructor)( FT_Module module );
typedef FT_Module_Interface
typedef FT_Module_Interface
(*FT_Module_Requester)( FT_Module module,
const char* name );
@@ -301,7 +313,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* __FTMODULE_H__ */
#endif /* __FTMODAPI_H__ */
/* END */
/* END */
+24 -19
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType module error offsets (specification). */
/* */
/* Copyright 2001, 2002 by */
/* Copyright 2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -23,8 +23,8 @@
/* The lower byte gives the error code, the higher byte gives the */
/* module. The base module has error offset 0. For example, the error */
/* `FT_Err_Invalid_File_Format' has value 0x003, the error */
/* `TT_Err_Invalid_File_Format' has value 0xB03, the error */
/* `T1_Err_Invalid_File_Format' has value 0xC03, etc. */
/* `TT_Err_Invalid_File_Format' has value 0x1003, the error */
/* `T1_Err_Invalid_File_Format' has value 0x1103, etc. */
/* */
/* Undefine the macro FT_CONFIG_OPTION_USE_MODULE_ERRORS in ftoption.h */
/* to make the higher byte always zero (disabling the module error */
@@ -102,21 +102,26 @@
#endif
FT_MODERRDEF( Base, 0x000, "base module" )
FT_MODERRDEF( Autohint, 0x100, "autohinter module" )
FT_MODERRDEF( Cache, 0x200, "cache module" )
FT_MODERRDEF( CFF, 0x300, "CFF module" )
FT_MODERRDEF( CID, 0x400, "CID module" )
FT_MODERRDEF( PCF, 0x500, "PCF module" )
FT_MODERRDEF( PSaux, 0x600, "PS auxiliary module" )
FT_MODERRDEF( PSnames, 0x700, "PS names module" )
FT_MODERRDEF( Raster, 0x800, "raster module" )
FT_MODERRDEF( SFNT, 0x900, "SFNT module" )
FT_MODERRDEF( Smooth, 0xA00, "smooth raster module" )
FT_MODERRDEF( TrueType, 0xB00, "TrueType module" )
FT_MODERRDEF( Type1, 0xC00, "Type 1 module" )
FT_MODERRDEF( Winfonts, 0xD00, "Windows FON/FNT module" )
FT_MODERRDEF( PFR, 0xE00, "PFR module" )
FT_MODERRDEF( Base, 0x000, "base module" )
FT_MODERRDEF( Autohint, 0x100, "autohinter module" )
FT_MODERRDEF( BDF, 0x200, "BDF module" )
FT_MODERRDEF( Cache, 0x300, "cache module" )
FT_MODERRDEF( CFF, 0x400, "CFF module" )
FT_MODERRDEF( CID, 0x500, "CID module" )
FT_MODERRDEF( Gzip, 0x600, "Gzip module" )
FT_MODERRDEF( LZW, 0x700, "LZW module" )
FT_MODERRDEF( PCF, 0x800, "PCF module" )
FT_MODERRDEF( PFR, 0x900, "PFR module" )
FT_MODERRDEF( PSaux, 0xA00, "PS auxiliary module" )
FT_MODERRDEF( PShinter, 0xB00, "PS hinter module" )
FT_MODERRDEF( PSnames, 0xC00, "PS names module" )
FT_MODERRDEF( Raster, 0xD00, "raster module" )
FT_MODERRDEF( SFNT, 0xE00, "SFNT module" )
FT_MODERRDEF( Smooth, 0xF00, "smooth raster module" )
FT_MODERRDEF( TrueType, 0x1000, "TrueType module" )
FT_MODERRDEF( Type1, 0x1100, "Type 1 module" )
FT_MODERRDEF( Type42, 0x1200, "Type 42 module" )
FT_MODERRDEF( Winfonts, 0x1300, "Windows FON/FNT module" )
#ifdef FT_MODERR_END_LIST
@@ -146,4 +151,4 @@
#endif /* __FTMODERR_H__ */
/* END */
/* END */
+75 -3
View File
@@ -5,7 +5,7 @@
/* Support for the FT_Outline type used to store glyph shapes of */
/* most scalable font formats (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -24,6 +24,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -46,7 +52,7 @@ FT_BEGIN_HEADER
/* */
/* <Order> */
/* FT_Outline */
/* FT_Outline_Flags */
/* FT_OUTLINE_FLAGS */
/* FT_Outline_New */
/* FT_Outline_Done */
/* FT_Outline_Copy */
@@ -389,6 +395,72 @@ FT_BEGIN_HEADER
FT_Raster_Params* params );
/**************************************************************************
*
* @enum:
* FT_Orientation
*
* @description:
* A list of values used to describe an outline's contour orientation.
*
* The TrueType and Postscript specifications use different conventions
* to determine whether outline contours should be filled or unfilled.
*
* @values:
* FT_ORIENTATION_TRUETYPE ::
* According to the TrueType specification, clockwise contours must
* be filled, and counter-clockwise ones must be unfilled.
*
* FT_ORIENTATION_POSTSCRIPT ::
* According to the Postscript specification, counter-clockwise contours
* must be filled, and clockwise ones must be unfilled.
*
* FT_ORIENTATION_FILL_RIGHT ::
* This is identical to @FT_ORIENTATION_TRUETYPE, but is used to
* remember that in TrueType, everything that is to the right of
* the drawing direction of a contour must be filled.
*
* FT_ORIENTATION_FILL_LEFT ::
* This is identical to @FT_ORIENTATION_POSTSCRIPT, but is used to
* remember that in Postscript, everything that is to the left of
* the drawing direction of a contour must be filled.
*/
typedef enum
{
FT_ORIENTATION_TRUETYPE = 0,
FT_ORIENTATION_POSTSCRIPT = 1,
FT_ORIENTATION_FILL_RIGHT = FT_ORIENTATION_TRUETYPE,
FT_ORIENTATION_FILL_LEFT = FT_ORIENTATION_POSTSCRIPT
} FT_Orientation;
/**************************************************************************
*
* @function:
* FT_Outline_Get_Orientation
*
* @description:
* This function analyzes a glyph outline and tries to compute its
* fill orientation (see @FT_Orientation). This is done by computing
* the direction of each global horizontal and/or vertical extrema
* within the outline.
*
* Note that this will return @FT_ORIENTATION_TRUETYPE for empty
* outlines.
*
* @input:
* outline ::
* A handle to the source outline.
*
* @return:
* The orientation.
*
*/
FT_EXPORT( FT_Orientation )
FT_Outline_Get_Orientation( FT_Outline* outline );
/* */
@@ -397,4 +469,4 @@ FT_END_HEADER
#endif /* __FTOUTLN_H__ */
/* END */
/* END */
+60 -44
View File
@@ -2,9 +2,9 @@
/* */
/* ftpfr.h */
/* */
/* FreeType API for accessing PFR-specific data */
/* FreeType API for accessing PFR-specific data (specification only). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,6 +22,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -49,42 +55,44 @@ FT_BEGIN_HEADER
* FT_Get_PFR_Metrics
*
* @description:
* returns the outline and metrics resolutions of a given PFR
* face.
* Return the outline and metrics resolutions of a given PFR face.
*
* @input:
* face :: handle to input face. It can be a non-PFR face.
* face :: Handle to the input face. It can be a non-PFR face.
*
* @output:
* aoutline_resolution ::
* outline resolution. This is equivalent to "face->units_per_EM".
* optional (parameter can be NULL)
* Outline resolution. This is equivalent to `face->units_per_EM'.
* Optional (parameter can be NULL).
*
* ametrics_resolution ::
* metrics_resolution. This is equivalent to "outline_resolution"
* for non-PFR fonts. can be NULL
* optional (parameter can be NULL)
* Metrics resolution. This is equivalent to `outline_resolution'
* for non-PFR fonts. Optional (parameter can be NULL).
*
* ametrics_x_scale ::
* a 16.16 fixed-point number used to scale distance expressed
* in metrics units to device sub-pixels. This is equivalent to
* 'face->size->x_scale', but for metrics only.
* optional (parameter can be NULL)
* A 16.16 fixed-point number used to scale distance expressed
* in metrics units to device sub-pixels. This is equivalent to
* `face->size->x_scale', but for metrics only. Optional (parameter
* can be NULL)
*
* ametrics_y_scale ::
* same as 'ametrics_x_scale', but for the vertical direction.
* Same as `ametrics_x_scale' but for the vertical direction.
* optional (parameter can be NULL)
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* if the input face is not a PFR, this function will return an error.
* If the input face is not a PFR, this function will return an error.
* However, in all cases, it will return valid values.
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Metrics( FT_Face face,
FT_UInt *aoutline_resolution,
FT_UInt *ametrics_resolution,
FT_Fixed *ametrics_x_scale,
FT_Fixed *ametrics_y_scale );
FT_Get_PFR_Metrics( FT_Face face,
FT_UInt *aoutline_resolution,
FT_UInt *ametrics_resolution,
FT_Fixed *ametrics_x_scale,
FT_Fixed *ametrics_y_scale );
/**********************************************************************
*
@@ -92,25 +100,30 @@ FT_BEGIN_HEADER
* FT_Get_PFR_Kerning
*
* @description:
* returns the kerning pair corresponding to two glyphs in
* a PFR face. The distance is expressed in metrics units, unlike
* the result of @FT_Get_Kerning.
* Return the kerning pair corresponding to two glyphs in a PFR face.
* The distance is expressed in metrics units, unlike the result of
* @FT_Get_Kerning.
*
* @input:
* face :: handle to input face.
* left :: left glyph index
* right :: right glyph index
* face :: A handle to the input face.
*
* left :: Index of the left glyph.
*
* right :: Index of the right glyph.
*
* @output:
* avector :: kerning vector
* avector :: A kerning vector.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* this function always return distances in original PFR metrics
* units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED
* mode, which always return distances converted to outline units.
* This function always return distances in original PFR metrics
* units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED
* mode, which always returns distances converted to outline units.
*
* you can use the value of the 'x_scale' and 'y_scale' parameters
* returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels
* You can use the value of the `x_scale' and `y_scale' parameters
* returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels.
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Kerning( FT_Face face,
@@ -118,39 +131,42 @@ FT_BEGIN_HEADER
FT_UInt right,
FT_Vector *avector );
/**********************************************************************
*
* @function:
* FT_Get_PFR_Advance
*
* @description:
* returns a given glyph advance, expressed in original metrics units,
* Return a given glyph advance, expressed in original metrics units,
* from a PFR font.
*
* @input:
* face :: handle to input face.
* gindex :: glyph index
* face :: A handle to the input face.
*
* gindex :: The glyph index.
*
* @output:
* aadvance :: glyph advance in metrics units
* aadvance :: The glyph advance in metrics units.
*
* @return:
* error code. 0 means success
* FreeType error code. 0 means success.
*
* @note:
* you can use the 'x_scale' or 'y_scale' results of @FT_Get_PFR_Metrics
* to convert the advance to device sub-pixels (i.e. 1/64th of pixels)
* You can use the `x_scale' or `y_scale' results of @FT_Get_PFR_Metrics
* to convert the advance to device sub-pixels (i.e. 1/64th of pixels).
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Advance( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
FT_Get_PFR_Advance( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
/* */
FT_END_HEADER
#endif /* __FTBDF_H__ */
/* END */
/* END */
+1 -1
View File
@@ -226,4 +226,4 @@ FT_END_HEADER
#endif /* __FTRENDER_H__ */
/* END */
/* END */
+11 -3
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType size objects management (specification). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -32,6 +32,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -101,7 +107,9 @@ FT_BEGIN_HEADER
/* FT_Done_Size */
/* */
/* <Description> */
/* Discards a given size object. */
/* Discards a given size object. Note that @FT_Done_Face */
/* automatically discards all size objects allocated with */
/* @FT_New_Size. */
/* */
/* <Input> */
/* size :: A handle to a target size object. */
@@ -148,4 +156,4 @@ FT_END_HEADER
#endif /* __FTSIZES_H__ */
/* END */
/* END */
+8 -2
View File
@@ -7,7 +7,7 @@
/* */
/* This is _not_ used to retrieve glyph names! */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -26,6 +26,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -158,4 +164,4 @@ FT_END_HEADER
#endif /* __FT_SFNT_NAMES_H__ */
/* END */
/* END */
+686
View File
@@ -0,0 +1,686 @@
/***************************************************************************/
/* */
/* ftstroke.h */
/* */
/* FreeType path stroker (specification). */
/* */
/* Copyright 2002, 2003, 2004 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. */
/* */
/***************************************************************************/
#ifndef __FT_STROKE_H__
#define __FT_STROKE_H__
#include <ft2build.h>
#include FT_OUTLINE_H
#include FT_GLYPH_H
FT_BEGIN_HEADER
/*@*************************************************************
*
* @type:
* FT_Stroker
*
* @description:
* Opaque handler to a path stroker object.
*/
typedef struct FT_StrokerRec_* FT_Stroker;
/*@*************************************************************
*
* @enum:
* FT_Stroker_LineJoin
*
* @description:
* These values determine how two joining lines are rendered
* in a stroker.
*
* @values:
* FT_STROKER_LINEJOIN_ROUND ::
* Used to render rounded line joins. Circular arcs are used
* to join two lines smoothly.
*
* FT_STROKER_LINEJOIN_BEVEL ::
* Used to render beveled line joins; i.e., the two joining lines
* are extended until they intersect.
*
* FT_STROKER_LINEJOIN_MITER ::
* Same as beveled rendering, except that an additional line
* break is added if the angle between the two joining lines
* is too closed (this is useful to avoid unpleasant spikes
* in beveled rendering).
*/
typedef enum
{
FT_STROKER_LINEJOIN_ROUND = 0,
FT_STROKER_LINEJOIN_BEVEL,
FT_STROKER_LINEJOIN_MITER
} FT_Stroker_LineJoin;
/*@*************************************************************
*
* @enum:
* FT_Stroker_LineCap
*
* @description:
* These values determine how the end of opened sub-paths are
* rendered in a stroke.
*
* @values:
* FT_STROKER_LINECAP_BUTT ::
* The end of lines is rendered as a full stop on the last
* point itself.
*
* FT_STROKER_LINECAP_ROUND ::
* The end of lines is rendered as a half-circle around the
* last point.
*
* FT_STROKER_LINECAP_SQUARE ::
* The end of lines is rendered as a square around the
* last point.
*/
typedef enum
{
FT_STROKER_LINECAP_BUTT = 0,
FT_STROKER_LINECAP_ROUND,
FT_STROKER_LINECAP_SQUARE
} FT_Stroker_LineCap;
/**************************************************************
*
* @enum:
* FT_StrokerBorder
*
* @description:
* These values are used to select a given stroke border
* in @FT_Stroker_GetBorderCounts and @FT_Stroker_ExportBorder.
*
* @values:
* FT_STROKER_BORDER_LEFT ::
* Select the left border, relative to the drawing direction.
*
* FT_STROKER_BORDER_RIGHT ::
* Select the right border, relative to the drawing direction.
*
* @note:
* Applications are generally interested in the `inside' and `outside'
* borders. However, there is no direct mapping between these and
* the `left' / `right' ones, since this really depends on the glyph's
* drawing orientation, which varies between font formats.
*
* You can however use @FT_Outline_GetInsideBorder and
* @FT_Outline_GetOutsideBorder to get these.
*/
typedef enum
{
FT_STROKER_BORDER_LEFT = 0,
FT_STROKER_BORDER_RIGHT
} FT_StrokerBorder;
/**************************************************************
*
* @function:
* FT_Outline_GetInsideBorder
*
* @description:
* Retrieve the @FT_StrokerBorder value corresponding to the
* `inside' borders of a given outline.
*
* @input:
* outline ::
* The source outline handle.
*
* @return:
* The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
* outlines.
*/
FT_EXPORT( FT_StrokerBorder )
FT_Outline_GetInsideBorder( FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Outline_GetOutsideBorder
*
* @description:
* Retrieve the @FT_StrokerBorder value corresponding to the
* `outside' borders of a given outline.
*
* @input:
* outline ::
* The source outline handle.
*
* @return:
* The border index. @FT_STROKER_BORDER_LEFT for empty or invalid
* outlines.
*/
FT_EXPORT( FT_StrokerBorder )
FT_Outline_GetOutsideBorder( FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Stroker_New
*
* @description:
* Create a new stroker object.
*
* @input:
* memory ::
* The memory manager handle.
*
* @output:
* A new stroker object handle. NULL in case of error.
*
* @return:
* FreeType error code. 0 means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_New( FT_Memory memory,
FT_Stroker *astroker );
/**************************************************************
*
* @function:
* FT_Stroker_Set
*
* @description:
* Reset a stroker object's attributes.
*
* @input:
* stroker ::
* The target stroker handle.
*
* radius ::
* The border radius.
*
* line_cap ::
* The line cap style.
*
* line_join ::
* The line join style.
*
* miter_limit ::
* The miter limit for the FT_STROKER_LINEJOIN_MITER style,
* expressed as 16.16 fixed point value.
*
* @note:
* The radius is expressed in the same units that the outline
* coordinates.
*/
FT_EXPORT( void )
FT_Stroker_Set( FT_Stroker stroker,
FT_Fixed radius,
FT_Stroker_LineCap line_cap,
FT_Stroker_LineJoin line_join,
FT_Fixed miter_limit );
/**************************************************************
*
* @function:
* FT_Stroker_Rewind
*
* @description:
* Reset a stroker object without changing its attributes.
* You should call this function before beginning a new
* series of calls to @FT_Stroker_BeginSubPath or
* @FT_Stroker_EndSubPath.
*
* @input:
* stroker ::
* The target stroker handle.
*/
FT_EXPORT( void )
FT_Stroker_Rewind( FT_Stroker stroker );
/**************************************************************
*
* @function:
* FT_Stroker_ParseOutline
*
* @description:
* A convenience function used to parse a whole outline with
* the stroker. The resulting outline(s) can be retrieved
* later by functions like @FT_Stroker_GetCounts and @FT_Stroker_Export.
*
* @input:
* stroker ::
* The target stroker handle.
*
* outline ::
* The source outline.
*
* opened ::
* A boolean. If TRUE, the outline is treated as an open path
* instead of a closed one.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* If `opened' is 0 (the default), the outline is treated as a closed
* path, and the stroker will generate two distinct `border' outlines.
*
* If `opened' is 1, the outline is processed as an open path, and the
* stroker will generate a single `stroke' outline.
*
* This function calls @FT_Stroker_Rewind automatically.
*/
FT_EXPORT( FT_Error )
FT_Stroker_ParseOutline( FT_Stroker stroker,
FT_Outline* outline,
FT_Bool opened );
/**************************************************************
*
* @function:
* FT_Stroker_BeginSubPath
*
* @description:
* Start a new sub-path in the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* to ::
* A pointer to the start vector.
*
* open ::
* A boolean. If TRUE, the sub-path is treated as an open one.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* This function is useful when you need to stroke a path that is
* not stored as a @FT_Outline object.
*/
FT_EXPORT( FT_Error )
FT_Stroker_BeginSubPath( FT_Stroker stroker,
FT_Vector* to,
FT_Bool open );
/**************************************************************
*
* @function:
* FT_Stroker_EndSubPath
*
* @description:
* Close the current sub-path in the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function after @FT_Stroker_BeginSubPath.
* If the subpath was not `opened', this function will `draw' a
* single line segment to the start position when needed.
*/
FT_EXPORT( FT_Error )
FT_Stroker_EndSubPath( FT_Stroker stroker );
/**************************************************************
*
* @function:
* FT_Stroker_LineTo
*
* @description:
* `Draw' a single line segment in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_LineTo( FT_Stroker stroker,
FT_Vector* to );
/**************************************************************
*
* @function:
* FT_Stroker_ConicTo
*
* @description:
* `Draw; a single quadratic bezier in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* control ::
* A pointer to a Bézier control point.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_ConicTo( FT_Stroker stroker,
FT_Vector* control,
FT_Vector* to );
/**************************************************************
*
* @function:
* FT_Stroker_CubicTo
*
* @description:
* `Draw' a single cubic Bézier in the stroker's current sub-path,
* from the last position.
*
* @input:
* stroker ::
* The target stroker handle.
*
* control1 ::
* A pointer to the first Bézier control point.
*
* control2 ::
* A pointer to second Bézier control point.
*
* to ::
* A pointer to the destination point.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* You should call this function between @FT_Stroker_BeginSubPath and
* @FT_Stroker_EndSubPath.
*/
FT_EXPORT( FT_Error )
FT_Stroker_CubicTo( FT_Stroker stroker,
FT_Vector* control1,
FT_Vector* control2,
FT_Vector* to );
/**************************************************************
*
* @function:
* FT_Stroker_GetBorderCounts
*
* @description:
* Vall this function once you have finished parsing your paths
* with the stroker. It will return the number of points and
* contours necessary to export one of the `border' or `stroke'
* outlines generated by the stroker.
*
* @input:
* stroker ::
* The target stroker handle.
*
* border ::
* The border index.
*
* @output:
* anum_points ::
* The number of points.
*
* anum_contours ::
* The number of contours.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* When an outline, or a sub-path, is `closed', the stroker generates
* two independent `border' outlines, named `left' and `right'.
*
* When the outline, or a sub-path, is `opened', the stroker merges
* the `border' outlines with caps. The `left' border receives all
* points, while the `right' border becomes empty.
*
* Use the function @FT_Stroker_GetCounts instead if you want to
* retrieve the counts associated to both borders.
*/
FT_EXPORT( FT_Error )
FT_Stroker_GetBorderCounts( FT_Stroker stroker,
FT_StrokerBorder border,
FT_UInt *anum_points,
FT_UInt *anum_contours );
/**************************************************************
*
* @function:
* FT_Stroker_ExportBorder
*
* @description:
* Call this function after @FT_Stroker_GetBorderCounts to
* export the corresponding border to your own @FT_Outline
* structure.
*
* Note that this function will append the border points and
* contours to your outline, but will not try to resize its
* arrays.
*
* @input:
* stroker ::
* The target stroker handle.
*
* border ::
* The border index.
*
* outline ::
* The target outline handle.
*
* @note:
* Always call this function after @FT_Stroker_GetBorderCounts to
* get sure that there is enough room in your @FT_Outline object to
* receive all new data.
*
* When an outline, or a sub-path, is `closed', the stroker generates
* two independent `border' outlines, named `left' and `right'
*
* When the outline, or a sub-path, is `opened', the stroker merges
* the `border' outlines with caps. The `left' border receives all
* points, while the `right' border becomes empty.
*
* Use the function @FT_Stroker_Export instead if you want to
* retrieve all borders at once.
*/
FT_EXPORT( void )
FT_Stroker_ExportBorder( FT_Stroker stroker,
FT_StrokerBorder border,
FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Stroker_GetCounts
*
* @description:
* Call this function once you have finished parsing your paths
* with the stroker. It returns the number of points and
* contours necessary to export all points/borders from the stroked
* outline/path.
*
* @input:
* stroker ::
* The target stroker handle.
*
* @output:
* anum_points ::
* The number of points.
*
* anum_contours ::
* The number of contours.
*
* @return:
* FreeType error code. 0 means success.
*/
FT_EXPORT( FT_Error )
FT_Stroker_GetCounts( FT_Stroker stroker,
FT_UInt *anum_points,
FT_UInt *anum_contours );
/**************************************************************
*
* @function:
* FT_Stroker_Export
*
* @description:
* Call this function after @FT_Stroker_GetBorderCounts to
* export the all borders to your own @FT_Outline structure.
*
* Note that this function will append the border points and
* contours to your outline, but will not try to resize its
* arrays.
*
* @input:
* stroker ::
* The target stroker handle.
*
* outline ::
* The target outline handle.
*/
FT_EXPORT( void )
FT_Stroker_Export( FT_Stroker stroker,
FT_Outline* outline );
/**************************************************************
*
* @function:
* FT_Stroker_Done
*
* @description:
* Destroy a stroker object.
*
* @input:
* stroker ::
* A stroker handle. Can be NULL.
*/
FT_EXPORT( void )
FT_Stroker_Done( FT_Stroker stroker );
/**************************************************************
*
* @function:
* FT_Glyph_Stroke
*
* @description:
* Stroke a given outline glyph object with a given stroker.
*
* @inout:
* pglyph :: Source glyph handle on input, new glyph handle
* on output.
*
* @input:
* stroker ::
* A stroker handle.
*
* destroy ::
* A Boolean. If TRUE, the source glyph object is destroyed
* on success.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* The source glyph is untouched in case of error.
*/
FT_EXPORT( FT_Error )
FT_Glyph_Stroke( FT_Glyph *pglyph,
FT_Stroker stroker,
FT_Bool destroy );
/**************************************************************
*
* @function:
* FT_Glyph_StrokeBorder
*
* @description:
* Stroke a given outline glyph object with a given stroker, but
* only return either its inside or outside border.
*
* @inout:
* pglyph ::
* Source glyph handle on input, new glyph handle on output.
*
* @input:
* stroker ::
* A stroker handle.
*
* inside ::
* A Boolean. If TRUE, return the inside border, otherwise
* the outside border.
*
* destroy ::
* A Boolean. If TRUE, the source glyph object is destroyed
* on success.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* The source glyph is untouched in case of error.
*/
FT_EXPORT( FT_Error )
FT_Glyph_StrokeBorder( FT_Glyph *pglyph,
FT_Stroker stroker,
FT_Bool inside,
FT_Bool destroy );
/* */
FT_END_HEADER
#endif /* __FT_STROKE_H__ */
/* END */
-139
View File
@@ -1,139 +0,0 @@
#ifndef __FT_STROKER_H__
#define __FT_STROKER_H__
#include <ft2build.h>
#include FT_OUTLINE_H
FT_BEGIN_HEADER
/*@*************************************************************
*
* @type: FT_Stroker
*
* @description:
* opaque handler to a path stroker object
*/
typedef struct FT_StrokerRec_* FT_Stroker;
/*@*************************************************************
*
* @enum: FT_Stroker_LineJoin
*
* @description:
* these values determine how two joining lines are rendered
* in a stroker.
*
* @values:
* FT_STROKER_LINEJOIN_ROUND ::
* used to render rounded line joins. circular arcs are used
* to join two lines smoothly
*
* FT_STROKER_LINEJOIN_BEVEL ::
* used to render beveled line joins; i.e. the two joining lines
* are extended until they intersect
*
* FT_STROKER_LINEJOIN_MITER ::
* same as beveled rendering, except that an additional line
* break is added if the angle between the two joining lines
* is too closed (this is useful to avoid unpleasant spikes
* in beveled rendering).
*/
typedef enum
{
FT_STROKER_LINEJOIN_ROUND = 0,
FT_STROKER_LINEJOIN_BEVEL,
FT_STROKER_LINEJOIN_MITER
} FT_Stroker_LineJoin;
/*@*************************************************************
*
* @enum: FT_Stroker_LineCap
*
* @description:
* these values determine how the end of opened sub-paths are
* rendered in a stroke
*
* @values:
* FT_STROKER_LINECAP_BUTT ::
* the end of lines is rendered as a full stop on the last
* point itself
*
* FT_STROKER_LINECAP_ROUND ::
* the end of lines is rendered as a half-circle around the
* last point
*
* FT_STROKER_LINECAP_SQUARE ::
* the end of lines is rendered as a square around the
* last point
*/
typedef enum
{
FT_STROKER_LINECAP_BUTT = 0,
FT_STROKER_LINECAP_ROUND,
FT_STROKER_LINECAP_SQUARE
} FT_Stroker_LineCap;
/* */
FT_EXPORT( FT_Error )
FT_Stroker_New( FT_Memory memory,
FT_Stroker *astroker );
FT_EXPORT( void )
FT_Stroker_Set( FT_Stroker stroker,
FT_Fixed radius,
FT_Stroker_LineCap line_cap,
FT_Stroker_LineJoin line_join,
FT_Fixed miter_limit );
FT_EXPORT( FT_Error )
FT_Stroker_ParseOutline( FT_Stroker stroker,
FT_Outline* outline,
FT_Bool opened );
FT_EXPORT( FT_Error )
FT_Stroker_BeginSubPath( FT_Stroker stroker,
FT_Vector* to,
FT_Bool open );
FT_EXPORT( FT_Error )
FT_Stroker_EndSubPath( FT_Stroker stroker );
FT_EXPORT( FT_Error )
FT_Stroker_LineTo( FT_Stroker stroker,
FT_Vector* to );
FT_EXPORT( FT_Error )
FT_Stroker_ConicTo( FT_Stroker stroker,
FT_Vector* control,
FT_Vector* to );
FT_EXPORT( FT_Error )
FT_Stroker_CubicTo( FT_Stroker stroker,
FT_Vector* control1,
FT_Vector* control2,
FT_Vector* to );
FT_EXPORT( FT_Error )
FT_Stroker_GetCounts( FT_Stroker stroker,
FT_UInt *anum_points,
FT_UInt *anum_contours );
FT_EXPORT( void )
FT_Stroker_Export( FT_Stroker stroker,
FT_Outline* outline );
FT_EXPORT( void )
FT_Stroker_Done( FT_Stroker stroker );
FT_END_HEADER
#endif /* __FT_STROKER_H__ */
+8 -2
View File
@@ -5,7 +5,7 @@
/* FreeType synthesizing code for emboldening and slanting */
/* (specification). */
/* */
/* Copyright 2000-2001 by */
/* Copyright 2000-2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -41,6 +41,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -62,4 +68,4 @@ FT_END_HEADER
#endif /* __FTSYNTH_H__ */
/* END */
/* END */
+1 -1
View File
@@ -192,4 +192,4 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* __FT_SYSTEM_STREAM_H__ */
#endif /* __FT_SYSTEM_STREAM_H__ */
+1 -1
View File
@@ -199,4 +199,4 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* __FT_SYSTEM_MEMORY_H__ */
#endif /* __FT_SYSTEM_MEMORY_H__ */
+1 -1
View File
@@ -306,4 +306,4 @@ FT_END_HEADER
#endif /* __FTSYSTEM_H__ */
/* END */
/* END */
+8 -18
View File
@@ -4,7 +4,7 @@
/* */
/* FreeType trigonometric functions (specification). */
/* */
/* Copyright 2001 by */
/* Copyright 2001, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -21,6 +21,12 @@
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -257,22 +263,6 @@ FT_BEGIN_HEADER
FT_Vector_Length( FT_Vector* vec );
/*************************************************************************/
/* */
/* @function: */
/* FT_Vector_Normalize */
/* */
/* @description: */
/* Normalize a given vector (i.e. compute the equivalent unit */
/* vector). */
/* */
/* @inout: */
/* vec :: The address of target vector. */
/* */
FT_EXPORT( void )
FT_Vector_Normalize( FT_Vector* vec );
/*************************************************************************/
/* */
/* @function: */
@@ -322,4 +312,4 @@ FT_END_HEADER
#endif /* __FTTRIGON_H__ */
/* END */
/* END */
+1 -1
View File
@@ -555,4 +555,4 @@ FT_END_HEADER
#endif /* __FTTYPES_H__ */
/* END */
/* END */
+257 -129
View File
@@ -1,129 +1,257 @@
/***************************************************************************/
/* */
/* ftwinfnt.h */
/* */
/* FreeType API for accessing Windows fnt-specific data. */
/* */
/* Copyright 2002 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. */
/* */
/***************************************************************************/
#ifndef __FTWINFNT_H__
#define __FTWINFNT_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* winfnt_fonts */
/* */
/* <Title> */
/* Window FNT Fonts */
/* */
/* <Abstract> */
/* Windows FNT specific APIs */
/* */
/* <Description> */
/* This section contains the declaration of Windows FNT specific */
/* functions. */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* FT_WinFNT_HeaderRec_ */
/* */
/* <Description> */
/* Windows FNT Header info. */
/* */
typedef struct FT_WinFNT_HeaderRec_
{
FT_UShort version;
FT_ULong file_size;
FT_Byte copyright[60];
FT_UShort file_type;
FT_UShort nominal_point_size;
FT_UShort vertical_resolution;
FT_UShort horizontal_resolution;
FT_UShort ascent;
FT_UShort internal_leading;
FT_UShort external_leading;
FT_Byte italic;
FT_Byte underline;
FT_Byte strike_out;
FT_UShort weight;
FT_Byte charset;
FT_UShort pixel_width;
FT_UShort pixel_height;
FT_Byte pitch_and_family;
FT_UShort avg_width;
FT_UShort max_width;
FT_Byte first_char;
FT_Byte last_char;
FT_Byte default_char;
FT_Byte break_char;
FT_UShort bytes_per_row;
FT_ULong device_offset;
FT_ULong face_name_offset;
FT_ULong bits_pointer;
FT_ULong bits_offset;
FT_Byte reserved;
FT_ULong flags;
FT_UShort A_space;
FT_UShort B_space;
FT_UShort C_space;
FT_UShort color_table_offset;
FT_ULong reserved1[4];
} FT_WinFNT_HeaderRec, *FT_WinFNT_Header;
/**********************************************************************
*
* @function:
* FT_Get_WinFNT_Header
*
* @description:
* Retrieves a Windows FNT font info header.
*
* @input:
* face :: handle to input face
*
* @output:
* header :: WinFNT header.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* This function only works with Windows FNT faces, returning an erro
* otherwise.
*/
FT_EXPORT( FT_Error )
FT_Get_WinFNT_Header( FT_Face face,
FT_WinFNT_HeaderRec *header );
/* */
FT_END_HEADER
#endif /* __FTWINFNT_H__ */
/* END */
/***************************************************************************/
/* */
/* ftwinfnt.h */
/* */
/* FreeType API for accessing Windows fnt-specific data. */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __FTWINFNT_H__
#define __FTWINFNT_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* winfnt_fonts */
/* */
/* <Title> */
/* Window FNT Fonts */
/* */
/* <Abstract> */
/* Windows FNT specific APIs */
/* */
/* <Description> */
/* This section contains the declaration of Windows FNT specific */
/* functions. */
/* */
/*************************************************************************/
/*************************************************************************
*
* @enum:
* FT_WinFNT_ID_XXX
*
* @description:
* A list of valid values for the `charset' byte in
* @FT_WinFNT_HeaderRec. Exact mapping tables for the various cpXXXX
* encodings (except for cp1361) can be found at ftp://ftp.unicode.org
* in the MAPPINGS/VENDORS/MICSFT/WINDOWS subdirectory. cp1361 is
* roughly a superset of MAPPINGS/OBSOLETE/EASTASIA/KSC/JOHAB.TXT.
*
* @values:
* FT_WinFNT_ID_DEFAULT ::
* This is used for font enumeration and font creation as a
* `don't care' value. Valid font files don't contain this value.
* When querying for information about the character set of the font
* that is currently selected into a specified device context, this
* return value (of the related Windows API) simply denotes failure.
*
* FT_WinFNT_ID_SYMBOL ::
* There is no known mapping table available.
*
* FT_WinFNT_ID_MAC ::
* Mac Roman encoding.
*
* FT_WinFNT_ID_OEM ::
* From Michael Pöttgen <[email protected]>:
* The `Windows Font Mapping' article says that FT_WinFNT_ID_OEM
* is used for the charset of vector fonts, like `modern.fon',
* `roman.fon', and `script.fon' on Windows.
*
* The `CreateFont' documentation says: The FT_WinFNT_ID_OEM value
* specifies a character set that is operating-system dependent.
*
* The `IFIMETRICS' documentation from the `Windows Driver
* Development Kit' says: This font supports an OEM-specific
* character set. The OEM character set is system dependent.
*
* In general OEM, as opposed to ANSI (i.e., cp1252), denotes the
* second default codepage that most international versions of
* Windows have. It is one of the OEM codepages from
*
* http://www.microsoft.com/globaldev/reference/cphome.mspx,
*
* and is used for the `DOS boxes', to support legacy applications.
* A German Windows version for example usually uses ANSI codepage
* 1252 and OEM codepage 850.
*
* FT_WinFNT_ID_CP874 ::
* A superset of Thai TIS 620 and ISO 8859-11.
*
* FT_WinFNT_ID_CP932 ::
* A superset of Japanese Shift-JIS (with minor deviations).
*
* FT_WinFNT_ID_CP936 ::
* A superset of simplified Chinese GB 2312-1980 (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP949 ::
* A superset of Korean Hangul KS C 5601-1987 (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP950 ::
* A superset of traditional Chinese Big 5 ETen (with different
* ordering and minor deviations).
*
* FT_WinFNT_ID_CP1250 ::
* A superset of East European ISO 8859-2 (with slightly different
* ordering).
*
* FT_WinFNT_ID_CP1251 ::
* A superset of Russian ISO 8859-5 (with different ordering).
*
* FT_WinFNT_ID_CP1252 ::
* ANSI encoding. A superset of ISO 8859-1.
*
* FT_WinFNT_ID_CP1253 ::
* A superset of Greek ISO 8859-7 (with minor modifications).
*
* FT_WinFNT_ID_CP1254 ::
* A superset of Turkish ISO 8859-9.
*
* FT_WinFNT_ID_CP1255 ::
* A superset of Hebrew ISO 8859-8 (with some modifications).
*
* FT_WinFNT_ID_CP1256 ::
* A superset of Arabic ISO 8859-6 (with different ordering).
*
* FT_WinFNT_ID_CP1257 ::
* A superset of Baltic ISO 8859-13 (with some deviations).
*
* FT_WinFNT_ID_CP1258 ::
* For Vietnamese. This encoding doesn't cover all necessary
* characters.
*
* FT_WinFNT_ID_CP1361 ::
* Korean (Johab).
*/
#define FT_WinFNT_ID_CP1252 0
#define FT_WinFNT_ID_DEFAULT 1
#define FT_WinFNT_ID_SYMBOL 2
#define FT_WinFNT_ID_MAC 77
#define FT_WinFNT_ID_CP932 128
#define FT_WinFNT_ID_CP949 129
#define FT_WinFNT_ID_CP1361 130
#define FT_WinFNT_ID_CP936 134
#define FT_WinFNT_ID_CP950 136
#define FT_WinFNT_ID_CP1253 161
#define FT_WinFNT_ID_CP1254 162
#define FT_WinFNT_ID_CP1258 163
#define FT_WinFNT_ID_CP1255 177
#define FT_WinFNT_ID_CP1256 178
#define FT_WinFNT_ID_CP1257 186
#define FT_WinFNT_ID_CP1251 204
#define FT_WinFNT_ID_CP874 222
#define FT_WinFNT_ID_CP1250 238
#define FT_WinFNT_ID_OEM 255
/*************************************************************************/
/* */
/* <Struct> */
/* FT_WinFNT_HeaderRec */
/* */
/* <Description> */
/* Windows FNT Header info. */
/* */
typedef struct FT_WinFNT_HeaderRec_
{
FT_UShort version;
FT_ULong file_size;
FT_Byte copyright[60];
FT_UShort file_type;
FT_UShort nominal_point_size;
FT_UShort vertical_resolution;
FT_UShort horizontal_resolution;
FT_UShort ascent;
FT_UShort internal_leading;
FT_UShort external_leading;
FT_Byte italic;
FT_Byte underline;
FT_Byte strike_out;
FT_UShort weight;
FT_Byte charset;
FT_UShort pixel_width;
FT_UShort pixel_height;
FT_Byte pitch_and_family;
FT_UShort avg_width;
FT_UShort max_width;
FT_Byte first_char;
FT_Byte last_char;
FT_Byte default_char;
FT_Byte break_char;
FT_UShort bytes_per_row;
FT_ULong device_offset;
FT_ULong face_name_offset;
FT_ULong bits_pointer;
FT_ULong bits_offset;
FT_Byte reserved;
FT_ULong flags;
FT_UShort A_space;
FT_UShort B_space;
FT_UShort C_space;
FT_UShort color_table_offset;
FT_ULong reserved1[4];
} FT_WinFNT_HeaderRec, *FT_WinFNT_Header;
/**********************************************************************
*
* @function:
* FT_Get_WinFNT_Header
*
* @description:
* Retrieve a Windows FNT font info header.
*
* @input:
* face :: A handle to the input face.
*
* @output:
* aheader :: The WinFNT header.
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* This function only works with Windows FNT faces, returning an error
* otherwise.
*/
FT_EXPORT( FT_Error )
FT_Get_WinFNT_Header( FT_Face face,
FT_WinFNT_HeaderRec *aheader );
/* */
FT_END_HEADER
#endif /* __FTWINFNT_H__ */
/* END */
+10 -3
View File
@@ -4,7 +4,7 @@
/* */
/* Support functions for X11. */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -22,6 +22,13 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/* this comment is intentionally disabled for now, to prevent this */
@@ -43,11 +50,11 @@ FT_BEGIN_HEADER
/* <Return> */
/* Font format string. NULL in case of error. */
/* */
FT_EXPORT_DEF( const char* )
FT_EXPORT( const char* )
FT_Get_X11_Font_Format( FT_Face face );
/* */
FT_END_HEADER
#endif /* __FTXF86_H__ */
#endif /* __FTXF86_H__ */
@@ -202,4 +202,4 @@ FT_END_HEADER
#endif /* __AUTOHINT_H__ */
/* END */
/* END */
@@ -1,58 +0,0 @@
/* bdftypes.h
FreeType font driver for bdf fonts
Copyright (C) 2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef __BDFTYPES_H__
#define __BDFTYPES_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_BDF_H
FT_BEGIN_HEADER
typedef struct BDF_Public_FaceRec_
{
FT_FaceRec root;
char* charset_encoding;
char* charset_registry;
} BDF_Public_FaceRec, *BDF_Public_Face;
typedef FT_Error (*BDF_GetPropertyFunc)( FT_Face face,
const char* prop_name,
BDF_PropertyRec *aproperty );
FT_END_HEADER
#endif /* __BDFTYPES_H__ */
/* END */
@@ -1,114 +0,0 @@
/***************************************************************************/
/* */
/* fnttypes.h */
/* */
/* Basic Windows FNT/FON type definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2001, 2002 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. */
/* */
/***************************************************************************/
#ifndef __FNTTYPES_H__
#define __FNTTYPES_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_WINFONTS_H
FT_BEGIN_HEADER
typedef struct WinMZ_HeaderRec_
{
FT_UShort magic;
/* skipped content */
FT_UShort lfanew;
} WinMZ_HeaderRec;
typedef struct WinNE_HeaderRec_
{
FT_UShort magic;
/* skipped content */
FT_UShort resource_tab_offset;
FT_UShort rname_tab_offset;
} WinNE_HeaderRec;
typedef struct WinNameInfoRec_
{
FT_UShort offset;
FT_UShort length;
FT_UShort flags;
FT_UShort id;
FT_UShort handle;
FT_UShort usage;
} WinNameInfoRec;
typedef struct WinResourceInfoRec_
{
FT_UShort type_id;
FT_UShort count;
} WinResourceInfoRec;
#define WINFNT_MZ_MAGIC 0x5A4D
#define WINFNT_NE_MAGIC 0x454E
typedef struct FNT_FontRec_
{
FT_ULong offset;
FT_Int size_shift;
FT_WinFNT_HeaderRec header;
FT_Byte* fnt_frame;
FT_ULong fnt_size;
} FNT_FontRec, *FNT_Font;
typedef struct FNT_SizeRec_
{
FT_SizeRec root;
FNT_Font font;
} FNT_SizeRec, *FNT_Size;
typedef struct FNT_FaceRec_
{
FT_FaceRec root;
FT_UInt num_fonts;
FNT_Font fonts;
FT_CharMap charmap_handle;
FT_CharMapRec charmap; /* a single charmap per face */
} FNT_FaceRec, *FNT_Face;
FT_END_HEADER
#endif /* __FNTTYPES_H__ */
/* END */
@@ -4,7 +4,7 @@
/* */
/* Arithmetic computations (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -27,7 +27,8 @@
FT_BEGIN_HEADER
FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x );
FT_EXPORT( FT_Int32 )
FT_SqrtFixed( FT_Int32 x );
#define SQRT_32( x ) FT_Sqrt32( x )
@@ -59,6 +60,39 @@ FT_BEGIN_HEADER
/*************************************************************************/
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
/*************************************************************************/
/* */
/* <Function> */
/* FT_MulDiv_No_Round */
/* */
/* <Description> */
/* A very simple function used to perform the computation `(a*b)/c' */
/* (without rounding) with maximal accuracy (it uses a 64-bit */
/* intermediate integer whenever necessary). */
/* */
/* This function isn't necessarily as fast as some processor specific */
/* operations, but is at least completely portable. */
/* */
/* <Input> */
/* a :: The first multiplier. */
/* b :: The second multiplier. */
/* c :: The divisor. */
/* */
/* <Return> */
/* The result of `(a*b)/c'. This function never traps when trying to */
/* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
/* on the signs of `a' and `b'. */
/* */
FT_BASE( FT_Long )
FT_MulDiv_No_Round( FT_Long a,
FT_Long b,
FT_Long c );
#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )
@@ -74,4 +108,4 @@ FT_END_HEADER
#endif /* __FTCALC_H__ */
/* END */
/* END */
@@ -1,185 +0,0 @@
#ifndef __FT_CORE_H__
#define __FT_CORE_H__
#include <ft2build.h>
#include FT_TYPES_H
#include FT_SYSTEM_MEMORY_H
FT_BEGIN_HEADER
/**************************************************************************/
/**************************************************************************/
/***** *****/
/***** C L E A N U P S T A C K *****/
/***** *****/
/**************************************************************************/
/**************************************************************************/
/************************************************************************
*
* @functype: FT_CleanupFunc
*
* @description:
* a function used to cleanup a given item on the cleanup stack
*
* @input:
* item :: target item pointer
* item_data :: optional argument to cleanup routine
*/
typedef void (*FT_CleanupFunc)( FT_Pointer item,
FT_Pointer item_data );
/************************************************************************
*
* @type: FT_XHandler
*
* @description:
* handle to an exception-handler structure for the FreeType
* exception sub-system
*
* @note:
* exception handlers are allocated on the stack within a
* @FT_XTRY macro. Do not try to access them directly.
*/
typedef struct FT_XHandlerRec_* FT_XHandler;
/* the size of a cleanup chunk in bytes is FT_CLEANUP_CHUNK_SIZE*12 + 4 */
/* this must be a small power of 2 whenever possible.. */
/* */
/* with a value of 5, we have a byte size of 64 bytes per chunk.. */
/* */
#define FT_CLEANUP_CHUNK_SIZE 5
typedef struct FT_CleanupItemRec_
{
FT_Pointer item;
FT_CleanupFunc item_func;
FT_Pointer item_data;
} FT_CleanupItemRec;
typedef struct FT_CleanupChunkRec_* FT_CleanupChunk;
typedef struct FT_CleanupChunkRec_
{
FT_CleanupChunk link;
FT_CleanupItemRec items[ FT_CLEANUP_CHUNK_SIZE ];
} FT_CleanupChunkRec;
typedef struct FT_CleanupStackRec_
{
FT_CleanupItem top;
FT_CleanupItem limit;
FT_CleanupChunk chunk;
FT_CleanupChunkRec chunk_0; /* avoids stupid dynamic allocation */
FT_Memory memory;
} FT_CleanupStackRec, *FT_CleanupStack;
FT_BASE( void )
ft_cleanup_stack_push( FT_CleanupStack stack,
FT_Pointer item,
FT_CleanupFunc item_func,
FT_Pointer item_data );
FT_BASE( void )
ft_cleanup_stack_pop( FT_CleanupStack stack,
FT_Int destroy );
FT_BASE( FT_CleanupItem )
ft_cleanup_stack_peek( FT_CleanupStack stack );
FT_BASE( void )
ft_cleanup_throw( FT_CleanupStack stack,
FT_Error error );
/**************************************************************************/
/**************************************************************************/
/***** *****/
/***** M E M O R Y M A N A G E R *****/
/***** *****/
/**************************************************************************/
/**************************************************************************/
typedef struct FT_MemoryRec_
{
FT_Memory_AllocFunc mem_alloc; /* shortcut to funcs->mem_alloc */
FT_Memory_FreeFunc mem_free; /* shortcut to funcs->mem_free */
FT_Pointer mem_data;
const FT_Memory_Funcs mem_funcs;
FT_CleanupStackRec cleanup_stack;
FT_Pointer meta_class;
} FT_MemoryRec;
#define FT_MEMORY(x) ((FT_Memory)(x))
#define FT_MEMORY__ALLOC(x) FT_MEMORY(x)->mem_alloc
#define FT_MEMORY__FREE(x) FT_MEMORY(x)->mem_free
#define FT_MEMORY__REALLOC(x) FT_MEMORY(x)->mem_funcs->mem_realloc
#define FT_MEMORY__CLEANUP(x) (&FT_MEMORY(x)->cleanup_stack)
#define FT_MEMORY__META_CLASS(x) ((FT_MetaClass)(FT_MEMORY(x)->meta_class))
/**************************************************************************/
/**************************************************************************/
/***** *****/
/***** E X C E P T I O N H A N D L I N G *****/
/***** *****/
/**************************************************************************/
/**************************************************************************/
/************************************************************************
*
* @struct: FT_XHandlerRec
*
* @description:
* exception handler structure
*
* @fields:
* previous :: previous handler in chain.
* jum_buffer :: processor state used by setjmp/longjmp to implement
* exception control transfer
* error :: exception error code
* mark :: top of cleanup stack when @FT_XTRY is used
*/
typedef struct FT_XHandlerRec_
{
FT_XHandler previous;
ft_jmp_buf jump_buffer;
volatile FT_Error error;
FT_Pointer mark;
} FT_XHandlerRec;
FT_BASE( void )
ft_xhandler_enter( FT_XHandler xhandler,
FT_Memory memory );
FT_BASE( void )
ft_xhandler_exit( FT_XHandler xhandler );
FT_END_HEADER
#endif /* __FT_CORE_H__ */
@@ -4,7 +4,7 @@
/* */
/* Debugging and logging component (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -27,6 +27,7 @@
#include <ft2build.h>
#include FT_CONFIG_CONFIG_H
#include FT_FREETYPE_H
FT_BEGIN_HEADER
@@ -96,6 +97,53 @@ FT_BEGIN_HEADER
#endif /* !FT_DEBUG_LEVEL_TRACE */
/*************************************************************************/
/* */
/* <Function> */
/* FT_Trace_Get_Count */
/* */
/* <Description> */
/* Return the number of available trace components. */
/* */
/* <Return> */
/* The number of trace components. 0 if FreeType 2 is not built with */
/* FT_DEBUG_LEVEL_TRACE definition. */
/* */
/* <Note> */
/* This function may be useful if you want to access elements of */
/* the internal `ft_trace_levels' array by an index. */
/* */
FT_EXPORT( FT_Int )
FT_Trace_Get_Count( void );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Trace_Get_Name */
/* */
/* <Description> */
/* Return the name of a trace component. */
/* */
/* <Input> */
/* The index of the trace component. */
/* */
/* <Return> */
/* The name of the trace component. This is a statically allocated */
/* C string, so do not free it after use. NULL if FreeType 2 is not */
/* built with FT_DEBUG_LEVEL_TRACE definition. */
/* */
/* <Note> */
/* Use @FT_Trace_Get_Count to get the number of available trace */
/* components. */
/* */
/* This function may be useful if you want to control FreeType 2's */
/* debug level in your appliaciton. */
/* */
FT_EXPORT( const char * )
FT_Trace_Get_Name( FT_Int idx );
/*************************************************************************/
/* */
/* You need two opening resp. closing parentheses! */
@@ -193,4 +241,4 @@ FT_END_HEADER
#endif /* __FTDEBUG_H__ */
/* END */
/* END */
@@ -4,7 +4,7 @@
/* */
/* FreeType font driver interface (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -155,11 +155,15 @@ FT_BEGIN_HEADER
/* add data from AFM or PFM files on a Type 1 */
/* face, or a CIDMap on a CID-keyed face. */
/* */
/* get_advances :: A function handle used to return the advances */
/* of 'count' glyphs, starting at `index'. the */
/* `vertical' flags must be set when vertical */
/* advances are queried. The advances buffer is */
/* caller-allocated. */
/* get_advances :: A function handle used to return advance */
/* widths of 'count' glyphs (in font units), */
/* starting at `first'. The `vertical' flag must */
/* be set to get vertical advance heights. The */
/* `advances' buffer is caller-allocated. */
/* Currently not implemented. The idea of this */
/* function is to be able to perform */
/* device-independent text layout without loading */
/* a single glyph image. */
/* */
/* <Note> */
/* Most function pointers, with the exception of `load_glyph' and */
@@ -169,9 +173,9 @@ FT_BEGIN_HEADER
{
FT_Module_Class root;
FT_Int face_object_size;
FT_Int size_object_size;
FT_Int slot_object_size;
FT_Long face_object_size;
FT_Long size_object_size;
FT_Long slot_object_size;
FT_Face_InitFunc init_face;
FT_Face_DoneFunc done_face;
@@ -199,4 +203,4 @@ FT_END_HEADER
#endif /* __FTDRIVER_H__ */
/* END */
/* END */
@@ -1,82 +0,0 @@
#ifndef __FT_EXCEPT_H__
#define __FT_EXCEPT_H__
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
FT_BEGIN_HEADER
/* I can't find a better place for this for now */
<<<<<<< ftexcept.h
=======
/* the size of a cleanup chunk in bytes is FT_CLEANUP_CHUNK_SIZE*12 + 4 */
/* this must be a small power of 2 whenever possible.. */
/* */
/* with a value of 5, we have a byte size of 64 bytes per chunk.. */
/* */
#define FT_CLEANUP_CHUNK_SIZE 5
typedef struct FT_CleanupItemRec_
{
FT_Pointer item;
FT_CleanupFunc item_func;
FT_Pointer item_data;
} FT_CleanupItemRec;
typedef struct FT_CleanupChunkRec_* FT_CleanupChunk;
typedef struct FT_CleanupChunkRec_
{
FT_CleanupChunk link;
FT_CleanupItemRec items[ FT_CLEANUP_CHUNK_SIZE ];
} FT_CleanupChunkRec;
typedef struct FT_CleanupStackRec_
{
FT_CleanupItem top;
FT_CleanupItem limit;
FT_CleanupChunk chunk;
FT_CleanupChunkRec chunk_0; /* avoids stupid dynamic allocation */
FT_Memory memory;
} FT_CleanupStackRec, *FT_CleanupStack;
FT_BASE( void )
ft_cleanup_stack_push( FT_CleanupStack stack,
FT_Pointer item,
FT_CleanupFunc item_func,
FT_Pointer item_data );
FT_BASE( void )
ft_cleanup_stack_pop( FT_CleanupStack stack,
FT_Int destroy );
FT_BASE( FT_CleanupItem )
ft_cleanup_stack_peek( FT_CleanupStack stack );
FT_BASE( void )
ft_xhandler_enter( FT_XHandler xhandler,
FT_Memory memory );
FT_BASE( void )
ft_xhandler_exit( FT_XHandler xhandler );
FT_BASE( void )
ft_cleanup_throw( FT_CleanupStack stack,
FT_Error error );
>>>>>>> 1.2
FT_END_HEADER
#endif /* __FT_EXCEPT_H__ */
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph loader (specification). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -52,12 +52,6 @@ FT_BEGIN_HEADER
#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
enum
{
FT_GLYPH_OWN_BITMAP = 1
};
typedef struct FT_SubGlyphRec_
{
FT_Int index;
@@ -116,15 +110,15 @@ FT_BEGIN_HEADER
FT_BASE( void )
FT_GlyphLoader_Rewind( FT_GlyphLoader loader );
/* check that there is enough room to add 'n_points' and 'n_contours' */
/* to the glyph loader */
/* check that there is enough space to add `n_points' and `n_contours' */
/* to the glyph loader */
FT_BASE( FT_Error )
FT_GlyphLoader_CheckPoints( FT_GlyphLoader loader,
FT_UInt n_points,
FT_UInt n_contours );
/* check that there is enough room to add 'n_subs' sub-glyphs to */
/* a glyph loader */
/* check that there is enough space to add `n_subs' sub-glyphs to */
/* a glyph loader */
FT_BASE( FT_Error )
FT_GlyphLoader_CheckSubGlyphs( FT_GlyphLoader loader,
FT_UInt n_subs );
@@ -150,4 +144,4 @@ FT_END_HEADER
#endif /* __FTGLOADR_H__ */
/* END */
/* END */
@@ -1,502 +0,0 @@
/******************************************************************
*
* fthash.h - fast dynamic hash tables
*
* Copyright 2002 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.
*
*
* This header is used to define dynamic hash tables as described
* by the article "Main-Memory Linear Hashing - Some Enhancements
* of Larson's Algorithm" by Mikael Petterson.
*
* Basically, linear hashing prevents big "stalls" during
* resizes of the buckets array by only splitting one bucket
* at a time. This ensures excellent response time even when
* the table is frequently resized..
*
*
* Note that the use of the FT_Hash type is rather unusual in order
* to be as generic and efficient as possible. See the comments in the
* following definitions for more details.
*/
#ifndef __FT_HASH_H__
#define __FT_HASH_H__
#include <ft2build.h>
#include FT_TYPES_H
FT_BEGIN_HEADER
/***********************************************************
*
* @type: FT_Hash
*
* @description:
* handle to a @FT_HashRec structure used to model a
* dynamic hash table
*/
typedef struct FT_HashRec_* FT_Hash;
/***********************************************************
*
* @type: FT_HashNode
*
* @description:
* handle to a @FT_HashNodeRec structure used to model a
* single node of a hash table
*/
typedef struct FT_HashNodeRec_* FT_HashNode;
/***********************************************************
*
* @type: FT_HashLookup
*
* @description:
* handle to a @FT_HashNode pointer. This is returned by
* the @ft_hash_lookup function and can later be used by
* @ft_hash_add or @ft_hash_remove
*/
typedef FT_HashNode* FT_HashLookup;
/***********************************************************
*
* @type: FT_Hash_EqualFunc
*
* @description:
* a function used to compare two nodes of the hash table
*
* @input:
* node1 :: handle to first node
* node2 :: handle to second node
*
* @return:
* 1 iff the 'keys' in 'node1' and 'node2' are identical.
* 0 otherwise.
*/
typedef FT_Int (*FT_Hash_EqualFunc)( FT_HashNode node1,
FT_HashNode node2 );
/***********************************************************
*
* @struct: FT_HashRec
*
* @description:
* a structure used to model a dynamic hash table.
*
* @fields:
* memory :: memory manager used to allocate
* the buckets array and the hash nodes
*
* buckets :: array of hash buckets
*
* node_size :: size of node in bytes
* node_compare :: a function used to compare two nodes
* node_hash :: a function used to compute the hash
* value of a given node
* p ::
* mask ::
* slack ::
*
* @note:
* 'p', 'mask' and 'slack' are control values managed by
* the hash table. Do not try to interpret them directly.
*
* You can grab the hash table size by calling
* '@ft_hash_get_size'.
*/
typedef struct FT_HashRec_
{
FT_HashNode* buckets;
FT_UInt p;
FT_UInt mask; /* really maxp-1 */
FT_Long slack;
FT_Hash_EqualFunc node_equal;
FT_Memory memory;
} FT_HashRec;
/***********************************************************
*
* @struct: FT_HashNodeRec
*
* @description:
* a structure used to model the root fields of a dynamic
* hash table node.
*
* it's up to client applications to "sub-class" this
* structure to add relevant (key,value) definitions
*
* @fields:
* link :: pointer to next node in bucket's collision list
* hash :: 32-bit hash value for this node
*
* @note:
* it's up to client applications to "sub-class" this structure
* to add relevant (key,value) type definitions. For example,
* if we want to build a "string -> int" mapping, we could use
* something like:
*
* {
* typedef struct MyNodeRec_
* {
* FT_HashNodeRec hnode;
* const char* key;
* int value;
*
* } MyNodeRec, *MyNode;
* }
*
*/
typedef struct FT_HashNodeRec_
{
FT_HashNode link;
FT_UInt32 hash;
} FT_HashNodeRec;
/****************************************************************
*
* @function: ft_hash_init
*
* @description:
* initialize a dynamic hash table
*
* @input:
* table :: handle to target hash table structure
* node_equal :: node comparison function
* memory :: memory manager handle used to allocate the
* buckets array within the hash table
*
* @return:
* error code. 0 means success
*
* @note:
* the node comparison function should only compare node _keys_
* and ignore values !! with good hashing computation (which the
* user must perform itself), the comparison function should be
* pretty seldom called.
*
* here is a simple example:
*
* {
* static int my_equal( MyNode node1,
* MyNode node2 )
* {
* // compare keys of 'node1' and 'node2'
* return (strcmp( node1->key, node2->key ) == 0);
* }
*
* ....
*
* ft_hash_init( &hash, (FT_Hash_EqualFunc) my_compare, memory );
* ....
* }
*/
FT_BASE( FT_Error )
ft_hash_init( FT_Hash table,
FT_Hash_EqualFunc compare,
FT_Memory memory );
/****************************************************************
*
* @function: ft_hash_lookup
*
* @description:
* search a hash table to find a node corresponding to a given
* key.
*
* @input:
* table :: handle to target hash table structure
* keynode :: handle to a reference hash node that will be
* only used for key comparisons with the table's
* elements
*
* @return:
* a pointer-to-hash-node value, which must be used as followed:
*
* - if '*result' is NULL, the key wasn't found in the hash
* table. The value of 'result' can be used to add new elements
* through @ft_hash_add however..
*
* - if '*result' is not NULL, it's a handle to the first table
* node that corresponds to the search key. The value of 'result'
* can be used to remove this element through @ft_hash_remove
*
* @note:
* here is an example:
*
* {
* // maps a string to an integer with a hash table
* // returns -1 in case of failure
* //
* int my_lookup( FT_Hash table,
* const char* key )
* {
* MyNode* pnode;
* MyNodeRec noderec;
*
* // set-up key node. It's 'hash' and 'key' fields must
* // be set correctly.. we ignore 'link' and 'value'
* //
* noderec.hnode.hash = strhash( key );
* noderec.key = key;
*
* // perform search - return value
* //
* pnode = (MyNode) ft_hash_lookup( table, &noderec );
* if ( *pnode )
* {
* // we found it
* return (*pnode)->value;
* }
* return -1;
* }
* }
*/
FT_BASE_DEF( FT_HashLookup )
ft_hash_lookup( FT_Hash table,
FT_HashNode keynode );
/****************************************************************
*
* @function: ft_hash_add
*
* @description:
* add a new node to a dynamic hash table. the user must
* call @ft_hash_lookup and allocate a new node before calling
* this function.
*
* @input:
* table :: hash table handle
* lookup :: pointer-to-hash-node value returned by @ft_hash_lookup
* new_node :: handle to new hash node. All its fields must be correctly
* set, including 'hash'.
*
* @return:
* error code. 0 means success
*
* @note:
* this function should always be used _after_ a call to @ft_hash_lookup
* that returns a pointer to a NULL handle. Here's an example:
*
* {
* // sets the value corresponding to a given string key
* //
* void my_set( FT_Hash table,
* const char* key,
* int value )
* {
* MyNode* pnode;
* MyNodeRec noderec;
* MyNode node;
*
* // set-up key node. It's 'hash' and 'key' fields must
* // be set correctly..
* noderec.hnode.hash = strhash( key );
* noderec.key = key;
*
* // perform search - return value
* pnode = (MyNode) ft_hash_lookup( table, &noderec );
* if ( *pnode )
* {
* // we found it, simply replace the value in the node
* (*pnode)->value = value;
* return;
* }
*
* // allocate a new node - and set it up
* node = (MyNode) malloc( sizeof(*node) );
* if ( node == NULL ) .....
*
* node->hnode.hash = noderec.hnode.hash;
* node->key = key;
* node->value = value;
*
* // add it to the hash table
* error = ft_hash_add( table, pnode, node );
* if (error) ....
* }
*/
FT_BASE( FT_Error )
ft_hash_add( FT_Hash table,
FT_HashLookup lookup,
FT_HashNode new_node );
/****************************************************************
*
* @function: ft_hash_remove
*
* @description:
* try to remove the node corresponding to a given key from
* a hash table. This must be called after @ft_hash_lookup
*
* @input:
* table :: hash table handle
* lookup :: pointer-to-hash-node value returned by @ft_hash_lookup
*
* @note:
* this function doesn't free the node itself !! Here's an example:
*
* {
* // sets the value corresponding to a given string key
* //
* void my_remove( FT_Hash table,
* const char* key )
* {
* MyNodeRec noderec;
* MyNode node;
*
* noderec.hnode.hash = strhash(key);
* noderec.key = key;
* node = &noderec;
*
* pnode = ft_hash_lookup( table, &noderec );
* node = *pnode;
* if ( node != NULL )
* {
* error = ft_hash_remove( table, pnode );
* if ( !error )
* free( node );
* }
* }
* }
*/
FT_BASE( FT_Error )
ft_hash_remove( FT_Hash table,
FT_HashLookup lookup );
/****************************************************************
*
* @function: ft_hash_get_size
*
* @description:
* return the number of elements in a given hash table
*
* @input:
* table :: handle to target hash table structure
*
* @return:
* number of elements. 0 if empty
*/
FT_BASE( FT_UInt )
ft_hash_get_size( FT_Hash table );
/****************************************************************
*
* @functype: FT_Hash_ForeachFunc
*
* @description:
* a function used to iterate over all elements of a given
* hash table
*
* @input:
* node :: handle to target @FT_HashNodeRec node structure
* data :: optional argument to iteration routine
*
* @also: @ft_hash_foreach
*/
typedef void (*FT_Hash_ForeachFunc)( const FT_HashNode node,
const FT_Pointer data );
/****************************************************************
*
* @function: ft_hash_foreach
*
* @description:
* parse over all elements in a hash table
*
* @input:
* table :: handle to target hash table structure
* foreach_func :: iteration routine called for each element
* foreach_data :: optional argument to the iteration routine
*
* @note:
* this function is often used to release all elements from a
* hash table. See the example given for @ft_hash_done
*/
FT_BASE( void )
ft_hash_foreach( FT_Hash table,
FT_Hash_ForeachFunc foreach_func,
const FT_Pointer foreach_data );
/****************************************************************
*
* @function: ft_hash_done
*
* @description:
* finalize a given hash table
*
* @input:
* table :: handle to target hash table structure
* node_func :: optional iteration function pointer. this
* can be used to destroy all nodes explicitely
* node_data :: optional argument to the node iterator
*
* @note:
* this function simply frees the hash table's buckets.
* you probably will need to call @ft_hash_foreach to
* destroy all its elements before @ft_hash_done, as in
* the following example:
*
* {
* static void my_node_clear( const MyNode node )
* {
* free( node );
* }
*
* static void my_done( FT_Hash table )
* {
* ft_hash_done( table, (FT_Hash_ForeachFunc) my_node_clear, NULL );
* }
* }
*/
FT_BASE( void )
ft_hash_done( FT_Hash table,
FT_Hash_ForeachFunc item_func,
const FT_Pointer item_data );
/* */
/* compute bucket index from hash value in a dynamic hash table */
/* this is only used to break encapsulation to speed lookups in */
/* the FreeType cache manager !! */
/* */
#define FT_HASH_COMPUTE_INDEX(_table,_hash,_index) \
{ \
FT_UInt _mask = (_table)->mask; \
FT_UInt _hash0 = (_hash); \
\
(_index) = (FT_UInt)( (_hash0) & _mask ) ); \
if ( (_index) < (_table)->p ) \
(_index) = (FT_uInt)( (_hash0) & ( 2*_mask+1 ) ); \
}
FT_END_HEADER
#endif /* __FT_HASH_H__ */
@@ -4,7 +4,7 @@
/* */
/* The FreeType memory management macros (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -141,7 +141,7 @@ FT_BEGIN_HEADER
FT_Realloc( FT_Memory memory,
FT_Long current,
FT_Long size,
void** P );
void* *P );
/*************************************************************************/
@@ -159,17 +159,14 @@ FT_BEGIN_HEADER
/* P :: This is the _address_ of a _pointer_ which points to the */
/* allocated block. It is always set to NULL on exit. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* If P or *P are NULL, this function should return successfully. */
/* If P or *P is NULL, this function should return successfully. */
/* This is a strong convention within all of FreeType and its */
/* drivers. */
/* */
FT_BASE( void )
FT_Free( FT_Memory memory,
void** P );
void* *P );
#define FT_MEM_SET( dest, byte, count ) ft_memset( dest, byte, count )
@@ -183,6 +180,12 @@ FT_BEGIN_HEADER
#define FT_ZERO( p ) FT_MEM_ZERO( p, sizeof ( *(p) ) )
#define FT_ARRAY_COPY( dest, source, count ) \
FT_MEM_COPY( dest, source, (count) * sizeof( *(dest) ) )
#define FT_ARRAY_MOVE( dest, source, count ) \
FT_MEM_MOVE( dest, source, (count) * sizeof( *(dest) ) )
/*************************************************************************/
/* */
@@ -293,4 +296,4 @@ FT_END_HEADER
#endif /* __FTMEMORY_H__ */
/* END */
/* END */
@@ -1,533 +0,0 @@
#ifndef __FT_OBJECT_H__
#define __FT_OBJECT_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/**************************************************************
*
* @type: FT_Object
*
* @description:
* handle to a FreeType Object. See @FT_ObjectRec
*/
typedef struct FT_ObjectRec_* FT_Object;
/**************************************************************
*
* @type: FT_Class
*
* @description:
* handle to a constant class handle to a FreeType Object.
*
* Note that a class is itself a @FT_Object and are dynamically
* allocated on the heap.
*
* @also:
* @FT_ClassRec, @FT_Object, @FT_ObjectRec, @FT_Type, @FT_TypeRec
*/
typedef const struct FT_ClassRec_* FT_Class;
/**************************************************************
*
* @type: FT_Type
*
* @description:
* handle to a constant structure (of type @FT_TypeRec) used
* to describe a given @FT_Class type to the FreeType object
* sub-system.
*/
typedef const struct FT_TypeRec_* FT_Type;
/**************************************************************
*
* @struct: FT_ObjectRec
*
* @description:
* a structure describing the root fields of all @FT_Object
* class instances in FreeType
*
* @fields:
* clazz :: handle to the object's class
* ref_count :: object's reference count. Starts at 1
*/
typedef struct FT_ObjectRec_
{
FT_Class clazz;
FT_Int ref_count;
} FT_ObjectRec;
/**************************************************************
*
* @macro: FT_OBJECT (x)
*
* @description:
* a useful macro to type-cast anything to a @FT_Object
* handle. No check performed..
*/
#define FT_OBJECT(x) ((FT_Object)(x))
/**************************************************************
*
* @macro: FT_OBJECT_P (x)
*
* @description:
* a useful macro to type-cast anything to a pointer to
* @FT_Object handle.
*/
#define FT_OBJECT_P(x) ((FT_Object*)(x))
/**************************************************************
*
* @macro: FT_OBJECT__CLASS (obj)
*
* @description:
* a useful macro to return the class of any object
*/
#define FT_OBJECT__CLASS(x) FT_OBJECT(x)->clazz
/**************************************************************
*
* @macro: FT_OBJECT__REF_COUNT (obj)
*
* @description:
* a useful macro to return the reference count of any object
*/
#define FT_OBJECT__REF_COUNT(x) FT_OBJECT(x)->ref_count
/**************************************************************
*
* @macro: FT_OBJECT__MEMORY (obj)
*
* @description:
* a useful macro to return a handle to the memory manager
* used to allocate a given object
*/
#define FT_OBJECT__MEMORY(x) FT_CLASS__MEMORY(FT_OBJECT(x)->clazz)
/**************************************************************
*
* @macro: FT_OBJECT__LIBRARY (obj)
*
* @description:
* a useful macro to return a handle to the library handle
* that owns the object
*/
#define FT_OBJECT__LIBRARY(x) FT_CLASS__LIBRARY(FT_OBJECT(x)->clazz)
/**************************************************************
*
* @functype: FT_Object_InitFunc
*
* @description:
* a function used to initialize a new object
*
* @input:
* object :: target object handle
* init_data :: optional pointer to initialization data
*
* @return:
* error code. 0 means success
*/
typedef FT_Error (*FT_Object_InitFunc)( FT_Object object,
FT_Pointer init_data );
/**************************************************************
*
* @functype: FT_Object_DoneFunc
*
* @description:
* a function used to finalize a given object
*
* @input:
* object :: handle to target object
*/
typedef void (*FT_Object_DoneFunc)( FT_Object object );
/**************************************************************
*
* @struct: FT_ClassRec
*
* @description:
* a structure used to describe a given object class within
* FreeType
*
* @fields:
* object :: root @FT_ObjectRec fields, since each class is
* itself an object. (it's an instance of the
* "metaclass", a special object of the FreeType
* object sub-system.)
*
* magic :: a 32-bit magic number used for decoding
* super :: pointer to super class
* type :: the @FT_Type descriptor of this class
* memory :: the current memory manager handle
* library :: the current library handle
* info :: an opaque pointer to class-specific information
* managed by the FreeType object sub-system
*
* class_done :: the class destructor function
*
* obj_size :: size of class instances in bytes
* obj_init :: class instance constructor
* obj_done :: class instance destructor
*/
typedef struct FT_ClassRec_
{
FT_ObjectRec object;
FT_UInt32 magic;
FT_Class super;
FT_Type type;
FT_Memory memory;
FT_Library library;
FT_Pointer info;
FT_Object_DoneFunc class_done;
FT_UInt obj_size;
FT_Object_InitFunc obj_init;
FT_Object_DoneFunc obj_done;
} FT_ClassRec;
/**************************************************************
*
* @macro: FT_CLASS (x)
*
* @description:
* a useful macro to convert anything to a class handle
* without checks
*/
#define FT_CLASS(x) ((FT_Class)(x))
/**************************************************************
*
* @macro: FT_CLASS_P (x)
*
* @description:
* a useful macro to convert anything to a pointer to a class
* handle without checks
*/
#define FT_CLASS_P(x) ((FT_Class*)(x))
/**************************************************************
*
* @macro: FT_CLASS__MEMORY (clazz)
*
* @description:
* a useful macro to return the memory manager handle of a
* given class
*/
#define FT_CLASS__MEMORY(x) FT_CLASS(x)->memory
/**************************************************************
*
* @macro: FT_CLASS__LIBRARY (clazz)
*
* @description:
* a useful macro to return the library handle of a
* given class
*/
#define FT_CLASS__LIBRARY(x) FT_CLASS(x)->library
/**************************************************************
*
* @macro: FT_CLASS__TYPE (clazz)
*
* @description:
* a useful macro to return the type of a given class
* given class
*/
#define FT_CLASS__TYPE(x) FT_CLASS(x)->type
/* */
#define FT_CLASS__INFO(x) FT_CLASS(x)->info
#define FT_CLASS__MAGIC(x) FT_CLASS(x)->magic
/**************************************************************
*
* @struct: FT_TypeRec
*
* @description:
* a structure used to describe a given class to the FreeType
* object sub-system.
*
* @fields:
* name :: class name. only used for debugging
* super :: type of super-class. NULL if none
*
* class_size :: size of class structure in bytes
* class_init :: class constructor
* class_done :: class finalizer
*
* obj_size :: instance size in bytes
* obj_init :: instance constructor. can be NULL
* obj_done :: instance destructor. can be NULL
*
* @note:
* if 'obj_init' is NULL, the class will use it's parent
* constructor, if any
*
* if 'obj_done' is NULL, the class will use it's parent
* finalizer, if any
*
* the object sub-system allocates a new class, copies
* the content of its super-class into the new structure,
* _then_ calls 'clazz_init'.
*
* 'class_init' and 'class_done' can be NULL, in which case
* the parent's class constructor and destructor wil be used
*/
typedef struct FT_TypeRec_
{
const char* name;
FT_Type super;
FT_UInt class_size;
FT_Object_InitFunc class_init;
FT_Object_DoneFunc class_done;
FT_UInt obj_size;
FT_Object_InitFunc obj_init;
FT_Object_DoneFunc obj_done;
} FT_TypeRec;
/**************************************************************
*
* @macro: FT_TYPE (x)
*
* @description:
* a useful macro to convert anything to a class type handle
* without checks
*/
#define FT_TYPE(x) ((FT_Type)(x))
/**************************************************************
*
* @function: ft_object_check
*
* @description:
* checks that a handle points to a valid @FT_Object
*
* @input:
* obj :: handle/pointer
*
* @return:
* 1 iff the handle points to a valid object. 0 otherwise
*/
FT_BASE( FT_Int )
ft_object_check( FT_Pointer obj );
/**************************************************************
*
* @function: ft_object_is_a
*
* @description:
* checks that a handle points to a valid @FT_Object that
* is an instance of a given class (or of any of its sub-classes)
*
* @input:
* obj :: handle/pointer
* clazz :: class handle to check
*
* @return:
* 1 iff the handle points to a valid 'clazz' instance. 0
* otherwise.
*/
FT_BASE( FT_Int )
ft_object_is_a( FT_Pointer obj,
FT_Class clazz );
/**************************************************************
*
* @function: ft_object_create
*
* @description:
* create a new object (class instance)
*
* @output:
* aobject :: new object handle. NULL in case of error
*
* @input:
* clazz :: object's class pointer
* init_data :: optional pointer to initialization data
*
* @return:
* error code. 0 means success
*/
FT_BASE( FT_Error )
ft_object_create( FT_Object *aobject,
FT_Class clazz,
FT_Pointer init_data );
/**************************************************************
*
* @function: ft_object_create_from_type
*
* @description:
* create a new object (class instance) from a @FT_Type
*
* @output:
* aobject :: new object handle. NULL in case of error
*
* @input:
* type :: object's type descriptor
* init_data :: optional pointer to initialization data
*
* @return:
* error code. 0 means success
*
* @note:
* this function is slower than @ft_object_create
*
* this is equivalent to calling @ft_class_from_type followed by
* @ft_object_create
*/
FT_BASE( FT_Error )
ft_object_create_from_type( FT_Object *aobject,
FT_Type type,
FT_Pointer init_data,
FT_Library library );
/**************************************************************
*
* @macro FT_OBJ_CREATE (object,class,init)
*
* @description:
* a convenient macro used to create new objects. see
* @ft_object_create for details
*/
#define FT_OBJ_CREATE( _obj, _clazz, _init ) \
ft_object_create( FT_OBJECT_P(&(_obj)), _clazz, _init )
/**************************************************************
*
* @macro FT_CREATE (object,class,init)
*
* @description:
* a convenient macro used to create new objects. It also
* sets an _implicit_ local variable named "error" to the error
* code returned by the object constructor.
*/
#define FT_CREATE( _obj, _clazz, _init ) \
FT_SET_ERROR( FT_OBJ_CREATE( _obj, _clazz, _init ) )
/**************************************************************
*
* @macro FT_OBJ_CREATE_FROM_TYPE (object,type,init)
*
* @description:
* a convenient macro used to create new objects. see
* @ft_object_create_from_type for details
*/
#define FT_OBJ_CREATE_FROM_TYPE( _obj, _type, _init, _lib ) \
ft_object_create_from_type( FT_OBJECT_P(&(_obj)), _type, _init, _lib )
/**************************************************************
*
* @macro FT_CREATE_FROM_TYPE (object,type,init)
*
* @description:
* a convenient macro used to create new objects. It also
* sets an _implicit_ local variable named "error" to the error
* code returned by the object constructor.
*/
#define FT_CREATE_FROM_TYPE( _obj, _type, _init, _lib ) \
FT_SET_ERROR( FT_OBJ_CREATE_FROM_TYPE( _obj, _type, _init, _lib ) )
/* */
/**************************************************************
*
* @function: ft_class_from_type
*
* @description:
* retrieves the class object corresponding to a given type
* descriptor. The class is created when needed
*
* @output:
* aclass :: handle to corresponding class object. NULL in
* case of error
*
* @input:
* type :: type descriptor handle
* library :: library handle
*
* @return:
* error code. 0 means success
*/
FT_BASE( FT_Error )
ft_class_from_type( FT_Class *aclass,
FT_Type type,
FT_Library library );
/* */
#include FT_INTERNAL_HASH_H
typedef struct FT_ClassHNodeRec_* FT_ClassHNode;
typedef struct FT_ClassHNodeRec_
{
FT_HashNodeRec hnode;
FT_Type type;
FT_Class clazz;
} FT_ClassHNodeRec;
typedef struct FT_MetaClassRec_
{
FT_ClassRec clazz; /* the meta-class is a class itself */
FT_HashRec type_to_class; /* the type => class hash table */
} FT_MetaClassRec, *FT_MetaClass;
/* initialize meta class */
FT_BASE( FT_Error )
ft_metaclass_init( FT_MetaClass meta,
FT_Library library );
/* finalize meta class - destroy all registered class objects */
FT_BASE( void )
ft_metaclass_done( FT_MetaClass meta );
/* */
FT_END_HEADER
#endif /* __FT_OBJECT_H__ */
+100 -73
View File
@@ -4,7 +4,7 @@
/* */
/* The FreeType private base classes (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -34,7 +34,7 @@
#include FT_INTERNAL_GLYPH_LOADER_H
#include FT_INTERNAL_DRIVER_H
#include FT_INTERNAL_AUTOHINT_H
#include FT_INTERNAL_OBJECT_H
#include FT_INTERNAL_SERVICE_H
#ifdef FT_CONFIG_OPTION_INCREMENTAL
#include FT_INCREMENTAL_H
@@ -64,19 +64,21 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* The min and max functions missing in C. As usual, be careful not to */
/* write things like MIN( a++, b++ ) to avoid side effects. */
/* write things like FT_MIN( a++, b++ ) to avoid side effects. */
/* */
#ifndef MIN
#define MIN( a, b ) ( (a) < (b) ? (a) : (b) )
#endif
#define FT_MIN( a, b ) ( (a) < (b) ? (a) : (b) )
#define FT_MAX( a, b ) ( (a) > (b) ? (a) : (b) )
#ifndef MAX
#define MAX( a, b ) ( (a) > (b) ? (a) : (b) )
#endif
#define FT_ABS( a ) ( (a) < 0 ? -(a) : (a) )
#ifndef ABS
#define ABS( a ) ( (a) < 0 ? -(a) : (a) )
#endif
#define FT_PAD_FLOOR( x, n ) ( (x) & ~((n)-1) )
#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n )
#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n )
#define FT_PIX_FLOOR( x ) ( (x) & ~63 )
#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
/*************************************************************************/
@@ -112,7 +114,7 @@ FT_BEGIN_HEADER
/* return an error later when trying to load the glyph). */
/* */
/* It also check that fields that must be a multiple of 2, 4, or 8 */
/* dont' have incorrect values, etc. */
/* don't have incorrect values, etc. */
/* */
/* FT_VALIDATE_PARANOID :: */
/* Only for font debugging. Checks that a table follows the */
@@ -239,7 +241,7 @@ FT_BEGIN_HEADER
typedef struct FT_CMap_ClassRec_
{
FT_UInt size;
FT_ULong size;
FT_CMap_InitFunc init;
FT_CMap_DoneFunc done;
FT_CMap_CharIndexFunc char_index;
@@ -271,56 +273,52 @@ FT_BEGIN_HEADER
/* FreeType. */
/* */
/* <Fields> */
/* max_points :: The maximal number of points used to store the */
/* vectorial outline of any glyph in this face. */
/* If this value cannot be known in advance, or */
/* if the face isn't scalable, this should be set */
/* to 0. Only relevant for scalable formats. */
/* max_points :: */
/* The maximal number of points used to store the vectorial outline */
/* of any glyph in this face. If this value cannot be known in */
/* advance, or if the face isn't scalable, this should be set to 0. */
/* Only relevant for scalable formats. */
/* */
/* max_contours :: The maximal number of contours used to store */
/* the vectorial outline of any glyph in this */
/* face. If this value cannot be known in */
/* advance, or if the face isn't scalable, this */
/* should be set to 0. Only relevant for */
/* scalable formats. */
/* max_contours :: */
/* The maximal number of contours used to store the vectorial */
/* outline of any glyph in this face. If this value cannot be */
/* known in advance, or if the face isn't scalable, this should be */
/* set to 0. Only relevant for scalable formats. */
/* */
/* transform_matrix :: A 2x2 matrix of 16.16 coefficients used to */
/* transform glyph outlines after they are loaded */
/* from the font. Only used by the convenience */
/* functions. */
/* transform_matrix :: */
/* A 2x2 matrix of 16.16 coefficients used to transform glyph */
/* outlines after they are loaded from the font. Only used by the */
/* convenience functions. */
/* */
/* transform_delta :: A translation vector used to transform glyph */
/* outlines after they are loaded from the font. */
/* Only used by the convenience functions. */
/* transform_delta :: */
/* A translation vector used to transform glyph outlines after they */
/* are loaded from the font. Only used by the convenience */
/* functions. */
/* */
/* transform_flags :: Some flags used to classify the transform. */
/* Only used by the convenience functions. */
/* transform_flags :: */
/* Some flags used to classify the transform. Only used by the */
/* convenience functions. */
/* */
/* hint_flags :: Some flags used to change the hinters' */
/* behaviour. Only used for debugging for now. */
/* */
/* postscript_name :: Postscript font name for this face. */
/* services :: */
/* A cache for frequently used services. It should be only */
/* accessed with the macro `FT_FACE_LOOKUP_SERVICE'. */
/* */
/* incremental_interface :: */
/* If non-null, the interface through */
/* which glyph data and metrics are loaded */
/* incrementally for faces that do not provide */
/* all of this data when first opened. */
/* This field exists only if */
/* @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* If non-null, the interface through which glyph data and metrics */
/* are loaded incrementally for faces that do not provide all of */
/* this data when first opened. This field exists only if */
/* @FT_CONFIG_OPTION_INCREMENTAL is defined. */
/* */
typedef struct FT_Face_InternalRec_
{
FT_UShort max_points;
FT_Short max_contours;
FT_UShort max_points;
FT_Short max_contours;
FT_Matrix transform_matrix;
FT_Vector transform_delta;
FT_Int transform_flags;
FT_Matrix transform_matrix;
FT_Vector transform_delta;
FT_Int transform_flags;
FT_UInt32 hint_flags;
const char* postscript_name;
FT_ServiceCacheRec services;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_InterfaceRec* incremental_interface;
@@ -343,6 +341,11 @@ FT_BEGIN_HEADER
/* loader :: The glyph loader object used to load outlines */
/* into the glyph slot. */
/* */
/* flags :: Possible values are zero or */
/* FT_GLYPH_OWN_BITMAP. The latter indicates */
/* that the FT_GlyphSlot structure owns the */
/* bitmap buffer. */
/* */
/* glyph_transformed :: Boolean. Set to TRUE when the loaded glyph */
/* must be transformed through a specific */
/* font transformation. This is _not_ the same */
@@ -357,9 +360,13 @@ FT_BEGIN_HEADER
/* */
/* glyph_hints :: Format-specific glyph hints management. */
/* */
#define FT_GLYPH_OWN_BITMAP 0x1
typedef struct FT_Slot_InternalRec_
{
FT_GlyphLoader loader;
FT_UInt flags;
FT_Bool glyph_transformed;
FT_Matrix glyph_matrix;
FT_Vector glyph_delta;
@@ -416,25 +423,25 @@ FT_BEGIN_HEADER
#define FT_MODULE_IS_DRIVER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_font_driver )
FT_MODULE_FONT_DRIVER )
#define FT_MODULE_IS_RENDERER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_renderer )
FT_MODULE_RENDERER )
#define FT_MODULE_IS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_hinter )
FT_MODULE_HINTER )
#define FT_MODULE_IS_STYLER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_styler )
FT_MODULE_STYLER )
#define FT_DRIVER_IS_SCALABLE( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_driver_scalable )
FT_MODULE_DRIVER_SCALABLE )
#define FT_DRIVER_USES_OUTLINES( x ) !( FT_MODULE_CLASS( x )->module_flags & \
ft_module_driver_no_outlines )
FT_MODULE_DRIVER_NO_OUTLINES )
#define FT_DRIVER_HAS_HINTER( x ) ( FT_MODULE_CLASS( x )->module_flags & \
ft_module_driver_has_hinter )
FT_MODULE_DRIVER_HAS_HINTER )
/*************************************************************************/
@@ -462,6 +469,10 @@ FT_BEGIN_HEADER
FT_Get_Module_Interface( FT_Library library,
const char* mod_name );
FT_BASE( FT_Pointer )
ft_module_get_service( FT_Module module,
const char* service_id );
/* */
@@ -537,28 +548,30 @@ FT_BEGIN_HEADER
FT_Done_GlyphSlot( FT_GlyphSlot slot );
/* */
/*
* free the bitmap of a given glyphslot when needed
* (i.e. only when it was allocated with ft_glyphslot_alloc_bitmap)
* Free the bitmap of a given glyphslot when needed
* (i.e., only when it was allocated with ft_glyphslot_alloc_bitmap).
*/
FT_BASE( void )
ft_glyphslot_free_bitmap( FT_GlyphSlot slot );
/*
* allocate a new bitmap buffer in a glyph slot
* Allocate a new bitmap buffer in a glyph slot.
*/
FT_BASE( FT_Error )
ft_glyphslot_alloc_bitmap( FT_GlyphSlot slot,
FT_ULong size );
/*
* set the bitmap buffer in a glyph slot to a given pointer.
* the buffer will not be freed by a later call to ft_glyphslot_free_bitmap
* Set the bitmap buffer in a glyph slot to a given pointer.
* The buffer will not be freed by a later call to ft_glyphslot_free_bitmap.
*/
FT_BASE( void )
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
FT_Pointer buffer );
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
FT_Byte* buffer );
/*************************************************************************/
@@ -667,8 +680,18 @@ FT_BEGIN_HEADER
/*************************************************************************/
#define FT_DEBUG_HOOK_TRUETYPE 0
#define FT_DEBUG_HOOK_TYPE1 1
/* this hook is used by the TrueType debugger. It must be set to an alternate
* truetype bytecode interpreter function
*/
#define FT_DEBUG_HOOK_TRUETYPE 0
/* set this debug hook to a non-null pointer to force unpatented hinting
* for all faces when both TT_CONFIG_OPTION_BYTECODE_INTERPRETER and
* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined. this is only used
* during debugging
*/
#define FT_DEBUG_HOOK_UNPATENTED_HINTING 1
/*************************************************************************/
@@ -688,6 +711,12 @@ FT_BEGIN_HEADER
/* generic :: Client data variable. Used to extend the */
/* Library class by higher levels and clients. */
/* */
/* version_major :: The major version number of the library. */
/* */
/* version_minor :: The minor version number of the library. */
/* */
/* version_patch :: The current patch level of the library. */
/* */
/* num_modules :: The number of modules currently registered */
/* within this library. This is set to 0 for new */
/* libraries. New modules are added through the */
@@ -738,8 +767,6 @@ FT_BEGIN_HEADER
FT_DebugHook_Func debug_hooks[4];
FT_MetaClassRec meta_class;
} FT_LibraryRec;
@@ -817,4 +844,4 @@ FT_END_HEADER
#endif /* __FTOBJS_H__ */
/* END */
/* END */
@@ -0,0 +1,184 @@
/***************************************************************************/
/* */
/* ftrfork.h */
/* */
/* Embedded resource forks accessor (specification). */
/* */
/* Copyright 2004 by */
/* Masatake YAMATO and Redhat K.K. */
/* */
/* 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. */
/* */
/***************************************************************************/
/***************************************************************************/
/* Development of the code in this file is support of */
/* Information-technology Promotion Agency, Japan. */
/***************************************************************************/
#ifndef __FTRFORK_H__
#define __FTRFORK_H__
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
FT_BEGIN_HEADER
/* Number of guessing rules supported in `FT_Raccess_Guess'. */
/* Don't forget to increment the number if you add a new guessing rule. */
#define FT_RACCESS_N_RULES 8
/*************************************************************************/
/* */
/* <Function> */
/* FT_Raccess_Guess */
/* */
/* <Description> */
/* Guess a file name and offset where the actual resource fork is */
/* stored. The macro FT_RACCESS_N_RULES holds the number of */
/* guessing rules; the guessed result for the Nth rule is */
/* represented as a triplet: a new file name (new_names[N]), a file */
/* offset (offsets[N]), and an error code (errors[N]). */
/* */
/* <Input> */
/* library :: */
/* A FreeType library instance. */
/* */
/* stream :: */
/* A file stream containing the resource fork. */
/* */
/* base_name :: */
/* The (base) file name of the resource fork used for some */
/* guessing rules. */
/* */
/* <Output> */
/* new_names :: */
/* An array of guessed file names in which the resource forks may */
/* exist. If `new_names[N]' is NULL, the guessed file name is */
/* equal to `base_name'. */
/* */
/* offsets :: */
/* An array of guessed file offsets. `offsets[N]' holds the file */
/* offset of the possible start of the resource fork in file */
/* `new_names[N]'. */
/* */
/* errors :: */
/* An array of FreeType error codes. `errors[N]' is the error */
/* code of Nth guessing rule function. If `errors[N]' is not */
/* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */
/* */
FT_BASE( void )
FT_Raccess_Guess( FT_Library library,
FT_Stream stream,
char* base_name,
char** new_names,
FT_Long* offsets,
FT_Error* errors );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Raccess_Get_HeaderInfo */
/* */
/* <Description> */
/* Get the information from the header of resource fork. The */
/* information includes the file offset where the resource map */
/* starts, and the file offset where the resource data starts. */
/* `FT_Raccess_Get_DataOffsets' requires these two data. */
/* */
/* <Input> */
/* library :: */
/* A FreeType library instance. */
/* */
/* stream :: */
/* A file stream containing the resource fork. */
/* */
/* rfork_offset :: */
/* The file offset where the resource fork starts. */
/* */
/* <Output> */
/* map_offset :: */
/* The file offset where the resource map starts. */
/* */
/* rdata_pos :: */
/* The file offset where the resource data starts. */
/* */
/* <Return> */
/* FreeType error code. FT_Err_Ok means success. */
/* */
FT_BASE( FT_Error )
FT_Raccess_Get_HeaderInfo( FT_Library library,
FT_Stream stream,
FT_Long rfork_offset,
FT_Long *map_offset,
FT_Long *rdata_pos );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Raccess_Get_DataOffsets */
/* */
/* <Description> */
/* Get the data offsets for a tag in a resource fork. Offsets are */
/* stored in an array because, in some cases, resources in a resource */
/* fork have the same tag. */
/* */
/* <Input> */
/* library :: */
/* A FreeType library instance. */
/* */
/* stream :: */
/* A file stream containing the resource fork. */
/* */
/* map_offset :: */
/* The file offset where the resource map starts. */
/* */
/* rdata_pos :: */
/* The file offset where the resource data starts. */
/* */
/* tag :: */
/* The resource tag. */
/* */
/* <Output> */
/* offsets :: */
/* The stream offsets for the resource data specified by `tag'. */
/* This array is allocated by the function, so you have to call */
/* @FT_Free after use. */
/* */
/* count :: */
/* The length of offsets array. */
/* */
/* <Return> */
/* FreeType error code. FT_Err_Ok means success. */
/* */
/* <Note> */
/* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */
/* value for `map_offset' and `rdata_pos'. */
/* */
FT_BASE( FT_Error )
FT_Raccess_Get_DataOffsets( FT_Library library,
FT_Stream stream,
FT_Long map_offset,
FT_Long rdata_pos,
FT_Long tag,
FT_Long **offsets,
FT_Long *count );
FT_END_HEADER
#endif /* __FTRFORK_H__ */
/* END */
@@ -0,0 +1,260 @@
/***************************************************************************/
/* */
/* ftserv.h */
/* */
/* The FreeType services (specification only). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* Each module can export one or more `services'. Each service is */
/* identified by a constant string and modeled by a pointer; the latter */
/* generally corresponds to a structure containing function pointers. */
/* */
/* Note that a service's data cannot be a mere function pointer because */
/* in C it is possible that function pointers might be implemented */
/* differently than data pointers (e.g. 48 bits instead of 32). */
/* */
/*************************************************************************/
#ifndef __FTSERV_H__
#define __FTSERV_H__
FT_BEGIN_HEADER
/*
* @macro:
* FT_FACE_FIND_SERVICE
*
* @description:
* This macro is used to look up a service from a face's driver module.
*
* @input:
* face ::
* The source face handle.
*
* id ::
* A string describing the service as defined in the service's
* header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
* `multi-masters'). It is automatically prefixed with
* `FT_SERVICE_ID_'.
*
* @output:
* ptr ::
* A variable that receives the service pointer. Will be NULL
* if not found.
*/
#define FT_FACE_FIND_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \
/* the strange cast is to allow C++ compilation */ \
FT_Pointer* Pptr = (FT_Pointer*) &(ptr); \
\
\
*Pptr = NULL; \
if ( module->clazz->get_interface ) \
*Pptr = module->clazz->get_interface( module, FT_SERVICE_ID_ ## id ); \
FT_END_STMNT
/*
* @macro:
* FT_FACE_FIND_GLOBAL_SERVICE
*
* @description:
* This macro is used to look up a service from all modules.
*
* @input:
* face ::
* The source face handle.
*
* id ::
* A string describing the service as defined in the service's
* header files (e.g. FT_SERVICE_ID_MULTI_MASTERS which expands to
* `multi-masters'). It is automatically prefixed with
* `FT_SERVICE_ID_'.
*
* @output:
* ptr ::
* A variable that receives the service pointer. Will be NULL
* if not found.
*/
#define FT_FACE_FIND_GLOBAL_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
FT_Module module = FT_MODULE( FT_FACE(face)->driver ); \
/* the strange cast is to allow C++ compilation */ \
FT_Pointer* Pptr = (FT_Pointer*) &(ptr); \
\
\
*Pptr = ft_module_get_service( module, FT_SERVICE_ID_ ## id ); \
FT_END_STMNT
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** S E R V I C E D E S C R I P T O R S *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*
* The following structure is used to _describe_ a given service
* to the library. This is useful to build simple static service lists.
*/
typedef struct FT_ServiceDescRec_
{
const char* serv_id; /* service name */
const void* serv_data; /* service pointer/data */
} FT_ServiceDescRec;
typedef const FT_ServiceDescRec* FT_ServiceDesc;
/*
* Parse a list of FT_ServiceDescRec descriptors and look for
* a specific service by ID. Note that the last element in the
* array must be { NULL, NULL }, and that the function should
* return NULL if the service isn't available.
*
* This function can be used by modules to implement their
* `get_service' method.
*/
FT_BASE( FT_Pointer )
ft_service_list_lookup( FT_ServiceDesc service_descriptors,
const char* service_id );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** S E R V I C E S C A C H E *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/*
* This structure is used to store a cache for several frequently used
* services. It is the type of `face->internal->services'. You
* should only use FT_FACE_LOOKUP_SERVICE to access it.
*
* All fields should have the type FT_Pointer to relax compilation
* dependencies. We assume the developer isn't completely stupid.
*
* Each field must be named `service_XXXX' where `XXX' corresponds to
* the correct FT_SERVICE_ID_XXXX macro. See the definition of
* FT_FACE_LOOKUP_SERVICE below how this is implemented.
*
*/
typedef struct FT_ServiceCacheRec_
{
FT_Pointer service_POSTSCRIPT_FONT_NAME;
FT_Pointer service_MULTI_MASTERS;
FT_Pointer service_GLYPH_DICT;
FT_Pointer service_PFR_METRICS;
FT_Pointer service_WINFNT;
} FT_ServiceCacheRec, *FT_ServiceCache;
/*
* A magic number used within the services cache.
*/
#define FT_SERVICE_UNAVAILABLE ((FT_Pointer)-2) /* magic number */
/*
* @macro:
* FT_FACE_LOOKUP_SERVICE
*
* @description:
* This macro is used to lookup a service from a face's driver module
* using its cache.
*
* @input:
* face::
* The source face handle containing the cache.
*
* field ::
* The field name in the cache.
*
* id ::
* The service ID.
*
* @output:
* ptr ::
* A variable receiving the service data. NULL if not available.
*/
#define FT_FACE_LOOKUP_SERVICE( face, ptr, id ) \
FT_BEGIN_STMNT \
/* the strange cast is to allow C++ compilation */ \
FT_Pointer* pptr = (FT_Pointer*)&(ptr); \
FT_Pointer svc; \
\
\
svc = FT_FACE(face)->internal->services. service_ ## id ; \
if ( svc == FT_SERVICE_UNAVAILABLE ) \
svc = NULL; \
else if ( svc == NULL ) \
{ \
FT_FACE_FIND_SERVICE( face, svc, id ); \
\
FT_FACE(face)->internal->services. service_ ## id = \
(FT_Pointer)( svc != NULL ? svc \
: FT_SERVICE_UNAVAILABLE ); \
} \
*pptr = svc; \
FT_END_STMNT
/*
* A macro used to define new service structure types.
*/
#define FT_DEFINE_SERVICE( name ) \
typedef struct FT_Service_ ## name ## Rec_ \
FT_Service_ ## name ## Rec ; \
typedef struct FT_Service_ ## name ## Rec_ \
const * FT_Service_ ## name ; \
struct FT_Service_ ## name ## Rec_
/* */
/*
* The header files containing the services.
*/
#define FT_SERVICE_MULTIPLE_MASTERS_H <freetype/internal/services/svmm.h>
#define FT_SERVICE_POSTSCRIPT_NAME_H <freetype/internal/services/svpostnm.h>
#define FT_SERVICE_POSTSCRIPT_CMAPS_H <freetype/internal/services/svpscmap.h>
#define FT_SERVICE_POSTSCRIPT_INFO_H <freetype/internal/services/svpsinfo.h>
#define FT_SERVICE_GLYPH_DICT_H <freetype/internal/services/svgldict.h>
#define FT_SERVICE_BDF_H <freetype/internal/services/svbdf.h>
#define FT_SERVICE_XFREE86_NAME_H <freetype/internal/services/svxf86nm.h>
#define FT_SERVICE_SFNT_H <freetype/internal/services/svsfnt.h>
#define FT_SERVICE_PFR_H <freetype/internal/services/svpfr.h>
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
#define FT_SERVICE_TT_CMAP_H <freetype/internal/services/svttcmap.h>
/* */
FT_END_HEADER
#endif /* __FTSERV_H__ */
/* END */
@@ -4,7 +4,7 @@
/* */
/* Stream handling (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -315,6 +315,17 @@ FT_BEGIN_HEADER
#endif /* FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */
/* create a new (input) stream from an FT_Open_Args structure */
FT_BASE( FT_Error )
FT_Stream_New( FT_Library library,
const FT_Open_Args* args,
FT_Stream *astream );
/* free a stream */
FT_BASE( void )
FT_Stream_Free( FT_Stream stream,
FT_Int external );
/* initialize a stream for reading in-memory data */
FT_BASE( void )
FT_Stream_OpenMemory( FT_Stream stream,
@@ -495,4 +506,4 @@ FT_END_HEADER
#endif /* __FTSTREAM_H__ */
/* END */
/* END */
@@ -4,7 +4,7 @@
/* */
/* Tracing handling (specification only). */
/* */
/* Copyright 2002 by */
/* Copyright 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -16,12 +16,12 @@
/***************************************************************************/
/* definitions of trace levels for FreeType 2 */
/* definitions of trace levels for FreeType 2 */
/* the first level must always be `trace_any' */
/* the first level must always be `trace_any' */
FT_TRACE_DEF( any )
/* base components */
/* base components */
FT_TRACE_DEF( calc ) /* calculations (ftcalc.c) */
FT_TRACE_DEF( memory ) /* memory manager (ftobjs.c) */
FT_TRACE_DEF( stream ) /* stream manager (ftstream.c) */
@@ -35,14 +35,15 @@ FT_TRACE_DEF( glyph ) /* glyph management (ftglyph.c) */
FT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */
FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */
FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */
FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */
/* Cache sub-system */
FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc..) */
FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */
/* SFNT driver components */
FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */
FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */
FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
FT_TRACE_DEF( ttpost ) /* PS table processing (ttpost.c) */
FT_TRACE_DEF( ttsbit ) /* TrueType sbit handling (ttsbit.c) */
@@ -103,4 +104,4 @@ FT_TRACE_DEF( bdflib )
FT_TRACE_DEF( pfr )
/* END */
/* END */
@@ -4,7 +4,7 @@
/* */
/* Internal header files (specification only). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -27,26 +27,18 @@
#define FT_INTERNAL_OBJECTS_H <freetype/internal/ftobjs.h>
#define FT_INTERNAL_STREAM_H <freetype/internal/ftstream.h>
#define FT_INTERNAL_MEMORY_H <freetype/internal/ftmemory.h>
#define FT_INTERNAL_EXTENSION_H <freetype/internal/ftextend.h>
#define FT_INTERNAL_DEBUG_H <freetype/internal/ftdebug.h>
#define FT_INTERNAL_CALC_H <freetype/internal/ftcalc.h>
#define FT_INTERNAL_DRIVER_H <freetype/internal/ftdriver.h>
#define FT_INTERNAL_EXTEND_H <freetype/internal/ftextend.h>
#define FT_INTERNAL_TRACE_H <freetype/internal/fttrace.h>
#define FT_INTERNAL_GLYPH_LOADER_H <freetype/internal/ftgloadr.h>
#define FT_INTERNAL_SFNT_H <freetype/internal/sfnt.h>
#define FT_INTERNAL_HASH_H <freetype/internal/fthash.h>
#define FT_INTERNAL_OBJECT_H <freetype/internal/ftobject.h>
#define FT_INTERNAL_SERVICE_H <freetype/internal/ftserv.h>
#define FT_INTERNAL_RFORK_H <freetype/internal/ftrfork.h>
#define FT_INTERNAL_TRUETYPE_TYPES_H <freetype/internal/tttypes.h>
#define FT_INTERNAL_TYPE1_TYPES_H <freetype/internal/t1types.h>
#define FT_INTERNAL_TYPE42_TYPES_H <freetype/internal/t42types.h>
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
#define FT_INTERNAL_BDF_TYPES_H <freetype/internal/bdftypes.h>
#define FT_INTERNAL_PFR_H <freetype/internal/pfr.h>
#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>
@@ -54,4 +46,4 @@
#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
/* END */
/* END */
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
Copyright (C) 2000-2001 by
Copyright (C) 2000, 2001, 2002 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -53,4 +53,4 @@ FT_END_HEADER
#endif /* __PCFTYPES_H__ */
/* END */
/* END */
@@ -1,36 +0,0 @@
#ifndef __FT_INTERNAL_PFR_H__
#define __FT_INTERNAL_PFR_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
typedef FT_Error (*FT_PFR_GetMetricsFunc)( FT_Face face,
FT_UInt *aoutline,
FT_UInt *ametrics,
FT_Fixed *ax_scale,
FT_Fixed *ay_scale );
typedef FT_Error (*FT_PFR_GetKerningFunc)( FT_Face face,
FT_UInt left,
FT_UInt right,
FT_Vector *avector );
typedef FT_Error (*FT_PFR_GetAdvanceFunc)( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
typedef struct FT_PFR_ServiceRec_
{
FT_PFR_GetMetricsFunc get_metrics;
FT_PFR_GetKerningFunc get_kerning;
FT_PFR_GetAdvanceFunc get_advance;
} FT_PFR_ServiceRec, *FT_PFR_Service;
#define FT_PFR_SERVICE_NAME "pfr"
FT_END_HEADER
#endif /* __FT_INTERNAL_PFR_H__ */
@@ -5,7 +5,7 @@
/* Auxiliary functions and data structures related to PostScript fonts */
/* (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -24,6 +24,7 @@
#include <ft2build.h>
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_TYPE1_TYPES_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
FT_BEGIN_HEADER
@@ -70,10 +71,10 @@ FT_BEGIN_HEADER
(*done)( PS_Table table );
FT_Error
(*add)( PS_Table table,
FT_Int index,
void* object,
FT_Int length );
(*add)( PS_Table table,
FT_Int idx,
void* object,
FT_PtrDist length );
void
(*release)( PS_Table table );
@@ -123,7 +124,7 @@ FT_BEGIN_HEADER
FT_Int max_elems;
FT_Int num_elems;
FT_Byte** elements; /* addresses of table elements */
FT_Int* lengths; /* lengths of table elements */
FT_PtrDist* lengths; /* lengths of table elements */
FT_Memory memory;
PS_Table_FuncsRec funcs;
@@ -177,7 +178,9 @@ FT_BEGIN_HEADER
T1_FIELD_TYPE_BOOL,
T1_FIELD_TYPE_INTEGER,
T1_FIELD_TYPE_FIXED,
T1_FIELD_TYPE_FIXED_1000,
T1_FIELD_TYPE_STRING,
T1_FIELD_TYPE_KEY,
T1_FIELD_TYPE_BBOX,
T1_FIELD_TYPE_INTEGER_ARRAY,
T1_FIELD_TYPE_FIXED_ARRAY,
@@ -261,7 +264,7 @@ FT_BEGIN_HEADER
},
#define T1_FIELD_TYPE_BOOL( _ident, _fname ) \
#define T1_FIELD_BOOL( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname )
#define T1_FIELD_NUM( _ident, _fname ) \
@@ -270,9 +273,15 @@ FT_BEGIN_HEADER
#define T1_FIELD_FIXED( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname )
#define T1_FIELD_FIXED_1000( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_1000, _fname )
#define T1_FIELD_STRING( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname )
#define T1_FIELD_KEY( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_KEY, _fname )
#define T1_FIELD_BBOX( _ident, _fname ) \
T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname )
@@ -321,13 +330,21 @@ FT_BEGIN_HEADER
void
(*skip_spaces)( PS_Parser parser );
void
(*skip_alpha)( PS_Parser parser );
(*skip_PS_token)( PS_Parser parser );
FT_Long
(*to_int)( PS_Parser parser );
FT_Fixed
(*to_fixed)( PS_Parser parser,
FT_Int power_ten );
FT_Error
(*to_bytes)( PS_Parser parser,
FT_Byte* bytes,
FT_Long max_bytes,
FT_Long* pnum_bytes,
FT_Bool delimiters );
FT_Int
(*to_coord_array)( PS_Parser parser,
FT_Int max_coords,
@@ -634,14 +651,14 @@ FT_BEGIN_HEADER
T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS + 1];
T1_Decoder_Zone zone;
PSNames_Service psnames; /* for seac */
FT_Service_PsCMaps psnames; /* for seac */
FT_UInt num_glyphs;
FT_Byte** glyph_names;
FT_Int lenIV; /* internal for sub routine calls */
FT_UInt num_subrs;
FT_Byte** subrs;
FT_Int* subrs_len; /* array of subrs length (optional) */
FT_PtrDist* subrs_len; /* array of subrs length (optional) */
FT_Matrix font_matrix;
FT_Vector font_offset;
@@ -652,7 +669,6 @@ FT_BEGIN_HEADER
PS_Blend blend; /* for multiple master support */
FT_UInt32 hint_flags;
FT_Render_Mode hint_mode;
T1_Decoder_Callback parse_callback;
@@ -714,4 +730,4 @@ FT_END_HEADER
#endif /* __PSAUX_H__ */
/* END */
/* END */
@@ -6,7 +6,7 @@
/* recorders (specification only). These are used to support native */
/* T1/T2 hints in the "type1", "cid" and "cff" font drivers. */
/* */
/* Copyright 2001, 2002 by */
/* Copyright 2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -261,13 +261,13 @@ FT_BEGIN_HEADER
/* been recorded. */
/* */
/* @input: */
/* hints :: A handle to the Type 1 hints recorder. */
/* hints :: A handle to the Type 1 hints recorder. */
/* */
/* outline :: A pointer to the target outline descriptor. */
/* outline :: A pointer to the target outline descriptor. */
/* */
/* globals :: The hinter globals for this font. */
/* globals :: The hinter globals for this font. */
/* */
/* hint_flags :: Hinter bit flags. */
/* hint_mode :: Hinting information. */
/* */
/* @return: */
/* FreeType error code. 0 means success. */
@@ -542,13 +542,13 @@ FT_BEGIN_HEADER
/* method. */
/* */
/* @input: */
/* hints :: A handle to the Type 2 hints recorder. */
/* hints :: A handle to the Type 2 hints recorder. */
/* */
/* outline :: A pointer to the target outline descriptor. */
/* outline :: A pointer to the target outline descriptor. */
/* */
/* globals :: The hinter globals for this font. */
/* globals :: The hinter globals for this font. */
/* */
/* hint_flags :: Hinter bit flags. */
/* hint_mode :: Hinting information. */
/* */
/* @return: */
/* FreeType error code. 0 means success. */
@@ -623,4 +623,4 @@ FT_END_HEADER
#endif /* __PSHINTS_H__ */
/* END */
/* END */
@@ -1,241 +0,0 @@
/***************************************************************************/
/* */
/* psnames.h */
/* */
/* High-level interface for the `PSNames' module (in charge of */
/* various functions related to Postscript glyph names conversion). */
/* */
/* Copyright 1996-2001, 2002 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. */
/* */
/***************************************************************************/
#ifndef __PSNAMES_H__
#define __PSNAMES_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <FuncType> */
/* PS_Unicode_Value_Func */
/* */
/* <Description> */
/* A function used to return the Unicode index corresponding to a */
/* given glyph name. */
/* */
/* <Input> */
/* glyph_name :: The glyph name. */
/* */
/* <Return> */
/* The Unicode character index resp. the non-Unicode value 0xFFFF if */
/* the glyph name has no known Unicode meaning. */
/* */
/* <Note> */
/* This function is able to map several different glyph names to the */
/* same Unicode value, according to the rules defined in the Adobe */
/* Glyph List table. */
/* */
/* This function will not be compiled if the configuration macro */
/* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined. */
/* */
typedef FT_UInt32
(*PS_Unicode_Value_Func)( const char* glyph_name );
/*************************************************************************/
/* */
/* <FuncType> */
/* PS_Unicode_Index_Func */
/* */
/* <Description> */
/* A function used to return the glyph index corresponding to a given */
/* Unicode value. */
/* */
/* <Input> */
/* num_glyphs :: The number of glyphs in the face. */
/* */
/* glyph_names :: An array of glyph name pointers. */
/* */
/* unicode :: The Unicode value. */
/* */
/* <Return> */
/* The glyph index resp. 0xFFFF if no glyph corresponds to this */
/* Unicode value. */
/* */
/* <Note> */
/* This function is able to recognize several glyph names per Unicode */
/* value, according to the Adobe Glyph List. */
/* */
/* This function will not be compiled if the configuration macro */
/* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is undefined. */
/* */
typedef FT_UInt
(*PS_Unicode_Index_Func)( FT_UInt num_glyphs,
const char** glyph_names,
FT_ULong unicode );
/*************************************************************************/
/* */
/* <FuncType> */
/* PS_Macintosh_Name_Func */
/* */
/* <Description> */
/* A function used to return the glyph name corresponding to an Apple */
/* glyph name index. */
/* */
/* <Input> */
/* name_index :: The index of the Mac name. */
/* */
/* <Return> */
/* The glyph name, or 0 if the index is invalid. */
/* */
/* <Note> */
/* This function will not be compiled if the configuration macro */
/* FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined. */
/* */
typedef const char*
(*PS_Macintosh_Name_Func)( FT_UInt name_index );
typedef const char*
(*PS_Adobe_Std_Strings_Func)( FT_UInt string_index );
typedef struct PS_UniMap_
{
FT_UInt unicode;
FT_UInt glyph_index;
} PS_UniMap;
/*************************************************************************/
/* */
/* <Struct> */
/* PS_Unicodes */
/* */
/* <Description> */
/* A simple table used to map Unicode values to glyph indices. It is */
/* built by the PS_Build_Unicodes table according to the glyphs */
/* present in a font file. */
/* */
/* <Fields> */
/* num_codes :: The number of glyphs in the font that match a given */
/* Unicode value. */
/* */
/* unicodes :: An array of unicode values, sorted in increasing */
/* order. */
/* */
/* gindex :: An array of glyph indices, corresponding to each */
/* Unicode value. */
/* */
/* <Note> */
/* Use the function PS_Lookup_Unicode() to retrieve the glyph index */
/* corresponding to a given Unicode character code. */
/* */
typedef struct PS_Unicodes_
{
FT_UInt num_maps;
PS_UniMap* maps;
} PS_Unicodes;
typedef FT_Error
(*PS_Build_Unicodes_Func)( FT_Memory memory,
FT_UInt num_glyphs,
const char** glyph_names,
PS_Unicodes* unicodes );
typedef FT_UInt
(*PS_Lookup_Unicode_Func)( PS_Unicodes* unicodes,
FT_UInt unicode );
typedef FT_ULong
(*PS_Next_Unicode_Func)( PS_Unicodes* unicodes,
FT_ULong unicode );
/*************************************************************************/
/* */
/* <Struct> */
/* PSNames_Interface */
/* */
/* <Description> */
/* This structure defines the PSNames interface. */
/* */
/* <Fields> */
/* unicode_value :: A function used to convert a glyph name */
/* into a Unicode character code. */
/* */
/* build_unicodes :: A function which builds up the Unicode */
/* mapping table. */
/* */
/* lookup_unicode :: A function used to return the glyph index */
/* corresponding to a given Unicode */
/* character. */
/* */
/* macintosh_name :: A function used to return the standard */
/* Apple glyph Postscript name corresponding */
/* to a given string index (used by the */
/* TrueType `post' table). */
/* */
/* adobe_std_strings :: A function that returns a pointer to a */
/* Adobe Standard String for a given SID. */
/* */
/* adobe_std_encoding :: A table of 256 unsigned shorts that maps */
/* character codes in the Adobe Standard */
/* Encoding to SIDs. */
/* */
/* adobe_expert_encoding :: A table of 256 unsigned shorts that maps */
/* character codes in the Adobe Expert */
/* Encoding to SIDs. */
/* */
/* <Note> */
/* `unicode_value' and `unicode_index' will be set to 0 if the */
/* configuration macro FT_CONFIG_OPTION_ADOBE_GLYPH_LIST is */
/* undefined. */
/* */
/* `macintosh_name' will be set to 0 if the configuration macro */
/* FT_CONFIG_OPTION_POSTSCRIPT_NAMES is undefined. */
/* */
typedef struct PSNames_Interface_
{
PS_Unicode_Value_Func unicode_value;
PS_Build_Unicodes_Func build_unicodes;
PS_Lookup_Unicode_Func lookup_unicode;
PS_Macintosh_Name_Func macintosh_name;
PS_Adobe_Std_Strings_Func adobe_std_strings;
const unsigned short* adobe_std_encoding;
const unsigned short* adobe_expert_encoding;
PS_Next_Unicode_Func next_unicode;
} PSNames_Interface;
typedef PSNames_Interface* PSNames_Service;
FT_END_HEADER
#endif /* __PSNAMES_H__ */
/* END */
@@ -0,0 +1,57 @@
/***************************************************************************/
/* */
/* svbdf.h */
/* */
/* The FreeType BDF services (specification). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __SVBDF_H__
#define __SVBDF_H__
#include FT_BDF_H
#include FT_INTERNAL_SERVICE_H
FT_BEGIN_HEADER
#define FT_SERVICE_ID_BDF "bdf"
typedef FT_Error
(*FT_BDF_GetCharsetIdFunc)( FT_Face face,
const char* *acharset_encoding,
const char* *acharset_registry );
typedef FT_Error
(*FT_BDF_GetPropertyFunc)( FT_Face face,
const char* prop_name,
BDF_PropertyRec *aproperty );
FT_DEFINE_SERVICE( BDF )
{
FT_BDF_GetCharsetIdFunc get_charset_id;
FT_BDF_GetPropertyFunc get_property;
};
/* */
FT_END_HEADER
#endif /* __SVBDF_H__ */
/* END */
@@ -0,0 +1,60 @@
/***************************************************************************/
/* */
/* svgldict.h */
/* */
/* The FreeType glyph dictionary services (specification). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __SVGLDICT_H__
#define __SVGLDICT_H__
#include FT_INTERNAL_SERVICE_H
FT_BEGIN_HEADER
/*
* A service used to retrieve glyph names, as well as to find the
* index of a given glyph name in a font.
*
*/
#define FT_SERVICE_ID_GLYPH_DICT "glyph-dict"
typedef FT_Error
(*FT_GlyphDict_GetNameFunc)( FT_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max );
typedef FT_UInt
(*FT_GlyphDict_NameIndexFunc)( FT_Face face,
FT_String* glyph_name );
FT_DEFINE_SERVICE( GlyphDict )
{
FT_GlyphDict_GetNameFunc get_name;
FT_GlyphDict_NameIndexFunc name_index; /* optional */
};
/* */
FT_END_HEADER
#endif /* __SVGLDICT_H__ */
@@ -0,0 +1,68 @@
/***************************************************************************/
/* */
/* svmm.h */
/* */
/* The FreeType Multiple Masters services (specification). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __SVMM_H__
#define __SVMM_H__
#include FT_INTERNAL_SERVICE_H
FT_BEGIN_HEADER
/*
* A service used to manage multiple-masters data in a given face.
*
* See the related APIs in `ftmm.h' (FT_MULTIPLE_MASTERS_H).
*
*/
#define FT_SERVICE_ID_MULTI_MASTERS "multi-masters"
typedef FT_Error
(*FT_Get_MM_Func)( FT_Face face,
FT_Multi_Master* master );
typedef FT_Error
(*FT_Set_MM_Design_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
typedef FT_Error
(*FT_Set_MM_Blend_Func)( FT_Face face,
FT_UInt num_coords,
FT_Long* coords );
FT_DEFINE_SERVICE( MultiMasters )
{
FT_Get_MM_Func get_mm;
FT_Set_MM_Design_Func set_mm_design;
FT_Set_MM_Blend_Func set_mm_blend;
};
/* */
FT_END_HEADER
#endif /* __SVMM_H__ */
/* END */
@@ -0,0 +1,65 @@
/***************************************************************************/
/* */
/* svpfr.h */
/* */
/* Internal PFR service functions (specification). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __SVPFR_H__
#define __SVPFR_H__
#include FT_INTERNAL_SERVICE_H
FT_BEGIN_HEADER
#define FT_SERVICE_ID_PFR_METRICS "pfr-metrics"
typedef FT_Error
(*FT_PFR_GetMetricsFunc)( FT_Face face,
FT_UInt *aoutline,
FT_UInt *ametrics,
FT_Fixed *ax_scale,
FT_Fixed *ay_scale );
typedef FT_Error
(*FT_PFR_GetKerningFunc)( FT_Face face,
FT_UInt left,
FT_UInt right,
FT_Vector *avector );
typedef FT_Error
(*FT_PFR_GetAdvanceFunc)( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
FT_DEFINE_SERVICE( PfrMetrics )
{
FT_PFR_GetMetricsFunc get_metrics;
FT_PFR_GetKerningFunc get_kerning;
FT_PFR_GetAdvanceFunc get_advance;
};
/* */
FT_END_HEADER
#endif /* __SVPFR_H__ */
/* END */
@@ -0,0 +1,58 @@
/***************************************************************************/
/* */
/* svpostnm.h */
/* */
/* The FreeType PostScript name services (specification). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __SVPOSTNM_H__
#define __SVPOSTNM_H__
#include FT_INTERNAL_SERVICE_H
FT_BEGIN_HEADER
/*
* A trivial service used to retrieve the PostScript name of a given
* font when available. The `get_name' field should never be NULL.
*
* The correponding function can return NULL to indicate that the
* PostScript name is not available.
*
* The name is owned by the face and will be destroyed with it.
*/
#define FT_SERVICE_ID_POSTSCRIPT_FONT_NAME "postscript-font-name"
typedef const char*
(*FT_PsName_GetFunc)( FT_Face face );
FT_DEFINE_SERVICE( PsFontName )
{
FT_PsName_GetFunc get_ps_font_name;
};
/* */
FT_END_HEADER
#endif /* __SVPOSTNM_H__ */
/* END */
@@ -0,0 +1,113 @@
/***************************************************************************/
/* */
/* svpscmap.h */
/* */
/* The FreeType PostScript charmap service (specification). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __SVPSCMAP_H__
#define __SVPSCMAP_H__
FT_BEGIN_HEADER
#define FT_SERVICE_ID_POSTSCRIPT_CMAPS "postscript-cmaps"
/*
* Adobe glyph name to unicode value
*/
typedef FT_UInt32
(*PS_Unicode_ValueFunc)( const char* glyph_name );
/*
* Unicode value to Adobe glyph name index. 0xFFFF if not found.
*/
typedef FT_UInt
(*PS_Unicode_Index_Func)( FT_UInt num_glyphs,
const char** glyph_names,
FT_ULong unicode );
/*
* Macintosh name id to glyph name. NULL if invalid index.
*/
typedef const char*
(*PS_Macintosh_Name_Func)( FT_UInt name_index );
/*
* Adobe standard string ID to glyph name. NULL if invalid index.
*/
typedef const char*
(*PS_Adobe_Std_Strings_Func)( FT_UInt string_index );
/*
* Simple unicode -> glyph index charmap built from font glyph names
* table.
*/
typedef struct PS_UniMap_
{
FT_UInt unicode;
FT_UInt glyph_index;
} PS_UniMap;
typedef struct PS_Unicodes_
{
FT_UInt num_maps;
PS_UniMap* maps;
} PS_Unicodes;
typedef FT_Error
(*PS_Unicodes_InitFunc)( FT_Memory memory,
FT_UInt num_glyphs,
const char** glyph_names,
PS_Unicodes* unicodes );
typedef FT_UInt
(*PS_Unicodes_CharIndexFunc)( PS_Unicodes* unicodes,
FT_UInt unicode );
typedef FT_ULong
(*PS_Unicodes_CharNextFunc)( PS_Unicodes* unicodes,
FT_ULong unicode );
FT_DEFINE_SERVICE( PsCMaps )
{
PS_Unicode_ValueFunc unicode_value;
PS_Unicodes_InitFunc unicodes_init;
PS_Unicodes_CharIndexFunc unicodes_char_index;
PS_Unicodes_CharNextFunc unicodes_char_next;
PS_Macintosh_Name_Func macintosh_name;
PS_Adobe_Std_Strings_Func adobe_std_strings;
const unsigned short* adobe_std_encoding;
const unsigned short* adobe_expert_encoding;
};
/* */
FT_END_HEADER
#endif /* __SVPSCMAP_H__ */
/* END */
@@ -0,0 +1,55 @@
/***************************************************************************/
/* */
/* svpsinfo.h */
/* */
/* The FreeType PostScript info service (specification). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __SVPSINFO_H__
#define __SVPSINFO_H__
#include FT_INTERNAL_SERVICE_H
#include FT_INTERNAL_TYPE1_TYPES_H
FT_BEGIN_HEADER
#define FT_SERVICE_ID_POSTSCRIPT_INFO "postscript-info"
typedef FT_Error
(*PS_GetFontInfoFunc)( FT_Face face,
PS_FontInfoRec* afont_info );
typedef FT_Int
(*PS_HasGlyphNamesFunc)( FT_Face face );
FT_DEFINE_SERVICE( PsInfo )
{
PS_GetFontInfoFunc ps_get_font_info;
PS_HasGlyphNamesFunc ps_has_glyph_names;
};
/* */
FT_END_HEADER
#endif /* __SVPSINFO_H__ */
/* END */
@@ -0,0 +1,69 @@
/***************************************************************************/
/* */
/* svsfnt.h */
/* */
/* The FreeType PostScript name services (specification). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __SVSFNT_H__
#define __SVSFNT_H__
#include FT_INTERNAL_SERVICE_H
#include FT_TRUETYPE_TABLES_H
FT_BEGIN_HEADER
/*
* SFNT table loading service.
*/
#define FT_SERVICE_ID_SFNT_TABLE "sfnt-table"
/*
* Used to implement FT_Load_Sfnt_Table().
*/
typedef FT_Error
(*FT_SFNT_TableLoadFunc)( FT_Face face,
FT_ULong tag,
FT_Long offset,
FT_Byte* buffer,
FT_ULong* length );
/*
* Used to implement FT_Get_Sfnt_Table().
*/
typedef void*
(*FT_SFNT_TableGetFunc)( FT_Face face,
FT_Sfnt_Tag tag );
FT_DEFINE_SERVICE( SFNT_Table )
{
FT_SFNT_TableLoadFunc load_table;
FT_SFNT_TableGetFunc get_table;
};
/* */
FT_END_HEADER
#endif /* __SVSFNT_H__ */
/* END */
@@ -0,0 +1,77 @@
/***************************************************************************/
/* */
/* svsttcmap.h */
/* */
/* The FreeType TrueType/sfnt cmap extra information service. */
/* */
/* Copyright 2003 by */
/* Masatake YAMATO, Redhat K.K. */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
/* Development of this service is support of
Information-technology Promotion Agency, Japan. */
#ifndef __SVTTCMAP_H__
#define __SVTTCMAP_H__
#include FT_INTERNAL_SERVICE_H
#include FT_TRUETYPE_TABLES_H
FT_BEGIN_HEADER
#define FT_SERVICE_ID_TT_CMAP "tt-cmaps"
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CMapInfo */
/* */
/* <Description> */
/* A structure used to store TrueType/sfnt specific cmap information */
/* which is not covered by the generic @FT_CharMap structure. This */
/* structure can be accessed with the @FT_Get_TT_CMap_Info function. */
/* */
/* <Fields> */
/* language :: */
/* The language ID used in Mac fonts. Definitions of values are in */
/* freetype/ttnameid.h. */
/* */
typedef struct TT_CMapInfo_
{
FT_ULong language;
} TT_CMapInfo;
typedef FT_Error
(*TT_CMap_Info_GetFunc)( FT_CharMap charmap,
TT_CMapInfo *cmap_info );
FT_DEFINE_SERVICE( TTCMaps )
{
TT_CMap_Info_GetFunc get_cmap_info;
};
/* */
FT_END_HEADER
#endif /* __SVTTCMAP_H__ */
/* END */
@@ -1,10 +1,10 @@
/***************************************************************************/
/* */
/* ttcmap.h */
/* svwinfnt.h */
/* */
/* TrueType character mapping table (cmap) support (specification). */
/* The FreeType Windows FNT/FONT service (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -16,30 +16,35 @@
/***************************************************************************/
#ifndef __TTCMAP_H__
#define __TTCMAP_H__
#ifndef __SVWINFNT_H__
#define __SVWINFNT_H__
#include <ft2build.h>
#include FT_INTERNAL_TRUETYPE_TYPES_H
#include FT_INTERNAL_SERVICE_H
#include FT_WINFONTS_H
FT_BEGIN_HEADER
FT_LOCAL( FT_Error )
tt_face_load_charmap( TT_Face face,
TT_CMapTable cmap,
FT_Stream input );
#define FT_SERVICE_ID_WINFNT "winfonts"
FT_LOCAL( FT_Error )
tt_face_free_charmap( TT_Face face,
TT_CMapTable cmap );
typedef FT_Error
(*FT_WinFnt_GetHeaderFunc)( FT_Face face,
FT_WinFNT_HeaderRec *aheader );
FT_DEFINE_SERVICE( WinFnt )
{
FT_WinFnt_GetHeaderFunc get_header;
};
/* */
FT_END_HEADER
#endif /* __TTCMAP_H__ */
#endif /* __SVWINFNT_H__ */
/* END */
/* END */
@@ -0,0 +1,55 @@
/***************************************************************************/
/* */
/* svxf86nm.h */
/* */
/* The FreeType XFree86 services (specification only). */
/* */
/* Copyright 2003 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. */
/* */
/***************************************************************************/
#ifndef __SVXF86NM_H__
#define __SVXF86NM_H__
#include FT_INTERNAL_SERVICE_H
FT_BEGIN_HEADER
/*
* A trivial service used to return the name of a face's font driver,
* according to the XFree86 nomenclature. Note that the service data
* is a simple constant string pointer.
*/
#define FT_SERVICE_ID_XF86_NAME "xf86-driver-name"
#define FT_XF86_FORMAT_TRUETYPE "TrueType"
#define FT_XF86_FORMAT_TYPE_1 "Type 1"
#define FT_XF86_FORMAT_BDF "BDF"
#define FT_XF86_FORMAT_PCF "PCF"
#define FT_XF86_FORMAT_TYPE_42 "Type 42"
#define FT_XF86_FORMAT_CID "CID Type 1"
#define FT_XF86_FORMAT_CFF "CFF"
#define FT_XF86_FORMAT_PFR "PFR"
#define FT_XF86_FORMAT_WINFNT "Windows FNT"
/* */
FT_END_HEADER
#endif /* __SVXF86NM_H__ */
/* END */
+91 -87
View File
@@ -4,7 +4,7 @@
/* */
/* High-level `sfnt' driver interface (specification). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -125,11 +125,6 @@ FT_BEGIN_HEADER
(*TT_Done_Face_Func)( TT_Face face );
typedef FT_Module_Interface
(*SFNT_Get_Interface_Func)( FT_Module module,
const char* func_interface );
/*************************************************************************/
/* */
/* <FuncType> */
@@ -245,6 +240,76 @@ FT_BEGIN_HEADER
FT_ULong* length );
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Find_SBit_Image_Func */
/* */
/* <Description> */
/* Checks whether an embedded bitmap (an `sbit') exists for a given */
/* glyph, at a given strike. */
/* */
/* <Input> */
/* face :: The target face object. */
/* */
/* glyph_index :: The glyph index. */
/* */
/* strike_index :: The current strike index. */
/* */
/* <Output> */
/* arange :: The SBit range containing the glyph index. */
/* */
/* astrike :: The SBit strike containing the glyph index. */
/* */
/* aglyph_offset :: The offset of the glyph data in `EBDT' table. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. Returns */
/* SFNT_Err_Invalid_Argument if no sbit exists for the requested */
/* glyph. */
/* */
typedef FT_Error
(*TT_Find_SBit_Image_Func)( TT_Face face,
FT_UInt glyph_index,
FT_ULong strike_index,
TT_SBit_Range *arange,
TT_SBit_Strike *astrike,
FT_ULong *aglyph_offset );
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_Load_SBit_Metrics_Func */
/* */
/* <Description> */
/* Gets the big metrics for a given embedded bitmap. */
/* */
/* <Input> */
/* stream :: The input stream. */
/* */
/* range :: The SBit range containing the glyph. */
/* */
/* <Output> */
/* big_metrics :: A big SBit metrics structure for the glyph. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The stream cursor must be positioned at the glyph's offset within */
/* the `EBDT' table before the call. */
/* */
/* If the image format uses variable metrics, the stream cursor is */
/* positioned just after the metrics header in the `EBDT' table on */
/* function exit. */
/* */
typedef FT_Error
(*TT_Load_SBit_Metrics_Func)( FT_Stream stream,
TT_SBit_Range range,
TT_SBit_Metrics metrics );
/*************************************************************************/
/* */
/* <FuncType> */
@@ -255,20 +320,27 @@ FT_BEGIN_HEADER
/* returns its metrics. */
/* */
/* <Input> */
/* face :: The target face object. */
/* face :: */
/* The target face object. */
/* */
/* x_ppem :: The horizontal resolution in points per EM. */
/* strike_index :: */
/* The strike index. */
/* */
/* y_ppem :: The vertical resolution in points per EM. */
/* glyph_index :: */
/* The current glyph index. */
/* */
/* glyph_index :: The current glyph index. */
/* load_flags :: */
/* The current load flags. */
/* */
/* stream :: The input stream. */
/* stream :: */
/* The input stream. */
/* */
/* <Output> */
/* amap :: The target pixmap. */
/* amap :: */
/* The target pixmap. */
/* */
/* ametrics :: A big sbit metrics structure for the glyph image. */
/* ametrics :: */
/* A big sbit metrics structure for the glyph image. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. Returns an error if no */
@@ -312,8 +384,8 @@ FT_BEGIN_HEADER
/* */
typedef FT_Error
(*TT_Set_SBit_Strike_Func)( TT_Face face,
FT_Int x_ppem,
FT_Int y_ppem,
FT_UInt x_ppem,
FT_UInt y_ppem,
FT_ULong *astrike_index );
@@ -366,57 +438,6 @@ FT_BEGIN_HEADER
FT_Bool vertical );
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_CharMap_Load_Func */
/* */
/* <Description> */
/* Loads a given TrueType character map into memory. */
/* */
/* <Input> */
/* face :: A handle to the parent face object. */
/* */
/* stream :: A handle to the current stream object. */
/* */
/* <InOut> */
/* cmap :: A pointer to a cmap object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The function assumes that the stream is already in use (i.e., */
/* opened). In case of error, all partially allocated tables are */
/* released. */
/* */
typedef FT_Error
(*TT_CharMap_Load_Func)( TT_Face face,
TT_CMapTable cmap,
FT_Stream input );
/*************************************************************************/
/* */
/* <FuncType> */
/* TT_CharMap_Free_Func */
/* */
/* <Description> */
/* Destroys a character mapping table. */
/* */
/* <Input> */
/* face :: A handle to the parent face object. */
/* */
/* cmap :: A handle to a cmap object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
typedef FT_Error
(*TT_CharMap_Free_Func)( TT_Face face,
TT_CMapTable cmap );
/*************************************************************************/
/* */
/* <FuncType> */
@@ -457,21 +478,6 @@ FT_BEGIN_HEADER
(*TT_Free_Table_Func)( TT_Face face );
/*************************************************************************/
/* */
/* <FuncType> */
/* SFNT_Load_Table_Func */
/* */
/* <Description> */
/* Loads a given SFNT table in memory */
/* */
typedef FT_Error
(*SFNT_Load_Table_Func)( FT_Face face,
FT_ULong tag,
FT_Long offset,
FT_Byte* buffer,
FT_ULong* length );
/*************************************************************************/
/* */
/* <Struct> */
@@ -491,7 +497,7 @@ FT_BEGIN_HEADER
TT_Init_Face_Func init_face;
TT_Load_Face_Func load_face;
TT_Done_Face_Func done_face;
SFNT_Get_Interface_Func get_interface;
FT_Module_Requester get_interface;
TT_Load_Any_Func load_any;
TT_Load_SFNT_HeaderRec_Func load_sfnt_header;
@@ -523,6 +529,8 @@ FT_BEGIN_HEADER
/* see `ttsbit.h' */
TT_Set_SBit_Strike_Func set_sbit_strike;
TT_Load_Table_Func load_sbits;
TT_Find_SBit_Image_Func find_sbit_image;
TT_Load_SBit_Metrics_Func load_sbit_metrics;
TT_Load_SBit_Image_Func load_sbit_image;
TT_Free_Table_Func free_sbits;
@@ -530,10 +538,6 @@ FT_BEGIN_HEADER
TT_Get_PS_Name_Func get_psname;
TT_Free_Table_Func free_psnames;
/* see `ttcmap.h' */
TT_CharMap_Load_Func load_charmap;
TT_CharMap_Free_Func free_charmap;
} SFNT_Interface;
@@ -546,4 +550,4 @@ FT_END_HEADER
#endif /* __SFNT_H__ */
/* END */
/* END */
@@ -5,7 +5,7 @@
/* Basic Type1/Type2 type definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -23,8 +23,9 @@
#include <ft2build.h>
#include FT_TYPE1_TABLES_H
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
#include FT_INTERNAL_SERVICE_H
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
FT_BEGIN_HEADER
@@ -101,12 +102,12 @@ FT_BEGIN_HEADER
FT_Int num_subrs;
FT_Byte** subrs;
FT_Int* subrs_len;
FT_PtrDist* subrs_len;
FT_Int num_glyphs;
FT_String** glyph_names; /* array of glyph names */
FT_Byte** charstrings; /* array of glyph charstrings */
FT_Int* charstrings_len;
FT_PtrDist* charstrings_len;
FT_Byte paint_type;
FT_Byte font_type;
@@ -115,7 +116,7 @@ FT_BEGIN_HEADER
FT_BBox font_bbox;
FT_Long font_id;
FT_Int stroke_width;
FT_Fixed stroke_width;
} T1_FontRec, *T1_Font;
@@ -141,17 +142,6 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/* */
/* This structure/class is defined here because it is common to the */
/* following formats: TTF, OpenType-TT, and OpenType-CFF. */
/* */
/* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
/* are not shared between font drivers, and are thus defined normally in */
/* `ttobjs.h'. */
/* */
/*************************************************************************/
typedef struct T1_FaceRec_* T1_Face;
typedef struct CID_FaceRec_* CID_Face;
@@ -169,7 +159,7 @@ FT_BEGIN_HEADER
/* support for Multiple Masters fonts */
PS_Blend blend;
/* since FT 2.1 - interface to PostScript hinter */
const void* pshinter;
@@ -183,8 +173,10 @@ FT_BEGIN_HEADER
void* psaux;
CID_FaceInfoRec cid;
void* afm_data;
FT_Byte* binary_data; /* used if hex data has been converted */
FT_Stream cid_stream;
CID_Subrs subrs;
/* since FT 2.1 - interface to PostScript hinter */
void* pshinter;
@@ -196,4 +188,4 @@ FT_END_HEADER
#endif /* __T1TYPES_H__ */
/* END */
/* END */
@@ -105,41 +105,6 @@ FT_BEGIN_HEADER
} SFNT_HeaderRec, *SFNT_Header;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_TableDirRec */
/* */
/* <Description> */
/* This structure models a TrueType table directory. It is used to */
/* access the various tables of the font face. */
/* */
/* <Fields> */
/* version :: The version number; starts with 0x00010000. */
/* */
/* numTables :: The number of tables. */
/* */
/* searchRange :: Unused. */
/* */
/* entrySelector :: Unused. */
/* */
/* rangeShift :: Unused. */
/* */
/* <Note> */
/* This structure is only used during font opening. */
/* */
typedef struct TT_TableDirRec_
{
FT_Fixed version; /* should be 0x10000 */
FT_UShort numTables; /* number of tables */
FT_UShort searchRange; /* These parameters are only used */
FT_UShort entrySelector; /* for a dichotomy search in the */
FT_UShort rangeShift; /* directory. We ignore them. */
} TT_TableDirRec;
/*************************************************************************/
/* */
/* <Struct> */
@@ -168,61 +133,6 @@ FT_BEGIN_HEADER
} TT_TableRec, *TT_Table;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CMapDirRec */
/* */
/* <Description> */
/* This structure describes the directory of the `cmap' table, */
/* containing the font's character mappings table. */
/* */
/* <Fields> */
/* tableVersionNumber :: The version number. */
/* */
/* numCMaps :: The number of charmaps in the font. */
/* */
/* <Note> */
/* This structure is only used during font loading. */
/* */
typedef struct TT_CMapDirRec_
{
FT_UShort tableVersionNumber;
FT_UShort numCMaps;
} TT_CMapDirRec, *TT_CMapDir;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CMapDirEntryRec */
/* */
/* <Description> */
/* This structure describes a charmap in a TrueType font. */
/* */
/* <Fields> */
/* platformID :: An ID used to specify for which platform this */
/* charmap is defined (FreeType manages all platforms). */
/* */
/* encodingID :: A platform-specific ID used to indicate which source */
/* encoding is used in this charmap. */
/* */
/* offset :: The offset of the charmap relative to the start of */
/* the `cmap' table. */
/* */
/* <Note> */
/* This structure is only used during font loading. */
/* */
typedef struct TT_CMapDirEntryRec_
{
FT_UShort platformID;
FT_UShort platformEncodingID;
FT_Long offset;
} TT_CMapDirEntryRec, *TT_CMapDirEntry;
/*************************************************************************/
/* */
/* <Struct> */
@@ -908,201 +818,6 @@ FT_BEGIN_HEADER
} TT_Post_NamesRec, *TT_Post_Names;
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/*** ***/
/*** ***/
/*** TRUETYPE CHARMAPS SUPPORT ***/
/*** ***/
/*** ***/
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* format 0 */
typedef struct TT_CMap0_
{
FT_ULong language; /* for Mac fonts (originally ushort) */
FT_Byte* glyphIdArray;
} TT_CMap0Rec, *TT_CMap0;
/* format 2 */
typedef struct TT_CMap2SubHeaderRec_
{
FT_UShort firstCode; /* first valid low byte */
FT_UShort entryCount; /* number of valid low bytes */
FT_Short idDelta; /* delta value to glyphIndex */
FT_UShort idRangeOffset; /* offset from here to 1st code */
} TT_CMap2SubHeaderRec, *TT_CMap2SubHeader;
typedef struct TT_CMap2Rec_
{
FT_ULong language; /* for Mac fonts (originally ushort) */
FT_UShort* subHeaderKeys; /* high byte mapping table */
/* value = subHeader index * 8 */
TT_CMap2SubHeader subHeaders;
FT_UShort* glyphIdArray;
FT_UShort numGlyphId; /* control value */
} TT_CMap2Rec, *TT_CMap2;
/* format 4 */
typedef struct TT_CMap4Segment_
{
FT_UShort endCount;
FT_UShort startCount;
FT_Short idDelta;
FT_UShort idRangeOffset;
} TT_CMap4SegmentRec, *TT_CMap4Segment;
typedef struct TT_CMap4Rec_
{
FT_ULong language; /* for Mac fonts (originally ushort) */
FT_UShort segCountX2; /* number of segments * 2 */
FT_UShort searchRange; /* these parameters can be used */
FT_UShort entrySelector; /* for a binary search */
FT_UShort rangeShift;
TT_CMap4Segment segments;
FT_UShort* glyphIdArray;
FT_UShort numGlyphId; /* control value */
TT_CMap4Segment last_segment; /* last used segment; this is a small */
/* cache to potentially increase speed */
} TT_CMap4Rec, *TT_CMap4;
/* format 6 */
typedef struct TT_CMap6_
{
FT_ULong language; /* for Mac fonts (originally ushort) */
FT_UShort firstCode; /* first character code of subrange */
FT_UShort entryCount; /* number of character codes in subrange */
FT_UShort* glyphIdArray;
} TT_CMap6Rec, *TT_CMap6;
/* auxiliary table for format 8 and 12 */
typedef struct TT_CMapGroupRec_
{
FT_ULong startCharCode;
FT_ULong endCharCode;
FT_ULong startGlyphID;
} TT_CMapGroupRec, *TT_CMapGroup;
/* FreeType handles format 8 and 12 identically. It is not necessary to
cover mixed 16bit and 32bit codes since FreeType always uses FT_ULong
for input character codes -- converting Unicode surrogates to 32bit
character codes must be done by the application. */
typedef struct TT_CMap8_12Rec_
{
FT_ULong language; /* for Mac fonts */
FT_ULong nGroups;
TT_CMapGroup groups;
TT_CMapGroup last_group; /* last used group; this is a small */
/* cache to potentially increase speed */
} TT_CMap8_12Rec, *TT_CMap8_12;
/* format 10 */
typedef struct TT_CMap10Rec_
{
FT_ULong language; /* for Mac fonts */
FT_ULong startCharCode; /* first character covered */
FT_ULong numChars; /* number of characters covered */
FT_UShort* glyphs;
} TT_CMap10Rec, *TT_CMap10;
typedef struct TT_CMapTableRec_* TT_CMapTable;
typedef FT_UInt
(*TT_CharMap_Func)( TT_CMapTable charmap,
FT_ULong char_code );
typedef FT_ULong
(*TT_CharNext_Func)( TT_CMapTable charmap,
FT_ULong char_code );
/* charmap table */
typedef struct TT_CMapTableRec_
{
FT_UShort platformID;
FT_UShort platformEncodingID;
FT_UShort format;
FT_ULong length; /* must be ulong for formats 8, 10, and 12 */
FT_Bool loaded;
FT_ULong offset;
union
{
TT_CMap0Rec cmap0;
TT_CMap2Rec cmap2;
TT_CMap4Rec cmap4;
TT_CMap6Rec cmap6;
TT_CMap8_12Rec cmap8_12;
TT_CMap10Rec cmap10;
} c;
TT_CharMap_Func get_index;
TT_CharNext_Func get_next_char;
} TT_CMapTableRec;
/*************************************************************************/
/* */
/* <Struct> */
/* TT_CharMapRec */
/* */
/* <Description> */
/* The TrueType character map object type. */
/* */
/* <Fields> */
/* root :: The parent character map structure. */
/* */
/* cmap :: The used character map. */
/* */
typedef struct TT_CharMapRec_
{
FT_CharMapRec root;
TT_CMapTableRec cmap;
} TT_CharMapRec;
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@@ -1121,9 +836,8 @@ FT_BEGIN_HEADER
/* This structure/class is defined here because it is common to the */
/* following formats: TTF, OpenType-TT, and OpenType-CFF. */
/* */
/* Note, however, that the classes TT_Size, TT_GlyphSlot, and TT_CharMap */
/* are not shared between font drivers, and are thus defined in */
/* `ttobjs.h'. */
/* Note, however, that the classes TT_Size and TT_GlyphSlot are not */
/* shared between font drivers, and are thus defined in `ttobjs.h'. */
/* */
/*************************************************************************/
@@ -1145,17 +859,6 @@ FT_BEGIN_HEADER
typedef struct TT_FaceRec_* TT_Face;
/*************************************************************************/
/* */
/* <Type> */
/* TT_CharMap */
/* */
/* <Description> */
/* A handle to a TrueType character mapping object. */
/* */
typedef struct TT_CharMapRec_* TT_CharMap;
/* a function type used for the truetype bytecode interpreter hooks */
typedef FT_Error
(*TT_Interpreter)( void* exec_context );
@@ -1341,15 +1044,6 @@ FT_BEGIN_HEADER
/* cmap_size :: The size in bytes of the `cmap_table' */
/* described above. */
/* */
/* num_charmaps :: The number of character mappings in the */
/* font. */
/* */
/* charmaps :: The array of charmap objects for this font */
/* file. Note that this field is a typeless */
/* pointer. The Reason is that the format of */
/* charmaps varies with the underlying font */
/* format and cannot be determined here. */
/* */
/* goto_table :: A function called by each TrueType table */
/* loader to position a stream's cursor to */
/* the start of a given table according to */
@@ -1375,10 +1069,9 @@ FT_BEGIN_HEADER
/* It must be called after the header was */
/* read, and before the `forget'. */
/* */
/* sfnt :: A pointer to the SFNT `driver' interface. */
/* sfnt :: A pointer to the SFNT service. */
/* */
/* psnames :: A pointer to the `PSNames' module */
/* interface. */
/* psnames :: A pointer to the PostScript names service. */
/* */
/* hdmx :: The face's horizontal device metrics */
/* (`hdmx' table). This table is optional in */
@@ -1456,6 +1149,9 @@ FT_BEGIN_HEADER
/* interpreters field is also used to hook */
/* the debugger in `ttdebug'. */
/* */
/* unpatented_hinting :: If true, use only unpatented methods in */
/* the bytecode interpreter. */
/* */
/* extra :: Reserved for third-party font drivers. */
/* */
typedef struct TT_FaceRec_
@@ -1494,14 +1190,15 @@ FT_BEGIN_HEADER
TT_Loader_ReadGlyphFunc read_simple_glyph;
TT_Loader_ReadGlyphFunc read_composite_glyph;
/* a typeless pointer to the SFNT_Interface table used to load */
/* the basic TrueType tables in the face object */
/* a typeless pointer to the SFNT_Interface table used to load */
/* the basic TrueType tables in the face object */
void* sfnt;
/* a typeless pointer to the PSNames_Interface table used to */
/* handle glyph names <-> unicode & Mac values */
/* a typeless pointer to the FT_Service_PsCMapsRec table used to */
/* handle glyph names <-> unicode & Mac values */
void* psnames;
/***********************************************************************/
/* */
/* Optional TrueType/OpenType tables */
@@ -1559,6 +1256,10 @@ FT_BEGIN_HEADER
/* used to hook the debugger for the `ttdebug' utility. */
TT_Interpreter interpreter;
#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
/* Use unpatented hinting only. */
FT_Bool unpatented_hinting;
#endif
/***********************************************************************/
/* */
@@ -1569,6 +1270,8 @@ FT_BEGIN_HEADER
FT_Generic extra;
const char* postscript_name;
} TT_FaceRec;
@@ -1639,11 +1342,15 @@ FT_BEGIN_HEADER
FT_BBox bbox;
FT_Int left_bearing;
FT_Int advance;
FT_Int top_bearing;
FT_Int vadvance;
FT_Int linear;
FT_Bool linear_def;
FT_Bool preserve_pps;
FT_Vector pp1;
FT_Vector pp2;
FT_Vector pp3;
FT_Vector pp4;
FT_ULong glyf_offset;
@@ -1666,4 +1373,4 @@ FT_END_HEADER
#endif /* __TTTYPES_H__ */
/* END */
/* END */
+13 -5
View File
@@ -5,7 +5,7 @@
/* Basic Type 1/Type 2 tables definitions and interface (specification */
/* only). */
/* */
/* Copyright 1996-2001, 2002 by */
/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -24,6 +24,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -129,6 +135,8 @@ FT_BEGIN_HEADER
FT_Short snap_widths [13]; /* including std width */
FT_Short snap_heights[13]; /* including std height */
FT_Fixed expansion_factor;
FT_Long language_group;
FT_Long password;
@@ -157,7 +165,7 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* A set of flags used to indicate which fields are present in a */
/* given blen dictionary (font info or private). Used to support */
/* given blend dictionary (font info or private). Used to support */
/* Multiple Masters fonts. */
/* */
typedef enum
@@ -314,7 +322,7 @@ FT_BEGIN_HEADER
/* CID_Info */
/* */
/* <Description> */
/* This type is equivalent to @CID_FaceInfoRec. It is deprecated but */
/* This type is equivalent to CID_FaceInfoRec. It is deprecated but */
/* kept to maintain source compatibility between various versions of */
/* FreeType. */
/* */
@@ -373,7 +381,7 @@ FT_BEGIN_HEADER
* the face and don't need to be freed by the caller.
*
* If the font's format is not Postscript-based, this function will
* return the @FT_Err_Invalid_Argument error code.
* return the FT_Err_Invalid_Argument error code.
*/
FT_EXPORT( FT_Error )
FT_Get_PS_Font_Info( FT_Face face,
@@ -388,4 +396,4 @@ FT_END_HEADER
#endif /* __T1TABLES_H__ */
/* END */
/* END */
+17 -17
View File
@@ -4,7 +4,7 @@
/* */
/* TrueType name ID definitions (specification only). */
/* */
/* Copyright 1996-2002 by */
/* Copyright 1996-2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -41,7 +41,7 @@ FT_BEGIN_HEADER
*
* @description:
* A list of valid values for the `platform_id' identifier code in
* @FT_CharmapRec and @FT_SfntName structures.
* @FT_CharMapRec and @FT_SfntName structures.
*
* @values:
* TT_PLATFORM_APPLE_UNICODE ::
@@ -231,34 +231,33 @@ FT_BEGIN_HEADER
*
* @values:
* TT_MS_ID_SYMBOL_CS ::
* Corresponds to symbol encodings. see @FT_ENCODING_MS_SYMBOL.
* Corresponds to Microsoft symbol encoding. See
* @FT_ENCODING_MS_SYMBOL.
*
* TT_MS_ID_UNICODE_CS ::
* Corresponds to a Microsoft WGL4 charmap, matching Unicode. See
* @FT_ENCODING_UNICODE.
*
* TT_MS_ID_SJIS ::
* Corresponds to Microsoft SJIS Japanese encoding.
* See @FT_ENCODING_MS_SJIS.
* Corresponds to SJIS Japanese encoding. See @FT_ENCODING_SJIS.
*
* TT_MS_ID_GB2312 ::
* Corresponds to Microsoft Simplified Chinese as used in Mainland
* China. See @FT_ENCODING_MS_GB2312.
* Corresponds to Simplified Chinese as used in Mainland China. See
* @FT_ENCODING_GB2312.
*
* TT_MS_ID_BIG_5 ::
* Corresponds to Microsoft Traditional Chinese as used in Taiwan and
* Hong Kong. See @FT_ENCODING_MS_BIG5.
* Corresponds to Traditional Chinese as used in Taiwan and Hong Kong.
* See @FT_ENCODING_BIG5.
*
* TT_MS_ID_WANSUNG ::
* Corresponds to Microsoft Korean Wansung encoding. See
* @FT_ENCODING_MS_WANSUNG.
* Corresponds to Korean Wansung encoding. See @FT_ENCODING_WANSUNG.
*
* TT_MS_ID_JOHAB ::
* Corresponds to Microsoft Johab encoding. See @FT_ENCODING_MS_JOHAB.
* Corresponds to Johab encoding. See @FT_ENCODING_JOHAB.
*
* TT_MS_ID_UCS_4 ::
* Corresponds to UCS-4 or UTF-32 charmaps. This has been added into
* OpenType specification as of version 1.4 (mid-2001.)
* Corresponds to UCS-4 or UTF-32 charmaps. This has been added to
* the OpenType specification version 1.4 (mid-2001.)
*/
#define TT_MS_ID_SYMBOL_CS 0
@@ -292,6 +291,7 @@ FT_BEGIN_HEADER
#define TT_ADOBE_ID_STANDARD 0
#define TT_ADOBE_ID_EXPERT 1
#define TT_ADOBE_ID_CUSTOM 2
#define TT_ADOBE_ID_LATIN_1 3
/*************************************************************************/
@@ -705,8 +705,8 @@ FT_BEGIN_HEADER
#define TT_MS_LANGID_SPANISH_UNITED_STATES 0x540a
/* The following two IDs blatantly violate MS specs by using a */
/* sublanguage > 0x1F. */
#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40a
#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40c
#define TT_MS_LANGID_SPANISH_LATIN_AMERICA 0xE40aU
#define TT_MS_LANGID_FRENCH_NORTH_AFRICA 0xE40cU
#define TT_MS_LANGID_FRENCH_MOROCCO 0x380c
#define TT_MS_LANGID_FRENCH_HAITI 0x3c0c
@@ -1073,4 +1073,4 @@ FT_END_HEADER
#endif /* __TTNAMEID_H__ */
/* END */
/* END */
+65 -32
View File
@@ -5,7 +5,7 @@
/* Basic SFNT/TrueType tables definitions and interface */
/* (specification only). */
/* */
/* Copyright 1996-2001 by */
/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -24,6 +24,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -541,8 +547,15 @@ FT_BEGIN_HEADER
} TT_MaxProfile;
/* */
/*************************************************************************/
/* */
/* <Enum> */
/* FT_Sfnt_Tag */
/* */
/* <Description> */
/* An enumeration used to specify the index of an SFNT table. */
/* Used in the @FT_Get_Sfnt_Table API function. */
/* */
typedef enum
{
ft_sfnt_head = 0,
@@ -553,15 +566,11 @@ FT_BEGIN_HEADER
ft_sfnt_post = 5,
ft_sfnt_pclt = 6,
sfnt_max /* don't remove */
sfnt_max /* internal end mark */
} FT_Sfnt_Tag;
/* internal use only */
typedef void*
(*FT_Get_Sfnt_Table_Func)( FT_Face face,
FT_Sfnt_Tag tag );
/* */
/*************************************************************************/
@@ -586,13 +595,14 @@ FT_BEGIN_HEADER
/* The table is owned by the face object and disappears with it. */
/* */
/* This function is only useful to access SFNT tables that are loaded */
/* by the sfnt/truetype/opentype drivers. See FT_Sfnt_Tag for a */
/* by the sfnt/truetype/opentype drivers. See @FT_Sfnt_Tag for a */
/* list. */
/* */
FT_EXPORT( void* )
FT_Get_Sfnt_Table( FT_Face face,
FT_Sfnt_Tag tag );
/**************************************************************************
*
* <Function>
@@ -602,54 +612,77 @@ FT_BEGIN_HEADER
* Loads any font table into client memory.
*
* <Input>
* face :: handle to source face.
* tag :: the 4-byte tag of the table to load. Use the value 0 if
* you want to access the whole font file. Else, you can use
* one of the definitions found in the @FT_TRUETYPE_TAGS_H
* file, or forge a new one with @FT_MAKE_TAG
* face :: A handle to the source face.
*
* tag :: The 4-byte tag of the table to load. Use the value 0 if
* you want to access the whole font file. Otherwise, you can
* use one of the definitions found in the @FT_TRUETYPE_TAGS_H
* file, or forge a new one with @FT_MAKE_TAG.
*
* offset :: the starting offset in the table (or file if tag == 0)
* offset :: The starting offset in the table (or file if tag == 0).
*
* <Output>
* buffer :: target buffer address. client must ensure that there are
* enough bytes in it.
* buffer :: The target buffer address. The client must ensure that
* the memory array is big enough to hold the data.
*
* <InOut>
* length :: if the 'length' parameter is NULL, then try to load the whole
* table, and return an error code if it fails.
* length :: If the `length' parameter is NULL, then try to load the whole
* table. Return an error code if it fails.
*
* else, if '*length' is 0, then exit immediately while returning
* Else, if `*length' is 0, exit immediately while returning
* the table's (or file) full size in it.
*
* else, the number of bytes to read from the table or file,
* Else the number of bytes to read from the table or file,
* from the starting offset.
*
* <Return>
* error code. 0 means success
* FreeType error code. 0 means success.
*
* <Note>
* if you need to determine the table's length you should first call this
* function with "*length" set to 0, as in the following example:
* If you need to determine the table's length you should first call this
* function with `*length' set to 0, as in the following example:
*
* {
* FT_ULong length = 0;
*
*
* error = FT_Load_Sfnt_Table( face, tag, 0, NULL, &length );
* if ( error ) { ... table does not exist ... }
*
* buffer = malloc( length );
* if ( buffer == NULL ) { ... not enough memory ... }
* if ( buffer == NULL ) { ... not enough memory ... }
*
* error = FT_Load_Sfnt_Table( face,tag, 0, buffer, &length );
* if ( error ) { ... could not load table ... }
* }
*/
FT_EXPORT( FT_Error )
FT_Load_Sfnt_Table( FT_Face face,
FT_ULong tag,
FT_Long offset,
FT_Byte* buffer,
FT_ULong* length );
FT_Load_Sfnt_Table( FT_Face face,
FT_ULong tag,
FT_Long offset,
FT_Byte* buffer,
FT_ULong* length );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_CMap_Language_ID */
/* */
/* <Description> */
/* Return TrueType/sfnt specific cmap language ID. Definitions of */
/* language ID values are in freetype/ttnameid.h. */
/* */
/* <Input> */
/* charmap :: */
/* The target charmap. */
/* */
/* <Return> */
/* The language ID of `charmap'. If `charmap' doesn't belong to a */
/* TrueType/sfnt face, just return 0 as the default value. */
/* */
FT_EXPORT( FT_ULong )
FT_Get_CMap_Language_ID( FT_CharMap charmap );
/* */
@@ -659,4 +692,4 @@ FT_END_HEADER
#endif /* __TTTABLES_H__ */
/* END */
/* END */
+7 -1
View File
@@ -23,6 +23,12 @@
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
@@ -71,4 +77,4 @@ FT_END_HEADER
#endif /* __TTAGS_H__ */
/* END */
/* END */
+59
View File
@@ -0,0 +1,59 @@
/***************************************************************************/
/* */
/* ttunpat.h */
/* */
/* Definitions for the unpatented TrueType hinting system */
/* */
/* Copyright 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* Written by Graham Asher <[email protected]> */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifndef __TTUNPAT_H__
#define __TTUNPAT_H__
#include <ft2build.h>
#include FT_FREETYPE_H
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/***************************************************************************
*
* @constant:
* FT_PARAM_TAG_UNPATENTED_HINTING
*
* @description:
* A constant used as the tag of an @FT_Parameter structure to indicate
* that unpatented methods only should be used by the TrueType bytecode
* interpreter for a typeface opened by FT_Open_Face.
*
*/
#define FT_PARAM_TAG_UNPATENTED_HINTING FT_MAKE_TAG( 'u', 'n', 'p', 'a' )
/* */
FT_END_HEADER
#endif /* __TTUNPAT_H__ */
/* END */
+39 -39
View File
@@ -1,39 +1,39 @@
/***************************************************************************/
/* */
/* ft2build.h */
/* */
/* FreeType 2 build and setup macros. */
/* (Generic version) */
/* */
/* Copyright 1996-2001 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. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file corresponds to the default "ft2build.h" file for */
/* FreeType 2. It uses the "freetype" include root. */
/* */
/* Note that specific platforms might use a different configuration. */
/* See builds/unix/ft2unix.h for an example. */
/* */
/*************************************************************************/
#ifndef __FT2_BUILD_GENERIC_H__
#define __FT2_BUILD_GENERIC_H__
#include <freetype/config/ftheader.h>
#endif /* __FT2_BUILD_GENERIC_H__ */
/* END */
/***************************************************************************/
/* */
/* ft2build.h */
/* */
/* FreeType 2 build and setup macros. */
/* (Generic version) */
/* */
/* Copyright 1996-2001 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. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* This file corresponds to the default "ft2build.h" file for */
/* FreeType 2. It uses the "freetype" include root. */
/* */
/* Note that specific platforms might use a different configuration. */
/* See builds/unix/ft2unix.h for an example. */
/* */
/*************************************************************************/
#ifndef __FT2_BUILD_GENERIC_H__
#define __FT2_BUILD_GENERIC_H__
#include <freetype/config/ftheader.h>
#endif /* __FT2_BUILD_GENERIC_H__ */
/* END */
+24
View File
@@ -0,0 +1,24 @@
# FreeType 2 src/autofit Jamfile (c) 2001 David Turner
#
SubDir OBOS_TOP src libs freetype2 autofit ;
UseFreeTypeHeaders ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = autofit afmodule afloader aflatin afhints afglobal afdummy afangles ;
}
else
{
_sources = autofit ;
}
FT2_Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/autofit Jamfile
+214
View File
@@ -0,0 +1,214 @@
#include "aftypes.h"
/* this table was generated for AF_ANGLE_PI = 256 */
#define AF_ANGLE_MAX_ITERS 8
#define AF_TRIG_MAX_ITERS 9
static const FT_Fixed
af_angle_arctan_table[9] =
{
90, 64, 38, 20, 10, 5, 3, 1, 1
};
static FT_Int
af_angle_prenorm( FT_Vector* vec )
{
FT_Fixed x, y, z;
FT_Int shift;
x = vec->x;
y = vec->y;
z = ( ( x >= 0 ) ? x : - x ) | ( (y >= 0) ? y : -y );
shift = 0;
if ( z < ( 1L << 27 ) )
{
do
{
shift++;
z <<= 1;
} while ( z < ( 1L << 27 ) );
vec->x = x << shift;
vec->y = y << shift;
}
else if ( z > ( 1L << 28 ) )
{
do
{
shift++;
z >>= 1;
} while ( z > ( 1L << 28 ) );
vec->x = x >> shift;
vec->y = y >> shift;
shift = -shift;
}
return shift;
}
static void
af_angle_pseudo_polarize( FT_Vector* vec )
{
FT_Fixed theta;
FT_Fixed yi, i;
FT_Fixed x, y;
const FT_Fixed *arctanptr;
x = vec->x;
y = vec->y;
/* Get the vector into the right half plane */
theta = 0;
if ( x < 0 )
{
x = -x;
y = -y;
theta = 2 * AF_ANGLE_PI2;
}
if ( y > 0 )
theta = - theta;
arctanptr = af_angle_arctan_table;
if ( y < 0 )
{
/* Rotate positive */
yi = y + ( x << 1 );
x = x - ( y << 1 );
y = yi;
theta -= *arctanptr++; /* Subtract angle */
}
else
{
/* Rotate negative */
yi = y - ( x << 1 );
x = x + ( y << 1 );
y = yi;
theta += *arctanptr++; /* Add angle */
}
i = 0;
do
{
if ( y < 0 )
{
/* Rotate positive */
yi = y + ( x >> i );
x = x - ( y >> i );
y = yi;
theta -= *arctanptr++;
}
else
{
/* Rotate negative */
yi = y - ( x >> i );
x = x + ( y >> i );
y = yi;
theta += *arctanptr++;
}
} while ( ++i < AF_TRIG_MAX_ITERS );
/* round theta */
if ( theta >= 0 )
theta = FT_PAD_ROUND( theta, 4 );
else
theta = - FT_PAD_ROUND( theta, 4 );
vec->x = x;
vec->y = theta;
}
/* documentation is in fttrigon.h */
FT_LOCAL_DEF( AF_Angle )
af_angle_atan( FT_Fixed dx,
FT_Fixed dy )
{
FT_Vector v;
if ( dx == 0 && dy == 0 )
return 0;
v.x = dx;
v.y = dy;
af_angle_prenorm( &v );
af_angle_pseudo_polarize( &v );
return v.y;
}
FT_LOCAL_DEF( AF_Angle )
af_angle_diff( AF_Angle angle1,
AF_Angle angle2 )
{
AF_Angle delta = angle2 - angle1;
delta %= AF_ANGLE_2PI;
if ( delta < 0 )
delta += AF_ANGLE_2PI;
if ( delta > AF_ANGLE_PI )
delta -= AF_ANGLE_2PI;
return delta;
}
/* well, this needs to be somewhere, right :-)
*/
FT_LOCAL_DEF( void )
af_sort_pos( FT_UInt count,
FT_Pos* table )
{
FT_UInt i, j;
FT_Pos swap;
for ( i = 1; i < count; i++ )
{
for ( j = i; j > 0; j-- )
{
if ( table[j] > table[j - 1] )
break;
swap = table[j];
table[j] = table[j - 1];
table[j - 1] = swap;
}
}
}
FT_LOCAL_DEF( void )
af_sort_widths( FT_UInt count,
AF_Width table )
{
FT_UInt i, j;
AF_WidthRec swap;
for ( i = 1; i < count; i++ )
{
for ( j = i; j > 0; j-- )
{
if ( table[j].org > table[j - 1].org )
break;
swap = table[j];
table[j] = table[j - 1];
table[j - 1] = swap;
}
}
}
+35
View File
@@ -0,0 +1,35 @@
#include "afdummy.h"
static FT_Error
af_dummy_hints_init( AF_GlyphHints hints,
FT_Outline* outline,
AF_ScriptMetrics metrics )
{
return af_glyph_hints_reset( hints,
&metrics->scaler,
metrics,
outline );
}
static FT_Error
af_dummy_hints_apply( AF_GlyphHints hints,
FT_Outline* outline )
{
af_glyph_hints_save( hints, outline );
}
FT_LOCAL_DEF( const AF_ScriptClassRec ) af_dummy_script_class =
{
AF_SCRIPT_NONE,
NULL,
sizeof( AF_ScriptMetricsRec ),
(AF_Script_InitMetricsFunc) NULL,
(AF_Script_ScaleMetricsFunc) NULL,
(AF_Script_DoneMetricsFunc) NULL,
(AF_Script_InitHintsFunc) af_dummy_hints_init,
(AF_Script_ApplyHintsFunc) af_dummy_hints_apply
};
+18
View File
@@ -0,0 +1,18 @@
#ifndef __AFDUMMY_H__
#define __AFDUMMY_H__
#include "aftypes.h"
FT_BEGIN_HEADER
/* a dummy script metrics class used when no hinting should
* be performed. This is the default for non-latin glyphs !
*/
FT_LOCAL( const AF_ScriptClassRec ) af_dummy_script_class;
/* */
FT_END_HEADER
#endif /* __AFDUMMY_H__ */
+236
View File
@@ -0,0 +1,236 @@
#include "afglobal.h"
#include "afdummy.h"
#include "aflatin.h"
/* populate this list when you add new scripts
*/
static AF_ScriptClass const af_script_classes[] =
{
& af_dummy_script_class,
& af_latin_script_class,
NULL /* do not remove */
};
#define AF_SCRIPT_LIST_DEFAULT 0 /* index of default script in 'af_script_classes' */
#define AF_SCRIPT_LIST_NONE 255 /* indicates an uncovered glyph */
/*
* note that glyph_scripts[] is used to map each glyph into
* an index into the 'af_script_classes' array.
*
*/
typedef struct AF_FaceGlobalsRec_
{
FT_Face face;
FT_UInt glyph_count; /* same as face->num_glyphs */
FT_Byte* glyph_scripts;
AF_ScriptMetrics metrics[ AF_SCRIPT_MAX ];
} AF_FaceGlobalsRec;
/* this function is used to compute the script index of each glyph
* within a given face
*/
static FT_Error
af_face_globals_compute_script_coverage( AF_FaceGlobals globals )
{
FT_Error error = 0;
FT_Face face = globals->face;
FT_CharMap old_charmap = face->charmap;
FT_Byte* gscripts = globals->glyph_scripts;
FT_UInt ss;
/* the value 255 means "uncovered glyph"
*/
FT_MEM_SET( globals->glyph_scripts,
AF_SCRIPT_LIST_NONE,
globals->glyph_count );
error = FT_Select_Charmap( face, FT_ENCODING_UNICODE );
if ( error )
{
/* ignore this error, we'll simply use Latin as the standard
* script. XXX: Shouldn't we rather disable hinting ??
*/
error = 0;
goto Exit;
}
/* scan each script in a Unicode charmap
*/
for ( ss = 0; af_script_classes[ss]; ss++ )
{
AF_ScriptClass clazz = af_script_classes[ss];
AF_Script_UniRange range;
if ( clazz->script_uni_ranges == NULL )
continue;
/* scan all unicode points in the range, and set the corresponding
* glyph script index
*/
for ( range = clazz->script_uni_ranges; range->first != 0; range++ )
{
FT_ULong charcode = range->first;
FT_UInt gindex;
gindex = FT_Get_Char_Index( face, charcode );
if ( gindex != 0 &&
gindex < globals->glyph_count &&
gscripts[ gindex ] == AF_SCRIPT_LIST_NONE )
{
gscripts[ gindex ] = (FT_Byte) ss;
}
for (;;)
{
charcode = FT_Get_Next_Char( face, charcode, &gindex );
if ( gindex == 0 || charcode > range->last )
break;
if ( gindex < globals->glyph_count &&
gscripts[ gindex ] == AF_SCRIPT_LIST_NONE )
{
gscripts[ gindex ] = (FT_Byte) ss;
}
}
}
}
Exit:
/* by default, all uncovered glyphs are set to the latin script
* XXX: shouldnt' we disable hinting or do something similar ?
*/
{
FT_UInt nn;
for ( nn = 0; nn < globals->glyph_count; nn++ )
{
if ( gscripts[ nn ] == AF_SCRIPT_LIST_NONE )
gscripts[ nn ] = AF_SCRIPT_LIST_DEFAULT;
}
}
FT_Set_Charmap( face, old_charmap );
return error;
}
FT_LOCAL_DEF( FT_Error )
af_face_globals_new( FT_Face face,
AF_FaceGlobals *aglobals )
{
FT_Error error;
FT_Memory memory;
AF_FaceGlobals globals;
memory = face->memory;
if ( !FT_ALLOC( globals, sizeof(*globals) +
face->num_glyphs*sizeof(FT_Byte) ) )
{
globals->face = face;
globals->glyph_count = face->num_glyphs;
globals->glyph_scripts = (FT_Byte*)( globals+1 );
error = af_face_globals_compute_script_coverage( globals );
if ( error )
{
af_face_globals_free( globals );
globals = NULL;
}
}
*aglobals = globals;
return error;
}
FT_LOCAL_DEF( void )
af_face_globals_free( AF_FaceGlobals globals )
{
if ( globals )
{
FT_Memory memory = globals->face->memory;
FT_UInt nn;
for ( nn = 0; nn < AF_SCRIPT_MAX; nn++ )
{
if ( globals->metrics[nn] )
{
AF_ScriptClass clazz = af_script_classes[nn];
FT_ASSERT( globals->metrics[nn]->clazz == clazz );
if ( clazz->script_metrics_done )
clazz->script_metrics_done( globals->metrics[nn] );
FT_FREE( globals->metrics[nn] );
}
}
globals->glyph_count = 0;
globals->glyph_scripts = NULL; /* no need to free this one !! */
globals->face = NULL;
FT_FREE( globals );
}
}
FT_LOCAL_DEF( FT_Error )
af_face_globals_get_metrics( AF_FaceGlobals globals,
FT_UInt gindex,
AF_ScriptMetrics *ametrics )
{
AF_ScriptMetrics metrics = NULL;
FT_UInt index;
AF_ScriptClass clazz;
FT_Error error = 0;
if ( gindex >= globals->glyph_count )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
index = globals->glyph_scripts[ gindex ];
clazz = af_script_classes[ index ];
metrics = globals->metrics[ clazz->script ];
if ( metrics == NULL )
{
/* create the global metrics object when needed
*/
FT_Memory memory = globals->face->memory;
if ( FT_ALLOC( metrics, clazz->script_metrics_size ) )
goto Exit;
metrics->clazz = clazz;
if ( clazz->script_metrics_init )
{
error = clazz->script_metrics_init( metrics, globals->face );
if ( error )
{
if ( clazz->script_metrics_done )
clazz->script_metrics_done( metrics );
FT_FREE( metrics );
goto Exit;
}
}
globals->metrics[ clazz->script ] = metrics;
}
Exit:
*ametrics = metrics;
return error;
}
+41
View File
@@ -0,0 +1,41 @@
#ifndef __AF_GLOBAL_H__
#define __AF_GLOBAL_H__
#include "aftypes.h"
FT_BEGIN_HEADER
/**************************************************************************/
/**************************************************************************/
/***** *****/
/***** F A C E G L O B A L S *****/
/***** *****/
/**************************************************************************/
/**************************************************************************/
/*
* models the global hints data for a given face, decomposed into
* script-specific items..
*
*/
typedef struct AF_FaceGlobalsRec_* AF_FaceGlobals;
FT_LOCAL( FT_Error )
af_face_globals_new( FT_Face face,
AF_FaceGlobals *aglobals );
FT_LOCAL( FT_Error )
af_face_globals_get_metrics( AF_FaceGlobals globals,
FT_UInt gindex,
AF_ScriptMetrics *ametrics );
FT_LOCAL( void )
af_face_globals_free( AF_FaceGlobals globals );
/* */
FT_END_HEADER
#endif /* __AF_GLOBALS_H__ */
+986
View File
@@ -0,0 +1,986 @@
#include "afhints.h"
#ifdef AF_DEBUG
#include <stdio.h>
static const char* af_dir_str( AF_Direction dir )
{
const char* result;
switch (dir)
{
case AF_DIR_UP: result = "up"; break;
case AF_DIR_DOWN: result = "down"; break;
case AF_DIR_LEFT: result = "left"; break;
case AF_DIR_RIGHT: result = "right"; break;
default: result = "none";
}
return result;
}
#define AF_INDEX_NUM(ptr,base) ( (ptr) ? ((ptr)-(base)) : -1 )
void
af_glyph_hints_dump_points( AF_GlyphHints hints )
{
AF_Point points = hints->points;
AF_Point limit = points + hints->num_points;
AF_Point point;
printf( "Table of points:\n" );
printf( " [ index | xorg | yorg | xscale | yscale | xfit | yfit | flags ]\n" );
for ( point = points; point < limit; point++ )
{
printf( " [ %5d | %5d | %5d | %-5.2f | %-5.2f | %-5.2f | %-5.2f | %c%c%c%c%c%c ]\n",
point - points,
point->fx,
point->fy,
point->ox/64.0,
point->oy/64.0,
point->x/64.0,
point->y/64.0,
(point->flags & AF_FLAG_WEAK_INTERPOLATION) ? 'w' : ' ',
(point->flags & AF_FLAG_INFLECTION) ? 'i' : ' ',
(point->flags & AF_FLAG_EXTREMA_X) ? '<' : ' ',
(point->flags & AF_FLAG_EXTREMA_Y) ? 'v' : ' ',
(point->flags & AF_FLAG_ROUND_X) ? '(' : ' ',
(point->flags & AF_FLAG_ROUND_Y) ? 'u' : ' '
);
}
printf( "\n" );
}
/* A function used to dump the array of linked segments */
void
af_glyph_hints_dump_segments( AF_GlyphHints hints )
{
AF_Point points = hints->points;
FT_Int dimension;
for ( dimension = 1; dimension >= 0; dimension-- )
{
AF_AxisHints axis = &hints->axis[dimension];
AF_Segment segments = axis->segments;
AF_Segment limit = segments + axis->num_segments;
AF_Segment seg;
printf ( "Table of %s segments:\n",
dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" );
printf ( " [ index | pos | dir | link | serif |"
" numl | first | start ]\n" );
for ( seg = segments; seg < limit; seg++ )
{
printf ( " [ %5d | %4d | %5s | %4d | %5d | %4d | %5d | %5d ]\n",
seg - segments,
(int)seg->pos,
af_dir_str( seg->dir ),
AF_INDEX_NUM( seg->link, segments ),
AF_INDEX_NUM( seg->serif, segments ),
(int)seg->num_linked,
seg->first - points,
seg->last - points );
}
printf( "\n" );
}
}
void
af_glyph_hints_dump_edges( AF_GlyphHints hints )
{
FT_Int dimension;
for ( dimension = 1; dimension >= 0; dimension-- )
{
AF_AxisHints axis = &hints->axis[ dimension ];
AF_Edge edges = axis->edges;
AF_Edge limit = edges + axis->num_edges;
AF_Edge edge;
/* note: AF_DIMENSION_HORZ corresponds to _vertical_ edges
* since they have constant X coordinate
*/
printf ( "Table of %s edges:\n",
dimension == AF_DIMENSION_HORZ ? "vertical" : "horizontal" );
printf ( " [ index | pos | dir | link |"
" serif | blue | opos | pos ]\n" );
for ( edge = edges; edge < limit; edge++ )
{
printf ( " [ %5d | %4d | %5s | %4d | %5d | %c | %5.2f | %5.2f ]\n",
edge - edges,
(int)edge->fpos,
af_dir_str( edge->dir ),
AF_INDEX_NUM( edge->link, edges ),
AF_INDEX_NUM( edge->serif, edges ),
edge->blue_edge ? 'y' : 'n',
edge->opos / 64.0,
edge->pos / 64.0 );
}
printf( "\n" );
}
}
#endif /* AF_DEBUG */
/* compute the direction value of a given vector */
FT_LOCAL_DEF( AF_Direction )
af_direction_compute( FT_Pos dx,
FT_Pos dy )
{
AF_Direction dir;
FT_Pos ax = FT_ABS( dx );
FT_Pos ay = FT_ABS( dy );
dir = AF_DIR_NONE;
/* atan(1/12) == 4.7 degrees */
/* test for vertical direction */
if ( ax * 12 < ay )
{
dir = dy > 0 ? AF_DIR_UP : AF_DIR_DOWN;
}
/* test for horizontal direction */
else if ( ay * 12 < ax )
{
dir = dx > 0 ? AF_DIR_RIGHT : AF_DIR_LEFT;
}
return dir;
}
/* compute all inflex points in a given glyph */
static void
af_glyph_hints_compute_inflections( AF_GlyphHints hints )
{
AF_Point* contour = hints->contours;
AF_Point* contour_limit = contour + hints->num_contours;
/* do each contour separately */
for ( ; contour < contour_limit; contour++ )
{
AF_Point point = contour[0];
AF_Point first = point;
AF_Point start = point;
AF_Point end = point;
AF_Point before;
AF_Point after;
AF_Angle angle_in, angle_seg, angle_out;
AF_Angle diff_in, diff_out;
FT_Int finished = 0;
/* compute first segment in contour */
first = point;
start = end = first;
do
{
end = end->next;
if ( end == first )
goto Skip;
} while ( end->fx == first->fx && end->fy == first->fy );
angle_seg = af_angle_atan( end->fx - start->fx,
end->fy - start->fy );
/* extend the segment start whenever possible */
before = start;
do
{
do
{
start = before;
before = before->prev;
if ( before == first )
goto Skip;
} while ( before->fx == start->fx && before->fy == start->fy );
angle_in = af_angle_atan( start->fx - before->fx,
start->fy - before->fy );
} while ( angle_in == angle_seg );
first = start;
diff_in = af_angle_diff( angle_in, angle_seg );
/* now, process all segments in the contour */
do
{
/* first, extend current segment's end whenever possible */
after = end;
do
{
do
{
end = after;
after = after->next;
if ( after == first )
finished = 1;
} while ( end->fx == after->fx && end->fy == after->fy );
angle_out = af_angle_atan( after->fx - end->fx,
after->fy - end->fy );
} while ( angle_out == angle_seg );
diff_out = af_angle_diff( angle_seg, angle_out );
if ( ( diff_in ^ diff_out ) < 0 )
{
/* diff_in and diff_out have different signs, we have */
/* inflection points here... */
do
{
start->flags |= AF_FLAG_INFLECTION;
start = start->next;
} while ( start != end );
start->flags |= AF_FLAG_INFLECTION;
}
start = end;
end = after;
angle_seg = angle_out;
diff_in = diff_out;
} while ( !finished );
Skip:
;
}
}
FT_LOCAL_DEF( void )
af_glyph_hints_init( AF_GlyphHints hints,
FT_Memory memory )
{
FT_ZERO( hints );
hints->memory = memory;
}
FT_LOCAL_DEF( void )
af_glyph_hints_done( AF_GlyphHints hints )
{
if ( hints && hints->memory )
{
FT_Memory memory = hints->memory;
AF_Dimension dim;
/* note that we don't need to free the segment and edge
* buffers, since they're really within the hints->points array
*/
for ( dim = 0; dim < 2; dim++ )
{
AF_AxisHints axis = &hints->axis[ dim ];
axis->num_segments = 0;
axis->num_edges = 0;
axis->segments = NULL;
axis->edges = NULL;
}
FT_FREE( hints->contours );
hints->max_contours = 0;
hints->num_contours = 0;
FT_FREE( hints->points );
hints->num_points = 0;
hints->max_points = 0;
hints->memory = NULL;
}
}
FT_LOCAL_DEF( FT_Error )
af_glyph_hints_reset( AF_GlyphHints hints,
AF_Scaler scaler,
AF_ScriptMetrics metrics,
FT_Outline* outline )
{
FT_Error error = FT_Err_Ok;
AF_Point points;
FT_UInt old_max, new_max;
FT_Fixed x_scale = scaler->x_scale;
FT_Fixed y_scale = scaler->y_scale;
FT_Pos x_delta = scaler->x_delta;
FT_Pos y_delta = scaler->y_delta;
FT_Memory memory = hints->memory;
hints->metrics = metrics;
hints->scaler_flags = scaler->flags;
hints->other_flags = 0;
hints->num_points = 0;
hints->num_contours = 0;
hints->axis[0].num_segments = 0;
hints->axis[0].num_edges = 0;
hints->axis[1].num_segments = 0;
hints->axis[1].num_edges = 0;
/* first of all, reallocate the contours array when necessary
*/
new_max = (FT_UInt) outline->n_contours;
old_max = hints->max_contours;
if ( new_max > old_max )
{
new_max = (new_max + 3) & ~3;
if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) )
goto Exit;
hints->max_contours = new_max;
}
/* then, reallocate the points, segments & edges arrays if needed --
* note that we reserved two additional point positions, used to
* hint metrics appropriately
*/
new_max = (FT_UInt)( outline->n_points + 2 );
old_max = hints->max_points;
if ( new_max > old_max )
{
FT_Byte* items;
FT_ULong off1, off2, off3;
/* we store in a single buffer the following arrays:
*
* - an array of N AF_PointRec items
* - an array of 2*N AF_SegmentRec items
* - an array of 2*N AF_EdgeRec items
*
*/
new_max = ( new_max + 2 + 7 ) & ~7;
#define OFF_PAD2(x,y) (((x)+(y)-1) & ~((y)-1))
#define OFF_PADX(x,y) ((((x)+(y)-1)/(y))*(y))
#define OFF_PAD(x,y) ( ((y) & ((y)-1)) ? OFF_PADX(x,y) : OFF_PAD2(x,y) )
#undef OFF_INCREMENT
#define OFF_INCREMENT( _off, _type, _count ) \
( OFF_PAD( _off, sizeof(_type) ) + (_count)*sizeof(_type))
off1 = OFF_INCREMENT( 0, AF_PointRec, new_max );
off2 = OFF_INCREMENT( off1, AF_SegmentRec, new_max*2 );
off3 = OFF_INCREMENT( off2, AF_EdgeRec, new_max*2 );
FT_FREE( hints->points );
if ( FT_ALLOC( items, off3 ) )
{
hints->max_points = 0;
hints->axis[0].segments = NULL;
hints->axis[0].edges = NULL;
hints->axis[1].segments = NULL;
hints->axis[1].edges = NULL;
goto Exit;
}
/* readjust some pointers
*/
hints->max_points = new_max;
hints->points = (AF_Point) items;
hints->axis[0].segments = (AF_Segment)( items + off1 );
hints->axis[1].segments = hints->axis[0].segments + new_max;
hints->axis[0].edges = (AF_Edge) ( items + off2 );
hints->axis[1].edges = hints->axis[0].edges + new_max;
}
hints->num_points = outline->n_points;
hints->num_contours = outline->n_contours;
/* We can't rely on the value of `FT_Outline.flags' to know the fill */
/* direction used for a glyph, given that some fonts are broken (e.g. */
/* the Arphic ones). We thus recompute it each time we need to. */
/* */
hints->axis[ AF_DIMENSION_HORZ ].major_dir = AF_DIR_UP;
hints->axis[ AF_DIMENSION_VERT ].major_dir = AF_DIR_LEFT;
if ( FT_Outline_Get_Orientation( outline ) == FT_ORIENTATION_POSTSCRIPT )
{
hints->axis[ AF_DIMENSION_HORZ ].major_dir = AF_DIR_DOWN;
hints->axis[ AF_DIMENSION_VERT ].major_dir = AF_DIR_RIGHT;
}
hints->x_scale = x_scale;
hints->y_scale = y_scale;
hints->x_delta = x_delta;
hints->y_delta = y_delta;
points = hints->points;
if ( hints->num_points == 0 )
goto Exit;
{
AF_Point point;
AF_Point point_limit = points + hints->num_points;
/* compute coordinates & bezier flags */
{
FT_Vector* vec = outline->points;
char* tag = outline->tags;
for ( point = points; point < point_limit; point++, vec++, tag++ )
{
point->fx = vec->x;
point->fy = vec->y;
point->ox = point->x = FT_MulFix( vec->x, x_scale ) + x_delta;
point->oy = point->y = FT_MulFix( vec->y, y_scale ) + y_delta;
switch ( FT_CURVE_TAG( *tag ) )
{
case FT_CURVE_TAG_CONIC:
point->flags = AF_FLAG_CONIC;
break;
case FT_CURVE_TAG_CUBIC:
point->flags = AF_FLAG_CUBIC;
break;
default:
point->flags = 0;
;
}
}
}
/* compute `next' and `prev' */
{
FT_Int contour_index;
AF_Point prev;
AF_Point first;
AF_Point end;
contour_index = 0;
first = points;
end = points + outline->contours[0];
prev = end;
for ( point = points; point < point_limit; point++ )
{
point->prev = prev;
if ( point < end )
{
point->next = point + 1;
prev = point;
}
else
{
point->next = first;
contour_index++;
if ( point + 1 < point_limit )
{
end = points + outline->contours[contour_index];
first = point + 1;
prev = end;
}
}
}
}
/* set-up the contours array */
{
AF_Point* contour = hints->contours;
AF_Point* contour_limit = contour + hints->num_contours;
short* end = outline->contours;
short idx = 0;
for ( ; contour < contour_limit; contour++, end++ )
{
contour[0] = points + idx;
idx = (short)( end[0] + 1 );
}
}
/* compute directions of in & out vectors */
{
for ( point = points; point < point_limit; point++ )
{
AF_Point prev;
AF_Point next;
FT_Pos in_x, in_y, out_x, out_y;
prev = point->prev;
in_x = point->fx - prev->fx;
in_y = point->fy - prev->fy;
point->in_dir = af_direction_compute( in_x, in_y );
next = point->next;
out_x = next->fx - point->fx;
out_y = next->fy - point->fy;
point->out_dir = af_direction_compute( out_x, out_y );
if ( point->flags & ( AF_FLAG_CONIC | AF_FLAG_CUBIC ) )
{
Is_Weak_Point:
point->flags |= AF_FLAG_WEAK_INTERPOLATION;
}
else if ( point->out_dir == point->in_dir )
{
AF_Angle angle_in, angle_out, delta;
if ( point->out_dir != AF_DIR_NONE )
goto Is_Weak_Point;
angle_in = af_angle_atan( in_x, in_y );
angle_out = af_angle_atan( out_x, out_y );
delta = af_angle_diff( angle_in, angle_out );
if ( delta < 2 && delta > -2 )
goto Is_Weak_Point;
}
else if ( point->in_dir == -point->out_dir )
goto Is_Weak_Point;
}
}
}
/* compute inflection points
*/
af_glyph_hints_compute_inflections( hints );
Exit:
return error;
}
FT_LOCAL_DEF( void )
af_glyph_hints_save( AF_GlyphHints hints,
FT_Outline* outline )
{
AF_Point point = hints->points;
AF_Point limit = point + hints->num_points;
FT_Vector* vec = outline->points;
char* tag = outline->tags;
for ( ; point < limit; point++, vec++, tag++ )
{
vec->x = (FT_Pos) point->x;
vec->y = (FT_Pos) point->y;
if ( point->flags & AF_FLAG_CONIC )
tag[0] = FT_CURVE_TAG_CONIC;
else if ( point->flags & AF_FLAG_CUBIC )
tag[0] = FT_CURVE_TAG_CUBIC;
else
tag[0] = FT_CURVE_TAG_ON;
}
}
/*
*
* E D G E P O I N T G R I D - F I T T I N G
*
*/
FT_LOCAL_DEF( void )
af_glyph_hints_align_edge_points( AF_GlyphHints hints,
AF_Dimension dim )
{
AF_AxisHints axis = & hints->axis[ dim ];
AF_Edge edges = axis->edges;
AF_Edge edge_limit = edges + axis->num_edges;
AF_Edge edge;
for ( edge = edges; edge < edge_limit; edge++ )
{
/* move the points of each segment */
/* in each edge to the edge's position */
AF_Segment seg = edge->first;
do
{
AF_Point point = seg->first;
for (;;)
{
if ( dim == AF_DIMENSION_HORZ )
{
point->x = edge->pos;
point->flags |= AF_FLAG_TOUCH_X;
}
else
{
point->y = edge->pos;
point->flags |= AF_FLAG_TOUCH_Y;
}
if ( point == seg->last )
break;
point = point->next;
}
seg = seg->edge_next;
} while ( seg != edge->first );
}
}
/*
*
* S T R O N G P O I N T I N T E R P O L A T I O N
*
*/
/* hint the strong points -- this is equivalent to the TrueType `IP' */
/* hinting instruction */
FT_LOCAL_DEF( void )
af_glyph_hints_align_strong_points( AF_GlyphHints hints,
AF_Dimension dim )
{
AF_Point points = hints->points;
AF_Point point_limit = points + hints->num_points;
AF_AxisHints axis = &hints->axis[dim];
AF_Edge edges = axis->edges;
AF_Edge edge_limit = edges + axis->num_edges;
AF_Flags touch_flag;
if ( dim == AF_DIMENSION_HORZ )
touch_flag = AF_FLAG_TOUCH_X;
else
touch_flag = AF_FLAG_TOUCH_Y;
if ( edges < edge_limit )
{
AF_Point point;
AF_Edge edge;
for ( point = points; point < point_limit; point++ )
{
FT_Pos u, ou, fu; /* point position */
FT_Pos delta;
if ( point->flags & touch_flag )
continue;
/* if this point is candidate to weak interpolation, we will */
/* interpolate it after all strong points have been processed */
if ( ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) &&
!( point->flags & AF_FLAG_INFLECTION ) )
continue;
if ( dim == AF_DIMENSION_VERT )
{
u = point->fy;
ou = point->oy;
}
else
{
u = point->fx;
ou = point->ox;
}
fu = u;
/* is the point before the first edge? */
edge = edges;
delta = edge->fpos - u;
if ( delta >= 0 )
{
u = edge->pos - ( edge->opos - ou );
goto Store_Point;
}
/* is the point after the last edge? */
edge = edge_limit - 1;
delta = u - edge->fpos;
if ( delta >= 0 )
{
u = edge->pos + ( ou - edge->opos );
goto Store_Point;
}
{
FT_UInt min, max, mid;
FT_Pos fpos;
/* find enclosing edges */
min = 0;
max = edge_limit - edges;
while ( min < max )
{
mid = ( max + min ) >> 1;
edge = edges + mid;
fpos = edge->fpos;
if ( u < fpos )
max = mid;
else if ( u > fpos )
min = mid + 1;
else
{
/* we are on the edge */
u = edge->pos;
goto Store_Point;
}
}
{
AF_Edge before = edges + min - 1;
AF_Edge after = edges + min + 0;
/* assert( before && after && before != after ) */
if ( before->scale == 0 )
before->scale = FT_DivFix( after->pos - before->pos,
after->fpos - before->fpos );
u = before->pos + FT_MulFix( fu - before->fpos,
before->scale );
}
}
Store_Point:
/* save the point position */
if ( dim == AF_DIMENSION_HORZ )
point->x = u;
else
point->y = u;
point->flags |= touch_flag;
}
}
}
/*
*
* W E A K P O I N T I N T E R P O L A T I O N
*
*/
static void
af_iup_shift( AF_Point p1,
AF_Point p2,
AF_Point ref )
{
AF_Point p;
FT_Pos delta = ref->u - ref->v;
for ( p = p1; p < ref; p++ )
p->u = p->v + delta;
for ( p = ref + 1; p <= p2; p++ )
p->u = p->v + delta;
}
static void
af_iup_interp( AF_Point p1,
AF_Point p2,
AF_Point ref1,
AF_Point ref2 )
{
AF_Point p;
FT_Pos u;
FT_Pos v1 = ref1->v;
FT_Pos v2 = ref2->v;
FT_Pos d1 = ref1->u - v1;
FT_Pos d2 = ref2->u - v2;
if ( p1 > p2 )
return;
if ( v1 == v2 )
{
for ( p = p1; p <= p2; p++ )
{
u = p->v;
if ( u <= v1 )
u += d1;
else
u += d2;
p->u = u;
}
return;
}
if ( v1 < v2 )
{
for ( p = p1; p <= p2; p++ )
{
u = p->v;
if ( u <= v1 )
u += d1;
else if ( u >= v2 )
u += d2;
else
u = ref1->u + FT_MulDiv( u - v1, ref2->u - ref1->u, v2 - v1 );
p->u = u;
}
}
else
{
for ( p = p1; p <= p2; p++ )
{
u = p->v;
if ( u <= v2 )
u += d2;
else if ( u >= v1 )
u += d1;
else
u = ref1->u + FT_MulDiv( u - v1, ref2->u - ref1->u, v2 - v1 );
p->u = u;
}
}
}
FT_LOCAL_DEF( void )
af_glyph_hints_align_weak_points( AF_GlyphHints hints,
AF_Dimension dim )
{
AF_Point points = hints->points;
AF_Point point_limit = points + hints->num_points;
AF_Point* contour = hints->contours;
AF_Point* contour_limit = contour + hints->num_contours;
AF_Flags touch_flag;
AF_Point point;
AF_Point end_point;
AF_Point first_point;
/* PASS 1: Move segment points to edge positions */
if ( dim == AF_DIMENSION_HORZ )
{
touch_flag = AF_FLAG_TOUCH_X;
for ( point = points; point < point_limit; point++ )
{
point->u = point->x;
point->v = point->ox;
}
}
else
{
touch_flag = AF_FLAG_TOUCH_Y;
for ( point = points; point < point_limit; point++ )
{
point->u = point->y;
point->v = point->oy;
}
}
point = points;
for ( ; contour < contour_limit; contour++ )
{
point = *contour;
end_point = point->prev;
first_point = point;
while ( point <= end_point && !( point->flags & touch_flag ) )
point++;
if ( point <= end_point )
{
AF_Point first_touched = point;
AF_Point cur_touched = point;
point++;
while ( point <= end_point )
{
if ( point->flags & touch_flag )
{
/* we found two successive touched points; we interpolate */
/* all contour points between them */
af_iup_interp( cur_touched + 1, point - 1,
cur_touched, point );
cur_touched = point;
}
point++;
}
if ( cur_touched == first_touched )
{
/* this is a special case: only one point was touched in the */
/* contour; we thus simply shift the whole contour */
af_iup_shift( first_point, end_point, cur_touched );
}
else
{
/* now interpolate after the last touched point to the end */
/* of the contour */
af_iup_interp( cur_touched + 1, end_point,
cur_touched, first_touched );
/* if the first contour point isn't touched, interpolate */
/* from the contour start to the first touched point */
if ( first_touched > points )
af_iup_interp( first_point, first_touched - 1,
cur_touched, first_touched );
}
}
}
/* now save the interpolated values back to x/y */
if ( dim == AF_DIMENSION_HORZ )
{
for ( point = points; point < point_limit; point++ )
point->x = point->u;
}
else
{
for ( point = points; point < point_limit; point++ )
point->y = point->u;
}
}
+246
View File
@@ -0,0 +1,246 @@
#ifndef __AFHINTS_H__
#define __AFHINTS_H__
#include "aftypes.h"
FT_BEGIN_HEADER
/*
* The definition of outline glyph hints. These are shared by all
* script analysis routines (until now)
*
*/
typedef enum
{
AF_DIMENSION_HORZ = 0, /* x coordinates, i.e. vertical segments & edges */
AF_DIMENSION_VERT = 1, /* y coordinates, i.e. horizontal segments & edges */
AF_DIMENSION_MAX /* do not remove */
} AF_Dimension;
/* hint directions -- the values are computed so that two vectors are */
/* in opposite directions iff `dir1+dir2 == 0' */
typedef enum
{
AF_DIR_NONE = 4,
AF_DIR_RIGHT = 1,
AF_DIR_LEFT = -1,
AF_DIR_UP = 2,
AF_DIR_DOWN = -2
} AF_Direction;
/* point hint flags */
typedef enum
{
AF_FLAG_NONE = 0,
/* point type flags */
AF_FLAG_CONIC = (1 << 0),
AF_FLAG_CUBIC = (1 << 1),
AF_FLAG_CONTROL = AF_FLAG_CONIC | AF_FLAG_CUBIC,
/* point extremum flags */
AF_FLAG_EXTREMA_X = (1 << 2),
AF_FLAG_EXTREMA_Y = (1 << 3),
/* point roundness flags */
AF_FLAG_ROUND_X = (1 << 4),
AF_FLAG_ROUND_Y = (1 << 5),
/* point touch flags */
AF_FLAG_TOUCH_X = (1 << 6),
AF_FLAG_TOUCH_Y = (1 << 7),
/* candidates for weak interpolation have this flag set */
AF_FLAG_WEAK_INTERPOLATION = (1 << 8),
/* all inflection points in the outline have this flag set */
AF_FLAG_INFLECTION = (1 << 9)
} AF_Flags;
/* edge hint flags */
typedef enum
{
AF_EDGE_NORMAL = 0,
AF_EDGE_ROUND = (1 << 0),
AF_EDGE_SERIF = (1 << 1),
AF_EDGE_DONE = (1 << 2)
} AF_Edge_Flags;
typedef struct AF_PointRec_* AF_Point;
typedef struct AF_SegmentRec_* AF_Segment;
typedef struct AF_EdgeRec_* AF_Edge;
typedef struct AF_PointRec_
{
AF_Flags flags; /* point flags used by hinter */
FT_Pos ox, oy; /* original, scaled position */
FT_Pos fx, fy; /* original, unscaled position (font units) */
FT_Pos x, y; /* current position */
FT_Pos u, v; /* current (x,y) or (y,x) depending on context */
AF_Direction in_dir; /* direction of inwards vector */
AF_Direction out_dir; /* direction of outwards vector */
AF_Point next; /* next point in contour */
AF_Point prev; /* previous point in contour */
} AF_PointRec;
typedef struct AF_SegmentRec_
{
AF_Edge_Flags flags; /* edge/segment flags for this segment */
AF_Direction dir; /* segment direction */
FT_Pos pos; /* position of segment */
FT_Pos min_coord; /* minimum coordinate of segment */
FT_Pos max_coord; /* maximum coordinate of segment */
AF_Edge edge; /* the segment's parent edge */
AF_Segment edge_next; /* link to next segment in parent edge */
AF_Segment link; /* (stem) link segment */
AF_Segment serif; /* primary segment for serifs */
FT_Pos num_linked; /* number of linked segments */
FT_Pos score; /* used during stem matching */
AF_Point first; /* first point in edge segment */
AF_Point last; /* last point in edge segment */
AF_Point* contour; /* ptr to first point of segment's contour */
} AF_SegmentRec;
typedef struct AF_EdgeRec_
{
FT_Pos fpos; /* original, unscaled position (font units) */
FT_Pos opos; /* original, scaled position */
FT_Pos pos; /* current position */
AF_Edge_Flags flags; /* edge flags */
AF_Direction dir; /* edge direction */
FT_Fixed scale; /* used to speed up interpolation between edges */
AF_Width blue_edge; /* non-NULL if this is a blue edge */
AF_Edge link;
AF_Edge serif;
FT_Int num_linked;
FT_Int score;
AF_Segment first;
AF_Segment last;
} AF_EdgeRec;
typedef struct AF_AxisHintsRec_
{
FT_Int num_segments;
AF_Segment segments;
FT_Int num_edges;
AF_Edge edges;
AF_Direction major_dir;
} AF_AxisHintsRec, *AF_AxisHints;
typedef struct AF_GlyphHintsRec_
{
FT_Memory memory;
FT_Fixed x_scale;
FT_Pos x_delta;
FT_Fixed y_scale;
FT_Pos y_delta;
FT_Pos edge_distance_threshold;
FT_Int max_points;
FT_Int num_points;
AF_Point points;
FT_Int max_contours;
FT_Int num_contours;
AF_Point* contours;
AF_AxisHintsRec axis[ AF_DIMENSION_MAX ];
FT_UInt32 scaler_flags; /* copy of scaler flags */
FT_UInt32 other_flags; /* free for script-specific implementations */
AF_ScriptMetrics metrics;
} AF_GlyphHintsRec;
#define AF_HINTS_TEST_SCALER(h,f) ( (h)->scaler_flags & (f) )
#define AF_HINTS_TEST_OTHER(h,f) ( (h)->other_flags & (f) )
#define AF_HINTS_DO_HORIZONTAL(h) \
!AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_HORIZONTAL)
#define AF_HINTS_DO_VERTICAL(h) \
!AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_VERTICAL)
#define AF_HINTS_DO_ADVANCE(h) \
!AF_HINTS_TEST_SCALER(h,AF_SCALER_FLAG_NO_ADVANCE)
FT_LOCAL( AF_Direction )
af_direction_compute( FT_Pos dx,
FT_Pos dy );
FT_LOCAL( void )
af_glyph_hints_init( AF_GlyphHints hints,
FT_Memory memory );
/* recomputes all AF_Point in a AF_GlyphHints from the definitions
* in a source outline
*/
FT_LOCAL( FT_Error )
af_glyph_hints_reset( AF_GlyphHints hints,
AF_Scaler scaler,
AF_ScriptMetrics metrics,
FT_Outline* outline );
FT_LOCAL( void )
af_glyph_hints_save( AF_GlyphHints hints,
FT_Outline* outline );
FT_LOCAL( void )
af_glyph_hints_align_edge_points( AF_GlyphHints hints,
AF_Dimension dim );
FT_LOCAL( void )
af_glyph_hints_align_strong_points( AF_GlyphHints hints,
AF_Dimension dim );
FT_LOCAL( void )
af_glyph_hints_align_weak_points( AF_GlyphHints hints,
AF_Dimension dim );
FT_LOCAL( void )
af_glyph_hints_done( AF_GlyphHints hints );
/* */
FT_END_HEADER
#endif /* __AFHINTS_H__ */
File diff suppressed because it is too large Load Diff
+168
View File
@@ -0,0 +1,168 @@
#ifndef __AFLATIN_H__
#define __AFLATIN_H__
#include "afhints.h"
FT_BEGIN_HEADER
/*
* the latin-specific script class
*
*/
FT_LOCAL( const AF_ScriptClassRec ) af_latin_script_class;
/***************************************************************************/
/***************************************************************************/
/***** *****/
/***** L A T I N G L O B A L M E T R I C S *****/
/***** *****/
/***************************************************************************/
/***************************************************************************/
/*
* the following declarations could be embedded in the file "aflatin.c"
* they've been made semi-public to allow alternate script hinters to
* re-use some of them
*/
/*
* Latin (global) metrics management
*
*/
enum
{
AF_LATIN_BLUE_CAPITAL_TOP,
AF_LATIN_BLUE_CAPITAL_BOTTOM,
AF_LATIN_BLUE_SMALL_F_TOP,
AF_LATIN_BLUE_SMALL_TOP,
AF_LATIN_BLUE_SMALL_BOTTOM,
AF_LATIN_BLUE_SMALL_MINOR,
AF_LATIN_BLUE_MAX
};
#define AF_LATIN_IS_TOP_BLUE( b ) ( (b) == AF_LATIN_BLUE_CAPITAL_TOP || \
(b) == AF_LATIN_BLUE_SMALL_F_TOP || \
(b) == AF_LATIN_BLUE_SMALL_TOP )
#define AF_LATIN_MAX_WIDTHS 16
#define AF_LATIN_MAX_BLUES AF_LATIN_BLUE_MAX
enum
{
AF_LATIN_BLUE_ACTIVE = (1 << 0),
AF_LATIN_BLUE_TOP = (1 << 1),
AF_LATIN_BLUE_FLAG_MAX
};
typedef struct AF_LatinBlueRec_
{
AF_WidthRec ref;
AF_WidthRec shoot;
FT_UInt flags;
} AF_LatinBlueRec, *AF_LatinBlue;
typedef struct AF_LatinAxisRec_
{
FT_Fixed scale;
FT_Pos delta;
FT_UInt width_count;
AF_WidthRec widths[ AF_LATIN_MAX_WIDTHS ];
FT_Pos edge_distance_threshold;
/* ignored for horizontal metrics */
FT_Bool control_overshoot;
FT_UInt blue_count;
AF_LatinBlueRec blues[ AF_LATIN_BLUE_MAX ];
FT_Fixed org_scale;
FT_Pos org_delta;
} AF_LatinAxisRec, *AF_LatinAxis;
typedef struct AF_LatinMetricsRec_
{
AF_ScriptMetricsRec root;
FT_UInt units_per_em;
AF_LatinAxisRec axis[ AF_DIMENSION_MAX ];
} AF_LatinMetricsRec, *AF_LatinMetrics;
FT_LOCAL( FT_Error )
af_latin_metrics_init( AF_LatinMetrics metrics,
FT_Face face );
FT_LOCAL( void )
af_latin_metrics_scale( AF_LatinMetrics metrics,
AF_Scaler scaler );
/***************************************************************************/
/***************************************************************************/
/***** *****/
/***** L A T I N G L Y P H A N A L Y S I S *****/
/***** *****/
/***************************************************************************/
/***************************************************************************/
enum
{
AF_LATIN_HINTS_HORZ_SNAP = (1 << 0), /* enable stem width snapping */
AF_LATIN_HINTS_VERT_SNAP = (1 << 1), /* enable stem height snapping */
AF_LATIN_HINTS_STEM_ADJUST = (1 << 2), /* enable stem width/height adjustment */
AF_LATIN_HINTS_MONO = (1 << 3) /* indicate monochrome rendering */
};
#define AF_LATIN_HINTS_DO_HORZ_SNAP(h) \
AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_HORZ_SNAP)
#define AF_LATIN_HINTS_DO_VERT_SNAP(h) \
AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_VERT_SNAP)
#define AF_LATIN_HINTS_DO_STEM_ADJUST(h) \
AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_STEM_ADJUST)
#define AF_LATIN_HINTS_DO_MONO(h) \
AF_HINTS_TEST_OTHER(h,AF_LATIN_HINTS_MONO)
/* this shouldn't normally be exported. However, other scripts might
* like to use this function as-is
*/
FT_LOCAL( void )
af_latin_hints_compute_segments( AF_GlyphHints hints,
AF_Dimension dim );
/* this shouldn't normally be exported. However, other scripts might
* want to use this function as-is
*/
FT_LOCAL( void )
af_latin_hints_link_segments( AF_GlyphHints hints,
AF_Dimension dim );
/* this shouldn't normally be exported. However, other scripts might
* want to use this function as-is
*/
FT_LOCAL( void )
af_latin_hints_compute_edges( AF_GlyphHints hints,
AF_Dimension dim );
FT_LOCAL( void )
af_latin_hints_detect_features( AF_GlyphHints hints,
AF_Dimension dim );
/* */
FT_END_HEADER
#endif /* __AFLATIN_H__ */
+441
View File
@@ -0,0 +1,441 @@
#include "afloader.h"
#include "afhints.h"
#include "afglobal.h"
#include "aflatin.h"
FT_LOCAL_DEF( FT_Error )
af_loader_init( AF_Loader loader,
FT_Memory memory )
{
FT_Error error;
FT_ZERO( loader );
af_glyph_hints_init( &loader->hints, memory );
error = FT_GlyphLoader_New( memory, &loader->gloader );
if ( !error )
{
error = FT_GlyphLoader_CreateExtra( loader->gloader );
if ( error )
{
FT_GlyphLoader_Done( loader->gloader );
loader->gloader = NULL;
}
}
return error;
}
FT_LOCAL_DEF( FT_Error )
af_loader_reset( AF_Loader loader,
FT_Face face )
{
FT_Error error = 0;
loader->face = face;
loader->globals = (AF_FaceGlobals) face->autohint.data;
FT_GlyphLoader_Rewind( loader->gloader );
if ( loader->globals == NULL )
{
error = af_face_globals_new( face, &loader->globals );
if ( !error )
{
face->autohint.data = (FT_Pointer) loader->globals;
face->autohint.finalizer = (FT_Generic_Finalizer) af_face_globals_free;
}
}
return error;
}
FT_LOCAL_DEF( void )
af_loader_done( AF_Loader loader )
{
loader->face = NULL;
loader->globals = NULL;
FT_GlyphLoader_Done( loader->gloader );
loader->gloader = NULL;
}
static FT_Error
af_loader_load_g( AF_Loader loader,
AF_Scaler scaler,
FT_UInt glyph_index,
FT_Int32 load_flags,
FT_UInt depth )
{
FT_Error error = 0;
FT_Face face = loader->face;
FT_GlyphLoader gloader = loader->gloader;
AF_ScriptMetrics metrics = loader->metrics;
AF_GlyphHints hints = &loader->hints;
FT_GlyphSlot slot = face->glyph;
FT_Slot_Internal internal = slot->internal;
error = FT_Load_Glyph( face, glyph_index, load_flags );
if ( error )
goto Exit;
loader->transformed = internal->glyph_transformed;
if ( loader->transformed )
{
FT_Matrix inverse;
loader->trans_matrix = internal->glyph_matrix;
loader->trans_delta = internal->glyph_delta;
inverse = loader->trans_matrix;
FT_Matrix_Invert( &inverse );
FT_Vector_Transform( &loader->trans_delta, &inverse );
}
/* set linear metrics */
slot->linearHoriAdvance = slot->metrics.horiAdvance;
slot->linearVertAdvance = slot->metrics.vertAdvance;
switch ( slot->format )
{
case FT_GLYPH_FORMAT_OUTLINE:
/* translate the loaded glyph when an internal transform
* is needed
*/
if ( loader->transformed )
{
FT_Vector* point = slot->outline.points;
FT_Vector* limit = point + slot->outline.n_points;
for ( ; point < limit; point++ )
{
point->x += loader->trans_delta.x;
point->y += loader->trans_delta.y;
}
}
/* copy the outline points in the loader's current */
/* extra points which is used to keep original glyph coordinates */
error = FT_GlyphLoader_CheckPoints( gloader,
slot->outline.n_points + 4,
slot->outline.n_contours );
if ( error )
goto Exit;
FT_ARRAY_COPY( gloader->current.outline.points,
slot->outline.points,
slot->outline.n_points );
FT_ARRAY_COPY( gloader->current.extra_points,
slot->outline.points,
slot->outline.n_points );
FT_ARRAY_COPY( gloader->current.outline.contours,
slot->outline.contours,
slot->outline.n_contours );
FT_ARRAY_COPY( gloader->current.outline.tags,
slot->outline.tags,
slot->outline.n_points );
gloader->current.outline.n_points = slot->outline.n_points;
gloader->current.outline.n_contours = slot->outline.n_contours;
/* compute original horizontal phantom points (and ignore */
/* vertical ones) */
loader->pp1.x = hints->x_delta;
loader->pp1.y = hints->y_delta;
loader->pp2.x = FT_MulFix( slot->metrics.horiAdvance,
hints->x_scale ) + hints->x_delta;
loader->pp2.y = hints->y_delta;
/* be sure to check for spacing glyphs */
if ( slot->outline.n_points == 0 )
goto Hint_Metrics;
/* now load the slot image into the auto-outline and run the */
/* automatic hinting process */
error = metrics->clazz->script_hints_init( hints,
&gloader->current.outline,
metrics );
if ( error )
goto Exit;
/* apply the hints */
metrics->clazz->script_hints_apply( hints,
&gloader->current.outline,
metrics );
/* we now need to hint the metrics according to the change in */
/* width/positioning that occured during the hinting process */
{
FT_Pos old_advance, old_rsb, old_lsb, new_lsb;
AF_AxisHints axis = &hints->axis[ AF_DIMENSION_HORZ ];
AF_Edge edge1 = axis->edges; /* leftmost edge */
AF_Edge edge2 = edge1 + axis->num_edges - 1; /* rightmost edge */
old_advance = loader->pp2.x;
old_rsb = old_advance - edge2->opos;
old_lsb = edge1->opos;
new_lsb = edge1->pos;
loader->pp1.x = FT_PIX_ROUND( new_lsb - old_lsb );
loader->pp2.x = FT_PIX_ROUND( edge2->pos + old_rsb );
#if 0
/* try to fix certain bad advance computations */
if ( loader->pp2.x + loader->pp1.x == edge2->pos && old_rsb > 4 )
loader->pp2.x += 64;
#endif
}
/* good, we simply add the glyph to our loader's base */
FT_GlyphLoader_Add( gloader );
break;
case FT_GLYPH_FORMAT_COMPOSITE:
{
FT_UInt nn, num_subglyphs = slot->num_subglyphs;
FT_UInt num_base_subgs, start_point;
FT_SubGlyph subglyph;
start_point = gloader->base.outline.n_points;
/* first of all, copy the subglyph descriptors in the glyph loader */
error = FT_GlyphLoader_CheckSubGlyphs( gloader, num_subglyphs );
if ( error )
goto Exit;
FT_ARRAY_COPY( gloader->current.subglyphs,
slot->subglyphs,
num_subglyphs );
gloader->current.num_subglyphs = num_subglyphs;
num_base_subgs = gloader->base.num_subglyphs;
/* now, read each subglyph independently */
for ( nn = 0; nn < num_subglyphs; nn++ )
{
FT_Vector pp1, pp2;
FT_Pos x, y;
FT_UInt num_points, num_new_points, num_base_points;
/* gloader.current.subglyphs can change during glyph loading due */
/* to re-allocation -- we must recompute the current subglyph on */
/* each iteration */
subglyph = gloader->base.subglyphs + num_base_subgs + nn;
pp1 = loader->pp1;
pp2 = loader->pp2;
num_base_points = gloader->base.outline.n_points;
error = af_loader_load_g( loader, scaler, subglyph->index,
load_flags, depth + 1 );
if ( error )
goto Exit;
/* recompute subglyph pointer */
subglyph = gloader->base.subglyphs + num_base_subgs + nn;
if ( subglyph->flags & FT_SUBGLYPH_FLAG_USE_MY_METRICS )
{
pp1 = loader->pp1;
pp2 = loader->pp2;
}
else
{
loader->pp1 = pp1;
loader->pp2 = pp2;
}
num_points = gloader->base.outline.n_points;
num_new_points = num_points - num_base_points;
/* now perform the transform required for this subglyph */
if ( subglyph->flags & ( FT_SUBGLYPH_FLAG_SCALE |
FT_SUBGLYPH_FLAG_XY_SCALE |
FT_SUBGLYPH_FLAG_2X2 ) )
{
FT_Vector* cur = gloader->base.outline.points +
num_base_points;
FT_Vector* org = gloader->base.extra_points +
num_base_points;
FT_Vector* limit = cur + num_new_points;
for ( ; cur < limit; cur++, org++ )
{
FT_Vector_Transform( cur, &subglyph->transform );
FT_Vector_Transform( org, &subglyph->transform );
}
}
/* apply offset */
if ( !( subglyph->flags & FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES ) )
{
FT_Int k = subglyph->arg1;
FT_UInt l = subglyph->arg2;
FT_Vector* p1;
FT_Vector* p2;
if ( start_point + k >= num_base_points ||
l >= (FT_UInt)num_new_points )
{
error = FT_Err_Invalid_Composite;
goto Exit;
}
l += num_base_points;
/* for now, only use the current point coordinates; */
/* we may consider another approach in the near future */
p1 = gloader->base.outline.points + start_point + k;
p2 = gloader->base.outline.points + start_point + l;
x = p1->x - p2->x;
y = p1->y - p2->y;
}
else
{
x = FT_MulFix( subglyph->arg1, hints->x_scale ) + hints->x_delta;
y = FT_MulFix( subglyph->arg2, hints->y_scale ) + hints->y_delta;
x = FT_PIX_ROUND(x);
y = FT_PIX_ROUND(y);
}
{
FT_Outline dummy = gloader->base.outline;
dummy.points += num_base_points;
dummy.n_points = (short)num_new_points;
FT_Outline_Translate( &dummy, x, y );
}
}
}
break;
default:
/* we don't support other formats (yet?) */
error = FT_Err_Unimplemented_Feature;
}
Hint_Metrics:
if ( depth == 0 )
{
FT_BBox bbox;
/* transform the hinted outline if needed */
if ( loader->transformed )
FT_Outline_Transform( &gloader->base.outline, &loader->trans_matrix );
/* we must translate our final outline by -pp1.x and compute */
/* the new metrics */
if ( loader->pp1.x )
FT_Outline_Translate( &gloader->base.outline, -loader->pp1.x, 0 );
FT_Outline_Get_CBox( &gloader->base.outline, &bbox );
bbox.xMin = FT_PIX_FLOOR( bbox.xMin );
bbox.yMin = FT_PIX_FLOOR( bbox.yMin );
bbox.xMax = FT_PIX_CEIL( bbox.xMax );
bbox.yMax = FT_PIX_CEIL( bbox.yMax );
slot->metrics.width = bbox.xMax - bbox.xMin;
slot->metrics.height = bbox.yMax - bbox.yMin;
slot->metrics.horiBearingX = bbox.xMin;
slot->metrics.horiBearingY = bbox.yMax;
/* for mono-width fonts (like Andale, Courier, etc.) we need */
/* to keep the original rounded advance width */
#if 0
if ( !FT_IS_FIXED_WIDTH( slot->face ) )
slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
else
slot->metrics.horiAdvance = FT_MulFix( slot->metrics.horiAdvance,
x_scale );
#else
slot->metrics.horiAdvance = loader->pp2.x - loader->pp1.x;
#endif
slot->metrics.horiAdvance = FT_PIX_ROUND( slot->metrics.horiAdvance );
/* now copy outline into glyph slot */
FT_GlyphLoader_Rewind( internal->loader );
error = FT_GlyphLoader_CopyPoints( internal->loader, gloader );
if ( error )
goto Exit;
slot->outline = internal->loader->base.outline;
slot->format = FT_GLYPH_FORMAT_OUTLINE;
}
#ifdef DEBUG_HINTER
af_debug_hinter = hinter;
#endif
Exit:
return error;
}
FT_LOCAL_DEF( FT_Error )
af_loader_load_glyph( AF_Loader loader,
FT_Face face,
FT_UInt gindex,
FT_UInt32 load_flags )
{
FT_Error error;
FT_Size size = face->size;
AF_ScalerRec scaler;
if ( !size )
return FT_Err_Invalid_Argument;
FT_ZERO( &scaler );
scaler.face = face;
scaler.x_scale = size->metrics.x_scale;
scaler.x_delta = 0; /* XXX: TODO: add support for sub-pixel hinting */
scaler.y_scale = size->metrics.y_scale;
scaler.y_delta = 0; /* XXX: TODO: add support for sub-pixel hinting */
scaler.render_mode = FT_LOAD_TARGET_MODE( load_flags );
scaler.flags = 0; /* XXX: fix this */
error = af_loader_reset( loader, face );
if ( !error )
{
AF_ScriptMetrics metrics;
error = af_face_globals_get_metrics( loader->globals, gindex, &metrics );
if ( !error )
{
loader->metrics = metrics;
metrics->scaler = scaler;
if ( metrics->clazz->script_metrics_scale )
metrics->clazz->script_metrics_scale( metrics, &scaler );
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM;
load_flags &= ~FT_LOAD_RENDER;
error = af_loader_load_g( loader, &scaler, gindex, load_flags, 0 );
}
}
return error;
}
+50
View File
@@ -0,0 +1,50 @@
#ifndef __AF_LOADER_H__
#define __AF_LOADER_H__
#include "afhints.h"
#include "afglobal.h"
FT_BEGIN_HEADER
typedef struct AF_LoaderRec_
{
FT_Face face; /* current face */
AF_FaceGlobals globals; /* current face globals */
FT_GlyphLoader gloader; /* glyph loader */
AF_GlyphHintsRec hints;
AF_ScriptMetrics metrics;
FT_Bool transformed;
FT_Matrix trans_matrix;
FT_Vector trans_delta;
FT_Vector pp1;
FT_Vector pp2;
/* we don't handle vertical phantom points */
} AF_LoaderRec, *AF_Loader;
FT_LOCAL( FT_Error )
af_loader_init( AF_Loader loader,
FT_Memory memory );
FT_LOCAL( FT_Error )
af_loader_reset( AF_Loader loader,
FT_Face face );
FT_LOCAL( void )
af_loader_done( AF_Loader loader );
FT_LOCAL( FT_Error )
af_loader_load_glyph( AF_Loader loader,
FT_Face face,
FT_UInt gindex,
FT_UInt32 load_flags );
/* */
FT_END_HEADER
#endif /* __AF_LOADER_H__ */

Some files were not shown because too many files have changed in this diff Show More