shithub: freetype+ttf2subf

Download patch

ref: 70cf8c5e6d249523ed474e548b4c9e1d226c77df
parent: 3630bf7eb59d28172cd0472f43d7cad847fc9f46
author: Werner Lemberg <[email protected]>
date: Sat Nov 26 15:09:39 EST 2011

Improve tracing.

* src/bdf/bdfdrivr.c (BDF_Face_Done), src/pcf/pcfdrivr.c
(PCF_Face_Done): Remove tracing message.

* src/bdf/bdfdrivr.c (BDF_Face_Init), src/cff/cffobjs.c
(cff_face_init), src/cid/cidobjs.c (cid_face_init),
src/pfr/pfrobjs.c (pfr_face_init), src/sfnt/sfobjs.c
(sfnt_init_face), src/truetype/ttobjs.c (tt_face_init),
src/type1/t1objs.c (T1_Face_Init), src/type42/t42objs.c
(T42_Face_Init), src/winfonts/winfnt.c (FNT_Face_Init): Add
`greeting' message.

* src/sfnt/sfobjs.c (sfnt_open_font), src/type42/t42objs.c
(T42_Open_Face): Improve tracing.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2011-11-26  Werner Lemberg  <[email protected]>
 
+	Improve tracing.
+
+	* src/bdf/bdfdrivr.c (BDF_Face_Done), src/pcf/pcfdrivr.c
+	(PCF_Face_Done): Remove tracing message.
+
+	* src/bdf/bdfdrivr.c (BDF_Face_Init), src/cff/cffobjs.c
+	(cff_face_init), src/cid/cidobjs.c (cid_face_init),
+	src/pfr/pfrobjs.c (pfr_face_init), src/sfnt/sfobjs.c
+	(sfnt_init_face), src/truetype/ttobjs.c (tt_face_init),
+	src/type1/t1objs.c (T1_Face_Init), src/type42/t42objs.c
+	(T42_Face_Init), src/winfonts/winfnt.c (FNT_Face_Init): Add
+	`greeting' message.
+
+	* src/sfnt/sfobjs.c (sfnt_open_font), src/type42/t42objs.c
+	(T42_Open_Face): Improve tracing.
+
+2011-11-26  Werner Lemberg  <[email protected]>
+
 	[cid] Fix error code.
 
 	* src/cid/cidparse.c (cid_parser_new): Do it.
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -2,7 +2,7 @@
 
     FreeType font driver for bdf files
 
-    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by
+    Copyright (C) 2001-2008, 2011 by
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -332,8 +332,6 @@
     FT_FREE( bdfface->available_sizes );
 
     FT_FREE( face->bdffont );
-
-    FT_TRACE4(( "BDF_Face_Done: done face\n" ));
   }
 
 
@@ -356,6 +354,8 @@
     FT_UNUSED( face_index );
 
 
+    FT_TRACE2(( "BDF driver\n" ));
+
     if ( FT_STREAM_SEEK( 0 ) )
       goto Exit;
 
@@ -367,7 +367,7 @@
     error = bdf_load_font( stream, memory, &options, &font );
     if ( error == BDF_Err_Missing_Startfont_Field )
     {
-      FT_TRACE2(( "[not a valid BDF file]\n" ));
+      FT_TRACE2(( "  not a BDF file\n" ));
       goto Fail;
     }
     else if ( error )
@@ -379,10 +379,10 @@
       bdf_property_t*  prop = NULL;
 
 
-      FT_TRACE4(( "number of glyphs: %d (%d)\n",
+      FT_TRACE4(( "  number of glyphs: allocated %d (used %d)\n",
                   font->glyphs_size,
                   font->glyphs_used ));
-      FT_TRACE4(( "number of unencoded glyphs: %d (%d)\n",
+      FT_TRACE4(( "  number of unencoded glyphs: allocated %d (used %d)\n",
                   font->unencoded_size,
                   font->unencoded_used ));
 
@@ -482,7 +482,7 @@
         for ( n = 0; n < font->glyphs_size; n++ )
         {
           (face->en_table[n]).enc = cur[n].encoding;
-          FT_TRACE4(( "idx %d, val 0x%lX\n", n, cur[n].encoding ));
+          FT_TRACE4(( "  idx %d, val 0x%lX\n", n, cur[n].encoding ));
           (face->en_table[n]).glyph = (FT_Short)n;
 
           if ( cur[n].encoding == font->default_char )
@@ -490,7 +490,8 @@
             if ( n < FT_UINT_MAX )
               face->default_glyph = (FT_UInt)n;
             else
-              FT_TRACE1(( "idx %d is too large for this system\n", n ));
+              FT_TRACE1(( "BDF_Face_Init:"
+                          " idx %d is too large for this system\n", n ));
           }
         }
       }
@@ -761,8 +762,8 @@
       case BDF_INTEGER:
         if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
         {
-          FT_TRACE1(( "bdf_get_bdf_property: " ));
-          FT_TRACE1(( "too large integer 0x%x is truncated\n" ));
+          FT_TRACE1(( "bdf_get_bdf_property:"
+                      " too large integer 0x%x is truncated\n" ));
         }
         aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
         aproperty->u.integer = (FT_Int32)prop->value.l;
@@ -771,8 +772,8 @@
       case BDF_CARDINAL:
         if ( prop->value.ul > 0xFFFFFFFFUL )
         {
-          FT_TRACE1(( "bdf_get_bdf_property: " ));
-          FT_TRACE1(( "too large cardinal 0x%x is truncated\n" ));
+          FT_TRACE1(( "bdf_get_bdf_property:"
+                      " too large cardinal 0x%x is truncated\n" ));
         }
         aproperty->type       = BDF_PROPERTY_TYPE_CARDINAL;
         aproperty->u.cardinal = (FT_UInt32)prop->value.ul;
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -1458,7 +1458,7 @@
          font->header_size      < 4 ||
          font->absolute_offsize > 4 )
     {
-      FT_TRACE2(( "[not a CFF font header]\n" ));
+      FT_TRACE2(( "  not a CFF font header\n" ));
       error = CFF_Err_Unknown_File_Format;
       goto Exit;
     }
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -505,6 +505,8 @@
     pshinter = (PSHinter_Service)FT_Get_Module_Interface(
                  library, "pshinter" );
 
+    FT_TRACE2(( "CFF driver\n" ));
+
     /* create input stream from resource */
     if ( FT_STREAM_SEEK( 0 ) )
       goto Exit;
@@ -515,7 +517,7 @@
     {
       if ( face->format_tag != TTAG_OTTO )  /* `OTTO'; OpenType/CFF font */
       {
-        FT_TRACE2(( "[not a valid OpenType/CFF font]\n" ));
+        FT_TRACE2(( "  not an OpenType/CFF font\n" ));
         error = CFF_Err_Unknown_File_Format;
         goto Exit;
       }
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -318,6 +318,8 @@
       face->pshinter = pshinter;
     }
 
+    FT_TRACE2(( "CID driver\n" ));
+
     /* open the tokenizer; this will also check the font format */
     if ( FT_STREAM_SEEK( 0 ) )
       goto Exit;
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -73,7 +73,7 @@
     if ( ft_strncmp( (char *)stream->cursor,
                      "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) )
     {
-      FT_TRACE2(( "[not a valid CID-keyed font]\n" ));
+      FT_TRACE2(( "  not a CID-keyed font\n" ));
       error = CID_Err_Unknown_File_Format;
     }
 
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -2,8 +2,7 @@
 
     FreeType font driver for pcf files
 
-    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009,
-                  2010 by
+    Copyright (C) 2000-2004, 2006-2011 by
     Francesco Zappa Nardelli
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -248,8 +247,6 @@
     FT_FREE( face->charset_encoding );
     FT_FREE( face->charset_registry );
 
-    FT_TRACE4(( "PCF_Face_Done: done face\n" ));
-
     /* close compressed stream if any */
     if ( pcfface->stream == &face->comp_stream )
     {
@@ -274,6 +271,8 @@
     FT_UNUSED( face_index );
 
 
+    FT_TRACE2(( "PCF driver\n" ));
+
     error = pcf_load_font( stream, face );
     if ( error )
     {
@@ -405,7 +404,7 @@
     return error;
 
   Fail:
-    FT_TRACE2(( "[not a valid PCF file]\n" ));
+    FT_TRACE2(( "  not a PCF file\n" ));
     PCF_Face_Done( pcfface );
     error = PCF_Err_Unknown_File_Format;  /* error */
     goto Exit;
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType PFR object methods (body).                                  */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 by            */
+/*  Copyright 2002-2008, 2010-2011 by                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -77,6 +77,8 @@
     FT_UNUSED( params );
 
 
+    FT_TRACE2(( "PFR driver\n" ));
+
     /* load the header and check it */
     error = pfr_header_load( &face->header, stream );
     if ( error )
@@ -84,7 +86,7 @@
 
     if ( !pfr_header_check( &face->header ) )
     {
-      FT_TRACE4(( "pfr_face_init: not a valid PFR font\n" ));
+      FT_TRACE2(( "  not a PFR font\n" ));
       error = PFR_Err_Unknown_File_Format;
       goto Exit;
     }
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -376,7 +376,10 @@
          tag != TTAG_true    &&
          tag != TTAG_typ1    &&
          tag != 0x00020000UL )
+    {
+      FT_TRACE2(( "  not a font using the SFNT container format\n" ));
       return SFNT_Err_Unknown_File_Format;
+    }
 
     face->ttc_header.tag = TTAG_ttcf;
 
@@ -462,6 +465,8 @@
     }
 
     FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );
+
+    FT_TRACE2(( "SFNT driver\n" ));
 
     error = sfnt_open_font( stream, face );
     if ( error )
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -493,6 +493,8 @@
     TT_Face       face = (TT_Face)ttface;
 
 
+    FT_TRACE2(( "TTF driver\n" ));
+
     library = ttface->driver->root.library;
 
     sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" );
@@ -519,7 +521,7 @@
          face->format_tag != 0x00020000L &&    /* CJK fonts for Win 3.1 */
          face->format_tag != TTAG_true   )     /* Mac fonts */
     {
-      FT_TRACE2(( "[not a valid TTF font]\n" ));
+      FT_TRACE2(( "  not a TTF font\n" ));
       goto Bad_Format;
     }
 
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -323,6 +323,8 @@
     face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
                                               "pshinter" );
 
+    FT_TRACE2(( "Type 1 driver\n" ));
+
     /* open the tokenizer; this will also check the font format */
     error = T1_Open_Face( face );
     if ( error )
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -164,7 +164,7 @@
       error = check_type1_format( stream, "%!FontType", 10 );
       if ( error )
       {
-        FT_TRACE2(( "[not a Type1 font]\n" ));
+        FT_TRACE2(( "  not a Type 1 font\n" ));
         goto Exit;
       }
     }
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -61,6 +61,8 @@
 
     if ( type1->font_type != 42 )
     {
+      FT_ERROR(( "T42_Open_Face: cannot handle FontType %d\n",
+                 type1->font_type ));
       error = T42_Err_Unknown_File_Format;
       goto Exit;
     }
@@ -185,6 +187,8 @@
       error = T42_Err_Missing_Module;
       goto Exit;
     }
+
+    FT_TRACE2(( "Type 42 driver\n" ));
 
     /* open the tokenizer, this will also check the font format */
     error = T42_Open_Face( face );
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 42 font parser (body).                                          */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by      */
+/*  Copyright 2002-2011 by                                                 */
 /*  Roberto Alameda.                                                       */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -175,7 +175,7 @@
 
     if ( ft_memcmp( stream->cursor, "%!PS-TrueTypeFont", 17 ) != 0 )
     {
-      FT_TRACE2(( "not a Type42 font\n" ));
+      FT_TRACE2(( "  not a Type42 font\n" ));
       error = T42_Err_Unknown_File_Format;
     }
 
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType font driver for Windows FNT/FON files                       */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010 by */
+/*  Copyright 1996-2004, 2006-2011 by                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*  Copyright 2003 Huw D M Davies for Codeweavers                          */
 /*  Copyright 2007 Dmitry Timoshkov for Codeweavers                        */
@@ -224,7 +224,7 @@
     if ( header->version != 0x200 &&
          header->version != 0x300 )
     {
-      FT_TRACE2(( "[not a valid FNT file]\n" ));
+      FT_TRACE2(( "  not a Windows FNT file\n" ));
       error = FNT_Err_Unknown_File_Format;
       goto Exit;
     }
@@ -234,7 +234,7 @@
 
     if ( header->file_size < size )
     {
-      FT_TRACE2(( "[not a valid FNT file]\n" ));
+      FT_TRACE2(( "  not a Windows FNT file\n" ));
       error = FNT_Err_Unknown_File_Format;
       goto Exit;
     }
@@ -695,6 +695,8 @@
     FT_UNUSED( num_params );
     FT_UNUSED( params );
 
+
+    FT_TRACE2(( "Windows FNT driver\n" ));
 
     /* try to load font from a DLL */
     error = fnt_face_get_dll_font( face, face_index );