[raster] Make bbox handling the same as with Microsoft's rasterizer.

Right before B/W rasterizing, the bbox gets simply rounded to
integers.  This fixes, for example, glyph `three' in font `Helvetica
Neue LT Com 65 Medium' at 11ppem.

Thanks to Greg Hitchcock who explained this behaviour.

* src/raster/ftrend1.c (ft_raster1_render): Implement it.
This commit is contained in:
Werner Lemberg 2011-01-15 09:46:13 +01:00
parent a2ef6647ae
commit 21bdca7907
2 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,15 @@
2011-01-15 Werner Lemberg <wl@gnu.org>
[raster] Make bbox handling the same as with Microsoft's rasterizer.
Right before B/W rasterizing, the bbox gets simply rounded to
integers. This fixes, for example, glyph `three' in font `Helvetica
Neue LT Com 65 Medium' at 11ppem.
Thanks to Greg Hitchcock who explained this behaviour.
* src/raster/ftrend1.c (ft_raster1_render): Implement it.
2011-01-15 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
Copy -mcpu=* & -march=* options from CFLAGS to LDFLAGS.

View File

@ -161,10 +161,18 @@
/* compute the control box, and grid fit it */
FT_Outline_Get_CBox( outline, &cbox );
/* undocumented but confirmed: bbox values get rounded */
#if 1
cbox.xMin = FT_PIX_ROUND( cbox.xMin );
cbox.yMin = FT_PIX_ROUND( cbox.yMin );
cbox.xMax = FT_PIX_ROUND( cbox.xMax );
cbox.yMax = FT_PIX_ROUND( cbox.yMax );
#else
cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
cbox.xMax = FT_PIX_CEIL( cbox.xMax );
cbox.yMax = FT_PIX_CEIL( cbox.yMax );
#endif
width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 );
height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 );