in reply to Re^2: Chinese font problem in Perl/Tk
in thread Chinese fonts problem in Perl/Tk

I use Arial Unicode MS from within Perl and Tk applications, see http://mini.net/tcl//11392 for explanations about font itself and http://www.vkonovalov.ru/perlce-tcltk.htm on my few screenshots within Perl+Tcl::Tk using it...

Must be able using it on Linux as well, although I did not tried namely that font there, because my Tk Unicode apps run on Linux w/o problems even without that font (however I don't have enough Chinese knowledge to notice errors :)

Best regards,
Courage, the Cowardly Dog

Replies are listed 'Best First'.
Re^4: Chinese font problem in Perl/Tk
by shockers (Acolyte) on Jan 06, 2005 at 16:32 UTC
    Thanks Courage.

    My script is working 100% okay in Windows anyway. The problem is some of the characters displaying properly in Windows are not displaying properly in Solaris/Linux.

    Looking at http://mini.net/tcl/11392, there may be issues using Arial Unicode MS on Solaris/Linux systems and I'm not sure where in those Solaris/Linux boxes I'd put it.

    If you have a spare moment, you can try running my script on your Linux box to see if all the Chinese characters appear properly. Could be you have additional fonts loaded, but if it's the standard Linux installation, it'd be interesting to see if you get the same problem.

    BTW, even though I'm an ABC Chinese, I can't read a lick of Chinese. I have to get someone else to give me the Chinese and then I convert it to the 16-bit codes.

    The errors with Solaris/Linux appear on the screen as 16-bit codes (eg, \x{6c2e}) instead of the actual Chinese character. From the menu, start with CONFIG->Chinese, then click on EVENT ENTRY. (It will need Tk804. With Tk800, everything appears as garbage).
      now I gained access to linux machine, tried your script but unfortunately my perlTk is 800, so no luck.

      BUT I extracted unicode text, made it Tcl and now you can see all fonts are okay (at least on mandrake10), where I did not did any font setup.

      See screenshot at http://vkonovalov.ru/tcltk-misc/a,tcl.jpg

      here is Tk code:

      pack [text .t] .t insert end " No Operator (61) \u5F85\u64CD\u4F5C\u54E1 Power Down (63) \u96FB\u6E90\u4E2D\u65B7 Contactor Repair (124) \u4FEE\u593E\u8173 Change Cleaning Disk (125) \u66F4\u63DB\u786C\u789F Change Loadboard (127) \u66F4\u63DB\u6E2C\u8A66\u677F Change LN2 (128) \u66F4\u63DB\u6DB2\u614B\u6C2E"
      I don't remember though, did I or not installed Chinese support from rpmdrake...

      Best regards,
      Courage, the Cowardly Dog

        Did you tried my example that I give in parallel post?? Do you receive same screenshot as mine? (to run, you need save my code as file, run 'wish' on it, and you should see mine screenshot)

        I saved the sample code to tksample.tk and simply ran "wish tksample.tk".

        On Solaris 8, this didn't work for me. It displayed the 6 lines between the quotes verbatim without any translation. Did I overlook something?

        Regarding the widget demos that had the Unicode text demo, they were run on each OS using the respective Activeperl 5.8.4 for each OS. There shouldn't be any Solaris/Linux incompatibility problems running widget.
      due to some concrete difficulties I can't try your code within required configuration right now. I can try later.

      However could you please provide screenshot with a problem?

      Best regards,
      Courage, the Cowardly Dog

        Snapshot links embedded below. Click on "normal" size for proper viewing.

        Looks like it boils down to installing/accessing the correct font on Unix. Guess we can toss out my example and just look at the widget demos and the chfont.pl demo zentara passed along.

        Surprising that CPAN's perl 5.8.5 widget demo (snapshot here) did not have the Unicode demo that are in ActivePerl's (5.8.4, all OS's) widget demo

        Here are the snapshots of the "Labels and Unicode Text" demo (unicodeout.pl): Win32 is correct whereas Linux, Solaris 8, and Solaris 2.6 all have the same problems.

        zentara's chfont.pl had similar results: Win32 is fine, but Linux, Solaris 8, and Solaris 2.6 do not.

        So the basic questions remains: Do we need to get a different font file? Where would it go? Does the script need to call a particular font a particular way?