ReactOS  0.4.14-dev-317-g96040ec
ftcmanag.c File Reference
#include <ft2build.h>
#include "ftcmanag.h"
#include "ftccback.h"
#include "ftcerror.h"
Include dependency graph for ftcmanag.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FTC_SizeNodeRec_
 
struct  FTC_FaceNodeRec_
 

Macros

#define FT_COMPONENT   trace_cache
 
#define FTC_SIZE_NODE(x)   ( (FTC_SizeNode)( x ) )
 
#define FTC_FACE_NODE(x)   ( ( FTC_FaceNode )( x ) )
 

Typedefs

typedef struct FTC_SizeNodeRec_ FTC_SizeNodeRec
 
typedef struct FTC_SizeNodeRec_FTC_SizeNode
 
typedef struct FTC_FaceNodeRec_ FTC_FaceNodeRec
 
typedef struct FTC_FaceNodeRec_FTC_FaceNode
 

Functions

static FT_Error ftc_scaler_lookup_size (FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize)
 
 ftc_size_node_done (FTC_MruNode ftcnode, FT_Pointer data)
 
 ftc_size_node_compare (FTC_MruNode ftcnode, FT_Pointer ftcscaler)
 
 ftc_size_node_init (FTC_MruNode ftcnode, FT_Pointer ftcscaler, FT_Pointer ftcmanager)
 
 ftc_size_node_reset (FTC_MruNode ftcnode, FT_Pointer ftcscaler, FT_Pointer ftcmanager)
 
static FT_Bool ftc_size_node_compare_faceid (FTC_MruNode ftcnode, FT_Pointer ftcface_id)
 
 FTC_Manager_LookupSize (FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize)
 
 ftc_face_node_init (FTC_MruNode ftcnode, FT_Pointer ftcface_id, FT_Pointer ftcmanager)
 
 ftc_face_node_done (FTC_MruNode ftcnode, FT_Pointer ftcmanager)
 
 ftc_face_node_compare (FTC_MruNode ftcnode, FT_Pointer ftcface_id)
 
 FTC_Manager_LookupFace (FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface)
 
 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_Done (FTC_Manager manager)
 
 FTC_Manager_Reset (FTC_Manager manager)
 
 FTC_Manager_Compress (FTC_Manager manager)
 
 FTC_Manager_RegisterCache (FTC_Manager manager, FTC_CacheClass clazz, FTC_Cache *acache)
 
 FTC_Manager_FlushN (FTC_Manager manager, FT_UInt count)
 
 FTC_Manager_RemoveFaceID (FTC_Manager manager, FTC_FaceID face_id)
 
 FTC_Node_Unref (FTC_Node node, FTC_Manager manager)
 

Variables

static const FTC_MruListClassRec ftc_size_list_class
 
static const FTC_MruListClassRec ftc_face_list_class
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   trace_cache

Definition at line 35 of file ftcmanag.c.

◆ FTC_FACE_NODE

#define FTC_FACE_NODE (   x)    ( ( FTC_FaceNode )( x ) )

Definition at line 231 of file ftcmanag.c.

◆ FTC_SIZE_NODE

#define FTC_SIZE_NODE (   x)    ( (FTC_SizeNode)( x ) )

Definition at line 86 of file ftcmanag.c.

Typedef Documentation

◆ FTC_FaceNode

◆ FTC_FaceNodeRec

◆ FTC_SizeNode

◆ FTC_SizeNodeRec

Function Documentation

◆ ftc_face_node_compare()

ftc_face_node_compare ( FTC_MruNode  ftcnode,
FT_Pointer  ftcface_id 
)

Definition at line 284 of file ftcmanag.c.

286  {
287  FTC_FaceNode node = (FTC_FaceNode)ftcnode;
288  FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
289 
290 
291  return FT_BOOL( node->face_id == face_id );
292  }
FT_BEGIN_HEADER typedef FT_Pointer FTC_FaceID
Definition: ftcache.h:171
#define FT_BOOL(x)
Definition: fttypes.h:578
struct FTC_FaceNodeRec_ * FTC_FaceNode
Definition: dlist.c:348

Referenced by FTC_Manager_LookupFace(), and FTC_Manager_RemoveFaceID().

◆ ftc_face_node_done()

ftc_face_node_done ( FTC_MruNode  ftcnode,
FT_Pointer  ftcmanager 
)

Definition at line 263 of file ftcmanag.c.

265  {
266  FTC_FaceNode node = (FTC_FaceNode)ftcnode;
267  FTC_Manager manager = (FTC_Manager)ftcmanager;
268 
269 
270  /* we must begin by removing all scalers for the target face */
271  /* from the manager's list */
274  node->face_id );
275 
276  /* all right, we can discard the face now */
277  FT_Done_Face( node->face );
278  node->face = NULL;
279  node->face_id = NULL;
280  }
FTC_MruList_RemoveSelection(FTC_MruList list, FTC_MruNode_CompareFunc selection, FT_Pointer key)
Definition: ftcmru.c:327
smooth NULL
Definition: ftsmooth.c:416
static FT_Bool ftc_size_node_compare_faceid(FTC_MruNode ftcnode, FT_Pointer ftcface_id)
Definition: ftcmanag.c:169
struct FTC_ManagerRec_ * FTC_Manager
Definition: ftcache.h:250
FTC_MruListRec sizes
Definition: ftcmanag.h:105
FT_Done_Face(FT_Face face)
Definition: ftobjs.c:2721
struct FTC_FaceNodeRec_ * FTC_FaceNode
Definition: dlist.c:348

◆ ftc_face_node_init()

ftc_face_node_init ( FTC_MruNode  ftcnode,
FT_Pointer  ftcface_id,
FT_Pointer  ftcmanager 
)

Definition at line 235 of file ftcmanag.c.

238  {
239  FTC_FaceNode node = (FTC_FaceNode)ftcnode;
240  FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
241  FTC_Manager manager = (FTC_Manager)ftcmanager;
242  FT_Error error;
243 
244 
245  node->face_id = face_id;
246 
247  error = manager->request_face( face_id,
248  manager->library,
249  manager->request_data,
250  &node->face );
251  if ( !error )
252  {
253  /* destroy initial size object; it will be re-created later */
254  if ( node->face->size )
255  FT_Done_Size( node->face->size );
256  }
257 
258  return error;
259  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
FT_BEGIN_HEADER typedef FT_Pointer FTC_FaceID
Definition: ftcache.h:171
FT_Library library
Definition: ftcmanag.h:93
struct FTC_ManagerRec_ * FTC_Manager
Definition: ftcache.h:250
FT_Done_Size(FT_Size size)
Definition: ftobjs.c:2827
FT_Pointer request_data
Definition: ftcmanag.h:107
struct FTC_FaceNodeRec_ * FTC_FaceNode
FTC_Face_Requester request_face
Definition: ftcmanag.h:108
Definition: dlist.c:348

◆ FTC_Manager_Compress()

FTC_Manager_Compress ( FTC_Manager  manager)

Definition at line 538 of file ftcmanag.c.

539  {
541 
542 
543  if ( !manager )
544  return;
545 
546  first = manager->nodes_list;
547 
548 #ifdef FT_DEBUG_ERROR
549  FTC_Manager_Check( manager );
550 
551  FT_TRACE0(( "compressing, weight = %ld, max = %ld, nodes = %d\n",
552  manager->cur_weight, manager->max_weight,
553  manager->num_nodes ));
554 #endif
555 
556  if ( manager->cur_weight < manager->max_weight || !first )
557  return;
558 
559  /* go to last node -- it's a circular list */
560  node = FTC_NODE_PREV( first );
561  do
562  {
563  FTC_Node prev;
564 
565 
566  prev = ( node == first ) ? NULL : FTC_NODE_PREV( node );
567 
568  if ( node->ref_count <= 0 )
569  ftc_node_destroy( node, manager );
570 
571  node = prev;
572 
573  } while ( node && manager->cur_weight > manager->max_weight );
574  }
FT_UInt num_nodes
Definition: ftcmanag.h:99
const GLint * first
Definition: glext.h:5794
FT_Offset max_weight
Definition: ftcmanag.h:97
FT_Offset cur_weight
Definition: ftcmanag.h:98
struct node node
smooth NULL
Definition: ftsmooth.c:416
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
#define FTC_NODE_PREV(x)
Definition: ftccache.h:73
ftc_node_destroy(FTC_Node node, FTC_Manager manager)
Definition: ftccache.c:273
FTC_Node nodes_list
Definition: ftcmanag.h:96
Definition: dlist.c:348

Referenced by ftc_cache_add().

◆ 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_FlushN()

FTC_Manager_FlushN ( FTC_Manager  manager,
FT_UInt  count 
)

Definition at line 632 of file ftcmanag.c.

634  {
635  FTC_Node first = manager->nodes_list;
636  FTC_Node node;
637  FT_UInt result;
638 
639 
640  /* try to remove `count' nodes from the list */
641  if ( !first ) /* empty list! */
642  return 0;
643 
644  /* go to last node - it's a circular list */
646  for ( result = 0; result < count; )
647  {
648  FTC_Node prev = FTC_NODE_PREV( node );
649 
650 
651  /* don't touch locked nodes */
652  if ( node->ref_count <= 0 )
653  {
654  ftc_node_destroy( node, manager );
655  result++;
656  }
657 
658  if ( node == first )
659  break;
660 
661  node = prev;
662  }
663  return result;
664  }
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
struct node node
#define FTC_NODE_PREV(x)
Definition: ftccache.h:73
ftc_node_destroy(FTC_Node node, FTC_Manager manager)
Definition: ftccache.c:273
FTC_Node nodes_list
Definition: ftcmanag.h:96
unsigned int FT_UInt
Definition: fttypes.h:231
GLuint64EXT * result
Definition: glext.h:11304
Definition: dlist.c:348

Referenced by FTC_Manager_Reset().

◆ 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_RegisterCache()

FTC_Manager_RegisterCache ( FTC_Manager  manager,
FTC_CacheClass  clazz,
FTC_Cache acache 
)

Definition at line 580 of file ftcmanag.c.

583  {
584  FT_Error error = FT_ERR( Invalid_Argument );
585  FTC_Cache cache = NULL;
586 
587 
588  if ( manager && clazz && acache )
589  {
590  FT_Memory memory = manager->memory;
591 
592 
593  if ( manager->num_caches >= FTC_MAX_CACHES )
594  {
595  error = FT_THROW( Too_Many_Caches );
596  FT_ERROR(( "FTC_Manager_RegisterCache:"
597  " too many registered caches\n" ));
598  goto Exit;
599  }
600 
601  if ( !FT_ALLOC( cache, clazz->cache_size ) )
602  {
603  cache->manager = manager;
604  cache->memory = memory;
605  cache->clazz = clazz[0];
606  cache->org_class = clazz;
607 
608  /* THIS IS VERY IMPORTANT! IT WILL WRETCH THE MANAGER */
609  /* IF IT IS NOT SET CORRECTLY */
610  cache->index = manager->num_caches;
611 
612  error = clazz->cache_init( cache );
613  if ( error )
614  {
615  clazz->cache_done( cache );
616  FT_FREE( cache );
617  goto Exit;
618  }
619 
620  manager->caches[manager->num_caches++] = cache;
621  }
622  }
623 
624  Exit:
625  if ( acache )
626  *acache = cache;
627  return error;
628  }
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
Definition: cache.c:46
int FT_Error
Definition: fttypes.h:300
FT_Offset cache_size
Definition: ftccache.h:135
#define error(str)
Definition: mkdosfs.c:1605
static char memory[1024 *256]
Definition: process.c:116
FT_Memory memory
Definition: ftcmanag.h:94
#define FT_ERROR(varformat)
Definition: ftdebug.h:181
#define FT_THROW(e)
Definition: ftdebug.h:213
smooth NULL
Definition: ftsmooth.c:416
#define FT_FREE(ptr)
Definition: ftmemory.h:329
#define FT_ERR(e)
Definition: fttypes.h:586
static void Exit(void)
Definition: sock.c:1331
FTC_Cache_DoneFunc cache_done
Definition: ftccache.h:137
static IOleCache * cache
Definition: ole2.c:75
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
#define FTC_MAX_CACHES
Definition: ftcmanag.h:88
FTC_Cache_InitFunc cache_init
Definition: ftccache.h:136
FT_UInt num_caches
Definition: ftcmanag.h:102
FTC_Cache caches[FTC_MAX_CACHES]
Definition: ftcmanag.h:101

Referenced by FTC_CMapCache_New(), and FTC_GCache_New().

◆ 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_scaler_lookup_size()

static FT_Error ftc_scaler_lookup_size ( FTC_Manager  manager,
FTC_Scaler  scaler,
FT_Size asize 
)
static

Definition at line 39 of file ftcmanag.c.

42  {
43  FT_Face face;
44  FT_Size size = NULL;
46 
47 
48  error = FTC_Manager_LookupFace( manager, scaler->face_id, &face );
49  if ( error )
50  goto Exit;
51 
52  error = FT_New_Size( face, &size );
53  if ( error )
54  goto Exit;
55 
57 
58  if ( scaler->pixel )
59  error = FT_Set_Pixel_Sizes( face, scaler->width, scaler->height );
60  else
62  (FT_F26Dot6)scaler->width,
63  (FT_F26Dot6)scaler->height,
64  scaler->x_res,
65  scaler->y_res );
66  if ( error )
67  {
68  FT_Done_Size( size );
69  size = NULL;
70  }
71 
72  Exit:
73  *asize = size;
74  return error;
75  }
int FT_Error
Definition: fttypes.h:300
#define error(str)
Definition: mkdosfs.c:1605
FT_UInt height
Definition: ftcache.h:429
WORD face[3]
Definition: mesh.c:4747
FT_Set_Pixel_Sizes(FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height)
Definition: ftobjs.c:3309
FT_Int pixel
Definition: ftcache.h:430
FTC_Manager_LookupFace(FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface)
Definition: ftcmanag.c:310
smooth NULL
Definition: ftsmooth.c:416
FT_UInt y_res
Definition: ftcache.h:432
FT_Set_Char_Size(FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, FT_UInt horz_resolution, FT_UInt vert_resolution)
Definition: ftobjs.c:3267
GLsizeiptr size
Definition: glext.h:5919
FT_UInt width
Definition: ftcache.h:428
static void Exit(void)
Definition: sock.c:1331
FT_Activate_Size(FT_Size size)
Definition: ftobjs.c:4230
FT_Done_Size(FT_Size size)
Definition: ftobjs.c:2827
FT_UInt x_res
Definition: ftcache.h:431
signed long FT_F26Dot6
Definition: fttypes.h:276
FTC_FaceID face_id
Definition: ftcache.h:427
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
FT_BEGIN_HEADER FT_New_Size(FT_Face face, FT_Size *size)
Definition: ftobjs.c:2762

Referenced by ftc_size_node_init(), and ftc_size_node_reset().

◆ ftc_size_node_compare()

ftc_size_node_compare ( FTC_MruNode  ftcnode,
FT_Pointer  ftcscaler 
)

Definition at line 104 of file ftcmanag.c.

106  {
107  FTC_SizeNode node = (FTC_SizeNode)ftcnode;
108  FTC_Scaler scaler = (FTC_Scaler)ftcscaler;
109  FTC_Scaler scaler0 = &node->scaler;
110 
111 
112  if ( FTC_SCALER_COMPARE( scaler0, scaler ) )
113  {
114  FT_Activate_Size( node->size );
115  return 1;
116  }
117  return 0;
118  }
struct FTC_ScalerRec_ * FTC_Scaler
Definition: ftcache.h:445
#define FTC_SCALER_COMPARE(a, b)
Definition: ftcmanag.h:154
struct FTC_SizeNodeRec_ * FTC_SizeNode
FT_Activate_Size(FT_Size size)
Definition: ftobjs.c:4230
Definition: dlist.c:348

Referenced by FTC_Manager_LookupSize().

◆ ftc_size_node_compare_faceid()

static FT_Bool ftc_size_node_compare_faceid ( FTC_MruNode  ftcnode,
FT_Pointer  ftcface_id 
)
static

Definition at line 169 of file ftcmanag.c.

171  {
172  FTC_SizeNode node = (FTC_SizeNode)ftcnode;
173  FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
174 
175 
176  return FT_BOOL( node->scaler.face_id == face_id );
177  }
FT_BEGIN_HEADER typedef FT_Pointer FTC_FaceID
Definition: ftcache.h:171
struct FTC_SizeNodeRec_ * FTC_SizeNode
#define FT_BOOL(x)
Definition: fttypes.h:578
Definition: dlist.c:348

Referenced by ftc_face_node_done().

◆ ftc_size_node_done()

ftc_size_node_done ( FTC_MruNode  ftcnode,
FT_Pointer  data 
)

Definition at line 90 of file ftcmanag.c.

92  {
93  FTC_SizeNode node = (FTC_SizeNode)ftcnode;
94  FT_Size size = node->size;
95  FT_UNUSED( data );
96 
97 
98  if ( size )
99  FT_Done_Size( size );
100  }
struct FTC_SizeNodeRec_ * FTC_SizeNode
GLsizeiptr size
Definition: glext.h:5919
FT_Done_Size(FT_Size size)
Definition: ftobjs.c:2827
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
Definition: dlist.c:348

◆ ftc_size_node_init()

ftc_size_node_init ( FTC_MruNode  ftcnode,
FT_Pointer  ftcscaler,
FT_Pointer  ftcmanager 
)

Definition at line 122 of file ftcmanag.c.

125  {
126  FTC_SizeNode node = (FTC_SizeNode)ftcnode;
127  FTC_Scaler scaler = (FTC_Scaler)ftcscaler;
128  FTC_Manager manager = (FTC_Manager)ftcmanager;
129 
130 
131  node->scaler = scaler[0];
132 
133  return ftc_scaler_lookup_size( manager, scaler, &node->size );
134  }
struct FTC_ScalerRec_ * FTC_Scaler
Definition: ftcache.h:445
struct FTC_SizeNodeRec_ * FTC_SizeNode
struct FTC_ManagerRec_ * FTC_Manager
Definition: ftcache.h:250
static FT_Error ftc_scaler_lookup_size(FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize)
Definition: ftcmanag.c:39
Definition: dlist.c:348

◆ ftc_size_node_reset()

ftc_size_node_reset ( FTC_MruNode  ftcnode,
FT_Pointer  ftcscaler,
FT_Pointer  ftcmanager 
)

Definition at line 138 of file ftcmanag.c.

141  {
142  FTC_SizeNode node = (FTC_SizeNode)ftcnode;
143  FTC_Scaler scaler = (FTC_Scaler)ftcscaler;
144  FTC_Manager manager = (FTC_Manager)ftcmanager;
145 
146 
147  FT_Done_Size( node->size );
148 
149  node->scaler = scaler[0];
150 
151  return ftc_scaler_lookup_size( manager, scaler, &node->size );
152  }
struct FTC_ScalerRec_ * FTC_Scaler
Definition: ftcache.h:445
struct FTC_SizeNodeRec_ * FTC_SizeNode
struct FTC_ManagerRec_ * FTC_Manager
Definition: ftcache.h:250
FT_Done_Size(FT_Size size)
Definition: ftobjs.c:2827
static FT_Error ftc_scaler_lookup_size(FTC_Manager manager, FTC_Scaler scaler, FT_Size *asize)
Definition: ftcmanag.c:39
Definition: dlist.c:348

Variable Documentation

◆ ftc_face_list_class

const FTC_MruListClassRec ftc_face_list_class
static
Initial value:
=
{
sizeof ( FTC_FaceNodeRec),
NULL,
}
ftc_face_node_compare(FTC_MruNode ftcnode, FT_Pointer ftcface_id)
Definition: ftcmanag.c:284
smooth NULL
Definition: ftsmooth.c:416
ftc_face_node_init(FTC_MruNode ftcnode, FT_Pointer ftcface_id, FT_Pointer ftcmanager)
Definition: ftcmanag.c:235
ftc_face_node_done(FTC_MruNode ftcnode, FT_Pointer ftcmanager)
Definition: ftcmanag.c:263
struct FTC_FaceNodeRec_ FTC_FaceNodeRec

Definition at line 296 of file ftcmanag.c.

Referenced by FTC_Manager_New().

◆ ftc_size_list_class

const FTC_MruListClassRec ftc_size_list_class
static
Initial value:
=
{
sizeof ( FTC_SizeNodeRec ),
}
ftc_size_node_reset(FTC_MruNode ftcnode, FT_Pointer ftcscaler, FT_Pointer ftcmanager)
Definition: ftcmanag.c:138
struct FTC_SizeNodeRec_ FTC_SizeNodeRec
ftc_size_node_done(FTC_MruNode ftcnode, FT_Pointer data)
Definition: ftcmanag.c:90
ftc_size_node_compare(FTC_MruNode ftcnode, FT_Pointer ftcscaler)
Definition: ftcmanag.c:104
ftc_size_node_init(FTC_MruNode ftcnode, FT_Pointer ftcscaler, FT_Pointer ftcmanager)
Definition: ftcmanag.c:122

Definition at line 156 of file ftcmanag.c.

Referenced by FTC_Manager_New().