From: Mischa POSLAWSKY Date: Tue, 11 Apr 2017 20:19:38 +0000 (+0200) Subject: latin: generic unicode display option of bar codes X-Git-Tag: v1.10~162 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/4b41b47d87dc5cd2533cb06f6791537176641503 latin: generic unicode display option of bar codes --- diff --git a/writing-latn.inc.pl b/writing-latn.inc.pl index 3aab17a..c026c0f 100644 --- a/writing-latn.inc.pl +++ b/writing-latn.inc.pl @@ -1,6 +1,6 @@ use 5.014; use utf8; -use List::Util qw( pairs sum ); +use List::Util qw( pairs pairmap sum ); my %C = qw(red #EC1C24 blue #3953A3 yellow #F9EC31 black #231F20); my $U = 0; # optional unicode alternatives @@ -15,7 +15,13 @@ sub disptap { } sub dispbar { - my @cols = split //, shift; # bar and space widths + my $code = shift; + + return join '', pairmap { + ($a =~ tr/123/❘❙❚/r) . ($b =~ tr/321/  /dr) + } split //, $code if $U; + + my @cols = split //, $code; # bar and space widths my $width = sum(@cols); return sprintf( '',