[gf] Important Fixes.

* As suggested here:

    http://lists.gnu.org/archive/html/freetype-devel/2018-08/msg00030.html
This commit is contained in:
Parth Wazurkar 2018-08-12 15:56:30 +05:30
parent 743b415ca9
commit efe6142469
2 changed files with 9 additions and 20 deletions

View File

@ -208,7 +208,6 @@
FT_Error error = FT_Err_Ok;
FT_Memory memory = FT_FACE_MEMORY( face );
GF_Glyph go=NULL;
FT_UInt16 i,count;
TFM_Service tfm;
@ -275,13 +274,7 @@
*/
gfface->family_name = NULL;
count=0;
for (i = 0; i < 256; i++)
{
if(go->bm_table[i].bitmap != NULL)
count++;
}
gfface->num_glyphs = (FT_Long)count;
gfface->num_glyphs = (FT_Long)go->nglyphs;
FT_TRACE4(( " number of glyphs: allocated %d\n",gfface->num_glyphs ));

View File

@ -162,7 +162,7 @@ FT_Byte bit_table[] = {
FT_TRACE2(( "gf_set_encodings: Allocated sufficient memory.\n" ));
for( i = 0 ; i < 256 ; i++ )
for( i = 0 ; i < ngphs ; i++ )
{
if( of[i].char_offset >= 0 )
tosort[i] = of[i].char_offset;
@ -174,7 +174,7 @@ FT_Byte bit_table[] = {
k = 0;
for ( i = 0; i < ngphs; i++ )
{
for ( j = 0; j < 256; j++ )
for ( j = 0; j < ngphs; j++ )
{
if( of[j].char_offset == tosort[i] )
break;
@ -561,14 +561,8 @@ FT_Byte bit_table[] = {
if( FT_ALLOC(go, sizeof(GF_GlyphRec)) )
goto Exit;
if( FT_ALLOC_MULT(go->bm_table, sizeof(GF_BitmapRec), nchars) )
goto Exit;
FT_TRACE2(( "gf_load_font: Allocated bitmap table\n" ));
for (i = 0; i < nchars; i++)
go->bm_table[i].bitmap = NULL;
go->ds = (FT_UInt)ds/(1<<20);
go->hppp = (FT_UInt)hppp/(1<<16);
go->vppp = (FT_UInt)vppp/(1<<16);
@ -584,11 +578,10 @@ FT_Byte bit_table[] = {
if( FT_ALLOC_MULT(of, sizeof(GF_CharOffsetRec), nchars) )
goto Exit;
for( i = 0; i < 256 ; i++)
of[i].char_offset = -1;
rptr = stream->pos;
i=0; ngphs=0;
i =0;
ngphs=0;
for ( ; ; )
{
if ((instr = READ_UINT1( stream )) == GF_POST_POST)
@ -622,6 +615,9 @@ FT_Byte bit_table[] = {
i++;
}
if( FT_ALLOC_MULT(go->bm_table, sizeof(GF_BitmapRec), ngphs) )
goto Exit;
error = gf_set_encodings( of, ngphs, go, memory );
if( error )
goto Exit;