fix spacing in Hangul.
authorimiyazaki <imiyazaki>
Mon, 2 Feb 2004 12:31:46 +0000 (12:31 +0000)
committerimiyazaki <imiyazaki>
Mon, 2 Feb 2004 12:31:46 +0000 (12:31 +0000)
inCHISE

diff --git a/inCHISE b/inCHISE
index 3fb24fa..cfdf098 100755 (executable)
--- a/inCHISE
+++ b/inCHISE
@@ -60,10 +60,13 @@ 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}'; # need to fix.
+#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 $asian = '\x{2E80}-\x{312f}\x{3190}-\x{ABFF}\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}';
 
+my $hangul='\x{1100}-\x{11ff}\x{3130}-\x{318f}\x{AC00}-\x{D7AF}';
+
 my %tex_meta=('#'=>'\#',
              '$'=>'\\textdollar{}',
              '%'=>'\%',
@@ -176,9 +179,10 @@ while(<>){
     }
     s/(amp.+?;)/&de_tex_er($1)/ge;
 #    s/(&.+?;)/&de_tex_er($1)/ge;
-    s/([$asian])\s+([$asian])/$1$2/g unless($out_cs eq 'UniKS');
-    s/([$asian])\s*([^$asian])/$1 $2/g;
-    s/([^$asian$idc])\s*([$asian])/$1 $2/g;
+    s/([$asian])\s+/$1/go unless($out_cs eq 'UniKS');
+    s/\s+([$asian])/$1/go unless($out_cs eq 'UniKS');
+    s/([$asian])\s*([^$asian$space])/$1 $2/go;
+    s/([^$asian$idc])\s*([$asian])/$1 $2/go;
     s/\-\-\-/pack("U",0x2014)/geo;# EM DASH
     s/\-\-/pack("U",0x2013)/geo;# EN DASH
     s/\`\`/pack("U",0x201f)/geo;# DOUBLE HIGH-REVERSED-9 QUOTATION MARK
@@ -203,10 +207,11 @@ while(<>){
                   ){
                    print '';
                }elsif(($chars[$i-1]=~/[$asian]/
-                       and $chars[$i+1]=~/[^$asian]/)
-                      or($chars[$i-1]=~/[^$asian]/
-                         and $chars[$i+1]=~/[$asian]/)){
-                   print '{\selectjisfont\hspace{.25ex}}';
+                       and $chars[$i+1]=~/[^$asian]/)){
+                   print '\unskip\kern.25ex';
+               }elsif($chars[$i-1]=~/[^$asian]/
+                      and $chars[$i+1]=~/[$asian]/){
+                   print '\kern.25ex';
                }else{
                    print ' ';
                }