[gf] Fix gf_free_font function errors.

* src/gf/gflib.c (gf_free_font): Fix errors in gf_free_font
function.

* src/gf/gfdrir.c (GF_Glyph_Load): Improve slot metric
values.
This commit is contained in:
Parth Wazurkar 2018-07-10 14:12:06 +05:30
parent f7f18d792e
commit 2c3b6390a5
2 changed files with 21 additions and 15 deletions

View File

@ -133,8 +133,8 @@
FT_CALLBACK_DEF( void )
GF_Face_Done( FT_Face gfface ) /* GF_Face */
{
GF_Face face = (GF_Face)gfface;
FT_Memory memory= FT_FACE_MEMORY( gfface );
GF_Face face = (GF_Face)gfface;
FT_Memory memory;
if ( !face )
@ -142,7 +142,10 @@
memory = FT_FACE_MEMORY( face );
gf_free_font( gfface, memory );
/*gf_free_font( face );*/
/*FT_FREE( gfface->available_sizes );*/
}
@ -409,8 +412,8 @@
slot->bitmap_left = bm.off_x / go->hppp;
slot->bitmap_top = ascent ;
slot->metrics.horiAdvance = (FT_Pos) bm.mv_x * 64;
slot->metrics.horiBearingX = (FT_Pos) bm.off_x * 64;
slot->metrics.horiAdvance = (FT_Pos) (bm.mv_x / go->hppp) * 64;
slot->metrics.horiBearingX = (FT_Pos) (bm.off_x / go->hppp) * 64;
slot->metrics.horiBearingY = (FT_Pos) ascent * 64;
slot->metrics.width = (FT_Pos) ( bitmap->width * 64 );
slot->metrics.height = (FT_Pos) ( bitmap->rows * 64 );

View File

@ -133,7 +133,6 @@ unsigned char bit_table[] = {
min_n = READ_INT4( stream );
max_n = READ_INT4( stream );
break;
case GF_BOC1:
if ( FT_STREAM_SKIP( 1 ) )
return -1;
@ -144,7 +143,6 @@ unsigned char bit_table[] = {
min_m = max_m - del_m;
min_n = max_n - del_n;
break;
default:
return -1;
}
@ -489,7 +487,6 @@ unsigned char bit_table[] = {
return error;
Exit:
printf("*ERROR\n");
if (go != NULL)
{
FT_FREE(go->bm_table);
@ -500,16 +497,22 @@ unsigned char bit_table[] = {
FT_LOCAL_DEF( void )
gf_free_font( FT_Face gfface, FT_Memory memory )
gf_free_font( GF_Face face )
{
GF_Face gf = (GF_Face)gfface;
GF_Glyph go;
go = gf->gf_glyph;
if (go != NULL)
FT_Memory memory = FT_FACE( face )->memory;
GF_Glyph go = face->gf_glyph;
FT_UInt nchars = FT_FACE( face )->num_glyphs,i;
if ( !go )
return;
if( go->bm_table )
{
FT_FREE(go->bm_table);
FT_FREE(go);
for (i = 0; i < nchars; i++)
FT_FREE(go->bm_table[i].bitmap);
}
FT_FREE(go->bm_table);
FT_FREE(go);
}