X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/675221b52b08ff40fa91f38fe2eae05a4ef155bc..4d0dfd97b2708e809741ad853bff0bd000fcbb33:/font.plp?ds=sidebyside
diff --git a/font.plp b/font.plp
index 1d6ee4f..e0a9663 100644
--- a/font.plp
+++ b/font.plp
@@ -1,4 +1,5 @@
<(common.inc.plp)><:
+use 5.014;
Html({
title => 'character support sheet',
@@ -11,6 +12,57 @@ Html({
data => [qw( unicode-cover.inc.pl )],
});
+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;
+
+ say "
Font coverage
";
+ say "$_
" for EscapeHTML($fontmeta->{name});
+ printf("Version %s released %s contains %d glyphs.
\n",
+ !!$_->[2] && qq( title="revision $_->[2]"),
+ $_->[1], $_->[0],
+ scalar @cover,
+ ) for [
+ grep { $_ }
+ ($fontmeta->{date} || '?') =~ s/T.*//r,
+ EscapeHTML($fontmeta->{version}),
+ $fontmeta->{revision},
+ ];
+ printf "%s
\n", join('
', map { $_ ? EscapeHTML($_) : () }
+ $fontmeta->{copyright}, $fontmeta->{license},
+ );
+
+ require Shiar_Sheet::FormatChar;
+ my $glyphs = Shiar_Sheet::FormatChar->new;
+
+ my %cover = map { ($_ => 1) } @cover; # lookup map
+
+ say <<"EOT";
+
+
+EOT
+ say '';
+ for my $cp ($offset .. $offset+0x1FF) {
+ my $info = $glyphs->glyph_info($cp);
+ my ($class, $name, $mnem, $html, $string) = @{$info};
+ my $np = $class =~ /\bC\S\b/; # noprint if control or invalid
+ say sprintf '%X', $cp if $cp % 32 == 0;
+ say sprintf ' | %s',
+ !$class ? ('l0', $cp, '', '') :
+ $cover{$cp} ? $np ? 'l2' : 'l5' : $np ? 'Xi' : 'l1',
+ $cp, !!$name && ": $name",
+ ($cover{$cp} || !$np) && EscapeHTML(chr $cp);
+ }
+ say ' |
---|
';
+
+ exit;
+}
+
:>
Font coverage
@@ -22,9 +74,6 @@ Character support of Unicode
<:
-use 5.010;
-use Shiar_Sheet::FormatChar;
-my $glyphs = Shiar_Sheet::FormatChar->new;
my $cover = do 'unicode-cover.inc.pl' or die $@ || $!;
@@ -60,8 +109,7 @@ my @rows = (
'table/html',
);
-if (my $group = $ENV{PATH_INFO}) {
- $group =~ s{^/}{};
+if (my $group = $get{q}) {
my $grouprows = $cover->{$group}
or die "Unknown character category $_\n";
@rows = map { "$group/$_" } sort keys %{$grouprows};
@@ -81,8 +129,9 @@ printf '
%s fonts', scalar @{ $cover->{os}->{$_} }, $_
print ' | ';
print '';
-printf(' | %s', map { EscapeHTML($_) }
+printf(' | %s', map { EscapeHTML($_) }
join("\n", $_->{name}, $_->{description}),
+ "/font/$_->{file}",
$_->{abbr},
) for @{ $cover->{fonts} }[@fontlist];
say '';
|