/[freetype]/freetype2/src/sfnt/ttload.c
ViewVC logotype

Diff of /freetype2/src/sfnt/ttload.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.120 by olvaffe, Sun Nov 20 08:24:24 2005 UTC revision 1.121 by olvaffe, Mon Nov 21 03:04:03 2005 UTC
# Line 134  Line 134 
134    }    }
135    
136    
137    /* In theory, we should check the values of `search_range',              */    /* Here, we:                                                             */
   /* `entry_selector', and `range_shift' to detect non-SFNT based files    */  
   /* whose header might also start with 0x100000L (yes, these exist).      */  
   /*                                                                       */  
   /* Very unfortunately, many TrueType fonts don't have these fields       */  
   /* set correctly and we must ignore them to support them.  An            */  
   /* alternative way to check the font file is thus to:                    */  
138    /*                                                                       */    /*                                                                       */
139    /* - check that `num_tables' is valid                                    */    /* - check that `num_tables' is valid                                    */
140    /* - look for a "head" table, check its size, and parse it to            */    /* - look for a "head" table, check its size, and parse it to            */
# Line 381  Line 375 
375           FT_STREAM_READ_FIELDS( sfnt_header_fields, sfnt ) )           FT_STREAM_READ_FIELDS( sfnt_header_fields, sfnt ) )
376        return error;        return error;
377    
378      /* now check the sfnt directory */      /* many fonts don't have these fields set correctly */
379      error = sfnt_dir_check( sfnt, stream );  #if 0
380      if ( error )      if ( sfnt->search_range != 1 << ( sfnt->entry_selector + 4 ) ||
381        FT_TRACE2(( "tt_face_load_sfnt_header: invalid SFNT!\n" ));           sfnt->search_range + sfnt->range_shift != sfnt->num_tables << 4 )
382          return SFNT_Err_Unknown_File_Format;
383    #endif
384    
385      return error;      return error;
386    }    }
# Line 428  Line 424 
424      FT_TRACE2(( "-- Tables count:   %12u\n",  sfnt->num_tables ));      FT_TRACE2(( "-- Tables count:   %12u\n",  sfnt->num_tables ));
425      FT_TRACE2(( "-- Format version: %08lx\n", sfnt->format_tag ));      FT_TRACE2(( "-- Format version: %08lx\n", sfnt->format_tag ));
426    
427        /* check first */
428        error = sfnt_dir_check( sfnt, stream );
429        if ( error ) {
430          FT_TRACE2(( "tt_face_load_directory: directory checking failed!\n" ));
431    
432          return error;
433        }
434    
435      face->num_tables = sfnt->num_tables;      face->num_tables = sfnt->num_tables;
436    
437      if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )      if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )

Legend:
Removed from v.1.120  
changed lines
  Added in v.1.121

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26