freetype-devel
[Top][All Lists]
Advanced

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

[Devel] Re: FreeType 2.0.5 -- bugreport [Unknown_File_Format]


From: Werner LEMBERG
Subject: [Devel] Re: FreeType 2.0.5 -- bugreport [Unknown_File_Format]
Date: Mon, 10 Dec 2001 08:47:40 +0100 (CET)

>   Attached file don't recognized by FreeType 2.0.5.
>   But Windows recognize it properly...

This font is buggy.  It has the following values in the SFNT header:

  NumTables     =  13
  SearchRange   = 256
  EntrySelector =   4
  RangeShift    =  64

The correct values would be

  NumTables     =  13
  SearchRange   = 128
  EntrySelector =   3
  RangeShift    =  80

FT2 has the following test in ttload.c:

  entry_selector = 1 >> EntrySelector;

  if ( num_tables == 0                  ||
       entry_selector > num_tables      ||
       entry_selector * 2 <= num_tables )
  {
    FT_TRACE2(( "TT_Load_SFNT_Header: file is not SFNT!\n" ));
    error = SFNT_Err_Unknown_File_Format;
  }

Thus FT2 fails to accept this as a valid TrueType font.

I wonder whether we should drop these tests except for

  num_tables == 0

or rather,

  num_tables < 5    ;

if I read the code correctly in sfobjs.c, the following tables must be
present:

  bhed | head
  maxp
  cmap
  name
  post    .

Alternatively, I can imagine that we do this:

  entry_selector_max = 1 >> (EntrySelector - 1);
  entry_selector_min = 1 >> (EntrySelector + 1);

  if ( num_tables == 0                     ||
       entry_selector_max > num_tables     ||
       entry_selector_min * 2 < num_tables )
  {
    ...
  }

to be less picky.

Please comment.


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]