summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-29 13:51:16 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-29 15:30:17 +0200
commit1cc571593a67f3e688a5cbb896f0be71ca5a2b30 (patch)
treec652360c9276cbf475244fd02313d64e3df11a96 /src/plugins/platforms/windows
parent829c59aa4acf94bd979f6a3162808be36802d79a (diff)
parentcc74452d6d259d36ac47c536f11a5efb269e8e44 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
cf53aa21bf0f8fbd13c0ce2d33ddf7bc63d0d76a and 3aaa5d6b32130d3eeac872a59a5a44bfb20dfd4a were reverted because of reconstruction in 5.7. defineTest(qtConfTest_checkCompiler) in configure.pri is smart enough to cover the case in a9474d1260a8c8cc9eae14f2984098919d9684e5. DirectWrite: Fix advances being scaled to 0 Since 131eee5cd, the stretch of a font can be 0, meaning "whatever the font provides". In combination with ec7fee96, this would cause advances in the DirectWrite engine to be scaled to 0, causing the QRawFont test to fail. Conflicts: configure mkspecs/features/uikit/device_destinations.sh mkspecs/features/uikit/xcodebuild.mk src/corelib/global/qglobal.cpp src/corelib/global/qnamespace.qdoc src/plugins/platforms/cocoa/qcocoamenuitem.h src/plugins/platforms/windows/qwindowsservices.cpp src/plugins/platformthemes/gtk3/qgtk3dialoghelpers.cpp src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp src/widgets/kernel/qapplication.cpp tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp Change-Id: I4656d8133da7ee9fcc84ad3f1c7950f924432d1e
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp18
-rw-r--r--src/plugins/platforms/windows/qwindowsservices.cpp5
2 files changed, 17 insertions, 6 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
index 18be3b0ce6..39a4eb81ca 100644
--- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp
@@ -364,8 +364,9 @@ void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEn
glyphIndices.size(),
glyphMetrics.data());
if (SUCCEEDED(hr)) {
+ qreal stretch = fontDef.stretch != QFont::AnyStretch ? fontDef.stretch / 100.0 : 1.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();
@@ -448,7 +449,7 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g)
width,
height,
advanceWidth,
- advanceHeight);
+ 0);
} else {
qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__);
}
@@ -532,7 +533,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;
@@ -551,6 +552,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;
@@ -807,10 +812,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;
diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp
index 6cc56372ec..7f9c9bd205 100644
--- a/src/plugins/platforms/windows/qwindowsservices.cpp
+++ b/src/plugins/platforms/windows/qwindowsservices.cpp
@@ -54,8 +54,9 @@ enum { debug = 0 };
static inline bool shellExecute(const QUrl &url)
{
- const QString nativeFilePath =
- url.isLocalFile() ? QDir::toNativeSeparators(url.toLocalFile()) : url.toString(QUrl::FullyEncoded);
+ const QString nativeFilePath = url.isLocalFile() && !url.hasFragment() && !url.hasQuery()
+ ? QDir::toNativeSeparators(url.toLocalFile())
+ : url.toString(QUrl::FullyEncoded);
const quintptr result =
reinterpret_cast<quintptr>(ShellExecute(0, 0,
reinterpret_cast<const wchar_t *>(nativeFilePath.utf16()),