shithub: freetype+ttf2subf

Download patch

ref: 6a700786ae88513bd51e41b8ff3dbfc63af721fc
parent: 2b623fe4f69485bc66eccb49757c703b99eba788
author: Werner Lemberg <[email protected]>
date: Thu Jan 16 03:55:40 EST 2014

[autofit] Improve tracing of style coverages.

* include/internal/fttrace.h: Add `afglobal' for tracing style
coverages.

* src/autofit/afglobal.c: Include FT_INTERNAL_DEBUG_H.
(FT_COMPONENT): Define.
(af_face_globals_compute_style_coverage): Trace `gstyles' array
data.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-01-16  Werner Lemberg  <[email protected]>
+
+	[autofit] Improve tracing of style coverages.
+
+	* include/internal/fttrace.h: Add `afglobal' for tracing style
+	coverages.
+
+	* src/autofit/afglobal.c: Include FT_INTERNAL_DEBUG_H.
+	(FT_COMPONENT): Define.
+	(af_face_globals_compute_style_coverage): Trace `gstyles' array
+	data.
+
 2014-01-09  Werner Lemberg  <[email protected]>
 
 	Fix Savannah bug #41158.
--- a/include/internal/fttrace.h
+++ b/include/internal/fttrace.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Tracing handling (specification only).                               */
 /*                                                                         */
-/*  Copyright 2002, 2004-2007, 2009, 2011-2013 by                          */
+/*  Copyright 2002, 2004-2007, 2009, 2011-2014 by                          */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -149,5 +149,6 @@
 FT_TRACE_DEF( aflatin2 )
 FT_TRACE_DEF( afwarp )
 FT_TRACE_DEF( afharfbuzz )
+FT_TRACE_DEF( afglobal )
 
 /* END */
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -19,8 +19,19 @@
 #include "afglobal.h"
 #include "afranges.h"
 #include "hbshim.h"
+#include FT_INTERNAL_DEBUG_H
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
+  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
+  /* messages during execution.                                            */
+  /*                                                                       */
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_afglobal
+
+
   /* get writing system specific header files */
 #undef  WRITING_SYSTEM
 #define WRITING_SYSTEM( ws, WS )  /* empty */
@@ -245,6 +256,45 @@
         }
       }
     }
+
+#ifdef FT_DEBUG_LEVEL_TRACE
+
+    FT_TRACE4(( "\n"
+                "style coverage\n"
+                "==============\n"
+                "\n" ));
+
+    for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ )
+    {
+      AF_StyleClass  style_class = AF_STYLE_CLASSES_GET[ss];
+      FT_UInt        count       = 0;
+      FT_Long        idx;
+
+
+      FT_TRACE4(( "%s:\n", af_style_names[style_class->style] ));
+
+      for ( idx = 0; idx < globals->glyph_count; idx++ )
+      {
+        if ( ( gstyles[idx] & ~AF_DIGIT ) == style_class->style )
+        {
+          if ( !( count % 10 ) )
+            FT_TRACE4(( " " ));
+
+          FT_TRACE4(( " %d", idx ));
+          count++;
+
+          if ( !( count % 10 ) )
+            FT_TRACE4(( "\n" ));
+        }
+      }
+
+      if ( !count )
+        FT_TRACE4(( "  (none)\n" ));
+      if ( count % 10 )
+        FT_TRACE4(( "\n" ));
+    }
+
+#endif /* FT_DEBUG_LEVEL_TRACE */
 
     FT_Set_Charmap( face, old_charmap );
     return error;