annotate make14x14ja.pl @ 6:4ed010b4a017

batsu
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 26 Dec 2013 09:01:31 +0900
parents a6ddaa18e3c1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #!/usr/bin/perl
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 use ucs2jis;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 # printf "%04x\n",&to_ucs(eval($ARGV[0]));
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 my $ucs_bdf = "/Users/kono/Desktop/Archives/12x13ja.bdf";
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 my $jis_bdf = "/Users/kono/Desktop/Archives/k14.bdf";
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 my $ucs14_bdf = "14x14ja.bdf";
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 my %jischar;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 my $debug = 0;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 my $header = <<'EOFEOF';
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 STARTFONT 2.1
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 COMMENT JIS X208 glyphs donated by T.Maebashi <maebashi@mcs.meitetsu.co.jp>
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 COMMENT Adapted and extended for ISO 10646-1 by Markus Kuhn <mkuhn@acm.org>
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 COMMENT Hangul glyphs prepared by Won-kyu Park <wkpark@chem.skku.ac.kr>
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 COMMENT from BAEKMUK font.
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 COMMENT Id: 14x14ja.bdf,v 1.23 2000-12-07 21:56:41+00 mgk25 Exp mgk25 $
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 FONT -misc-fixed-medium-r-normal-ja-14-130-75-75-c-140-iso10646-1
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 SIZE 14 75 75
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 FONTBOUNDINGBOX 14 14 0 -2
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24 STARTPROPERTIES 22
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 FONTNAME_REGISTRY ""
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 FOUNDRY "Misc"
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 FAMILY_NAME "Fixed"
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 WEIGHT_NAME "Medium"
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 SLANT "R"
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 SETWIDTH_NAME "Normal"
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 ADD_STYLE_NAME "ja"
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 PIXEL_SIZE 14
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 POINT_SIZE 130
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 RESOLUTION_X 75
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 RESOLUTION_Y 75
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 SPACING "C"
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 AVERAGE_WIDTH 140
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 CHARSET_REGISTRY "ISO10646"
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 CHARSET_ENCODING "1"
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 DEFAULT_CHAR 0
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 FONT_DESCENT 2
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 FONT_ASCENT 12
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 COPYRIGHT "Public domain font. Share and enjoy."
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 _XMBDFED_INFO "Edited with xmbdfed 4.3."
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 CAP_HEIGHT 9
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 X_HEIGHT 7
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47 ENDPROPERTIES
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 EOFEOF
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 open(JIS,"<$jis_bdf");
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 my $jis = 0;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53 my $jis0;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 my $char;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 while(<JIS>) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 if ($jis) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 $char .= $_;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 }
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 if (/^STARTCHAR ([\da-z]+)/) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 $char = '';
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61 $jis0 = hex($1);
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 } elsif (/^ENCODING/) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 $jis = $jis0;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 } elsif (/^ENDCHAR/) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 if ($jis) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 $jischar{$jis} = $char;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 }
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 $jis = $jis0 = 0;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 }
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 }
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73 my $uid;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 open(U14,">$ucs14_bdf");
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 open(UNICODE,"<$ucs_bdf");
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 $jis = '';
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 print U14 $header;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 while(<UNICODE>) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 last if (/ENDPROPERTIES/);
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 }
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 while(<UNICODE>) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 $jis = 0 if (/^STARTCHAR/);
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 next if ($jis); # skipping replacement
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 if (/^ENCODING (\d+)/) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 my $id = $1;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 printf "ucs 0x%x ",$id if ($debug);
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87 if (defined($jis = to_jis($id))
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 && defined($jischar{$jis})) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89 printf "defined 0x%x\n",$jis if ($debug);
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 print U14;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 print U14 $jischar{$jis};
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92 $jis = 1;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93 } else {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94 $jis = 0;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 print "not defined\n" if ($debug);
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 print U14;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97 }
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 } elsif (/^ENDCHAR/) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99 if (!$jis) {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100 print U14 "0000\n";
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 # print U14 "0000\n";
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 }
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 print U14;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104 } else {
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 s/^DWIDTH 12 0/DWIDTH 14 0/;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 s/^BBX 12 13 0 -2/BBX 14 14 0 -2/;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107 print U14;
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108 }
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 }
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110
a6ddaa18e3c1 k14 unicode font kit
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111 # end