原文:
10.15. How do I specify fonts?
The quick answer is to specify the font configuration option of your widget as in: #!/usr/local/bin/perl -w use Tk; $main = MainWindow->new(); $labl = $main -> Label('-text' => "Foo", '-font' => "fixed"); $labl -> pack; MainLoop;
The long answer involves figuring out what fonts you have access to locally. The Unix programs xlsfonts and xfontsel are useful in this regard.
The perl/Tk version of xfontsel was distributed as the font_test script in the Tk build directory.
See also the later question (within this FAQ) on international fonts.
译文:
10.15. 如何设定字体?
简单的说就是给你的组件设置‘font’选项,例如:
#!/usr/local/bin/perl -w
use Tk;
$main = MainWindow->new();
$labl = $main -> Label('-text' => "Foo");#, '-font' => "fixed");
$labl -> pack;
MainLoop;
具体的说来,其实通常还需要了解你的系统上有哪些可用的字体。在这方面,Unix系统中的xlsfonts和xfontsel程序是非常有用的。(译者注:Windows系统在“控制面板”中有一个专门的“字体”目录。)
另外,在后面的部分中我们还将具体讨论通用字体的问题。