forked from minhngoc25a/freetype2
[bdf]: Font properties are optional.
* src/bdf/bdflib.c (_bdf_readstream): Use special error code to indicate a redo operation. (_bdf_parse_start): Handle `CHARS' keyword here too and pass current input line to `_bdf_parse_glyph'.
This commit is contained in:
parent
8c2c2556af
commit
b21d7bc567
|
@ -1,3 +1,12 @@
|
|||
2010-06-24 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[bdf]: Font properties are optional.
|
||||
|
||||
* src/bdf/bdflib.c (_bdf_readstream): Use special error code to
|
||||
indicate a redo operation.
|
||||
(_bdf_parse_start): Handle `CHARS' keyword here too and pass current
|
||||
input line to `_bdf_parse_glyph'.
|
||||
|
||||
2010-06-23 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
Fix Savannah bug #30220.
|
||||
|
|
|
@ -721,6 +721,10 @@
|
|||
{
|
||||
error = (*cb)( buf + start, end - start, lineno,
|
||||
(void*)&cb, client_data );
|
||||
/* Redo if we have encountered CHARS without properties. */
|
||||
if ( error == -1 )
|
||||
error = (*cb)( buf + start, end - start, lineno,
|
||||
(void*)&cb, client_data );
|
||||
if ( error )
|
||||
break;
|
||||
}
|
||||
|
@ -2225,6 +2229,45 @@
|
|||
goto Exit;
|
||||
}
|
||||
|
||||
/* Check for the CHARS field -- font properties are optional */
|
||||
if ( ft_memcmp( line, "CHARS", 5 ) == 0 )
|
||||
{
|
||||
char nbuf[128];
|
||||
|
||||
|
||||
if ( !( p->flags & _BDF_FONT_BBX ) )
|
||||
{
|
||||
/* Missing the FONTBOUNDINGBOX field. */
|
||||
FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" ));
|
||||
error = BDF_Err_Missing_Fontboundingbox_Field;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
/* Add the two standard X11 properties which are required */
|
||||
/* for compiling fonts. */
|
||||
p->font->font_ascent = p->font->bbx.ascent;
|
||||
ft_sprintf( nbuf, "%hd", p->font->bbx.ascent );
|
||||
error = _bdf_add_property( p->font, (char *)"FONT_ASCENT", nbuf );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
FT_TRACE2(( "_bdf_parse_properties: " ACMSG1, p->font->bbx.ascent ));
|
||||
|
||||
p->font->font_descent = p->font->bbx.descent;
|
||||
ft_sprintf( nbuf, "%hd", p->font->bbx.descent );
|
||||
error = _bdf_add_property( p->font, (char *)"FONT_DESCENT", nbuf );
|
||||
if ( error )
|
||||
goto Exit;
|
||||
FT_TRACE2(( "_bdf_parse_properties: " ACMSG2, p->font->bbx.descent ));
|
||||
|
||||
p->font->modified = 1;
|
||||
|
||||
*next = _bdf_parse_glyphs;
|
||||
|
||||
/* A special return value. */
|
||||
error = -1;
|
||||
goto Exit;
|
||||
}
|
||||
|
||||
error = BDF_Err_Invalid_File_Format;
|
||||
|
||||
Exit:
|
||||
|
|
Loading…
Reference in New Issue