* src/sfnt/ttload.c (sfnt_init): Add tracing message.
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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
diff --git a/ChangeLog b/ChangeLog
index d36046e..32ff89e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
+2005-11-21 Werner Lemberg <wl@gnu.org>
+
+ * src/sfnt/ttload.c (sfnt_init): Add tracing message.
+
2005-11-21 Chia-I Wu <b90201047@ntu.edu.tw>
- * src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): image_offset is
- added to image_start twice when image_format is 2 or 5.
+ * src/sfnt/ttsbit0.c (tt_sbit_decoder_load_image): Image_offset was
+ added twice to image_start when image_format is 2 or 5.
2005-11-21 Chia-I Wu <b90201047@ntu.edu.tw>
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 4fa6d71..d65b69c 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -376,11 +376,11 @@
if ( error )
goto Exit;
- if ( sfnt_header.format_tag != 0x00010000UL &&
- sfnt_header.format_tag != TTAG_ttcf &&
+ if ( sfnt_header.format_tag != 0x00010000UL &&
+ sfnt_header.format_tag != TTAG_ttcf &&
sfnt_header.format_tag != FT_MAKE_TAG( 'O', 'T', 'T', 'O' ) &&
- sfnt_header.format_tag != TTAG_true &&
- sfnt_header.format_tag != 0x00020000UL )
+ sfnt_header.format_tag != TTAG_true &&
+ sfnt_header.format_tag != 0x00020000UL )
return SFNT_Err_Unknown_File_Format;
face->format_tag = sfnt_header.format_tag;
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 77acfc2..67c5048 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -134,15 +134,15 @@
}
- /* Here, we: */
+ /* Here, we */
/* */
/* - check that `num_tables' is valid */
- /* - look for a "head" table, check its size, and parse it to */
- /* see if its "magic" field is correctly set */
+ /* - look for a `head' table, check its size, and parse it to check */
+ /* whether its `magic' field is correctly set */
/* */
/* When checking directory entries, ignore the tables `glyx' and `locx' */
/* which are hacked-out versions of `glyf' and `loca' in some PostScript */
- /* Type 42 fonts, and will generally be invalid. */
+ /* Type 42 fonts, and which are generally invalid. */
/* */
static FT_Error
sfnt_dir_check( SFNT_Header sfnt,
@@ -170,7 +170,7 @@
};
- if ( sfnt->num_tables == 0 ||
+ if ( sfnt->num_tables == 0 ||
offset + sfnt->num_tables * 16 > stream->size )
return SFNT_Err_Unknown_File_Format;
@@ -185,8 +185,9 @@
if ( FT_STREAM_READ_FIELDS( sfnt_dir_entry_fields, &table ) )
return error;
- if ( table.Offset + table.Length > stream->size &&
- table.Tag != glyx_tag && table.Tag != locx_tag )
+ if ( table.Offset + table.Length > stream->size &&
+ table.Tag != glyx_tag &&
+ table.Tag != locx_tag )
return SFNT_Err_Unknown_File_Format;
if ( table.Tag == TTAG_head || table.Tag == TTAG_bhed )
@@ -198,18 +199,20 @@
#endif
has_head = 1;
- /* The table length should be 0x36, but certain font tools
- * make it 0x38, so we will just check that it is greater.
+ /*
+ * The table length should be 0x36, but certain font tools make it
+ * 0x38, so we will just check that it is greater.
+ *
+ * Note that according to the specification, the table must be
+ * padded to 32-bit lengths, but this doesn't apply to the value of
+ * its `Length' field!
*
- * Note that according to the specification,
- * the table must be padded to 32-bit lengths, but this doesn't
- * apply to the value of its "Length" field!
*/
if ( table.Length < 0x36 )
return SFNT_Err_Unknown_File_Format;
if ( FT_STREAM_SEEK( table.Offset + 12 ) ||
- FT_READ_ULONG( magic ) )
+ FT_READ_ULONG( magic ) )
return error;
if ( magic != 0x5F0F3CF5UL )
@@ -224,6 +227,7 @@
has_meta = 1;
}
+ /* if `sing' and `meta' tables are present, there is no `head' table */
if ( has_head || ( has_sing && has_meta ) )
return SFNT_Err_Ok;
else
@@ -231,8 +235,8 @@
}
- /* Fill in face->ttc_header. If the font is not a TTC, it is */
- /* synthesized into a TTC with one offset table. */
+ /* Fill in face->ttc_header. If the font is not a TTC, it is */
+ /* synthesized into a TTC with one offset table. */
static FT_Error
sfnt_init( FT_Stream stream,
TT_Face face )
@@ -252,9 +256,10 @@
FT_FRAME_END
};
- face->ttc_header.tag = 0;
+
+ face->ttc_header.tag = 0;
face->ttc_header.version = 0;
- face->ttc_header.count = 0;
+ face->ttc_header.count = 0;
offset = FT_STREAM_POS();
@@ -287,8 +292,10 @@
}
else
{
+ FT_TRACE3(( "sfnt_init: synthesize TTC\n" ));
+
face->ttc_header.version = 1 << 16;
- face->ttc_header.count = 1;
+ face->ttc_header.count = 1;
if ( FT_NEW( face->ttc_header.offsets) )
return error;
@@ -371,13 +378,13 @@
return error;
/* read offset table */
- if ( FT_READ_ULONG( sfnt->format_tag ) ||
+ if ( FT_READ_ULONG( sfnt->format_tag ) ||
FT_STREAM_READ_FIELDS( sfnt_header_fields, sfnt ) )
return error;
/* many fonts don't have these fields set correctly */
#if 0
- if ( sfnt->search_range != 1 << ( sfnt->entry_selector + 4 ) ||
+ if ( sfnt->search_range != 1 << ( sfnt->entry_selector + 4 ) ||
sfnt->search_range + sfnt->range_shift != sfnt->num_tables << 4 )
return SFNT_Err_Unknown_File_Format;
#endif
@@ -426,7 +433,8 @@
/* check first */
error = sfnt_dir_check( sfnt, stream );
- if ( error ) {
+ if ( error )
+ {
FT_TRACE2(( "tt_face_load_directory: directory checking failed!\n" ));
return error;