From ca980b4cf11405469a5b5919dc40e73c4961c7c7 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 30 Aug 2018 21:51:18 -0400 Subject: [PATCH] * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Correct mono. --- ChangeLog | 4 ++++ src/base/ftobjs.c | 28 +++++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 70bc8a105..0b945f860 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-08-30 Alexei Podtelezhnikov + + * src/base/ftobjs.c (ft_glyphslot_preset_bitmap): Correct mono. + 2018-08-30 Armin Hasitzka [errors] Introduce a macro to control `FT_Error_String'. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index d4594b566..f245430ec 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -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;