changeset 29158:f28c657c9f42

get the default size for gui editor and terminal from system settings * resource-manager.cc (reload_settings): Create a dummy font and get its size, take font size 10 if this does not return a valid font size
author Torsten Lilge <ttl-octave@mailbox.org>
date Mon, 07 Dec 2020 19:59:18 +0100
parents b42c2c27a330
children a88f6107aceb
files libgui/src/resource-manager.cc
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/resource-manager.cc	Mon Dec 07 10:53:07 2020 -0800
+++ b/libgui/src/resource-manager.cc	Mon Dec 07 19:59:18 2020 +0100
@@ -273,7 +273,16 @@
 
         default_family = get_default_font_family ();
 
+        // determine the fefault fotn size of the system
+        QFont font = QFont (default_family);
+        int font_size = font.pointSize ();
+        if (font_size == -1)
+          font_size = static_cast <int> (std::floor(font.pointSizeF ()));
+
+        // check for valid font size, otherwise take default 10
         QString default_font_size = "10";
+        if (font_size > 0)
+          default_font_size = QString::number (font_size);
 
         std::string env_default_font_size
           = sys::env::getenv ("OCTAVE_DEFAULT_FONT_SIZE");