[bdf] Fix size and resolution handling.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Use `SIZE' values if `POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties are missing. * docs/CHANGES: Document it.
This commit is contained in:
parent
f0898b9259
commit
7d017ba810
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2017-09-05 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[bdf] Fix size and resolution handling.
|
||||
|
||||
* src/bdf/bdfdrivr.c (BDF_Face_Init): Use `SIZE' values if
|
||||
`POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties are
|
||||
missing.
|
||||
|
||||
* docs/CHANGES: Document it.
|
||||
|
||||
2017-08-25 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
Swap `ALLOC_MULT' arguments (#51833).
|
||||
|
@ -48,6 +48,12 @@ CHANGES BETWEEN 2.8 and 2.8.1
|
||||
- FreeType now synthesizes a missing Unicode cmap for (older)
|
||||
TrueType fonts also if glyph names are available.
|
||||
|
||||
- FreeType has improved handling of BDF fonts without the
|
||||
`POINT_SIZE', `RESOLUTION_X', or `RESOLUTION_Y' properties; the
|
||||
library now uses the values of the `SIZE' keyword if they are
|
||||
missing. Previously, `SIZE' was completely ignored, and
|
||||
FreeType used heuristic values instead.
|
||||
|
||||
|
||||
======================================================================
|
||||
|
||||
|
@ -437,6 +437,7 @@ THE SOFTWARE.
|
||||
{
|
||||
FT_Bitmap_Size* bsize = bdfface->available_sizes;
|
||||
FT_Short resolution_x = 0, resolution_y = 0;
|
||||
long value;
|
||||
|
||||
|
||||
FT_ZERO( bsize );
|
||||
@ -500,6 +501,17 @@ THE SOFTWARE.
|
||||
64 * 7200,
|
||||
72270L );
|
||||
}
|
||||
else if ( font->point_size )
|
||||
{
|
||||
if ( font->point_size > 0x7FFF )
|
||||
{
|
||||
bsize->size = 0x7FFF;
|
||||
FT_TRACE0(( "BDF_Face_Init: clamping point size to value %d\n",
|
||||
bsize->size ));
|
||||
}
|
||||
else
|
||||
bsize->size = (FT_Pos)font->point_size << 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* this is a heuristical value */
|
||||
@ -525,36 +537,44 @@ THE SOFTWARE.
|
||||
|
||||
prop = bdf_get_font_property( font, "RESOLUTION_X" );
|
||||
if ( prop )
|
||||
value = prop->value.l;
|
||||
else
|
||||
value = (long)font->resolution_x;
|
||||
if ( value )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( prop->value.l < 0 )
|
||||
if ( value < 0 )
|
||||
FT_TRACE0(( "BDF_Face_Init: negative X resolution\n" ));
|
||||
#endif
|
||||
if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF )
|
||||
if ( value > 0x7FFF || value < -0x7FFF )
|
||||
{
|
||||
resolution_x = 0x7FFF;
|
||||
FT_TRACE0(( "BDF_Face_Init: clamping X resolution to value %d\n",
|
||||
resolution_x ));
|
||||
}
|
||||
else
|
||||
resolution_x = FT_ABS( (FT_Short)prop->value.l );
|
||||
resolution_x = FT_ABS( (FT_Short)value );
|
||||
}
|
||||
|
||||
prop = bdf_get_font_property( font, "RESOLUTION_Y" );
|
||||
if ( prop )
|
||||
value = prop->value.l;
|
||||
else
|
||||
value = (long)font->resolution_y;
|
||||
if ( value )
|
||||
{
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
if ( prop->value.l < 0 )
|
||||
if ( value < 0 )
|
||||
FT_TRACE0(( "BDF_Face_Init: negative Y resolution\n" ));
|
||||
#endif
|
||||
if ( prop->value.l > 0x7FFF || prop->value.l < -0x7FFF )
|
||||
if ( value > 0x7FFF || value < -0x7FFF )
|
||||
{
|
||||
resolution_y = 0x7FFF;
|
||||
FT_TRACE0(( "BDF_Face_Init: clamping Y resolution to value %d\n",
|
||||
resolution_y ));
|
||||
}
|
||||
else
|
||||
resolution_y = FT_ABS( (FT_Short)prop->value.l );
|
||||
resolution_y = FT_ABS( (FT_Short)value );
|
||||
}
|
||||
|
||||
if ( bsize->y_ppem == 0 )
|
||||
|
Loading…
Reference in New Issue
Block a user