freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] sfnt-housed fonts on MacOS missing "hhea" table


From: mpsuzuki
Subject: [ft-devel] sfnt-housed fonts on MacOS missing "hhea" table
Date: Wed, 13 Jul 2005 13:26:48 +0900

Dear Sirs,

It seems that FreeType2 cannot load some bitmap-only fonts on MacOS X
(possibly on Classic MacOS too), because such fonts have no "hhea"
tables in its sfnt resource. I wrote small patch to bypass the problem
(attached to the end of this mail), but I'm not sure about FT2 requirement
of data in "hhea" and afraid unexpected subeffect. I hope I could
receive some comments.

--

As example, "/Library/Fonts/Osaka Bold", "/Library/Fonts/Osaka Narrow"
(both resource fork font, data fork is zero-sized) of MacOS X 10.2 and
later contains following subtables in its sfnt resource:

tt_face_load_sfnt_header: 0x80bcb10, 0
tt_face_load_directory: 0x80bcb10
-- Tables count:              9
-- Format version: 74727565
FT_QAlloc: size = 144, block = 0x0x80bce18, ref = 0x0x80bcbac
  bdat  -  0000009c  -  00048600
  bloc  -  0004869c  -  00000ae8
  cmap  -  00049184  -  0000bca6
  feat  -  00054e2c  -  0000003c
  head  -  00054e68  -  00000036
  maxp  -  00054ea0  -  00000020
  mort  -  00054ec0  -  0000587c
  name  -  0005e0b8  -  000002aa
  post  -  0005a73c  -  0000397a

You can see, there's no "hhea" subtable.
As a result, ttload.c::tt_face_load_metrics_header() returns
SFNT_Err_Horiz_Header_Missing. But, nothing to say, MacOS X
can handle such fonts.

According to the TrueType font specification by Microsoft, 
"hhea" is noted as essential table. But, Apple's specification
has strange notes.

http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html
--------------------------------------------------------------
Mac OS-specific information

Although it is officially listed as a "required" TrueType table,
the 'hhea' table is not in fact required for all sfnt-housed fonts
on the Mac OS.

Non-TrueType fonts housed in an sfnt data structure may not have
a 'hhea' table. This is allowed by the OFA2 architecture.
--------------------------------------------------------------

>From this note, I think as "if the font comes from MacOS platform,
FT2 had better stand against the lack of hhea subtable". So, I
propose a hook to detect "comes from MacOS platform" and softening
the error, aslike:

--- freetype2/src/sfnt/ttload.c
+++ freetype2/src/sfnt/ttload.c
@@ -1098,6 +1098,11 @@
       if ( error )
       {
         error = SFNT_Err_Horiz_Header_Missing;
+        if ( face->format_tag == TTAG_true )
+        {
+          FT_TRACE2(( "no hhea table, but font is sfnt-housed, ignore this 
error\n" ));
+          error = SFNT_Err_Ok;
+        }
         goto Exit;
       }

As far as I know, TTAG_true is not used on non-MacOS platform.

If the infos provided by "hhea" is not essential in FT2, I wish such
hook is included in FT2.

Regards,
mpsuzuki





reply via email to

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