diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-11 15:54:50 +0200 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-04-28 05:58:52 +0200 |
commit | 7b6b133746aa8bf23e08753851d7e23cc9d76170 (patch) | |
tree | 472044ff758e685d88618996fbccc76bbfe930b6 /src/gui/text/windows | |
parent | 852bb436057be518f864fb57fc1efc9d6a95f8c1 (diff) |
QtGui: use _L1 for for creating Latin-1 string literals
Task-number: QTBUG-98434
Change-Id: Idcb71c1d27125333a53b6bdd3e1af0d4c66617fa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/gui/text/windows')
-rw-r--r-- | src/gui/text/windows/qwindowsfontdatabase.cpp | 8 | ||||
-rw-r--r-- | src/gui/text/windows/qwindowsfontdatabase_ft.cpp | 13 | ||||
-rw-r--r-- | src/gui/text/windows/qwindowsfontdatabasebase.cpp | 4 |
3 files changed, 15 insertions, 10 deletions
diff --git a/src/gui/text/windows/qwindowsfontdatabase.cpp b/src/gui/text/windows/qwindowsfontdatabase.cpp index 8bac0eda41..039f6f5540 100644 --- a/src/gui/text/windows/qwindowsfontdatabase.cpp +++ b/src/gui/text/windows/qwindowsfontdatabase.cpp @@ -67,6 +67,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + #if QT_CONFIG(directwrite) static inline bool useDirectWrite(QFont::HintingPreference hintingPreference, const QString &familyName = QString(), @@ -78,7 +80,7 @@ static inline bool useDirectWrite(QFont::HintingPreference hintingPreference, // At some scales, GDI will misrender the MingLiU font, so we force use of // DirectWrite to work around the issue. - if (Q_UNLIKELY(familyName.startsWith(QLatin1String("MingLiU")))) + if (Q_UNLIKELY(familyName.startsWith("MingLiU"_L1))) return true; if (isColorFont) @@ -509,7 +511,7 @@ static bool addFontToDatabase(QString familyName, StoreFontPayload *sfp) { // the "@family" fonts are just the same as "family". Ignore them. - if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith(QLatin1String("WST_"))) + if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith("WST_"_L1)) return false; uchar charSet = logFont.lfCharSet; @@ -584,7 +586,7 @@ static bool addFontToDatabase(QString familyName, // display Thai text by default. As a temporary work around, we special case Segoe UI // and remove the Thai script from its list of supported writing systems. if (writingSystems.supported(QFontDatabase::Thai) && - familyName == QLatin1String("Segoe UI")) + familyName == "Segoe UI"_L1) writingSystems.setSupported(QFontDatabase::Thai, false); } else { const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet); diff --git a/src/gui/text/windows/qwindowsfontdatabase_ft.cpp b/src/gui/text/windows/qwindowsfontdatabase_ft.cpp index 6258535ac7..ce69cb4fc0 100644 --- a/src/gui/text/windows/qwindowsfontdatabase_ft.cpp +++ b/src/gui/text/windows/qwindowsfontdatabase_ft.cpp @@ -60,6 +60,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + static inline QFontDatabase::WritingSystem writingSystemFromCharSet(uchar charSet) { switch (charSet) { @@ -176,7 +178,7 @@ static bool addFontToDatabase(QString familyName, int type) { // the "@family" fonts are just the same as "family". Ignore them. - if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith(QLatin1String("WST_"))) + if (familyName.isEmpty() || familyName.at(0) == u'@' || familyName.startsWith("WST_"_L1)) return false; uchar charSet = logFont.lfCharSet; @@ -242,8 +244,7 @@ static bool addFontToDatabase(QString familyName, // Since it's the default UI font on this platform, most widgets will be unable to // display Thai text by default. As a temporary work around, we special case Segoe UI // and remove the Thai script from its list of supported writing systems. - if (writingSystems.supported(QFontDatabase::Thai) && - faceName == QLatin1String("Segoe UI")) + if (writingSystems.supported(QFontDatabase::Thai) && faceName == "Segoe UI"_L1) writingSystems.setSupported(QFontDatabase::Thai, false); } else { const QFontDatabase::WritingSystem ws = writingSystemFromCharSet(charSet); @@ -259,8 +260,8 @@ static bool addFontToDatabase(QString familyName, QLocale systemLocale = QLocale::system(); if (systemLocale.language() != QLocale::C && systemLocale.language() != QLocale::English - && styleName != QLatin1String("Italic") - && styleName != QLatin1String("Bold")) { + && styleName != "Italic"_L1 + && styleName != "Bold"_L1) { key = findFontKey(qt_getEnglishName(fullName, true), &index); } if (!key) @@ -431,7 +432,7 @@ QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QF } QString QWindowsFontDatabaseFT::fontDir() const { - const QString result = QLatin1String(qgetenv("windir")) + QLatin1String("/Fonts");//QPlatformFontDatabase::fontDir(); + const QString result = QLatin1String(qgetenv("windir")) + "/Fonts"_L1;//QPlatformFontDatabase::fontDir(); qCDebug(lcQpaFonts) << __FUNCTION__ << result; return result; } diff --git a/src/gui/text/windows/qwindowsfontdatabasebase.cpp b/src/gui/text/windows/qwindowsfontdatabasebase.cpp index 566941eca9..9d0797da1c 100644 --- a/src/gui/text/windows/qwindowsfontdatabasebase.cpp +++ b/src/gui/text/windows/qwindowsfontdatabasebase.cpp @@ -55,6 +55,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + // Helper classes for creating font engines directly from font data namespace { @@ -940,7 +942,7 @@ QFontDef QWindowsFontDatabaseBase::sanitizeRequest(QFontDef request) const if (fam.isEmpty()) req.families[0] = QStringLiteral("MS Sans Serif"); - if (fam == QLatin1String("MS Sans Serif")) { + if (fam == "MS Sans Serif"_L1) { int height = -qRound(request.pixelSize); // MS Sans Serif has bearing problems in italic, and does not scale if (request.style == QFont::StyleItalic || (height > 18 && height != 24)) |