* src/cid/cidparse.c (cid_parser_new): Improve error message for
Type 11 fonts. Scan for `/sfnts' token.
This commit is contained in:
parent
e6b6f3733e
commit
b8004d2e88
@ -1,7 +1,12 @@
|
||||
2007-01-07 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/cid/cidparse.c (cid_parser_new): Reject Type 42 CID-keyed
|
||||
fonts.
|
||||
* src/cid/cidparse.c (cid_parser_new): Improve error message for
|
||||
Type 11 fonts.
|
||||
Scan for `/sfnts' token.
|
||||
|
||||
2007-01-07 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/cid/cidparse.c (cid_parser_new): Reject Type 11 fonts.
|
||||
|
||||
2007-01-06 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
|
@ -83,7 +83,8 @@
|
||||
goto Exit;
|
||||
|
||||
Again:
|
||||
/* now, read the rest of the file until we find a `StartData' */
|
||||
/* now, read the rest of the file until we find */
|
||||
/* `StartData' or `/sfnts' */
|
||||
{
|
||||
FT_Byte buffer[256 + 10];
|
||||
FT_Int read_len = 256 + 10;
|
||||
@ -92,7 +93,7 @@
|
||||
|
||||
for ( offset = (FT_ULong)FT_STREAM_POS(); ; offset += 256 )
|
||||
{
|
||||
FT_Int stream_len;
|
||||
FT_Int stream_len;
|
||||
|
||||
|
||||
stream_len = stream->size - FT_STREAM_POS();
|
||||
@ -116,6 +117,11 @@
|
||||
offset += p - buffer + 10;
|
||||
goto Found;
|
||||
}
|
||||
else if ( p[1] == 's' && ft_strncmp( (char*)p, "/sfnts", 6 ) == 0 )
|
||||
{
|
||||
offset += p - buffer + 7;
|
||||
goto Found;
|
||||
}
|
||||
}
|
||||
|
||||
FT_MEM_MOVE( buffer, p, 10 );
|
||||
@ -125,8 +131,9 @@
|
||||
}
|
||||
|
||||
Found:
|
||||
/* We have found the start of the binary data. Now rewind and */
|
||||
/* extract the frame corresponding to the PostScript section. */
|
||||
/* We have found the start of the binary data or the `/sfnts' token. */
|
||||
/* Now rewind and extract the frame corresponding to this PostScript */
|
||||
/* section. */
|
||||
|
||||
ps_len = offset - base_offset;
|
||||
if ( FT_STREAM_SEEK( base_offset ) ||
|
||||
@ -140,9 +147,10 @@
|
||||
parser->root.limit = parser->root.cursor + ps_len;
|
||||
parser->num_dict = -1;
|
||||
|
||||
/* Finally, we check whether `StartData' was real -- it could be */
|
||||
/* in a comment or string. We also get its arguments to find out */
|
||||
/* whether the data is represented in binary or hex format. */
|
||||
/* Finally, we check whether `StartData' or `/sfnts' was real -- */
|
||||
/* it could be in a comment or string. We also get the arguments */
|
||||
/* of `StartData' to find out whether the data is represented in */
|
||||
/* binary or hex format. */
|
||||
|
||||
arg1 = parser->root.cursor;
|
||||
cid_parser_skip_PS_token( parser );
|
||||
@ -159,7 +167,7 @@
|
||||
if ( parser->root.error )
|
||||
break;
|
||||
|
||||
if ( *cur == 'S' && ft_strncmp( (char*)cur, "StartData", 9 ) == 0 )
|
||||
if ( cur[0] == 'S' && ft_strncmp( (char*)cur, "StartData", 9 ) == 0 )
|
||||
{
|
||||
if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 )
|
||||
parser->binary_length = ft_atol( (const char *)arg2 );
|
||||
@ -168,6 +176,12 @@
|
||||
cur = parser->root.cursor;
|
||||
goto Exit;
|
||||
}
|
||||
else if ( cur[1] == 's' && ft_strncmp( (char*)cur, "/sfnts", 6 ) == 0 )
|
||||
{
|
||||
FT_TRACE2(( "cid_parser_new: cannot handle Type 11 fonts\n" ));
|
||||
error = CID_Err_Unknown_File_Format;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
cid_parser_skip_PS_token( parser );
|
||||
cid_parser_skip_spaces ( parser );
|
||||
@ -183,11 +197,6 @@
|
||||
goto Again;
|
||||
|
||||
Exit:
|
||||
if ( !parser->postscript )
|
||||
{
|
||||
FT_TRACE2(( "[not a valid CID-keyed font]\n" ));
|
||||
error = CID_Err_Unknown_File_Format;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user