Code 128

Code 128 is a high density 1-D bar code, designed to encode all 128 ASCII characters. A specification of Code 128 can be found at BarCode-1.

One can not get a correct bar code for a given message by printing it directly using the Code128JK font. From the specification it follows that a checksum character as well as start, stop, and possibly shift characters, have to be added. Also, consecutive digits may be given a more compact representation by using a special encoding. You can use the enclosed Perl script code128.pl, or the Visual Basic script CODE128.VBS, to convert a string into the correct form to be used with the Code128JK font. If you are not using these scripts, the string to be printed should be generated as follows:

Compute the checksum character etc according to the specification. This will give you a sequence of values from the Code 128 character table. Add 32 to each of these values, and create a string with corresponding character values; this will be the string to be printed with the Code128JK font.

Note that all printable ASCII characters (i.e. those having values in the range 32 to 126) will be represented by themselves – except for digits when numerical compactification (Code C) is in effect.

Note also that the string generated by this procedure will contain characters that are not printable ASCII characters (they will be in the range 127 to 138). Since characters in this range may be undesirable (e.g. for copy-pasting between windows), there is an alternative representation in the range 192 to 203. So, for values between 95 and 106 from the character table: add 97, instead of 32, to get the character value. The characters in the range 192 to 203 for the ISO8859-1 encoding are À, Á, Â, Ã, Ä, Å, Æ, Ç, È, É, Ê, and Ë respectively.

Check the BarFonts home page regarding the hazards of smart quotes in certain word processors.


[BarFonts home page]