charset: symbols inheritance, override private use
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 21 Apr 2017 17:07:12 +0000 (19:07 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 25 May 2017 20:10:23 +0000 (22:10 +0200)
Find unicode equivalents for placeholders in Encode::Symbol maps,
matching descriptions in ucm sources.  Compare Windows Symbol at
<http://www.alanwood.net/demos/symbol.html> with Adobe version at
<http://www.sscnet.ucla.edu/soc/faculty/mcfarland/soc281/symbol.htm>.

charset.plp

index 5955c390a6da4327d490972a7bc3ea585659c873..e8382f508a60fa7ce5b51e44c334f5ffdc6dd453 100644 (file)
@@ -105,7 +105,7 @@ sub tabinput {
                hebrew     => [qw( iso-8859-8 cp1255 MacHebrew cp862  U59-5F )],
                thai       => [qw( iso-8859-11 cp874 MacThai )],
                vietnamese => [qw( viscii cp1258 MacVietnamese )],
-               symbol     => [qw( symbol dingbats MacDingbats AdobeZdingbat AdobeSymbol )],
+               symbols    => [qw( symbol dingbats MacDingbats )],
 
                # iso-code shorthand
                1 => 'westeur',
@@ -125,7 +125,7 @@ sub tabinput {
                return;
        }
 
-       state $visible = {};  # all present tables
+       state $visible = {'' => 1};  # all present tables
        my %row = (offset => 0, cols => 16);
        my $params = $input =~ s/[+](.*)\z// ? $1 : undef;
 
@@ -133,6 +133,11 @@ sub tabinput {
                state $INHERIT = {
                        'cp437'       => ['cp850' => 0, 'ascii' => '0-31+128'], # ascii range overridden later
                        'gsm0338'     => ['ascii' => '0-127'],
+                       'dingbats'    => ['' => '32-127+160'],
+                       'MacDingbats' => ['dingbats' => '128-159'],
+                       'AdobeZdingbat'=> ['MacDingbats' => '128-159'], # should be identical but maps to private use
+                       'symbol'      => ['' => '32-127+160'],
+                       'AdobeSymbol' => ['symbol' => '32-127+160', '' => '32-127+160'], # minor differences, irrelevant except for different '€'
 
                        'iso-8859-2'  => ['iso-8859-1' => '160'],
                        'iso-8859-3'  => ['iso-8859-1' => '160'], #TODO: also apply to iso-8859-9
@@ -313,6 +318,21 @@ sub tabinput {
                                );
                        }
                }
+               elsif ($row{set} eq 'symbol') {
+                       if ($row{offset} <= 0x60 and $row{endpoint} >= 0x60 - $row{offset}) {
+                               # replace radical extender by closest unicode equivalent
+                               substr($row{table}, 0x60 - $row{offset},  1) = '│';
+                       }
+                       if ($row{offset} <= 0xBD and $row{endpoint} >= 0xFF - $row{offset}) {
+                               substr($row{table}, 0xBD - $row{offset},  2) = '⏐⎯'; # arrow extenders
+                               substr($row{table}, 0xD2 - $row{offset},  3) = '®©™'; # serif variants
+                               substr($row{table}, 0xE0 - $row{offset},  1) = '◊'; # replace lookalike, should match AdobeSymbol
+                               substr($row{table}, 0xE2 - $row{offset},  3) = '®©™'; # sans-serif variants
+                               substr($row{table}, 0xE6 - $row{offset}, 10) = '⎛⎜⎝⎡⎢⎣⎧⎨⎩⎪';
+                               substr($row{table}, 0xF0 - $row{offset},  1) = '€';
+                               substr($row{table}, 0xF4 - $row{offset}, 11) = '⎮⌡⎞⎟⎠⎤⎥⎦⎫⎬⎭';
+                       }
+               }
 
                $visible->{ascii} =  # assume common base
                $visible->{ $row{set} } = 1;