From: imiyazaki Date: Fri, 25 Apr 2003 15:25:45 +0000 (+0000) Subject: fix bug: Some characters were lost when multiple code point designatesame cid. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=f0e209b575d3005def93be786dcbab2fb614eeb8;p=chise%2Fomega.git fix bug: Some characters were lost when multiple code point designatesame cid. --- diff --git a/make_omegadb.pl b/make_omegadb.pl index f66a5a8..117eacb 100644 --- a/make_omegadb.pl +++ b/make_omegadb.pl @@ -54,8 +54,8 @@ Usage: perl $0 This creates the databases required by Omega/CHISE. EOF -#my $cmapdir="/usr/local/share/texmf/dvipdfm/CMap"; -#my $db_home="$HOME/.chise"; +#my $cmapdir="/usr/local/share/texmf/dvipdfm/CMap-AcrobatReader5.0"; +#my $db_home="./omegadb"; if(@ARGV==2){ $cmapdir=shift; $db_home=shift; @@ -112,7 +112,18 @@ foreach $target (keys %cmaps){ if(/<([\da-fA-F]+)>\s*<([\da-fA-F]+)>\s*(\d+)/){ ($from, $to, $cid) = (hex($1), hex($2), $3); while ($from <= $to) { - $cid{$target}->{$cid++}=$from++; + # DB¤Î¥Þ¥Ã¥Ô¥ó¥°¥Æ¡¼¥Ö¥ë¤Ë¤Ê¤¤¤Î¤Ëcid¤¬¤¢¤ë¾ì¹ç¤Ï + # UCS ¤½¤Î¤Þ¤Þ¤Ç¤è¤¤¡© + + if(defined($mapto{$target}->{$from})){ + $charid=$mapto{$target}->{$from}; + }else{ + $charid=$from; + } + unless($ciddb{$target}->db_put($charid,$from)==0){ + die $!; + } + $cid++,$from++; } } } @@ -121,26 +132,7 @@ foreach $target (keys %cmaps){ print STDERR "done!\n"; } -foreach $target (keys %cmaps){ - print STDERR "Storing data for Uni",uc($target),"..."; - foreach $cid (keys %{$cid{$target}}){ - # $cid{$target}->{$cid} ¢« ucs in UniJIS, etc. - $ucs=$cid{$target}->{$cid}; - # DB¤Î¥Þ¥Ã¥Ô¥ó¥°¥Æ¡¼¥Ö¥ë¤Ë¤Ê¤¤¤Î¤Ëcid¤¬¤¢¤ë¾ì¹ç¤Ï - # UCS ¤½¤Î¤Þ¤Þ¤Ç¤è¤¤¡© - if(defined($mapto{$target}->{$ucs})){ - $charid=$mapto{$target}->{$ucs}; - }else{ - $charid=$ucs; - } - unless($ciddb{$target}->db_put($charid,$ucs)==0){ - die $!; - } - } - print STDERR "done!\n"; -} - -# creating reverse ids DB. +# creating ids DB. my $idsdb_filename="idsdb"; my($idsdb,$ids); if(-f "$db_home/$idsdb_filename"){