* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Correct mono.

This commit is contained in:
Alexei Podtelezhnikov 2018-08-30 21:51:18 -04:00
parent 35efb103fe
commit ca980b4cf1
2 changed files with 21 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2018-08-30 Alexei Podtelezhnikov <apodtele@gmail.com>
* src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Correct mono.
2018-08-30 Armin Hasitzka <prince.cherusker@gmail.com>
[errors] Introduce a macro to control `FT_Error_String'.

View File

@ -391,25 +391,31 @@
pixel_mode = FT_PIXEL_MODE_MONO;
#if 1
/* undocumented but confirmed: bbox values get rounded */
/* unless the rounded box can collapse for a narrow glyph */
if ( pbox.xMax - pbox.xMin == 0 )
/* for narrow glyphs bbox is extended to one pixel first */
if ( pbox.xMax - pbox.xMin <= 1 )
{
cbox.xMin = ( cbox.xMin + cbox.xMax ) / 2 - 32;
cbox.xMax = cbox.xMin + 64;
if ( pbox.xMax - pbox.xMin == 0 )
{
cbox.xMin = ( cbox.xMin + cbox.xMax ) / 2 - 32;
cbox.xMax = cbox.xMin + 64;
}
else if ( cbox.xMax - cbox.xMin < 0 )
cbox.xMin = cbox.xMax = ( cbox.xMin + cbox.xMax ) / 2;
}
else if ( pbox.xMax - pbox.xMin == 1 )
cbox.xMin = cbox.xMax = ( cbox.xMin + cbox.xMax ) / 2;
pbox.xMin += ( cbox.xMin + 32 ) >> 6;
pbox.xMax += ( cbox.xMax + 32 ) >> 6;
if ( pbox.yMax - pbox.yMin == 0 )
if ( pbox.yMax - pbox.yMin <= 1 )
{
cbox.yMin = ( cbox.yMin + cbox.yMax ) / 2 - 32;
cbox.yMax = cbox.yMin + 64;
if ( pbox.yMax - pbox.yMin == 0 )
{
cbox.yMin = ( cbox.yMin + cbox.yMax ) / 2 - 32;
cbox.yMax = cbox.yMin + 64;
}
else if ( cbox.yMax - cbox.yMin < 0 )
cbox.yMin = cbox.yMax = ( cbox.yMin + cbox.yMax ) / 2;
}
else if ( pbox.yMax - pbox.yMin == 1 )
cbox.yMin = cbox.yMax = ( cbox.yMin + cbox.yMax ) / 2;
pbox.yMin += ( cbox.yMin + 32 ) >> 6;
pbox.yMax += ( cbox.yMax + 32 ) >> 6;