From 3b125e95944ef4cbf321479410391db9bf403c00 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 17 Dec 2016 10:02:19 +0100 Subject: [PATCH] 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. --- ChangeLog | 10 ++++++++++ src/base/ftobjs.c | 24 ++++++++++++++++++++++++ src/sfnt/sfobjs.c | 3 +++ 3 files changed, 37 insertions(+) diff --git a/ChangeLog b/ChangeLog index a6cc7df78..3376a2449 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2016-12-17 Werner Lemberg + + 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 * src/cff/cffload.c (cff_load_private_dict): Always init `blend'. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 07b3ef073..5d347e844 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 60bfda9b8..b3b976127 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 );