]> git.wh0rd.org - fontconfig.git/blobdiff - src/ftglue.c
Detect TrueType Collections by checking the font data header
[fontconfig.git] / src / ftglue.c
index 0ad935ef2625a48e00603858869fb4f5bfb02c6f..b337751a975715627bd723053a95ba4670941594 100644 (file)
@@ -245,10 +245,17 @@ ftglue_face_goto_table( FT_Face    face,
    /* parse the directory table directly, without using
     * FreeType's built-in data structures
     */
-    FT_ULong  offset = 0;
+    FT_ULong  offset = 0, sig;
     FT_UInt   count, nn;
 
-    if ( face->num_faces > 1 )
+    if ( FILE_Seek( 0 ) || ACCESS_Frame( 4 ) )
+      goto Exit;
+
+    sig = GET_Tag4();
+
+    FORGET_Frame();
+
+    if ( sig == FT_MAKE_TAG( 't', 't', 'c', 'f' ) )
     {
       /* deal with TrueType collections */
 
@@ -290,7 +297,7 @@ ftglue_face_goto_table( FT_Face    face,
       if ( tag == the_tag )
       {
         LOG(( "TrueType table (start: %ld) (size: %ld)\n", start, size ));
-        error = ftglue_stream_seek( stream, offset+start );
+        error = ftglue_stream_seek( stream, start );
         goto FoundIt;
       }
     }
@@ -307,3 +314,6 @@ Exit:
 }                        
 
 #undef QALLOC
+#define __ftglue__
+#include "fcaliastail.h"
+#undef __ftglue__