git.shiar.nl
/
sheet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
bfb80ff
)
font: ?q offset by hex value or block name
author
Mischa POSLAWSKY
<perl@shiar.org>
Fri, 6 Mar 2015 07:11:32 +0000
(08:11 +0100)
committer
Mischa POSLAWSKY
<perl@shiar.org>
Tue, 9 Jun 2015 03:43:43 +0000
(
05:43
+0200)
font.plp
patch
|
blob
|
history
diff --git
a/font.plp
b/font.plp
index 2af6133da08094172b381f169d80ddebd726dbf7..886792114ba97f74b23ad6c146e0e729ca22ccff 100644
(file)
--- 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 ($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 $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});
say "<h1>Font coverage</h1>";
say "<h2>$_</h2>" for EscapeHTML($fontmeta->{name});