summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-04-01 11:51:06 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2011-04-01 12:27:29 (GMT)
commitdb9a81e5cc0f18e4b6dae5edf2309c6fc90b9eb3 (patch)
tree8949cd3f318758c7fb41770be7f566643a916dcf
parent90f18aa904c6c4371f954392cf99cbaeb404ae7d (diff)
downloadQt-db9a81e5cc0f18e4b6dae5edf2309c6fc90b9eb3.zip
Qt-db9a81e5cc0f18e4b6dae5edf2309c6fc90b9eb3.tar.gz
Qt-db9a81e5cc0f18e4b6dae5edf2309c6fc90b9eb3.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 (cherry picked from commit bf03b38d2b32a0cfca181398597884e4252466f4)
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp7
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp2
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
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) {