diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-02-19 15:43:37 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-02-19 17:09:10 +0000 |
commit | 1ffce57157c7a6ce7fb9d58776ee1dacd2ded61b (patch) | |
tree | fd357c6d105365df6c4c8e06b38b0f642a123242 /src/plugins | |
parent | a5ec7163f97fe6e04bb921eb98c6da48659fc09a (diff) |
Windows DirectWrite: Improve error messages for font engine creation.
Fix up debug operator for QFontDef, add one for LOGFONT and output
both should creation fail.
Task-number: QTBUG-51260
Change-Id: I5cbcd392edd811c6b9470ddbb095d41a9185d208
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 322ba0ec27..05e5af418a 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -634,11 +634,24 @@ QDebug operator<<(QDebug d, const QFontDef &def) { QDebugStateSaver saver(d); d.nospace(); - d << "Family=" << def.family << " Stylename=" << def.styleName - << " pointsize=" << def.pointSize << " pixelsize=" << def.pixelSize - << " styleHint=" << def.styleHint << " weight=" << def.weight - << " stretch=" << def.stretch << " hintingPreference=" - << def.hintingPreference; + d.noquote(); + d << "QFontDef(Family=\"" << def.family << '"'; + if (!def.styleName.isEmpty()) + d << ", stylename=" << def.styleName; + d << ", pointsize=" << def.pointSize << ", pixelsize=" << def.pixelSize + << ", styleHint=" << def.styleHint << ", weight=" << def.weight + << ", stretch=" << def.stretch << ", hintingPreference=" + << def.hintingPreference << ')'; + return d; +} + +QDebug operator<<(QDebug d, const LOGFONT &lf) +{ + QDebugStateSaver saver(d); + d.nospace(); + d.noquote(); + d << "LOGFONT(\"" << QString::fromWCharArray(lf.lfFaceName) + << "\", lfWidth=" << lf.lfWidth << ", lfHeight=" << lf.lfHeight << ')'; return d; } #endif // !QT_NO_DEBUG_STREAM @@ -1752,12 +1765,16 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, IDWriteFont *directWriteFont = 0; HRESULT hr = data->directWriteGdiInterop->CreateFontFromLOGFONT(&lf, &directWriteFont); if (FAILED(hr)) { - qErrnoWarning("%s: CreateFontFromLOGFONT failed", __FUNCTION__); + const QString errorString = qt_error_string(int(GetLastError())); + qWarning().noquote().nospace() << "DirectWrite: CreateFontFromLOGFONT() failed (" + << errorString << ") for " << request << ' ' << lf << " dpi=" << dpi; } else { IDWriteFontFace *directWriteFontFace = NULL; hr = directWriteFont->CreateFontFace(&directWriteFontFace); if (FAILED(hr)) { - qErrnoWarning("%s: CreateFontFace failed", __FUNCTION__); + const QString errorString = qt_error_string(int(GetLastError())); + qWarning().noquote() << "DirectWrite: CreateFontFace() failed (" + << errorString << ") for " << request << ' ' << lf << " dpi=" << dpi; } else { QWindowsFontEngineDirectWrite *fedw = new QWindowsFontEngineDirectWrite(directWriteFontFace, request.pixelSize, |