Commit bdb10748a79e13ba1ae88571ddafac71fdbde4c7

Werner Lemberg 2002-07-27T22:51:28

* src/sfnt/ttload.c (sfnt_dir_check): Make it work with TTCs.

diff --git a/ChangeLog b/ChangeLog
index 51558fa..6d9ee13 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2002-07-27  Werner Lemberg  <wl@gnu.org>
+
+	* src/sfnt/ttload.c (sfnt_dir_check): Make it work with TTCs.
+
 2002-07-26  Werner Lemberg  <wl@gnu.org>
 
 	* src/truetype/ttgload.c (load_truetype_glyph)
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index f73c4d0..b189b54 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -159,8 +159,8 @@
     FT_Error        error;
     FT_UInt         nn, has_head = 0;
 
-	const FT_ULong  glyx_tag = FT_MAKE_TAG('g','l','y','x');
-	const FT_ULong  locx_tag = FT_MAKE_TAG('l','o','c','x');
+    const FT_ULong  glyx_tag = FT_MAKE_TAG('g','l','y','x');
+    const FT_ULong  locx_tag = FT_MAKE_TAG('l','o','c','x');
 
     static const FT_Frame_Field  sfnt_dir_entry_fields[] =
     {
@@ -202,8 +202,8 @@
       if ( FT_STREAM_READ_FIELDS( sfnt_dir_entry_fields, &table ) )
         goto Bad_Format;
 
-      if ( offset + table.Offset + table.Length > stream->size &&
-		   table.Tag != glyx_tag && table.Tag != locx_tag      )
+      if ( table.Offset + table.Length > stream->size     &&
+           table.Tag != glyx_tag && table.Tag != locx_tag )
         goto Bad_Format;
 
       if ( table.Tag == TTAG_head )
@@ -213,10 +213,10 @@
 
         has_head = 1;
 
-        if ( table.Length != 0x36                         ||
-             FT_STREAM_SEEK( offset + table.Offset + 12 ) ||
-             FT_READ_ULONG( magic )                       ||
-             magic != 0x5F0F3CF5U                         )
+        if ( table.Length != 0x36                ||
+             FT_STREAM_SEEK( table.Offset + 12 ) ||
+             FT_READ_ULONG( magic )              ||
+             magic != 0x5F0F3CF5U                )
           goto Bad_Format;
 
         if ( FT_STREAM_SEEK( offset + 28 + 16*nn ) )
@@ -349,7 +349,7 @@
       }
 
       /* seek to the appropriate TrueType file, then read tag */
-      offset = face->ttc_header.offsets[ face_index ];
+      offset = face->ttc_header.offsets[face_index];
 
       if ( FT_STREAM_SEEK( offset ) ||
            FT_READ_LONG( format_tag )                             )