Corrected incremental interface implementation to suit the new system.
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
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index b49679d..95f3e5d 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -55,13 +55,13 @@
/* For incremental fonts get the character data using */
/* the callback function. */
- if ( face->root.incremental_interface )
+ if ( face->root.internal->incremental_interface )
{
FT_Data glyph_data;
- error = face->root.incremental_interface->funcs->get_glyph_data(
- face->root.incremental_interface->object,
+ error = face->root.internal->incremental_interface->funcs->get_glyph_data(
+ face->root.internal->incremental_interface->object,
glyph_index,
&glyph_data );
if ( error )
@@ -70,15 +70,20 @@
p = (FT_Byte*)glyph_data.pointer;
fd_select = (FT_UInt)cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
- glyph_data.pointer += cid->fd_bytes;
- glyph_data.length -= cid->fd_bytes;
- glyph_length = glyph_data.length;
+ if ( glyph_data.length != 0 )
+ {
+ glyph_length = glyph_data.length - cid->fd_bytes;
+ FT_ALLOC( charstring, glyph_length );
+ if ( !error )
+ ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes, glyph_length );
+ }
- if ( glyph_length == 0 )
- goto Exit;
- if ( FT_ALLOC( charstring, glyph_length ) )
+ face->root.internal->incremental_interface->funcs->free_glyph_data(
+ face->root.internal->incremental_interface->object,
+ &glyph_data );
+
+ if ( error )
goto Exit;
- ft_memcpy( charstring, glyph_data.pointer, glyph_length );
}
else
@@ -151,16 +156,15 @@
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* Incremental fonts can optionally override the metrics. */
- if ( !error &&
- face->root.incremental_interface &&
- face->root.incremental_interface->funcs->get_glyph_metrics )
+ if ( !error &&
+ face->root.internal->incremental_interface &&
+ face->root.internal->incremental_interface->funcs->get_glyph_metrics )
{
- FT_Bool found = FALSE;
- FT_Basic_Glyph_Metrics metrics;
-
+ FT_Bool found = FALSE;
+ FT_Incremental_MetricsRec metrics;
- error = face->root.incremental_interface->funcs->get_glyph_metrics(
- face->root.incremental_interface->object,
+ error = face->root.internal->incremental_interface->funcs->get_glyph_metrics(
+ face->root.internal->incremental_interface->object,
glyph_index, FALSE, &metrics, &found );
if ( found )
{