add a sniffer for TTF

since TTF files can be caught by the almost unfixably overgenerous TGA sniffer

see https://github.com/libvips/php-vips/issues/127
This commit is contained in:
John Cupitt 2021-12-22 10:25:52 +00:00
parent 93ff76ce53
commit d3f77e4433
2 changed files with 9 additions and 0 deletions

View File

@ -5,6 +5,7 @@
- fix a crash with 0 length vectors
- change default frame delay for GIFs from 1s to 0.1s
- remove stray trailing comma from iiif3 dirnames [whalehub]
- fix TTF load [chregu]
21/11/21 started 8.12.1
- fix insert [chregu]

View File

@ -82,6 +82,14 @@ magick_sniff( const unsigned char *bytes, size_t length )
bytes[3] == 0 )
return( "ICO" );
if( length >= 5 &&
bytes[0] == 0 &&
bytes[1] == 1 &&
bytes[2] == 0 &&
bytes[3] == 0 &&
bytes[4] == 0 )
return( "TTF" );
if( length >= 18 &&
(bytes[1] == 0 ||
bytes[1] == 1) &&