[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] parthw-cleaned 9c3ffde: [gf] Important Fixes.
From: |
Parth Wazurkar |
Subject: |
[freetype2] parthw-cleaned 9c3ffde: [gf] Important Fixes. |
Date: |
Sun, 12 Aug 2018 06:28:57 -0400 (EDT) |
branch: parthw-cleaned
commit 9c3ffded1b8c54901be3b95ac781d2cf292ceed4
Author: Parth Wazurkar <address@hidden>
Commit: Parth Wazurkar <address@hidden>
[gf] Important Fixes.
* As suggested here:
http://lists.gnu.org/archive/html/freetype-devel/2018-08/msg00030.html
---
src/gf/gfdrivr.c | 9 +--------
src/gf/gflib.c | 20 ++++++++------------
2 files changed, 9 insertions(+), 20 deletions(-)
diff --git a/src/gf/gfdrivr.c b/src/gf/gfdrivr.c
index e51f10a..8803bc2 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 0efbb90..0041b46 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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] parthw-cleaned 9c3ffde: [gf] Important Fixes.,
Parth Wazurkar <=