keyboard: split character formatting fallback method
[sheet.git] / tools / mkcharinfo
index 0f5d9bbe13d636f53a598862172a7e7843f862cb..da6aa87d5644d90a273e3ff5b89c86c9ade48832 100755 (executable)
@@ -3,11 +3,12 @@ use 5.014;
 use warnings;
 use utf8;
 no if $] >= 5.018, warnings => 'experimental::smartmatch';
+use lib '.';
 
-use open OUT => ':utf8', ':std';
+use open OUT => ':encoding(utf-8)', ':std';
 use Data::Dump 'pp';
 
-our $VERSION = '1.02';
+our $VERSION = '1.03';
 
 my %info = (
        # prepare presentational string for some control(lish) entries
@@ -17,6 +18,9 @@ my %info = (
        "\x{200B}" => {string => '␣'}, # nbsp: ~ in TeX
        "\x{200C}" => {string => '|'}, # ISO-9995-7-081 lookalike (alt: ∣ ⊺ ⟙)
        "\x{200D}" => {string => '⁀'}, # join (alt: ∤ |ͯ ⨝)
+       (map {( $_ => {string => chr(9676).$_.chr(9676)} )} map {chr} # combining double
+               0x35C .. 0x362, 0x1DCD, 0x1DFC,
+       ),
 );
 $info{chr $_} //= {} for 32 .. 126;
 
@@ -34,6 +38,12 @@ eval {
        1;
 } or warn "Failed reading unicode tables: $@";
 
+eval {
+       my $kbd = do './keyboard/altgr/macos-abc.eng.inc.pl' or die $@ || $!;
+       $info{$_} //= {} for map {s/◌//g; m/\A./g} values %{ $kbd->{key} };
+       1;
+} or warn "Failed reading additional keyboard map: $@";
+
 eval {
        require HTML::Entities;
        our %char2entity;
@@ -74,6 +84,7 @@ eval {
 
 for my $chr (keys %info) {
        my $cp = ord $chr;
+       #my $info = glyph_mkinfo($cp) or next;
        # attempt to get unicode character information
        my $info = eval {
                require Unicode::UCD;