ReactOS  0.4.14-dev-384-g5b37caa
ftcache.h File Reference
#include <ft2build.h>
Include dependency graph for ftcache.h:

Go to the source code of this file.

Classes

struct  FTC_ScalerRec_
 
struct  FTC_ImageTypeRec_
 
struct  FTC_SBitRec_
 

Macros

#define FTC_IMAGE_TYPE_COMPARE(d1, d2)
 

Typedefs

typedef FT_Error(* FTC_Face_Requester) (FTC_FaceID face_id, FT_Library library, FT_Pointer req_data, FT_Face *aface)
 
typedef struct FTC_ManagerRec_FTC_Manager
 
typedef struct FTC_NodeRec_FTC_Node
 
typedef struct FTC_ScalerRec_ FTC_ScalerRec
 
typedef struct FTC_ScalerRec_FTC_Scaler
 
typedef struct FTC_CMapCacheRec_ * FTC_CMapCache
 
typedef struct FTC_ImageTypeRec_ FTC_ImageTypeRec
 
typedef struct FTC_ImageTypeRec_FTC_ImageType
 
typedef struct FTC_ImageCacheRec_ * FTC_ImageCache
 
typedef struct FTC_SBitRec_FTC_SBit
 
typedef struct FTC_SBitRec_ FTC_SBitRec
 
typedef struct FTC_SBitCacheRec_ * FTC_SBitCache
 

Functions

 FTC_Manager_New (FT_Library library, FT_UInt max_faces, FT_UInt max_sizes, FT_ULong max_bytes, FTC_Face_Requester requester, FT_Pointer req_data, FTC_Manager *amanager)
 
 FTC_Manager_Reset (FTC_Manager manager)
 
 FTC_Manager_Done (FTC_Manager manager)
 
 FTC_Manager_LookupFace (FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface)
 
 FTC_Manager_LookupSize (FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize)
 
 FTC_Node_Unref (FTC_Node node, FTC_Manager manager)
 
 FTC_Manager_RemoveFaceID (FTC_Manager manager, FTC_FaceID face_id)
 
 FTC_CMapCache_New (FTC_Manager manager, FTC_CMapCache *acache)
 
 FTC_CMapCache_Lookup (FTC_CMapCache cache, FTC_FaceID face_id, FT_Int cmap_index, FT_UInt32 char_code)
 
 FTC_ImageCache_New (FTC_Manager manager, FTC_ImageCache *acache)
 
 FTC_ImageCache_Lookup (FTC_ImageCache cache, FTC_ImageType type, FT_UInt gindex, FT_Glyph *aglyph, FTC_Node *anode)
 
 FTC_ImageCache_LookupScaler (FTC_ImageCache cache, FTC_Scaler scaler, FT_ULong load_flags, FT_UInt gindex, FT_Glyph *aglyph, FTC_Node *anode)
 
 FTC_SBitCache_New (FTC_Manager manager, FTC_SBitCache *acache)
 
 FTC_SBitCache_Lookup (FTC_SBitCache cache, FTC_ImageType type, FT_UInt gindex, FTC_SBit *sbit, FTC_Node *anode)
 
 FTC_SBitCache_LookupScaler (FTC_SBitCache cache, FTC_Scaler scaler, FT_ULong load_flags, FT_UInt gindex, FTC_SBit *sbit, FTC_Node *anode)
 

Variables

FT_BEGIN_HEADER typedef FT_Pointer FTC_FaceID
 

Macro Definition Documentation

◆ FTC_IMAGE_TYPE_COMPARE

#define FTC_IMAGE_TYPE_COMPARE (   d1,
  d2 
)
Value:
( (d1)->face_id == (d2)->face_id && \
(d1)->width == (d2)->width && \
(d1)->flags == (d2)->flags )
GLint GLint GLsizei width
Definition: gl.h:1546
GLbitfield flags
Definition: glext.h:7161

Definition at line 677 of file ftcache.h.

Typedef Documentation

◆ FTC_CMapCache

typedef struct FTC_CMapCacheRec_* FTC_CMapCache

Definition at line 553 of file ftcache.h.

◆ FTC_Face_Requester

typedef FT_Error(* FTC_Face_Requester) (FTC_FaceID face_id, FT_Library library, FT_Pointer req_data, FT_Face *aface)

Definition at line 210 of file ftcache.h.

◆ FTC_ImageCache

typedef struct FTC_ImageCacheRec_* FTC_ImageCache

Definition at line 693 of file ftcache.h.

◆ FTC_ImageType

Definition at line 671 of file ftcache.h.

◆ FTC_ImageTypeRec

◆ FTC_Manager

Definition at line 250 of file ftcache.h.

◆ FTC_Node

Definition at line 270 of file ftcache.h.

◆ FTC_SBit

Definition at line 834 of file ftcache.h.

◆ FTC_SBitCache

typedef struct FTC_SBitCacheRec_* FTC_SBitCache

Definition at line 901 of file ftcache.h.

◆ FTC_SBitRec

◆ FTC_Scaler

Definition at line 445 of file ftcache.h.

◆ FTC_ScalerRec

Function Documentation

◆ FTC_CMapCache_Lookup()

FTC_CMapCache_Lookup ( FTC_CMapCache  cache,
FTC_FaceID  face_id,
FT_Int  cmap_index,
FT_UInt32  char_code 
)

Definition at line 231 of file ftccmap.c.

235  {
236  FTC_Cache cache = FTC_CACHE( cmap_cache );
238  FTC_Node node;
239  FT_Error error;
240  FT_UInt gindex = 0;
241  FT_Offset hash;
242  FT_Int no_cmap_change = 0;
243 
244 
245  if ( cmap_index < 0 )
246  {
247  /* Treat a negative cmap index as a special value, meaning that you */
248  /* don't want to change the FT_Face's character map through this */
249  /* call. This can be useful if the face requester callback already */
250  /* sets the face's charmap to the appropriate value. */
251 
252  no_cmap_change = 1;
253  cmap_index = 0;
254  }
255 
256  if ( !cache )
257  {
258  FT_TRACE0(( "FTC_CMapCache_Lookup: bad arguments, returning 0\n" ));
259  return 0;
260  }
261 
262  query.face_id = face_id;
263  query.cmap_index = (FT_UInt)cmap_index;
264  query.char_code = char_code;
265 
266  hash = FTC_CMAP_HASH( face_id, (FT_UInt)cmap_index, char_code );
267 
268 #if 1
270  node, error );
271 #else
272  error = FTC_Cache_Lookup( cache, hash, &query, &node );
273 #endif
274  if ( error )
275  goto Exit;
276 
277  FT_ASSERT( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first ) <
279 
280  /* something rotten can happen with rogue clients */
281  if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >=
283  return 0; /* XXX: should return appropriate error */
284 
285  gindex = FTC_CMAP_NODE( node )->indices[char_code -
286  FTC_CMAP_NODE( node )->first];
287  if ( gindex == FTC_CMAP_UNKNOWN )
288  {
289  FT_Face face;
290 
291 
292  gindex = 0;
293 
294  error = FTC_Manager_LookupFace( cache->manager,
295  FTC_CMAP_NODE( node )->face_id,
296  &face );
297  if ( error )
298  goto Exit;
299 
300  if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )
301  {
302  FT_CharMap old, cmap = NULL;
303 
304 
305  old = face->charmap;
306  cmap = face->charmaps[cmap_index];
307 
308  if ( old != cmap && !no_cmap_change )
309  FT_Set_Charmap( face, cmap );
310 
311  gindex = FT_Get_Char_Index( face, char_code );
312 
313  if ( old != cmap && !no_cmap_change )
314  FT_Set_Charmap( face, old );
315  }
316 
317  FTC_CMAP_NODE( node )->indices[char_code -
318  FTC_CMAP_NODE( node )->first]
319  = (FT_UShort)gindex;
320  }
321 
322  Exit:
323  return gindex;
324  }
Definition: cache.c:46
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
signed int FT_Int
Definition: fttypes.h:220
const GLint * first
Definition: glext.h:5794
#define FTC_CMAP_NODE(x)
Definition: ftccmap.c:78
WORD face[3]
Definition: mesh.c:4747
ftc_cmap_node_compare(FTC_Node ftcnode, FT_Pointer ftcquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftccmap.c:150
#define FTC_CMAP_INDICES_MAX
Definition: ftccmap.c:49
struct node node
int hash
Definition: main.c:58
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
#define FTC_CMAP_UNKNOWN
Definition: ftccmap.c:82
smooth NULL
Definition: ftsmooth.c:416
FT_Get_Char_Index(FT_Face face, FT_ULong charcode)
Definition: ftobjs.c:3668
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
static void Exit(void)
Definition: sock.c:1331
#define FTC_CACHE(x)
Definition: ftccache.h:161
#define FTC_CMAP_HASH(faceid, index, charcode)
Definition: ftccmap.c:52
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
Definition: ftobjs.c:3499
#define FTC_CACHE_LOOKUP_CMP(cache, nodecmp, hash, query, node, error)
Definition: ftccache.h:210
unsigned int FT_UInt
Definition: fttypes.h:231
unsigned short FT_UShort
Definition: fttypes.h:209
Definition: _hash_fun.h:40
GLenum query
Definition: glext.h:7781
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
FTC_Manager_LookupFace(FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface)
Definition: ftcmanag.c:310
size_t FT_Offset
Definition: fttypes.h:324
Definition: dlist.c:348

◆ FTC_CMapCache_New()

FTC_CMapCache_New ( FTC_Manager  manager,
FTC_CMapCache acache 
)

Definition at line 219 of file ftccmap.c.

221  {
222  return FTC_Manager_RegisterCache( manager,
224  FTC_CACHE_P( acache ) );
225  }
static const FTC_CacheClassRec ftc_cmap_cache_class
Definition: ftccmap.c:202
FTC_Manager_RegisterCache(FTC_Manager manager, FTC_CacheClass clazz, FTC_Cache *acache)
Definition: ftcmanag.c:580
#define FTC_CACHE_P(x)
Definition: ftccache.h:162

◆ FTC_ImageCache_Lookup()

FTC_ImageCache_Lookup ( FTC_ImageCache  cache,
FTC_ImageType  type,
FT_UInt  gindex,
FT_Glyph aglyph,
FTC_Node anode 
)

Definition at line 284 of file ftcbasic.c.

289  {
291  FTC_Node node = 0; /* make compiler happy */
292  FT_Error error;
293  FT_Offset hash;
294 
295 
296  /* some argument checks are delayed to `FTC_Cache_Lookup' */
297  if ( !aglyph )
298  {
299  error = FT_THROW( Invalid_Argument );
300  goto Exit;
301  }
302 
303  *aglyph = NULL;
304  if ( anode )
305  *anode = NULL;
306 
307  /*
308  * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
309  * but public `FT_ImageType->flags' is of type `FT_Int32'.
310  *
311  * On 16bit systems, higher bits of type->flags cannot be handled.
312  */
313 #if 0xFFFFFFFFUL > FT_UINT_MAX
314  if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
315  FT_TRACE1(( "FTC_ImageCache_Lookup:"
316  " higher bits in load_flags 0x%x are dropped\n",
317  (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
318 #endif
319 
320  query.attrs.scaler.face_id = type->face_id;
321  query.attrs.scaler.width = type->width;
322  query.attrs.scaler.height = type->height;
323  query.attrs.load_flags = (FT_UInt)type->flags;
324 
325  query.attrs.scaler.pixel = 1;
326  query.attrs.scaler.x_res = 0; /* make compilers happy */
327  query.attrs.scaler.y_res = 0;
328 
329  hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
330 
331 #if 1 /* inlining is about 50% faster! */
335  hash, gindex,
336  &query,
337  node,
338  error );
339 #else
340  error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
341  hash, gindex,
342  FTC_GQUERY( &query ),
343  &node );
344 #endif
345  if ( !error )
346  {
347  *aglyph = FTC_INODE( node )->glyph;
348 
349  if ( anode )
350  {
351  *anode = node;
352  node->ref_count++;
353  }
354  }
355 
356  Exit:
357  return error;
358  }
#define FT_UINT_MAX
Definition: ftstdlib.h:65
Definition: cache.c:46
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define FTC_GQUERY(x)
Definition: ftcglyph.h:167
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct node node
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
int hash
Definition: main.c:58
#define FT_THROW(e)
Definition: ftdebug.h:213
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
static void Exit(void)
Definition: sock.c:1331
FTC_GNode_Compare(FTC_GNode gnode, FTC_GQuery gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcglyph.c:86
unsigned int FT_UInt
Definition: fttypes.h:231
#define FTC_GCACHE_LOOKUP_CMP(cache, famcmp, nodecmp, hash, gindex, query, node, error)
Definition: ftcglyph.h:280
#define FTC_INODE(x)
Definition: ftcimage.h:54
#define FTC_GCACHE(x)
Definition: ftcglyph.h:219
Definition: _hash_fun.h:40
#define FTC_BASIC_ATTR_HASH(a)
Definition: ftcbasic.c:48
GLenum query
Definition: glext.h:7781
size_t FT_Offset
Definition: fttypes.h:324
Definition: dlist.c:348

◆ FTC_ImageCache_LookupScaler()

FTC_ImageCache_LookupScaler ( FTC_ImageCache  cache,
FTC_Scaler  scaler,
FT_ULong  load_flags,
FT_UInt  gindex,
FT_Glyph aglyph,
FTC_Node anode 
)

Definition at line 364 of file ftcbasic.c.

370  {
372  FTC_Node node = 0; /* make compiler happy */
373  FT_Error error;
374  FT_Offset hash;
375 
376 
377  /* some argument checks are delayed to `FTC_Cache_Lookup' */
378  if ( !aglyph || !scaler )
379  {
380  error = FT_THROW( Invalid_Argument );
381  goto Exit;
382  }
383 
384  *aglyph = NULL;
385  if ( anode )
386  *anode = NULL;
387 
388  /*
389  * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
390  * but public `FT_Face->face_flags' is of type `FT_Long'.
391  *
392  * On long > int systems, higher bits of load_flags cannot be handled.
393  */
394 #if FT_ULONG_MAX > FT_UINT_MAX
395  if ( load_flags > FT_UINT_MAX )
396  FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
397  " higher bits in load_flags 0x%x are dropped\n",
398  load_flags & ~((FT_ULong)FT_UINT_MAX) ));
399 #endif
400 
401  query.attrs.scaler = scaler[0];
402  query.attrs.load_flags = (FT_UInt)load_flags;
403 
404  hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
405 
409  hash, gindex,
410  &query,
411  node,
412  error );
413  if ( !error )
414  {
415  *aglyph = FTC_INODE( node )->glyph;
416 
417  if ( anode )
418  {
419  *anode = node;
420  node->ref_count++;
421  }
422  }
423 
424  Exit:
425  return error;
426  }
#define FT_UINT_MAX
Definition: ftstdlib.h:65
Definition: cache.c:46
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define error(str)
Definition: mkdosfs.c:1605
struct node node
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
int hash
Definition: main.c:58
#define FT_THROW(e)
Definition: ftdebug.h:213
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
static void Exit(void)
Definition: sock.c:1331
FTC_GNode_Compare(FTC_GNode gnode, FTC_GQuery gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcglyph.c:86
unsigned int FT_UInt
Definition: fttypes.h:231
#define FTC_GCACHE_LOOKUP_CMP(cache, famcmp, nodecmp, hash, gindex, query, node, error)
Definition: ftcglyph.h:280
#define FTC_INODE(x)
Definition: ftcimage.h:54
Definition: _hash_fun.h:40
#define FTC_BASIC_ATTR_HASH(a)
Definition: ftcbasic.c:48
GLenum query
Definition: glext.h:7781
size_t FT_Offset
Definition: fttypes.h:324
Definition: dlist.c:348

◆ FTC_ImageCache_New()

FTC_ImageCache_New ( FTC_Manager  manager,
FTC_ImageCache acache 
)

Definition at line 273 of file ftcbasic.c.

275  {
277  (FTC_GCache*)acache );
278  }
static const FTC_GCacheClassRec ftc_basic_image_cache_class
Definition: ftcbasic.c:252
FTC_GCache_New(FTC_Manager manager, FTC_GCacheClass clazz, FTC_GCache *acache)
Definition: ftcglyph.c:175

◆ FTC_Manager_Done()

FTC_Manager_Done ( FTC_Manager  manager)

Definition at line 417 of file ftcmanag.c.

418  {
420  FT_UInt idx;
421 
422 
423  if ( !manager || !manager->library )
424  return;
425 
426  memory = manager->memory;
427 
428  /* now discard all caches */
429  for (idx = manager->num_caches; idx-- > 0; )
430  {
431  FTC_Cache cache = manager->caches[idx];
432 
433 
434  if ( cache )
435  {
436  cache->clazz.cache_done( cache );
437  FT_FREE( cache );
438  manager->caches[idx] = NULL;
439  }
440  }
441  manager->num_caches = 0;
442 
443  /* discard faces and sizes */
444  FTC_MruList_Done( &manager->sizes );
445  FTC_MruList_Done( &manager->faces );
446 
447  manager->library = NULL;
448  manager->memory = NULL;
449 
450  FT_FREE( manager );
451  }
Definition: cache.c:46
FTC_MruListRec faces
Definition: ftcmanag.h:104
static char memory[1024 *256]
Definition: process.c:116
FT_Library library
Definition: ftcmanag.h:93
FT_Memory memory
Definition: ftcmanag.h:94
unsigned int idx
Definition: utils.c:41
smooth NULL
Definition: ftsmooth.c:416
#define FT_FREE(ptr)
Definition: ftmemory.h:329
FTC_MruList_Done(FTC_MruList list)
Definition: ftcmru.c:195
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
FTC_MruListRec sizes
Definition: ftcmanag.h:105
unsigned int FT_UInt
Definition: fttypes.h:231
FT_UInt num_caches
Definition: ftcmanag.h:102
FTC_Cache caches[FTC_MAX_CACHES]
Definition: ftcmanag.h:101

◆ FTC_Manager_LookupFace()

FTC_Manager_LookupFace ( FTC_Manager  manager,
FTC_FaceID  face_id,
FT_Face aface 
)

Definition at line 310 of file ftcmanag.c.

313  {
314  FT_Error error;
315  FTC_MruNode mrunode;
316 
317 
318  if ( !aface )
319  return FT_THROW( Invalid_Argument );
320 
321  *aface = NULL;
322 
323  if ( !manager )
324  return FT_THROW( Invalid_Cache_Handle );
325 
326  /* we break encapsulation for the sake of speed */
327 #ifdef FTC_INLINE
328 
330  mrunode, error );
331 
332 #else
333  error = FTC_MruList_Lookup( &manager->faces, face_id, &mrunode );
334 #endif
335 
336  if ( !error )
337  *aface = FTC_FACE_NODE( mrunode )->face;
338 
339  return error;
340  }
int FT_Error
Definition: fttypes.h:300
#define FTC_FACE_NODE(x)
Definition: ftcmanag.c:231
FTC_MruListRec faces
Definition: ftcmanag.h:104
#define error(str)
Definition: mkdosfs.c:1605
typedefFT_BEGIN_HEADER struct FTC_MruNodeRec_ * FTC_MruNode
Definition: ftcmru.h:61
#define FT_THROW(e)
Definition: ftdebug.h:213
ftc_face_node_compare(FTC_MruNode ftcnode, FT_Pointer ftcface_id)
Definition: ftcmanag.c:284
smooth NULL
Definition: ftsmooth.c:416
#define FTC_MRULIST_LOOKUP_CMP(list, key, compare, node, error)
Definition: ftcmru.h:164

Referenced by ftc_basic_family_get_count(), FTC_CMapCache_Lookup(), and ftc_scaler_lookup_size().

◆ FTC_Manager_LookupSize()

FTC_Manager_LookupSize ( FTC_Manager  manager,
FTC_Scaler  scaler,
FT_Size asize 
)

Definition at line 183 of file ftcmanag.c.

186  {
187  FT_Error error;
188  FTC_MruNode mrunode;
189 
190 
191  if ( !asize || !scaler )
192  return FT_THROW( Invalid_Argument );
193 
194  *asize = NULL;
195 
196  if ( !manager )
197  return FT_THROW( Invalid_Cache_Handle );
198 
199 #ifdef FTC_INLINE
200 
202  mrunode, error );
203 
204 #else
205  error = FTC_MruList_Lookup( &manager->sizes, scaler, &mrunode );
206 #endif
207 
208  if ( !error )
209  *asize = FTC_SIZE_NODE( mrunode )->size;
210 
211  return error;
212  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
#define FTC_SIZE_NODE(x)
Definition: ftcmanag.c:86
typedefFT_BEGIN_HEADER struct FTC_MruNodeRec_ * FTC_MruNode
Definition: ftcmru.h:61
#define FT_THROW(e)
Definition: ftdebug.h:213
smooth NULL
Definition: ftsmooth.c:416
#define FTC_MRULIST_LOOKUP_CMP(list, key, compare, node, error)
Definition: ftcmru.h:164
FTC_MruListRec sizes
Definition: ftcmanag.h:105
ftc_size_node_compare(FTC_MruNode ftcnode, FT_Pointer ftcscaler)
Definition: ftcmanag.c:104

Referenced by ftc_basic_family_load_bitmap(), and ftc_basic_family_load_glyph().

◆ FTC_Manager_New()

FTC_Manager_New ( FT_Library  library,
FT_UInt  max_faces,
FT_UInt  max_sizes,
FT_ULong  max_bytes,
FTC_Face_Requester  requester,
FT_Pointer  req_data,
FTC_Manager amanager 
)

Definition at line 355 of file ftcmanag.c.

362  {
363  FT_Error error;
365  FTC_Manager manager = 0;
366 
367 
368  if ( !library )
369  return FT_THROW( Invalid_Library_Handle );
370 
371  if ( !amanager || !requester )
372  return FT_THROW( Invalid_Argument );
373 
374  memory = library->memory;
375 
376  if ( FT_NEW( manager ) )
377  goto Exit;
378 
379  if ( max_faces == 0 )
380  max_faces = FTC_MAX_FACES_DEFAULT;
381 
382  if ( max_sizes == 0 )
383  max_sizes = FTC_MAX_SIZES_DEFAULT;
384 
385  if ( max_bytes == 0 )
386  max_bytes = FTC_MAX_BYTES_DEFAULT;
387 
388  manager->library = library;
389  manager->memory = memory;
390  manager->max_weight = max_bytes;
391 
392  manager->request_face = requester;
393  manager->request_data = req_data;
394 
395  FTC_MruList_Init( &manager->faces,
397  max_faces,
398  manager,
399  memory );
400 
401  FTC_MruList_Init( &manager->sizes,
403  max_sizes,
404  manager,
405  memory );
406 
407  *amanager = manager;
408 
409  Exit:
410  return error;
411  }
int FT_Error
Definition: fttypes.h:300
FT_Memory memory
Definition: ftobjs.h:918
FTC_MruListRec faces
Definition: ftcmanag.h:104
#define error(str)
Definition: mkdosfs.c:1605
FT_Offset max_weight
Definition: ftcmanag.h:97
#define FTC_MAX_SIZES_DEFAULT
Definition: ftcmanag.h:84
#define FTC_MAX_FACES_DEFAULT
Definition: ftcmanag.h:83
FT_Library library
Definition: cffdrivr.c:654
static char memory[1024 *256]
Definition: process.c:116
FTC_MruList_Init(FTC_MruList list, FTC_MruListClass clazz, FT_UInt max_nodes, FT_Pointer data, FT_Memory memory)
Definition: ftcmru.c:169
#define FTC_MAX_BYTES_DEFAULT
Definition: ftcmanag.h:85
FT_Library library
Definition: ftcmanag.h:93
FT_Memory memory
Definition: ftcmanag.h:94
#define FT_THROW(e)
Definition: ftdebug.h:213
static const FTC_MruListClassRec ftc_size_list_class
Definition: ftcmanag.c:156
static void Exit(void)
Definition: sock.c:1331
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
static const FTC_MruListClassRec ftc_face_list_class
Definition: ftcmanag.c:296
FT_Pointer request_data
Definition: ftcmanag.h:107
FTC_MruListRec sizes
Definition: ftcmanag.h:105
#define FT_NEW(ptr)
Definition: ftmemory.h:331
FTC_Face_Requester request_face
Definition: ftcmanag.h:108

◆ FTC_Manager_RemoveFaceID()

FTC_Manager_RemoveFaceID ( FTC_Manager  manager,
FTC_FaceID  face_id 
)

Definition at line 670 of file ftcmanag.c.

672  {
673  FT_UInt nn;
674 
675 
676  if ( !manager )
677  return;
678 
679  /* this will remove all FTC_SizeNode that correspond to
680  * the face_id as well
681  */
684  face_id );
685 
686  for ( nn = 0; nn < manager->num_caches; nn++ )
687  FTC_Cache_RemoveFaceID( manager->caches[nn], face_id );
688  }
FTC_MruListRec faces
Definition: ftcmanag.h:104
FTC_MruList_RemoveSelection(FTC_MruList list, FTC_MruNode_CompareFunc selection, FT_Pointer key)
Definition: ftcmru.c:327
ftc_face_node_compare(FTC_MruNode ftcnode, FT_Pointer ftcface_id)
Definition: ftcmanag.c:284
FTC_Cache_RemoveFaceID(FTC_Cache cache, FTC_FaceID face_id)
Definition: ftccache.c:564
unsigned int FT_UInt
Definition: fttypes.h:231
FT_UInt num_caches
Definition: ftcmanag.h:102
FTC_Cache caches[FTC_MAX_CACHES]
Definition: ftcmanag.h:101

◆ FTC_Manager_Reset()

FTC_Manager_Reset ( FTC_Manager  manager)

Definition at line 457 of file ftcmanag.c.

458  {
459  if ( !manager )
460  return;
461 
462  FTC_MruList_Reset( &manager->sizes );
463  FTC_MruList_Reset( &manager->faces );
464 
465  FTC_Manager_FlushN( manager, manager->num_nodes );
466  }
FT_UInt num_nodes
Definition: ftcmanag.h:99
FTC_MruListRec faces
Definition: ftcmanag.h:104
FTC_Manager_FlushN(FTC_Manager manager, FT_UInt count)
Definition: ftcmanag.c:632
FTC_MruListRec sizes
Definition: ftcmanag.h:105
FTC_MruList_Reset(FTC_MruList list)
Definition: ftcmru.c:185

◆ FTC_Node_Unref()

FTC_Node_Unref ( FTC_Node  node,
FTC_Manager  manager 
)

Definition at line 694 of file ftcmanag.c.

696  {
697  if ( node &&
698  manager &&
699  (FT_UInt)node->cache_index < manager->num_caches )
700  node->ref_count--;
701  }
unsigned int FT_UInt
Definition: fttypes.h:231
FT_UInt num_caches
Definition: ftcmanag.h:102
Definition: dlist.c:348

◆ FTC_SBitCache_Lookup()

FTC_SBitCache_Lookup ( FTC_SBitCache  cache,
FTC_ImageType  type,
FT_UInt  gindex,
FTC_SBit sbit,
FTC_Node anode 
)

Definition at line 484 of file ftcbasic.c.

489  {
490  FT_Error error;
492  FTC_Node node = 0; /* make compiler happy */
493  FT_Offset hash;
494 
495 
496  if ( anode )
497  *anode = NULL;
498 
499  /* other argument checks delayed to `FTC_Cache_Lookup' */
500  if ( !ansbit )
501  return FT_THROW( Invalid_Argument );
502 
503  *ansbit = NULL;
504 
505  /*
506  * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
507  * but public `FT_ImageType->flags' is of type `FT_Int32'.
508  *
509  * On 16bit systems, higher bits of type->flags cannot be handled.
510  */
511 #if 0xFFFFFFFFUL > FT_UINT_MAX
512  if ( (type->flags & (FT_ULong)FT_UINT_MAX) )
513  FT_TRACE1(( "FTC_ImageCache_Lookup:"
514  " higher bits in load_flags 0x%x are dropped\n",
515  (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) ));
516 #endif
517 
518  query.attrs.scaler.face_id = type->face_id;
519  query.attrs.scaler.width = type->width;
520  query.attrs.scaler.height = type->height;
521  query.attrs.load_flags = (FT_UInt)type->flags;
522 
523  query.attrs.scaler.pixel = 1;
524  query.attrs.scaler.x_res = 0; /* make compilers happy */
525  query.attrs.scaler.y_res = 0;
526 
527  /* beware, the hash must be the same for all glyph ranges! */
528  hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
529  gindex / FTC_SBIT_ITEMS_PER_NODE;
530 
531 #if 1 /* inlining is about 50% faster! */
535  hash, gindex,
536  &query,
537  node,
538  error );
539 #else
540  error = FTC_GCache_Lookup( FTC_GCACHE( cache ),
541  hash,
542  gindex,
543  FTC_GQUERY( &query ),
544  &node );
545 #endif
546  if ( error )
547  goto Exit;
548 
549  *ansbit = FTC_SNODE( node )->sbits +
550  ( gindex - FTC_GNODE( node )->gindex );
551 
552  if ( anode )
553  {
554  *anode = node;
555  node->ref_count++;
556  }
557 
558  Exit:
559  return error;
560  }
#define FT_UINT_MAX
Definition: ftstdlib.h:65
Definition: cache.c:46
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define FTC_GQUERY(x)
Definition: ftcglyph.h:167
#define FTC_SBIT_ITEMS_PER_NODE
Definition: ftcsbits.h:30
#define error(str)
Definition: mkdosfs.c:1605
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
struct node node
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
int hash
Definition: main.c:58
#define FT_THROW(e)
Definition: ftdebug.h:213
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
static void Exit(void)
Definition: sock.c:1331
#define FTC_GNODE(x)
Definition: ftcglyph.h:156
FTC_SNode_Compare(FTC_SNode snode, FTC_GQuery gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcsbits.c:412
unsigned int FT_UInt
Definition: fttypes.h:231
#define FTC_GCACHE_LOOKUP_CMP(cache, famcmp, nodecmp, hash, gindex, query, node, error)
Definition: ftcglyph.h:280
#define FTC_SNODE(x)
Definition: ftcsbits.h:41
#define FTC_GCACHE(x)
Definition: ftcglyph.h:219
Definition: _hash_fun.h:40
#define FTC_BASIC_ATTR_HASH(a)
Definition: ftcbasic.c:48
GLenum query
Definition: glext.h:7781
size_t FT_Offset
Definition: fttypes.h:324
Definition: dlist.c:348

◆ FTC_SBitCache_LookupScaler()

FTC_SBitCache_LookupScaler ( FTC_SBitCache  cache,
FTC_Scaler  scaler,
FT_ULong  load_flags,
FT_UInt  gindex,
FTC_SBit sbit,
FTC_Node anode 
)

Definition at line 566 of file ftcbasic.c.

572  {
573  FT_Error error;
575  FTC_Node node = 0; /* make compiler happy */
576  FT_Offset hash;
577 
578 
579  if ( anode )
580  *anode = NULL;
581 
582  /* other argument checks delayed to `FTC_Cache_Lookup' */
583  if ( !ansbit || !scaler )
584  return FT_THROW( Invalid_Argument );
585 
586  *ansbit = NULL;
587 
588  /*
589  * Internal `FTC_BasicAttr->load_flags' is of type `FT_UInt',
590  * but public `FT_Face->face_flags' is of type `FT_Long'.
591  *
592  * On long > int systems, higher bits of load_flags cannot be handled.
593  */
594 #if FT_ULONG_MAX > FT_UINT_MAX
595  if ( load_flags > FT_UINT_MAX )
596  FT_TRACE1(( "FTC_ImageCache_LookupScaler:"
597  " higher bits in load_flags 0x%x are dropped\n",
598  load_flags & ~((FT_ULong)FT_UINT_MAX) ));
599 #endif
600 
601  query.attrs.scaler = scaler[0];
602  query.attrs.load_flags = (FT_UInt)load_flags;
603 
604  /* beware, the hash must be the same for all glyph ranges! */
605  hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +
606  gindex / FTC_SBIT_ITEMS_PER_NODE;
607 
611  hash, gindex,
612  &query,
613  node,
614  error );
615  if ( error )
616  goto Exit;
617 
618  *ansbit = FTC_SNODE( node )->sbits +
619  ( gindex - FTC_GNODE( node )->gindex );
620 
621  if ( anode )
622  {
623  *anode = node;
624  node->ref_count++;
625  }
626 
627  Exit:
628  return error;
629  }
#define FT_UINT_MAX
Definition: ftstdlib.h:65
Definition: cache.c:46
int FT_Error
Definition: fttypes.h:300
unsigned long FT_ULong
Definition: fttypes.h:253
#define FTC_SBIT_ITEMS_PER_NODE
Definition: ftcsbits.h:30
#define error(str)
Definition: mkdosfs.c:1605
struct node node
#define FT_TRACE1(varformat)
Definition: ftdebug.h:158
int hash
Definition: main.c:58
#define FT_THROW(e)
Definition: ftdebug.h:213
ftc_basic_family_compare(FTC_MruNode ftcfamily, FT_Pointer ftcquery)
Definition: ftcbasic.c:69
smooth NULL
Definition: ftsmooth.c:416
static void Exit(void)
Definition: sock.c:1331
#define FTC_GNODE(x)
Definition: ftcglyph.h:156
FTC_SNode_Compare(FTC_SNode snode, FTC_GQuery gquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftcsbits.c:412
unsigned int FT_UInt
Definition: fttypes.h:231
#define FTC_GCACHE_LOOKUP_CMP(cache, famcmp, nodecmp, hash, gindex, query, node, error)
Definition: ftcglyph.h:280
#define FTC_SNODE(x)
Definition: ftcsbits.h:41
Definition: _hash_fun.h:40
#define FTC_BASIC_ATTR_HASH(a)
Definition: ftcbasic.c:48
GLenum query
Definition: glext.h:7781
size_t FT_Offset
Definition: fttypes.h:324
Definition: dlist.c:348

◆ FTC_SBitCache_New()

FTC_SBitCache_New ( FTC_Manager  manager,
FTC_SBitCache acache 
)

Definition at line 473 of file ftcbasic.c.

475  {
476  return FTC_GCache_New( manager, &ftc_basic_sbit_cache_class,
477  (FTC_GCache*)acache );
478  }
static const FTC_GCacheClassRec ftc_basic_sbit_cache_class
Definition: ftcbasic.c:452
FTC_GCache_New(FTC_Manager manager, FTC_GCacheClass clazz, FTC_GCache *acache)
Definition: ftcglyph.c:175

Variable Documentation

◆ FTC_FaceID