Commit 5e53db25ff480d4417154836385fa51f85a045cb

Werner Lemberg 2013-08-27T18:37:39

[autofit] While tracing, report script names instead of ID values. * src/autofit/afglobal.c (af_script_names) [FT_DEBUG_LEVEL_TRACE]: New array. * src/autofit/afglobal.h: Updated. * src/autofit/afcjk.c (af_cjk_metrics_init_widths, af_cjk_hint_edges): Use `af_script_names'. * src/autofit/aflatin.c (af_latin_metrics_init_widths, af_latin_hint_edges): Ditto.

diff --git a/ChangeLog b/ChangeLog
index c58e747..7cc14df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2013-08-27  Werner Lemberg  <wl@gnu.org>
+
+	[autofit] While tracing, report script names instead of ID values.
+
+	* src/autofit/afglobal.c (af_script_names) [FT_DEBUG_LEVEL_TRACE]:
+	New array.
+	* src/autofit/afglobal.h: Updated.
+
+	* src/autofit/afcjk.c (af_cjk_metrics_init_widths,
+	af_cjk_hint_edges): Use `af_script_names'.
+	* src/autofit/aflatin.c (af_latin_metrics_init_widths,
+	af_latin_hint_edges): Ditto.
+
 2013-08-26  Werner Lemberg  <wl@gnu.org>
 
 	[autofit] Report used script while hinting a glyph.
diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
index bcda652..85450ab 100644
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -74,10 +74,10 @@
 
 
     FT_TRACE5(( "\n"
-                "cjk standard widths computation (script %d)\n"
-                "===========================================\n"
+                "cjk standard widths computation (script `%s')\n"
+                "===============================================\n"
                 "\n",
-                metrics->root.script_class->script ));
+                af_script_names[metrics->root.script_class->script] ));
 
     af_glyph_hints_init( hints, face->memory );
 
@@ -1665,9 +1665,9 @@
 #endif
 
 
-    FT_TRACE5(( "cjk %s edge hinting (script %d)\n",
+    FT_TRACE5(( "cjk %s edge hinting (script `%s')\n",
                 dim == AF_DIMENSION_VERT ? "horizontal" : "vertical",
-                hints->metrics->script_class->script ));
+                af_script_names[hints->metrics->script_class->script] ));
 
     /* we begin by aligning all stems relative to the blue zone */
 
diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c
index e026c1c..12b6e03 100644
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -61,6 +61,22 @@
 #endif /* !FT_CONFIG_OPTION_PIC */
 
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+#undef  SCRIPT
+#define SCRIPT( s, S )  #s,
+
+  FT_LOCAL_ARRAY_DEF( char* )
+  af_script_names[] =
+  {
+
+#include "afscript.h"
+
+  };
+
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
+
   /* Compute the script index of each glyph within a given face. */
 
   static FT_Error
diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h
index e2f3e84..227eee7 100644
--- a/src/autofit/afglobal.h
+++ b/src/autofit/afglobal.h
@@ -34,6 +34,10 @@ FT_BEGIN_HEADER
   FT_LOCAL_ARRAY( AF_ScriptClass )
   af_script_classes[];
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+  FT_LOCAL_ARRAY( char* )
+  af_script_names[];
+#endif
 
   /*
    *  Default values and flags for both autofitter globals (found in
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index dd925e8..93c9f31 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -61,10 +61,10 @@
 
 
     FT_TRACE5(( "\n"
-                "latin standard widths computation (script %d)\n"
-                "=============================================\n"
+                "latin standard widths computation (script `%s')\n"
+                "=================================================\n"
                 "\n",
-                metrics->root.script_class->script ));
+                af_script_names[metrics->root.script_class->script] ));
 
     af_glyph_hints_init( hints, face->memory );
 
@@ -1897,9 +1897,9 @@
 #endif
 
 
-    FT_TRACE5(( "latin %s edge hinting (script %d)\n",
+    FT_TRACE5(( "latin %s edge hinting (script `%s')\n",
                 dim == AF_DIMENSION_VERT ? "horizontal" : "vertical",
-                hints->metrics->script_class->script ));
+                af_script_names[hints->metrics->script_class->script] ));
 
     /* we begin by aligning all stems relative to the blue zone */
     /* if needed -- that's only for horizontal edges            */