* src/base/ftobjs.c (ft_glyphslot_reset_bimap): Another tweak.
This one should be clearer. When the rounded monochrome bbox collapses we add a pixel that covers most if not all original cbox.
This commit is contained in:
parent
f26d57753f
commit
793a9ff9f5
|
@ -1,3 +1,10 @@
|
||||||
|
2018-09-20 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||||
|
|
||||||
|
* src/base/ftobjs.c (ft_glyphslot_reset_bimap): Another tweak.
|
||||||
|
|
||||||
|
This one should be clearer. When the rounded monochrome bbox collapses
|
||||||
|
we add a pixel that covers most if not all original cbox.
|
||||||
|
|
||||||
2018-09-20 Alexei Podtelezhnikov <apodtele@gmail.com>
|
2018-09-20 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||||
|
|
||||||
* src/base/ftobjs.c (ft_glyphslot_reset_bimap): Further tweak.
|
* src/base/ftobjs.c (ft_glyphslot_reset_bimap): Further tweak.
|
||||||
|
|
|
@ -393,47 +393,39 @@
|
||||||
#if 1
|
#if 1
|
||||||
/* x */
|
/* x */
|
||||||
|
|
||||||
/* undocumented but confirmed: bbox values get rounded; */
|
/* undocumented but confirmed: bbox values get rounded; */
|
||||||
/* for narrow glyphs bbox is extended to one pixel first */
|
/* we do asymmetric rounding so that the center of a pixel */
|
||||||
switch ( pbox.xMax - pbox.xMin )
|
/* gets always included */
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
pbox.xMax -= 1;
|
|
||||||
cbox.xMax += 64;
|
|
||||||
/* fall through */
|
|
||||||
case 0:
|
|
||||||
if ( cbox.xMax - cbox.xMin < 63 )
|
|
||||||
{
|
|
||||||
cbox.xMin = ( cbox.xMin + cbox.xMax ) / 2 - 31;
|
|
||||||
cbox.xMax = cbox.xMin + 63;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we do asymmetric rounding so that the center */
|
|
||||||
/* of a pixel gets always included */
|
|
||||||
|
|
||||||
pbox.xMin += ( cbox.xMin + 31 ) >> 6;
|
pbox.xMin += ( cbox.xMin + 31 ) >> 6;
|
||||||
pbox.xMax += ( cbox.xMax + 32 ) >> 6;
|
pbox.xMax += ( cbox.xMax + 32 ) >> 6;
|
||||||
|
|
||||||
/* y */
|
/* if the bbox collapsed, we add a pixel based on the total */
|
||||||
|
/* rounding remainder to cover most of the original cbox */
|
||||||
|
|
||||||
switch ( pbox.yMax - pbox.yMin )
|
if ( pbox.xMin == pbox.xMax )
|
||||||
{
|
{
|
||||||
case 1:
|
if ( ( ( cbox.xMin + 31 ) & 63 ) - 31 +
|
||||||
pbox.yMax -= 1;
|
( ( cbox.xMax + 32 ) & 63 ) - 32 < 0 )
|
||||||
cbox.yMax += 64;
|
pbox.xMin -= 1;
|
||||||
/* fall through */
|
else
|
||||||
case 0:
|
pbox.xMax += 1;
|
||||||
if ( cbox.yMax - cbox.yMin < 63 )
|
|
||||||
{
|
|
||||||
cbox.yMin = ( cbox.yMin + cbox.yMax ) / 2 - 31;
|
|
||||||
cbox.yMax = cbox.yMin + 63;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* y */
|
||||||
|
|
||||||
pbox.yMin += ( cbox.yMin + 31 ) >> 6;
|
pbox.yMin += ( cbox.yMin + 31 ) >> 6;
|
||||||
pbox.yMax += ( cbox.yMax + 32 ) >> 6;
|
pbox.yMax += ( cbox.yMax + 32 ) >> 6;
|
||||||
|
|
||||||
|
if ( pbox.yMin == pbox.yMax )
|
||||||
|
{
|
||||||
|
if ( ( ( cbox.yMin + 31 ) & 63 ) - 31 +
|
||||||
|
( ( cbox.yMax + 32 ) & 63 ) - 32 < 0 )
|
||||||
|
pbox.yMin -= 1;
|
||||||
|
else
|
||||||
|
pbox.yMax += 1;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
goto Adjust;
|
goto Adjust;
|
||||||
|
|
Loading…
Reference in New Issue