From: imiyazaki Date: Wed, 26 Nov 2003 14:59:18 +0000 (+0000) Subject: enable tex meta characters. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80a0c382222b050a3a3eb1f360e2b581cf2031e5;p=chise%2Fomega.git enable tex meta characters. --- diff --git a/inCHISE b/inCHISE index 19a8eff..c5801cb 100755 --- 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.