From 8d14af6c33129c7585628f7821f16e8e2840b314 Mon Sep 17 00:00:00 2001 From: imiyazaki Date: Fri, 10 Oct 2003 13:02:13 +0000 Subject: [PATCH] fix the place of variables. --- chise2otf/add_adobecid.pl | 49 +++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/chise2otf/add_adobecid.pl b/chise2otf/add_adobecid.pl index 8cf112b..1d22957 100644 --- a/chise2otf/add_adobecid.pl +++ b/chise2otf/add_adobecid.pl @@ -17,7 +17,7 @@ if($^V and $^V ge v5.8){ }elsif($^V and $^V ge v5.6){ $perl56=1; }else{ - print STDERR "This versin is not supported."; + print STDERR "This version is not supported."; } if($perl58){ eval "use Encode"; @@ -51,13 +51,27 @@ if(@ARGV==2){ ($encoding=$cmapfile)=~s!.*/Uni(\w+).*$!"\=ucs\@".lc($1)!e; } -unless(-f $cmapfile +unless(defined($cmapfile) and -f $cmapfile and $encoding=~/^=ucs\@(cns|gb|jis|ks)$/ and -d $db_home){ print $usage; exit 1; } +$cs_var{'=ucs@cns'}=['=cns11643-1','=cns11643-2', + '=cns11643-3','=cns11643-4', + '=cns11643-5','=cns11643-6', + '=cns11643-7']; + +$cs_var{'=ucs@gb'}=['=gb12345','=gb2312']; + +$cs_var{'=ucs@jis'}=['=jis-x0208','=jis-x0208-1978', + '=jis-x0208-1983','=jis-x0208-1990', + '=jis-x0212', + '=jis-x0213-1-2000','=jis-x0213-2-2000']; + +$cs_var{'=ucs@ks'}=['=ks-x1001']; + if(-f "$db_home/$ciddb_filename"){ print STDERR "Removing old DB $db_home/$ciddb_filename.\n"; unlink "$db_home/$ciddb_filename"; @@ -131,7 +145,7 @@ sub store_cid{ } } if($debug){ - print STDERR sprintf("%X:%X\n",unpack("U",$char),$cid); + print STDERR sprintf("%X:%d\n",unpack("U",$char),$cid); } unless($ciddb->db_put("?".$char,$cid)==0){ die $!; @@ -140,19 +154,6 @@ sub store_cid{ exit 0; -$cs_var{'=ucs@cns'}=['=cns11643-1','=cns11643-2', - '=cns11643-3','=cns11643-4', - '=cns11643-5','=cns11643-6', - '=cns11643-7']; - -$cs_var{'=ucs@gb'}=['=gb12345','=gb2312']; - -$cs_var{'=ucs@jis'}=['=jis-x0208','=jis-x0208-1978', - '=jis-x0208-1983','=jis-x0208-1990', - '=jis-x0212', - '=jis-x0213-1-2000','=jis-x0213-2-2000']; - -$cs_var{'=ucs@ks'}=['=ks-x1001']; sub replace_char_id{ my($ucs,$encoding)=@_; @@ -169,9 +170,10 @@ sub replace_char_id{ sub have_glyph{ my($char_id,$cs)=@_; - my($cs_var); + my($cs_var,$char); + $char=pack("U",$char_id); foreach $cs_var (@{$cs_var{$cs}}){ - if(&get_char_attribute(pack("U",$char_id),$cs_var)){ + if(&get_char_attribute($char,$cs_var)){ return 1; } } @@ -181,8 +183,11 @@ sub have_glyph{ sub get_char_id_unified{ my($char_id)=@_; my($chars); - $chars=&get_char_attribute(pack("U",$char_id),'->ucs-unified'); - $chars=~s/^\((.*)\)$/$1/; - $chars=~s/\?//g; - return map {unpack("U",$_)} (split(/\s+/,$chars)); + if($chars=&get_char_attribute(pack("U",$char_id),'->ucs-unified')){ + $chars=~s/^\((.*)\)$/$1/; + $chars=~s/\?//g; + return map {unpack("U",$_)} (split(/\s+/,$chars)); + }else{ + return (); + } } -- 1.7.10.4