From 344a4dcfe847dd778c33d1a852381672dd331409 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 12 Nov 2010 12:50:24 +0100 Subject: Fix text rendering offset for raster engine on Mac Since the bounding box returned by Core Text in smaller than the actual glyph rendered, we have 2 pixels padding around it, as a result, we have to leave 1 pixel above the glyph in glyph cache, so we need to put the text origin 1 pixel lower to draw it. Task-number: QTBUG-15223, QTBUG-15230, QTBUG-15243 Reviewed-by: Gunnar Sletta --- src/gui/text/qfontengine_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index 7efb1cc..51e18ec 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -694,7 +694,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition CGContextSetFont(ctx, cgFont); qreal pos_x = -br.x.toReal() + subPixelPosition.toReal(); - qreal pos_y = im.height()+br.y.toReal(); + qreal pos_y = im.height() + br.y.toReal() - 1; CGContextSetTextPosition(ctx, pos_x, pos_y); CGSize advance; -- cgit v0.12