Bug#672554: konsole: vertically misaligned/cut off characters

2013-02-15 Thread Maximiliano Curia
retitle 672554 konsole: vertically misaligned/cut off characters
tags 672554 + patch
thanks

Hello,

This bug seems to be caused by a problem in the qt's painter::drawText
method handling monospace fonts with different attributes (bold, inverted and
such), that end up with slightly different positions.

The konsole developers applied two patches to handle this problem, the first
one increased the text linespacing so that the misalignment
doesn't end up with cut off characters. (affecting src/TerminalDisplay.h
setBidiEnabled function).

The second patch adds a flag to the drawText to align the text (this shouldn't
be needed in a monospace font), the result hides the problem in almost every
case (affecting src/TerminalDisplay.cpp drawCharacters function).

Both patches are applied only to the unidirectional text rendering, but after
a few releases the bidirectional text rendering became the default, thus making
this bug noticeable again. Although as the bidirectional renderer draws the
whole line, the misplacement won't make the terminal useless as the
unidirectional renderer used to cause; it's just annoying.

The misplacement is not always the same, it depends on the font you are using,
some fonts seem to be particularly prone to misplacement. Currently, I'm using
the Anonymous Pro font; before, I used the Terminus font and it was displaced
more heavily in presence of unicode chars, while the TrueType fonts seem to be
displaced with the change of attributes.

To test this bug, I use the manpage of fonts.conf, close to the end of the
manpage, the line that starts with conf.d, the text is sligthly misplaced.
Selecting a word causes the line to get redrawn in a slightly different
position. This misplacement is very subtle, some texts produce a more serious
misplacement, but this is the one I found when I was tracking the problem.

I'm attaching two patches that modify the patches made by upstream, the first
one adds the alignBottom flag to the bidirectional renderer. This patch hides
part of the misplacement in the bidirectional renderer.

The second patch reverts the added linespacing for the unidirectional
renderer, making the lines in konsole of the same height than in any other
program, while using the same font (this can be tested using a gnome-terminal
or similar with transparency on top of konsole).

As mentioned before, these patches only reduce the effect of the problem, but
the error is somewhere in the execution produced by drawText. So far, I
haven't found the culprit.

-- 
If you are in a hole, stop digging. -- The First Rule of Excavation
Saludos /\/\ /\  `/
Index: konsole/src/TerminalDisplay.cpp
===
--- konsole.orig/src/TerminalDisplay.cpp	2013-02-15 13:56:21.342032187 +0100
+++ konsole/src/TerminalDisplay.cpp	2013-02-15 14:37:06.932813212 +0100
@@ -701,6 +701,13 @@
 if (isLineCharString(text)) {
 drawLineCharString(painter, rect.x(), rect.y(), text, style);
 } else {
+		// Avoid fonts vertical displacement.
+
+		// See bug 280896 for more info
+		int flags = 0;
+#if QT_VERSION = 0x040800
+		flags |= Qt::AlignBottom;
+#endif
 // Force using LTR as the document layout for the terminal area, because
 // there is no use cases for RTL emulator and RTL terminal application.
 //
@@ -715,14 +722,9 @@
 //
 // This was discussed in: http://lists.kde.org/?t=12055222362r=1w=2
 if (_bidiEnabled) {
-painter.drawText(rect, 0, text);
+painter.drawText(rect, flags, text);
 } else {
-// See bug 280896 for more info
-#if QT_VERSION = 0x040800
-painter.drawText(rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + text);
-#else
-painter.drawText(rect, 0, LTR_OVERRIDE_CHAR + text);
-#endif
+painter.drawText(rect, flags, LTR_OVERRIDE_CHAR + text);
 }
 }
 }
Index: konsole/src/TerminalDisplay.h
===
--- konsole.orig/src/TerminalDisplay.h	2013-02-15 13:56:21.342032187 +0100
+++ konsole/src/TerminalDisplay.h	2013-02-15 15:19:43.391806071 +0100
@@ -384,7 +384,7 @@
 if (_bidiEnabled) {
 setLineSpacing(0);
 } else {
-setLineSpacing(2);
+setLineSpacing(0);
 }
 #endif
 }


signature.asc
Description: Digital signature


Bug#672554: konsole: vertically misaligned/cut off characters when using Terminus font

2012-05-11 Thread Ignacio Riquelme Morelle
Package: konsole
Version: 4:4.7.4-2
Severity: normal

Since a recent series of updates in testing (that just happened to include Qt
4.8.1), Konsole doesn't draw characters with descenders (g, q, y, p, for
example) correctly when using the Terminus bitmap font at various sizes (bold
or otherwise). The characters are rendered vertically misaligned, cutting them
off at the baseline (a 'q' will look very much like an 'o') and leaving a
noticeable gap above for each line. This problem occurs at the standard sizes
provided by the font, but somehow not at sizes 9.8 - 10.1. Switching between
the bold and regular variants does not improve the rendering.

Truetype fonts in general seem unaffected, except for a couple of fonts
(Consolas and Lucida Console) found in Windows systems; this might not be very
relevant since they have never rendered quite right for me with different
hinting/antialiasing settings.

I couldn't reproduce this problem on other KDE applications such as Kate, which
is why I decided to file this bug against Konsole's package.



-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.3.5-reicore-72 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages konsole depends on:
ii  kde-runtime4:4.7.4-2
ii  libc6  2.13-32
ii  libkdecore54:4.7.4-4
ii  libkdeui5  4:4.7.4-4
ii  libkio54:4.7.4-4
ii  libknotifyconfig4  4:4.7.4-4
ii  libkparts4 4:4.7.4-4
ii  libkpty4   4:4.7.4-4
ii  libqt4-dbus4:4.8.1-1
ii  libqtcore4 4:4.8.1-1
ii  libqtgui4  4:4.8.1-1
ii  libstdc++6 4.7.0-7
ii  libx11-6   2:1.4.99.901-2

konsole recommends no packages.

konsole suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-qt-kde-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20120512020922.27177.89519.reportbug@reicore