summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParth Wazurkar <parthwazurkar@gmail.com>2018-08-12 15:56:30 +0530
committerParth Wazurkar <parthwazurkar@gmail.com>2018-08-12 15:56:30 +0530
commitefe614246915426b08dc37732f91d9b8b23fd089 (patch)
tree8ad8cf3ce8f91f84fde348b1d988edcdfdd6044d
parent743b415ca95ad25722a2fb260920cfab21220479 (diff)
downloadfreetype2-efe614246915426b08dc37732f91d9b8b23fd089.tar.gz
[gf] Important Fixes.
* As suggested here: http://lists.gnu.org/archive/html/freetype-devel/2018-08/msg00030.html
-rw-r--r--src/gf/gfdrivr.c9
-rw-r--r--src/gf/gflib.c20
2 files changed, 9 insertions, 20 deletions
diff --git a/src/gf/gfdrivr.c b/src/gf/gfdrivr.c
index e51f10abc..8803bc24a 100644
--- a/src/gf/gfdrivr.c
+++ b/src/gf/gfdrivr.c
@@ -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 ));
diff --git a/src/gf/gflib.c b/src/gf/gflib.c
index 0efbb903c..0041b4668 100644
--- a/src/gf/gflib.c
+++ b/src/gf/gflib.c
@@ -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;