From 44e16a2ff933556dd5db83bdbf2315d61ce0640f Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sat, 27 Jan 2024 21:30:41 +0100 Subject: [PATCH] keyboard/altgr: classify lookalike symbols as transliterated Character type distinction (spacing diacritic or punctuation) deemed less significant. --- Shiar_Sheet/KeyboardChars.pm | 6 +++--- keyboard/altgr/olpc.eng.inc.pl | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Shiar_Sheet/KeyboardChars.pm b/Shiar_Sheet/KeyboardChars.pm index 6afd7dc..77be120 100644 --- a/Shiar_Sheet/KeyboardChars.pm +++ b/Shiar_Sheet/KeyboardChars.pm @@ -8,7 +8,7 @@ use Unicode::Normalize qw( NFKD ); use Text::Unidecode qw( unidecode ); use Shiar_Sheet::FormatChar; -our $VERSION = '1.00'; +our $VERSION = '1.01'; our @EXPORT = qw( kbchars kbmodes ); my $uc = Shiar_Sheet::FormatChar->new; @@ -36,10 +36,10 @@ sub kbmodes ($modes) { my $class = 'g'.( !defined $v || $c eq $v ? 1 # identical : $v =~ /\A\p{Mn}+\z/ ? 9 # combining accent - : $v =~ /\A[\p{Sk}\p{Lm}]+\z/ ? 8 # modifier symbol - : $v =~ /\A[\pM\pP]+\z/ ? 7 # mark : NFKD($v) =~ /\Q$c/ ? 2 # decomposed equivalent : unidecode($v) =~ /\Q$c\E+/i ? 4 # transliterated + : $v =~ /\A[\p{Sk}\p{Lm}]+\z/ ? 8 # modifier symbol + : $v =~ /\A[\pM\pP]+\z/ ? 7 # mark : $v =~ /^\p{Latin}/ ? 5 # latin script : 6 ); diff --git a/keyboard/altgr/olpc.eng.inc.pl b/keyboard/altgr/olpc.eng.inc.pl index 3884b9a..2cd99e2 100644 --- a/keyboard/altgr/olpc.eng.inc.pl +++ b/keyboard/altgr/olpc.eng.inc.pl @@ -1,6 +1,7 @@ use utf8; use strict; use warnings; +no warnings 'qw'; use Shiar_Sheet::KeyboardChars 'kbchars'; my %rows = ( @@ -63,15 +64,11 @@ my %shift = ( qw( { [ } ] " ' | \ < , > . ? / ` 3 ~ = ), (map {uc, lc} qw[ r t y u i o p h j m ]), ); +$rows{$_} = $rows{ $shift{$_} } for keys %shift; # alias shifted my $groups = kbchars(\%rows); $groups->{flag}{ext} = ['alias', 'identical results from unshifted key']; -while (my ($alias, $target) = each %shift) { - # copy alias to shifted - $groups->{key}{$alias} = $groups->{key}{$target}; - $groups->{def}{''}{$alias} = $groups->{def}{''}{$target}.' ext'; -} -$groups->{def}{''}{$_} =~ s/g7/g4/ for qw( ! < > ? ); # similar punctuation +$groups->{def}{''}{$_} .= ' ext' for keys %shift; # mark aliases +{ %{ $groups }, -- 2.30.0