keyboard/altgr/index: osicon font to render actual os logos
[sheet.git] / keyboard / altgr / index.inc.plp
index 0bb7774112193b414cab1a65531cf966ccc66a9b..c47bfeb1c67d19dc53b03ce713f58dc610c69bae 100644 (file)
@@ -1,6 +1,7 @@
 <: # included from keyboard.plp
 use 5.014;
 use warnings;
+use utf8;
 
 my @incs = glob 'keyboard/altgr/*.eng.inc.pl';
 
@@ -46,6 +47,18 @@ Html({
        text-align: right;
 }
 
+@font-face {
+       font-family: osicons;
+       src: url(/osicon.ttf);
+}
+.icon {
+       font-family: osicons;
+}
+.keys.cmp tbody .ni {
+       font-size: 80%;
+       padding: 0 .2em;
+}
+
 .graph {
        display: block;
        line-height: 1ex;
@@ -96,10 +109,17 @@ my @sample = split /(?<!\+)/, $get{sample} // 'asSci1!+1';
 require Shiar_Sheet::Keyboard;
 use List::Util qw( uniq max );
 
+my %caticon = (
+       legacy  => qq{<span class=icon title="deprecated">\N{TOP HAT}</span>},
+       windows => qq{<span class=icon title="Windows">\x{1FA9F}</span>}, # \N{WINDOW}
+       macos   => qq{<span class=icon title="MacOS">\N{RED APPLE}</span>},
+       xorg    => qq{<span class=icon title="Xorg">\N{PENGUIN}</span>},
+);
+
 printf '<section class="%s">', @sample ? 'section' : 'gallery';
 if (@sample) {
        print '<table class="big keys cmp">';
-       print '<thead><tr><th>';
+       print '<thead><tr><th colspan=2>';
        print "<th>$_" for @sample;
        say '</tr></thead>';
 }
@@ -140,6 +160,9 @@ for my $inc (sort {
                        }
                        say '</span>';
                }
+               print "\t<td class=ni>";
+               print join ' ', map { $caticon{$_} // () } split m{/}, $keys->{category};
+               say '';
                $keys->print_key('', $_, $keys->{def}{''}{$_} // 'ni') for @sample;
                say '</tr>';
        }