From 9088661c63f61fbfa02e2e11aefe32cfa0f52171 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 28 Jun 2011 15:53:28 +0200 Subject: Fix vertical positioning of glyphs in raster engine with FreeType Reviewed-by: aavit --- src/gui/painting/qpaintengine_raster.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 30553b5..9ba4592 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2774,10 +2774,12 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, { Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); + const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta); #if !defined(QT_NO_FREETYPE) if (fontEngine->type() == QFontEngine::Freetype) { QFontEngineFT *fe = static_cast(fontEngine); + const QFixed xOffs = fe->supportsSubPixelPositions() ? 0 : offs; QFontEngineFT::GlyphFormat neededFormat = painter()->device()->devType() == QInternal::Widget ? fe->defaultGlyphFormat() @@ -2851,8 +2853,8 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, }; alphaPenBlt(glyph->data, pitch, depth, - qFloor(positions[i].x) + glyph->x, - qFloor(positions[i].y) - glyph->y, + qFloor(positions[i].x + xOffs) + glyph->x, + qFloor(positions[i].y + offs) - glyph->y, glyph->width, glyph->height); } if (lockedFace) @@ -2892,7 +2894,6 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, rightShift = 3; // divide by 8 int margin = cache->glyphMargin(); - const QFixed offs = QFixed::fromReal(aliasedCoordinateDelta); const uchar *bits = image.bits(); for (int i=0; i