freetype-devel
[Top][All Lists]
Advanced

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

[Devel] RE: FreeType 2.0.9 could not read the HKSCS-2001 MING_UNI.TTF fo


From: Yao Zhang
Subject: [Devel] RE: FreeType 2.0.9 could not read the HKSCS-2001 MING_UNI.TTF font
Date: Wed, 29 May 2002 21:18:51 -0400 (EDT)

George Williams wrote:

> According to my showttf
>          The file checksum is incorrect
>          The table checksums are incorrect for
>                  glyf
>                  hmtx
>                  loca
>                  maxp
> (I don't know if those cause problems for freetype)

The problem is actually at the beginning.  In MING_UNI_TTF's Offset
Subtable, numTables is 13 and entrySelector is 4 which is wrong. The
correct entrySelector should be 3.  In freetype2/src/sfnt/ttload.c,

    /* now, check the values of `num_tables', `seach_range', etc. */
    {
      FT_UInt   num_tables     = sfnt->num_tables;
      FT_ULong  entry_selector = 1L << sfnt->entry_selector;


      /* IMPORTANT: Many fonts have an incorrect `search_range' value, so */
      /*            we only check the `entry_selector' correctness here.  */
      /*                                                                  */
      if ( num_tables == 0                  ||
           entry_selector > num_tables      ||
           entry_selector * 2 <= num_tables )
      {
        FT_TRACE2(( "TT_Load_SFNT_HeaderRec: file is not SFNT!\n" ));
        error = SFNT_Err_Unknown_File_Format;
      }
    }

with the wrong entrySelector value 4, entry_selector is 16 and num_tables is
13.  The font cannot be loaded because
           entry_selector > num_tables

I corrected the font with my oTo utility:

    oto MING_UNI.TTF ming_uni.ttf

The new ming_uni.ttf works fine.  I don't know if I can upload the new
ming_uni.ttf to my website since I have no idea about its license.

Regards,

Yao Zhang



reply via email to

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