11 open U
, '<', 'unifont.hex' or
12 open U
, '<', '/usr/share/unifont/unifont.hex' or die $!;
13 open O
, '>', 'unifont.pixelfont' or die $!;
15 my ($ch, $hex) = /^([[:xdigit:]]+):([[:xdigit:]]+)$/;
23 open O
, '<', 'unifont.pixelfont' or die $!;
24 open P
, '>', 'preload_font.h' or die $!;
25 print P
"static const unsigned char fontdata_preloaded[] = {";
32 printf P
"% 4d,", ord $_;
38 open O
, '>', 'unifont.pixelfont' or die $!;
41 while (++$last_ch < $ch) {
42 # print "Missing entry for ".($last_ch - 1 )."\n";
43 print O
pack 'C', 0x00;
47 my $len = length($hex) / 16;
56 die "No handling for len = $len\n";
66 my $c = substr($hex, (15 - $_) * $len, $len);
69 if (!defined $start) {
70 # Skip blank rows at the bottom.
77 # my $b = sprintf $fmt, $row;
83 my $lsb_used = $pixels_set & -$pixels_set;
84 my $msb_used = 1 << ($len * 4 - 1);
85 while ($msb_used > $pixels_set) {
89 $data = join '', map {pack($packcode, $_ << $left_gap)} @data;
90 my $right_gap = $bitno{$lsb_used} + $left_gap;
91 $right_gap = 0 if ($left_gap == 16);
97 if (!defined $start) {
99 print O
pack 'C', ($len * 4 - 4);
100 die "not really empty!" unless $hex =~ /^0*$/;
102 die "really empty!" if $hex =~ /^0*$/;
103 $n = $n + 1 - $start;
104 print O
pack 'C', (($len / 2) << 6) | $width;
105 print O
pack 'C', ($start << 4) | ($n - 1);
106 die "too little data (".length($data)." < ".$n."*".($len/2).")" if length($data) < $n * $len/2;
107 print O
substr($data, 0, $n * $len / 2);