Hi, Changes are list below, though currently no module uses more than one glyph slot in a face.
* fixed a memory leak in FT_Done_GlyphSlot * removed a non-necessary loop in T42_GlyphSlot_Done * prepend glyph slot to face->glyph when FT_New_GlyphSlot is called, otherwise a new second glyph slot cannot be done
Index: base/ftobjs.c =================================================================== RCS file: /home/cvs/freetype2/src/base/ftobjs.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 ftobjs.c --- base/ftobjs.c 15 May 2005 07:10:28 -0000 1.1.1.1 +++ base/ftobjs.c 16 May 2005 15:37:15 -0000 @@ -348,11 +348,9 @@ FT_GlyphSlot slot; - if ( !face || !aslot || !face->driver ) + if ( !face || !face->driver ) return FT_Err_Invalid_Argument; - *aslot = 0; - driver = face->driver; clazz = driver->clazz; memory = driver->root.memory; @@ -370,8 +368,15 @@ goto Exit; } - *aslot = slot; + slot->next = face->glyph; + face->glyph = slot; + + if ( aslot ) + *aslot = slot; } + else if ( aslot ) + *aslot = 0; + Exit: FT_TRACE4(( "FT_New_GlyphSlot: Return %d\n", error )); @@ -386,25 +391,30 @@ { if ( slot ) { - FT_Driver driver = slot->face->driver; - FT_Memory memory = driver->root.memory; - FT_GlyphSlot* parent; - FT_GlyphSlot cur; + FT_Driver driver = slot->face->driver; + FT_Memory memory = driver->root.memory; + FT_GlyphSlot prev; + FT_GlyphSlot cur; /* Remove slot from its parent face's list */ - parent = &slot->face->glyph; - cur = *parent; + prev = NULL; + cur = slot->face->glyph; while ( cur ) { if ( cur == slot ) { - *parent = cur->next; + if ( !prev ) + slot->face->glyph = cur->next; + else + prev->next = cur->next; + ft_glyphslot_done( slot ); FT_FREE( slot ); break; } + prev = cur; cur = cur->next; } } @@ -1679,18 +1689,11 @@ FT_List_Add( &face->driver->faces_list, node ); /* now allocate a glyph slot object for the face */ - { - FT_GlyphSlot slot; - - - FT_TRACE4(( "FT_Open_Face: Creating glyph slot\n" )); + FT_TRACE4(( "FT_Open_Face: Creating glyph slot\n" )); - error = FT_New_GlyphSlot( face, &slot ); - if ( error ) - goto Fail; - - face->glyph = slot; - } + error = FT_New_GlyphSlot( face, NULL ); + if ( error ) + goto Fail; /* finally, allocate a size object for the face */ { Index: type42/t42objs.c =================================================================== RCS file: /home/cvs/freetype2/src/type42/t42objs.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 t42objs.c --- type42/t42objs.c 15 May 2005 07:10:28 -0000 1.1.1.1 +++ type42/t42objs.c 16 May 2005 14:34:59 -0000 @@ -515,21 +515,7 @@ FT_LOCAL_DEF( void ) T42_GlyphSlot_Done( T42_GlyphSlot slot ) { - FT_Face face = slot->root.face; - T42_Face t42face = (T42_Face)face; - FT_GlyphSlot cur = t42face->ttf_face->glyph; - - - while ( cur ) - { - if ( cur == slot->ttslot ) - { - FT_Done_GlyphSlot( slot->ttslot ); - break; - } - - cur = cur->next; - } + FT_Done_GlyphSlot( slot->ttslot ); }
_______________________________________________ Freetype-devel mailing list Freetype-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/freetype-devel