[SCM] ktp-text-ui packaging branch, master, updated. debian/15.12.1-1-1918-gdf4b0ec

Maximiliano Curia maxy at moszumanska.debian.org
Sat May 28 00:24:30 UTC 2016


Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-text-ui.git;a=commitdiff;h=2793999

The following commit has been merged in the master branch:
commit 2793999ad1089bd4a02c7973fa74b178c3b60e93
Author: Martin Klapetek <mklapetek at kde.org>
Date:   Thu Apr 10 23:42:55 2014 +0200

    Use system font if theme does not provide default font and font size
    
    CCBUG: 305712
---
 lib/chat-window-style.cpp | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/lib/chat-window-style.cpp b/lib/chat-window-style.cpp
index 9a75237..b03f480 100644
--- a/lib/chat-window-style.cpp
+++ b/lib/chat-window-style.cpp
@@ -25,11 +25,14 @@
 #include <QtCore/QStringList>
 #include <QtCore/QTextCodec>
 #include <QtCore/QTextStream>
+#include <QtCore/qmath.h>
+#include <QFont>
 
 // KDE includes
 #include <KDebug>
 #include <KLocale>
 #include <KStandardDirs>
+#include <KGlobalSettings>
 
 class ChatWindowStyle::Private
 {
@@ -349,8 +352,14 @@ void ChatWindowStyle::readStyleFiles()
         d->defaultVariantName = i18nc("Normal style variant menu item", "Normal");
     }
     kDebug() << "defaultVariantName = " << d->defaultVariantName;
-    d->defaultFontFamily  = plistReader.defaultFontFamily();
-    d->defaultFontSize    = plistReader.defaultFontSize();
+    d->defaultFontFamily  = plistReader.defaultFontFamily().isEmpty() ? KGlobalSettings::generalFont().family()
+                                                                      : plistReader.defaultFontFamily();
+
+    // If the theme has no default font size, use the system font size, but since that is in points (pt), we need to convert
+    // it to pixel size (and using pixelSize() does not work if the QFont was not set up using setPixelSize), so we use the
+    // rough conversion ratio 4/3 and floor the number
+    d->defaultFontSize    = plistReader.defaultFontSize() == 0 ? qFloor(KGlobalSettings::generalFont().pointSizeF() * (4.0/3.0))
+                                                               : plistReader.defaultFontSize();
     d->disableCombineConsecutive = plistReader.disableCombineConsecutive();
     d->messageViewVersion = plistReader.messageViewVersion();
 

-- 
ktp-text-ui packaging



More information about the pkg-kde-commits mailing list