Commit 9b8f5c4ce1ac3f75c2b8960fc31cafe868fa8731

David Turner 2000-10-28T07:26:59

small updates: - reworked slightly the cache manager to better differentiate between the abstract class in "ftcglyph.h" and the FT_Glyph sub-class in "ftcimage.h", and slightly reduced the size of FTC_GlyphNodeRec, saving 8 bytes on a 32-bit system. Yes, I'm crazy ;-) - added build files to compile with LCC on Unix too (compile speeds _are_ insane with it). There is unfortunately a bug in the version I'm using (LCC 4.1) that prevents it to compile FT_MulTo64 correctly (in src/base/ftcalc.c) the generated assembly is incorrect, I don't know what to do ?? the build files are ok, though.. you should invoke "make setup lcc" to select them..

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
diff --git a/builds/compiler/unix-lcc.mk b/builds/compiler/unix-lcc.mk
new file mode 100644
index 0000000..e1a925f
--- /dev/null
+++ b/builds/compiler/unix-lcc.mk
@@ -0,0 +1,86 @@
+#
+# FreeType 2 Unix LCC specific definitions
+#
+
+
+# Copyright 1996-2000 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.
+
+
+# Command line name
+#
+CC := lcc
+
+
+# The object file extension (for standard and static libraries).  This can be
+# .o, .tco, .obj, etc., depending on the platform.
+#
+O  := o
+SO := o
+
+
+# The library file extension (for standard and static libraries).  This can
+# be .a, .lib, etc., depending on the platform.
+#
+A  := a
+SA := a
+
+
+# Path inclusion flag.  Some compilers use a different flag than `-I' to
+# specify an additional include path.  Examples are `/i=' or `-J'.
+#
+I := -I
+
+
+# C flag used to define a macro before the compilation of a given source
+# object.  Usually it is `-D' like in `-DDEBUG'.
+#
+D := -D
+
+
+# The link flag used to specify a given library file on link.  Note that
+# this is only used to compile the demo programs, not the library itself.
+#
+L := -l
+
+
+# Target flag.
+#
+T := -o # don't remove this comment, we need a trailing space !!
+
+
+# C flags
+#
+#   These should concern: debug output, optimization & warnings.
+#
+#   Use the ANSIFLAGS variable to define the compiler flags used to enfore
+#   ANSI compliance.
+#
+ifndef CFLAGS
+  CFLAGS := -c -g
+endif
+
+# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
+#
+#  LCC is pure ANSI anyway!
+#
+#  the "-A" flag simply increments verbosity about non ANSI code 
+#
+ANSIFLAGS := -A
+
+
+# library linking
+#
+ifndef CLEAN_LIBRARY
+  CLEAN_LIBRARY = $(DELETE) $(subst $(SEP),$(HOSTSEP),$(PROJECT_LIBRARY)) \
+                  $(NO_OUTPUT)
+endif
+LINK_LIBRARY = $(AR) -r $@ $(OBJECTS_LIST)
+                    
+# EOF
diff --git a/builds/unix/detect.mk b/builds/unix/detect.mk
index 85d7a22..af8b62b 100644
--- a/builds/unix/detect.mk
+++ b/builds/unix/detect.mk
@@ -30,21 +30,30 @@ ifeq ($(PLATFORM),ansi)
       CONFIG_FILE := unix-dev.mk
       devel: setup
     else
-      # If a Unix platform is detected, the configure script is called and
-      # `unix-def.mk' together with `unix-cc.mk' is created.
-      #
-      # Arguments to `configure' should be in the CFG variable.  Example:
-      #
-      #   make CFG="--prefix=/usr --disable-static"
-      #
-      # If you need to set CFLAGS or LDFLAGS, do it here also.
-      #
-      # Feel free to add support for other platform specific compilers in this
-      # directory (e.g. solaris.mk + changes here to detect the platform).
-      #
-      CONFIG_FILE := unix.mk
-      setup: unix-def.mk
-      unix: setup
+
+    # If `lccl' is the requested target, we use a special configuration
+    # file named `unix-lcc.mk'.  It disables libtool for LCC
+    #
+      ifneq ($(findstring lcc,$(MAKECMDGOALS)),)
+        CONFIG_FILE := unix-lcc.mk
+        lcc: setup
+      else
+        # If a Unix platform is detected, the configure script is called and
+        # `unix-def.mk' together with `unix-cc.mk' is created.
+        #
+        # Arguments to `configure' should be in the CFG variable.  Example:
+        #
+        #   make CFG="--prefix=/usr --disable-static"
+        #
+        # If you need to set CFLAGS or LDFLAGS, do it here also.
+        #
+        # Feel free to add support for other platform specific compilers in this
+        # directory (e.g. solaris.mk + changes here to detect the platform).
+        #
+        CONFIG_FILE := unix.mk
+        setup: unix-def.mk
+        unix: setup
+      endif
     endif
 
     setup: std_setup
diff --git a/builds/unix/unix-lcc.mk b/builds/unix/unix-lcc.mk
new file mode 100644
index 0000000..dab175c
--- /dev/null
+++ b/builds/unix/unix-lcc.mk
@@ -0,0 +1,23 @@
+#
+# FreeType 2 Configuration rules for Unix + LCC
+#
+#   Development version without optimizations & libtool
+#   and no installation.
+#
+
+
+# Copyright 1996-2000 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.
+
+
+include $(TOP)/builds/unix/unixddef.mk
+include $(TOP)/builds/compiler/unix-lcc.mk
+include $(TOP)/builds/link_std.mk
+
+# EOF
diff --git a/include/freetype/cache/ftcglyph.h b/include/freetype/cache/ftcglyph.h
index 0a18823..9d49ac8 100644
--- a/include/freetype/cache/ftcglyph.h
+++ b/include/freetype/cache/ftcglyph.h
@@ -49,7 +49,6 @@
 
 
 #include <freetype/cache/ftcmanag.h>
-#include <freetype/ftglyph.h>
 #include <stddef.h>
 
 
@@ -58,7 +57,7 @@
 #endif
 
 
-  /* maximum number of queues per image cache; must be < 256 */
+  /* maximum number of queues per glyph cache; must be < 256 */
 #define FTC_MAX_GLYPH_QUEUES  16
 
 #define FTC_QUEUE_HASH_SIZE_DEFAULT  64
@@ -70,35 +69,14 @@
   typedef struct  FTC_GlyphNodeRec_
   {
     FTC_CacheNodeRec  root;
-
-    /* link.data contains a handle to a FT_Glyph object */
-    FT_ListNodeRec    link;
-
+    FTC_GlyphNode     queue_next;   /* next in queue's bucket list */
     FT_UShort         glyph_index;
     FT_UShort         queue_index;
 
   } FTC_GlyphNodeRec;
 
 
-#define FTC_GLYPHNODE_GET_GLYPH( n ) \
-          ( (FT_Glyph)((n)->link.data) )
-#define FTC_GLYPHNODE_SET_GLYPH( n, g ) \
-          do                            \
-          {                             \
-            (n)->link.data = (g);       \
-          } while ( 0 )
-
-  /* this macro is used to extract a handle to the bucket's lru list */
-  /* corresponding to a given image node                             */
-#define FTC_GLYPHNODE_TO_LISTNODE( n ) \
-          ( (FT_ListNode)&(n)->link )
-
-  /* this macro is used to extract a handle to a given image node from */
-  /* the corresponding LRU glyph list node. That's a bit hackish...    */
-#define FTC_LISTNODE_TO_GLYPHNODE( p )                             \
-          ( (FTC_GlyphNode)( (char*)(p) -                          \
-                             offsetof( FTC_GlyphNodeRec,link ) ) )
-
+#define FTC_GLYPHNODE(x)               ( (FTC_GlyphNode)(x) )
 #define FTC_GLYPHNODE_TO_LRUNODE( n )  ( (FT_ListNode)(n) )
 #define FTC_LRUNODE_TO_GLYPHNODE( n )  ( (FTC_GlyphNode)(n) )
 
@@ -150,7 +128,7 @@
     FTC_Glyph_Queue_Class*  clazz;
     FTC_Image_Desc          descriptor;
     FT_UInt                 hash_size;
-    FT_List                 buckets;
+    FTC_GlyphNode*          buckets;
     FT_UInt                 queue_index;  /* index in parent cache    */
 
   } FTC_Glyph_QueueRec;
@@ -170,7 +148,7 @@
   {
     FTC_CacheRec     root;
     FT_Lru           queues_lru;  /* static queues lru list */
-    FTC_Glyph_Queue  last_queue;  /* small cache            */
+    FTC_Glyph_Queue  last_queue;  /* small cache :-)        */
 
   } FTC_Glyph_CacheRec;
 
@@ -182,9 +160,10 @@
   /* cache sub-system internals.                                           */
   /*                                                                       */
 
-  FT_EXPORT_FUNC( void )  FTC_GlyphNode_Init( FTC_GlyphNode    node,
-                                              FTC_Glyph_Queue  queue,
-                                              FT_UInt          gindex );
+  FT_EXPORT_FUNC( void )
+  FTC_GlyphNode_Init( FTC_GlyphNode    node,
+                      FTC_Glyph_Queue  queue,
+                      FT_UInt          gindex );
 
 #define FTC_GlyphNode_Ref( n ) \
           FTC_CACHENODE_TO_DATA_P( &(n)->root )->ref_count++
@@ -193,21 +172,30 @@
           FTC_CACHENODE_TO_DATA_P( &(n)->root )->ref_count--
 
 
-  FT_EXPORT_DEF( void )  FTC_Destroy_Glyph_Node( FTC_GlyphNode    node,
-                                                 FTC_Glyph_Cache  cache );
+  FT_EXPORT_DEF( void )
+  FTC_Destroy_Glyph_Node( FTC_GlyphNode    node,
+                          FTC_Glyph_Cache  cache );
+
+
+
+  FT_EXPORT_DEF( FT_Error )
+  FTC_Glyph_Cache_Init( FTC_Glyph_Cache  cache );
+
+
+  FT_EXPORT_DEF( void )
+  FTC_Glyph_Cache_Done( FTC_Glyph_Cache  cache );
 
 
-  FT_EXPORT_DEF( FT_Error )  FTC_Glyph_Cache_Init( FTC_Glyph_Cache  cache );
 
-  FT_EXPORT_DEF( void )  FTC_Glyph_Cache_Done( FTC_Glyph_Cache  cache );
 
+  FT_EXPORT_DEF( FT_Error )
+  FTC_Glyph_Queue_New( FTC_Glyph_Cache   cache,
+                       FT_Pointer        type,
+                       FTC_Glyph_Queue*  aqueue );
 
-  FT_EXPORT_DEF( FT_Error )  FTC_Glyph_Queue_New( FTC_Glyph_Cache   cache,
-                                                  FT_Pointer        type,
-                                                  FTC_Glyph_Queue*  aqueue );
 
-  FT_EXPORT_DEF( FT_Error )  FTC_Glyph_Queue_Lookup_Node(
-                               FTC_Glyph_Queue  queue,
+  FT_EXPORT_DEF( FT_Error )
+  FTC_Glyph_Queue_Lookup_Node( FTC_Glyph_Queue  queue,
                                FT_UInt          glyph_index,
                                FTC_GlyphNode*   anode );
 
diff --git a/include/freetype/cache/ftcmanag.h b/include/freetype/cache/ftcmanag.h
index 0956a4d..0b13e34 100644
--- a/include/freetype/cache/ftcmanag.h
+++ b/include/freetype/cache/ftcmanag.h
@@ -74,9 +74,9 @@
 
 
   /* default values */
-#define FTC_MAX_FACES_DEFAULT  4
-#define FTC_MAX_SIZES_DEFAULT  8
-#define FTC_MAX_BYTES_DEFAULT  300000  /* 300kByte by default! */
+#define FTC_MAX_FACES_DEFAULT  2
+#define FTC_MAX_SIZES_DEFAULT  4
+#define FTC_MAX_BYTES_DEFAULT  200000  /* 200kByte by default! */
 
   /* maximum number of caches registered in a single manager */
 #define FTC_MAX_CACHES         16
@@ -114,7 +114,7 @@
   /* the global_lru list of the manager.  Its `data' field however is used */
   /* as a reference count for now.                                         */
   /*                                                                       */
-  /* A node can be anything, depending on the type of information hold by  */
+  /* A node can be anything, depending on the type of information held by  */
   /* the cache.  It can be an individual glyph image, a set of bitmaps     */
   /* glyphs for a given size, some metrics, etc.                           */
   /*                                                                       */
@@ -123,7 +123,7 @@
   typedef FTC_CacheNodeRec*  FTC_CacheNode;
 
 
-  /* the fields `cachenode.data' is typecast to this type */
+  /* the fields `cachenode.data' is typecasted to this type */
   typedef struct  FTC_CacheNode_Data_
   {
     FT_UShort  cache_index;
@@ -169,8 +169,7 @@
 
 
   typedef FT_Error  (*FTC_Cache_InitFunc)( FTC_Cache  cache );
-
-  typedef void  (*FTC_Cache_DoneFunc)( FTC_Cache  cache );
+  typedef void      (*FTC_Cache_DoneFunc)( FTC_Cache  cache );
 
 
   struct  FTC_Cache_Class_
diff --git a/include/freetype/cache/ftlru.h b/include/freetype/cache/ftlru.h
index 856caef..d514fd3 100644
--- a/include/freetype/cache/ftlru.h
+++ b/include/freetype/cache/ftlru.h
@@ -20,7 +20,7 @@
   /*                                                                       */
   /* An LRU is a list that cannot hold more than a certain number of       */
   /* elements (`max_elements').  All elements on the list are sorted in    */
-  /* lest-recently-used order, i.e., the `oldest' element is at the tail   */
+  /* 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()'),   */
diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c
index 970cc3d..400739c 100644
--- a/src/cache/ftcglyph.c
+++ b/src/cache/ftcglyph.c
@@ -65,7 +65,7 @@
   /* Important: This function is called from the cache manager to */
   /* destroy a given cache node during `cache compression'.  The  */
   /* second argument is always `cache.user_data'.  Thus be        */
-  /* certain that the function FTC_Image_Cache_New() does indeed  */
+  /* certain that the function FTC_Glyph_Cache_New() does indeed  */
   /* set its `user_data' field correctly, otherwise bad things    */
   /* will happen!                                                 */
 
@@ -75,11 +75,31 @@
     FT_LruNode       queue_lru = cache->queues_lru->nodes + node->queue_index;
     FTC_Glyph_Queue  queue     = (FTC_Glyph_Queue)queue_lru->root.data;
     FT_UInt          hash      = node->glyph_index % queue->hash_size;
-    FT_List          bucket    = queue->buckets + hash;
-
-
-    /* remove node from its queue's bucket list */
-    FT_List_Remove( bucket, FTC_GLYPHNODE_TO_LISTNODE( node ) );
+    
+    /* remove the node from its queue's bucket list */
+    {
+      FTC_GlyphNode*  pnode = queue->buckets + hash;
+      FTC_GlyphNode   cur;
+      
+      for (;;)
+      {
+        cur = *pnode;
+        if (!cur)
+        {
+          /* that's very strange, this should not happen !! */
+          FT_ERROR(( "FTC_GlyphNode_Destroy:"
+                     " trying to delete an unlisted node !!!!" ));
+          return;
+        }
+          
+        if (cur == node)
+        {
+          *pnode = cur->queue_next;
+          break;
+        }
+        pnode = &cur->queue_next;
+      }
+    }
 
     /* destroy the node */
     queue->clazz->destroy_node( node, queue );
@@ -89,7 +109,7 @@
   /* Important: This function is called from the cache manager to */
   /* size a given cache node during `cache compression'.  The     */
   /* second argument is always `cache.user_data'.  Thus be        */
-  /* certain that the function FTC_Image_Cache_New() does indeed  */
+  /* certain that the function FTC_Glyph_Cache_New() does indeed  */
   /* set its `user_data' field correctly, otherwise bad things    */
   /* will happen!                                                 */
 
@@ -148,7 +168,7 @@
     queue->clazz     = clazz;
 
     /* allocate buckets table */
-    if ( ALLOC_ARRAY( queue->buckets, queue->hash_size, FT_ListRec ) )
+    if ( ALLOC_ARRAY( queue->buckets, queue->hash_size, FTC_GlyphNode ) )
       goto Exit;
 
     /* initialize queue by type if needed */
@@ -177,8 +197,8 @@
     FTC_Glyph_Cache         cache        = queue->cache;
     FTC_Manager             manager      = cache->root.manager;
     FT_List                 glyphs_lru   = &manager->global_lru;
-    FT_List                 bucket       = queue->buckets;
-    FT_List                 bucket_limit = bucket + queue->hash_size;
+    FTC_GlyphNode*          bucket       = queue->buckets;
+    FTC_GlyphNode*          bucket_limit = bucket + queue->hash_size;
     FT_Memory               memory       = cache->root.memory;
 
     FTC_Glyph_Queue_Class*  clazz = queue->clazz;
@@ -187,26 +207,24 @@
     /* for each bucket, free the list of glyph nodes */
     for ( ; bucket < bucket_limit; bucket++ )
     {
-      FT_ListNode    node = bucket->head;
-      FT_ListNode    next = 0;
-      FT_ListNode    lrunode;
-      FTC_GlyphNode  inode;
+      FTC_GlyphNode   node = bucket[0];
+      FTC_GlyphNode   next = 0;
+      FT_ListNode     lrunode;
 
 
       for ( ; node; node = next )
       {
-        next    = node->next;
-        inode   = FTC_LISTNODE_TO_GLYPHNODE( node );
-        lrunode = FTC_GLYPHNODE_TO_LRUNODE( inode );
+        next    = node->queue_next;
+        lrunode = FTC_GLYPHNODE_TO_LRUNODE( node );
 
-        manager->num_bytes -= clazz->size_node( inode, queue );
+        manager->num_bytes -= clazz->size_node( node, queue );
 
         FT_List_Remove( glyphs_lru, lrunode );
 
-        clazz->destroy_node( inode, queue );
+        clazz->destroy_node( node, queue );
       }
 
-      bucket->head = bucket->tail = 0;
+      bucket[0] = 0;
     }
 
     if ( clazz->done )
@@ -217,58 +235,63 @@
   }
 
 
-  FT_EXPORT_FUNC( FT_Error )  FTC_Glyph_Queue_Lookup_Node(
-                                FTC_Glyph_Queue  queue,
-                                FT_UInt          glyph_index,
-                                FTC_GlyphNode*   anode )
+  FT_EXPORT_FUNC( FT_Error )
+  FTC_Glyph_Queue_Lookup_Node( FTC_Glyph_Queue  queue,
+                               FT_UInt          glyph_index,
+                               FTC_GlyphNode*   anode )
   {
     FTC_Glyph_Cache         cache      = queue->cache;
     FTC_Manager             manager    = cache->root.manager;
     FT_UInt                 hash_index = glyph_index % queue->hash_size;
-    FT_List                 bucket     = queue->buckets + hash_index;
-    FT_ListNode             node;
+    FTC_GlyphNode*          bucket     = queue->buckets + hash_index;
+    FTC_GlyphNode*          pnode      = bucket;
+    FTC_GlyphNode           node;
     FT_Error                error;
-    FTC_GlyphNode           inode;
 
     FTC_Glyph_Queue_Class*  clazz = queue->clazz;
 
 
     *anode = 0;
-    for ( node = bucket->head; node; node = node->next )
+    
+    for ( ;; )
     {
-      FT_UInt  gindex;
-
-
-      inode  = FTC_LISTNODE_TO_GLYPHNODE( node );
-      gindex = inode->glyph_index;
-
-      if ( gindex == glyph_index )
+      node = *pnode;
+      if (!node)
+        break;
+        
+      if ( node->glyph_index == glyph_index )
       {
         /* we found it! -- move glyph to start of the lists */
-        FT_List_Up( bucket, node );
-        FT_List_Up( &manager->global_lru, FTC_GLYPHNODE_TO_LRUNODE( inode ) );
-        *anode = inode;
+        *pnode           = node->queue_next;
+        node->queue_next = bucket[0];
+        bucket[0]        = node;
+        
+        FT_List_Up( &manager->global_lru, FTC_GLYPHNODE_TO_LRUNODE( node ) );
+        *anode = node;
         return 0;
       }
+      /* go to next node in bucket */
+      pnode = &node->queue_next;
     }
 
     /* we didn't found the glyph image, we will now create a new one */
-    error = clazz->new_node( queue, glyph_index, &inode );
+    error = clazz->new_node( queue, glyph_index, &node );
     if ( error )
       goto Exit;
 
     /* insert the node at the start of our bucket list */
-    FT_List_Insert( bucket, FTC_GLYPHNODE_TO_LISTNODE( inode ) );
+    node->queue_next = bucket[0];
+    bucket[0]        = node;
 
     /* insert the node at the start the global LRU glyph list */
-    FT_List_Insert( &manager->global_lru, FTC_GLYPHNODE_TO_LRUNODE( inode ) );
+    FT_List_Insert( &manager->global_lru, FTC_GLYPHNODE_TO_LRUNODE( node ) );
 
-    manager->num_bytes += clazz->size_node( inode, queue );
+    manager->num_bytes += clazz->size_node( node, queue );
 
     if (manager->num_bytes > manager->max_bytes)
       FTC_Manager_Compress( manager );
 
-    *anode = inode;
+    *anode = node;
 
   Exit:
     return error;
diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c
index 9f7f52c..2e8db1b 100644
--- a/src/cache/ftcimage.c
+++ b/src/cache/ftcimage.c
@@ -39,13 +39,13 @@
   /* this is a simple glyph image destructor, which is called exclusively */
   /* from the CacheQueue object                                           */
   LOCAL_FUNC_X
-  void  ftc_glyph_image_node_destroy( FTC_GlyphNode    node,
+  void  ftc_glyph_image_node_destroy( FTC_GlyphImage   node,
                                       FTC_Glyph_Queue  queue )
   {
     FT_Memory  memory = queue->memory;
 
 
-    FT_Done_Glyph( FTC_GLYPHNODE_GET_GLYPH( node ) );
+    FT_Done_Glyph( node->ft_glyph );
     FREE( node );
   }
 
@@ -53,12 +53,12 @@
   LOCAL_FUNC_X
   FT_Error  ftc_glyph_image_node_new( FTC_Glyph_Queue  queue,
                                       FT_UInt          glyph_index,
-                                      FTC_GlyphNode*   anode )
+                                      FTC_GlyphImage  *anode )
   {
     FT_Memory        memory   = queue->memory;
     FTC_Image_Queue  imageq = (FTC_Image_Queue)queue;
     FT_Error         error;
-    FTC_GlyphNode    node = 0;
+    FTC_GlyphImage   node = 0;
     FT_Face          face;
     FT_Size          size;
 
@@ -68,7 +68,7 @@
       goto Exit;
 
     /* init its inner fields */
-    FTC_GlyphNode_Init( node, queue, glyph_index );
+    FTC_GlyphNode_Init( FTC_GLYPHNODE(node), queue, glyph_index );
 
     /* we will now load the glyph image */
     error = FTC_Manager_Lookup_Size( queue->manager,
@@ -76,7 +76,7 @@
                                      &face, &size );
     if ( !error )
     {
-      FT_UInt  glyph_index = node->glyph_index;
+      FT_UInt  glyph_index = node->root.glyph_index;
       FT_UInt  load_flags  = FT_LOAD_DEFAULT;
       FT_UInt  image_type  = imageq->description.image_type;
 
@@ -118,7 +118,7 @@
 
           error = FT_Get_Glyph( face->glyph, &glyph );
           if ( !error )
-            FTC_GLYPHNODE_SET_GLYPH( node, glyph );
+            node->ft_glyph = glyph;
         }
         else
           error = FT_Err_Invalid_Argument;
@@ -138,10 +138,10 @@
   /* a FTC_Glyph_Queue_Class and a FTC_CacheNode_Class     */
   /*                                                       */
   LOCAL_FUNC_X
-  FT_ULong  ftc_glyph_image_node_size( FTC_GlyphNode  node )
+  FT_ULong  ftc_glyph_image_node_size( FTC_GlyphImage  node )
   {
     FT_ULong  size  = 0;
-    FT_Glyph  glyph = FTC_GLYPHNODE_GET_GLYPH( node );
+    FT_Glyph  glyph = node->ft_glyph;
 
 
     switch ( glyph->format )
@@ -249,15 +249,15 @@
   }
 
 
-  FT_EXPORT_DEF( FT_Error )  FTC_Image_Cache_Lookup(
-                               FTC_Image_Cache  cache,
-                               FTC_Image_Desc*  desc,
-                               FT_UInt          gindex,
-                               FT_Glyph*        aglyph )
+  FT_EXPORT_DEF( FT_Error )
+  FTC_Image_Cache_Lookup( FTC_Image_Cache  cache,
+                          FTC_Image_Desc*  desc,
+                          FT_UInt          gindex,
+                          FT_Glyph*        aglyph )
   {
     FT_Error         error;
     FTC_Glyph_Queue  queue;
-    FTC_GlyphNode    inode;
+    FTC_GlyphNode    node;
     FTC_Manager      manager;
 
     FTC_Image_Queue  img_queue;
@@ -281,7 +281,7 @@
         goto Exit;
     }
 
-    error = FTC_Glyph_Queue_Lookup_Node( queue, gindex, &inode );
+    error = FTC_Glyph_Queue_Lookup_Node( queue, gindex, &node );
     if ( error )
       goto Exit;
 
@@ -289,12 +289,12 @@
     manager = cache->root.root.manager;
     if ( manager->num_bytes > manager->max_bytes )
     {
-      FTC_GlyphNode_Ref( inode );
+      FTC_GlyphNode_Ref   ( node );
       FTC_Manager_Compress( manager );
-      FTC_GlyphNode_Unref( inode );
+      FTC_GlyphNode_Unref ( node );
     }
 
-    *aglyph = FTC_GLYPHNODE_GET_GLYPH( inode );
+    *aglyph = ((FTC_GlyphImage)node)->ft_glyph;
 
   Exit:
     return error;
diff --git a/src/cache/ftcimage.h b/src/cache/ftcimage.h
index 80de115..7fc9678 100644
--- a/src/cache/ftcimage.h
+++ b/src/cache/ftcimage.h
@@ -21,12 +21,21 @@
 
 
 #include <freetype/cache/ftcglyph.h>
+#include <freetype/ftglyph.h>
 
 
 #ifdef __cplusplus
   extern "C" {
 #endif
 
+ /* the FT_Glyph image "glyph node" type */
+  typedef struct  FTC_GlyphImageRec_
+  {
+    FTC_GlyphNodeRec   root;
+    FT_Glyph           ft_glyph;
+
+  } FTC_GlyphImageRec, *FTC_GlyphImage;
+
 
   /* the glyph image queue type */
   typedef struct  FTC_Image_QueueRec_