freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] parthw-cleaned f856284: [gf] Initialise `TFM Service' and ad


From: Parth Wazurkar
Subject: [freetype2] parthw-cleaned f856284: [gf] Initialise `TFM Service' and add tracing.
Date: Mon, 30 Jul 2018 13:45:19 -0400 (EDT)

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

    [gf] Initialise `TFM Service' and add tracing.
    
    * src/gf/gfdrivr.c (GF_Face_Init): Call `FT_Get_Module_Interface'
    to initialise `tfm' module.
    
    * src/gf/gfdrivr.c (TFM_Read_Metrics): Add tracing messages.
---
 src/gf/gfdrivr.c | 57 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 43 insertions(+), 14 deletions(-)

diff --git a/src/gf/gfdrivr.c b/src/gf/gfdrivr.c
index fbbc7aa..5cebaee 100644
--- a/src/gf/gfdrivr.c
+++ b/src/gf/gfdrivr.c
@@ -165,10 +165,22 @@
     GF_Glyph    go=NULL;
     FT_UInt16   i,count;
 
+    TFM_Service tfm;
+
     FT_UNUSED( num_params );
     FT_UNUSED( params );
 
 
+    face->tfm = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
+                                           "tfm" );
+    tfm = (TFM_Service)face->tfm;
+    if ( !tfm )
+    {
+      FT_ERROR(( "GF_Face_Init: cannot access `tfm' module\n" ));
+      error = FT_THROW( Missing_Module );
+      goto Exit;
+    }
+
     FT_TRACE2(( "GF driver\n" ));
 
     /* load font */
@@ -378,7 +390,7 @@
 
     FT_TRACE1(( "GF_Glyph_Load: glyph index %d\n", glyph_index ));
 
-    if ( glyph_index < 0 )
+    if ( (FT_Int)glyph_index < 0 )
       glyph_index = 0;
 
     if ((glyph_index < go->code_min) || (go->code_max < glyph_index))
@@ -468,28 +480,45 @@
     if ( FT_NEW( fi ) )
       goto Exit;
 
+    FT_TRACE4(( "TFM_Read_Metrics: Invoking TFM_Service.\n" ));
+
     tfm = (TFM_Service)face->tfm;
-    if ( tfm->init )
-    {
-      error = tfm->init( &parser,
-                         memory,
-                         stream );
 
-      if ( !error )
-      {
-        parser.FontInfo  = fi;
-        parser.user_data = gf_glyph;
+    /* Initialise TFM Service */
+    error = tfm->init( &parser,
+                       memory,
+                       stream );
 
-        error = tfm->parse_metrics( &parser );
-        tfm->done( &parser );
-      }
+    if ( !error )
+    {
+      FT_TRACE4(( "TFM_Read_Metrics: Initialised tfm metric data.\n" ));
+      parser.FontInfo  = fi;
+      parser.user_data = gf_glyph;
+
+      error = tfm->parse_metrics( &parser );
+      if( !error )
+        FT_TRACE4(( "TFM_Read_Metrics: parsing TFM metric information done.\n" 
));
+
+      FT_TRACE6(( "TFM_Read_Metrics: TFM Metric Information:\n"
+                  "                  Check Sum  : %ld\n"
+                  "                  Design Size: %ld\n"
+                  "                  Begin Char : %d\n"
+                  "                  End Char   : %d\n"
+                  "                  font_bbx_w : %d\n"
+                  "                  font_bbx_h : %d\n"
+                  "                  slant      : %d\n", parser.FontInfo->cs, 
parser.FontInfo->design_size, parser.FontInfo->begin_char,
+                                                         
parser.FontInfo->end_char, parser.FontInfo->font_bbx_w,
+                                                         
parser.FontInfo->font_bbx_h, parser.FontInfo->slant ));
+      tfm->done( &parser );
     }
 
     if ( !error )
     {
       /* Modify GF_Glyph data according to TFM metric values */
 
-      /* TO-DO */
+      /*face->gf_glyph->font_bbx_w = fi->font_bbx_w;
+      face->gf_glyph->font_bbx_h = fi->font_bbx_h;
+      */
 
       face->tfm_data       = fi;
       fi                   = NULL;



reply via email to

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