From cc517d7cd983d9444e9690353ea7ca7ee30740ef Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 15 Aug 2016 13:14:05 +0200 Subject: QWindowsServices::openUrl(): Don't convert URLs with fragments/queries to local files Pass the URL instead. Task-number: QTBUG-55300 Change-Id: I4ce9171db5c1a9e07b17911729b165c115329664 Reviewed-by: Thiago Macieira --- src/plugins/platforms/windows/qwindowsservices.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index ae63ac46ae..1d23a9d9b9 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -51,8 +51,9 @@ enum { debug = 0 }; static inline bool shellExecute(const QUrl &url) { #ifndef Q_OS_WINCE - 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(ShellExecute(0, 0, reinterpret_cast(nativeFilePath.utf16()), -- cgit v1.2.3 From ec7fee968f5f1a842b7d2fe670de1d517ecca308 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 17 Aug 2016 11:45:59 +0200 Subject: Support stretch when using DirectWrite font engine The DirectWrite font we get when converting the GDI font does not respect the stretch we have set, as this is an attribute of the text layout in DirectWrite and not the font description. To compensate for this, we scale advances and glyphs in the engine if the stretch is different from 100%. [ChangeLog][QtGui][Windows] Fixed stretch when combined with either no or vertical hinting preference or a device pixel ratio different from 1. Task-number: QTBUG-54494 Change-Id: Icc06d1457191782d1a281c99da2da3081a82c542 Reviewed-by: Lars Knoll Reviewed-by: Friedemann Kleint --- .../platforms/windows/qwindowsfontenginedirectwrite.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index c5831dd2e1..04a08d892a 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -351,8 +351,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(); @@ -509,7 +510,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; @@ -528,6 +529,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; @@ -664,10 +669,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; -- cgit v1.2.3 From b8c1efcb887a2aa313fd843aa16a5be84d4189e6 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 17 Aug 2016 13:03:59 +0200 Subject: DirectWrite: Fix calculating bounding box of glyphs We don't support vertical text layouts in Qt, so the vertical advance should always be 0 (like it is in other engines). Since we were setting this, we would calculate the bounding box of strings in the DirectWrite engine as if the layouts were diagonal, adding up both the horizontal and vertical advances. [ChangeLog][QtGui][Windows] Fixed height of text bounding box when using no or vertical hinting preference, or when the device pixel ratio is different from 1. Task-number: QTBUG-51024 Change-Id: I329917eb8da71fdfdffe9651ca8f0f48d26b6a60 Reviewed-by: Lars Knoll Reviewed-by: Friedemann Kleint Reviewed-by: Konstantin Ritt --- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 04a08d892a..f2758f6d90 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -436,7 +436,7 @@ glyph_metrics_t QWindowsFontEngineDirectWrite::boundingBox(glyph_t g) width, height, advanceWidth, - advanceHeight); + 0); } else { qErrnoWarning("%s: GetDesignGlyphMetrics failed", __FUNCTION__); } -- cgit v1.2.3