my ($fontmeta, @cover) = do "ttfsupport/$font.inc.pl";
$fontmeta or die "Unknown font $font\n";
- my $offset = $get{q} || 0;
+ require Unicode::UCD;
+
+ my $size = 0x200;
+ my $offset = eval {
+ local $_ = $get{q} || 0;
+ return $_ if /\A\d+\z/; # numeric
+ return hex $1 if /\A (?: 0?x | u\W* ) ([0-9a-f]+) \z/ix; # hexadecimal
+ return $_->[0]->[0] for Unicode::UCD::charblock(ucfirst) || (); # block
+ die "Unknown offset query '$_'\n";
+ };
+ die $@ if $@;
say "<h1>Font coverage</h1>";
say "<h2>$_</h2>" for EscapeHTML($fontmeta->{name});
</style>
EOT
say '<table class="glyphs big">';
- for my $cp ($offset .. $offset+0x1FF) {
+ say "<caption>$_</caption>" for join(' ', grep {$_}
+ $offset > $size && sprintf('<a rel="start" href="?q=%d">◄</a>', 0),
+ $offset > 0 && sprintf(
+ '<a rel="prev" href="?q=%d" title="U+%1$04X">◅</a>',
+ $offset - $size,
+ ),
+ sprintf('U+%04X', $offset), #TODO: block name
+ $offset + $size < 0x11_0000 && sprintf(
+ '<a rel="next" href="?q=%d" title="U+%1$04X">▻</a>',
+ $offset + $size,
+ ),
+ );
+ for my $cp ($offset .. $offset+$size-1) {
my $info = $glyphs->glyph_info($cp);
my ($class, $name, $mnem, $html, $string) = @{$info};
my $np = $class =~ /\bC\S\b/; # noprint if control or invalid