Bug 50901 - fonts like lucidasanstypewriter do not work in konsole
Summary: fonts like lucidasanstypewriter do not work in konsole
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: 1.2
Platform: Unlisted Binaries Solaris
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-18 12:26 UTC by Devendra Deshpande
Modified: 2005-02-12 20:04 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
p1 (1.04 KB, text/plain)
2002-12-02 10:15 UTC, Devendra Deshpande
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Devendra Deshpande 2002-11-18 12:26:10 UTC
Version:           1.2 (using KDE 3.0.9)
Compiler:          gcc version 3.1
OS:          SunOS (sun4u) release 5.7

Hi,

Upto KDE-3.1 Beta2 (with qt-3.1beta2), konsole worked fine
with solaris fonts like lucida/courier.

With KDE 3.1 rc3 (and qt-copy from cvs), the only family of fonts
that works in konsole is fixed*. Other fixed width fonts behave
strangely (variable number of spaces, garbled screen).

Is this something to do with Qt or konsole?

Thanks,
Devendra
Comment 1 Devendra Deshpande 2002-12-02 06:35:47 UTC
Subject: More on fixed-width fonts in konsole problem (on Solaris 2.7)

Hmmm,

I enabled a few debug lines (commented printf commands) in TEWidget.cpp,
TEWidget::fontChange and I see:

font: Screen,10,-1,5,50,0,0,0,1,0
fixed: yes
font_h: 14
font_w: 9
font_a: 10
rawname: -sun-screen-medium-r-normal--12-120-72-72-m-70-iso8859-1

So Knsole thinks (as Qt told it) that width of the font is 9. The 
window size is 80x24, and the window width is 738 (9*80 = 720 + some 
width for scrollbar).

But actually, the font width is 7! I can confirm this with rxvt.

The problem could be with Qt (Qt is giving the wrong value).

I change this loop in TEWidget::fontChange:

  int fw;
  font_w = 1;
  for(int i=0;i<128;i++) {
    if( isprint(i) && font_w < (fw = fm.width(i)))
      font_w = fw;
  }

to:

  int fw;
  font_w = 1;
  for(int i=0;i<128;i++) {
    if( isprint(i) && font_w < (fw = fm.width(i)))
      printf("intermediate fw: %d (i=%d)\n",fw, i);
      font_w = fw;
  }

and I see:

intermediate fw: 9 (i=9)
font: Screen,10,-1,5,50,0,0,0,1,0
fixed: yes
font_h: 14
font_w: 7
font_a: 10
rawname: -sun-screen-medium-r-normal--12-120-72-72-m-70-iso8859-1

Whew!

I don't know what happened or what did the trick, but Konsole works
with the screen and typewriter fonts now!!

Any clues as to what might be happening?

Thanks,
Devendra

Comment 2 Stephan Binner 2002-12-02 09:37:51 UTC
>  Any clues as to what might be happening?  
 
You forgot to place brackets after "if", it picks up the width of the last char. 
Comment 3 Devendra Deshpande 2002-12-02 10:15:43 UTC
Subject: Re:  fonts like lucidasanstypewriter do not work in konsole

On 2 Dec 2002 08:37:52 -0000 Stephan Binner <binner@kde.org> wrote:
> >  Any clues as to what might be happening?  
>  
> You forgot to place brackets after "if", it picks up the width of the
> last char.

<embarrassed>
I realized that.
</embarrassed>

I did a few code changes that effectively take out:

    font_w=fm.maxWidth();

from the conditional.

And I commented all the stuff that iterates over 0-127 chars and finds
the max width. I get the right result now.

Essentially, the code does the following (no more iterating):

    font_w=fm.maxWidth();

Things work like a charm now. I suspect this messes up the Japanese
support, but I don't know anything better :-(

Thanks,
Devendra

Created an attachment (id=557)
p1
Comment 4 Gerhard Franke 2002-12-03 14:43:00 UTC
Subject: 
This attachment also solved the issue described in
comment #3 of bug <a href="show_bug.cgi?id=45250"> #4520 </a>.
(kde-3.0.5 qt-3.0.6 built with gcc-3.1.1)

Thanks,
   Gerhard

Comment 5 Waldo Bastian 2003-03-11 18:38:56 UTC
This may or may not be fixed by some changes that I made today to konsole in KDE CVS. (Revision 
1.182 of TEWidget.cpp) Could you give that a try? Contact me at bastian@kde.org if you don't have 
access to CVS. 
Comment 6 Kurt Hindenburg 2005-02-12 20:04:58 UTC
A lot has happened since this report.  In KDE3.4 (3.3.x?) lucidasanstypewriter works fine.