From 3b047380aec4ccc707c4579327d54172c19820fd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 18 Nov 2007 22:34:08 +0000 Subject: [PATCH] Minor --- src/harfbuzz-dump-main.c | 4 +- src/harfbuzz-stream.c | 101 +++++++++++++++++++-------------------- 2 files changed, 52 insertions(+), 53 deletions(-) diff --git a/src/harfbuzz-dump-main.c b/src/harfbuzz-dump-main.c index 7e1b5a4a4..d19d6ea95 100644 --- a/src/harfbuzz-dump-main.c +++ b/src/harfbuzz-dump-main.c @@ -200,7 +200,7 @@ main (int argc, char **argv) croak ("HB_Done_GSUB_Table", error); } else if (error != HB_Err_Not_Covered) - fprintf (stderr, "HB_Load_GSUB_Table %x\n", error); + fprintf (stderr, "HB_Load_GSUB_Table: error 0x%x\n", error); if (!(error = HB_Load_GPOS_Table (font, &gpos, NULL))) { @@ -210,7 +210,7 @@ main (int argc, char **argv) croak ("HB_Done_GPOS_Table", error); } else if (error != HB_Err_Not_Covered) - fprintf (stderr, "HB_Load_GPOS_Table %x\n", error); + fprintf (stderr, "HB_Load_GPOS_Table: error 0x%x\n", error); printf ("\n"); diff --git a/src/harfbuzz-stream.c b/src/harfbuzz-stream.c index 75e4d34ea..29d280ae5 100644 --- a/src/harfbuzz-stream.c +++ b/src/harfbuzz-stream.c @@ -164,66 +164,65 @@ _hb_font_goto_table( HB_Font font, { LOG(( "not a SFNT font !!\n" )); error = ERR(HB_Err_Invalid_Argument); + goto Exit; } - else + + /* parse the directory table directly, without using + * FreeType's built-in data structures + */ + HB_UInt offset = 0; + HB_UInt count, nn; + + if ( font->num_faces > 1 ) { - /* parse the directory table directly, without using - * FreeType's built-in data structures - */ - HB_UInt offset = 0; - HB_UInt count, nn; + /* deal with TrueType collections */ + LOG(( ">> This is a TrueType Collection\n" )); - if ( font->num_faces > 1 ) - { - /* deal with TrueType collections */ - LOG(( ">> This is a TrueType Collection\n" )); - - if ( FILE_Seek( 12 + font->face_index*4 ) || - ACCESS_Frame( 4 ) ) - goto Exit; - - offset = GET_ULong(); - - FORGET_Frame(); - } - - LOG(( "TrueType offset = %ld\n", offset )); - - if ( FILE_Seek( offset+4 ) || - ACCESS_Frame( 2 ) ) + if ( FILE_Seek( 12 + font->face_index*4 ) || + ACCESS_Frame( 4 ) ) goto Exit; - count = GET_UShort(); + offset = GET_ULong(); FORGET_Frame(); - - if ( FILE_Seek( offset+12 ) || - ACCESS_Frame( count*16 ) ) - goto Exit; - - for ( nn = 0; nn < count; nn++ ) - { - HB_UInt tag = GET_ULong(); - HB_UInt checksum = GET_ULong(); - HB_UInt start = GET_ULong(); - HB_UInt size = GET_ULong(); - - HB_UNUSED(checksum); - HB_UNUSED(size); - - if ( tag == the_tag ) - { - LOG(( "TrueType table (start: %ld) (size: %ld)\n", start, size )); - error = _hb_stream_seek( stream, start ); - goto FoundIt; - } - } - error = HB_Err_Not_Covered; - - FoundIt: - FORGET_Frame(); } + LOG(( "TrueType offset = %ld\n", offset )); + + if ( FILE_Seek( offset+4 ) || + ACCESS_Frame( 2 ) ) + goto Exit; + + count = GET_UShort(); + + FORGET_Frame(); + + if ( FILE_Seek( offset+12 ) || + ACCESS_Frame( count*16 ) ) + goto Exit; + + for ( nn = 0; nn < count; nn++ ) + { + HB_UInt tag = GET_ULong(); + HB_UInt checksum = GET_ULong(); + HB_UInt start = GET_ULong(); + HB_UInt size = GET_ULong(); + + HB_UNUSED(checksum); + HB_UNUSED(size); + + if ( tag == the_tag ) + { + LOG(( "TrueType table (start: %ld) (size: %ld)\n", start, size )); + error = _hb_stream_seek( stream, start ); + goto FoundIt; + } + } + error = HB_Err_Not_Covered; + +FoundIt: + FORGET_Frame(); + Exit: LOG(( "TrueType error=%d\n", error ));