* src/base/ftobjs.c (ft_cmap_done_internal): New function.
(FT_CMap_Done): Remove cmap from cmap list. (destroy_charmaps, FT_CMap_New): Don't call FT_CMap_Done but ft_cmap_done_internal.
This commit is contained in:
parent
3a36ef7e6e
commit
e70371c410
@ -2,6 +2,11 @@
|
||||
|
||||
* src/base/ftsynth.c (FT_GlyphSlot_Embolden): Initialize `error'.
|
||||
|
||||
* src/base/ftobjs.c (ft_cmap_done_internal): New function.
|
||||
(FT_CMap_Done): Remove cmap from cmap list.
|
||||
(destroy_charmaps, FT_CMap_New): Don't call FT_CMap_Done but
|
||||
ft_cmap_done_internal.
|
||||
|
||||
2005-05-26 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* docs/GPL.txt: Update postal address of FSF.
|
||||
|
@ -75,10 +75,12 @@ FT_BEGIN_HEADER
|
||||
/* Copies an bitmap into another one. */
|
||||
/* */
|
||||
/* <Input> */
|
||||
/* source :: A handle to the source bitmap. */
|
||||
/* library :: A handle to a library object. */
|
||||
/* */
|
||||
/* source :: A handle to the source bitmap. */
|
||||
/* */
|
||||
/* <Output> */
|
||||
/* target :: A handle to the target bitmap. */
|
||||
/* target :: A handle to the target bitmap. */
|
||||
/* */
|
||||
/* <Return> */
|
||||
/* FreeType error code. 0 means success. */
|
||||
|
@ -159,7 +159,7 @@ FT_BEGIN_HEADER
|
||||
FT_CharMap charmap,
|
||||
FT_CMap *acmap );
|
||||
|
||||
/* destroy a charmap (don't remove it from face's list though) */
|
||||
/* destroy a charmap and remove it from face's list */
|
||||
FT_BASE( void )
|
||||
FT_CMap_Done( FT_CMap cmap );
|
||||
|
||||
|
@ -686,6 +686,10 @@
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_cmap_done_internal( FT_CMap cmap );
|
||||
|
||||
|
||||
static void
|
||||
destroy_charmaps( FT_Face face,
|
||||
FT_Memory memory )
|
||||
@ -698,7 +702,7 @@
|
||||
FT_CMap cmap = FT_CMAP( face->charmaps[n] );
|
||||
|
||||
|
||||
FT_CMap_Done( cmap );
|
||||
ft_cmap_done_internal( cmap );
|
||||
|
||||
face->charmaps[n] = NULL;
|
||||
}
|
||||
@ -2255,20 +2259,63 @@
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
ft_cmap_done_internal( FT_CMap cmap )
|
||||
{
|
||||
FT_CMap_Class clazz = cmap->clazz;
|
||||
FT_Face face = cmap->charmap.face;
|
||||
FT_Memory memory = FT_FACE_MEMORY(face);
|
||||
|
||||
|
||||
if ( clazz->done )
|
||||
clazz->done( cmap );
|
||||
|
||||
FT_FREE( cmap );
|
||||
}
|
||||
|
||||
|
||||
FT_BASE_DEF( void )
|
||||
FT_CMap_Done( FT_CMap cmap )
|
||||
{
|
||||
if ( cmap )
|
||||
{
|
||||
FT_CMap_Class clazz = cmap->clazz;
|
||||
FT_Face face = cmap->charmap.face;
|
||||
FT_Memory memory = FT_FACE_MEMORY(face);
|
||||
FT_Face face = cmap->charmap.face;
|
||||
FT_Memory memory = FT_FACE_MEMORY( face );
|
||||
FT_Error error;
|
||||
FT_Int i, j;
|
||||
|
||||
|
||||
if ( clazz->done )
|
||||
clazz->done( cmap );
|
||||
for ( i = 0; i < face->num_charmaps; i++ )
|
||||
{
|
||||
if ( (FT_CMap)face->charmaps[i] == cmap )
|
||||
{
|
||||
FT_CharMap last_charmap = face->charmaps[face->num_charmaps - 1];
|
||||
|
||||
FT_FREE( cmap );
|
||||
|
||||
if ( FT_RENEW_ARRAY( face->charmaps,
|
||||
face->num_charmaps,
|
||||
face->num_charmaps - 1 ) )
|
||||
return;
|
||||
|
||||
/* remove it from our list of charmaps */
|
||||
for ( j = i + 1; j < face->num_charmaps; j++ )
|
||||
{
|
||||
if ( j == face->num_charmaps - 1 )
|
||||
face->charmaps[j - 1] = last_charmap;
|
||||
else
|
||||
face->charmaps[j - 1] = face->charmaps[j];
|
||||
}
|
||||
|
||||
face->num_charmaps--;
|
||||
|
||||
if ( (FT_CMap)face->charmap == cmap )
|
||||
face->charmap = NULL;
|
||||
|
||||
ft_cmap_done_internal( cmap );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2319,7 +2366,7 @@
|
||||
return error;
|
||||
|
||||
Fail:
|
||||
FT_CMap_Done( cmap );
|
||||
ft_cmap_done_internal( cmap );
|
||||
cmap = NULL;
|
||||
goto Exit;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user