* `FT_Open_Face' tries `open_face_PS_from_sfnt_stream' when a sfnt container is found but not OpenType.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
diff --git a/ChangeLog b/ChangeLog
index b0a1254..34a7c62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-10-05 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
+ * src/sfnt/sfobjs.c (sfnt_open_font): Allow 'typ1' version
+ tag in the beginning of sfnt container.
+ * src/sfnt/ttload.c (check_table_dir): Return
+ `SFNT_Err_Table_Missing' when sfnt table directory structure
+ is correct but essential tables for TrueType fonts (`head',
+ `bhed' or `SING') are missing. Other errors are returned
+ by SFNT_Err_Unknown_File_Format.
+
+ * src/base/ftobjs.c (FT_Open_Face): When TrueType driver returns
+ `FT_Err_Table_Missing', try `open_face_PS_from_sfnt_stream'.
+ It is enabled only when old mac font support is configured.
+
2008-10-04 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
* include/freetype/tttags.h: Add TTAG_CID, TTAG_FOND, TTAG_LWFN,
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 5ae3b2b..fa5f5c8 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1951,6 +1951,28 @@
if ( !error )
goto Success;
+#ifdef FT_CONFIG_OPTION_MAC_FONTS
+ if ( ft_strcmp( cur[0]->clazz->module_name, "truetype" ) == 0 &&
+ FT_ERROR_BASE( error ) == FT_Err_Table_Missing )
+ {
+ /* TrueType but essential tables are missing */
+ if ( FT_Stream_Seek( stream, 0 ) )
+ break;
+
+ error = open_face_PS_from_sfnt_stream( library,
+ stream,
+ face_index,
+ num_params,
+ params,
+ aface );
+ if ( !error )
+ {
+ FT_Stream_Free( stream, external_stream );
+ return error;
+ }
+ }
+#endif
+
if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format )
goto Fail3;
}
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 0d44638..4f074d3 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -367,6 +367,7 @@
tag != TTAG_ttcf &&
tag != TTAG_OTTO &&
tag != TTAG_true &&
+ tag != TTAG_typ1 &&
tag != 0x00020000UL )
return SFNT_Err_Unknown_File_Format;
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 126cbef..aa14e94 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -141,6 +141,13 @@
/* - look for a `head' table, check its size, and parse it to check */
/* whether its `magic' field is correctly set */
/* */
+ /* - errors (except of errors returned by stream handling) */
+ /* */
+ /* SFNT_Err_Unknown_File_Format: no table is defined in directory, */
+ /* it's not sfnt-wrapped data. */
+ /* SFNT_Err_Table_Missing: table directory is valid, but essential */
+ /* tables (head/bhed/SING) are missing. */
+ /* */
static FT_Error
check_table_dir( SFNT_Header sfnt,
FT_Stream stream )
@@ -213,7 +220,7 @@
if ( table.Length < 0x36 )
{
FT_TRACE2(( "check_table_dir: `head' table too small\n" ));
- error = SFNT_Err_Unknown_File_Format;
+ error = SFNT_Err_Table_Missing;
goto Exit;
}
@@ -225,7 +232,7 @@
{
FT_TRACE2(( "check_table_dir:"
" no magic number found in `head' table\n"));
- error = SFNT_Err_Unknown_File_Format;
+ error = SFNT_Err_Table_Missing;
goto Exit;
}
@@ -261,7 +268,7 @@
#else
FT_TRACE2(( " neither `head' nor `sing' table found\n" ));
#endif
- error = SFNT_Err_Unknown_File_Format;
+ error = SFNT_Err_Table_Missing;
}
Exit:
@@ -341,7 +348,7 @@
error = check_table_dir( &sfnt, stream );
if ( error )
{
- FT_TRACE2(( "tt_face_load_font_dir: invalid table directory!\n" ));
+ FT_TRACE2(( "tt_face_load_font_dir: invalid table directory for TrueType!\n" ));
goto Exit;
}