aztec scan code in block drawing characters
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 22 Aug 2015 04:20:17 +0000 (06:20 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 5 Sep 2015 14:50:40 +0000 (16:50 +0200)
Test proper rendering and alignment (which can be verified by external scanner)
of an original 2D code creatable using Barcode Writer in Pure PostScript:

cat <<-. |
0 0 moveto (Unicode code) (ecaddchars=2)
/azteccode /uk.co.terryburton.bwipp findresource exec
.
cat /usr/share/libpostscriptbarcode/barcode.ps -

Older 2014 version in Debian needs pre-encoded input to create 15x15 code:

(10110111000111101010001001000000101001100000100100100000010100110)(raw)

Then converted via PBM to 2x2 box characters:

pstopnm -pbm -forceplain -stdout -portrait -xsize 15 \
-llx 0 -lly 0 -urx .42 -ury .42 -xborder 0 -yborder 0 |
perl -CO -ln -e'
use utf8;
/^[01]+$/  or next;
sub halfbits ($;$) {
pack "C*", map { $_ << $_[1] } unpack "C*", # multiply values
pack "(b2)*", split /..\K/, $_[0];  # value of every 2 bits
}
($_) = halfbits($_) | halfbits(<>, 2);  # 0..3 + 0,4,8,12
y/\0-\017/ ▘▝▀▖▌▞▛▗▚▐▜▄▙▟█/;
print;
'

Ironically, Aztec Codes do not really support Unicode (raw bytes are
declared to be Latin1), but it's currently the only widely supported 2D code
of this size.

unicode.txt

index 3624b6fc5e08f8d08dd88c86125e2dbe66ccc0a1..dd8693f6505a6dcb035be8c5ad474098c34a2de4 100644 (file)
@@ -317,11 +317,11 @@ Box drawing alignment tests:
   ││╠╬╣║│  ├╢│ │╟┤  ┣┿╾╳╼┿┫  ┕┛┖┚ ╹╵  ┆▌▐ ▌▐┇  ▌
   ││╚╩╝║│  │║╰─╯║│  ┃│╱╽╲│┃  ┏┯┓ ┌┰┐  ┆▌▝▀▘▐╏  ▋
   ╞╪═══╬╡  │╙─┬─╜│  ┃└─╂─┘┃  ┠┼┨ ┝╋┥  ┊▙▄▄▄▟╏  ▊
-  └┴───╨┘  ╘══╧══╛  ┗━━┻━━┛  ┗┷┛ └┸┘  ┕┉┅┅╍╍┛  ▉
-                                               █
-                     ▄█▄ █▄      ▄
-   ▄█▀█▓ ▄▓▀▀█▀ ▀▀▀█▓▀▀ ▀▀   ▄█▀█▓▀▀▀▀▀▓▄▀██▀▀   (\__/)
-  ██  ██ ▀██▄▄ ▄█  ▀ ░▒ ░▒  ██  ██ ▄█▄ █▀ ██     (=’.’=)
-  █▓▄▀██  ▄ ▀█▌▓█    ▒▓ ▒▓  █▓▄▀██ ▓█ ▀▄  █▓    ☆(”)_(”)☆
-  █▒  █▓ ██▄▓▀ ▀█▄▄█▄▓█ ▓█  █▒  █▓ ▒█  ▓█▄ ▒
-      ▀▒           ▀  ▀ █▀      ▀▒  █  █▀  ░  ヽ༼。◕ ∀ ◕。༽ノ
+  └┴───╨┘  ╘══╧══╛  ┗━━┻━━┛  ┗┷┛ └┸┘  ┕┉┅┅╍╍┛  ▉              ▗▄▖▄▖
+                                               █            ▐▄▞▀▐▚▗▘
+                     ▄█▄ █▄      ▄                          ▗▛▛▀▀▀▛▙
+   ▄█▀█▓ ▄▓▀▀█▀ ▀▀▀█▓▀▀ ▀▀   ▄█▀█▓▀▀▀▀▀▓▄▀██▀▀   (\__/)      ▞▌▛▀▌▌▜
+  ██  ██ ▀██▄▄ ▄█  ▀ ░▒ ░▒  ██  ██ ▄█▄ █▀ ██     (=’.’=)    ▐▜▌▌▘▌▛▙
+  █▓▄▀██  ▄ ▀█▌▓█    ▒▓ ▒▓  █▓▄▀██ ▓█ ▀▄  █▓    ☆(”)_(”)☆   ▐▐▌▀▀▘█▖
+  █▒  █▓ ██▄▓▀ ▀█▄▄█▄▓█ ▓█  █▒  █▓ ▒█  ▓█▄ ▒                ▗ ▀▛▜▜▀▘
+      ▀▒           ▀  ▀ █▀      ▀▒  █  █▀  ░  ヽ༼。◕ ∀ ◕。༽ノ  ▝ ▗▞▖▗▘▗