aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--subsurface-mobile-main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/subsurface-mobile-main.cpp b/subsurface-mobile-main.cpp
index 2b224b595..454996fc7 100644
--- a/subsurface-mobile-main.cpp
+++ b/subsurface-mobile-main.cpp
@@ -20,6 +20,7 @@
#include <QApplication>
#include <QFont>
+#include <QFontMetrics>
#include <QLocale>
#include <QLoggingCategory>
#include <QStringList>
@@ -64,6 +65,14 @@ int main(int argc, char **argv)
// grab the system font size before we overwrite this when we load preferences
double initial_font_size = QGuiApplication::font().pointSizeF();
+ if (initial_font_size < 0.0) {
+ // The OS provides a default font in pixels, not points; doing some crude math
+ // to reverse engineer that information by measuring the height of a 10pt font in pixels
+ QFont testFont;
+ testFont.setPointSizeF(10.0);
+ QFontMetrics fm(testFont);
+ initial_font_size = QGuiApplication::font().pixelSize() * 10.0 / fm.height();
+ }
init_ui();
if (prefs.default_file_behavior == LOCAL_DEFAULT_FILE)
set_filename(prefs.default_filename);