diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-04-01 11:51:06 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-04-01 12:16:44 (GMT) |
commit | bf03b38d2b32a0cfca181398597884e4252466f4 (patch) | |
tree | 87dcde787f8f3c7b115844fbfb1b7078c9f78727 | |
parent | 70dde9c60e2ed9f8b9a15bc5c656fda972e69d97 (diff) | |
download | Qt-bf03b38d2b32a0cfca181398597884e4252466f4.zip Qt-bf03b38d2b32a0cfca181398597884e4252466f4.tar.gz Qt-bf03b38d2b32a0cfca181398597884e4252466f4.tar.bz2 |
Make sure we don't use subpixel positions in full hinting mode
Some of the text can start from subpixel positions (start from
100.5 for instance), we need to make sure they stick to pixel grid
in this case.
Reviewed-by: Eskil
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 7 | ||||
-rw-r--r-- | src/gui/painting/qtextureglyphcache.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 2 |
3 files changed, 4 insertions, 7 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 9f3b9b9..6902543 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3191,15 +3191,10 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, rightShift = 3; // divide by 8 int margin = cache->glyphMargin(); - - bool supportsSubPixelPositions = fontEngine->supportsSubPixelPositions(); - const uchar *bits = image.bits(); for (int i=0; i<numGlyphs; ++i) { - QFixed subPixelPosition; - if (supportsSubPixelPositions) - subPixelPosition = cache->subPixelPositionForX(positions[i].x); + QFixed subPixelPosition = cache->subPixelPositionForX(positions[i].x); QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition); const QTextureGlyphCache::Coord &c = cache->coords[glyph]; if (c.isNull()) diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index f0db805..727852d 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -102,7 +102,7 @@ int QTextureGlyphCache::calculateSubPixelPositionCount(glyph_t glyph) const QFixed QTextureGlyphCache::subPixelPositionForX(QFixed x) const { - if (m_subPixelPositionCount == 0) + if (m_subPixelPositionCount <= 1) return QFixed(); QFixed subPixelPosition; diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index db0156a..08eb6bb 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1430,6 +1430,8 @@ QFontEngineFT::QGlyphSet *QFontEngineFT::loadTransformedGlyphSet(const QTransfor QFixed QFontEngineFT::subPixelPositionForX(QFixed x) { int m_subPixelPositionCount = 4; + if (!supportsSubPixelPositions()) + return 0; QFixed subPixelPosition; if (x != 0) { |