Hi, on modern linux systems, Arial fonts will install fine. Just put your arial.ttf file in your ~/.fonts directory and run fc-cache to make sure it's included in your font list. fc-cache is usually run at boot, but you can run it manually. Afterwards, run fc-list to be sure your new font is listed.

I think you will run into difficulty trying to declare a default system wide font in .Xdefaults, but you can easily make a default font in a Tk program with a single line. Notice the canvas dosn't pick up on the default font, but other widgets do. I don't run windows, but I would be interested to hear your report on whether the program below looks the same on linux and windows.

# set a default font for all widgets $mw->optionAdd('*font', 'Arial 24');
and a full program to demonstrate
#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = new MainWindow(-bg =>'black'); # set a default font $mw->optionAdd('*font', 'Arial 24'); # a useful way of tagging fonts for special use $mw->fontCreate('big', -family=>'arial', -weight=>'bold', -size=> 38 ); # will use default font my $menubar = $mw->Menu(-type => 'menubar'); $mw->configure(-menu => $menubar); my $menu = $menubar->cascade(-label => '~File'); $menu->command(-label => '~New'); $menu->command(-label => '~Open'); $mw->Button(-text => 'test this font', -bg=>'white')->pack; $mw->Label(-text => 'test this font', -bg=>'lightyellow')->pack; my $text = $mw->Text(-bg=>'white', -height => 4, -width =>20)->pack; $text->insert('0.0','test this font'); my $canvas = $mw->Canvas(-bg=>'lightgreen')->pack; #make a special font my $font = $mw->Font(-family=> 'Arial', -size => 18); # will use default font $canvas->createText( 0, 0, -anchor => 'nw', -text => 'test this font', ); # special font $canvas->createText( 0, 50, -anchor => 'nw', -text => 'test this font', -font => $font, ); # tagged font $canvas->createText( 0, 100, -anchor => 'nw', -text => 'test this font', -font => 'big', ); MainLoop;

I'm not really a human, but I play one on earth. ..... an animated JAPH

In reply to Re: Perl/Tk Windows fonts for Linux? by zentara
in thread Perl/Tk Windows fonts for Linux? by tlhackque

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.