Perl/TkFAQ-10.15.如何设定字体

王朝perl·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

原文:

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系统在“控制面板”中有一个专门的“字体”目录。)

另外,在后面的部分中我们还将具体讨论通用字体的问题。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航