Re: Fonts in PTK

Petr Pajas <[email protected]>
Newsgroups gmane.comp.lang.perl.tk
Organization UFAL MFF UK
Message-ID <[email protected]>
On Friday 04 November 2005 05:33 dusek wrote:
> I correct
>
> In version ActiveState-Perl  =<  5.8.3 is all right.
>
> I am sorry.

Hi,

I might be wrong, but it seems that your problem might be caused by the fact 
that the latest release of AP uses a UTF8-enabled version of Tk, namely 
Tk804, instead of the old 8bit Tk800 (check the version with e.g. perl -M"Tk 
1000").

If so, turn all strings passed to / obtained from Tk to UTF8. This includes 
all literals (so you must either recode your source to utf8 and add "use 
utf8" at the beginning or leave it in some 8-bit encoding and add e.g. "use 
encoding 'iso-8859-2'"; non-literal strings that you get via IO are best 
handled using perl IO layers). Then, you don't have to worry about specifying 
the right encoding part in the font spec. In Tk804 it is ignored, anyway.

There are two side notes about switching to Tk804: 
1/ do it, it is much easier to deal with a unified UTF8-based API in perl5.8

2/ the last release of ActivePerl (with Tk804) had problems with displaying 
some accented characters because of an incompatibility between the Encode and 
Tk modules. This has been solved by people from ActiveState a few days ago. 
Unless they have already made a new release, you'll have to work around the 
problem put the following lines after "use Tk":

  # work around an incomatibility of Tk and Encode 2.10
  if (defined $Tk::encodeFallback and 
      $Tk::encodeFallback == Encode::FB_PERLQQ() and
      Encode::FB_PERLQQ() != Encode::PERLQQ()) {
    $Tk::encodeFallback    = Encode::PERLQQ();
  }

-- Petr

>
> dusek napsal(a):
> > Hi,
> > I have font's problem with iso-8859-2 and CP1250.
> >
> > If I used  in WIN32
> > my $general_font = "-adobe-helvetica-bold-r-normal--16-*-*-*-*-*-cp1250";
> > my
> > $LabelTopZboziLabel=$LabelTop->Label(-text=>"Zboží",-takefocus=>1,-font=>
> >$general_font,-relief=>"ridge")
> >
> >    ->form(-top=>[5],-left=>[5],-bottom=>[25],-right=>[60]);
> >
> > or  Linux
> >
> > my $general_font =
> > "-adobe-helvetica-bold-r-normal--16-*-*-*-*-*-iso-8859-2";
> > my
> > $LabelTopZboziLabel=$LabelTop->Label(-text=>"Zboží",-takefocus=>1,-font=>
> >$general_font,-relief=>"ridge")
> >
> >    ->form(-top=>[5],-left=>[5],-bottom=>[25],-right=>[60]);
> >
> > I get wrong string in version ActiveState-Perl  > 5.8.3
> >
> > In version ActiveState-Perl  > 5.8.3 is all right.
> >
> > What is problem?
> >
> > Thank you

-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.