From bbd4d489ebb73ed0fbc55eac123614a4774bb937 Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Sun, 2 Apr 2017 19:00:33 +0200 Subject: [PATCH] latin: code 128 as svg images Unicode characters do not have any reliable form or width, so will only be similar at best. Replace by SVG drawing to ensure exact multiples of module size as specified. --- writing-latn.inc.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/writing-latn.inc.pl b/writing-latn.inc.pl index 93b5edc..7fabb6e 100644 --- a/writing-latn.inc.pl +++ b/writing-latn.inc.pl @@ -10,6 +10,7 @@ sub disptap { } my %C = qw(red #EC1C24 blue #3953A3 yellow #F9EC31 black #231F20); +my $U = 0; # optional unicode alternatives ( 'Uppercase' => [qw{ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z }], @@ -242,7 +243,16 @@ my %C = qw(red #EC1C24 blue #3953A3 yellow #F9EC31 black #231F20); ) ], 'Code 128' => [ - map { tr/1-3-/❘❙❚ /r } + map { $U ? tr/1-3-/❘❙❚ /r : sprintf + '', + join ' ', + map { + $_ eq '' ? 'm2,-7' : + $_ eq '-' ? 'm4,-7' : + join 'm1,-7', ('v7') x $_ + } + split /(-)?/, $_ # each bar [123] and space [ -] + } # bar widths (1-3) followed by space of width 1 (implied) or 3 (-) qw( 11-2 1-12 1-1-2 12-1 1-21 1-2-1 21-1 2-11 2-1-1 123 12-3 1-23 132 -- 2.30.0