Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TkDefaultFont CentOS 5 -> CentOS 8

62 views
Skip to first unread message

Dave J

unread,
Mar 29, 2021, 4:29:12 PM3/29/21
to
Hello,

I have an application written with Perl/Tk which I am moving from a CentOS 5 system to a CentOS 8 system. It appears that the default font, particularly the spacing, seems to be different and I wonder if I can change it to match the font as it looks on the CentOS 5 system. I couldn't find anything specific in the Perl/Tk source that showed such a change or specified the default font (I am using a new version of Perl Tk on CentOS 8 - I went from 804.027 to 804.034)

Here is output from tclsh that indicates the differences I am seeing....

CentOS 5:
% packa re Tk
8.4
% font actual TkDefaultFont
-family fixed -size 13 -weight normal -slant roman -underline 0 -overstrike 0
% font metrics TkDefaultFont
-ascent 14 -descent 2 -linespace 16 -fixed 1

CentOS 8:
% packa re Tk
8.6.8
% font actual TkDefaultFont
-family {Nimbus Sans} -size 9 -weight normal -slant roman -underline 0 -overstrike 0
% font metrics TkDefaultFont
-ascent 9 -descent 4 -linespace 13 -fixed 0

Thanks for any help anyone can provide or point me in a different direction if I am barking up the wrong tree.


Rich

unread,
Mar 29, 2021, 4:42:48 PM3/29/21
to
v5 is using the "fixed" family (this is the older bit-map X fonts).

v8 is using the "Nimbus Sans" family (this is a scalable font).

Why the two families differ I can not say.

But if you want the v5 font on the v8 system, just redefine
TkDefaultFont on the v8 system:

font configure TkDefaultFont -family fixed -size 13 -weight normal -slant roman -underline 0 -overstrike 0

and you should (assuming v8 has the 'fixed' family installed) get the
same font on v8 that you used to get on v5.

Note, if you want everything to match you'll want to pull the 'font
actual' lists for all the Tk default fonts on the v5 system and
redefine the same fonts on the v8 system.

The 'font names' command, in a fresh 'wish' will list all the fonts Tk
defines by default.

devdev data

unread,
Mar 31, 2021, 12:37:54 PM3/31/21
to
Rich thanks for your help.

I went ahead and tried the font configure command to straighten this out. Here's the output from that, done within wish

% packa re Tk
8.6.8
% font actual TkDefaultFont
-family {Nimbus Sans} -size 9 -weight normal -slant roman -underline 0 -overstrike 0
% font configure TkDefaultFont -family fixed -size 13 -weight normal -slant roman -underline 0 -overstrike 0
% font actual TkDefaultFont
-family {Nimbus Sans} -size 13 -weight normal -slant roman -underline 0 -overstrike 0

I wonder why {Nimbus Sans} is sticking around there - I looked in my X11 fonts area and it's the same set of fonts available (-misc-fixed) on both systems.
Perhaps this result indicates that the fixed font is not installed the same way on the v8 system as on the v5?

Another question: is 'font configure' intended to be permanent? Because when I start another wish, TkDefaultFont is back to the size 9.

% packa re Tk
8.6.8
% font actual TkDefaultFont
-family {Nimbus Sans} -size 9 -weight normal -slant roman -underline 0 -overstrike 0

Thanks again for helping.


Rich

unread,
Mar 31, 2021, 1:21:09 PM3/31/21
to
This seems to be a good possibility. Both Tk and X11 will do
'substitutions' for you to give you "a font" instead of leaving you
high and dry. So it looks like Tk (or X11) is not finding the fixed
family and is substituting in Nimbus Sans as the alternative.

On my Slackware system (where I know fixed is working, as I use it for
my terminal font) I can reconfigure TkDefaultFont:

$ rlwrap wish
% font actual TkDefaultFont
-family {DejaVu Sans} -size -12 -weight normal -slant roman -underline 0 -overstrike 0
% font configure TkDefaultFont -family fixed -size 13 -weight normal -slant roman -underline 0 -overstrike 0
% font actual TkDefaultFont
-family Fixed -size 13 -weight normal -slant roman -underline 0 -overstrike 0
%

> Another question: is 'font configure' intended to be permanent?
> Because when I start another wish, TkDefaultFont is back to the size
> 9.

No, it only impacts the current Tk interpreter within which you run it.
If you want to make it a user wide change, you might be able to do so
by adding it to a ~/.wishrc file, but then note that it would only be
global for the user to whom that .wishrc belongs.

devdev data

unread,
Apr 7, 2021, 10:31:34 PM4/7/21
to
Rich - thanks for your help getting me this far. I've picked through the fonts on both systems but do not find anything obvious. More investigation needed....or stuck with Nimbus Sans, I guess. Appreciate it!
0 new messages