4 title => 'character support sheet',
7 unicode glyph char character reference common ipa symbol sign mark table digraph
9 stylesheet => [qw'light dark mono circus red'],
10 data => [qw( unicode-cover.inc.pl ttfsupport unicode-char.inc.pl )],
14 <h1>Character support</h1>
17 Selected characters from Unicode <a href="/unicode">preset</a>
18 or <a href="/charset">range</a>.
25 use Shiar_Sheet::FormatChar;
26 my $glyphs = Shiar_Sheet::FormatChar->new;
29 win95 => [qw( arial ariuni verdana times )], # microsoft
30 mac10 => [qw( )], # apple
31 android => [qw( droidsans )], # google
32 oss => [qw( dvsans c2k unifont )],
34 my @ossel = qw( win95 oss android );
36 my (%font, @fontlist);
38 my $osfonts = $oslist{$os};
39 for my $fontid (@{$osfonts}) {
40 push @fontlist, $fontid;
41 my ($fontmeta, @fontrange) = do "ttfsupport/$fontid.inc.pl";
44 -id => $fontmeta->{id} || $fontid,
45 -name => $fontmeta->{name},
46 map { (chr $_ => 1) } @fontrange
56 if (my $query = $ENV{PATH_INFO} || $get{q} || 'ipa') {
57 my $groupinfo = do 'unicode-cover.inc.pl' or die $@ || $!;
58 for (split /[\s+]/, $query) {
60 when (qr{^[\d,;\s+-]+$}) {
61 push @querydesc, "character codepoints $_";
62 for (map { split /[^\d-]/ } $_) {
63 my ($charnum, $range) = split /-/, $_;
64 push @chars, chr $_ for $charnum .. ($range // $charnum);
68 my $row = $groupinfo->{$_} or do {
69 warn "group $_ not found";
72 push @querydesc, $row->{-name} // $_;
73 push @chars, map { chr } @{ $row->{-chars} };
76 die "unknown parameter: $_\n";
81 @chars <= 1500 or die sprintf(
82 'too many matches (%d) for %s'."\n",
83 scalar @chars, join(', ', @querydesc),
86 # output character list
88 print '<table class=mapped>';
89 say '<caption>'.EscapeHTML(join ', ', @querydesc).'</caption>';
91 print "<colgroup span=$_>" for 2, map { scalar @{$oslist{$_}} } @ossel;
94 print '<td colspan=3>character';
95 print '<td colspan=2>input';
96 printf '<td colspan=%d>%s fonts', scalar @{ $oslist{$_} }, $_
100 print '<td colspan=2>unicode';
102 print '<td><a href="/digraphs" title="digraph">di</a><td>html';
103 printf '<td title="%s">%s', $font{$_}->{-name}, $font{$_}->{-id} // $_
107 for my $chr (@chars) {
108 my $codepoint = ord $chr;
109 my $ascii = $codepoint <= 127;
111 print "<tr><th>$chr\n";
112 my $info = $glyphs->glyph_info($codepoint);
113 my ($class, $name, $mnem, $html, $string) = @$info;
114 print "<td>$_" for sprintf('%X', $codepoint), EscapeHTML($name || '?');
115 printf '<td class="%s">%s', @$_ for (
116 [$ascii ? 'l0' : defined $mnem ? $class =~ /\bu-di\b/ ? 'l4' : 'l3' : 'l1', $mnem // ''],
117 [$ascii ? 'l0' : defined $html ? 'l4' : 'l1', $html // ''],
119 !$font{$_}->{-id} ? [l0 => '?'] :
120 $font{$_}->{$chr} ? [l4 => '✔'] : [l1 => '✘']