Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Perl Tk -font option is not working in linux if the language is japanese

by Khen1950fx (Canon)
on Nov 07, 2012 at 04:43 UTC ( #1002623=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Perl Tk -font option is not working in linux if the language is japanese
in thread Perl Tk -font option is not working in linux if the language is japanese

First, do you actually have the adobe font that you're trying to use? On my system, it doesn't exist; however, I improvised and settled on this:

#!/usr/bin/perl BEGIN { $| = 1; $^W = 1; } use strict; use warnings; use Tk; use Tk::X11Font; my $font = "-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859- +1"; my $mw = MainWindow->new; $mw->geometry('100x150'); my $label = $mw->Label( -bg => 'white', -text => "Help!", -font => \$font, )->pack; MainLoop;


Comment on Re^3: Perl Tk -font option is not working in linux if the language is japanese
Download Code
Re^4: Perl Tk -font option is not working in linux if the language is japanese
by LeonelMendoza (Initiate) on Nov 07, 2012 at 05:33 UTC

    Yes, the font exists, Also i tried to copy fonts from the list the xlsfonts command provided, but it is still using "nimbus sans l". How do you get the real font? Here's my code to get the real font:

    #!/usr/bin/perl BEGIN { $| = 1; $^W = 1; } use strict; use warnings; use Tk; use Tk::X11Font; my $font = "-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859- +1"; my $mw = MainWindow->new; $mw->geometry('100x150'); my $label = $mw->Label( -bg => 'white', -text => "Help!", -font => \$font, )->pack; my $realfont = $label->cget(-font); print join(" ", $label->fontActual($realfont)), "\n";

    Here's my software specification: CentOS Release 4.8 perltk 804.030 perl 5.8.5-builtin in CENTOS Please help me!

      Use Tk::XFontSelect:
      #!/usr/bin/perl BEGIN { $| = 1; $^W = 1; } use strict; use warnings; use Tk; use Tk::X11Font; use Tk::XFontSelect; my $font = "-adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859- +1"; my $mw = MainWindow->new; $mw->geometry('100x150'); my $fontdialog = $mw->XFontSelect; $fontdialog->Show; my $label = $mw->Label( -bg => 'white', -text => "Help!", -font => \$font, )->pack; MainLoop;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1002623]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2014-09-22 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls