* src/bdf/bdflib.c (_bdf_readstream): Allocate `buf' dynamically.
(_bdf_parse_glyphs): Use correct size for allocating `font->unencoded'. (bdf_load_font): Free array conditionally. Return proper error code in case of failure. * src/bdf/bdfdrivr.c (BDF_Face_Init): Make it more robust against unusual fonts.
This commit is contained in:
parent
5bbb494008
commit
7925edcef4
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2002-05-29 Detlef Würkner <TetiSoft@apg.lahn.de>
|
||||
|
||||
* src/bdf/bdflib.c (_bdf_readstream): Allocate `buf' dynamically.
|
||||
(_bdf_parse_glyphs): Use correct size for allocating
|
||||
`font->unencoded'.
|
||||
(bdf_load_font): Free array conditionally.
|
||||
Return proper error code in case of failure.
|
||||
* src/bdf/bdfdrivr.c (BDF_Face_Init): Make it more robust against
|
||||
unusual fonts.
|
||||
|
||||
2002-05-29 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/bdf/descrip.mms, src/type42/descrip.mms: New files.
|
||||
|
|
|
@ -128,9 +128,10 @@ THE SOFTWARE.
|
|||
prop = bdf_get_font_property( font, (char *)"SPACING" );
|
||||
if ( prop != NULL )
|
||||
if ( prop->format == BDF_ATOM )
|
||||
if ( ( *(prop->value.atom) == 'M' ) ||
|
||||
( *(prop->value.atom) == 'C' ) )
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
if ( prop->value.atom != NULL )
|
||||
if ( ( *(prop->value.atom) == 'M' ) ||
|
||||
( *(prop->value.atom) == 'C' ) )
|
||||
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
||||
|
||||
/* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL */
|
||||
/* FZ XXX: I need a font to implement this */
|
||||
|
@ -139,18 +140,20 @@ THE SOFTWARE.
|
|||
prop = bdf_get_font_property( font, (char *)"SLANT" );
|
||||
if ( prop != NULL )
|
||||
if ( prop->format == BDF_ATOM )
|
||||
if ( ( *(prop->value.atom) == 'O' ) ||
|
||||
( *(prop->value.atom) == 'I' ) )
|
||||
root->style_flags |= FT_STYLE_FLAG_ITALIC;
|
||||
if ( prop->value.atom != NULL )
|
||||
if ( ( *(prop->value.atom) == 'O' ) ||
|
||||
( *(prop->value.atom) == 'I' ) )
|
||||
root->style_flags |= FT_STYLE_FLAG_ITALIC;
|
||||
|
||||
prop = bdf_get_font_property( font, (char *)"WEIGHT_NAME" );
|
||||
if ( prop != NULL )
|
||||
if ( prop->format == BDF_ATOM )
|
||||
if ( *(prop->value.atom) == 'B' )
|
||||
root->style_flags |= FT_STYLE_FLAG_BOLD;
|
||||
if ( prop->value.atom != NULL )
|
||||
if ( *(prop->value.atom) == 'B' )
|
||||
root->style_flags |= FT_STYLE_FLAG_BOLD;
|
||||
|
||||
prop = bdf_get_font_property( font, (char *)"FAMILY_NAME" );
|
||||
if ( prop != NULL )
|
||||
if ( ( prop != NULL ) && ( prop->value.atom != NULL ) )
|
||||
{
|
||||
int l = ft_strlen( prop->value.atom ) + 1;
|
||||
|
||||
|
@ -237,7 +240,9 @@ THE SOFTWARE.
|
|||
if ( ( charset_registry != NULL ) && ( charset_encoding != NULL ) )
|
||||
{
|
||||
if ( ( charset_registry->format == BDF_ATOM ) &&
|
||||
( charset_encoding->format == BDF_ATOM ) )
|
||||
( charset_encoding->format == BDF_ATOM ) &&
|
||||
( charset_registry->value.atom != NULL ) &&
|
||||
( charset_encoding->value.atom != NULL ) )
|
||||
{
|
||||
if ( FT_NEW_ARRAY( face->charset_encoding,
|
||||
strlen( charset_encoding->value.atom ) + 1 ) )
|
||||
|
|
|
@ -643,8 +643,8 @@
|
|||
unsigned long lineno;
|
||||
int n, res, done, refill, bytes, hold;
|
||||
char *ls, *le, *pp, *pe, *hp;
|
||||
/* XXX: Use a dynamic buffer */
|
||||
char buf[65536L];
|
||||
char *buf = 0;
|
||||
FT_Memory memory = stream->memory;
|
||||
FT_Error error = BDF_Err_Ok;
|
||||
|
||||
|
||||
|
@ -654,6 +654,9 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
if ( FT_NEW_ARRAY( buf, 65536L ) )
|
||||
goto Exit;
|
||||
|
||||
cb = callback;
|
||||
lineno = 1;
|
||||
buf[0] = 0;
|
||||
|
@ -732,6 +735,7 @@
|
|||
*lno = lineno;
|
||||
|
||||
Exit:
|
||||
FT_FREE( buf );
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -1619,7 +1623,7 @@
|
|||
{
|
||||
if ( font->unencoded_size == 0 )
|
||||
{
|
||||
if ( FT_NEW_ARRAY( font->unencoded, 2 ) )
|
||||
if ( FT_NEW_ARRAY( font->unencoded, 4 ) )
|
||||
goto Exit;
|
||||
}
|
||||
else
|
||||
|
@ -2290,7 +2294,8 @@
|
|||
}
|
||||
|
||||
/* Free up the list used during the parsing. */
|
||||
FT_FREE( p.list.field );
|
||||
if ( memory != NULL )
|
||||
FT_FREE( p.list.field );
|
||||
|
||||
if ( p.font != 0 )
|
||||
{
|
||||
|
@ -2306,6 +2311,8 @@
|
|||
p.font->comments[p.font->comments_len] = 0;
|
||||
}
|
||||
}
|
||||
else if ( error == BDF_Err_Ok )
|
||||
error = BDF_Err_Invalid_File_Format;
|
||||
|
||||
*font = p.font;
|
||||
|
||||
|
|
Loading…
Reference in New Issue