enable tex meta characters.
authorimiyazaki <imiyazaki>
Wed, 26 Nov 2003 14:59:18 +0000 (14:59 +0000)
committerimiyazaki <imiyazaki>
Wed, 26 Nov 2003 14:59:18 +0000 (14:59 +0000)
inCHISE

diff --git a/inCHISE b/inCHISE
index 19a8eff..c5801cb 100755 (executable)
--- a/inCHISE
+++ b/inCHISE
@@ -33,7 +33,7 @@ $opt_order{'UniGB'}='g';
 $opt_order{'UniJIS'}='j';
 $opt_order{'UniKS'}='k';
 
-$opt_allow_unify=0; # 1=true, 0=false.
+$opt_allow_unify=1; # 1=true, 0=false.
 $opt_protrude=0;# 1=true, 0=false.
 
 # currently does not work.
@@ -66,6 +66,18 @@ my $asian = '\x{1100}-\x{11FF}\x{2E80}-\x{D7AF}\x{F900}-\x{FAFF}\x{FE30}-\x{FE4F
 
 my $space = '\x{0020}\x{0009}\x{000A}\x{000C}\x{000D}';
 
+my %tex_meta=('#'=>'\#',
+             '$'=>'\\textdollar{}',
+             '%'=>'\%',
+             '&'=>'\&',
+             '{'=>'\\textbraceleft{}',
+             '}'=>'\\textbraceright{}',
+             '\\'=>'\\textbackslash{}',
+             '_'=>'\\textunderscore',
+            );
+
+my $tex_meta_re=join('|',map {quotemeta($_)} keys %tex_meta);
+
 &GetOptions("in=s"=>\$opt_in_cs,
            "out=s"=>\$opt_out_cs,
            "help",\$opt_help);
@@ -123,8 +135,8 @@ if(-e $idsdata_file){
 $ids_argc=0;
 $ids="";
 
-$geta=pack("U",0x3013);
-#$geta=pack("U",0xfffd);
+#$geta=pack("U",0x3013);
+$geta=pack("U",0xfffd);
 
 @GT=(#"=gt","=gt-k",
      "=gt-pj-1","=gt-pj-2","=gt-pj-3","=gt-pj-4","=gt-pj-5",
@@ -174,6 +186,9 @@ while(<>){
        if($char_id<=0x20){
            print $chars[$i];
            next CHAR;
+       }elsif($char=~m/($tex_meta_re)/o){
+           print $tex_meta{$1};
+           next CHAR;
        }elsif($char_id>0x20 and $char_id<=0x02af){
            # Basic Latin
            # Latin-1 Supplement
@@ -325,7 +340,7 @@ sub latin_parse{
        }
        $i++;
     }
-    return '{\normalfont {'.$out_str.'}}';
+    return '{\fontencoding{UT1}\fontfamily{omlgc}\selectfont '.$out_str.'}';
 }
 
 sub ids_parse{
@@ -375,7 +390,7 @@ sub get_macro_for_ids{
     # return: TeX macro for ids
     #          or GETA character if ids is invalid for KAGE.
     my($ids)=@_;
-    $ids=&normalize_ids($ids,"UniJIS");
+    # $ids=&normalize_ids($ids,"UniJIS");
     return $geta if(($ids!~/[$idc]/)
                    or($ids=~/[\x{10000}-]/));
                     #irregular for KAGE.