summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-09-13 12:05:54 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-09-13 12:14:32 (GMT)
commitc69469ff12eeed23584b5c3b15978a7e75d01df1 (patch)
tree530600b98cb78f9f01cb2f66204f9e490c831bae /src
parent2b527006a3e9147a447a08d78004e20a7ac3d17c (diff)
downloadQt-c69469ff12eeed23584b5c3b15978a7e75d01df1.zip
Qt-c69469ff12eeed23584b5c3b15978a7e75d01df1.tar.gz
Qt-c69469ff12eeed23584b5c3b15978a7e75d01df1.tar.bz2
Linux: Fix mispositioned, misclipped glyphs in large fonts (QStaticText)
While drawText() will use the path fallback for large fonts, and never hit this problem, QStaticText will draw the large fonts into the glyph cache. This broke when the freetype (or any other font engine) falls back to the generic implementation of alphaMapForGlyph() which uses path drawing. The problem was that alphaMapForGlyph() is not supposed to contain the bearing of the glyph, only the actual pixels. Since QFontEngine did not honor this contract, we would sample the wrong area in the glyph cache to get the glyph image. Task-number: QTBUG-12540 Reviewed-by: Gunnar
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qfontengine.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 1e8461f..a3f4d8a 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -631,10 +631,10 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
if (glyph_width <= 0 || glyph_height <= 0)
return QImage();
QFixedPoint pt;
- pt.x = 0;
+ pt.x = -glyph_x;
pt.y = -glyph_y; // the baseline
QPainterPath path;
- QImage im(glyph_width + qAbs(glyph_x) + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
+ QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
im.fill(Qt::transparent);
QPainter p(&im);
p.setRenderHint(QPainter::Antialiasing);