From 455d2c1110e3091cbcb34e60771a66a111654643 Mon Sep 17 00:00:00 2001 From: imiyazaki Date: Thu, 2 Sep 2004 13:55:55 +0000 Subject: [PATCH] use IDS data as text file instead of perl script. --- chise2otf/chise2otf | 23 ++++++++++++----------- makefonts.pl | 9 +++++++-- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/chise2otf/chise2otf b/chise2otf/chise2otf index fdcd5a6..4659a4e 100755 --- a/chise2otf/chise2otf +++ b/chise2otf/chise2otf @@ -116,21 +116,26 @@ if($opt_replace){ $texmacro[0x1E5D]='{\ifmmode \ucirc{\bar{r}}\else \ucirc{\={r}}\fi}'; } -$idsdata_file="$omegadb_path/idsdata.pl"; +$idsdata_file="$omegadb_path/idsdata.txt"; $ids_start=0x00; $font_start=0; if(-e $idsdata_file){ - open(IDSDATA,"+<$idsdata_file") or die; + open(IDSDATA,"+<:utf8",$idsdata_file) or die; flock(IDSDATA,LOCK_EX); seek(IDSDATA,0,0); while(){ - 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,]; + } } seek(IDSDATA,0,0); -# require $idsdata_file; + truncate(IDSDATA,0); }else{ - open(IDSDATA,">$idsdata_file") or die; + open(IDSDATA,">:utf8",$idsdata_file) or die; flock(IDSDATA,LOCK_EX); seek(IDSDATA,0,0); } @@ -220,14 +225,10 @@ while(<>){ } } -print IDSDATA 'use utf8;',"\n"; +print IDSDATA 'START',"\t",$font_start,"\t",$ids_start,"\n"; foreach $ids (keys %ids){ - print IDSDATA '$ids{\'',$ids,'\'}=' - ,'[',join ",",@{$ids{$ids}},"];\n"; + print IDSDATA $ids,"\t",join("\t",@{$ids{$ids}}),"\n"; } -print IDSDATA '$font_start=',$font_start,";\n"; -print IDSDATA '$ids_start=',$ids_start,";\n"; -print IDSDATA "1;"; flock(IDSDATA,LOCK_UN); if($exec_makefonts){ diff --git a/makefonts.pl b/makefonts.pl index ea11519..51274b8 100755 --- a/makefonts.pl +++ b/makefonts.pl @@ -224,14 +224,19 @@ BLACKBOX ############## # 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{ -- 1.7.10.4