use $omegadb_path of Chise_utils.pm.
[chise/omega.git] / makefonts.pl
index 8c0146e..ebb7dc3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl -w -CSD
 # This script requires 't1asm' program, which is part of t1utils package,
 # and 'pfaedit'.
 
@@ -6,15 +6,24 @@ use strict;
 use utf8;
 use IO::Socket::INET;
 use BerkeleyDB;
+require 5.008001;
 
-my $kageaddr="kage2.fonts.jp:80"; # Specify port number!
-my $t1asm = "/sw/bin/t1asm"; # point to 't1asm' executable.
-die "Cannot execute $t1asm. Abort.\n" unless -x $t1asm;
-my $pfaedit="/Users/izumi/work/fonteditor/pfaedit/pfaedit/pfaedit"; # point to 'pfaedit' executable.
-die "Cannot execute $pfaedit. Abort.\n" unless -x $pfaedit;
-my $cleanup_script="svg2t1.pfe"; # Set the name of pfaedit script.
+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 $kagecgi="/~kamichi/test/kagecgi.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.
+#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 $dbpath="$omegadb_path/glyph.db"; # check your DB path.
 
-my $dbpath="/Users/izumi/.chise/glyph.db"; # Set to your DB path.
 # Open Glyph Database
 my $db = new BerkeleyDB::Hash
     -Filename => $dbpath, -Flags => DB_CREATE
@@ -147,26 +156,25 @@ BLACKBOX
             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";
-                #Get redirection info.
-                local $/="\r\n";
-                while(<$kageserver>){
-                    chomp;
-                    next unless m|^location:\s+http://([a-z0-9.:]+)/|i;
-                    $location=$1;
-                }
-                close($kageserver);
-                print STDERR "Connecting $location...\n";
-                if($location
-                   and $kageserver=IO::Socket::INET->new($location)){
-                    print $kageserver "GET /$request.svg HTTP/1.1\r\n";
-                    print $kageserver "Host: $location\r\n\r\n";
+#               #Get redirection info.
+#               local $/="\r\n";
+#               while(<$kageserver>){
+#                   chomp;
+#                   next unless m|^location:\s+http://([a-z0-9.:]+)/|i;
+#                   $location=$1;
+#               }
+#               close($kageserver);
+#               if($location
+#                  and $kageserver=IO::Socket::INET->new($location)){
+#                   print $kageserver "GET /$request.svg HTTP/1.1\r\n";
+#                   print $kageserver "Host: $location\r\n\r\n";
                     local $/; $svg=<$kageserver>;
                     close($kageserver);
                     $svg =~ s/\r//gm; # remove CR.
                     $svg =~ s/^.+\n\n//ms; # remove HTTP header.
-                }else{
-                    $svg="error";
-                }
+#               }else{
+#                   $svg="error";
+#               }
             }else{
                 print STDERR "Cannot connect to KAGE server at $kageaddr.\n";
                 $svg="error";
@@ -194,13 +202,13 @@ BLACKBOX
 #### main ####
 ##############
 
-# Read ids data generated by outCMAP
-my $idsdata="idsdata.pl"; 
+# Read ids data generated by inCHISE
+my $idsdata="$omegadb_path/idsdata.pl";
 my ($font_start, $ids_start, %ids);
 if(-e $idsdata){
     # "require" doesn't work well.
     # I don't know why...
-    open (my $data, "<$idsdata");
+    open (my $data, "<:utf8","$idsdata");
     while(<$data>){
        eval $_;
     }