1
|
1 #!/usr/bin/perl
|
|
2
|
|
3 # find used unicode
|
|
4 use strict;
|
|
5 use utf8;
|
|
6 use open qw(:std :utf8); # input/output default encoding will be UTF-8, it looks like default
|
|
7
|
|
8 my %used;
|
6
|
9 my @fonts = <1[0-9]*.bdf> ;
|
|
10
|
|
11 use Getopt::Std;
|
|
12 our ($opt_f);
|
|
13
|
|
14 getopts('f:');
|
|
15
|
|
16 if ($opt_f) {
|
|
17 @fonts = ($opt_f);
|
|
18 }
|
1
|
19
|
|
20 while(<>) {
|
|
21 for my $ch ( /(.)/g ) {
|
2
|
22 next if (ord($ch)<128);
|
4
|
23 # next if (ord($ch)>=12288); # ignore CJKV
|
1
|
24 $used{ord($ch)}++;
|
|
25 }
|
|
26 }
|
|
27
|
6
|
28 for my $bdf ( @fonts ) {
|
1
|
29 open(my $f,"<",$bdf);
|
|
30 my %has;
|
|
31 while(<$f>) {
|
|
32 if (/^ENCODING\s+(\d+)/) {
|
|
33 my $encoding=$1;
|
|
34 $has{$encoding} = 1;
|
|
35 }
|
|
36 }
|
|
37 my %no;
|
|
38 for my $ch ( keys %used ) {
|
|
39 $no{$ch} ++ if (! defined $has{$ch}) ;
|
|
40 }
|
|
41 for my $ch ( sort {$a<=>$b} keys %no ) {
|
2
|
42 my $hex = sprintf("%x",$ch);
|
|
43 print chr($ch)," $ch 0x$hex is not in $bdf\n";
|
1
|
44 }
|
|
45 }
|