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)
commit378bf4526ac991fbbcc8b84f97677aa0ed614da4
tree02dd80a38ac48793f3db4d5d0ec0eae04c6abd6d
parent711b90decabd2f9f61e1532e006d1a83cb0d5b8d
aztec scan code in block drawing characters

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