Commit 70cf8c5e6d249523ed474e548b4c9e1d226c77df

Werner Lemberg 2011-11-26T20:09:39

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
diff --git a/ChangeLog b/ChangeLog
index e051317..a1c2fd5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2011-11-26  Werner Lemberg  <wl@gnu.org>
 
+	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  <wl@gnu.org>
+
 	[cid] Fix error code.
 
 	* src/cid/cidparse.c (cid_parser_new): Do it.
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index 47d0eae..a7064e1 100644
--- 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 @@ THE SOFTWARE.
     FT_FREE( bdfface->available_sizes );
 
     FT_FREE( face->bdffont );
-
-    FT_TRACE4(( "BDF_Face_Done: done face\n" ));
   }
 
 
@@ -356,6 +354,8 @@ THE SOFTWARE.
     FT_UNUSED( face_index );
 
 
+    FT_TRACE2(( "BDF driver\n" ));
+
     if ( FT_STREAM_SEEK( 0 ) )
       goto Exit;
 
@@ -367,7 +367,7 @@ THE SOFTWARE.
     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 @@ THE SOFTWARE.
       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 @@ THE SOFTWARE.
         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 @@ THE SOFTWARE.
             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 @@ THE SOFTWARE.
       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 @@ THE SOFTWARE.
       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;
diff --git a/src/cff/cffload.c b/src/cff/cffload.c
index d1dacbf..2be6ba0 100644
--- 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;
     }
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index feb5845..ea12c95 100644
--- 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;
       }
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 17c851f..cc2a200 100644
--- 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;
diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c
index db19028..4d21160 100644
--- 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;
     }
 
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index af2a2d9..adda087 100644
--- 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 @@ THE SOFTWARE.
     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 @@ THE SOFTWARE.
     FT_UNUSED( face_index );
 
 
+    FT_TRACE2(( "PCF driver\n" ));
+
     error = pcf_load_font( stream, face );
     if ( error )
     {
@@ -405,7 +404,7 @@ THE SOFTWARE.
     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;
diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c
index 3e5e86e..07ad226 100644
--- 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;
     }
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index c86c34e..d7be631 100644
--- 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;
 
@@ -463,6 +466,8 @@
 
     FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS );
 
+    FT_TRACE2(( "SFNT driver\n" ));
+
     error = sfnt_open_font( stream, face );
     if ( error )
       return error;
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index f36b46f..fc67072 100644
--- 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;
     }
 
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 5c8a7bc..2b25c25 100644
--- 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 )
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index 2a76227..23d6f36 100644
--- 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;
       }
     }
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index 7cf8801..f146c34 100644
--- 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;
     }
@@ -186,6 +188,8 @@
       goto Exit;
     }
 
+    FT_TRACE2(( "Type 42 driver\n" ));
+
     /* open the tokenizer, this will also check the font format */
     error = T42_Open_Face( face );
     if ( error )
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index 5774269..976aa22 100644
--- 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;
     }
 
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index ee17d16..2b17523 100644
--- 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;
     }
@@ -696,6 +696,8 @@
     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 );
     if ( !error && face_index < 0 )