Hungarian Runic writing
"Hidasi Zsolt" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
Hi Rob, Thanks a lot for your answer. I was really suprised (and happy of course) that somebody took interest in this subject. >My opinion is that currently the Text Widget as implemented at the >C-level isn't really designed to support some of the tricky presentation >requirements needed for several languages. >... >Along the way, I played with fribidi - http://imagic.weizmann.ac.il/~dov/freesw/FriBidi/ >which has a perl module... Yes, I agree: the text widget is not for special requirements, such as RTL writing and so on. What does C-level mean? I had a look at the web site of FriBidi and I found it promising. The trouble is that I have no C compiler on my Windows machine. Although at home I use Linux (and an old SGI) so I could try FriBidi, I'd like to make a pure perl program because - besides some WEB technologies -, perl is the only programming language what I know fairly well to make platform independent GUI applications. (Anyway my profession is a PL/SQL developer.) By the way I was curious what can Visual C++ make with RTL writing. I tried to make a Windows Form by .Net, and there wasn't any problem with wrapping and scrollbars. Good for .Net programmers... C++ is one of the things what I'll have to study... >It might even be worth looking around for other Text >implementations, and then looking into porting it to Perl/Tk. This is >something that I've seen done fairly well in Java. How do you do that? I have no experiences importing things from other languages at all. Would you so kind to send an example? >Has Hungarian Runic been approved for adoption into Unicode, yet? I understand not yet. >Have you read this document: >http://std.dkuug.dk/jtc1/sc2/wg2/docs/n1758.pdf No I haven't until your e-mail. Maybe I'll contact the author. Unfortunately I have no time to work on the Runic Writing (in fact my boss hang around me and I should work on my duty) however I send the standard font (Windows) of Hungarian Runic and the perl code of some very basic experiments. First install the enclosed font set and then run the perl code to see Hungarian Runic. See your answer soon Zsolt
text_canvas.pl
(application/octet-stream, 1.1 KB)
#!e:/perl/bin/perl.exe
use Tk;
use Tk::Text;
require Tk::Adjuster;
use strict;
my $mw = MainWindow->new;
$mw->geometry('600x300');
my $t1 = $mw->Scrolled('Text', -scrollbars=> 'se', -height=> 1, -background =>'SystemWindow', -wrap => 'none')->pack(-side=>'top', -fill=> 'both', -expand=> '1');
my $canvas = $mw->Scrolled('Canvas', -scrollbars => 'se', -height=> 1, -background => 'SystemButtonFace')->pack(-side=>'bottom', -fill=> 'both', -expand=> '1');
my $t2 = $canvas->createText(600,0, -anchor => 'e', -justify => 'right', -font=>[-family => 'Rovas Szabvany JB', -weight => 'bold']);
$mw->Adjuster->packAfter($canvas, -side => 'bottom', -fill => 'both');
$t1->focus;
$t1->bind('<KeyPress>' => sub {
my @revlines;
my $str = $t1->get('1.0', 'end');
my @lines = split(/\n/,$str);
foreach (@lines) {
my $revstr = reverse $_;
@revlines = (@revlines, $revstr);
}
$canvas->dchars($t2, '0','end');
foreach (@revlines) {
$canvas->insert($t2, 'end', "$_\n");
}
$canvas->configure(-scrollregion => [$canvas->bbox("all")]);});
MainLoop;
text_reverser2.pl
(application/octet-stream, 1.1 KB)
#!e:/perl/bin/perl.exe
use Tk;
use Tk::Text;
require Tk::Adjuster;
use strict;
my $mw = MainWindow->new;
my $t2 = $mw->Scrolled('Text', -scrollbars=> 'ose', -height=> 5, -background =>'SystemButtonFace', -wrap => 'none')->pack(-side=>'bottom', -fill=> 'both', -expand=> '1');
my $t1 = $mw->Scrolled('Text', -scrollbars=> 'ose', -height=> 5, -background =>'SystemWindow', -wrap => 'none')->pack(-side=>'bottom', -fill=> 'both', -expand=> '1');
$t2->tagConfigure('right', -font=>[-family => 'Rovas Szabvany JB', -weight => 'bold'], -justify => 'right');
$mw->Adjuster->packAfter($t2, -side => 'bottom', -fill => 'both');
$t1->focus;
$t1->bind('<KeyPress>' => sub {
my @revlines;
my $str = $t1->get('1.0', 'end');
my @lines = split(/\n/,$str);
foreach (@lines) {
my $revstr = reverse $_;
@revlines = (@revlines, $revstr);
}
$t2->delete('1.0','end');
foreach (@revlines) {
$t2->insert('end', "$_\n", 'right');
}
my $idx1 = $t1->index('insert');
$t2->SetCursor($idx1);});
MainLoop;
ROVSTDJB.TTF
(application/octet-stream, 54.5 KB) - not displayed