or Alert('Table data could not be read', $@ || $!);
}
else {
+ if ($row{set} eq 'MacHebrew') {
+ # array of possibly multiple characters per code point
+ $row{table} = [
+ map { Encode::decode($row{set}, pack 'C*', $_) } $row{offset} .. $endpoint
+ ];
+ }
+ else {
+ # ~16x faster than decoding in loop;
+ # substr strings is twice as fast as splitting to an array
+ $row{table} = Encode::decode($row{set}, pack 'C*', $row{offset} .. $endpoint);
+ }
$row{len} = $endpoint - $row{offset};
- $row{table} = Encode::decode($row{set}, pack 'C*', $row{offset} .. $endpoint);
- # (~16x faster than decoding in loop;
- # substr strings is twice as fast as splitting to an array)
if ($row{set} eq 'cp437' and !$row{offset}) {
substr($row{table}, 237, 1) = pack 'U*', 0x3D5; # phi sign
next;
}
- my $glyph = substr $row->{table}, $offset, 1;
+ my $glyph = ref $row->{table} eq 'ARRAY' ? $row->{table}->[$offset] :
+ substr $row->{table}, $offset, 1;
if ($glyph eq $NOCHAR) {
print '<td>';
next;