Re: Font Problems



At 05:47 AM 8/24/2002, Owen Taylor wrote:
We should most likely accept "well formed but useless" tables. Can
you provide your patch so I can take a look at it?

                                        Owen

Here is the patch. It contains some extra debugging statements, and has the old code partly #if 0'd out... The basic idea is that it will only fail if there are no valid scripts in the file.

Regards,
Eric

Index: ftxopen.c
===================================================================
RCS file: /cvs/gnome/pango/pango/opentype/ftxopen.c,v
retrieving revision 1.6
diff -u -p -r1.6 ftxopen.c
--- ftxopen.c   7 Aug 2002 17:01:52 -0000       1.6
+++ ftxopen.c   26 Aug 2002 23:04:14 -0000
@@ -130,6 +130,11 @@

     if ( s->LangSysCount == 0 && s->DefaultLangSys.FeatureCount == 0 )
     {
+#if 0
+      printf("s->LangSysCount == %d, s->defaultLangSys.FeatureCount == %d\n",
+            s->LangSysCount, s->DefaultLangSys.FeatureCount);
+#endif
+
       error = TTO_Err_Invalid_SubTable;
       goto Fail2;
     }
@@ -205,7 +210,7 @@
     FT_Error   error;
     FT_Memory  memory = stream->memory;

-    FT_UShort          n, m, count;
+    FT_UShort          n, m, o, count;
     FT_ULong           cur_offset, new_offset, base_offset;

     TTO_ScriptRecord*  sr;
@@ -227,27 +232,40 @@

     sr = sl->ScriptRecord;

+    o = 0;
     for ( n = 0; n < count; n++ )
     {
       if ( ACCESS_Frame( 6L ) )
         goto Fail;

-      sr[n].ScriptTag = GET_ULong();
+      sr[o].ScriptTag = GET_ULong();
       new_offset = GET_UShort() + base_offset;

       FORGET_Frame();

       cur_offset = FILE_Pos();
+#if 0
       if ( FILE_Seek( new_offset ) ||
            ( error = Load_Script( &sr[n].Script, stream ) ) != TT_Err_Ok )
         goto Fail;
+#else
+      if ( FILE_Seek( new_offset ) )
+       goto Fail;
+
+      if ( ( error = Load_Script( &sr[o].Script, stream ) ) == TT_Err_Ok )
+       o += 1;
+#endif
+
       (void)FILE_Seek( cur_offset );
     }

-    return TT_Err_Ok;
+    if ( o != 0 )
+      return TT_Err_Ok;
+
+    error = TTO_Err_Invalid_SubTable;

   Fail:
-    for ( m = 0; m < n; m++ )
+    for ( m = 0; m < o; m++ )
       Free_Script( &sr[m].Script, memory );

     FREE( sl->ScriptRecord );




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]