Re: Re: Bar code choice

From: Jan Karrman <jan_at_it_dot_uu_dot_se>
Date: Mon Sep 08 2003 - 05:27:23 CDT

On Sun, 7 Sep 2003, Alan Dechert wrote:

> Greetings and welcome, Jan!
> We are very lucky to have someone with your expertise joining the project.

Thank you.

> I don't quite understand why printing/non-printing characters matter since
> we're not printing the characters.

Since Code 128 encodes all 128 ASCII characters, what might come
first to mind is to split the 116-bit string into 7-bit chunks,
and use the corresponding ASCII characters in the encoded string.
Then probably about one fourth of those characters will become
control characters (ASCII code < 32). But mixing control characters
and certain printable characters requires adding extra switch
characters, as I wrote before, thus making the bar code longer.

> Also, what about character set B, which
> avoids the non-printing characters?

This gives the 95 characters I mentioned in my previous mail.

> If you've read our archives on this topic, you will see where Arthur has
> written about his scheme for encoding the string of bits. With our demo
> ballot, we will need to encode a single 116-bit string to a string of
> characters. Do you know of a ready-made solution for doing this? (e.g., a
> function where you give it the string of bits and get back some small number
> of Code 128 characters that you can then use to make the barcode)

I believe the way to get the most compact barcode is to use
the character set C (that makes a compact representation of
digits-only strings). If one interprets the 116-bit string
as a binary number and writes it in decimal form, one gets a
number with at most 35 digits. This can be encoded in Code128
using 22 symbols (17 pairs of digits each represented by one
symbol, one shift character, the 35th digit, plus the mandatory
three start, stop and checksum characters). What is needed is
code that converts big binary numbers to decimal (string).
I have never programmed in Python, but I believe there is
support for arithmetic with big integers. I have the necessary
code to convert the decimal string into what should be printed
using my font. It is a Perl script, but it ought to be easy to
translate to Python.

As an experiment, I printed out the bar code representation
of the number 2**116 at approximately the same size as on the
sample ballot. The bar code became 65 millimeters (that is
about 2 1/2 inches for those of you that need to modernize your
measuring system as well ;-). I printed it on an HP laserjet
at 600 dpi, and read it back successfully several times with
my bar code reader. This must of course be tested thoroughly,
with the equipment that will be used at the demo, before
deciding what font size to use.

> Can your
> fonts be read by the CueCat scanners? I can get these scanners for about
> US$2 ea.

I have no experience of CueCat, but a Google search gave some
documents that seem to indicate that it can handle Code 128,
but it only supports character sets B and C, and no mixing of
them. If that is correct one cannot switch between digit pairs
and a single digit as I indicated above. But then we can simply
add a leading zero to the decimal string, when necessary, to
make the number of digits even. The bar code will still be the
same size, since the extra zero added is compensated by not
having to add the switch character.

= The content of this message, with the exception of any external
= quotations under fair use, are released to the Public Domain
Received on Tue Sep 30 23:17:01 2003

This archive was generated by hypermail 2.1.8 : Tue Sep 30 2003 - 23:17:09 CDT