summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index 5408ff41e5..f6d911d646 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -362,8 +362,9 @@ void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEn
glyphIndices.size(),
glyphMetrics.data());
if (SUCCEEDED(hr)) {
+ qreal stretch = fontDef.stretch / 100.0;
for (int i = 0; i < glyphs->numGlyphs; ++i)
- glyphs->advances[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth);
+ glyphs->advances[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth * stretch);
if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
for (int i = 0; i < glyphs->numGlyphs; ++i)
glyphs->advances[i] = glyphs->advances[i].round();
@@ -520,7 +521,7 @@ bool QWindowsFontEngineDirectWrite::supportsSubPixelPositions() const
QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
QFixed subPixelPosition,
int margin,
- const QTransform &xform)
+ const QTransform &originalTransform)
{
UINT16 glyphIndex = t;
FLOAT glyphAdvance = 0;
@@ -539,6 +540,10 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t,
glyphRun.bidiLevel = 0;
glyphRun.glyphOffsets = &glyphOffset;
+ QTransform xform = originalTransform;
+ if (fontDef.stretch != 100)
+ xform.scale(fontDef.stretch / 100.0, 1.0);
+
DWRITE_MATRIX transform;
transform.dx = subPixelPosition.toReal();
transform.dy = 0;
@@ -795,10 +800,15 @@ QString QWindowsFontEngineDirectWrite::fontNameSubstitute(const QString &familyN
glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph,
QFixed subPixelPosition,
- const QTransform &matrix,
+ const QTransform &originalTransform,
GlyphFormat format)
{
Q_UNUSED(format);
+
+ QTransform matrix = originalTransform;
+ if (fontDef.stretch != 100)
+ matrix.scale(fontDef.stretch / 100.0, 1.0);
+
glyph_metrics_t bbox = QFontEngine::boundingBox(glyph, matrix); // To get transformed advance
UINT16 glyphIndex = glyph;