X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/bfb80ffa567c24ad151eaad7c0e813eb1f6cbe76..25a210c5de3a4e164a39839dedeb997d56f31faf:/font.plp diff --git a/font.plp b/font.plp index 2af6133..8867921 100644 --- a/font.plp +++ b/font.plp @@ -16,9 +16,17 @@ if (my $font = $ENV{PATH_INFO} =~ s{^/}{}r) { my ($fontmeta, @cover) = do "ttfsupport/$font.inc.pl"; $fontmeta or die "Unknown font $font\n"; - my $offset = $get{q} || 0; - $offset < 0 and $offset = 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 "

Font coverage

"; say "

$_

" for EscapeHTML($fontmeta->{name});