Bug 52538 - console font displays double width
Summary: console font displays double width
Status: RESOLVED WORKSFORME
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-03 00:44 UTC by alan
Modified: 2003-06-17 17:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Snapshot of the effect I am describing (26.62 KB, image/png)
2003-01-03 00:49 UTC, alan
Details
Code snippet showing how to reproduce problem (891 bytes, text/x-chdr)
2003-01-25 08:47 UTC, alan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description alan 2003-01-03 00:44:45 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 2.95 
OS:          Linux

When selecting and then using the "console" fonts (which is the font within the konsole subdir of kdebase) then it seems to be displayed incorrectly.  Each character seems larger than expected and also there is a single space between each letter (ie the character width appears to be twice what it should be).

This does not happen when using the font in an xterm (for instance).
Comment 1 alan 2003-01-03 00:49:30 UTC
Created attachment 688 [details]
Snapshot of the effect I am describing

This shows the effect when selecting the font within the select font dialog of
konsole - see the sample text on the bottom of the font selection dialog, and
on the actual screen area of konsole
Comment 2 Emmanuel BERRE 2003-01-12 16:05:20 UTC
I have the same problem with the same font, and others like nexus or outcast since my last debian  
update Thursday 9th. 
Comment 3 Stephan Binner 2003-01-16 22:01:22 UTC
And what did it update? Qt and/or KDE packages? To what versions? 
Comment 4 alan 2003-01-25 08:47:39 UTC
Created attachment 805 [details]
Code snippet showing how to reproduce problem

This is NOT a problem with konsole, but rather JUST about how the FixedPitch
attribute of a font changes how it is displayed.  This code snippet is from a
very simple QDesigner Application that just uses a button click to toggle the
FixedPitch attribute of the default font being used to display in a QLineEdit.
When FixedPitch is set the display width of the text doubles.
Because KFontDialog with the second parameter set to TRUE returns a QFont with
this attribute set, and because Konsole uses the font that is returned, the
effect shown in the first attachment occurs.
Comment 5 Joseph Mesterhazy 2003-01-29 00:11:42 UTC
I am also seeing this behaviour.  KDE 3.1 final from source on RH8 XFree86-4.2.0 Fontconfig-2.1 (this upgrade did not help)  QT 3.1.1   
Comment 6 alan 2003-02-02 22:45:10 UTC
I have done further analysis of this problem.  Its XFT returning what appears to be 
bogus font widths with the "Fixed Pitch" attribute is set.  QT uses that bit to request a 
font which is reported by XFT to be either XFT_MONO or XFT_CHARCELL.  XFT 
returns what looks like a matching font but the character widths, as obtained from 
XftTextExtent16 are too large. 
 
The actual problem I reported is related to the Console font.  XFT seems to reckon this 
is large (font widths in proportional mode of approximately 11 pixels for a 12point font - 
thats more like a 10 or 9 point font) and in monospaced mode it is returning a font width 
of a massive 26 pixels. 
 
I have attempted to report the bug at debian (whose packages I am using) and on the 
fontconfig mailing list. 
Comment 7 patricia 2003-02-05 11:03:17 UTC
I have a similar problem. I see helvetica font with larger characters, but I also see all fonts as the same thing.
Comment 8 alan 2003-02-08 10:54:35 UTC
It is also possible to work around the problem by editing ~/.qt/qtrc and changing the line 
"enableXft=..." from true to false. 
 
It appears with enableXft set to true that (with the fonts that I have installed) "console" 
font is being "best matched" as "verdana" by xft.  When qt is left to do it, it seems to find 
"console"  
Comment 9 patricia 2003-02-13 18:39:48 UTC
Thank you very much. Editing qtrc and chaging enableXft to false solved the problem!!!
Comment 10 alan 2003-02-18 21:11:33 UTC
I think I now know at least one part of the problem related to this bug.  The first part of 
the problem is that a request to display the "console" font confuses Xft/fontconfig - 
because it can't find a match against that family name.  It instead uses the Style Hint 
given it by qt to locate the nearest font (which will depend on the fontconfig 
configuration).  Before qt caches the font - it asks xft for it - which asks fontconfig which 
looks for it in the fonts.cache-1 file in the appropriate directory.  It does not find console 
(but instead the name is console8x16.pcf)  
 
This is because when fontconfig creates the font.cache-1 file in each of the font 
directories it asks freetype to look up the font from the font filename at give it its 
parameters.  Due to a bug in freetype 2.1.3 (fixed in cvs I am told) the routine that 
decompresses compressed fonts (console is one of these) reports a file format error 
against the font file and hence fails to get its parameters into the font cache.  
Fontconfig works round the problem by creating the family name from the file name. 
 
However, even with this bug fixed there is still a problem with the console font that 
means that freetype doesn't get its name right.  I believe THIS IS A BUG in the 
console8x16.pcf.gz and console8x8.pcf.gz files distributed with KDE. 
 
The file has "properties" in it, with a string defining the property type and a string 
defining the property value.  These fonts use FAMILY as the property type and console 
as the property value.  I have sampled some other fonts and they have FAMILY_NAME 
as this property type.  Freetype is only looking for the string FAMILY_NAME.  Hence it 
reports a null family name when asked and fontconfig therefore writes the filename into 
the font.cache-1 file. 
 
(I have asked for pointers to the pcf specification on the freetype mailing list to try and 
confirm what I am saving) 
Comment 11 alan 2003-02-25 21:50:37 UTC
I note that someone has fixed the fonts in cvs.  So this nearly solves the problem.  I 
have also discovered that what happens now is that fontconfig is searching for a 
nearest fit to "fixed" 9 point on a 100dpi screen and is locating (at least on my system) 
a font called  
 
/usr/X11R6/lib/X11/fonts/misc/12x13ja.pcf. 
 
This font seems to have an "Additional Style" hint which font config ignores. 
 
I have overcome this by adding the following text to /etc/fonts/local.conf 
<match> 
        <test name="family"> 
                <string>fixed</string> 
        </test> 
        <edit name="family" mode="assign" binding="strong"> 
                <string>console</string> 
        </edit> 
</match> 
 
Now konsole starts perfectly with the console font as the "normal" font. 
 
 
 
Comment 12 alan 2003-02-27 20:02:48 UTC
I have been having a conversation with the fontconfig author (Keith Packard) on the 
fontconfig mailing list and the correct thing for an application (such as konsole) to 
do if it wants a generic font is NOT to used "fixed" as the family name but use a 
generic name (such as "monospace").  That way the fontconfig configuration file 
can be used to find a user specific font.  
Comment 13 rjb 2003-06-17 17:10:54 UTC
So, is there a solution for this problem (except for the workaround by editing qtrc)? 
I built and installed xfree-cvs, freetype-2.1.4 and kde 3.1.2 and still have too much space 
between the characters of any of the fixed width fonts.