134 |
} |
} |
135 |
|
|
136 |
|
|
137 |
/* In theory, we should check the values of `search_range', */ |
/* In theory, we should check the values of `search_range', */ |
138 |
/* `entry_selector', and `range_shift' to detect non-SFNT based files */ |
/* `entry_selector', and `range_shift' to detect non-SFNT based files */ |
139 |
/* whose header might also start with 0x100000L (yes, these exist). */ |
/* whose header might also start with 0x100000L (yes, these exist). */ |
140 |
/* */ |
/* */ |
141 |
/* Very unfortunately, many TrueType fonts don't have these fields */ |
/* Very unfortunately, many TrueType fonts don't have these fields */ |
142 |
/* set correctly and we must ignore them to support them. An alternative */ |
/* set correctly and we must ignore them to support them. An */ |
143 |
/* way to check the font file is thus to: */ |
/* alternative way to check the font file is thus to: */ |
144 |
/* */ |
/* */ |
145 |
/* - check that `num_tables' is valid */ |
/* - check that `num_tables' is valid */ |
146 |
/* - look for a "head" table, check its size, and parse it to */ |
/* - look for a "head" table, check its size, and parse it to */ |
147 |
/* see if its "magic" field is correctly set */ |
/* see if its "magic" field is correctly set */ |
148 |
/* */ |
/* */ |
149 |
/* When checking directory entries, ignore the tables `glyx' and `locx' */ |
/* When checking directory entries, ignore the tables `glyx' and `locx' */ |
150 |
/* which are hacked-out versions of `glyf' and `loca' in some PostScript */ |
/* which are hacked-out versions of `glyf' and `loca' in some PostScript */ |
151 |
/* Type 42 fonts, and will generally be invalid. */ |
/* Type 42 fonts, and will generally be invalid. */ |
152 |
/* */ |
/* */ |
153 |
static FT_Error |
static FT_Error |
154 |
sfnt_dir_check( FT_Stream stream, |
sfnt_dir_check( FT_Stream stream, |
155 |
FT_ULong offset, |
FT_ULong offset, |
239 |
goto Bad_Format; |
goto Bad_Format; |
240 |
|
|
241 |
Exit: |
Exit: |
242 |
return error; |
return error; |
243 |
|
|
244 |
Bad_Format: |
Bad_Format: |
245 |
error = SFNT_Err_Unknown_File_Format; |
error = SFNT_Err_Unknown_File_Format; |