add quarter space between asian and non-asian.
authorimiyazaki <imiyazaki>
Fri, 23 Jan 2004 12:12:23 +0000 (12:12 +0000)
committerimiyazaki <imiyazaki>
Fri, 23 Jan 2004 12:12:23 +0000 (12:12 +0000)
preserve space in UniKS.

inCHISE

diff --git a/inCHISE b/inCHISE
index 9f7a731..9be4492 100755 (executable)
--- a/inCHISE
+++ b/inCHISE
@@ -60,7 +60,7 @@ my $forbidden_before
 my $slightly_forbidden_before
     = '\x{000a}\#\-‐−‰′″℃゛゜ゝゞヽヾ"%-゙゚';
 
-my $asian = '\x{1100}-\x{11FF}\x{2E80}-\x{D7AF}\x{F900}-\x{FAFF}\x{FE30}-\x{FE4F}\x{FF00}-\x{FFFFFF}';
+my $asian = '\x{1100}-\x{11FF}\x{2E80}-\x{D7AF}\x{F900}-\x{FAFF}\x{FE30}-\x{FE4F}\x{FF00}-\x{FFFFFF}'; # need to fix.
 
 my $space = '\x{0020}\x{0009}\x{000A}\x{000C}\x{000D}';
 
@@ -170,6 +170,10 @@ foreach $out_cs ('UniCNS','UniGB','UniJIS','UniKS','UniMulti'){
 
 while(<>){
     utf8::decode($_);
+
+    s/([$asian])\s+([$asian])/$1$2/g unless($out_cs eq 'UniKS');
+    s/([$asian])\s*([^$asian])/$1 $2/g;
+    s/([^$asian])\s*([$asian])/$1 $2/g;
     if($in_cs ne 'ucs@mcs'){
        s/(.)/&get_char_in_mcs($1,$in_cs)/ge;
     }
@@ -182,7 +186,17 @@ while(<>){
        $char_id=unpack("U",$char);
 
        if($char_id<=0x20){
-           print $chars[$i];
+           # add quarter space between asian and non-asian.
+           if($i>0 and $i<$#chars){
+               if((($chars[$i-1]=~/[$asian]/)
+                   and($chars[$i+1]=~/[^$asian]/))
+                  or(($chars[$i-1]=~/[^$asian]/)
+                     and($chars[$i+1]=~/[$asian]/))){
+                   print '{\selectjisfont\hspace{.25ex}}';
+               }else{
+                   print " ";
+               }
+           }
            next CHAR;
        }elsif($char=~m/($tex_meta_re)/o){
            print $tex_meta{$1};
@@ -306,6 +320,11 @@ sub add_break{
        }
     }
     if(($i<$#chars)
+       and($chars[$i+1]eq" ")){
+       # preserve space.
+       return "";
+    }
+    if(($i<$#chars)
        and($chars[$i+1]=~m/[$strictly_forbidden_before]/o)){
        return "\\CJKunbreakablekernone ";
     }