summaryrefslogtreecommitdiff
path: root/freetype
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2018-05-17 07:35:02 +0100
committerChris Liddell <chris.liddell@artifex.com>2018-05-18 13:17:15 +0100
commit891ea7d2813edaa3c7c874a4053afdda128e8a10 (patch)
tree43a405ea0e6a3a9ab64e245c61cd30fef7ea2f2b /freetype
parent9cb169b6b260f650aac2c3c7ed7af0f345ee0707 (diff)
downloadghostpdl-891ea7d2813edaa3c7c874a4053afdda128e8a10.tar.gz
Fix for small glyph distortion
Glyphs with very few pixels (i.e. lower case "i" in 9pt text rendered at 72dpi) we being distorted due to the specific rules applied by Freetype's dropout compensation. This isn't a full solution but resolves the change in behaviour between 2.7.x and 2.9.x (the change was due to different rounding being applied). This fix is from upstream: http://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=f1458d2e44d8 So should be in future Freetype releases, and not need re-applied here.
Diffstat (limited to 'freetype')
-rw-r--r--freetype/src/base/ftobjs.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/freetype/src/base/ftobjs.c b/freetype/src/base/ftobjs.c
index 8d07e35ae..926943b2f 100644
--- a/freetype/src/base/ftobjs.c
+++ b/freetype/src/base/ftobjs.c
@@ -374,32 +374,26 @@
/* unless the rounded box can collapse for a narrow glyph */
if ( cbox.xMax - cbox.xMin < 64 )
{
- cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
- cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax );
- }
- else
- {
- cbox.xMin = FT_PIX_ROUND_LONG( cbox.xMin );
- cbox.xMax = FT_PIX_ROUND_LONG( cbox.xMax );
+ cbox.xMin = ( cbox.xMin + cbox.xMax ) / 2 - 32;
+ cbox.xMax = cbox.xMin + 64;
}
+ cbox.xMin = FT_PIX_ROUND_LONG( cbox.xMin );
+ cbox.xMax = FT_PIX_ROUND_LONG( cbox.xMax );
+
if ( cbox.yMax - cbox.yMin < 64 )
{
- cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
- cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax );
- }
- else
- {
- cbox.yMin = FT_PIX_ROUND_LONG( cbox.yMin );
- cbox.yMax = FT_PIX_ROUND_LONG( cbox.yMax );
+ cbox.yMin = ( cbox.yMin + cbox.yMax ) / 2 - 32;
+ cbox.yMax = cbox.yMin + 64;
}
+
+ cbox.yMin = FT_PIX_ROUND_LONG( cbox.yMin );
+ cbox.yMax = FT_PIX_ROUND_LONG( cbox.yMax );
+
+ break;
#else
- cbox.xMin = FT_PIX_FLOOR( cbox.xMin );
- cbox.yMin = FT_PIX_FLOOR( cbox.yMin );
- cbox.xMax = FT_PIX_CEIL_LONG( cbox.xMax );
- cbox.yMax = FT_PIX_CEIL_LONG( cbox.yMax );
+ goto Round;
#endif
- break;
case FT_RENDER_MODE_LCD:
pixel_mode = FT_PIXEL_MODE_LCD;