Fix Japan locale not showing japanese fonts correctly
Fallback font determination did not take locale into account when Japanese locale was used. Android devices show Chinese fonts instead. Fixes the problem by prepending japanese defaut "Noto Sans Mono CJK ..." type font before other fonts. Does same for Chinese and Korean locales. Fixes: QTBUG-111528 Pick-to: 6.5 6.2 5.15 Change-Id: I70994c0059c3819eeb09dacb9bbe6634490ecf37 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 476e8f8aef52592d3908b9d5cf6711af7a7d631d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
2c58f1770a
commit
c6a86b6164
@ -2,6 +2,7 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
#include <QDir>
|
||||
#include <QLocale>
|
||||
|
||||
#include "qandroidplatformfontdatabase.h"
|
||||
|
||||
@ -47,6 +48,38 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami
|
||||
QChar::Script script) const
|
||||
{
|
||||
QStringList result;
|
||||
|
||||
// Prepend CJK fonts by the locale.
|
||||
QLocale locale = QLocale::system();
|
||||
switch (locale.language()) {
|
||||
case QLocale::Chinese: {
|
||||
switch (locale.territory()) {
|
||||
case QLocale::China:
|
||||
case QLocale::Singapore:
|
||||
result.append(QStringLiteral("Noto Sans Mono CJK SC"));
|
||||
break;
|
||||
case QLocale::Taiwan:
|
||||
case QLocale::HongKong:
|
||||
case QLocale::Macao:
|
||||
result.append(QStringLiteral("Noto Sans Mono CJK TC"));
|
||||
break;
|
||||
default:
|
||||
// no modifications.
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QLocale::Japanese:
|
||||
result.append(QStringLiteral("Noto Sans Mono CJK JP"));
|
||||
break;
|
||||
case QLocale::Korean:
|
||||
result.append(QStringLiteral("Noto Sans Mono CJK KR"));
|
||||
break;
|
||||
default:
|
||||
// no modifications.
|
||||
break;
|
||||
}
|
||||
|
||||
if (styleHint == QFont::Monospace || styleHint == QFont::Courier)
|
||||
result.append(QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(u';'));
|
||||
else if (styleHint == QFont::Serif)
|
||||
|
Loading…
x
Reference in New Issue
Block a user