summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTrond Kjernaasen <trond@trolltech.com>2009-05-14 17:38:56 +0200
committerTrond Kjernaasen <trond@trolltech.com>2009-05-14 17:45:13 +0200
commit85f98acaa3a38079071bea711e43c9a86edec1f6 (patch)
treef80ad70a065e8086b9095f559fe2edfab859798e /src
parentd644a9a89ff4f7bf8866b69af5334ea1c696e4a7 (diff)
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')
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp11
-rw-r--r--src/gui/text/qfontengine_win.cpp6
2 files changed, 7 insertions, 10 deletions
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 1ea40bad89..3fd1ffb66e 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)
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index 1996d44a4e..bf3a176d32 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -1406,8 +1406,8 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin
#endif
#endif
- QNativeImage *ni = new QNativeImage(iw + 2 * margin,
- ih + 2 * margin,
+ QNativeImage *ni = new QNativeImage(iw + 2 * margin + 2,
+ ih + 2 * margin + 2,
QNativeImage::systemFormat(), true);
ni->image.fill(0xffffffff);
@@ -1449,7 +1449,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
font = CreateFontIndirectW(&lf);
}
- QNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform);
+ QNativeImage *mask = drawGDIGlyph(font, glyph, 2, xform);
if (mask == 0)
return QImage();