update.
[chise/omega.git] / outCMAP
diff --git a/outCMAP b/outCMAP
index eedb485..dd9411d 100755 (executable)
--- a/outCMAP
+++ b/outCMAP
@@ -12,7 +12,6 @@ use vars qw($omegadb_path
            $char $char_id $out_char
            $ids $ids_argc %ids $idsdb
            $idsdata_file $ids_start $font_start
-           %utf8mcs_map_from
            $inotp $perl56 $perl58
            @CDP @HZK @GT
            );
@@ -25,7 +24,8 @@ my $omegadb_path="/usr/local/lib/chise/omega";
 
 ### Options ###
 
-$opt_order='jtcgkh';
+$opt_order='jcgk';
+#$opt_order='jtcgkhd';
 $opt_protrude=0;# 1=true, 0=false.
 
 ###
@@ -139,12 +139,11 @@ $ids="";
        'k'=>'UniKS',
        't'=>'GT',
        'h'=>'HZK',
-       # not implemented yet.
-       # 'd'=>'CDP',
+       'd'=>'CDP',
        );
 
 if(defined($opt_order)){
-    if($opt_order=~/^[cgjkth]*$/){
+    if($opt_order=~/^[cgjkthd]*$/){
        @order=split(//,$opt_order);
        @order=map {$order{$_}} @order;
     }else{
@@ -176,7 +175,7 @@ while(<>){
        if($char_id<=0x20){
            print $chars[$i];
            next;
-       }elsif($char_id>0x20 and $char_id<=0x02ff){
+       }elsif($char_id>0x20 and $char_id<=0x02af){
            # Basic Latin
            # Latin-1 Supplement
            # Latin Extended-A
@@ -281,7 +280,7 @@ sub latin_parse{
     $i++;
     while($i<=$#chars){
        $char_id=unpack("U",$chars[$i]);
-       if($char_id<=0xff){
+       if($char_id>0x20 and $char_id<=0x02af){
            $out_str.=pack("U",$char_id);
        }else{
            $i--;
@@ -397,7 +396,7 @@ sub get_output_char{
     $char=pack('U',$char_id);
 
     if($out_cs eq 'UniJIS'
-       and &get_char_attribute($char,"adobe-unijis-utf16-h")){
+       and &get_char_attribute($char,"vnd-adobe-cid-unijis-utf16-h")){
        if($out_char_id=&get_char_attribute($char,'=ucs@jis')
           or $out_char_id=&get_char_attribute($char,'=ucs')
           or $out_char_id=&get_char_attribute($char,'=>ucs@jis')
@@ -406,7 +405,7 @@ sub get_output_char{
            return pack("U",$out_char_id);
        }
     }elsif($out_cs eq 'UniGB'
-          and &get_char_attribute($char,"adobe-unigb-ucs2-h")){
+          and &get_char_attribute($char,"vnd-adobe-cid-unigb-ucs2-h")){
        if($out_char_id=&get_char_attribute($char,'=ucs@gb')
           or $out_char_id=&get_char_attribute($char,'=ucs')
           or $out_char_id=&get_char_attribute($char,'=>ucs@gb')
@@ -415,7 +414,7 @@ sub get_output_char{
            return pack("U",$out_char_id);
        }
     }elsif($out_cs eq 'UniCNS'
-          and &get_char_attribute($char,"adobe-unicns-ucs2-h")){
+          and &get_char_attribute($char,"vnd-adobe-cid-unicns-ucs2-h")){
        if($out_char_id=&get_char_attribute($char,'=ucs@cns')
           or $out_char_id=&get_char_attribute($char,'=ucs')
           or $out_char_id=&get_char_attribute($char,'=>ucs@cns')
@@ -424,7 +423,7 @@ sub get_output_char{
            return pack("U",$out_char_id);
        }
     }elsif($out_cs eq 'UniKS'
-          and &get_char_attribute($char,"adobe-uniks-ucs2-h")){
+          and &get_char_attribute($char,"vnd-adobe-cid-uniks-ucs2-h")){
        if($out_char_id=&get_char_attribute($char,'=ucs@ks')
           or $out_char_id=&get_char_attribute($char,'=ucs')
           or $out_char_id=&get_char_attribute($char,'=>ucs@ks')
@@ -436,7 +435,7 @@ sub get_output_char{
        foreach $out_cs (@order){
     
            if($out_cs eq 'UniJIS'
-              and &get_char_attribute($char,"adobe-unijis-utf16-h")){
+              and &get_char_attribute($char,"vnd-adobe-cid-unijis-utf16-h")){
                if($out_char_id=&get_char_attribute($char,'=ucs@jis')
                   or $out_char_id=&get_char_attribute($char,'=ucs')
                   or $out_char_id=&get_char_attribute($char,'=>ucs@jis')
@@ -445,7 +444,7 @@ sub get_output_char{
                    return '{\selectjisfont\char'.$out_char_id.'}';
                }
            }elsif($out_cs eq 'UniGB'
-                  and &get_char_attribute($char,"adobe-unigb-ucs2-h")){
+                  and &get_char_attribute($char,"vnd-adobe-cid-unigb-ucs2-h")){
                if($out_char_id=&get_char_attribute($char,'=ucs@gb')
                   or $out_char_id=&get_char_attribute($char,'=ucs')
                   or $out_char_id=&get_char_attribute($char,'=>ucs@gb')
@@ -454,7 +453,7 @@ sub get_output_char{
                    return '{\selectgbsfont\char'.$out_char_id.'}';
                }
            }elsif($out_cs eq 'UniCNS'
-                  and &get_char_attribute($char,"adobe-unicns-ucs2-h")){
+                  and &get_char_attribute($char,"vnd-adobe-cid-unicns-ucs2-h")){
                if($out_char_id=&get_char_attribute($char,'=ucs@cns')
                   or $out_char_id=&get_char_attribute($char,'=ucs')
                   or $out_char_id=&get_char_attribute($char,'=>ucs@cns')
@@ -463,7 +462,7 @@ sub get_output_char{
                    return '{\selectcnsfont\char'.$out_char_id.'}';
                }
            }elsif($out_cs eq 'UniKS'
-                  and &get_char_attribute($char,"adobe-uniks-ucs2-h")){
+                  and &get_char_attribute($char,"vnd-adobe-cid-uniks-ucs2-h")){
                if($out_char_id=&get_char_attribute($char,'=ucs@ks')
                   or $out_char_id=&get_char_attribute($char,'=ucs')
                   or $out_char_id=&get_char_attribute($char,'=>ucs@ks')
@@ -489,8 +488,8 @@ sub get_ids{
     my($char)=@_;
     my $ids="";
     $ids=&get_char_attribute($char,"ids-aggregated")
-       or &get_char_attribute($char,"ids");
-#      or &get_char_attribute($char,"ideographic-structure");
+       or $ids=&get_char_attribute($char,"ids");
+#        or $ids=&get_char_attribute($char,"ideographic-structure");
     $ids=decode('utf8', $ids) if($perl58);
 #    $ids=~s/[? ()]//g;
     return $ids;
@@ -565,7 +564,7 @@ sub get_macro_for_HZK{
 
 sub get_macro_for_CDP{
     my($char_id)=@_;
-    my($char,$cdp);
+    my($char,$cdp,$ucs);
     $char=pack("U",$char_id);
     foreach (@CDP){
        if($cdp=&get_char_attribute($char,$_)){
@@ -573,7 +572,15 @@ sub get_macro_for_CDP{
        }
     }
     if($cdp){
-       return "{\\fontencoding{OT1}\\fontfamily{cdp}\\selectfont\\char".$cdp."}";
+       $ucs=&get_char_attribute(&get_chars_matching("=big5-pua",$cdp),"=ucs");
+       if($ucs){
+           return "{\\fontencoding{OT1}\\fontfamily{cdp}\\selectfont\\char"
+               .$ucs.
+                   "}";
+       }else{
+           print STDERR "This hould not happen.\n";
+           print STDERR "ucs code point of CDP: $cdp not found.\n";
+       }
     }else{
        return undef;
     }