Android: Prefer "Droid Serif" as default serif font
I've also updated the qfont test so it passes on Android now. Note that there are no suitable cursive/fantasy fonts on Android, so the regular default "Roboto" (or "Droid Sans" on older devices) will be picked here instead. [ChangeLog][Android] Fixed font selection to prefer "Droid Serif" when Serif style hint is set on QFont. Change-Id: I294eebcc4d79410e435bdddce552acc6044753b2 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
parent
e899693aa4
commit
0cbebb21cc
@ -447,6 +447,7 @@ public class QtActivityDelegate
|
||||
|
||||
m_environmentVariables = loaderParams.getString(ENVIRONMENT_VARIABLES_KEY);
|
||||
String additionalEnvironmentVariables = "QT_ANDROID_FONTS_MONOSPACE=Droid Sans Mono;Droid Sans;Droid Sans Fallback"
|
||||
+ "\tQT_ANDROID_FONTS_SERIF=Droid Serif"
|
||||
+ "\tNECESSITAS_API_LEVEL=" + necessitasApiLevel
|
||||
+ "\tHOME=" + m_activity.getFilesDir().getAbsolutePath()
|
||||
+ "\tTMPDIR=" + m_activity.getFilesDir().getAbsolutePath();
|
||||
|
@ -86,6 +86,8 @@ QStringList QAndroidPlatformFontDatabase::fallbacksForFamily(const QString &fami
|
||||
|
||||
if (styleHint == QFont::Monospace || styleHint == QFont::Courier)
|
||||
return QString(qgetenv("QT_ANDROID_FONTS_MONOSPACE")).split(";") + m_fallbacks[script];
|
||||
else if (styleHint == QFont::Serif)
|
||||
return QString(qgetenv("QT_ANDROID_FONTS_SERIF")).split(";") + m_fallbacks[script];
|
||||
|
||||
return QString(qgetenv("QT_ANDROID_FONTS")).split(";") + m_fallbacks[script];
|
||||
}
|
||||
|
@ -624,11 +624,11 @@ void tst_QFont::defaultFamily_data()
|
||||
QTest::addColumn<QFont::StyleHint>("styleHint");
|
||||
QTest::addColumn<QStringList>("acceptableFamilies");
|
||||
|
||||
QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << getPlatformGenericFont("serif"));
|
||||
QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << getPlatformGenericFont("monospace"));
|
||||
QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << getPlatformGenericFont("cursive"));
|
||||
QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << getPlatformGenericFont("fantasy"));
|
||||
QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << getPlatformGenericFont("sans-serif"));
|
||||
QTest::newRow("serif") << QFont::Serif << (QStringList() << "Times New Roman" << "Times" << "Droid Serif" << getPlatformGenericFont("serif"));
|
||||
QTest::newRow("monospace") << QFont::Monospace << (QStringList() << "Courier New" << "Monaco" << "Droid Sans Mono" << getPlatformGenericFont("monospace"));
|
||||
QTest::newRow("cursive") << QFont::Cursive << (QStringList() << "Comic Sans MS" << "Apple Chancery" << "Roboto" << "Droid Sans" << getPlatformGenericFont("cursive"));
|
||||
QTest::newRow("fantasy") << QFont::Fantasy << (QStringList() << "Impact" << "Zapfino" << "Roboto" << "Droid Sans" << getPlatformGenericFont("fantasy"));
|
||||
QTest::newRow("sans-serif") << QFont::SansSerif << (QStringList() << "Arial" << "Lucida Grande" << "Roboto" << "Droid Sans" << getPlatformGenericFont("sans-serif"));
|
||||
}
|
||||
|
||||
void tst_QFont::defaultFamily()
|
||||
|
Loading…
Reference in New Issue
Block a user