Bug 305555

Summary: Wrong spacing in certain monospace fonts
Product: [Applications] konsole Reporter: Thomas Kahle <tomka>
Component: fontAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED UPSTREAM    
Severity: normal CC: cfeck, johu, poletti.marco
Priority: NOR    
Version: 2.8.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
URL: https://bugs.gentoo.org/show_bug.cgi?id=431934
Latest Commit: Version Fixed In:
Attachments: one d
some d's
many d's
inconsolata font that has the problem (with 'l')
liberation -> Problem on the 'd' (but not 'l')
FontTest Qt source
result of font test

Description Thomas Kahle 2012-08-21 14:37:06 UTC
When using liberation-mono version 2.0, or the inconsolata font (and possibly other monospace fonts) the spacing is wrong and leads to display errors. (I'm attaching screenshots of pressing a sequence of d's that moves the curser too far out). This does not happen in other kde applications such as kate.

Reproducible: Always

Steps to Reproduce:
1. Install inconsolata font
2. select it as the font in console
3. fill the screen with text
Actual Results:  
Display errors.
Comment 1 Thomas Kahle 2012-08-21 14:37:51 UTC
Created attachment 73356 [details]
one d
Comment 2 Thomas Kahle 2012-08-21 14:38:11 UTC
Created attachment 73357 [details]
some d's
Comment 3 Thomas Kahle 2012-08-21 14:38:33 UTC
Created attachment 73358 [details]
many d's
Comment 4 Thomas Kahle 2012-08-21 14:38:57 UTC
Adding downstream bug to URL.
Comment 5 Christoph Feck 2012-08-21 18:06:34 UTC
I guess this is a problem in the font. It probably advertises itself as a monospaced, i.e. all characters having the same advance width, but they aren't all the same.

Can you attach the font?
Comment 6 Thomas Kahle 2012-08-21 19:12:16 UTC
Created attachment 73366 [details]
inconsolata font that has the problem (with 'l')
Comment 7 Thomas Kahle 2012-08-21 19:14:10 UTC
Created attachment 73367 [details]
liberation -> Problem on the 'd' (but not 'l')
Comment 8 Thomas Kahle 2012-08-21 19:15:01 UTC
(In reply to comment #5)
> I guess this is a problem in the font. It probably advertises itself as a
> monospaced, i.e. all characters having the same advance width, but they
> aren't all the same.
> 
> Can you attach the font?

I attached two that have the problem on different letters.  Inconsolata with l, and liberation with d (as in the screenshots.)
Comment 9 Christoph Feck 2012-08-21 22:01:16 UTC
Cannot reproduce on my system, both fonts work fine in multiple sizes I tried.
KDE 4.9.0, Qt 4.8.2, freetype 2.4.9, xdyinfo: resolution:    96x96 dots per inch

Could you compile the attached FontTest program using
     qmake -project && qmake && make

and attach its generated "fonttest.txt" output when run using
    ./FontTest 2> fonttest.txt

if possible?
Comment 10 Christoph Feck 2012-08-21 22:02:05 UTC
Created attachment 73374 [details]
FontTest Qt source
Comment 11 Thomas Kahle 2012-08-22 06:33:21 UTC
Created attachment 73376 [details]
result of font test

I'm also on 96x96 dpi
Comment 12 Christoph Feck 2012-08-22 10:51:18 UTC
Thanks. On your system, Qt indeed returns different widths for different characters (the first "w" value). This could be a Qt bug, or a fontconfig/freetype bug.

Konsole cannot be blamed for this. If the Qt font database indicates the font is monospaced, then Qt should not return different widths. Please report this issue to the bug tracker of the Qt project via https://bugreports.qt-project.org/

A workaround in Konsole would be if Konsole rendered each character on its own, instead of rendering complete text lines, but this would be much slower, and I doubt Konsole should work around bugs in upstream libraries.