summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2012-07-09 14:14:36 +0200
committerQt by Nokia <qt-info@nokia.com>2012-07-09 15:55:49 +0200
commit6fb5b6fa58df4b622d47a8d71ba0f5f2b938cd63 (patch)
treee8195d32ec35c9f535f7225de915250f41b1ec45 /src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
parentbcf6333c6f6266e2f26efd1a3c4fe38c574161c8 (diff)
Fix bounding box of DirectWrite font engine
Vertical bearings of the font were ignored, giving the wrong height. Also, the left bearing is right bound in DirectWrite, so the sign should be flipped. Task-number: QTBUG-22649 Change-Id: I82934f5b08e68e46d1b2221b35008bf9d75c5748 Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index e90c6b6048..3d10d5aa82 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -434,6 +434,8 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g)
QFixed rightSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.rightSideBearing);
QFixed advanceHeight = DESIGN_TO_LOGICAL(glyphMetrics.advanceHeight);
QFixed verticalOriginY = DESIGN_TO_LOGICAL(glyphMetrics.verticalOriginY);
+ QFixed topSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.topSideBearing);
+ QFixed bottomSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.bottomSideBearing);
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
advanceWidth = advanceWidth.round();
@@ -441,10 +443,13 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g)
}
QFixed width = advanceWidth - leftSideBearing - rightSideBearing;
-
- return glyph_metrics_t(-leftSideBearing, -verticalOriginY,
- width, m_ascent + m_descent,
- advanceWidth, advanceHeight);
+ QFixed height = advanceHeight - topSideBearing - bottomSideBearing;
+ return glyph_metrics_t(leftSideBearing,
+ -verticalOriginY + topSideBearing,
+ width,
+ height,
+ advanceWidth,
+ advanceHeight);
} else {
qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
}