[gf] Allocate bitmap in `GF_Glyph_Load' itself.
This commit is contained in:
parent
7ea68ac9f3
commit
b54503a256
|
@ -189,10 +189,10 @@
|
|||
|
||||
memory = FT_FACE_MEMORY( face );
|
||||
|
||||
gf_free_font( face );
|
||||
|
||||
FT_FREE( gfface->available_sizes );
|
||||
|
||||
FT_FREE( face->gf_glyph->encodings );
|
||||
FT_FREE( face->gf_glyph->metrics );
|
||||
gf_free_font( face );
|
||||
}
|
||||
|
||||
|
||||
|
@ -429,7 +429,6 @@
|
|||
GF_MetricRec metric;
|
||||
GF_Glyph go;
|
||||
FT_ULong bytes;
|
||||
FT_Byte *bitmp;
|
||||
|
||||
go = gf->gf_glyph;
|
||||
|
||||
|
@ -470,12 +469,7 @@
|
|||
bitmap->width = metric.bbx_width;
|
||||
bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
|
||||
|
||||
bitmap->pitch = (int)( metric.raster );
|
||||
|
||||
/* note: we don't allocate a new array to hold the bitmap; */
|
||||
/* we can simply point to it */
|
||||
ft_glyphslot_set_bitmap( slot, metric.bitmap );
|
||||
|
||||
bitmap->pitch = (int)( ( bitmap->width + 7 ) >> 3 );
|
||||
|
||||
slot->format = FT_GLYPH_FORMAT_BITMAP;
|
||||
slot->bitmap_left = metric.off_x ;
|
||||
|
@ -489,7 +483,13 @@
|
|||
|
||||
ft_synthesize_vertical_metrics( &slot->metrics, metric.bbx_height * 64 );
|
||||
|
||||
/* XXX: to do: are there cases that need repadding the bitmap? */
|
||||
if ( load_flags & FT_LOAD_BITMAP_METRICS_ONLY )
|
||||
goto Exit;
|
||||
|
||||
bytes = (FT_ULong)bitmap->pitch * bitmap->rows;
|
||||
|
||||
error = ft_glyphslot_alloc_bitmap( slot, (FT_ULong)bytes );
|
||||
memset( slot->bitmap.buffer, 0, bytes );
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
|
@ -567,7 +567,6 @@
|
|||
|
||||
if ( !error )
|
||||
{
|
||||
printf("Hi I reached here\n");
|
||||
/* Modify GF_Glyph data according to TFM metric values */
|
||||
|
||||
/*face->gf_glyph->font_bbx_w = fi->font_bbx_w;
|
||||
|
@ -575,7 +574,6 @@
|
|||
*/
|
||||
|
||||
face->tfm_data = fi;
|
||||
fi = NULL;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
|
|
@ -195,6 +195,7 @@ FT_Byte bit_table[] = {
|
|||
}
|
||||
|
||||
FT_FREE(metric);
|
||||
FT_FREE(tosort);
|
||||
|
||||
go->nencodings = k;
|
||||
go->encodings = encoding;
|
||||
|
@ -283,14 +284,14 @@ FT_Byte bit_table[] = {
|
|||
|
||||
BOC:
|
||||
if(error != FT_Err_Ok)
|
||||
return -1;
|
||||
return error;
|
||||
w = max_m - min_m + 1;
|
||||
h = max_n - min_n + 1;
|
||||
if ((w < 0) || (h < 0))
|
||||
{
|
||||
FT_ERROR(( "gf_read_glyph: invalid w and h values\n" ));
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
return -1;
|
||||
return error;
|
||||
}
|
||||
|
||||
/* FT_TRACE2(( "w is %ld\n"
|
||||
|
@ -300,14 +301,21 @@ FT_Byte bit_table[] = {
|
|||
*/
|
||||
|
||||
/* allocate and build bitmap */
|
||||
/*
|
||||
if ((metrics->bitmap = (FT_Byte*)malloc(h*((w+7)/8))) == NULL)
|
||||
{
|
||||
error = FT_THROW( Invalid_File_Format );
|
||||
return -1;
|
||||
return error;
|
||||
}
|
||||
*/
|
||||
|
||||
/* if( FT_ALLOC( metrics->bitmap, (h*((w+7)/8)) ) )
|
||||
return error;
|
||||
*/
|
||||
/*
|
||||
memset(metrics->bitmap, 0, h*((w+7)/8));
|
||||
metrics->raster = (FT_UInt)(w+7)/8;
|
||||
*/
|
||||
metrics->bbx_width = w;
|
||||
metrics->bbx_height = h;
|
||||
metrics->off_x = -min_m;
|
||||
|
@ -596,6 +604,12 @@ FT_Byte bit_table[] = {
|
|||
go->metrics[code - bc].mv_y = dy;
|
||||
go->metrics[code - bc].char_offset = (FT_ULong)ptr;
|
||||
go->metrics[code - bc].code = (FT_UShort)code;
|
||||
go->metrics[code - bc].bbx_width = 0; /* Initialize other metrics here */
|
||||
go->metrics[code - bc].bbx_height = 0;
|
||||
go->metrics[code - bc].off_x = 0;
|
||||
go->metrics[code - bc].off_y = 0;
|
||||
go->metrics[code - bc].raster = 0;
|
||||
go->metrics[code - bc].bitmap = NULL;
|
||||
go->nglyphs += 1;
|
||||
}
|
||||
|
||||
|
@ -628,10 +642,6 @@ FT_Byte bit_table[] = {
|
|||
if ( !go )
|
||||
return;
|
||||
|
||||
if(go->metrics != NULL)
|
||||
{
|
||||
FT_FREE(go->metrics);
|
||||
}
|
||||
FT_FREE(go);
|
||||
}
|
||||
|
||||
|
|
|
@ -517,7 +517,6 @@
|
|||
*/
|
||||
|
||||
face->tfm_data = fi;
|
||||
fi = NULL;
|
||||
}
|
||||
|
||||
Exit:
|
||||
|
|
|
@ -131,9 +131,9 @@
|
|||
FT_LOCAL( void )
|
||||
tfm_close( TFM_Parser parser )
|
||||
{
|
||||
FT_Memory memory = parser->memory;
|
||||
FT_UNUSED( parser );
|
||||
|
||||
FT_FREE( parser->stream );
|
||||
/* nothing */
|
||||
}
|
||||
|
||||
|
||||
|
@ -346,13 +346,10 @@
|
|||
fi->slant = (FT_ULong)((double)fi->slant/(double)(1<<20));
|
||||
|
||||
Exit:
|
||||
if( !ci || !w || !h || !d )
|
||||
{
|
||||
FT_FREE(ci);
|
||||
FT_FREE(w);
|
||||
FT_FREE(h);
|
||||
FT_FREE(d);
|
||||
}
|
||||
FT_FREE(ci);
|
||||
FT_FREE(w);
|
||||
FT_FREE(h);
|
||||
FT_FREE(d);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue