charset: inheritance between windows charsets
[sheet.git] / charset.plp
index 5668225b2512169914da35586d3592992119f63c..feb793b2b65be96f28c27d87463cb31fedac050a 100644 (file)
@@ -99,14 +99,15 @@ sub tabinput {
                        'hp-roman8'   => ['iso-8859-1' => '160'],
 
                        'cp1252'      => ['iso-8859-1' => '128-159'],
-                       'cp1250'      => ['iso-8859-2' => '128-191'],
-                       'cp1254'      => ['iso-8859-9' => '128-159'],
-                       'cp874'       => ['iso-8859-11' => '128-159'], # windows-874 actually cp1162
-                       'cp1257'      => ['iso-8859-13' => '128'],
+                       'cp1250'      => ['iso-8859-2' => '128-191', 'cp1252' => '128'],
+                       'cp1254'      => ['iso-8859-9' => '128-159', 'cp1252' => '128'],
+                       'cp874'       => ['iso-8859-11' => '128-159', 'cp1252' => '128'], # windows-874 actually cp1162
+                       'cp1257'      => ['iso-8859-13' => '128', 'cp1252' => '128'],
                        'cp1251'      => ['cp1252' => '128'],
                        'cp1253'      => ['cp1252' => '128'],
                        'cp1255'      => ['iso-8859-8' => '128-223', 'cp1252' => '128'],
                        'cp1256'      => ['cp1252' => '128'],
+                       'cp1258'      => ['cp1252' => '128'],
 
                        'cp850'       => ['cp437' => '144'],
                        'cp860'       => ['cp437' => '128-175'],
@@ -139,7 +140,9 @@ sub tabinput {
 
                if (my ($parent, $part) = pairfirst { defined $visible->{$a} } @parents) {
                        $row{parent} = $parent;
-                       $params = $visible->{$parent} ? $part : 128;
+                       $params = $part;
+                       $params = 128 unless $visible->{$parent}
+                               or ($input eq 'MacCroatian' and defined $visible->{MacRomanian});
                }
                elsif (defined $visible->{ascii}) {
                        $row{parent} = $parents[0];
@@ -321,6 +324,20 @@ for my $row (@request) {
                                next;
                        }
 
+                       if (exists $get{compare}) {
+                               state $visible = {};
+                               my $cp = $offset + $row->{offset};
+                               printf '<td class="%s" title="%3$s">%2$s',
+                                       $cp == ord $glyph ? 'l4' :
+                                       $row->{parent} && $glyph eq
+                                               Encode::decode($row->{parent}, pack 'C', $cp) ? 'l3' :
+                                       $visible->{$glyph} ? 'l2' :
+                                       'l1',
+                                       $glyphs->glyph_html($glyph);
+                               $visible->{$glyph}++;
+                               next;
+                       }
+
                        print "\n".$glyphs->glyph_cell($glyph);
                }
                continue {
@@ -335,7 +352,13 @@ for my $row (@request) {
 <hr>
 
 <div class="legend">
-       <table class="glyphs"><tr>
+       <table class="glyphs"><tr><: if (exists $get{compare}) { :>
+       <td class="X l4">unicode
+       <td class="X l3">inherited
+       <td class="X l2">existing
+       <td class="X l1">original
+       <td class="">unassigned
+<: } else { :>
        <td class="X Cc">control
        <td class="X Zs"><span>whitespace</span>
        <td class="X Mn">diacritic<table class="glyphs"><tr>
@@ -372,6 +395,6 @@ for my $row (@request) {
        <td class="X Xd">deprecated
        <td class="">unassigned
        <td class="X Xi">invalid
-       </table>
+<: } :>        </table>
 </div>