diff options
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontdatabase.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 3a6f9f72e3..c273219181 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -857,19 +857,20 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, const QFont::Stretch stretch = QFont::Unstretched; #ifndef QT_NO_DEBUG_OUTPUT - if (QWindowsContext::verboseFonts > 2) { - QDebug nospace = qDebug().nospace(); - nospace << __FUNCTION__ << familyName << charSet - << "TTF=" << ttf; + if (QWindowsContext::verbose > 2) { + QString message; + QTextStream str(&message); + str << __FUNCTION__ << ' ' << familyName << ' ' << charSet << " TTF=" << ttf; if (type & DEVICE_FONTTYPE) - nospace << " DEVICE"; + str << " DEVICE"; if (type & RASTER_FONTTYPE) - nospace << " RASTER"; + str << " RASTER"; if (type & TRUETYPE_FONTTYPE) - nospace << " TRUETYPE"; - nospace << " scalable=" << scalable << " Size=" << size + str << " TRUETYPE"; + str << " scalable=" << scalable << " Size=" << size << " Style=" << style << " Weight=" << weight << " stretch=" << stretch; + qCDebug(lcQpaFonts) << message; } #endif @@ -973,8 +974,7 @@ void QWindowsFontDatabase::populateFontDatabase() void QWindowsFontDatabase::populate(const QString &family) { - if (QWindowsContext::verboseFonts) - qDebug() << __FUNCTION__ << m_families.size() << family; + qCDebug(lcQpaFonts) << __FUNCTION__ << m_families.size() << family; HDC dummy = GetDC(0); LOGFONT lf; @@ -1026,11 +1026,10 @@ QWindowsFontDatabase::QWindowsFontDatabase() Q_UNUSED(hfontMetaTypeId) Q_UNUSED(logFontMetaTypeId) - if (QWindowsContext::verboseFonts) { + if (lcQpaFonts().isDebugEnabled()) { const QWindowsFontEngineDataPtr data = sharedFontData(); - qDebug() << __FUNCTION__ << "Clear type: " - << data->clearTypeEnabled << "gamma: " - << data->fontSmoothingGamma; + qCDebug(lcQpaFonts) << __FUNCTION__ << "Clear type: " + << data->clearTypeEnabled << "gamma: " << data->fontSmoothingGamma; } } @@ -1044,8 +1043,7 @@ QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, QChar::S QFontEngine *fe = QWindowsFontDatabase::createEngine(script, fontDef, 0, QWindowsContext::instance()->defaultDPI(), false, QStringList(), sharedFontData()); - if (QWindowsContext::verboseFonts) - qDebug() << __FUNCTION__ << "FONTDEF" << fontDef << script << fe << handle; + qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << script << fe << handle; return fe; } @@ -1200,8 +1198,7 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal } } - if (QWindowsContext::verboseFonts) - qDebug() << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fontEngine; + qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDATA" << fontData << pixelSize << hintingPreference << fontEngine; return fontEngine; } @@ -1361,17 +1358,14 @@ void QWindowsFontDatabase::removeApplicationFonts() m_applicationFonts.clear(); } -void QWindowsFontDatabase::releaseHandle(void *handle) +void QWindowsFontDatabase::releaseHandle(void * /* handle */) { - if (handle && QWindowsContext::verboseFonts) - qDebug() << __FUNCTION__ << handle; } QString QWindowsFontDatabase::fontDir() const { const QString result = QPlatformFontDatabase::fontDir(); - if (QWindowsContext::verboseFonts) - qDebug() << __FUNCTION__ << result; + qCDebug(lcQpaFonts) << __FUNCTION__ << result; return result; } @@ -1550,7 +1544,7 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) return lf; } -static QStringList extraTryFontsForFamily(const QString& family) +QStringList QWindowsFontDatabase::extraTryFontsForFamily(const QString &family) { QStringList result; QFontDatabase db; @@ -1620,11 +1614,11 @@ QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFon result << QString::fromLatin1("Arial"); } - result.append(extraTryFontsForFamily(family)); + if (script == QChar::Script_Common || script == QChar::Script_Han) + result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); - if (QWindowsContext::verboseFonts) - qDebug() << __FUNCTION__ << family << style << styleHint - << script << result << m_families.size(); + qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint + << script << result << m_families.size(); return result; } @@ -1785,7 +1779,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ if ((script == QChar::Script_Common || script == QChar::Script_Han) && !(request.styleStrategy & QFont::NoFontMerging)) { - QStringList extraFonts = extraTryFontsForFamily(request.family); + const QStringList extraFonts = QWindowsFontDatabase::extraTryFontsForFamily(request.family); if (extraFonts.size()) { QStringList list = family_list; list.append(extraFonts); @@ -1810,8 +1804,7 @@ QFont QWindowsFontDatabase::systemDefaultFont() // "MS Shell Dlg 2" is the correct system font >= Win2k if (systemFont.family() == QStringLiteral("MS Shell Dlg")) systemFont.setFamily(QStringLiteral("MS Shell Dlg 2")); - if (QWindowsContext::verboseFonts) - qDebug() << __FUNCTION__ << systemFont; + qCDebug(lcQpaFonts) << __FUNCTION__ << systemFont; return systemFont; } @@ -1825,9 +1818,9 @@ QFont QWindowsFontDatabase::LOGFONT_to_QFont(const LOGFONT& logFont, int vertica qFont.setWeight(weightFromInteger(logFont.lfWeight)); const qreal logFontHeight = qAbs(logFont.lfHeight); qFont.setPointSizeF(logFontHeight * 72.0 / qreal(verticalDPI_In)); - qFont.setUnderline(false); + qFont.setUnderline(logFont.lfUnderline); qFont.setOverline(false); - qFont.setStrikeOut(false); + qFont.setStrikeOut(logFont.lfStrikeOut); return qFont; } |