latin: circumfix mark for code 39
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 10 Apr 2017 21:52:01 +0000 (23:52 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 24 Apr 2017 23:51:41 +0000 (01:51 +0200)
Optional 29th glyph to use as start and end mark in sample text, making it
conform to official specifications and recognisable by barcode scanners
(verified with ZXing Barcode Scanner on Android).

latinsample.js
writing-latn.inc.pl

index b576f955514949eb24c59f3c4d93619824a6fe88..fa6b0f1ca60af7e6cae33a5dce46eb2b0fb8df5a 100644 (file)
@@ -22,6 +22,9 @@ function appendsample() {
                                cols[++col] = same;
                        }
                }
+               for (var col = 0; col < cols.length; col++) {
+                       cols[col] = cols[col].innerHTML.trimRight();
+               }
 
                // copy letters into sample
                var output = '';
@@ -34,12 +37,16 @@ function appendsample() {
                        }
 
                        if (col < cols.length) {
-                               output += '<span>' + (cols[col].innerHTML.trimRight() || ' ') + '</span>';
+                               output += '<span>' + (cols[col] || ' ') + '</span>';
                        }
                        else {
                                output += ' ';
                        }
                }
+               if (cols[29] && !cols[28]) {
+                       // circumfix sign if no repetition
+                       output = cols[29] + output + cols[29];
+               }
                samplecol.innerHTML = output;
        }
 };
index 43b77b341f541bf442e1c793bdd958ff14696e67..1be023d367e7e17f184785ae3cb2a3b44b003d36 100644 (file)
@@ -256,10 +256,12 @@ my $U = 0;  # optional unicode alternatives
 ],
 'Code 39' => [
        # ISO/IEC 16388
-       map { tr/012/ ❘❙/r } qw(
+       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
+               201112 102112 202111 101212 201211 102211        102121 0 101221
        )
 ],
 'Code 93' => [