From eea96a232c342a6e73c9a8acdc8ee9e8218fe2ae Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Thu, 6 Apr 2017 01:20:04 +0200 Subject: [PATCH] charset: distinct column size per table Prevent unicode planes from affecting other tables. --- charset-ucplanes.inc.pl | 1 + charset-unicode.inc.pl | 2 ++ charset.plp | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/charset-ucplanes.inc.pl b/charset-ucplanes.inc.pl index b954068..45f271f 100644 --- a/charset-ucplanes.inc.pl +++ b/charset-ucplanes.inc.pl @@ -1,5 +1,6 @@ use utf8; +{ + colsize => 8, 0x0000 => [0x008, 'X Po', 'ascii'], 0x0008 => [0x020, 'X L Latin', 'latin'], 0x0028 => [0x010, 'X Mn', 'diac', 'diacritics'], # also spacing Sk diff --git a/charset-unicode.inc.pl b/charset-unicode.inc.pl index 559ca88..be08248 100644 --- a/charset-unicode.inc.pl +++ b/charset-unicode.inc.pl @@ -1,5 +1,7 @@ use utf8; +{ + colsize => 1, + # bmp 0x0000 => [0x02, 'X Cc joinr', 'control'], 0x0002 => [0x02, 'X L Po joinl joinr', 'comn'], diff --git a/charset.plp b/charset.plp index 9bdf363..080e208 100644 --- a/charset.plp +++ b/charset.plp @@ -22,7 +22,6 @@ Html({ use Shiar_Sheet::FormatChar; my $glyphs = Shiar_Sheet::FormatChar->new; my $cols = 16; # columns -my $colsize = 1; # increment per column # generate character table(s) # (~16x faster than decoding in loop; @@ -67,7 +66,6 @@ my @request = map { $row{set} = 'Unicode planes'; $row{cell} = do 'charset-ucplanes.inc.pl' or Alert('Table data could not be read', $@ || $!); - $colsize = 8; $cols *= 2; } elsif ($row{set} = Encode::resolve_alias($input)) { @@ -112,6 +110,7 @@ sub range_cell { my $def = $table->{$offset} or return; my ($len, $class, $name, $title) = @{$def}; + my $colsize = $table->{colsize} || 1; my $attr = ''; $len /= $colsize; $name //= $len <= 2 ? 'res' : 'reserved'; @@ -157,6 +156,7 @@ sub range_cell { } for my $row (@request) { + my $colsize = $row->{cell} && $row->{cell}->{colsize} || 1; printf '
', !$row->{cell} && ' charmap'; my $title = $row->{set}; $title .= " " for $row->{setnote} // (); -- 2.30.0