Perl/tk Linux 中缺少无衬线字体

Perl/tk sans-serif font missing in Linux

我有一个 perl/tk 脚本,它使用带有文本的 canvas。 不久前,文本的字体单独更改:不再使用无衬线字体! 可能有些 update/upgrade 弄乱了我的字体,但它们应该在某处。我只在 perl/tk 个脚本中发现了这个问题。

我下载了一个显示已安装字体的小 perl 脚本,但确实没有出现 sans-serif。事实上,只出现了 30 种左右的字体。命令 xlsfonts 给了我 1600 多种字体,但 xfontsel 只显示了这 30 个字体系列。

sans 字体是怎么消失的,我如何restore/install找回丢失的字体?

这是我用来查看字体的脚本:

#!/usr/bin/perl

use Tk;
use Tk::BrowseEntry;
use strict;

my $mw = MainWindow->new(-title => 'Font Viewer');
my $f = $mw->Frame->pack(-side => 'top');

my $family = 'Courier';
my $be = $f->BrowseEntry(-label => 'Family:', -variable => $family,
  -browsecmd => \&apply_font)->pack(-fill => 'x', -side => 'left');
$be->insert('end', sort $mw->fontFamilies);

my $size = 24;
my $bentry = $f->BrowseEntry(-label => 'Size:', -variable => $size,
  -browsecmd => \&apply_font)->pack(-side => 'left');
$bentry->insert('end', (3 .. 32));

my $weight = 'normal';
$f->Checkbutton(-onvalue => 'bold', -offvalue => 'normal',
  -text => 'Weight', -variable => $weight,
  -command => \&apply_font)->pack(-side => 'left');

my $slant = 'roman';
$f->Checkbutton(-onvalue => 'italic', -offvalue => 'roman',
  -text => 'Slant', -variable => $slant,
  -command => \&apply_font)->pack(-side => 'left');

my $underline = 0;
$f->Checkbutton(-text => 'Underline', -variable => $underline,
  -command => \&apply_font)->pack(-side => 'left');

my $overstrike = 0;
$f->Checkbutton(-text => 'Overstrike', -variable => $overstrike,
  -command => \&apply_font)->pack(-side => 'left');

my $stext = 'Sample Text';
my $sample = $mw->Entry(-textvariable => $stext)->pack(-fill => 'x');

&apply_font;

MainLoop;

sub apply_font {
  # Specify all options for font in an anonymous array
  $sample->configure(-font =>
    [-family => $family,
     -size => $size,
     -weight => $weight,
     -slant => $slant,
     -underline => $underline,
     -overstrike => $overstrike]);
}

在最近的一些更新中,这个问题已经得到修复。 Sans 字体回来了。