Commit ef48653023ea3e67bb4df3b5be1ef10089623abf

Werner Lemberg 2018-01-27T11:16:22

[truetype] Better trace VF instances. * src/truetype/ttgxvar.c (ft_var_to_normalized): Don't emit number of coordinates. (TT_Get_MM_Var): Trace instance indices names. (TT_Set_Var_Design): Updated.

diff --git a/ChangeLog b/ChangeLog
index f62e3f9..1777d2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2018-01-27  Werner Lemberg  <wl@gnu.org>
 
+	[truetype] Better trace VF instances.
+
+	* src/truetype/ttgxvar.c (ft_var_to_normalized): Don't emit number
+	of coordinates.
+	(TT_Get_MM_Var): Trace instance indices names.
+	(TT_Set_Var_Design): Updated.
+
+2018-01-27  Werner Lemberg  <wl@gnu.org>
+
 	[truetype] Beautify tracing of VF axis records.
 
 	* src/truetype/ttgxvar.c (TT_Get_MM_Var): Show axis records in a
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index d765184..a6910e9 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -1733,17 +1733,13 @@
     /* based on the [min,def,max] values for the axis to be [-1,0,1]. */
     /* Then, if there's an `avar' table, we renormalize this range.   */
 
-    FT_TRACE5(( "%d design coordinate%s:\n",
-                num_coords,
-                num_coords == 1 ? "" : "s" ));
-
     a = mmvar->axis;
     for ( i = 0; i < num_coords; i++, a++ )
     {
       FT_Fixed  coord = coords[i];
 
 
-      FT_TRACE5(( "  %.5f\n", coord / 65536.0 ));
+      FT_TRACE5(( "    %d: %.5f\n", i, coord / 65536.0 ));
       if ( coord > a->maximum || coord < a->minimum )
       {
         FT_TRACE1((
@@ -2218,6 +2214,10 @@
           goto Exit;
       }
 
+      FT_TRACE5(( "%d instance%s\n",
+                  fvar_head.instanceCount,
+                  fvar_head.instanceCount == 1 ? "" : "s" ));
+
       ns  = mmvar->namedstyle;
       nsc = face->blend->normalized_stylecoords;
       for ( i = 0; i < fvar_head.instanceCount; i++, ns++ )
@@ -2240,6 +2240,49 @@
         else
           ns->psid = 0xFFFF;
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+        {
+          SFNT_Service  sfnt = (SFNT_Service)face->sfnt;
+
+          FT_String*  strname = NULL;
+          FT_String*  psname  = NULL;
+
+          FT_ULong  pos;
+
+
+          pos = FT_STREAM_POS();
+
+          if ( ns->strid != 0xFFFF )
+          {
+            (void)sfnt->get_name( face,
+                                  (FT_UShort)ns->strid,
+                                  &strname );
+            if ( strname && !ft_strcmp( strname, ".notdef" ) )
+              strname = NULL;
+          }
+
+          if ( ns->psid != 0xFFFF )
+          {
+            (void)sfnt->get_name( face,
+                                  (FT_UShort)ns->psid,
+                                  &psname );
+            if ( psname && !ft_strcmp( psname, ".notdef" ) )
+              psname = NULL;
+          }
+
+          (void)FT_STREAM_SEEK( pos );
+
+          FT_TRACE5(( "  instance %d (%s%s%s, %s%s%s)\n",
+                      i,
+                      strname ? "name: `" : "",
+                      strname ? strname : "unnamed",
+                      strname ? "'" : "",
+                      psname ? "PS name: `" : "",
+                      psname ? psname : "no PS name",
+                      psname ? "'" : "" ));
+        }
+#endif /* FT_DEBUG_LEVEL_TRACE */
+
         ft_var_to_normalized( face, num_axes, ns->coords, nsc );
         nsc += num_axes;
 
@@ -2787,6 +2830,8 @@
     if ( !face->blend->avar_loaded )
       ft_var_load_avar( face );
 
+    FT_TRACE5(( "TT_Set_Var_Design:\n"
+                "  normalized design coordinates:\n" ));
     ft_var_to_normalized( face, num_coords, blend->coords, normalized );
 
     error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 );