[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=f5e12db
The following commit has been merged in the master branch:
commit f5e12db4e09b0068766bf2bf6134728e1a8b9ea6
Author: Martin Klapetek <mklapetek at kde.org>
Date: Thu Apr 10 23:36:46 2014 +0200
Use proper DPI in chat view
WebKit has a DPI hardcoded to 96; in order to not get super tiny fonts
we rescale them by the real DPI
Reviewed-by: David Edmundson
BUG: 305712
---
lib/adium-theme-view.cpp | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/adium-theme-view.cpp b/lib/adium-theme-view.cpp
index 635a877..aabc9c8 100644
--- a/lib/adium-theme-view.cpp
+++ b/lib/adium-theme-view.cpp
@@ -33,10 +33,12 @@
#include <QtGui/QContextMenuEvent>
#include <QtGui/QFontDatabase>
#include <QtGui/QMenu>
+#include <QtGui/QDesktopWidget>
#include <QtWebKit/QWebFrame>
#include <QtWebKit/QWebElement>
#include <QtWebKit/QWebInspector>
#include <QtWebKit/QWebSettings>
+#include <QApplication>
#include <KAction>
#include <KDebug>
@@ -195,14 +197,17 @@ void AdiumThemeView::initialise(const AdiumThemeHeaderInfo &chatInfo)
if (m_useCustomFont) {
// use user specified fontFamily and Size
settings()->setFontFamily(QWebSettings::StandardFont, m_fontFamily);
- settings()->setFontSize(QWebSettings::DefaultFontSize, m_fontSize);
+ // We get desktop's DPI and divide it 96, which is the DPI that WebKit has hardcoded in
+ // Then we can just scale the fonts using the obtained coefficient and they should look
+ // good/better on high-dpi screens
+ settings()->setFontSize(QWebSettings::DefaultFontSize, m_fontSize * (QApplication::desktop()->logicalDpiY() / 96.0 ));
// since some themes are pretty odd and hardcode fonts to the css we need to override that
// with some extra css. this may not work for all themes!
extraStyleHtml.append (
QString(QLatin1String("
* {font-family:\"%1\" !important;font-size:%2pt !important};"))
.arg( m_fontFamily )
- .arg( m_fontSize )
+ .arg( m_fontSize * (QApplication::desktop()->logicalDpiY() / 96.0 ))
);
} else {
// FIXME: we should inform the user if the chatStyle want's to use a fontFamily which is not present on the system
@@ -212,7 +217,8 @@ void AdiumThemeView::initialise(const AdiumThemeHeaderInfo &chatInfo)
// use theme fontFamily/Size, if not existent, it falls back to systems default font
settings()->setFontFamily(QWebSettings::StandardFont, m_chatStyle->defaultFontFamily());
- settings()->setFontSize(QWebSettings::DefaultFontSize, m_chatStyle->defaultFontSize());
+ // Computing the font size can result in floats and have some rounding errors, so add 0.5 and floor
+ settings()->setFontSize(QWebSettings::DefaultFontSize, qFloor(0.5 + m_chatStyle->defaultFontSize() * (QApplication::desktop()->logicalDpiY() / 96.0 )));
}
//The templateHtml is in a horrific NSString format.
--
ktp-text-ui packaging
More information about the pkg-kde-commits
mailing list