[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [ktexteditor] src/render: try to "fixup" rendering of underlines and stuff like that
From:       Christoph Cullmann <cullmann () kde ! org>
Date:       2016-09-07 21:21:39
Message-ID: E1bhkHr-0005GB-Jn () code ! kde ! org
[Download RAW message or body]

Git commit 2f31454eede42eb99fd8e95834a11397de98ea1e by Christoph Cullmann.
Committed on 07/09/2016 at 21:21.
Pushed by cullmann into branch 'master'.

try to "fixup" rendering of underlines and stuff like that

KTextEditor assumes equal line height, this leads to problems for _ and stuff like that

"fix": spread lines by factor 1.1

BUG: 335079

please test this, looks "ok" here and avoid the problems (tested with some fonts + CTRL--/+ zooming

if that is "unusable", we can revert it before 5.27

M  +9    -3    src/render/katerenderer.cpp

http://commits.kde.org/ktexteditor/2f31454eede42eb99fd8e95834a11397de98ea1e

diff --git a/src/render/katerenderer.cpp b/src/render/katerenderer.cpp
index d5eecfa..1b25369 100644
--- a/src/render/katerenderer.cpp
+++ b/src/render/katerenderer.cpp
@@ -943,19 +943,25 @@ void KateRenderer::updateConfig()
 void KateRenderer::updateFontHeight()
 {
     // first: get normal line spacing
-    m_fontHeight = config()->fontMetrics().height();
+    qreal height = config()->fontMetrics().lineSpacing();
 
     // Sometimes the height of italic fonts is larger than for the non-italic
     // font. Since all our lines are of same/fixed height, use the maximum of
     // both heights (bug #302748)
     QFont italicFont = config()->font();
     italicFont.setItalic(true);
-    m_fontHeight = qMax(m_fontHeight, qCeil(QFontMetricsF(italicFont).height()));
+    height = qMax(height, QFontMetricsF(italicFont).lineSpacing());
 
     // same for bold font
     QFont boldFont = config()->font();
     boldFont.setBold(true);
-    m_fontHeight = qMax(m_fontHeight, qCeil(QFontMetricsF(boldFont).height()));
+    height = qMax(height, QFontMetricsF(boldFont).lineSpacing());
+
+    // hack: add bit more spacing, just to be sure ;=)
+    // bug 335079
+    // this is no proper fix but works around the issues in many cases
+    // line height per line would fix it for real but needs complete rewrite of rendering/scrolling/...
+    m_fontHeight = qMax(1, qCeil(1.1f * height));
 }
 
 qreal KateRenderer::spaceWidth() const
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic