7 use open OUT => ':utf8', ':std';
8 use List::Util 'reduce';
9 use File::Basename 'basename';
12 our $VERSION = '1.00';
15 my $incsuffix = '.inc.pl';
16 for my $fontfile (glob 'ttfsupport/*'.$incsuffix) {
17 my ($fontid) = basename($fontfile, $incsuffix);
18 my ($fontmeta, @fontrange) = do $fontfile or next;
20 -id => $fontmeta->{id} || $fontid,
21 -name => $fontmeta->{name},
22 map { (chr $_ => 1) } @fontrange
29 Latin Greek Cyrillic Georgian Arabic Thai Hangul Han
34 for my $name (@chargroups) {
35 my $match = qr/\A\p{$name}\z/;
37 grep { m/$match/ } map { chr $_ }
38 0..0xD7FF, 0xE000..0xFDCF, 0xFDF0..0xFFFD,
45 my $fontcover = $font{$_};
46 ($_ => scalar grep { $fontcover->{$_} } @chars);
48 $cover{-count} = scalar @chars;
49 $cover{-chars} = [ map { ord } sort @chars ];
51 say $name.' => '.pp(\%cover).',';
59 mkfontinfo - Prepare font coverage of various character groups
63 mkfontinfo > unicode-cover.inc.pl
65 Test by finding the number of cyrillic characters in DejaVu Sans:
67 perl -E'$f = do "unicode-cover.inc.pl"; say $f->{Cyrillic}->{dvsans}'
71 Mischa POSLAWSKY <perl@shiar.org>
75 Licensed under the GNU Affero General Public License version 3.