ref: 3bcad43998e3bb0c9d848756970618a8cc61edb3
parent: 86ae11cf8714b4f25ad3187fb7a96914045cfb52
author: Werner Lemberg <[email protected]>
date: Thu May 6 07:48:35 EDT 2004
* src/truetype/ttobjs.c (tt_driver_done): Fix typo. * src/bdf/bdfdrivr.c (BDF_Face_Done, BDF_Face_Init, BDF_Set_Pixel_Size): Don't use BDF_XXX but FT_XXX arguments which are typecast to the proper BDF_XXX types within the function. Update code accordingly. Use FT_CALLBACK_DEF throughout. (BDF_Set_Point_Size): New wrapper function. (bdf_driver_class): Remove casts. * src/cff/cffdrivr.c (Get_Kerning, Load_Glyph, cff_get_interface): Don't use CFF_XXX but FT_XXX arguments which are typecast to the proper CFF_XXX types within the function. Update code accordingly. Use FT_CALLBACK_DEF throughout. (cff_driver_class): Remove casts. * src/cff/cffobjs.h, src/cff/cffobjs.c (cff_size_done, cff_size_init, cff_size_reset, cff_slot_done, cff_slot_init, cff_face_init, cff_face_done, cff_driver_init, cff_driver_done): Don't use CFF_XXX but FT_XXX arguments which are typecast to the proper CFF_XXX types within the function. Update code accordingly. (cff_point_size_reset): New wrapper function. * src/cid/cidobjs.h, src/cid/cidobjs.c (cid_slot_done, cid_slot_init, cid_size_done, cid_size_init, cid_size_reset, cid_face_done, cid_face_init, cid_driver_init, cid_driver_done): Don't use CID_XXX but FT_XXX arguments which are typecast to the proper CID_XXX types within the function. Update code accordingly. (cid_point_size_reset): New wrapper function. * src/cid/cidgload.c, src/cid/cidgload.h (cid_slot_load_glyph): Don't use CID_XXX but FT_XXX arguments which are typecast to the proper CID_XXX types within the function. Update code accordingly. * src/cid/cidriver.c (cid_get_interface): Don't use CID_XXX but FT_XXX arguments which are typecast to the proper CID_XXX types within the function. Update code accordingly. Use FT_CALLBACK_DEF. (t1cid_driver_class): Remove casts. * src/truetype/ttdriver.c (tt_get_interface): Use FT_CALLBACK_DEF. * src/truetype/ttgxvar.c (ft_var_load_avar): Don't free non-local variables (this is done later). (ft_var_load_avar): Fix call to FT_FRAME_ENTER. (TT_Get_MM_Var): Fix size for `fvar_fields'. (TT_Vary_Get_Glyph_Deltas): Handle deallocation of local variables correctly. * src/base/ftdbgmem.c (ft_mem_debug_realloc): Don't abort if current size is zero.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,75 @@
+2004-05-04 Steve Hartwell <[email protected]>
+
+ * src/truetype/ttobjs.c (tt_driver_done): Fix typo.
+
+2004-05-04 Werner Lemberg <[email protected]>
+
+ * src/bdf/bdfdrivr.c (BDF_Face_Done, BDF_Face_Init,
+ BDF_Set_Pixel_Size): Don't use BDF_XXX but FT_XXX arguments which
+ are typecast to the proper BDF_XXX types within the function.
+ Update code accordingly.
+ Use FT_CALLBACK_DEF throughout.
+ (BDF_Set_Point_Size): New wrapper function.
+ (bdf_driver_class): Remove casts.
+
+ * src/cff/cffdrivr.c (Get_Kerning, Load_Glyph, cff_get_interface):
+ Don't use CFF_XXX but FT_XXX arguments which are typecast to the
+ proper CFF_XXX types within the function.
+ Update code accordingly.
+ Use FT_CALLBACK_DEF throughout.
+ (cff_driver_class): Remove casts.
+
+ * src/cff/cffobjs.h, src/cff/cffobjs.c (cff_size_done,
+ cff_size_init, cff_size_reset, cff_slot_done, cff_slot_init,
+ cff_face_init, cff_face_done, cff_driver_init, cff_driver_done):
+ Don't use CFF_XXX but FT_XXX arguments which are typecast to the
+ proper CFF_XXX types within the function.
+ Update code accordingly.
+ (cff_point_size_reset): New wrapper function.
+
+ * src/cid/cidobjs.h, src/cid/cidobjs.c (cid_slot_done,
+ cid_slot_init, cid_size_done, cid_size_init, cid_size_reset,
+ cid_face_done, cid_face_init, cid_driver_init, cid_driver_done):
+ Don't use CID_XXX but FT_XXX arguments which are typecast to the
+ proper CID_XXX types within the function.
+ Update code accordingly.
+ (cid_point_size_reset): New wrapper function.
+
+ * src/cid/cidgload.c, src/cid/cidgload.h (cid_slot_load_glyph):
+ Don't use CID_XXX but FT_XXX arguments which are typecast to the
+ proper CID_XXX types within the function.
+ Update code accordingly.
+
+ * src/cid/cidriver.c (cid_get_interface):
+ Don't use CID_XXX but FT_XXX arguments which are typecast to the
+ proper CID_XXX types within the function.
+ Update code accordingly.
+ Use FT_CALLBACK_DEF.
+ (t1cid_driver_class): Remove casts.
+
+ * src/truetype/ttdriver.c (tt_get_interface): Use FT_CALLBACK_DEF.
+ * src/truetype/ttgxvar.c (ft_var_load_avar): Don't free non-local
+ variables (this is done later).
+ (ft_var_load_avar): Fix call to FT_FRAME_ENTER.
+ (TT_Get_MM_Var): Fix size for `fvar_fields'.
+ (TT_Vary_Get_Glyph_Deltas): Handle deallocation of local variables
+ correctly.
+
+ * src/base/ftdbgmem.c (ft_mem_debug_realloc): Don't abort if
+ current size is zero.
+
2004-05-03 Steve Hartwell <[email protected]>
* src/truetype/ttobjs.h, src/truetype/ttobjs.c (tt_face_init,
tt_face_done, tt_size_init, tt_size_done, tt_driver_init,
tt_driver_done): Don't use TT_XXX but FT_XXX arguments which are
- typecast to the proper TT_XXX within the function.
+ typecast to the proper TT_XXX types within the function.
Update code accordingly.
* src/truetype/ttdriver.c (Get_Kerning, Set_Char_Sizes,
Set_Pixel_Sizes, Load_Glyph, tt_get_interface): Don't use TT_XXX but
- FT_XXX arguments which are typecast to the proper TT_XXX within the
- function.
+ FT_XXX arguments which are typecast to the proper TT_XXX types
+ within the function.
Update code accordingly.
(tt_driver_class): Remove casts.
@@ -1402,7 +1462,7 @@
(FT_Load_Glyph): Update computation of linearHoriAdvance and
linearVertAdvance.
- * src/true/type/ttinterp.c (Update_Max): Use FT_REALLOC.
+ * src/truetype/ttinterp.c (Update_Max): Use FT_REALLOC.
2003-11-22 David Turner <[email protected]>
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -540,10 +540,15 @@
FT_Long line_no = table->line_no;
+ /* the following is valid according to ANSI C */
+#if 0
if ( block == NULL || cur_size == 0 )
ft_mem_debug_panic( "trying to reallocate NULL in (%s:%ld)",
- file_name, line_no );
+ file_name, line_no );
+#endif
+ /* while the following is allowed in ANSI C also, we abort since */
+ /* such code shouldn't be in FreeType... */
if ( new_size <= 0 )
ft_mem_debug_panic(
"trying to reallocate %p to size 0 (current is %ld) in (%s:%ld)",
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -284,9 +284,10 @@
}
- FT_CALLBACK_DEF( FT_Error )
- BDF_Face_Done( BDF_Face face )
+ FT_CALLBACK_DEF( void )
+ BDF_Face_Done( FT_Face bdfface ) /* BDF_Face */
{
+ BDF_Face face = (BDF_Face)bdfface;
FT_Memory memory = FT_FACE_MEMORY( face );
@@ -296,26 +297,25 @@
FT_FREE( face->charset_encoding );
FT_FREE( face->charset_registry );
- FT_FREE( face->root.family_name );
+ FT_FREE( bdfface->family_name );
- FT_FREE( face->root.available_sizes );
+ FT_FREE( bdfface->available_sizes );
FT_FREE( face->bdffont );
FT_TRACE4(( "BDF_Face_Done: done face\n" ));
-
- return BDF_Err_Ok;
}
FT_CALLBACK_DEF( FT_Error )
BDF_Face_Init( FT_Stream stream,
- BDF_Face face,
+ FT_Face bdfface, /* BDF_Face */
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params )
{
FT_Error error = BDF_Err_Ok;
+ BDF_Face face = (BDF_Face)bdfface;
FT_Memory memory = FT_FACE_MEMORY( face );
bdf_font_t* font;
@@ -346,7 +346,6 @@
/* we have a bdf font: let's construct the face object */
face->bdffont = font;
{
- FT_Face root = FT_FACE( face );
bdf_property_t* prop = NULL;
@@ -357,11 +356,11 @@
font->unencoded_size,
font->unencoded_used ));
- root->num_faces = 1;
- root->face_index = 0;
- root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
- FT_FACE_FLAG_HORIZONTAL |
- FT_FACE_FLAG_FAST_GLYPHS;
+ bdfface->num_faces = 1;
+ bdfface->face_index = 0;
+ bdfface->face_flags = FT_FACE_FLAG_FIXED_SIZES |
+ FT_FACE_FLAG_HORIZONTAL |
+ FT_FACE_FLAG_FAST_GLYPHS;
prop = bdf_get_font_property( font, "SPACING" );
if ( prop && prop->format == BDF_ATOM &&
@@ -368,7 +367,7 @@
prop->value.atom &&
( *(prop->value.atom) == 'M' || *(prop->value.atom) == 'm' ||
*(prop->value.atom) == 'C' || *(prop->value.atom) == 'c' ) )
- root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
+ bdfface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL */
/* FZ XXX: I need a font to implement this */
@@ -379,24 +378,24 @@
int l = ft_strlen( prop->value.atom ) + 1;
- if ( FT_NEW_ARRAY( root->family_name, l ) )
+ if ( FT_NEW_ARRAY( bdfface->family_name, l ) )
goto Exit;
- ft_strcpy( root->family_name, prop->value.atom );
+ ft_strcpy( bdfface->family_name, prop->value.atom );
}
else
- root->family_name = 0;
+ bdfface->family_name = 0;
if ( ( error = bdf_interpret_style( face ) ) != 0 )
goto Exit;
- root->num_glyphs = font->glyphs_size; /* unencoded included */
+ bdfface->num_glyphs = font->glyphs_size; /* unencoded included */
- root->num_fixed_sizes = 1;
- if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
+ bdfface->num_fixed_sizes = 1;
+ if ( FT_NEW_ARRAY( bdfface->available_sizes, 1 ) )
goto Exit;
{
- FT_Bitmap_Size* bsize = root->available_sizes;
+ FT_Bitmap_Size* bsize = bdfface->available_sizes;
FT_Short resolution_x = 0, resolution_y = 0;
@@ -521,8 +520,8 @@
#if 0
/* Select default charmap */
- if (root->num_charmaps)
- root->charmap = root->charmaps[0];
+ if ( bdfface->num_charmaps )
+ bdfface->charmap = bdfface->charmaps[0];
#endif
}
@@ -544,28 +543,33 @@
error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL );
/* Select default charmap */
- if (root->num_charmaps)
- root->charmap = root->charmaps[0];
+ if ( bdfface->num_charmaps )
+ bdfface->charmap = bdfface->charmaps[0];
}
}
- }
+ }
Exit:
return error;
Fail:
- BDF_Face_Done( face );
+ BDF_Face_Done( bdfface );
return BDF_Err_Unknown_File_Format;
}
- static FT_Error
- BDF_Set_Pixel_Size( FT_Size size )
+ FT_CALLBACK_DEF( FT_Error )
+ BDF_Set_Pixel_Size( FT_Size size,
+ FT_UInt char_width,
+ FT_UInt char_height )
{
BDF_Face face = (BDF_Face)FT_SIZE_FACE( size );
FT_Face root = FT_FACE( face );
+ FT_UNUSED( char_width );
+ FT_UNUSED( char_height );
+
FT_TRACE4(( "rec %d - pres %d\n",
size->metrics.y_ppem, root->available_sizes->y_ppem ));
@@ -584,7 +588,23 @@
}
- static FT_Error
+ FT_CALLBACK_DEF( FT_Error )
+ BDF_Set_Point_Size( FT_Size size,
+ FT_F26Dot6 char_width,
+ FT_F26Dot6 char_height,
+ FT_UInt horz_resolution,
+ FT_UInt vert_resolution )
+ {
+ FT_UNUSED( char_width );
+ FT_UNUSED( char_height );
+ FT_UNUSED( horz_resolution );
+ FT_UNUSED( vert_resolution );
+
+ return BDF_Set_Pixel_Size( size, 0, 0 );
+ }
+
+
+ FT_CALLBACK_DEF( FT_Error )
BDF_Glyph_Load( FT_GlyphSlot slot,
FT_Size size,
FT_UInt glyph_index,
@@ -817,7 +837,7 @@
};
- static FT_Module_Interface
+ FT_CALLBACK_DEF( FT_Module_Interface )
bdf_driver_requester( FT_Module module,
const char* name )
{
@@ -851,21 +871,21 @@
sizeof ( FT_SizeRec ),
sizeof ( FT_GlyphSlotRec ),
- (FT_Face_InitFunc) BDF_Face_Init,
- (FT_Face_DoneFunc) BDF_Face_Done,
- (FT_Size_InitFunc) 0,
- (FT_Size_DoneFunc) 0,
- (FT_Slot_InitFunc) 0,
- (FT_Slot_DoneFunc) 0,
+ BDF_Face_Init,
+ BDF_Face_Done,
+ 0, /* FT_Size_InitFunc */
+ 0, /* FT_Size_DoneFunc */
+ 0, /* FT_Slot_InitFunc */
+ 0, /* FT_Slot_DoneFunc */
- (FT_Size_ResetPointsFunc) BDF_Set_Pixel_Size,
- (FT_Size_ResetPixelsFunc) BDF_Set_Pixel_Size,
+ BDF_Set_Point_Size,
+ BDF_Set_Pixel_Size,
- (FT_Slot_LoadFunc) BDF_Glyph_Load,
+ BDF_Glyph_Load,
- (FT_Face_GetKerningFunc) 0,
- (FT_Face_AttachFunc) 0,
- (FT_Face_GetAdvancesFunc) 0
+ 0, /* FT_Face_GetKerningFunc */
+ 0, /* FT_Face_AttachFunc */
+ 0, /* FT_Face_GetAdvancesFunc */
};
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -96,12 +96,13 @@
/* */
/* They can be implemented by format-specific interfaces. */
/* */
- static FT_Error
- Get_Kerning( TT_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ Get_Kerning( FT_Face ttface, /* TT_Face */
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_Vector* kerning )
{
+ TT_Face face = (TT_Face)ttface;
TT_Kern0_Pair pair;
@@ -178,13 +179,15 @@
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
- static FT_Error
- Load_Glyph( CFF_GlyphSlot slot,
- CFF_Size size,
- FT_UShort glyph_index,
- FT_Int32 load_flags )
+ FT_CALLBACK_DEF( FT_Error )
+ Load_Glyph( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */
+ FT_Size cffsize, /* CFF_Size */
+ FT_UInt glyph_index,
+ FT_Int32 load_flags )
{
FT_Error error;
+ CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot;
+ CFF_Size size = (CFF_Size)cffsize;
if ( !slot )
@@ -409,8 +412,8 @@
};
- static FT_Module_Interface
- cff_get_interface( CFF_Driver driver,
+ FT_CALLBACK_DEF( FT_Module_Interface )
+ cff_get_interface( FT_Module driver, /* CFF_Driver */
const char* module_interface )
{
FT_Module sfnt;
@@ -422,7 +425,7 @@
return result;
/* we pass our request to the `sfnt' module */
- sfnt = FT_Get_Module( driver->root.root.library, "sfnt" );
+ sfnt = FT_Get_Module( driver->library, "sfnt" );
return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
}
@@ -446,9 +449,9 @@
0, /* module-specific interface */
- (FT_Module_Constructor)cff_driver_init,
- (FT_Module_Destructor) cff_driver_done,
- (FT_Module_Requester) cff_get_interface,
+ cff_driver_init,
+ cff_driver_done,
+ cff_get_interface,
},
/* now the specific driver fields */
@@ -456,21 +459,21 @@
sizeof( CFF_SizeRec ),
sizeof( CFF_GlyphSlotRec ),
- (FT_Face_InitFunc) cff_face_init,
- (FT_Face_DoneFunc) cff_face_done,
- (FT_Size_InitFunc) cff_size_init,
- (FT_Size_DoneFunc) cff_size_done,
- (FT_Slot_InitFunc) cff_slot_init,
- (FT_Slot_DoneFunc) cff_slot_done,
+ cff_face_init,
+ cff_face_done,
+ cff_size_init,
+ cff_size_done,
+ cff_slot_init,
+ cff_slot_done,
- (FT_Size_ResetPointsFunc)cff_size_reset,
- (FT_Size_ResetPixelsFunc)cff_size_reset,
+ cff_point_size_reset,
+ cff_size_reset,
- (FT_Slot_LoadFunc) Load_Glyph,
+ Load_Glyph,
- (FT_Face_GetKerningFunc) Get_Kerning,
- (FT_Face_AttachFunc) 0,
- (FT_Face_GetAdvancesFunc)0,
+ Get_Kerning,
+ 0, /* FT_Face_AttachFunc */
+ 0 /* FT_Face_GetAdvancesFunc */
};
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1095,7 +1095,7 @@
idx->stream = stream;
if ( !FT_READ_USHORT( count ) &&
- count > 0 )
+ count > 0 )
{
FT_Byte* p;
FT_Byte offsize;
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -135,8 +135,11 @@
FT_LOCAL_DEF( void )
- cff_size_done( CFF_Size size )
+ cff_size_done( FT_Size cffsize ) /* CFF_Size */
{
+ CFF_Size size = (CFF_Size)cffsize;
+
+
if ( size->root.internal )
{
PSH_Globals_Funcs funcs;
@@ -152,8 +155,9 @@
FT_LOCAL_DEF( FT_Error )
- cff_size_init( CFF_Size size )
+ cff_size_init( FT_Size cffsize ) /* CFF_Size */
{
+ CFF_Size size = (CFF_Size)cffsize;
FT_Error error = CFF_Err_Ok;
PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size );
@@ -225,13 +229,19 @@
FT_LOCAL_DEF( FT_Error )
- cff_size_reset( CFF_Size size )
+ cff_size_reset( FT_Size cffsize, /* CFF_Size */
+ FT_UInt char_width,
+ FT_UInt char_height )
{
+ CFF_Size size = (CFF_Size)cffsize;
PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size );
FT_Error error = CFF_Err_Ok;
FT_Face face = size->root.face;
+ FT_UNUSED( char_width );
+ FT_UNUSED( char_height );
+
if ( funcs )
error = funcs->set_scale( (PSH_Globals)size->root.internal,
size->root.metrics.x_scale,
@@ -257,6 +267,22 @@
}
+ FT_LOCAL_DEF( FT_Error )
+ cff_point_size_reset( FT_Size cffsize,
+ FT_F26Dot6 char_width,
+ FT_F26Dot6 char_height,
+ FT_UInt horz_resolution,
+ FT_UInt vert_resolution )
+ {
+ FT_UNUSED( char_width );
+ FT_UNUSED( char_height );
+ FT_UNUSED( horz_resolution );
+ FT_UNUSED( vert_resolution );
+
+ return cff_size_reset( cffsize, 0, 0 );
+ }
+
+
/*************************************************************************/
/* */
/* SLOT FUNCTIONS */
@@ -264,15 +290,18 @@
/*************************************************************************/
FT_LOCAL_DEF( void )
- cff_slot_done( CFF_GlyphSlot slot )
+ cff_slot_done( FT_GlyphSlot cffslot ) /* CFF_GlyphSlot */
{
+ CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot;
+
slot->root.internal->glyph_hints = 0;
}
FT_LOCAL_DEF( FT_Error )
- cff_slot_init( CFF_GlyphSlot slot )
+ cff_slot_init( FT_GlyphSlot cffslot ) /* CFF_GlyphSlot */
{
+ CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot;
CFF_Face face = (CFF_Face)slot->root.face;
CFF_Font font = (CFF_FontRec *)face->extra.data;
PSHinter_Service pshinter = (PSHinter_Service)font->pshinter;
@@ -328,11 +357,12 @@
FT_LOCAL_DEF( FT_Error )
cff_face_init( FT_Stream stream,
- CFF_Face face,
+ FT_Face cffface, /* CFF_Face */
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params )
{
+ CFF_Face face = (CFF_Face)cffface;
FT_Error error;
SFNT_Service sfnt;
FT_Service_PsCMaps psnames;
@@ -708,8 +738,9 @@
FT_LOCAL_DEF( void )
- cff_face_done( CFF_Face face )
+ cff_face_done( FT_Face cffface ) /* CFF_Face */
{
+ CFF_Face face = (CFF_Face)cffface;
FT_Memory memory = face->root.memory;
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
@@ -731,9 +762,9 @@
FT_LOCAL_DEF( FT_Error )
- cff_driver_init( CFF_Driver driver )
+ cff_driver_init( FT_Module module )
{
- FT_UNUSED( driver );
+ FT_UNUSED( module );
return CFF_Err_Ok;
}
@@ -740,9 +771,9 @@
FT_LOCAL_DEF( void )
- cff_driver_done( CFF_Driver driver )
+ cff_driver_done( FT_Module module )
{
- FT_UNUSED( driver );
+ FT_UNUSED( module );
}
--- a/src/cff/cffobjs.h
+++ b/src/cff/cffobjs.h
@@ -113,19 +113,28 @@
FT_LOCAL( FT_Error )
- cff_size_init( CFF_Size size );
+ cff_size_init( FT_Size size ); /* CFF_Size */
FT_LOCAL( void )
- cff_size_done( CFF_Size size );
+ cff_size_done( FT_Size size ); /* CFF_Size */
FT_LOCAL( FT_Error )
- cff_size_reset( CFF_Size size );
+ cff_size_reset( FT_Size size, /* CFF_Size */
+ FT_UInt char_width,
+ FT_UInt char_height );
+ FT_LOCAL( FT_Error )
+ cff_point_size_reset( FT_Size cffsize,
+ FT_F26Dot6 char_width,
+ FT_F26Dot6 char_height,
+ FT_UInt horz_resolution,
+ FT_UInt vert_resolution );
+
FT_LOCAL( void )
- cff_slot_done( CFF_GlyphSlot slot );
+ cff_slot_done( FT_GlyphSlot slot ); /* CFF_GlyphSlot */
FT_LOCAL( FT_Error )
- cff_slot_init( CFF_GlyphSlot slot );
+ cff_slot_init( FT_GlyphSlot slot ); /* CFF_GlyphSlot */
/*************************************************************************/
@@ -134,13 +143,13 @@
/* */
FT_LOCAL( FT_Error )
cff_face_init( FT_Stream stream,
- CFF_Face face,
+ FT_Face face, /* CFF_Face */
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params );
FT_LOCAL( void )
- cff_face_done( CFF_Face face );
+ cff_face_done( FT_Face face ); /* CFF_Face */
/*************************************************************************/
@@ -148,10 +157,10 @@
/* Driver functions */
/* */
FT_LOCAL( FT_Error )
- cff_driver_init( CFF_Driver driver );
+ cff_driver_init( FT_Module module );
FT_LOCAL( void )
- cff_driver_done( CFF_Driver driver );
+ cff_driver_done( FT_Module module );
FT_END_HEADER
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -269,14 +269,16 @@
FT_LOCAL_DEF( FT_Error )
- cid_slot_load_glyph( CID_GlyphSlot glyph,
- CID_Size size,
- FT_Int glyph_index,
- FT_Int32 load_flags )
+ cid_slot_load_glyph( FT_GlyphSlot cidglyph, /* CID_GlyphSlot */
+ FT_Size cidsize, /* CID_Size */
+ FT_UInt glyph_index,
+ FT_Int32 load_flags )
{
+ CID_GlyphSlot glyph = (CID_GlyphSlot)cidglyph;
+ CID_Size size = (CID_Size)cidsize;
FT_Error error;
T1_DecoderRec decoder;
- CID_Face face = (CID_Face)glyph->root.face;
+ CID_Face face = (CID_Face)cidglyph->face;
FT_Bool hinting;
PSAux_Service psaux = (PSAux_Service)face->psaux;
@@ -287,22 +289,22 @@
if ( load_flags & FT_LOAD_NO_RECURSE )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
- glyph->x_scale = size->root.metrics.x_scale;
- glyph->y_scale = size->root.metrics.y_scale;
+ glyph->x_scale = cidsize->metrics.x_scale;
+ glyph->y_scale = cidsize->metrics.y_scale;
- glyph->root.outline.n_points = 0;
- glyph->root.outline.n_contours = 0;
+ cidglyph->outline.n_points = 0;
+ cidglyph->outline.n_contours = 0;
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
- glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
+ cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
{
error = psaux->t1_decoder_funcs->init( &decoder,
- (FT_Face)face,
- (FT_Size)size,
- (FT_GlyphSlot)glyph,
+ cidglyph->face,
+ cidsize,
+ cidglyph,
0, /* glyph names -- XXX */
0, /* blend == 0 */
hinting,
@@ -327,18 +329,18 @@
/* bearing the yMax */
if ( !error )
{
- glyph->root.outline.flags &= FT_OUTLINE_OWNER;
- glyph->root.outline.flags |= FT_OUTLINE_REVERSE_FILL;
+ cidglyph->outline.flags &= FT_OUTLINE_OWNER;
+ cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
/* for composite glyphs, return only left side bearing and */
/* advance width */
if ( load_flags & FT_LOAD_NO_RECURSE )
{
- FT_Slot_Internal internal = glyph->root.internal;
+ FT_Slot_Internal internal = cidglyph->internal;
- glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
- glyph->root.metrics.horiAdvance = decoder.builder.advance.x;
+ cidglyph->metrics.horiBearingX = decoder.builder.left_bearing.x;
+ cidglyph->metrics.horiAdvance = decoder.builder.advance.x;
internal->glyph_matrix = font_matrix;
internal->glyph_delta = font_offset;
@@ -347,14 +349,14 @@
else
{
FT_BBox cbox;
- FT_Glyph_Metrics* metrics = &glyph->root.metrics;
+ FT_Glyph_Metrics* metrics = &cidglyph->metrics;
FT_Vector advance;
/* copy the _unscaled_ advance width */
- metrics->horiAdvance = decoder.builder.advance.x;
- glyph->root.linearHoriAdvance = decoder.builder.advance.x;
- glyph->root.internal->glyph_transformed = 0;
+ metrics->horiAdvance = decoder.builder.advance.x;
+ cidglyph->linearHoriAdvance = decoder.builder.advance.x;
+ cidglyph->internal->glyph_transformed = 0;
/* make up vertical metrics */
metrics->vertBearingX = 0;
@@ -361,16 +363,16 @@
metrics->vertBearingY = 0;
metrics->vertAdvance = 0;
- glyph->root.linearVertAdvance = 0;
- glyph->root.format = FT_GLYPH_FORMAT_OUTLINE;
+ cidglyph->linearVertAdvance = 0;
+ cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
- if ( size && size->root.metrics.y_ppem < 24 )
- glyph->root.outline.flags |= FT_OUTLINE_HIGH_PRECISION;
+ if ( size && cidsize->metrics.y_ppem < 24 )
+ cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
/* apply the font matrix */
- FT_Outline_Transform( &glyph->root.outline, &font_matrix );
+ FT_Outline_Transform( &cidglyph->outline, &font_matrix );
- FT_Outline_Translate( &glyph->root.outline,
+ FT_Outline_Translate( &cidglyph->outline,
font_offset.x,
font_offset.y );
@@ -401,7 +403,7 @@
vec->y = FT_MulFix( vec->y, y_scale );
}
- FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
+ FT_Outline_Get_CBox( &cidglyph->outline, &cbox );
/* Then scale the metrics */
metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
@@ -421,7 +423,7 @@
}
/* compute the other metrics */
- FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
+ FT_Outline_Get_CBox( &cidglyph->outline, &cbox );
/* grid fit the bounding box if necessary */
if ( hinting )
@@ -439,6 +441,7 @@
metrics->horiBearingY = cbox.yMax;
}
}
+
return error;
}
--- a/src/cid/cidgload.h
+++ b/src/cid/cidgload.h
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (specification). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -37,10 +37,10 @@
#endif /* 0 */
FT_LOCAL( FT_Error )
- cid_slot_load_glyph( CID_GlyphSlot glyph,
- CID_Size size,
- FT_Int glyph_index,
- FT_Int32 load_flags );
+ cid_slot_load_glyph( FT_GlyphSlot glyph, /* CID_Glyph_Slot */
+ FT_Size size, /* CID_Size */
+ FT_UInt glyph_index,
+ FT_Int32 load_flags );
FT_END_HEADER
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -47,20 +47,20 @@
/*************************************************************************/
FT_LOCAL_DEF( void )
- cid_slot_done( CID_GlyphSlot slot )
+ cid_slot_done( FT_GlyphSlot slot )
{
- slot->root.internal->glyph_hints = 0;
+ slot->internal->glyph_hints = 0;
}
FT_LOCAL_DEF( FT_Error )
- cid_slot_init( CID_GlyphSlot slot )
+ cid_slot_init( FT_GlyphSlot slot )
{
CID_Face face;
PSHinter_Service pshinter;
- face = (CID_Face)slot->root.face;
+ face = (CID_Face)slot->face;
pshinter = (PSHinter_Service)face->pshinter;
if ( pshinter )
@@ -68,7 +68,7 @@
FT_Module module;
- module = FT_Get_Module( slot->root.face->driver->root.library,
+ module = FT_Get_Module( slot->face->driver->root.library,
"pshinter" );
if ( module )
{
@@ -76,7 +76,7 @@
funcs = pshinter->get_t1_funcs( module );
- slot->root.internal->glyph_hints = (void*)funcs;
+ slot->internal->glyph_hints = (void*)funcs;
}
}
@@ -108,9 +108,12 @@
FT_LOCAL_DEF( void )
- cid_size_done( CID_Size size )
+ cid_size_done( FT_Size cidsize ) /* CID_Size */
{
- if ( size->root.internal )
+ CID_Size size = (CID_Size)cidsize;
+
+
+ if ( cidsize->internal )
{
PSH_Globals_Funcs funcs;
@@ -117,16 +120,17 @@
funcs = cid_size_get_globals_funcs( size );
if ( funcs )
- funcs->destroy( (PSH_Globals)size->root.internal );
+ funcs->destroy( (PSH_Globals)cidsize->internal );
- size->root.internal = 0;
+ cidsize->internal = 0;
}
}
FT_LOCAL_DEF( FT_Error )
- cid_size_init( CID_Size size )
+ cid_size_init( FT_Size cidsize ) /* CID_Size */
{
+ CID_Size size = (CID_Size)cidsize;
FT_Error error = 0;
PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size );
@@ -134,14 +138,14 @@
if ( funcs )
{
PSH_Globals globals;
- CID_Face face = (CID_Face)size->root.face;
+ CID_Face face = (CID_Face)cidsize->face;
CID_FaceDict dict = face->cid.font_dicts + face->root.face_index;
PS_Private priv = &dict->private_dict;
- error = funcs->create( size->root.face->memory, priv, &globals );
+ error = funcs->create( cidsize->face->memory, priv, &globals );
if ( !error )
- size->root.internal = (FT_Size_Internal)(void*)globals;
+ cidsize->internal = (FT_Size_Internal)(void*)globals;
}
return error;
@@ -149,21 +153,43 @@
FT_LOCAL_DEF( FT_Error )
- cid_size_reset( CID_Size size )
+ cid_size_reset( FT_Size cidsize, /* CID_Size */
+ FT_UInt char_width,
+ FT_UInt char_height )
{
+ CID_Size size = (CID_Size)cidsize;
PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size );
FT_Error error = 0;
+ FT_UNUSED( char_width );
+ FT_UNUSED( char_height );
+
if ( funcs )
- error = funcs->set_scale( (PSH_Globals)size->root.internal,
- size->root.metrics.x_scale,
- size->root.metrics.y_scale,
+ error = funcs->set_scale( (PSH_Globals)cidsize->internal,
+ cidsize->metrics.x_scale,
+ cidsize->metrics.y_scale,
0, 0 );
return error;
}
+ FT_LOCAL_DEF( FT_Error )
+ cid_point_size_reset( FT_Size size,
+ FT_F26Dot6 char_width,
+ FT_F26Dot6 char_height,
+ FT_UInt horz_resolution,
+ FT_UInt vert_resolution )
+ {
+ FT_UNUSED( char_width );
+ FT_UNUSED( char_height );
+ FT_UNUSED( horz_resolution );
+ FT_UNUSED( vert_resolution );
+
+ return cid_size_reset( size, 0, 0 );
+ }
+
+
/*************************************************************************/
/* */
/* FACE FUNCTIONS */
@@ -182,8 +208,9 @@
/* face :: A pointer to the face object to destroy. */
/* */
FT_LOCAL_DEF( void )
- cid_face_done( CID_Face face )
+ cid_face_done( FT_Face cidface ) /* CID_Face */
{
+ CID_Face face = (CID_Face)cidface;
FT_Memory memory;
@@ -193,7 +220,7 @@
PS_FontInfo info = &cid->font_info;
- memory = face->root.memory;
+ memory = cidface->memory;
/* release subrs */
if ( face->subrs )
@@ -232,8 +259,8 @@
FT_FREE( cid->registry );
FT_FREE( cid->ordering );
- face->root.family_name = 0;
- face->root.style_name = 0;
+ cidface->family_name = 0;
+ cidface->style_name = 0;
FT_FREE( face->binary_data );
FT_FREE( face->cid_stream );
@@ -266,11 +293,12 @@
/* */
FT_LOCAL_DEF( FT_Error )
cid_face_init( FT_Stream stream,
- CID_Face face,
+ FT_Face cidface, /* CID_Face */
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params )
{
+ CID_Face face = (CID_Face)cidface;
FT_Error error;
FT_Service_PsCMaps psnames;
PSAux_Service psaux;
@@ -281,7 +309,7 @@
FT_UNUSED( stream );
- face->root.num_faces = 1;
+ cidface->num_faces = 1;
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
@@ -329,33 +357,32 @@
/* set up root face fields */
{
- FT_Face root = (FT_Face)&face->root;
CID_FaceInfo cid = &face->cid;
PS_FontInfo info = &cid->font_info;
- root->num_glyphs = cid->cid_count;
- root->num_charmaps = 0;
+ cidface->num_glyphs = cid->cid_count;
+ cidface->num_charmaps = 0;
- root->face_index = face_index;
- root->face_flags = FT_FACE_FLAG_SCALABLE;
+ cidface->face_index = face_index;
+ cidface->face_flags = FT_FACE_FLAG_SCALABLE;
- root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
+ cidface->face_flags |= FT_FACE_FLAG_HORIZONTAL;
if ( info->is_fixed_pitch )
- root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
+ cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* XXX: TODO: add kerning with .afm support */
/* get style name -- be careful, some broken fonts only */
/* have a /FontName dictionary entry! */
- root->family_name = info->family_name;
+ cidface->family_name = info->family_name;
/* assume "Regular" style if we don't know better */
- root->style_name = (char *)"Regular";
- if ( root->family_name )
+ cidface->style_name = (char *)"Regular";
+ if ( cidface->family_name )
{
char* full = info->full_name;
- char* family = root->family_name;
+ char* family = cidface->family_name;
if ( full )
@@ -376,7 +403,7 @@
else
{
if ( !*family )
- root->style_name = full;
+ cidface->style_name = full;
break;
}
}
@@ -387,42 +414,42 @@
{
/* do we have a `/FontName'? */
if ( cid->cid_font_name )
- root->family_name = cid->cid_font_name;
+ cidface->family_name = cid->cid_font_name;
}
/* compute style flags */
- root->style_flags = 0;
+ cidface->style_flags = 0;
if ( info->italic_angle )
- root->style_flags |= FT_STYLE_FLAG_ITALIC;
+ cidface->style_flags |= FT_STYLE_FLAG_ITALIC;
if ( info->weight )
{
if ( !ft_strcmp( info->weight, "Bold" ) ||
!ft_strcmp( info->weight, "Black" ) )
- root->style_flags |= FT_STYLE_FLAG_BOLD;
+ cidface->style_flags |= FT_STYLE_FLAG_BOLD;
}
/* no embedded bitmap support */
- root->num_fixed_sizes = 0;
- root->available_sizes = 0;
+ cidface->num_fixed_sizes = 0;
+ cidface->available_sizes = 0;
- root->bbox.xMin = cid->font_bbox.xMin >> 16;
- root->bbox.yMin = cid->font_bbox.yMin >> 16;
- root->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFFU ) >> 16;
- root->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFFU ) >> 16;
+ cidface->bbox.xMin = cid->font_bbox.xMin >> 16;
+ cidface->bbox.yMin = cid->font_bbox.yMin >> 16;
+ cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFFU ) >> 16;
+ cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFFU ) >> 16;
- if ( !root->units_per_EM )
- root->units_per_EM = 1000;
+ if ( !cidface->units_per_EM )
+ cidface->units_per_EM = 1000;
- root->ascender = (FT_Short)( root->bbox.yMax );
- root->descender = (FT_Short)( root->bbox.yMin );
- root->height = (FT_Short)(
- ( ( root->ascender - root->descender ) * 12 ) / 10 );
+ cidface->ascender = (FT_Short)( cidface->bbox.yMax );
+ cidface->descender = (FT_Short)( cidface->bbox.yMin );
+ cidface->height = (FT_Short)(
+ ( ( cidface->ascender - cidface->descender ) * 12 ) / 10 );
- root->underline_position = (FT_Short)info->underline_position;
- root->underline_thickness = (FT_Short)info->underline_thickness;
+ cidface->underline_position = (FT_Short)info->underline_position;
+ cidface->underline_thickness = (FT_Short)info->underline_thickness;
- root->internal->max_points = 0;
- root->internal->max_contours = 0;
+ cidface->internal->max_points = 0;
+ cidface->internal->max_contours = 0;
}
Exit:
@@ -445,7 +472,7 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF( FT_Error )
- cid_driver_init( CID_Driver driver )
+ cid_driver_init( FT_Module driver )
{
FT_UNUSED( driver );
@@ -465,7 +492,7 @@
/* driver :: A handle to the target CID driver. */
/* */
FT_LOCAL_DEF( void )
- cid_driver_done( CID_Driver driver )
+ cid_driver_done( FT_Module driver )
{
FT_UNUSED( driver );
}
--- a/src/cid/cidobjs.h
+++ b/src/cid/cidobjs.h
@@ -4,7 +4,7 @@
/* */
/* CID objects manager (specification). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -112,42 +112,47 @@
FT_LOCAL( void )
- cid_slot_done( CID_GlyphSlot slot );
+ cid_slot_done( FT_GlyphSlot slot );
FT_LOCAL( FT_Error )
- cid_slot_init( CID_GlyphSlot slot );
+ cid_slot_init( FT_GlyphSlot slot );
FT_LOCAL( void )
- cid_size_done( CID_Size size );
+ cid_size_done( FT_Size size ); /* CID_Size */
+ FT_LOCAL( FT_Error )
+ cid_size_init( FT_Size size ); /* CID_Size */
FT_LOCAL( FT_Error )
- cid_size_init( CID_Size size );
+ cid_size_reset( FT_Size size, /* CID_Size */
+ FT_UInt char_width,
+ FT_UInt char_height );
-
FT_LOCAL( FT_Error )
- cid_size_reset( CID_Size size );
+ cid_point_size_reset( FT_Size size,
+ FT_F26Dot6 char_width,
+ FT_F26Dot6 char_height,
+ FT_UInt horz_resolution,
+ FT_UInt vert_resolution );
FT_LOCAL( FT_Error )
cid_face_init( FT_Stream stream,
- CID_Face face,
+ FT_Face face, /* CID_Face */
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params );
-
FT_LOCAL( void )
- cid_face_done( CID_Face face );
+ cid_face_done( FT_Face face ); /* CID_Face */
FT_LOCAL( FT_Error )
- cid_driver_init( CID_Driver driver );
+ cid_driver_init( FT_Module driver );
-
FT_LOCAL( void )
- cid_driver_done( CID_Driver driver );
+ cid_driver_done( FT_Module driver );
FT_END_HEADER
--- a/src/cid/cidriver.c
+++ b/src/cid/cidriver.c
@@ -4,7 +4,7 @@
/* */
/* CID driver interface (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -97,12 +97,11 @@
};
- static FT_Module_Interface
- cid_get_interface( FT_Driver driver,
- const FT_String* cid_interface )
+ FT_CALLBACK_DEF( FT_Module_Interface )
+ cid_get_interface( FT_Module module,
+ const char* cid_interface )
{
- FT_UNUSED( driver );
- FT_UNUSED( cid_interface );
+ FT_UNUSED( module );
return ft_service_list_lookup( cid_services, cid_interface );
}
@@ -125,9 +124,9 @@
0,
- (FT_Module_Constructor)cid_driver_init,
- (FT_Module_Destructor) cid_driver_done,
- (FT_Module_Requester) cid_get_interface
+ cid_driver_init,
+ cid_driver_done,
+ cid_get_interface
},
/* then the other font drivers fields */
@@ -135,23 +134,23 @@
sizeof( CID_SizeRec ),
sizeof( CID_GlyphSlotRec ),
- (FT_Face_InitFunc) cid_face_init,
- (FT_Face_DoneFunc) cid_face_done,
+ cid_face_init,
+ cid_face_done,
- (FT_Size_InitFunc) cid_size_init,
- (FT_Size_DoneFunc) cid_size_done,
- (FT_Slot_InitFunc) cid_slot_init,
- (FT_Slot_DoneFunc) cid_slot_done,
+ cid_size_init,
+ cid_size_done,
+ cid_slot_init,
+ cid_slot_done,
- (FT_Size_ResetPointsFunc)cid_size_reset,
- (FT_Size_ResetPixelsFunc)cid_size_reset,
+ cid_point_size_reset,
+ cid_size_reset,
- (FT_Slot_LoadFunc) cid_slot_load_glyph,
+ cid_slot_load_glyph,
- (FT_Face_GetKerningFunc) 0,
- (FT_Face_AttachFunc) 0,
+ 0, /* FT_Face_GetKerningFunc */
+ 0, /* FT_Face_AttachFunc */
- (FT_Face_GetAdvancesFunc)0,
+ 0 /* FT_Face_GetAdvancesFunc */
};
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -388,7 +388,7 @@
};
- static FT_Module_Interface
+ FT_CALLBACK_DEF( FT_Module_Interface )
tt_get_interface( FT_Module driver, /* TT_Driver */
const char* tt_interface )
{
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -304,15 +304,7 @@
{
segment->pairCount = FT_GET_USHORT();
if ( FT_NEW_ARRAY( segment->correspondence, segment->pairCount ) )
- {
- /* Failure. Free everything we have done so far. */
-
- for ( j = i - 1; j >= 0; --j )
- FT_FREE( blend->avar_segment[j].correspondence );
-
- FT_FREE( blend->avar_segment );
goto Exit;
- }
for ( j = 0; j < segment->pairCount; ++j )
{
@@ -408,7 +400,7 @@
if ( gvar_head.flags & 1 )
{
- /* long offsets (one more offset than glyph, to mark size of last) */
+ /* long offsets (one more offset than glyphs, to mark size of last) */
if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 4L ) )
goto Exit;
@@ -419,9 +411,10 @@
}
else
{
- /* short offsets (one more offset than glyph, to mark size of last) */
+ /* short offsets (one more offset than glyphs, to mark size of last) */
if ( FT_FRAME_ENTER( ( blend->gv_glyphcnt + 1 ) * 2L ) )
goto Exit;
+
for ( i = 0; i <= blend->gv_glyphcnt; ++i )
blend->glyphoffsets[i] = OffsetToData + FT_GET_USHORT() * 2;
/* XXX: Undocumented: `*2'! */
@@ -435,10 +428,8 @@
gvar_head.axisCount * blend->tuplecount ) )
goto Exit;
- if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord ) ||
- FT_FRAME_ENTER( blend->tuplecount
- * gvar_head.axisCount
- * sizeof ( short ) ) )
+ if ( FT_STREAM_SEEK( gvar_start + gvar_head.offsetToCoord ) ||
+ FT_FRAME_ENTER( blend->tuplecount * gvar_head.axisCount * 2L ) )
goto Exit;
for ( i = 0; i < blend->tuplecount; ++i )
@@ -469,11 +460,11 @@
/* tupleIndex :: A flag saying whether this is an intermediate */
/* tuple or not. */
/* */
- /* tuple_coords :: The coordiates of the tuple in normalized axis */
+ /* tuple_coords :: The coordinates of the tuple in normalized axis */
/* units. */
/* */
- /* im_start_coords :: The initial coordinatess where this tuple */
- /* starts to apply (for intermediate coordinates). */
+ /* im_start_coords :: The initial coordinates where this tuple starts */
+ /* to apply (for intermediate coordinates). */
/* */
/* im_end_coords :: The final coordinates after which this tuple no */
/* longer applies (for intermediate coordinates). */
@@ -621,7 +612,7 @@
#undef FT_STRUCTURE
#define FT_STRUCTURE GX_FVar_Head
- FT_FRAME_START( 14 ),
+ FT_FRAME_START( 16 ),
FT_FRAME_LONG ( version ),
FT_FRAME_USHORT( offsetToData ),
FT_FRAME_USHORT( countSizePairs ),
@@ -745,7 +736,7 @@
ns = mmvar->namedstyle;
for ( i = 0; i < fvar_head.instanceCount; ++i )
{
- if ( FT_FRAME_ENTER( 4 + 4 * fvar_head.axisCount ) )
+ if ( FT_FRAME_ENTER( 4L + 4L * fvar_head.axisCount ) )
goto Exit;
ns->strid = FT_GET_USHORT();
@@ -1304,9 +1295,9 @@
FT_ULong OffsetToData;
FT_ULong here;
FT_UInt i, j;
- FT_Fixed* tuple_coords = NULL;
+ FT_Fixed* tuple_coords = NULL;
FT_Fixed* im_start_coords = NULL;
- FT_Fixed* im_end_coords = NULL;
+ FT_Fixed* im_end_coords = NULL;
FT_UInt point_count, spoint_count = 0;
FT_UShort* sharedpoints = NULL;
FT_UShort* localpoints;
@@ -1317,8 +1308,9 @@
if ( !face->doblend || blend == NULL )
return TT_Err_Invalid_Argument;
+ /* to be freed by the caller */
if ( ( error = FT_NEW_ARRAY( delta_xy, n_points ) ) )
- goto Fail;
+ goto Exit;
*deltas = delta_xy;
if ( glyph_index >= blend->gv_glyphcnt ||
@@ -1329,7 +1321,7 @@
if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] ) ||
FT_FRAME_ENTER( blend->glyphoffsets[glyph_index + 1] -
blend->glyphoffsets[glyph_index] ) )
- goto Fail;
+ goto Fail1;
glyph_start = FT_Stream_FTell( stream );
@@ -1339,7 +1331,7 @@
if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis ) ||
FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||
FT_NEW_ARRAY( im_end_coords, blend->num_axis ) )
- goto Exit;
+ goto Fail2;
tupleCount = FT_GET_USHORT();
OffsetToData = glyph_start + FT_GET_USHORT();
@@ -1375,7 +1367,7 @@
else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount )
{
error = TT_Err_Invalid_Table;
- goto Fail;
+ goto Fail3;
}
else
{
@@ -1428,7 +1420,7 @@
: point_count );
if ( points == NULL || deltas_y == NULL || deltas_x == NULL )
- /* failure, ignore it */;
+ ; /* failure, ignore it */
else if ( points == ALL_POINTS )
{
@@ -1459,17 +1451,22 @@
FT_Stream_SeekSet( stream, here );
}
+ FT_FRAME_EXIT();
goto Exit;
- Fail:
- FT_FREE( delta_xy );
- *deltas = NULL;
-
- Exit:
+ Fail3:
FT_FREE( tuple_coords );
FT_FREE( im_start_coords );
FT_FREE( im_end_coords );
+ Fail2:
+ FT_FRAME_EXIT();
+
+ Fail1:
+ FT_FREE( delta_xy );
+ *deltas = NULL;
+
+ Exit:
return error;
}
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -892,7 +892,7 @@
driver->context = NULL;
}
#else
- FT_UNUSED( driver );
+ FT_UNUSED( ttdriver );
#endif
}