Bug 323994

Summary: font rendering bug in English and Chinese chars.
Product: [Applications] konsole Reporter: Grissiom <chaos.proton>
Component: fontAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED DUPLICATE    
Severity: normal CC: Arfrever.FTA, broken.zhou, khindenburg, martin.sandsmark
Priority: NOR    
Version: 2.11   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
URL: https://plus.google.com/117338407260059907348/posts/HgANx9koSxN
Latest Commit: Version Fixed In:

Description Grissiom 2013-08-25 05:54:30 UTC
The screen shot is here:

https://plus.google.com/117338407260059907348/posts/HgANx9koSxN

The black part is Konsole and the white part is Kate. You can see from the screen shot that every thing seems fine in Kate but in Konsole, the baseline of Chinese fonts and English fonts are not aligned. The English chars are raised a little and nearly touch the line above.

It makes writing documenting in Konsole painful.

Both Konsole and Kate use monospace fonts and the relative fontconfig part is:

 <alias>
  <family>monospace</family>
  <prefer>
   <family>Consolas</family>
   <family>Liberation Mono</family>
   <family>FZLanTingHei-R-GBK</family>
  </prefer>
 </alias>

I hope that could do some help. Thanks.

Reproducible: Always
Comment 1 Kurt Hindenburg 2013-10-01 13:03:48 UTC
Thanks for the report - do you happen to have a text file w/ the chars in it?  or perhaps copy/paste in this bko.
Comment 2 Yichao Zhou 2013-12-01 15:45:01 UTC
Here is my version of this bug.

1.  Screenshot
http://i.imgur.com/MPEv3Nb.png

2.  User fontconfig
http://bpaste.net/show/154552/

3.  Example.txt in UTF-8
http://bpaste.net/show/154553/

4.  Font: monospace, which will be replace by fontconfig to Dejavu Sans Mono and Droid Sans Fallback.

In order to get it work, you need to install font "droid sans", which is packaged by most distro.
Comment 3 Yichao Zhou 2014-01-27 10:30:46 UTC
Finally, I think I workaround this bug.  In Edit Profile - Advanced - cancel the check about "Enable Bi-Directional Text rendering", and Chinese char displayed correct!

I wonder why that option is enabled by default.
Comment 4 Martin Sandsmark 2016-11-20 16:01:59 UTC
It seems like this might be because bidi disables Qt::AlignBottom?

Not sure how something like this would affect things:

diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp
index dd91177..40b0d49 100644
--- a/src/TerminalDisplay.cpp
+++ b/src/TerminalDisplay.cpp
@@ -863,7 +863,7 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
         //
         // This was discussed in: http://lists.kde.org/?t=120552223600002&r=1&w=2
         if (_bidiEnabled) {
-            painter.drawText(rect, 0, text);
+            painter.drawText(rect, Qt::AlignBottom, text);
         } else {
             // See bug 280896 for more info
             painter.drawText(rect, Qt::AlignBottom, LTR_OVERRIDE_CHAR + text);
Comment 5 Christoph Feck 2016-11-21 23:44:07 UTC
Chinese characters are not RTL, so no bidi issue.

The issue is that fonts have different pixel heights for the same point size.

For aligning the baselines, see https://git.reviewboard.kde.org/r/129281/
Comment 6 Christoph Feck 2016-12-07 19:27:45 UTC
I cannot access the screen shot from comment #0, but reading the description, it is a duplicate of bug 371687.

*** This bug has been marked as a duplicate of bug 371687 ***