latin: convert code39 to common svg codes
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 11 Apr 2017 20:25:23 +0000 (22:25 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 22 May 2017 15:55:29 +0000 (17:55 +0200)
Ensure exact widths even for simple two-state bars, because even this does
not appear properly with some [Apple] fonts.  Unicode option does retain old
behaviour if wanted.

writing-latn.inc.pl

index 7b9b17f00ba2e303e8d32417b38af94edc67a9ac..6adf33b8f5713a4740bd584974aaabd0c40eb310 100644 (file)
@@ -12,7 +12,7 @@ sub disptap {
 }
 
 sub dispbar {
 }
 
 sub dispbar {
-       my $code = shift;
+       my $code = shift or return '';
 
        return join '', pairmap {
                ($a =~ tr/123/❘❙❚/r) . ($b =~ tr/321/  /dr)
 
        return join '', pairmap {
                ($a =~ tr/123/❘❙❚/r) . ($b =~ tr/321/  /dr)
@@ -274,16 +274,13 @@ sub dispbar {
                131001 231301 000202 023302 230003 032003 201003 101003
        )
 ],
                131001 231301 000202 023302 230003 032003 201003 101003
        )
 ],
-'Code 39' => [
-       # ISO/IEC 16388
-       map { !!$_ && tr/012/ ❘❙/r }
-       # bar widths (1-2) followed by space of width 1 (implied) or 2 (0)
-       qw(
-               211012 121012 221011 112012 212011 122011 111022 211021 121021 112021
-               211102 121102 221101 112102 212101 122101 111202 211201 121201 112201
-               201112 102112 202111 101212 201211 102211        102121 0 101221
-       )
-],
+'Code 39' => [map { dispbar($_) } qw(
+       2111121121 1121121121 2121121111 1111221121 2111221111 1121221111
+       1111122121 2111122111 1121122111 1111222111 2111111221 1121111221
+       2121111211 1111211221 2111211211 1121211211 1111112221 2111112211
+       1121112211 1111212211 2211111121 1221111121 2221111111 1211211121
+       2211211111 1221211111            1221112111 0 1211212111
+)], # ISO/IEC 16388
 'Code 93' => [map { dispbar($_) } qw(
        211113 211212 211311 221112 221211 231111 112113 112212 112311 122112
        132111 111123 111222 111321 121122 131121 212112 212211 211122 211221
 'Code 93' => [map { dispbar($_) } qw(
        211113 211212 211311 221112 221211 231111 112113 112212 112311 122112
        132111 111123 111222 111321 121122 131121 212112 212211 211122 211221