From 58b928aca8029a4ebc63b0120a7afb93db4e8691 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 28 Feb 2014 11:59:30 +0100 Subject: Windows: Fix return value of WM_QUERYENDSESSION for bogus messages. LRESULT should be non-zero if the application can quit, and it is always handled. Improves 97d8e3b2007abf7b14b4ccbfbbc4abdeef712bcf . Task-number: QTBUG-35986 Change-Id: I0ad95bc20a5d9e2a52c76bdcdfa986595f6a08d8 Reviewed-by: Oliver Wolff Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowscontext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index f67fb9bc19..6462cb8d3e 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -971,8 +971,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, #if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) case QtWindows::QueryEndSessionApplicationEvent: { QWindowsSessionManager *sessionManager = platformSessionManager(); - if (sessionManager->isActive()) // bogus message from windows + if (sessionManager->isActive()) { // bogus message from windows + *result = sessionManager->wasCanceled() ? 0 : 1; return true; + } sessionManager->setActive(true); sessionManager->blocksInteraction(); -- cgit v1.2.3 From 4c7082162dd2192f535c1e524f966199883f53db Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sun, 2 Mar 2014 01:52:52 +0200 Subject: Unify QFontEngine::getSfntTableData() behavior on all platforms Being a most significant method in the font API, getSfntTableData() must behave in exactly the same way on all platforms. Briefly, it must return true if the table exists in the font, despite the other params, and always stores the table data length in 'length' param, thus reporting the amount of bytes actually needed to store the table data in a buffer. Change-Id: I7a15465020c1ea818ea46a05ea3b9b7e1cd60d14 Reviewed-by: Lars Knoll --- src/plugins/platforms/windows/qwindowsfontengine.cpp | 1 + src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 86fcb666b0..79615e79ec 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1032,6 +1032,7 @@ bool QWindowsFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) SelectObject(hdc, hfont); DWORD t = qbswap(tag); *length = GetFontData(hdc, t, 0, buffer, *length); + Q_ASSERT(*length == GDI_ERROR || int(*length) > 0); return *length != GDI_ERROR; } diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 1c5e4508ac..158eee6b38 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -282,8 +282,8 @@ bool QWindowsFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, ui ret = true; if (buffer && *length >= tableSize) memcpy(buffer, tableData, tableSize); - else - *length = tableSize; + *length = tableSize; + Q_ASSERT(int(*length) > 0); } m_directWriteFontFace->ReleaseFontTable(tableContext); } else { -- cgit v1.2.3 From 78d115f8f28a7e3f15c0280e8d87d7041ecff793 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 3 Mar 2014 05:57:40 +0200 Subject: Unify QFontEngine*::stringToCMap() behavior Ensure the params are valid and make QCoreTextFontEngine::stringToCMap() handle the unsufficient buffer case exactly like the other engines does. Change-Id: I078af37da917cf2bac709b12aa827ed4128e5f30 Reviewed-by: Lars Knoll --- src/plugins/platforms/windows/qwindowsfontengine.cpp | 1 + src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 79615e79ec..87eca98e44 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -351,6 +351,7 @@ HGDIOBJ QWindowsFontEngine::selectDesignFont() const bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 158eee6b38..a4e4dd38d4 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -318,6 +318,7 @@ inline unsigned int getChar(const QChar *str, int &i, const int len) bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; -- cgit v1.2.3 From af74201edbb9dc344419ed3f8ebc35f8e8f05617 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 3 Mar 2014 03:01:14 +0200 Subject: Introduce QFontEngine::glyphIndex(uint) ...an optimized drop-in replacement for the code like this: `stringToCMap(&uc, 1, &g, &numGlyphs, QFontEngine::GlyphIndicesOnly)` (aka "get the glyph index for exactly one Unicode character"). Change-Id: I22babf49f7cf28892d27533a5ac51ad449779f75 Reviewed-by: Lars Knoll --- .../platforms/windows/qwindowsfontengine.cpp | 24 ++++++++++++++++++++++ src/plugins/platforms/windows/qwindowsfontengine.h | 1 + .../windows/qwindowsfontenginedirectwrite.cpp | 13 ++++++++++++ .../windows/qwindowsfontenginedirectwrite.h | 1 + 4 files changed, 39 insertions(+) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 87eca98e44..a2f65c766d 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -340,6 +340,30 @@ QWindowsFontEngine::~QWindowsFontEngine() } } +glyph_t QWindowsFontEngine::glyphIndex(uint ucs4) const +{ + glyph_t glyph; + +#if !defined(Q_OS_WINCE) + if (symbol) { + glyph = getTrueTypeGlyphIndex(cmap, ucs4); + if (glyph == 0 && ucs4 < 0x100) + glyph = getTrueTypeGlyphIndex(cmap, ucs4 + 0xf000); + } else if (ttf) { + glyph = getTrueTypeGlyphIndex(cmap, ucs4); +#else + if (tm.tmFirstChar > 60000) { + glyph = ucs4; +#endif + } else if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) { + glyph = ucs4; + } else { + glyph = 0; + } + + return glyph; +} + HGDIOBJ QWindowsFontEngine::selectDesignFont() const { LOGFONT f = m_logfont; diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index e3fb3281a3..390de1d16e 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -86,6 +86,7 @@ public: virtual int synthesized() const; virtual QFixed emSquareSize() const; + virtual glyph_t glyphIndex(uint ucs4) const; virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; virtual void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const; diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index a4e4dd38d4..cd5defdfea 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -301,6 +301,19 @@ QFixed QWindowsFontEngineDirectWrite::emSquareSize() const return QFontEngine::emSquareSize(); } +glyph_t QWindowsFontEngineDirectWrite::glyphIndex(uint ucs4) const +{ + UINT16 glyphIndex; + + HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(&ucs4, 1, &glyphIndex); + if (FAILED(hr)) { + qErrnoWarning("%s: glyphIndex failed", __FUNCTION__); + glyphIndex = 0; + } + + return glyphIndex; +} + // ### Qt 5.1: replace with QStringIterator inline unsigned int getChar(const QChar *str, int &i, const int len) { diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index 399bb5f5ad..aacdcd5a89 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -74,6 +74,7 @@ public: bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; QFixed emSquareSize() const; + virtual glyph_t glyphIndex(uint ucs4) const; bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const; -- cgit v1.2.3 From 2b15c9c256e5be597cfc3e8165d9b1a9047cfa7c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 3 Mar 2014 06:37:29 +0200 Subject: Introduce a generic QFontEngine::canRender() implementation ...which uses the recently introduced glyphIndex() method; get rid of re-implementations that did almost the same. Change-Id: I6d32d2cee6a31f57de6aee05ed8d120d4a1f4e9c Reviewed-by: Lars Knoll --- .../platforms/windows/qwindowsfontengine.cpp | 29 ---------------------- src/plugins/platforms/windows/qwindowsfontengine.h | 2 -- .../windows/qwindowsfontenginedirectwrite.cpp | 23 ----------------- .../windows/qwindowsfontenginedirectwrite.h | 1 - 4 files changed, 55 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index a2f65c766d..264c22f47e 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -777,35 +777,6 @@ const char *QWindowsFontEngine::name() const return 0; } -bool QWindowsFontEngine::canRender(const QChar *string, int len) -{ - if (symbol) { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(string, i, len); - if (getTrueTypeGlyphIndex(cmap, uc) == 0) { - if (uc < 0x100) { - if (getTrueTypeGlyphIndex(cmap, uc + 0xf000) == 0) - return false; - } else { - return false; - } - } - } - } else if (ttf) { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(string, i, len); - if (getTrueTypeGlyphIndex(cmap, uc) == 0) - return false; - } - } else { - while(len--) { - if (tm.tmFirstChar > string->unicode() || tm.tmLastChar < string->unicode()) - return false; - } - } - return true; -} - QFontEngine::Type QWindowsFontEngine::type() const { return QFontEngine::Win; diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index 390de1d16e..89ad08f689 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -112,8 +112,6 @@ public: virtual const char *name() const; - bool canRender(const QChar *string, int len); - Type type() const; virtual QImage alphaMapForGlyph(glyph_t t) { return alphaMapForGlyph(t, QTransform()); } diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index cd5defdfea..744058279e 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -647,29 +647,6 @@ const char *QWindowsFontEngineDirectWrite::name() const return 0; } -bool QWindowsFontEngineDirectWrite::canRender(const QChar *string, int len) -{ - QVarLengthArray codePoints(len); - int actualLength = 0; - for (int i=0; i glyphIndices(actualLength); - HRESULT hr = m_directWriteFontFace->GetGlyphIndices(codePoints.data(), actualLength, - glyphIndices.data()); - if (FAILED(hr)) { - qErrnoWarning("%s: GetGlyphIndices failed", __FUNCTION__); - return false; - } - - for (int i = 0; i < actualLength; ++i) { - if (glyphIndices.at(i) == 0) - return false; - } - - return true; -} - QFontEngine::Type QWindowsFontEngineDirectWrite::type() const { return QFontEngine::DirectWrite; diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index aacdcd5a89..070adfcbde 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -99,7 +99,6 @@ public: QFontEngine *cloneWithSize(qreal pixelSize) const; - bool canRender(const QChar *string, int len); Type type() const; const QSharedPointer &fontEngineData() const { return m_fontEngineData; } -- cgit v1.2.3 From 21114bcc1f58696eef1164e6638d9f1bf7b700e2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 28 Feb 2014 17:10:55 +0100 Subject: Support QQuickWidget on Windows. Task-number: QTBUG-36887 Change-Id: Ifb03804e21fd82d7eae2942b9e8ca83f1bdb776c Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/windows/qwindowsbackingstore.cpp | 13 +++++++++++++ src/plugins/platforms/windows/qwindowsbackingstore.h | 4 ++++ src/plugins/platforms/windows/qwindowsintegration.cpp | 2 ++ src/plugins/platforms/windows/qwindowsnativeinterface.cpp | 7 ++++++- 4 files changed, 25 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index f12c828d8a..1abf447709 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -203,4 +203,17 @@ HDC QWindowsBackingStore::getDC() const return 0; } +#ifndef QT_NO_OPENGL + +QImage QWindowsBackingStore::toImage() const +{ + if (m_image.isNull()) { + qCWarning(lcQpaBackingStore) <<__FUNCTION__ << "Image is null."; + return QImage(); + } + return m_image.data()->image(); +} + +#endif // !QT_NO_OPENGL + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.h b/src/plugins/platforms/windows/qwindowsbackingstore.h index b655aca835..758f6c941f 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.h +++ b/src/plugins/platforms/windows/qwindowsbackingstore.h @@ -67,6 +67,10 @@ public: HDC getDC() const; +#ifndef QT_NO_OPENGL + QImage toImage() const Q_DECL_OVERRIDE; +#endif + private: QScopedPointer m_image; }; diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 3735865845..2a7a275060 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -245,6 +245,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case ForeignWindows: return true; + case RasterGLSurface: + return true; default: return QPlatformIntegration::hasCapability(cap); } diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index fb1b63084f..f6d01d7ef7 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -69,13 +69,18 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc QWindowsWindow *bw = static_cast(window->handle()); if (resource == "handle") return bw->handle(); - if (window->surfaceType() == QWindow::RasterSurface) { + switch (window->surfaceType()) { + case QWindow::RasterSurface: + case QWindow::RasterGLSurface: if (resource == "getDC") return bw->getDC(); if (resource == "releaseDC") { bw->releaseDC(); return 0; } + break; + case QWindow::OpenGLSurface: + break; } qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData()); return 0; -- cgit v1.2.3 From 4b2f35d04ca3c2e037b4d0edd8b2350051cc572c Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 28 Feb 2014 17:03:57 +0100 Subject: Dynamic GL: remove exporting symbols MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the opengl proxy for now. Later it will either be moved into a separate library or replaced by a QOpenGLFunctions-based approach. This means that the -opengl dynamic configuration is not usable for the time being. The rest of the enablers remain in place. The convenience function QOpenGLFunctions::isES() is now moved to QOpenGLContext and is changed to check the renderable type. This is extremely useful since besides supporting dynamic GL it solves also the problem of GL_ARB_ES2_compatibility (i.e. it triggers the real ES path when creating an ES-compatible context with a desktop OpenGL implementation). Task-number: QTBUG-36483 Task-number: QTBUG-37172 Change-Id: I045be3fc16e9043e1528cf48e6bf0903da4fa7ca Reviewed-by: Friedemann Kleint Reviewed-by: Jørgen Lind --- src/plugins/platforms/windows/qwindowsintegration.cpp | 7 ++++--- src/plugins/platforms/windows/qwindowsnativeinterface.cpp | 4 ++-- src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 2a7a275060..64a842d492 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -234,7 +234,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case ThreadedOpenGL: #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - return QOpenGLFunctions::isES() ? QWindowsEGLContext::hasThreadedOpenGLCapability() : true; + return QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL + ? QWindowsEGLContext::hasThreadedOpenGLCapability() : true; # else return true; # endif // QT_OPENGL_ES_2 @@ -298,7 +299,7 @@ QPlatformOpenGLContext { qCDebug(lcQpaGl) << __FUNCTION__ << context->format(); #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()){ + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) { if (d->m_staticEGLContext.isNull()) { QWindowsEGLStaticContext *staticContext = QWindowsEGLStaticContext::create(); if (!staticContext) @@ -309,7 +310,7 @@ QPlatformOpenGLContext } #endif #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { if (d->m_staticOpenGLContext.isNull()) d->m_staticOpenGLContext = QSharedPointer(QOpenGLStaticContext::create()); diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index f6d01d7ef7..7e15be1d19 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -125,7 +125,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour return 0; } #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) { QWindowsEGLContext *windowsEglContext = static_cast(context->handle()); if (resource == QByteArrayLiteral("eglDisplay")) return windowsEglContext->eglDisplay(); @@ -136,7 +136,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour } #endif // QT_OPENGL_ES_2 || QT_OPENGL_DYNAMIC #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { QWindowsGLContext *windowsContext = static_cast(context->handle()); if (resource == QByteArrayLiteral("renderingContext")) return windowsContext->renderingContext(); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index d77f587b92..3cf9481c17 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -880,7 +880,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) if (aWindow->surfaceType() == QWindow::OpenGLSurface) { setFlag(OpenGLSurface); #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()) + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) setFlag(OpenGL_ES2); #endif } -- cgit v1.2.3 From e69284db08966cbe907df4b3cdc58fb9f9ee5dc4 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 5 Mar 2014 08:34:46 +0200 Subject: Get rid of QFontEngine::name() It was only used in QFontCache debug output, and some engines weren't even report a name. Change-Id: I6cec4b75f105f5a4e1405f50188bebb3a3f04e33 Reviewed-by: Lars Knoll --- src/plugins/platforms/windows/qwindowsfontengine.cpp | 6 ------ src/plugins/platforms/windows/qwindowsfontengine.h | 2 -- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 5 ----- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h | 2 -- 4 files changed, 15 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 264c22f47e..cc2f152bf9 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -771,12 +771,6 @@ qreal QWindowsFontEngine::minRightBearing() const #endif // Q_OS_WINCE } - -const char *QWindowsFontEngine::name() const -{ - return 0; -} - QFontEngine::Type QWindowsFontEngine::type() const { return QFontEngine::Win; diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index 89ad08f689..b534798958 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -110,8 +110,6 @@ public: virtual qreal minLeftBearing() const; virtual qreal minRightBearing() const; - virtual const char *name() const; - Type type() const; virtual QImage alphaMapForGlyph(glyph_t t) { return alphaMapForGlyph(t, QTransform()); } diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 744058279e..665e767786 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -642,11 +642,6 @@ QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t, : mask.convertToFormat(QImage::Format_RGB32); } -const char *QWindowsFontEngineDirectWrite::name() const -{ - return 0; -} - QFontEngine::Type QWindowsFontEngineDirectWrite::type() const { return QFontEngine::DirectWrite; diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index 070adfcbde..c61f1a0635 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -90,8 +90,6 @@ public: QFixed xHeight() const; qreal maxCharWidth() const; - const char *name() const; - bool supportsSubPixelPositions() const; QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition); -- cgit v1.2.3 From 9f1089531d75b0a831e03c3a31ef8b4e5c0b54f4 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Wed, 5 Mar 2014 09:00:31 +0200 Subject: Make QFontEngine::type() non-virtual Change-Id: I24ece90d6d8f96dad0c41a474a491b4ea96d97c3 Reviewed-by: Lars Knoll --- src/plugins/platforms/windows/qwindowsfontengine.cpp | 8 ++------ src/plugins/platforms/windows/qwindowsfontengine.h | 2 -- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp | 9 ++------- src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h | 2 -- 4 files changed, 4 insertions(+), 17 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index cc2f152bf9..e8e2978ee3 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -272,7 +272,8 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa QWindowsFontEngine::QWindowsFontEngine(const QString &name, HFONT _hfont, bool stockFontIn, LOGFONT lf, - const QSharedPointer &fontEngineData) : + const QSharedPointer &fontEngineData) + : QFontEngine(Win), m_fontEngineData(fontEngineData), _name(name), hfont(_hfont), @@ -771,11 +772,6 @@ qreal QWindowsFontEngine::minRightBearing() const #endif // Q_OS_WINCE } -QFontEngine::Type QWindowsFontEngine::type() const -{ - return QFontEngine::Win; -} - static inline double qt_fixed_to_double(const FIXED &p) { return ((p.value << 16) + p.fract) / 65536.0; } diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index b534798958..0a40082ad2 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -110,8 +110,6 @@ public: virtual qreal minLeftBearing() const; virtual qreal minRightBearing() const; - Type type() const; - virtual QImage alphaMapForGlyph(glyph_t t) { return alphaMapForGlyph(t, QTransform()); } virtual QImage alphaMapForGlyph(glyph_t, const QTransform &xform); virtual QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform); diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 665e767786..b6b554d4b0 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -201,8 +201,8 @@ namespace { QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace, qreal pixelSize, const QSharedPointer &d) - - : m_fontEngineData(d) + : QFontEngine(DirectWrite) + , m_fontEngineData(d) , m_directWriteFontFace(directWriteFontFace) , m_directWriteBitmapRenderTarget(0) , m_lineThickness(-1) @@ -642,11 +642,6 @@ QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t, : mask.convertToFormat(QImage::Format_RGB32); } -QFontEngine::Type QWindowsFontEngineDirectWrite::type() const -{ - return QFontEngine::DirectWrite; -} - QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const { QFontEngine *fontEngine = new QWindowsFontEngineDirectWrite(m_directWriteFontFace, diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index c61f1a0635..2da014ddc3 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -97,8 +97,6 @@ public: QFontEngine *cloneWithSize(qreal pixelSize) const; - Type type() const; - const QSharedPointer &fontEngineData() const { return m_fontEngineData; } static QString fontNameSubstitute(const QString &familyName); -- cgit v1.2.3 From bc361899f214a6ecb2603ed92bb8dd6ac4c0f086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Nowacki?= Date: Tue, 4 Mar 2014 15:43:02 +0100 Subject: Remove unused and unlinked qdocconf file from src/plugins. Change-Id: Ie6fd3f9fe7d5bbbe948dd3d38d2be835fd92834d Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/windows/qwindows.qdocconf | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 src/plugins/platforms/windows/qwindows.qdocconf (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindows.qdocconf b/src/plugins/platforms/windows/qwindows.qdocconf deleted file mode 100644 index 1684773b87..0000000000 --- a/src/plugins/platforms/windows/qwindows.qdocconf +++ /dev/null @@ -1,25 +0,0 @@ -project = "Qt Windows Lighthouse Plugin" -description = "Documentation of the Qt Windows Lighthouse Plugin" - -language = Cpp - -headerdirs = . - -sourcedirs = . - -showinternal = true - -headers.fileextensions = "*.h" -sources.fileextensions = "*.cpp *.qdoc" - -qhp.projects = QtLighthouseWindows -qhp.QtLighthouseWindowsDev.file = qtlighthousewindows-dev.qhp -qhp.QtLighthouseWindowsDev.namespace = com.nokia.qt.developer.lighthouse -qhp.QtLighthouseWindowsDev.virtualFolder = doc -qhp.QtLighthouseWindowsDev.indexTitle = Qt Windows Lighthouse Plugin -qhp.QtLighthouseWindowsDev.indexRoot = - -# Doxygen compatibility commands - -macro.see = "\\sa" -macro.function = "\\fn" -- cgit v1.2.3 From 275dcd61d30a59a6144c5ba40ae853cca463b173 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 5 Mar 2014 11:58:07 +0100 Subject: Fix cursor blink time in Windows In Qt 4 there is a factor of 2 in qapplication_win.cpp, this got lost, so all our cursors were blinking twice as fast. Task-number: QTBUG-37200 Change-Id: I11ce61c51279d9ceb8bc9ba01c1bb9640a31ade8 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 64a842d492..e0e8753e14 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -382,7 +382,7 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co switch (hint) { case QPlatformIntegration::CursorFlashTime: if (const unsigned timeMS = GetCaretBlinkTime()) - return QVariant(int(timeMS)); + return QVariant(int(timeMS) * 2); break; #ifdef SPI_GETKEYBOARDSPEED case KeyboardAutoRepeatRate: -- cgit v1.2.3 From 4c9d767f6ebe20188b56c51d1c9af5d193a29b6b Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 12:07:25 +0100 Subject: Avoid asserting with QQuickWidget on Windows Change-Id: I8b4185a9725b27b3e3e0e049e3a001ed61bcf1d5 Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/windows/qwindowsglcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 9bfe4e6e26..c45c34ae4d 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -1050,7 +1050,7 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface) qCDebug(lcQpaGl) << __FUNCTION__ << this << m_windowContexts.size() << "contexts"; #endif // DEBUG_GL - Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface); + Q_ASSERT(surface->surface()->supportsOpenGL()); // Do we already have a DC entry for that window? QWindowsWindow *window = static_cast(surface); -- cgit v1.2.3 From 11eb9d37dc191b6e71c903e4f7f4d2da579e7df5 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 6 Mar 2014 12:02:25 +0200 Subject: Use QStringIterator instead of homebrew Task-number: QTBUG-15664 Change-Id: I1ed3eb04ddd822e57a4d993af656dfe283f3af1a Reviewed-by: Lars Knoll --- .../platforms/windows/qwindowsfontengine.cpp | 34 +++++++++------------- .../windows/qwindowsfontenginedirectwrite.cpp | 20 +++---------- 2 files changed, 17 insertions(+), 37 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index e8e2978ee3..6f0a4f9ea5 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -65,6 +65,7 @@ #include #include #include +#include #include @@ -205,47 +206,37 @@ void QWindowsFontEngine::getCMap() } } -// ### Qt 5.1: replace with QStringIterator -inline unsigned int getChar(const QChar *str, int &i, const int len) -{ - uint uc = str[i].unicode(); - if (QChar::isHighSurrogate(uc) && i < len-1) { - uint low = str[i+1].unicode(); - if (QChar::isLowSurrogate(low)) { - uc = QChar::surrogateToUcs4(uc, low); - ++i; - } - } - return uc; -} - int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout *glyphs) const { - int i = 0; int glyph_pos = 0; { #if defined(Q_OS_WINCE) { #else if (symbol) { - for (; i < numChars; ++i, ++glyph_pos) { - unsigned int uc = getChar(str, i, numChars); + QStringIterator it(str, str + numChars); + while (it.hasNext()) { + const uint uc = it.next(); glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); if(!glyphs->glyphs[glyph_pos] && uc < 0x100) glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000); + ++glyph_pos; } } else if (ttf) { - for (; i < numChars; ++i, ++glyph_pos) { - unsigned int uc = getChar(str, i, numChars); + QStringIterator it(str, str + numChars); + while (it.hasNext()) { + const uint uc = it.next(); glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); + ++glyph_pos; } } else { #endif wchar_t first = tm.tmFirstChar; wchar_t last = tm.tmLastChar; - for (; i < numChars; ++i, ++glyph_pos) { - uint uc = getChar(str, i, numChars); + QStringIterator it(str, str + numChars); + while (it.hasNext()) { + const uint uc = it.next(); if ( #ifdef Q_WS_WINCE tm.tmFirstChar > 60000 || @@ -254,6 +245,7 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa glyphs->glyphs[glyph_pos] = uc; else glyphs->glyphs[glyph_pos] = 0; + ++glyph_pos; } } } diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index b6b554d4b0..8f55e20536 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -314,20 +315,6 @@ glyph_t QWindowsFontEngineDirectWrite::glyphIndex(uint ucs4) const return glyphIndex; } -// ### Qt 5.1: replace with QStringIterator -inline unsigned int getChar(const QChar *str, int &i, const int len) -{ - uint uc = str[i].unicode(); - if (QChar::isHighSurrogate(uc) && i < len-1) { - uint low = str[i+1].unicode(); - if (QChar::isLowSurrogate(low)) { - uc = QChar::surrogateToUcs4(uc, low); - ++i; - } - } - return uc; -} - bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { @@ -339,8 +326,9 @@ bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGly QVarLengthArray codePoints(len); int actualLength = 0; - for (int i = 0; i < len; ++i) - codePoints[actualLength++] = getChar(str, i, len); + QStringIterator it(str, str + len); + while (it.hasNext()) + codePoints[actualLength++] = it.next(); QVarLengthArray glyphIndices(actualLength); HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(codePoints.data(), actualLength, -- cgit v1.2.3 From 5aaec4800066801f069dfb4606c5d9551a9b8110 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 7 Mar 2014 13:11:20 +0100 Subject: Remove unused parameter from QEGLPlatformContext constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API is chosen via QSurfaceFormat, the constructor argument is ignored. Remove this historical artifact. Change-Id: I4a5c1e12cb297de22f239ad0a6747c1c36168eed Reviewed-by: Jørgen Lind --- src/plugins/platforms/windows/qwindowseglcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index e025d7e513..d5ca06bb3f 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -124,7 +124,7 @@ QWindowsEGLStaticContext::~QWindowsEGLStaticContext() QWindowsEGLContext::QWindowsEGLContext(const QWindowsEGLStaticContextPtr &staticContext, const QSurfaceFormat &format, QPlatformOpenGLContext *share) - : QEGLPlatformContext(format, share, staticContext->display(), EGL_OPENGL_ES_API) + : QEGLPlatformContext(format, share, staticContext->display()) , m_staticContext(staticContext) { } -- cgit v1.2.3 From c3b2425791ec1e17a8b1e2f5b35b8e79176fc9c4 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 7 Mar 2014 02:46:45 +0200 Subject: Guarantee QPFDB::fontEngine() always return non-multi font engine After QPA refactoring, QWindowsFontDatabase::fontEngine() was returning a multi font engine w/o any particular reason. This makes the code more obvious and opens the road to further improvements. Change-Id: I4858026ddf774d3159c89357b1c905f5112b1c51 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- .../platforms/windows/qwindowsfontdatabase.cpp | 34 +++++++++------------- .../platforms/windows/qwindowsfontdatabase.h | 4 +-- .../platforms/windows/qwindowsfontengine.cpp | 30 +++++++++++-------- src/plugins/platforms/windows/qwindowsfontengine.h | 5 ++-- 4 files changed, 37 insertions(+), 36 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 854444b254..8f9ddc2168 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1038,11 +1038,17 @@ QWindowsFontDatabase::~QWindowsFontDatabase() removeApplicationFonts(); } +QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) +{ + Q_UNUSED(script) + return new QWindowsMultiFontEngine(fontEngine, QStringList()); +} + QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) { - QFontEngine *fe = QWindowsFontDatabase::createEngine(QChar::Script_Common, fontDef, - 0, QWindowsContext::instance()->defaultDPI(), false, - QStringList(), sharedFontData()); + QFontEngine *fe = QWindowsFontDatabase::createEngine(fontDef, 0, + QWindowsContext::instance()->defaultDPI(), + false, sharedFontData()); qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << fe << handle; return fe; } @@ -1087,12 +1093,12 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal QFontDef request; request.family = uniqueFamilyName; request.pixelSize = pixelSize; - request.styleStrategy = QFont::NoFontMerging | QFont::PreferMatch; + request.styleStrategy = QFont::PreferMatch; request.hintingPreference = hintingPreference; - fontEngine = QWindowsFontDatabase::createEngine(QChar::Script_Common, request, 0, - QWindowsContext::instance()->defaultDPI(), false, QStringList(), - sharedFontData()); + fontEngine = QWindowsFontDatabase::createEngine(request, 0, + QWindowsContext::instance()->defaultDPI(), + false, sharedFontData()); if (fontEngine) { if (request.family != fontEngine->fontDef.family) { @@ -1623,9 +1629,8 @@ QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFon } -QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &request, +QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, HDC fontHdc, int dpi, bool rawMode, - const QStringList &family_list, const QSharedPointer &data) { LOGFONT lf; @@ -1769,17 +1774,6 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ directWriteFont->Release(); #endif - if ((script == QChar::Script_Common || script == QChar::Script_Han) - && !(request.styleStrategy & QFont::NoFontMerging)) { - const QStringList extraFonts = QWindowsFontDatabase::extraTryFontsForFamily(request.family); - if (extraFonts.size()) { - QStringList list = family_list; - list.append(extraFonts); - QFontEngine *mfe = new QWindowsMultiFontEngine(fe, list); - mfe->fontDef = fe->fontDef; - fe = mfe; - } - } return fe; } diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h index 1e13fc2559..a2324544d2 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.h +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h @@ -78,6 +78,7 @@ public: ~QWindowsFontDatabase(); virtual void populateFontDatabase(); + virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script); virtual QFontEngine *fontEngine(const QFontDef &fontDef, void *handle); virtual QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); virtual QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; @@ -92,9 +93,8 @@ public: static QFont systemDefaultFont(); - static QFontEngine *createEngine(int script, const QFontDef &request, + static QFontEngine *createEngine(const QFontDef &request, HDC fontHdc, int dpi, bool rawMode, - const QStringList &family_list, const QSharedPointer &data); static HFONT systemFont(); diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 6f0a4f9ea5..c3774064e3 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1233,15 +1233,11 @@ QFontEngine *QWindowsFontEngine::cloneWithSize(qreal pixelSize) const if (!uniqueFamilyName.isEmpty()) request.family = uniqueFamilyName; request.pixelSize = pixelSize; - // Disable font merging, as otherwise createEngine will return a multi-engine - // instance instead of the specific engine we wish to clone. - request.styleStrategy |= QFont::NoFontMerging; QFontEngine *fontEngine = - QWindowsFontDatabase::createEngine(QChar::Script_Common, request, 0, + QWindowsFontDatabase::createEngine(request, 0, QWindowsContext::instance()->defaultDPI(), - false, - QStringList(), m_fontEngineData); + false, m_fontEngineData); if (fontEngine) { fontEngine->fontDef.family = actualFontName; if (!uniqueFamilyName.isEmpty()) { @@ -1284,19 +1280,29 @@ void QWindowsFontEngine::initFontInfo(const QFontDef &request, */ QWindowsMultiFontEngine::QWindowsMultiFontEngine(QFontEngine *first, const QStringList &fallbacks) - : QFontEngineMulti(fallbacks.size()+1), - fallbacks(fallbacks) + : QFontEngineMulti(fallbacks.size() + 1), + fallbackFamilies(fallbacks) { - qCDebug(lcQpaFonts) << __FUNCTION__ << engines.size() << first << first->fontDef.family << fallbacks; engines[0] = first; first->ref.ref(); fontDef = engines[0]->fontDef; cache_cost = first->cache_cost; } -QWindowsMultiFontEngine::~QWindowsMultiFontEngine() +void QWindowsMultiFontEngine::setFallbackFamiliesList(const QStringList &fallbacks) { - qCDebug(lcQpaFonts) << __FUNCTION__; + // Original FontEngine to restore after the fill. + QFontEngine *fe = engines[0]; + fallbackFamilies = fallbacks; + if (!fallbackFamilies.isEmpty()) { + engines.fill(0, fallbackFamilies.size() + 1); + engines[0] = fe; + } else { + // Turns out we lied about having any fallback at all. + fallbackFamilies << fe->fontDef.family; + engines[1] = fe; + fe->ref.ref(); + } } void QWindowsMultiFontEngine::loadEngine(int at) @@ -1323,7 +1329,7 @@ void QWindowsMultiFontEngine::loadEngine(int at) data = fe->fontEngineData(); } - const QString fam = fallbacks.at(at-1); + const QString fam = fallbackFamilies.at(at-1); memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded #ifndef QT_NO_DIRECTWRITE diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index 0a40082ad2..7d93484220 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -170,10 +170,11 @@ class QWindowsMultiFontEngine : public QFontEngineMulti { public: QWindowsMultiFontEngine(QFontEngine *first, const QStringList &fallbacks); - virtual ~QWindowsMultiFontEngine(); + + void setFallbackFamiliesList(const QStringList &fallbacks); void loadEngine(int at); - QStringList fallbacks; + QStringList fallbackFamilies; }; QT_END_NAMESPACE -- cgit v1.2.3