* src/pcf/pcfread.c (pcf_read_TOC, pcf_get_properties,

pcf_get_metrics, pcf_get_bitmaps, pcf_get_encodings): Improve
debugging messages.

* src/pcf/pcfdrivr.c (FT_COMPOMENT): Move up.
(PCF_Face_Init): Simplify code.
This commit is contained in:
Werner Lemberg 2004-06-22 06:24:09 +00:00
parent 51cda9c81c
commit 46f4c1781e
3 changed files with 67 additions and 38 deletions

View File

@ -1,3 +1,12 @@
2004-06-22 Werner Lemberg <wl@gnu.org>
* src/pcf/pcfread.c (pcf_read_TOC, pcf_get_properties,
pcf_get_metrics, pcf_get_bitmaps, pcf_get_encodings): Improve
debugging messages.
* src/pcf/pcfdrivr.c (FT_COMPOMENT): Move up.
(PCF_Face_Init): Simplify code.
2004-06-21 Werner Lemberg <wl@gnu.org>
* docs/CHANGES: Updated.

View File

@ -49,6 +49,16 @@ THE SOFTWARE.
#include FT_SERVICE_XFREE86_NAME_H
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_pcfdriver
typedef struct PCF_CMapRec_
{
FT_CMapRec root;
@ -170,9 +180,10 @@ THE SOFTWARE.
}
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec pcf_cmap_class =
FT_CALLBACK_TABLE_DEF
const FT_CMap_ClassRec pcf_cmap_class =
{
sizeof( PCF_CMapRec ),
sizeof ( PCF_CMapRec ),
pcf_cmap_init,
pcf_cmap_done,
pcf_cmap_char_index,
@ -180,16 +191,6 @@ THE SOFTWARE.
};
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_pcfdriver
FT_CALLBACK_DEF( void )
PCF_Face_Done( FT_Face pcfface ) /* PCF_Face */
{
@ -298,19 +299,16 @@ THE SOFTWARE.
}
}
/* set-up charmap */
/* set up charmap */
{
FT_String *charset_registry, *charset_encoding;
FT_String *charset_registry = face->charset_registry;
FT_String *charset_encoding = face->charset_encoding;
FT_Bool unicode_charmap = 0;
charset_registry = face->charset_registry;
charset_encoding = face->charset_encoding;
if ( ( charset_registry != NULL ) &&
( charset_encoding != NULL ) )
if ( charset_registry && charset_encoding )
{
char* s = face->charset_registry;
char* s = charset_registry;
/* Uh, oh, compare first letters manually to avoid dependency

View File

@ -122,7 +122,10 @@ THE SOFTWARE.
const char* name = "?";
FT_TRACE4(( "Tables count: %ld\n", face->toc.count ));
FT_TRACE4(( "pcf_read_TOC:\n" ));
FT_TRACE4(( " number of tables: %ld\n", face->toc.count ));
tables = face->toc.tables;
for ( i = 0; i < toc->count; i++ )
{
@ -130,12 +133,12 @@ THE SOFTWARE.
if ( tables[i].type == (FT_UInt)( 1 << j ) )
name = tableNames[j];
FT_TRACE4(( "Table %d: type=%-6s format=0x%04lX "
"size=0x%06lX (%8ld) offset=0x%04lX\n",
FT_TRACE4(( " %d: type=%s, format=0x%X, "
"size=%ld (0x%lX), offset=%ld (0x%lX)\n",
i, name,
tables[i].format,
tables[i].size, tables[i].size,
tables[i].offset ));
tables[i].offset, tables[i].offset ));
}
}
@ -370,7 +373,9 @@ THE SOFTWARE.
if ( FT_READ_ULONG_LE( format ) )
goto Bail;
FT_TRACE4(( "get_prop: format = %ld\n", format ));
FT_TRACE4(( "pcf_get_properties:\n" ));
FT_TRACE4(( " format = %ld\n", format ));
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
goto Bail;
@ -382,7 +387,7 @@ THE SOFTWARE.
if ( error )
goto Bail;
FT_TRACE4(( "get_prop: nprop = %d\n", nprops ));
FT_TRACE4(( " nprop = %d\n", nprops ));
if ( FT_NEW_ARRAY( props, nprops ) )
goto Bail;
@ -419,7 +424,7 @@ THE SOFTWARE.
if ( error )
goto Bail;
FT_TRACE4(( "get_prop: string_size = %ld\n", string_size ));
FT_TRACE4(( " string_size = %ld\n", string_size ));
if ( FT_NEW_ARRAY( strings, string_size ) )
goto Bail;
@ -437,7 +442,9 @@ THE SOFTWARE.
if ( FT_NEW_ARRAY( properties[i].name,
ft_strlen( strings + props[i].name ) + 1 ) )
goto Bail;
ft_strcpy( properties[i].name,strings + props[i].name );
ft_strcpy( properties[i].name, strings + props[i].name );
FT_TRACE4(( " %s:", properties[i].name ));
properties[i].isString = props[i].isString;
@ -447,9 +454,15 @@ THE SOFTWARE.
ft_strlen( strings + props[i].value ) + 1 ) )
goto Bail;
ft_strcpy( properties[i].value.atom, strings + props[i].value );
FT_TRACE4(( " `%s'\n", properties[i].value.atom ));
}
else
{
properties[i].value.integer = props[i].value;
FT_TRACE4(( " %d\n", properties[i].value.integer ));
}
}
face->properties = properties;
@ -518,6 +531,8 @@ THE SOFTWARE.
if ( FT_NEW_ARRAY( face->metrics, nmetrics ) )
return PCF_Err_Out_Of_Memory;
FT_TRACE4(( "pcf_get_metrics:\n" ));
metrics = face->metrics;
for ( i = 0; i < nmetrics; i++ )
{
@ -525,7 +540,7 @@ THE SOFTWARE.
metrics[i].bits = 0;
FT_TRACE4(( "%d : width=%d, "
FT_TRACE4(( " idx %d: width=%d, "
"lsb=%d, rsb=%d, ascent=%d, descent=%d, swidth=%d\n",
i,
( metrics + i )->characterWidth,
@ -588,6 +603,8 @@ THE SOFTWARE.
if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
return error;
FT_TRACE4(( "pcf_get_bitmaps:\n" ));
for ( i = 0; i < nbitmaps; i++ )
{
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
@ -595,7 +612,8 @@ THE SOFTWARE.
else
(void)FT_READ_LONG_LE( offsets[i] );
FT_TRACE4(( "bitmap %d is at offset %ld\n", i, offsets[i] ));
FT_TRACE4(( " bitmap %d: offset %ld (0x%lX)\n",
i, offsets[i], offsets[i] ));
}
if ( error )
goto Bail;
@ -611,13 +629,13 @@ THE SOFTWARE.
sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];
FT_TRACE4(( "padding %d implies a size of %ld\n", i, bitmapSizes[i] ));
FT_TRACE4(( " padding %d implies a size of %ld\n", i, bitmapSizes[i] ));
}
FT_TRACE4(( " %d bitmaps, padding index %ld\n",
nbitmaps,
PCF_GLYPH_PAD_INDEX( format ) ));
FT_TRACE4(( "bitmap size = %d\n", sizebitmaps ));
FT_TRACE4(( " bitmap size = %d\n", sizebitmaps ));
FT_UNUSED( sizebitmaps ); /* only used for debugging */
@ -640,8 +658,8 @@ THE SOFTWARE.
pcf_get_encodings( FT_Stream stream,
PCF_Face face )
{
FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory;
FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory;
FT_ULong format, size;
int firstCol, lastCol;
int firstRow, lastRow;
@ -687,7 +705,9 @@ THE SOFTWARE.
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
return PCF_Err_Invalid_File_Format;
FT_TRACE4(( "enc: firstCol %d, lastCol %d, firstRow %d, lastRow %d\n",
FT_TRACE4(( "pdf_get_encodings:\n" ));
FT_TRACE4(( " firstCol %d, lastCol %d, firstRow %d, lastRow %d\n",
firstCol, lastCol, firstRow, lastRow ));
nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 );
@ -714,11 +734,13 @@ THE SOFTWARE.
firstCol );
tmpEncoding[j].glyph = (FT_Short)encodingOffset;
FT_TRACE4(( " code %d (0x%04X): idx %d\n",
tmpEncoding[j].enc, tmpEncoding[j].enc,
tmpEncoding[j].glyph ));
j++;
}
FT_TRACE4(( "enc n. %d ; Uni %ld ; Glyph %d\n",
i, tmpEncoding[j - 1].enc, encodingOffset ));
}
FT_Stream_ExitFrame( stream );