freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] parthw-cleaned f7a27bf: [gf] Fixes.


From: Parth Wazurkar
Subject: [freetype2] parthw-cleaned f7a27bf: [gf] Fixes.
Date: Sun, 8 Jul 2018 12:16:23 -0400 (EDT)

branch: parthw-cleaned
commit f7a27bf38847b4531164f042088535604d3cd2ec
Author: Parth Wazurkar <address@hidden>
Commit: Parth Wazurkar <address@hidden>

    [gf] Fixes.
---
 src/gf/gfdrivr.c | 13 ++++++++-----
 src/gf/gflib.c   | 22 +++++++++++++---------
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/gf/gfdrivr.c b/src/gf/gfdrivr.c
index cc2aa95..6ce8665 100644
--- a/src/gf/gfdrivr.c
+++ b/src/gf/gfdrivr.c
@@ -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 );
diff --git a/src/gf/gflib.c b/src/gf/gflib.c
index ff6fe90..8eb7f68 100644
--- a/src/gf/gflib.c
+++ b/src/gf/gflib.c
@@ -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;
     }
@@ -500,16 +498,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);
   }
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]