charset: override cp437 glyphs using unicode string
[sheet.git] / charset.plp
index e8382f508a60fa7ce5b51e44c334f5ffdc6dd453..4e25ef1edd432bf203127f7ecc9ed52fd2c4acba 100644 (file)
@@ -303,19 +303,14 @@ sub tabinput {
                $row{endpoint} -= $row{offset};
 
                if ($row{set} eq 'cp437') {
-                       for my $phipos (237 - $row{offset}) {
-                               next if $phipos < 0 or $phipos > $row{endpoint};
+                       if ($row{offset} <= 0xED and $row{endpoint} >= 0xED - $row{offset}) {
                                # replace phi glyph
-                               substr($row{table}, $phipos, 1) = pack 'U*', 0x3D5;
+                               substr($row{table}, 0xED - $row{offset}, 1) = 'ϕ';
                        }
-                       if ($row{offset} == 0) {
+                       if ($row{offset} < 0x20) {
                                # replace control characters by visible variants
-                               substr($row{table}, 0, 32) = pack 'U*', map {hex} qw(
-                                       2007 263A 263B 2665 2666 2663 2660 2022
-                                       25D8 25CB 25D9 2642 2640 266A 266B 263C
-                                       25BA 25C4 2195 203C 00B6 00A7 25AC 21A8
-                                       2191 2193 2192 2190 221F 2194 25B2 25BC
-                               );
+                               my $sub = substr ' ☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼', $row{offset};
+                               substr($row{table}, 0, length $sub) = $sub;
                        }
                }
                elsif ($row{set} eq 'symbol') {