From 21bdca7907cb08b3afebe8af808af45456001d3b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 15 Jan 2011 09:46:13 +0100 Subject: [PATCH] [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. --- ChangeLog | 12 ++++++++++++ src/raster/ftrend1.c | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index c3dff2805..ab0fb4085 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-01-15 Werner Lemberg + + [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 Copy -mcpu=* & -march=* options from CFLAGS to LDFLAGS. diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index 1ed8af612..d8a89f28a 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -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 );