From 4b41b47d87dc5cd2533cb06f6791537176641503 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Tue, 11 Apr 2017 22:19:38 +0200 Subject: [PATCH] latin: generic unicode display option of bar codes --- writing-latn.inc.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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( '', -- 2.30.0