# unicodeout.pl

use vars qw/$TOP/;
use subs qw/unicodeadd/;

sub unicodeout {

    # This demonstration script shows how you can produce output (in label
    # widgets) using many different alphabets.

    my($demo) = @_;
    $TOP = $MW->WidgetDemo(
        -name     => $demo,
        -text     => 'This is a sample of Perl/Tk\'s support for languages that use non-Western character sets.  However, what you will actually seebelow depends largely on what character sets you have installed, and what you see for characters that are not present varies greatly between platforms as well.  The strings are written in Perl Unicode characters using the \\x{XXXX} escape sequence so as to do so in a portable fashion.',
        -title    => 'Unicode Label Demonstration',
        -iconname => 'unicodeout',

    my $unicode_wait = $TOP->Label(
        -text => 'Please wait while loading fonts...',
        -font => 'Helvetica 12 italic',

    # Processing when some characters are missing might take a while, so make
    # sure we're displaying something in the meantime.


    unicodeadd $TOP, 'Arabic',
    unicodeadd $TOP, "Trad. Chinese", "\x{4E2D}\x{570B}\x{7684}\x{6F22}\x{5B57}";
    unicodeadd $TOP, "Simpl. Chinese", "\x{6C49}\x{8BED}";
    unicodeadd $TOP, 'Greek', 
    unicodeadd $TOP, 'Hebrew', 
    unicodeadd $TOP, 'Japanese', 
    unicodeadd $TOP, 'Korean',
    unicodeadd $TOP, 'Russian', 

    # We're done processing, so change things back to normal running.


} # end unicodeout

sub unicodeadd {

    my ($w, $language, @args) = @_;

    my $sample = join('', @args);
    my $l1 = $w->Label(-text => "$language: ", qw/-anchor nw -pady 0/);
    my $l2 = $w->Label(-text => $sample, qw/-anchor nw -width 30 -pady 0/);
    $l1->grid($l1, $l2, qw/-sticky ew -pady 0/);
    $l1->gridConfigure(qw/-padx 1m/);

} # end unicodeadd