3 # depends on Unicode::UCD and Font::TTF
5 # small tweaks by Nicolas Spalinger
8 use Unicode::UCD qw(charblocks charblock charscripts charscript);
17 $blocks = charscripts;
24 foreach (keys %{$blocks})
26 foreach $r (@{$blocks->{$_}})
27 { $stats->{$_}[0] += ($r->[1] - $r->[0]) + 1; }
30 $f = Font::TTF::Font->open($ARGV[0]) || die "Can't open font $ARGV[0]";
31 $cmap = $f->{'cmap'}->read->find_ms->{'val'};
33 foreach $c (keys %{$cmap})
35 $r = $opt_s ? charscript($c) : charblock($c);
39 foreach (sort keys %{$stats})
41 next unless ($_ && $stats->{$_}[1]);
42 printf "%s: %d/%d (%.2f%%)\n", $_, $stats->{$_}[1], $stats->{$_}[0], $stats->{$_}[1] / $stats->{$_}[0] * 100.;