From: Mischa POSLAWSKY Date: Sat, 8 Apr 2017 20:40:50 +0000 (+0200) Subject: charset: unicode preset with all blocks and planes X-Git-Tag: v1.10~203 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/64823813136c216d4bfcf7df302983ffe408b5f7 charset: unicode preset with all blocks and planes Support unicode table offsets and width option to display all data. --- diff --git a/charset.plp b/charset.plp index f26b7bd..54e3b45 100644 --- a/charset.plp +++ b/charset.plp @@ -61,6 +61,7 @@ print join " •\n", ( cyrillic => 0, hebrew => 0, ], + [ uc => 'Unicode' ], ); :>.

@@ -77,6 +78,7 @@ sub tabinput { state $ALIAS = { default => [qw( unicode+0-639 utf-8 iso-8859-1 iso-8859-15 cp1252 cp437 cp850 )], + uc => [qw( U++ unicode+0-4095 unicode+4096-6319 unicode+6320-8191 )], us => [qw( cp437 cp863 gsm0338 AdobeStandardEncoding )], ebcdic => [qw( cp37 cp500 cp1047 posix-bc cp1026 cp875 )], iso => [map {"iso-8859-$_"} 1 .. 11, 13 .. 16], @@ -219,7 +221,8 @@ sub tabinput { } $visible->{$_} //= 0 for $row{parent} || (); } - else { + + if (length $params) { # manual option to double table width $row{cols} *= 2 if $params =~ s/[+]\z//; } @@ -257,15 +260,21 @@ sub tabinput { $row{set} = 'Unicode planes'; $row{cell} = do 'charset-ucplanes.inc.pl' or Alert('Table data could not be read', $@ || $!); - $row{cols} *= 2; $row{endpoint} = 1023 * $row{cell}->{colsize}; } elsif ($row{set} = Encode::resolve_alias($input)) { if ($row{set} eq 'Internal') { - $row{set} = 'Unicode BMP'; $row{cell} = do 'charset-unicode.inc.pl' or Alert('Table data could not be read', $@ || $!); - $row{endpoint} = ($endpoint || 8191) * $row{cell}->{colsize}; + + $row{endpoint } = $row{cell}->{colsize} * ($endpoint || 8191); + $row{startpoint} = $row{cell}->{colsize} * $row{offset}; + $row{offset} = 0; + $row{set} = 'Unicode ' . ( + $row{startpoint} < 0x10000 && $row{endpoint} < 0x10000 ? 'BMP' : + $row{startpoint} >= 0x10000 && $row{endpoint} < 0x20000 ? 'SMP' : + 'allocations' + ); } elsif ($row{set} eq 'utf-8-strict') { $row{set} = 'UTF-8'; @@ -380,7 +389,7 @@ for my $row (@request) { my $coldigits = ceil(log($colsize * $cols) / log(16)); # uniform length of hexadecimal header my $rowdiv = 16 ** $coldigits; # row divide for column digits $rowdiv = 1 if $rowdiv != $cols * $colsize; # divide only if all columns are matched - my $offset = 0; + my $offset = $row->{startpoint} || 0; printf '
', !$row->{cell} && ' charmap'; my $title = $row->{set};