Commit 86fa2ebc1f2a73693b5da1076a0871439256db2b

Werner Lemberg 2009-06-19T14:56:26

Improve debug messages for Type1 charstrings. * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Emit newlines after instructions. Prettify output.

diff --git a/ChangeLog b/ChangeLog
index b00dc35..df83e9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-06-19  Werner Lemberg  <wl@gnu.org>
 
+	Improve debug messages for Type1 charstrings.
+
+	* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Emit newlines
+	after instructions.
+	Prettify output.
+
+2009-06-19  Werner Lemberg  <wl@gnu.org>
+
 	More ftgray fixes for FT_STATIC_RASTER.
 	Problems reported by suyu@cooee.cn.
 
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 4ccf30f..d396a68 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -340,6 +340,10 @@
 
     T1_Hints_Funcs   hinter;
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+    FT_Bool          bol = TRUE;
+#endif
+
 
     /* we don't want to touch the source code -- use macro trick */
 #define start_point    t1_builder_start_point
@@ -394,7 +398,13 @@
       FT_ASSERT( known_othersubr_result_cnt == 0   ||
                  unknown_othersubr_result_cnt == 0 );
 
-      FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
+#ifdef FT_DEBUG_LEVEL_TRACE
+      if ( bol )
+      {
+        FT_TRACE5(( " (%d)", decoder->top - decoder->stack ));
+        bol = FALSE;
+      }
+#endif
 
       /*********************************************************************/
       /*                                                                   */
@@ -592,7 +602,10 @@
         FT_Int  arg_cnt;
 
 
-        FT_TRACE4(( " callothersubr" ));
+#ifdef FT_DEBUG_LEVEL_TRACE
+        FT_TRACE4(( " callothersubr\n" ));
+        bol = TRUE;
+#endif
 
         if ( top - decoder->stack < 2 )
           goto Stack_Underflow;
@@ -974,7 +987,7 @@
         switch ( op )
         {
         case op_endchar:
-          FT_TRACE4(( " endchar" ));
+          FT_TRACE4(( " endchar\n" ));
 
           close_contour( builder );
 
@@ -994,8 +1007,6 @@
           /* add current outline to the glyph slot */
           FT_GlyphLoader_Add( builder->loader );
 
-          FT_TRACE4(( "\n" ));
-
           /* the compiler should optimize away this empty loop but ... */
 
 #ifdef FT_DEBUG_LEVEL_TRACE
@@ -1144,7 +1155,7 @@
           break;
 
         case op_rrcurveto:
-          FT_TRACE4(( " rcurveto" ));
+          FT_TRACE4(( " rrcurveto" ));
 
           if ( start_point( builder, x, y ) ||
                check_points( builder, 3 )   )
@@ -1399,6 +1410,11 @@
 
         decoder->top = top;
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+        FT_TRACE4(( "\n" ));
+        bol = TRUE;
+#endif
+
       } /* general operator processing */
 
     } /* while ip < limit */