use utf8;
use IO::Socket::INET;
use BerkeleyDB;
+use Chise_utils '$omegadb_path';
require 5.008001;
-my $omegadb_path="/usr/local/lib/chise/omega"; # set to the path of your db and script.
-
#my $kageaddr="home.fonts.jp:5100"; # Specify port number!
-my $kageaddr="home.fonts.jp:5101"; # Specify port number!
+my $kageaddr="fonts.jp:80"; # Specify port number!
#my $kagecgi="/~kamichi/test/kagecgi.cgi"; #
+my $kagecgi="v0.4/engine/kage.cgi"; #
+#my $kageaddr="localhost:80"; # Specify port number!
+#my $kagecgi="cgi-bin/kage.cgi"; #
my $t1asm = "/usr/bin/env t1asm"; # point to 't1asm' executable.
#die "Cannot execute $t1asm. Abort.\n" unless -x $t1asm;
-my $pfaedit="/usr/bin/env pfaedit"; # point to 'pfaedit' executable.
+#my $pfaedit="/usr/bin/env pfaedit"; # point to 'pfaedit' executable.
+my $pfaedit="/usr/bin/env fontforge"; # point to 'pfaedit' executable.
#die "Cannot execute $pfaedit. Abort.\n" unless -x $pfaedit;
$omegadb_path=~s!/$!!;
-my $cleanup_script="$omegadb_path/svg2t1.pfe"; # Check the path of pfaedit script.
+my $cleanup_script=""; # Check the path of pfaedit script, if needed.
+
+unless($cleanup_script){
+ if(-e "/usr/local/share/texmf/omega/ocp/local/chise/svg2t1.pfe"){
+ $cleanup_script="/usr/local/share/texmf/omega/ocp/local/chise/svg2t1.pfe";
+ }elsif(-e "/usr/share/texmf/omega/ocp/local/chise/svg2t1.pfe"){
+ $cleanup_script="/usr/share/texmf/omega/ocp/local/chise/svg2t1.pfe";
+ }elsif(-e "/sw/share/texmf/omega/ocp/local/chise/svg2t1.pfe"){
+ $cleanup_script="/sw/share/texmf/omega/ocp/local/chise/svg2t1.pfe";
+ }
+}
+unless($cleanup_script and -e $cleanup_script){
+ print STDERR "svg2t1.pfe not found!\n",
+ "please check \$cleanup_script in $0.\n";
+ exit 1;
+}
+
my $dbpath="$omegadb_path/glyph.db"; # check your DB path.
# Open Glyph Database
# Return: Type1 charstring.
sub svg2charstring {
my ($svg) = @_;
+ $svg=~s/></>\n</g;
my @paths= split(/\n/, $svg);
my ($x1, $y1, $x2, $y2);
my $glyph= "\{\n0 1000 hsbw\n";
for (@paths){
- if(m/error/i){
+ if(m/error/i or m/bad/i){
return undef;
}
next unless /\<path d=\"M([0-9, ]+)Z\"\/\>/;
my $kageserver;
my $location; # For redirection
if($kageserver = IO::Socket::INET->new("$kageaddr")){
- print $kageserver "HEAD /$request.svg HTTP/1.1\r\n";
- print $kageserver "Host: $kageaddr\r\n\r\n";
+ print $kageserver "GET /$kagecgi?$req&shotai=$suffix&type=svg\r\n";
+# print $kageserver "HEAD /$kagecgi?$req&shotai=$suffix&type=svg HTTP/1.1\r\n";
+# print $kageserver "Host: $kageaddr\r\n\r\n";
# #Get redirection info.
# local $/="\r\n";
# while(<$kageserver>){
##############
# Read ids data generated by inCHISE
-my $idsdata="$omegadb_path/idsdata.pl";
+my $idsdata="$omegadb_path/idsdata.txt";
my ($font_start, $ids_start, %ids);
if(-e $idsdata){
# "require" doesn't work well.
# I don't know why...
open (my $data, "<:utf8","$idsdata");
while(<$data>){
- eval $_;
+ utf8::decode($_);
+ if(m/^START\t(\d+)\t(\d+)/){
+ $font_start=$1,$ids_start=$2;
+ }elsif(m/^(.*?)\t(\d+)\t(\d+)/){
+ $ids{$1}=[$2,$3,];
+ }
}
close($data);
}else{
last;
}
}
+ $code=~s/(.)u/$1.u/g;
$Requests[$ids{$key}[0]]->[$ids{$key}[1]]=$code;
}
+print STDERR "Sending query to KAGE server at $kageaddr.\n";
+
# Create fonts.
foreach my $fontnum (0 .. $#Requests){
my @faces=(['Mincho', 'min', 'mincho'],