- my ($fontmeta, @cover) = do "ttfsupport/$font.inc.pl";
- $fontmeta or die "Unknown font $font\n";
+ my ($fontmeta, @cover) = do "data/font/$font.inc.pl";
+ $fontmeta or Abort("Unknown font $font", '404 font not found');
+
+ my $map = eval {
+ $get{map} or return;
+
+ my $groupinfo = do 'data/unicode-cover.inc.pl' or die $@ || $!;
+
+ my ($cat, $name) = split m{/}, $get{map}, 2 or die "invalid map\n";
+ if (!$name) {
+ ($cat, $name) = ('table', $cat);
+ }
+
+ my $row = $groupinfo->{$cat}->{$name}
+ or die "unknown character group $cat/$name\n";
+ my $query = $row->{query};
+
+ my @map;
+ for (map { split /[^\d-]/ } $query) {
+ my @range = split /-/, $_, 2;
+ m/^[0-9]+$/ or die "Invalid code point $_ in query $query\n" for @range;
+ push @map, $_ for $range[0] .. ($range[1] // $range[0]);
+ }
+ return \@map;
+ };
+ Abort($@, '404 invalid query') if $@;