Commit 3b125e95944ef4cbf321479410391db9bf403c00

Werner Lemberg 2016-12-17T10:02:19

Improve tracing of `FT_Open_Face'. * src/base/ftobjs.c (FT_Open_Face): Return info on number of available faces and numbered instances, or the indices of the requested face and numbered instance. * src/sfnt/sfobjs. (sfnt_open_font): Trace number of subfonts.

diff --git a/ChangeLog b/ChangeLog
index a6cc7df..3376a24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2016-12-17  Werner Lemberg  <wl@gnu.org>
 
+	Improve tracing of `FT_Open_Face'.
+
+	* src/base/ftobjs.c (FT_Open_Face): Return info on number of
+	available faces and numbered instances, or the indices of the
+	requested face and numbered instance.
+
+	* src/sfnt/sfobjs. (sfnt_open_font): Trace number of subfonts.
+
+2016-12-17  Werner Lemberg  <wl@gnu.org>
+
 	* src/cff/cffload.c (cff_load_private_dict): Always init `blend'.
 
 	Reported as
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 07b3ef0..5d347e8 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -2122,6 +2122,19 @@
     FT_Module*   limit;
 
 
+#ifdef FT_DEBUG_LEVEL_TRACE
+    FT_TRACE3(( "FT_Open_Face: " ));
+    if ( face_index < 0 )
+      FT_TRACE3(( "Requesting number of faces and named instances\n"));
+    else
+    {
+      FT_TRACE3(( "Requesting face %ld", face_index & 0xFFFFL ));
+      if ( face_index & 0x7FFF0000L )
+        FT_TRACE3(( ", named instance %ld", face_index >> 16 ));
+      FT_TRACE3(( "\n" ));
+    }
+#endif
+
     /* test for valid `library' delayed to `FT_Stream_New' */
 
     if ( ( !aface && face_index >= 0 ) || !args )
@@ -2368,6 +2381,17 @@
       destroy_face( memory, face, driver );
 
   Exit:
+#ifdef FT_DEBUG_LEVEL_TRACE
+    if ( !error && face_index < 0 )
+    {
+      FT_TRACE3(( "FT_Open_Face: The font has %ld faces\n"
+                  "              and %ld named instances for face %ld\n",
+                  face->num_faces,
+                  face->style_flags >> 16,
+                  -face_index - 1 ));
+    }
+#endif
+
     FT_TRACE4(( "FT_Open_Face: Return %d\n", error ));
 
     return error;
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 60bfda9..b3b9761 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -804,6 +804,9 @@
       if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) )
         return error;
 
+      FT_TRACE3(( "                with %ld subfonts\n",
+                  face->ttc_header.count ));
+
       if ( face->ttc_header.count == 0 )
         return FT_THROW( Invalid_Table );