at last, the infamous cache bug is fixed !!
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
diff --git a/src/cache/ftcchunk.c b/src/cache/ftcchunk.c
index ae2d333..f07fa2b 100644
--- a/src/cache/ftcchunk.c
+++ b/src/cache/ftcchunk.c
@@ -44,12 +44,12 @@
FT_Error error = 0;
- data->cache_index = (FT_UShort) cache->root.cache_index;
- data->ref_count = (FT_Short) 0;
- node->cset_index = (FT_UShort) index;
-
- node->num_elements = (index+1 < cset->element_count)
- ? cset->element_count * cset->element_size
+ data->cache_index = (FT_UShort) cache->root.cache_index;
+ data->ref_count = (FT_Short) 0;
+ node->cset = cset;
+ node->cset_index = (FT_UShort) index;
+ node->num_elements = (index+1 < cset->num_chunks)
+ ? cset->element_count
: cset->element_max - cset->element_count*index;
if (alloc)
{
@@ -227,7 +227,7 @@
if (!node)
{
/* we didn't found the glyph image, we will now create a new one */
- error = clazz->new_node( cset, glyph_index, &node );
+ error = clazz->new_node( cset, chunk_index, &node );
if ( error )
goto Exit;
@@ -267,7 +267,7 @@
#define FTC_CSET_LRU_GET_CACHE( lru ) \
- ( (FTC_Chunk_Cache)(lru)->user_data )
+ ( (FTC_Chunk_Cache)((lru)->user_data) )
#define FTC_CSET_LRU_GET_MANAGER( lru ) \
FTC_CSET_LRU_GET_CACHE( lru )->manager
diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c
index e1a9412..994ff3a 100644
--- a/src/cache/ftcmanag.c
+++ b/src/cache/ftcmanag.c
@@ -464,6 +464,10 @@
cache->manager = manager;
cache->memory = memory;
cache->clazz = clazz;
+
+ /* THIS IS VERY IMPORTANT, THIS WILL WRECH THE MANAGER */
+ /* IF IT IS NOT SET CORRECTLY.. */
+ cache->cache_index = index;
if ( clazz->init_cache )
error = clazz->init_cache( cache );
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 281b48b..93d8fdb 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -262,7 +262,7 @@
/* lookup the FT_Face to obtain the number of glyphs */
error = FTC_Manager_Lookup_Face( cset->manager,
- &desc->font, &face );
+ desc->font.face_id, &face );
if (!error)
cset->element_max = face->num_glyphs;
@@ -290,7 +290,7 @@
FT_CPLUSPLUS( const FTC_ChunkSet_Class ) ftc_sbit_chunk_set_class =
{
- sizeof( FTC_ImageSetRec ),
+ sizeof( FTC_SBitSetRec ),
(FTC_ChunkSet_InitFunc) ftc_sbit_chunk_set_init,
(FTC_ChunkSet_DoneFunc) 0,
@@ -381,13 +381,7 @@
FTC_ChunkNode_Unref ( node );
}
- sbit = ((FTC_SBit)((FTC_ChunkNode)node)->elements) + cindex;
- if (sbit->buffer == 0)
- {
- /* the glyph was missing, we return a NULL pointer !! */
- sbit = 0;
- }
-
+ sbit = ((FTC_SBit)((FTC_ChunkNode)node)->elements) + cindex;
*asbit = sbit;
Exit:
diff --git a/src/cache/rules.mk b/src/cache/rules.mk
index 8cdf1f6..000dc95 100644
--- a/src/cache/rules.mk
+++ b/src/cache/rules.mk
@@ -31,6 +31,8 @@ Cache_COMPILE := $(FT_COMPILE)
Cache_DRV_SRC := $(CACHE_DIR_)ftlru.c \
$(CACHE_DIR_)ftcmanag.c \
$(CACHE_DIR_)ftcglyph.c \
+ $(CACHE_DIR_)ftcchunk.c \
+ $(CACHE_DIR_)ftcsbits.c \
$(CACHE_DIR_)ftcimage.c
# Cache driver headers