9.14. 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 = MaiWindow->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-b9.01 build directory.

See also the later question (within this FAQ) on international fonts.


Previous | Return to table of contents | Next