summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qtextureglyphcache.cpp
diff options
context:
space:
mode:
authorTrond Kjernaasen <trond@trolltech.com>2009-05-14 15:38:56 (GMT)
committerTrond Kjernaasen <trond@trolltech.com>2009-05-14 15:45:13 (GMT)
commit85f98acaa3a38079071bea711e43c9a86edec1f6 (patch)
treef80ad70a065e8086b9095f559fe2edfab859798e /src/gui/painting/qtextureglyphcache.cpp
parentd644a9a89ff4f7bf8866b69af5334ea1c696e4a7 (diff)
downloadQt-85f98acaa3a38079071bea711e43c9a86edec1f6.zip
Qt-85f98acaa3a38079071bea711e43c9a86edec1f6.tar.gz
Qt-85f98acaa3a38079071bea711e43c9a86edec1f6.tar.bz2
Fixed an issue with text drawing under Windows.
Some text drawn with OpenType fonts where cut off by a pixel or two under certain circumstances. This adds an additional 2 pixel pad margin to the glyph cache entries. The padding behaves slightly different when ClearType is enabled/disabled, hence the general 2 pixel padding. Task-number: 246196 Reviewed-by: Samuel
Diffstat (limited to 'src/gui/painting/qtextureglyphcache.cpp')
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 1ea40ba..3fd1ffb 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -88,11 +88,12 @@ void QTextureGlyphCache::populate(const QTextItemInt &ti,
ti.ascent.toReal(),
ti.descent.toReal());
#endif
- int glyph_width = metrics.width.ceil().toInt() + margin * 2;
- int glyph_height = metrics.height.ceil().toInt() + margin * 2;
+ int glyph_width = metrics.width.ceil().toInt();
+ int glyph_height = metrics.height.ceil().toInt();
if (glyph_height == 0 || glyph_width == 0)
continue;
-
+ glyph_width += margin * 2 + 2;
+ glyph_height += margin * 2 + 2;
// align to 8-bit boundary
if (m_type == QFontEngineGlyphCache::Raster_Mono)
glyph_width = (glyph_width+7)&~7;
@@ -188,11 +189,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height)
int QImageTextureGlyphCache::glyphMargin() const
{
-#ifdef Q_WS_MAC
return 2;
-#else
- return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0;
-#endif
}
void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g)