From 7166253831e552f7247827569215d150b9f93501 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 21 Aug 2015 14:00:51 +1000 Subject: [PATCH] Fix rounding up for 26.6 fixed point, not 24.8. --- freetype.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freetype.go b/freetype.go index d871168..928d2f6 100644 --- a/freetype.go +++ b/freetype.go @@ -167,8 +167,8 @@ func (c *Context) rasterize(glyph truetype.Index, fx, fy fixed.Int26_6) ( // Calculate the integer-pixel bounds for the glyph. xmin := int(fx+fixed.Int26_6(c.glyphBuf.B.XMin)) >> 6 ymin := int(fy-fixed.Int26_6(c.glyphBuf.B.YMax)) >> 6 - xmax := int(fx+fixed.Int26_6(c.glyphBuf.B.XMax)+0xff) >> 6 - ymax := int(fy-fixed.Int26_6(c.glyphBuf.B.YMin)+0xff) >> 6 + xmax := int(fx+fixed.Int26_6(c.glyphBuf.B.XMax)+0x3f) >> 6 + ymax := int(fy-fixed.Int26_6(c.glyphBuf.B.YMin)+0x3f) >> 6 if xmin > xmax || ymin > ymax { return 0, nil, image.Point{}, errors.New("freetype: negative sized glyph") } -- GitLab