1 |
wakaba |
1.1 |
|
2 |
|
|
=pod
|
3 |
|
|
|
4 |
|
|
Number2XBM
|
5 |
|
|
Change: Public Domain
|
6 |
|
|
|
7 |
|
|
2001-07-14 wakaba <wakaba@suika.fam.cx>
|
8 |
|
|
- Data::Number2XBM.pm.
|
9 |
|
|
2001-07-09 wakaba
|
10 |
|
|
- Counter.cgi. Glyphs of numbers are taken from jiskan16.bdf.
|
11 |
|
|
1984-**-** JISC <http://www.jisc.org/>
|
12 |
|
|
- JIS X 9051-1984.
|
13 |
|
|
|
14 |
|
|
=cut
|
15 |
|
|
|
16 |
|
|
package Data::Number2XBM;
|
17 |
|
|
|
18 |
|
|
sub convert {
|
19 |
|
|
my $count = shift;
|
20 |
|
|
my $keta = shift;
|
21 |
|
|
|
22 |
|
|
@char0 = ('0x00,0x00,', '0xC0,0x03,', '0x20,0x04,', '0x10,0x08,', '0x10,0x08,', '0x18,0x18,', '0x08,0x10,', '0x08,0x10,', '0x08,0x10,', '0x08,0x10,', '0x18,0x18,', '0x10,0x08,', '0x10,0x08,', '0x20,0x04,', '0xC0,0x03,', '0x00,0x00,', );
|
23 |
|
|
@char1 = ('0x00,0x00,', '0x80,0x00,', '0xC0,0x00,', '0xA0,0x00,', '0x90,0x00,', '0x80,0x00,', '0x80,0x00,', '0x80,0x00,', '0x80,0x00,', '0x80,0x00,', '0x80,0x00,', '0x80,0x00,', '0x80,0x00,', '0x80,0x00,', '0xE0,0x03,', '0x00,0x00,', );
|
24 |
|
|
@char2 = ('0x00,0x00,', '0xE0,0x07,', '0x30,0x08,', '0x18,0x10,', '0x08,0x10,', '0x00,0x10,', '0x00,0x18,', '0x00,0x0C,', '0x00,0x06,', '0x00,0x03,', '0x80,0x01,', '0xC0,0x00,', '0x60,0x00,', '0x30,0x00,', '0xF8,0x1F,', '0x00,0x00,', );
|
25 |
|
|
@char3 = ('0x00,0x00,', '0xC0,0x07,', '0x70,0x08,', '0x18,0x10,', '0x00,0x10,', '0x00,0x10,', '0x00,0x08,', '0xE0,0x07,', '0x00,0x08,', '0x00,0x10,', '0x00,0x10,', '0x00,0x10,', '0x00,0x18,', '0x00,0x0E,', '0xF8,0x03,', '0x00,0x00,', );
|
26 |
|
|
@char4 = ('0x00,0x00,', '0x00,0x06,', '0x00,0x07,', '0x80,0x05,', '0xC0,0x04,', '0x60,0x04,', '0x30,0x04,', '0x18,0x04,', '0x0C,0x04,', '0x04,0x04,', '0xFC,0x3F,', '0x00,0x04,', '0x00,0x04,', '0x00,0x04,', '0x00,0x1F,', '0x00,0x00,', );
|
27 |
|
|
@char5 = ('0x00,0x00,', '0xF8,0x1F,', '0x08,0x00,', '0x08,0x00,', '0x08,0x00,', '0x08,0x00,', '0xE8,0x07,', '0x18,0x08,', '0x08,0x10,', '0x00,0x10,', '0x00,0x10,', '0x00,0x18,', '0x00,0x0C,', '0x00,0x07,', '0xF8,0x01,', '0x00,0x00,', );
|
28 |
|
|
@char6 = ('0x00,0x00,', '0x00,0x0F,', '0xC0,0x01,', '0x60,0x00,', '0x30,0x00,', '0x10,0x00,', '0xD8,0x03,', '0x28,0x0C,', '0x18,0x18,', '0x08,0x10,', '0x08,0x10,', '0x18,0x10,', '0x10,0x18,', '0x30,0x0C,', '0xC0,0x03,', '0x00,0x00,', );
|
29 |
|
|
@char7 = ('0x00,0x00,', '0xF8,0x3F,', '0x08,0x10,', '0x08,0x18,', '0x08,0x08,', '0x00,0x0C,', '0x00,0x04,', '0x00,0x06,', '0x00,0x02,', '0x00,0x03,', '0x00,0x01,', '0x00,0x01,', '0x80,0x01,', '0x80,0x00,', '0x80,0x00,', '0x00,0x00,', );
|
30 |
|
|
@char8 = ('0x00,0x00,', '0xC0,0x03,', '0x30,0x0C,', '0x18,0x18,', '0x08,0x10,', '0x08,0x10,', '0x10,0x08,', '0xE0,0x07,', '0x10,0x08,', '0x08,0x10,', '0x08,0x10,', '0x08,0x10,', '0x18,0x18,', '0x30,0x0C,', '0xC0,0x03,', '0x00,0x00,', );
|
31 |
|
|
@char9 = ('0x00,0x00,', '0xC0,0x03,', '0x30,0x0C,', '0x18,0x08,', '0x08,0x18,', '0x08,0x10,', '0x08,0x10,', '0x18,0x18,', '0x30,0x14,', '0xC0,0x1B,', '0x00,0x08,', '0x00,0x0C,', '0x00,0x06,', '0x80,0x03,', '0xF0,0x00,', '0x00,0x00,', );
|
32 |
|
|
|
33 |
|
|
$count = substr(('0' x $keta).$count,-$keta);
|
34 |
|
|
my @count = split('', $count);
|
35 |
|
|
my $width = $keta * 16;
|
36 |
|
|
|
37 |
|
|
my $ret = <<EOH;
|
38 |
|
|
#define c_width ${width}
|
39 |
|
|
#define c_height 16
|
40 |
|
|
static char c_bits[] = {
|
41 |
|
|
EOH
|
42 |
|
|
|
43 |
|
|
for $j (0...15) {
|
44 |
|
|
for $i (0...($keta-1)) {
|
45 |
|
|
$ret .= ${'char'.$count[$i]}[$j];
|
46 |
|
|
}
|
47 |
|
|
$ret .= "\n";
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
$ret .= '}';
|
51 |
|
|
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
1;
|