font: coverage overview page
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 9 Apr 2012 21:17:43 +0000 (23:17 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 10 Apr 2012 01:03:24 +0000 (03:03 +0200)
Replacing earlier font page (now chars) with less specific totals.

font.plp [new file with mode: 0644]

diff --git a/font.plp b/font.plp
new file mode 100644 (file)
index 0000000..79ac28d
--- /dev/null
+++ b/font.plp
@@ -0,0 +1,83 @@
+<(common.inc.plp)><:
+
+Html({
+       title => 'character support sheet',
+       version => 'v1.1',
+       keywords => [qw(
+               unicode font glyph char character support overview cover coverage
+               script block symbol sign mark reference table
+       )],
+       stylesheet => [qw( light dark mono circus red )],
+       data => [qw( unicode-cover.inc.pl )],
+});
+
+:>
+<h1>Font coverage</h1>
+
+<p>
+Character support of Unicode
+<a href="/charset">blocks</a> and <a href="/unicode">presets</a>.
+</p>
+
+<div>
+
+<:
+use 5.010;
+use Shiar_Sheet::FormatChar;
+my $glyphs = Shiar_Sheet::FormatChar->new;
+
+my %oslist = (
+       win95   => [qw( arial ariuni verdana times courier )],  # microsoft
+       mac10   => [qw( )],  # apple
+       android => [qw( droidsans )],  # google
+       oss     => [qw( dvsans c2k unifont )],
+);
+my @ossel = qw( win95 oss android );
+my @fontlist = map { @{ $oslist{$_} } } @ossel;
+
+my $cover = do 'unicode-cover.inc.pl' or die $@ || $!;
+
+# output character list
+
+print '<table class=mapped>';
+print '<col><col>';
+print "<colgroup span=$_>" for map { scalar @{$oslist{$_}} } @ossel;
+
+print '<thead><tr>';
+print '<th colspan=2>';
+printf '<th colspan=%d>%s fonts', scalar @{ $oslist{$_} }, $_ for @ossel;
+
+print '<tr>';
+print '<th colspan=2>';
+printf '<td>%s', $_ for @fontlist;
+say '</thead>';
+
+for my $name (sort keys %{$cover}) {
+       my $row = $cover->{$name};
+       print '<tr>';
+       $name = qq{<a href="/chars/$name">$name</a>}
+               if $row->{-count} and $row->{-count} < 1280;
+       print '<th>', $name;
+       print '<td class=right>', $row->{-count};
+       for (@fontlist) {
+               my $count = $row->{$_};
+               if (not defined $count) {
+                       print '<td class="l0">?';
+                       next;
+               }
+               if (not $count) {
+                       print '<td class="l1">0';
+                       next;
+               }
+
+               my $rel = $count / $row->{-count};
+               my $class = $rel < .5 ? 2 : $rel < .75 ? 3 : $rel < 1 ? 4 : 5;
+               printf '<td class="%s">%d%%', "l$class", $rel*100;
+       }
+       say '</tr>';
+}
+
+say "</table>\n";
+
+:></div>
+