diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2021-01-14 03:54:28 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-01-19 12:35:29 -0800 |
commit | 11ae6625459f93613c233842ef4b25925f38a870 (patch) | |
tree | 6f13d839882f29d9ca9d8ae01ced79918cfaef44 /subsurface-helper.cpp | |
parent | ecf3ac12eb7f93e2c0f214af8c1271087df3bac1 (diff) | |
download | subsurface-11ae6625459f93613c233842ef4b25925f38a870.tar.gz |
mobile/Android: ensure the onePlus font has point size
Otherwise this throws off the calculation of the gridUnit on onePlus
devices.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-helper.cpp')
-rw-r--r-- | subsurface-helper.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/subsurface-helper.cpp b/subsurface-helper.cpp index c3249f03f..6b92fe203 100644 --- a/subsurface-helper.cpp +++ b/subsurface-helper.cpp @@ -25,6 +25,7 @@ #include "profile-widget/qmlprofile.h" #include "core/downloadfromdcthread.h" #include "core/subsurfacestartup.h" // for testqml +#include "core/metrics.h" #include "qt-models/diveimportedmodel.h" #else #include "desktop-widgets/mainwindow.h" @@ -73,6 +74,8 @@ void run_ui() #if defined(Q_OS_ANDROID) // work around an odd interaction between the OnePlus flavor of Android and Qt font handling if (getAndroidHWInfo().contains("/OnePlus/")) { + QFontInfo qfi(defaultModelFont()); + double basePointSize = qfi.pointSize(); QFontDatabase db; int id = QFontDatabase::addApplicationFont(":/fonts/Roboto-Regular.ttf"); QStringList fontFamilies = QFontDatabase::applicationFontFamilies(id); @@ -80,6 +83,7 @@ void run_ui() QString family = fontFamilies.at(0); QFont newDefaultFont; newDefaultFont.setFamily(family); + newDefaultFont.setPointSize(basePointSize); (static_cast<QApplication *>(QCoreApplication::instance()))->setFont(newDefaultFont); qDebug() << "Detected OnePlus device, trying to force bundled font" << family; QFont defaultFont = (static_cast<QApplication *>(QCoreApplication::instance()))->font(); |