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