diff --git a/ChangeLog b/ChangeLog index 7c1f64940..ecdb4ec66 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2014-01-16 Werner Lemberg + + [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 Fix Savannah bug #41158. diff --git a/include/internal/fttrace.h b/include/internal/fttrace.h index 29158c08f..d5253db78 100644 --- 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( aflatin ) FT_TRACE_DEF( aflatin2 ) FT_TRACE_DEF( afwarp ) FT_TRACE_DEF( afharfbuzz ) +FT_TRACE_DEF( afglobal ) /* END */ diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c index 7682c1468..b587a90bf 100644 --- a/src/autofit/afglobal.c +++ b/src/autofit/afglobal.c @@ -19,6 +19,17 @@ #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 */ @@ -246,6 +257,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; }