UPC/EAN, ITF14: quiet zones, addongap; raster/vector: sync code, use double

This commit is contained in:
gitlost 2020-07-15 19:00:12 +01:00
parent e90c273165
commit 2a19b883a5
55 changed files with 2917 additions and 1351 deletions

View file

@ -44,10 +44,18 @@ To show debug info (if any), use '-d <flag>':
./test_dotcode -f input -i 2 -d 1
(for other flags see <project-dir>/backend/tests/testcommon.h)
To generate test data, use '-g':
./test_dotcode -f encode -g
To run a test against BWIPP (if any), use '-d 128':
./test_composite -d 128
(see also <project-dir>/backend/tests/tools/run_bwipp_tests.sh)
------------------------------------------------------------------------------
To make with gcc sanitize, first set for libzint and make:

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

View file

@ -0,0 +1,65 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="276" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="276" height="118" fill="#FFFFFF" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="26.00" y="0.00" width="2.00" height="110.00" />
<rect x="30.00" y="0.00" width="6.00" height="100.00" />
<rect x="38.00" y="0.00" width="4.00" height="100.00" />
<rect x="46.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="58.00" y="0.00" width="4.00" height="100.00" />
<rect x="66.00" y="0.00" width="4.00" height="100.00" />
<rect x="72.00" y="0.00" width="8.00" height="100.00" />
<rect x="82.00" y="0.00" width="2.00" height="100.00" />
<rect x="90.00" y="0.00" width="2.00" height="100.00" />
<rect x="96.00" y="0.00" width="2.00" height="100.00" />
<rect x="100.00" y="0.00" width="2.00" height="100.00" />
<rect x="108.00" y="0.00" width="4.00" height="100.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="110.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="128.00" y="0.00" width="6.00" height="100.00" />
<rect x="136.00" y="0.00" width="4.00" height="100.00" />
<rect x="142.00" y="0.00" width="4.00" height="100.00" />
<rect x="150.00" y="0.00" width="2.00" height="100.00" />
<rect x="154.00" y="0.00" width="6.00" height="100.00" />
<rect x="164.00" y="0.00" width="6.00" height="100.00" />
<rect x="174.00" y="0.00" width="2.00" height="100.00" />
<rect x="178.00" y="0.00" width="4.00" height="100.00" />
<rect x="186.00" y="0.00" width="4.00" height="100.00" />
<rect x="192.00" y="0.00" width="2.00" height="100.00" />
<rect x="200.00" y="0.00" width="2.00" height="100.00" />
<rect x="206.00" y="0.00" width="2.00" height="110.00" />
<rect x="210.00" y="0.00" width="2.00" height="110.00" />
<rect x="226.00" y="20.00" width="2.00" height="90.00" />
<rect x="230.00" y="20.00" width="4.00" height="90.00" />
<rect x="238.00" y="20.00" width="4.00" height="90.00" />
<rect x="246.00" y="20.00" width="2.00" height="90.00" />
<rect x="250.00" y="20.00" width="2.00" height="90.00" />
<rect x="256.00" y="20.00" width="2.00" height="90.00" />
<rect x="262.00" y="20.00" width="4.00" height="90.00" />
<text x="8.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
9
</text>
<text x="70.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
771384
</text>
<text x="164.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
524017
</text>
<text x="246.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -0,0 +1,74 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="330" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="330" height="118" fill="#FFFFFF" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="26.00" y="0.00" width="2.00" height="110.00" />
<rect x="30.00" y="0.00" width="6.00" height="100.00" />
<rect x="38.00" y="0.00" width="4.00" height="100.00" />
<rect x="48.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="58.00" y="0.00" width="2.00" height="100.00" />
<rect x="64.00" y="0.00" width="6.00" height="100.00" />
<rect x="72.00" y="0.00" width="4.00" height="100.00" />
<rect x="78.00" y="0.00" width="6.00" height="100.00" />
<rect x="88.00" y="0.00" width="2.00" height="100.00" />
<rect x="96.00" y="0.00" width="2.00" height="100.00" />
<rect x="100.00" y="0.00" width="6.00" height="100.00" />
<rect x="108.00" y="0.00" width="4.00" height="100.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="110.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="130.00" y="0.00" width="2.00" height="100.00" />
<rect x="136.00" y="0.00" width="6.00" height="100.00" />
<rect x="144.00" y="0.00" width="2.00" height="100.00" />
<rect x="150.00" y="0.00" width="6.00" height="100.00" />
<rect x="158.00" y="0.00" width="2.00" height="100.00" />
<rect x="164.00" y="0.00" width="2.00" height="100.00" />
<rect x="174.00" y="0.00" width="2.00" height="100.00" />
<rect x="178.00" y="0.00" width="6.00" height="100.00" />
<rect x="188.00" y="0.00" width="2.00" height="100.00" />
<rect x="192.00" y="0.00" width="2.00" height="100.00" />
<rect x="196.00" y="0.00" width="2.00" height="100.00" />
<rect x="206.00" y="0.00" width="2.00" height="110.00" />
<rect x="210.00" y="0.00" width="2.00" height="110.00" />
<rect x="226.00" y="20.00" width="2.00" height="90.00" />
<rect x="230.00" y="20.00" width="4.00" height="90.00" />
<rect x="236.00" y="20.00" width="6.00" height="90.00" />
<rect x="246.00" y="20.00" width="2.00" height="90.00" />
<rect x="250.00" y="20.00" width="2.00" height="90.00" />
<rect x="254.00" y="20.00" width="2.00" height="90.00" />
<rect x="262.00" y="20.00" width="4.00" height="90.00" />
<rect x="268.00" y="20.00" width="2.00" height="90.00" />
<rect x="272.00" y="20.00" width="2.00" height="90.00" />
<rect x="282.00" y="20.00" width="2.00" height="90.00" />
<rect x="286.00" y="20.00" width="2.00" height="90.00" />
<rect x="292.00" y="20.00" width="2.00" height="90.00" />
<rect x="298.00" y="20.00" width="4.00" height="90.00" />
<rect x="304.00" y="20.00" width="2.00" height="90.00" />
<rect x="310.00" y="20.00" width="4.00" height="90.00" />
<rect x="318.00" y="20.00" width="2.00" height="90.00" />
<text x="8.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
9
</text>
<text x="70.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
780877
</text>
<text x="164.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
799306
</text>
<text x="274.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
54321
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -0,0 +1,23 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="64" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="64" height="118" fill="#FFFFFF" />
<rect x="14.00" y="0.00" width="2.00" height="100.00" />
<rect x="18.00" y="0.00" width="4.00" height="100.00" />
<rect x="26.00" y="0.00" width="4.00" height="100.00" />
<rect x="34.00" y="0.00" width="2.00" height="100.00" />
<rect x="38.00" y="0.00" width="2.00" height="100.00" />
<rect x="44.00" y="0.00" width="2.00" height="100.00" />
<rect x="50.00" y="0.00" width="4.00" height="100.00" />
<text x="34.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 969 B

View file

@ -0,0 +1,32 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="118" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="118" height="118" fill="#FFFFFF" />
<rect x="14.00" y="0.00" width="2.00" height="100.00" />
<rect x="18.00" y="0.00" width="4.00" height="100.00" />
<rect x="24.00" y="0.00" width="4.00" height="100.00" />
<rect x="32.00" y="0.00" width="4.00" height="100.00" />
<rect x="38.00" y="0.00" width="2.00" height="100.00" />
<rect x="44.00" y="0.00" width="2.00" height="100.00" />
<rect x="50.00" y="0.00" width="4.00" height="100.00" />
<rect x="56.00" y="0.00" width="2.00" height="100.00" />
<rect x="60.00" y="0.00" width="2.00" height="100.00" />
<rect x="70.00" y="0.00" width="2.00" height="100.00" />
<rect x="74.00" y="0.00" width="2.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="86.00" y="0.00" width="4.00" height="100.00" />
<rect x="92.00" y="0.00" width="2.00" height="100.00" />
<rect x="96.00" y="0.00" width="4.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<text x="61.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -0,0 +1,53 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="216" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="216" height="118" fill="#FFFFFF" />
<rect x="14.00" y="0.00" width="2.00" height="110.00" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="24.00" y="0.00" width="4.00" height="100.00" />
<rect x="32.00" y="0.00" width="2.00" height="100.00" />
<rect x="38.00" y="0.00" width="2.00" height="100.00" />
<rect x="44.00" y="0.00" width="4.00" height="100.00" />
<rect x="50.00" y="0.00" width="8.00" height="100.00" />
<rect x="60.00" y="0.00" width="2.00" height="100.00" />
<rect x="64.00" y="0.00" width="2.00" height="100.00" />
<rect x="72.00" y="0.00" width="4.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="110.00" />
<rect x="82.00" y="0.00" width="2.00" height="110.00" />
<rect x="86.00" y="0.00" width="2.00" height="100.00" />
<rect x="92.00" y="0.00" width="6.00" height="100.00" />
<rect x="100.00" y="0.00" width="2.00" height="100.00" />
<rect x="104.00" y="0.00" width="2.00" height="100.00" />
<rect x="114.00" y="0.00" width="2.00" height="100.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="128.00" y="0.00" width="6.00" height="100.00" />
<rect x="138.00" y="0.00" width="2.00" height="100.00" />
<rect x="142.00" y="0.00" width="2.00" height="110.00" />
<rect x="146.00" y="0.00" width="2.00" height="110.00" />
<rect x="162.00" y="20.00" width="2.00" height="90.00" />
<rect x="166.00" y="20.00" width="4.00" height="90.00" />
<rect x="174.00" y="20.00" width="4.00" height="90.00" />
<rect x="182.00" y="20.00" width="2.00" height="90.00" />
<rect x="186.00" y="20.00" width="2.00" height="90.00" />
<rect x="192.00" y="20.00" width="2.00" height="90.00" />
<rect x="198.00" y="20.00" width="4.00" height="90.00" />
<text x="48.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
1234
</text>
<text x="114.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
5670
</text>
<text x="182.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View file

@ -0,0 +1,62 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="270" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="270" height="118" fill="#FFFFFF" />
<rect x="14.00" y="0.00" width="2.00" height="110.00" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="24.00" y="0.00" width="4.00" height="100.00" />
<rect x="32.00" y="0.00" width="2.00" height="100.00" />
<rect x="38.00" y="0.00" width="2.00" height="100.00" />
<rect x="44.00" y="0.00" width="4.00" height="100.00" />
<rect x="50.00" y="0.00" width="8.00" height="100.00" />
<rect x="60.00" y="0.00" width="2.00" height="100.00" />
<rect x="64.00" y="0.00" width="2.00" height="100.00" />
<rect x="72.00" y="0.00" width="4.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="110.00" />
<rect x="82.00" y="0.00" width="2.00" height="110.00" />
<rect x="86.00" y="0.00" width="2.00" height="100.00" />
<rect x="92.00" y="0.00" width="6.00" height="100.00" />
<rect x="100.00" y="0.00" width="2.00" height="100.00" />
<rect x="104.00" y="0.00" width="2.00" height="100.00" />
<rect x="114.00" y="0.00" width="2.00" height="100.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="128.00" y="0.00" width="6.00" height="100.00" />
<rect x="138.00" y="0.00" width="2.00" height="100.00" />
<rect x="142.00" y="0.00" width="2.00" height="110.00" />
<rect x="146.00" y="0.00" width="2.00" height="110.00" />
<rect x="162.00" y="20.00" width="2.00" height="90.00" />
<rect x="166.00" y="20.00" width="4.00" height="90.00" />
<rect x="172.00" y="20.00" width="4.00" height="90.00" />
<rect x="180.00" y="20.00" width="4.00" height="90.00" />
<rect x="186.00" y="20.00" width="2.00" height="90.00" />
<rect x="192.00" y="20.00" width="2.00" height="90.00" />
<rect x="198.00" y="20.00" width="4.00" height="90.00" />
<rect x="204.00" y="20.00" width="2.00" height="90.00" />
<rect x="208.00" y="20.00" width="2.00" height="90.00" />
<rect x="218.00" y="20.00" width="2.00" height="90.00" />
<rect x="222.00" y="20.00" width="2.00" height="90.00" />
<rect x="226.00" y="20.00" width="2.00" height="90.00" />
<rect x="234.00" y="20.00" width="4.00" height="90.00" />
<rect x="240.00" y="20.00" width="2.00" height="90.00" />
<rect x="244.00" y="20.00" width="4.00" height="90.00" />
<rect x="254.00" y="20.00" width="2.00" height="90.00" />
<text x="48.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
1234
</text>
<text x="114.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
5670
</text>
<text x="210.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -0,0 +1,69 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="276" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="276" height="118" fill="#FFFFFF" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="30.00" y="0.00" width="4.00" height="110.00" />
<rect x="36.00" y="0.00" width="2.00" height="110.00" />
<rect x="42.00" y="0.00" width="4.00" height="100.00" />
<rect x="50.00" y="0.00" width="2.00" height="100.00" />
<rect x="56.00" y="0.00" width="2.00" height="100.00" />
<rect x="62.00" y="0.00" width="4.00" height="100.00" />
<rect x="68.00" y="0.00" width="8.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="82.00" y="0.00" width="2.00" height="100.00" />
<rect x="90.00" y="0.00" width="4.00" height="100.00" />
<rect x="96.00" y="0.00" width="4.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<rect x="110.00" y="0.00" width="2.00" height="110.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="100.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="132.00" y="0.00" width="2.00" height="100.00" />
<rect x="140.00" y="0.00" width="2.00" height="100.00" />
<rect x="146.00" y="0.00" width="2.00" height="100.00" />
<rect x="152.00" y="0.00" width="2.00" height="100.00" />
<rect x="160.00" y="0.00" width="6.00" height="100.00" />
<rect x="168.00" y="0.00" width="2.00" height="100.00" />
<rect x="174.00" y="0.00" width="6.00" height="100.00" />
<rect x="184.00" y="0.00" width="2.00" height="100.00" />
<rect x="188.00" y="0.00" width="2.00" height="110.00" />
<rect x="194.00" y="0.00" width="6.00" height="110.00" />
<rect x="202.00" y="0.00" width="2.00" height="110.00" />
<rect x="206.00" y="0.00" width="2.00" height="110.00" />
<rect x="226.00" y="20.00" width="2.00" height="80.00" />
<rect x="230.00" y="20.00" width="4.00" height="80.00" />
<rect x="238.00" y="20.00" width="2.00" height="80.00" />
<rect x="244.00" y="20.00" width="4.00" height="80.00" />
<rect x="250.00" y="20.00" width="2.00" height="80.00" />
<rect x="254.00" y="20.00" width="2.00" height="80.00" />
<rect x="262.00" y="20.00" width="4.00" height="80.00" />
<text x="8.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
0
</text>
<text x="72.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
<text x="154.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
67890
</text>
<text x="218.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
5
</text>
<text x="250.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
24
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -0,0 +1,78 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="330" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="330" height="118" fill="#FFFFFF" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="26.00" y="0.00" width="2.00" height="110.00" />
<rect x="30.00" y="0.00" width="8.00" height="110.00" />
<rect x="42.00" y="0.00" width="4.00" height="100.00" />
<rect x="50.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="62.00" y="0.00" width="4.00" height="100.00" />
<rect x="70.00" y="0.00" width="4.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="82.00" y="0.00" width="2.00" height="100.00" />
<rect x="90.00" y="0.00" width="4.00" height="100.00" />
<rect x="98.00" y="0.00" width="4.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<rect x="110.00" y="0.00" width="2.00" height="110.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="4.00" height="100.00" />
<rect x="124.00" y="0.00" width="4.00" height="100.00" />
<rect x="132.00" y="0.00" width="2.00" height="100.00" />
<rect x="142.00" y="0.00" width="2.00" height="100.00" />
<rect x="146.00" y="0.00" width="2.00" height="100.00" />
<rect x="150.00" y="0.00" width="6.00" height="100.00" />
<rect x="160.00" y="0.00" width="2.00" height="100.00" />
<rect x="164.00" y="0.00" width="6.00" height="100.00" />
<rect x="174.00" y="0.00" width="4.00" height="100.00" />
<rect x="182.00" y="0.00" width="4.00" height="100.00" />
<rect x="188.00" y="0.00" width="2.00" height="110.00" />
<rect x="196.00" y="0.00" width="2.00" height="110.00" />
<rect x="202.00" y="0.00" width="2.00" height="110.00" />
<rect x="206.00" y="0.00" width="2.00" height="110.00" />
<rect x="226.00" y="20.00" width="2.00" height="80.00" />
<rect x="230.00" y="20.00" width="4.00" height="80.00" />
<rect x="236.00" y="20.00" width="4.00" height="80.00" />
<rect x="244.00" y="20.00" width="4.00" height="80.00" />
<rect x="250.00" y="20.00" width="2.00" height="80.00" />
<rect x="256.00" y="20.00" width="2.00" height="80.00" />
<rect x="262.00" y="20.00" width="4.00" height="80.00" />
<rect x="268.00" y="20.00" width="2.00" height="80.00" />
<rect x="272.00" y="20.00" width="2.00" height="80.00" />
<rect x="282.00" y="20.00" width="2.00" height="80.00" />
<rect x="286.00" y="20.00" width="2.00" height="80.00" />
<rect x="290.00" y="20.00" width="2.00" height="80.00" />
<rect x="298.00" y="20.00" width="4.00" height="80.00" />
<rect x="304.00" y="20.00" width="2.00" height="80.00" />
<rect x="308.00" y="20.00" width="4.00" height="80.00" />
<rect x="318.00" y="20.00" width="2.00" height="80.00" />
<text x="8.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
6
</text>
<text x="72.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
14141
</text>
<text x="154.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
23441
</text>
<text x="218.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
7
</text>
<text x="278.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -0,0 +1,52 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="184" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="184" height="118" fill="#FFFFFF" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="28.00" y="0.00" width="2.00" height="100.00" />
<rect x="34.00" y="0.00" width="4.00" height="100.00" />
<rect x="40.00" y="0.00" width="8.00" height="100.00" />
<rect x="50.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="62.00" y="0.00" width="4.00" height="100.00" />
<rect x="68.00" y="0.00" width="6.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="88.00" y="0.00" width="2.00" height="100.00" />
<rect x="92.00" y="0.00" width="2.00" height="100.00" />
<rect x="98.00" y="0.00" width="2.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<rect x="110.00" y="0.00" width="2.00" height="110.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="110.00" />
<rect x="134.00" y="20.00" width="2.00" height="80.00" />
<rect x="138.00" y="20.00" width="4.00" height="80.00" />
<rect x="146.00" y="20.00" width="4.00" height="80.00" />
<rect x="154.00" y="20.00" width="2.00" height="80.00" />
<rect x="158.00" y="20.00" width="2.00" height="80.00" />
<rect x="164.00" y="20.00" width="2.00" height="80.00" />
<rect x="170.00" y="20.00" width="4.00" height="80.00" />
<text x="8.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
1
</text>
<text x="66.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
234567
</text>
<text x="128.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
0
</text>
<text x="154.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,61 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="238" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="238" height="118" fill="#FFFFFF" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="28.00" y="0.00" width="2.00" height="100.00" />
<rect x="34.00" y="0.00" width="4.00" height="100.00" />
<rect x="40.00" y="0.00" width="8.00" height="100.00" />
<rect x="50.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="62.00" y="0.00" width="4.00" height="100.00" />
<rect x="68.00" y="0.00" width="6.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="88.00" y="0.00" width="2.00" height="100.00" />
<rect x="92.00" y="0.00" width="2.00" height="100.00" />
<rect x="98.00" y="0.00" width="2.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<rect x="110.00" y="0.00" width="2.00" height="110.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="110.00" />
<rect x="134.00" y="20.00" width="2.00" height="80.00" />
<rect x="138.00" y="20.00" width="4.00" height="80.00" />
<rect x="144.00" y="20.00" width="4.00" height="80.00" />
<rect x="152.00" y="20.00" width="4.00" height="80.00" />
<rect x="158.00" y="20.00" width="2.00" height="80.00" />
<rect x="164.00" y="20.00" width="2.00" height="80.00" />
<rect x="170.00" y="20.00" width="4.00" height="80.00" />
<rect x="176.00" y="20.00" width="2.00" height="80.00" />
<rect x="180.00" y="20.00" width="2.00" height="80.00" />
<rect x="190.00" y="20.00" width="2.00" height="80.00" />
<rect x="194.00" y="20.00" width="2.00" height="80.00" />
<rect x="198.00" y="20.00" width="2.00" height="80.00" />
<rect x="206.00" y="20.00" width="4.00" height="80.00" />
<rect x="212.00" y="20.00" width="2.00" height="80.00" />
<rect x="216.00" y="20.00" width="4.00" height="80.00" />
<rect x="226.00" y="20.00" width="2.00" height="80.00" />
<text x="8.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
1
</text>
<text x="66.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
234567
</text>
<text x="128.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
0
</text>
<text x="182.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3 KiB

View file

@ -193,6 +193,8 @@ static void test_encode(int index, int generate, int debug) {
testStart("");
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise
int ret;
struct item {
int symbology;
@ -206,37 +208,37 @@ static void test_encode(int index, int generate, int debug) {
};
// BARCODE_ITF14 examples verified manually against GS1 General Specifications 20.0
struct item data[] = {
/* 0*/ { BARCODE_C25MATRIX, "87654321", 0, 1, 97, "Standard Code 2 of 5; verified manually against bwipp and tec-it",
/* 0*/ { BARCODE_C25MATRIX, "87654321", 0, 1, 97, "Standard Code 2 of 5; note zint uses 4X start/end wides while BWIPP uses 3X",
"1111010101110100010101000111010001110101110111010101110111011100010101000101110111010111011110101"
},
/* 1*/ { BARCODE_C25INTER, "87654321", 0, 1, 81, "Interleaved Code 2 of 5; verified manually against bwipp and tec-it",
/* 1*/ { BARCODE_C25INTER, "87654321", 0, 1, 81, "Interleaved Code 2 of 5; verified manually against tec-it",
"101011101010111000100010001110111000101010001000111010111010001110101011100011101"
},
/* 2*/ { BARCODE_C25INTER, "602003", 0, 1, 63, "DX cartridge barcode https://en.wikipedia.org/wiki/Interleaved_2_of_5 example",
"101010111011100010001010111010001000111010001000111011101011101"
},
/* 3*/ { BARCODE_C25IATA, "87654321", 0, 1, 121, "IATA Code 2 of 5; verified manually against bwipp and tec-it",
/* 3*/ { BARCODE_C25IATA, "87654321", 0, 1, 121, "IATA Code 2 of 5; verified manually against tec-it",
"1010111010101110101010101110111010111011101010111010111010101010111010111011101110101010101110101011101110101010111011101"
},
/* 4*/ { BARCODE_C25LOGIC, "87654321", 0, 1, 89, "Code 2 of 5 Data Logic; verified manually against bwipp and tec-it",
/* 4*/ { BARCODE_C25LOGIC, "87654321", 0, 1, 89, "Code 2 of 5 Data Logic; verified manually against tec-it",
"10101110100010101000111010001110101110111010101110111011100010101000101110111010111011101"
},
/* 5*/ { BARCODE_C25IND, "87654321", 0, 1, 131, "Industrial Code 2 of 5; verified manually against bwipp and tec-it",
/* 5*/ { BARCODE_C25IND, "87654321", 0, 1, 131, "Industrial Code 2 of 5; verified manually against tec-it",
"11101110101110101011101010101011101110101110111010101110101110101010101110101110111011101010101011101010111011101010101110111010111"
},
/* 6*/ { BARCODE_DPLEIT, "87654321", 0, 1, 135, "Deutsche Post Leitcode; verified manually against bwipp and tec-it (0000087654321)",
/* 6*/ { BARCODE_DPLEIT, "0000087654321", 0, 1, 135, "Deutsche Post Leitcode; verified manually against tec-it",
"101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101"
},
/* 7*/ { BARCODE_DPLEIT, "5082300702800", 0, 1, 135, "Deutsche Post Leitcode https://de.wikipedia.org/wiki/Leitcode example",
"101011101011100010001011101000101110100011101110100010001010101110111000100010100011101110100011101010001110001010001011100011101011101"
},
/* 8*/ { BARCODE_DPIDENT, "87654321", 0, 1, 117, "Deutsche Post Identcode; verified manually against bwipp and tec-it (00087654321)",
/* 8*/ { BARCODE_DPIDENT, "00087654321", 0, 1, 117, "Deutsche Post Identcode; verified manually against tec-it",
"101010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101"
},
/* 9*/ { BARCODE_DPIDENT, "39601313414", 0, 1, 117, "Deutsche Post Identcode https://de.wikipedia.org/wiki/Leitcode example",
"101011101110001010001010111011100010001011100010001010111011100010001010111010001011101011100010101110001000111011101"
},
/* 10*/ { BARCODE_ITF14, "87654321", 0, 1, 135, "ITF-14; verified manually against bwipp and tec-it (0000087654321)",
/* 10*/ { BARCODE_ITF14, "0000087654321", 0, 1, 135, "ITF-14; verified manually against tec-it",
"101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000101011100011101"
},
/* 11*/ { BARCODE_ITF14, "0950110153000", 0, 1, 135, "GS1 General Specifications Figure 5.1-2",
@ -252,6 +254,8 @@ static void test_encode(int index, int generate, int debug) {
int data_size = ARRAY_SIZE(data);
char escaped[1024];
char bwipp_buf[4096];
char bwipp_msg[1024];
for (int i = 0; i < data_size; i++) {
@ -281,6 +285,15 @@ static void test_encode(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
}
if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) {
ret = testUtilBwipp(symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
}
}
}

View file

@ -432,7 +432,7 @@ static void test_encode(int index, int generate, int debug) {
if (generate) {
printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->rows, data[i].bwipp_cmp, symbol->width, data[i].comment);
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
testUtilModulesDump(symbol, " ", "\n");
printf(" },\n");
} else {
@ -448,7 +448,7 @@ static void test_encode(int index, int generate, int debug) {
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, data[i].option_2, -1, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s skipped, not BWIPP compatible\n", i, testUtilBarcodeName(symbol->symbology));
if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
ret = testUtilBwipp(symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);

View file

@ -443,99 +443,127 @@ static void test_encode(int index, int generate, int debug) {
int expected_rows;
int expected_width;
int bwipp_cmp;
char *comment;
char *expected;
};
// BARCODE_EAN128 examples verified manually against GS1 General Specifications 20.0
// BARCODE_EAN128 examples verified manually against GS1 General Specifications 20.0 (GGS)
struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, "AIM", 0, 1, 68, "ISO/IEC 15417:2007 Figure 1",
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, "AIM", 0, 1, 68, 1, "ISO/IEC 15417:2007 Figure 1",
"11010010000101000110001100010001010111011000101110110001100011101011"
},
/* 1*/ { BARCODE_CODE128B, UNICODE_MODE, "AIM", 0, 1, 68, "128B same",
/* 1*/ { BARCODE_CODE128B, UNICODE_MODE, "AIM", 0, 1, 68, 1, "128B same",
"11010010000101000110001100010001010111011000101110110001100011101011"
},
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, "1234567890", 0, 1, 90, "",
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, "1234567890", 0, 1, 90, 1, "",
"110100111001011001110010001011000111000101101100001010011011110110100111100101100011101011"
},
/* 3*/ { BARCODE_CODE128B, UNICODE_MODE, "1234567890", 0, 1, 145, "",
/* 3*/ { BARCODE_CODE128B, UNICODE_MODE, "1234567890", 0, 1, 145, 1, "",
"1101001000010011100110110011100101100101110011001001110110111001001100111010011101101110111010011001110010110010011101100101000110001100011101011"
},
/* 4*/ { BARCODE_EAN128, GS1_MODE, "[8018]950110153123456781", 0, 1, 167, "GS1 General Specifications Figure 2.5.2-1",
/* 4*/ { BARCODE_EAN128, GS1_MODE, "[8018]950110153123456781", 0, 1, 167, 1, "GGS Figure 2.5.2-1",
"11010011100111101011101010011110011001110010101111010001100110110011001000100101110011001101100011011101101110101110110001000010110010010111100101111001001100011101011"
},
/* 5*/ { BARCODE_EAN128, GS1_MODE, "[415]5412345678908[3911]710125", 0, 1, 189, "GS1 General Specifications Figure 2.6.6-1 top",
/* 5*/ { BARCODE_EAN128, GS1_MODE, "[415]5412345678908[3911]710125", 0, 1, 189, 1, "GGS Figure 2.6.6-1 top",
"110100111001111010111011000100010111010001101100010001011101101110101110110001000010110011011011110100011001001101000100011000100100100110100001100110110011100101100100001001101100011101011"
},
/* 6*/ { BARCODE_EAN128, GS1_MODE, "[12]010425[8020]ABC123", 0, 1, 189, "GS1 General Specifications Figure 2.6.6-1 bottom",
/* 6*/ { BARCODE_EAN128, GS1_MODE, "[12]010425[8020]ABC123", 0, 1, 189, 1, "GGS Figure 2.6.6-1 bottom",
"110100111001111010111010110011100110011011001001000110011100101100101001111001100100111010111101110101000110001000101100010001000110100111001101100111001011001011100110010111001100011101011"
},
/* 7*/ { BARCODE_EAN128, GS1_MODE, "[253]950110153005812345678901", 0, 1, 211, "GS1 General Specifications Figure 2.6.9-1",
/* 7*/ { BARCODE_EAN128, GS1_MODE, "[253]950110153005812345678901", 0, 1, 211, 1, "GGS Figure 2.6.9-1",
"1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001110110001010110011100100010110001110001011011000010100110111101101011110111010011100110101110110001100011101011"
},
/* 8*/ { BARCODE_EAN128, GS1_MODE, "[253]950110153006567890543210987", 0, 1, 211, "GS1 General Specifications Figure 2.6.9-2",
/* 8*/ { BARCODE_EAN128, GS1_MODE, "[253]950110153006567890543210987", 0, 1, 211, 1, "GGS Figure 2.6.9-2",
"1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001001011000010000101100110110111101000100110010110001110110111001001100100100011110010100101110011001100011101011"
},
/* 9*/ { BARCODE_EAN128, GS1_MODE, "[253]95011015300657654321", 0, 1, 189, "GS1 General Specifications Figure 2.6.9-3",
/* 9*/ { BARCODE_EAN128, GS1_MODE, "[253]95011015300657654321", 0, 1, 189, 1, "GGS Figure 2.6.9-3",
"110100111001111010111011100101100110100010001100010111011000100100110011011001101110111011011001100100101100001100101000011101011000110001101101011110111010011100110111001001101100011101011"
},
/* 10*/ { BARCODE_EAN128, GS1_MODE, "[253]9501101530065123456", 0, 1, 167, "GS1 General Specifications Figure 2.6.9-4",
/* 10*/ { BARCODE_EAN128, GS1_MODE, "[253]9501101530065123456", 0, 1, 167, 1, "GGS Figure 2.6.9-4",
"11010011100111101011101110010110011010001000110001011101100010010011001101100110111011101101100110010010110000101100111001000101100011100010110100011110101100011101011"
},
/* 11*/ { BARCODE_EAN128, GS1_MODE, "[01]10857674002017[10]1152KMB", 0, 1, 211, "GS1 General Specifications Figure 4.15.1-1",
/* 11*/ { BARCODE_EAN128, GS1_MODE, "[01]10857674002017[10]1152KMB", 0, 1, 211, 1, "GGS Figure 4.15.1-1",
"1101001110011110101110110011011001100100010010011110010110010100001000011001011011001100110010011101001110011011001000100110001001001101110001010111101110101100011101011101100010001011000100111001101100011101011"
},
/* 12*/ { BARCODE_EAN128, GS1_MODE, "[01]09501101530003", 0, 1, 134, "GS1 General Specifications Figure 5.1-3",
/* 12*/ { BARCODE_EAN128, GS1_MODE, "[01]09501101530003", 0, 1, 134, 1, "GGS Figure 5.1-3",
"11010011100111101011101100110110011001001000110001011101100010010011001101100110111011101101100110010010011000100110100001100011101011"
},
/* 13*/ { BARCODE_EAN128, GS1_MODE, "[00]395123451234567895", 0, 1, 156, "GS1 General Specifications Figure 5.4.2-1",
/* 13*/ { BARCODE_EAN128, GS1_MODE, "[00]395123451234567895", 0, 1, 156, 1, "GGS Figure 5.4.2-1",
"110100111001111010111011011001100110100010001101110100011101101110101110110001011001110010001011000111000101101100001010010111101000101111000101100011101011"
},
/* 14*/ { BARCODE_EAN128, GS1_MODE, "[00]395011010013000129", 0, 1, 156, "GS1 General Specifications Figure 6.6.5-6",
/* 14*/ { BARCODE_EAN128, GS1_MODE, "[00]006141411234567890", 0, 1, 156, 1, "GGS Figure 6.6.5-1. (and Figures 6.6.5-3 bottom, 6.6.5-4 bottom)",
"110100111001111010111011011001100110110011001100100001011000100010110001000101011001110010001011000111000101101100001010011011110110110110110001100011101011"
},
/* 15*/ { BARCODE_EAN128, GS1_MODE, "[403]402621[401]950110153B01001", 0, 1, 266, 0, "GGS Figure 6.6.5-2 top **NOT SAME**, different encodation for zint, BWIPP & standard, same codeword count",
"11010011100111101011101100010100010001011000110011001101111000101010111101110100111001101011101111011110101110110001010001100101110011000101110110001001001100110110011011101110101111011101000101100010011101100101110111101100100010011001101100101001111001100011101011"
},
/* 16*/ { BARCODE_EAN128, GS1_MODE, "[00]395011015300000011", 0, 1, 156, 1, "GGS Figure 6.6.5-2 bottom",
"110100111001111010111011011001100110100010001100010111011000100100110011011001101110111011011001100110110011001101100110011000100100100011101101100011101011"
},
/* 17*/ { BARCODE_EAN128, GS1_MODE, "[420]45458", 0, 1, 90, 1, "GGS Figure 6.6.5-3 top",
"110100111001111010111010110111000100100011001110101100011101100010111100100101100011101011"
},
/* 18*/ { BARCODE_EAN128, GS1_MODE, "[02]00614141000418[15]210228[10]451214[37]20", 0, 1, 255, 1, "GGS Figure 6.6.5-4 top",
"110100111001111010111011001100110110110011001100100001011000100010110001000101101100110010010001100110011100101011100110011011100100110011001101110011010011001000100101110110001011001110010011001110111101011101000110100011001001110100011110101100011101011"
},
/* 19*/ { BARCODE_EAN128, GS1_MODE, "[420]87109", 0, 1, 90, 1, "GGS Figure 6.6.5-5 top",
"110100111001111010111010110111000100011001001001101000011001001000111001001101100011101011"
},
/* 20*/ { BARCODE_EAN128, GS1_MODE, "[90]1528", 0, 1, 79, 1, "GGS Figure 6.6.5-5 middle",
"1101001110011110101110110111101101011100110011100110100111001100101100011101011"
},
/* 21*/ { BARCODE_EAN128, GS1_MODE, "[00]000521775138957172", 0, 1, 156, 1, "GGS Figure 6.6.5-5 bottom",
"110100111001111010111011011001100110110011001000100110011011100100111101110101101110100010001100010101111010001001101000010011000010110011011001100011101011"
},
/* 22*/ { BARCODE_EAN128, GS1_MODE, "[00]395011010013000129", 0, 1, 156, 1, "GGS Figure 6.6.5-6",
"110100111001111010111011011001100110100010001100010111011000100100110011011001101100110010011011100110110011001100110110011100110010111101101101100011101011"
},
/* 15*/ { BARCODE_EAN128, GS1_MODE, "[401]931234518430GR", 0, 1, 167, "GS1 General Specifications Figure 6.6.5-7 top",
/* 23*/ { BARCODE_EAN128, GS1_MODE, "[00]395011010013000129", 0, 1, 156, 1, "GGS Figure 6.6.5-6",
"110100111001111010111011011001100110100010001100010111011000100100110011011001101100110010011011100110110011001100110110011100110010111101101101100011101011"
},
/* 24*/ { BARCODE_EAN128, GS1_MODE, "[401]931234518430GR", 0, 1, 167, 1, "GGS Figure 6.6.5-7 top",
"11010011100111101011101100010100011001011100110110001101110110111010111011000110011100101011000111010111101110100111011001101000100011000101110100110111001100011101011"
},
/* 16*/ { BARCODE_EAN128, GS1_MODE, "[00]093123450000000012", 0, 1, 156, "GS1 General Specifications Figure 6.6.5-7 bottom",
/* 25*/ { BARCODE_EAN128, GS1_MODE, "[00]093123450000000012", 0, 1, 156, 1, "GGS Figure 6.6.5-7 bottom",
"110100111001111010111011011001100110010010001101100011011101101110101110110001101100110011011001100110110011001101100110010110011100110111010001100011101011"
},
/* 17*/ { BARCODE_EAN128, GS1_MODE, "[01]95012345678903", 0, 1, 134, "GS1 General Specifications Figure 7.8.5.1-1 1st",
/* 26*/ { BARCODE_EAN128, GS1_MODE, "[01]95012345678903", 0, 1, 134, 1, "GGS Figure 7.8.5.1-1 1st",
"11010011100111101011101100110110010111101000110011011001110110111010111011000100001011001101101111010010011000110110001101100011101011"
},
/* 18*/ { BARCODE_EAN128, GS1_MODE, "[3102]000400", 0, 1, 101, "GS1 General Specifications Figure 7.8.5.1-1 2nd",
/* 27*/ { BARCODE_EAN128, GS1_MODE, "[3102]000400", 0, 1, 101, 1, "GGS Figure 7.8.5.1-1 2nd",
"11010011100111101011101101100011011001100110110110011001001000110011011001100110110111101100011101011"
},
/* 19*/ { BARCODE_EAN128, GS1_MODE, "[01]95012345678903[3102]000400", 0, 1, 189, "GS1 General Specifications Figure 7.8.5.1-2",
/* 28*/ { BARCODE_EAN128, GS1_MODE, "[01]95012345678903[3102]000400", 0, 1, 189, 1, "GGS Figure 7.8.5.1-2",
"110100111001111010111011001101100101111010001100110110011101101110101110110001000010110011011011110100100110001101100011011001100110110110011001001000110011011001100100100110001100011101011"
},
/* 20*/ { BARCODE_EAN128, GS1_MODE, "[8005]000365", 0, 1, 101, "GS1 General Specifications Figure 7.8.5.2-1 1st",
/* 29*/ { BARCODE_EAN128, GS1_MODE, "[8005]000365", 0, 1, 101, 1, "GGS Figure 7.8.5.2-1 1st",
"11010011100111101011101010011110010001001100110110011001001001100010010110000100100001101100011101011"
},
/* 21*/ { BARCODE_EAN128, GS1_MODE, "[10]123456", 0, 1, 90, "GS1 General Specifications Figure 7.8.5.2-1 2nd",
/* 30*/ { BARCODE_EAN128, GS1_MODE, "[10]123456", 0, 1, 90, 1, "GGS Figure 7.8.5.2-1 2nd",
"110100111001111010111011001000100101100111001000101100011100010110110010000101100011101011"
},
/* 22*/ { BARCODE_EAN128, GS1_MODE, "[8005]000365[10]123456", 0, 1, 156, "GS1 General Specifications Figure 7.8.5.2-2",
/* 31*/ { BARCODE_EAN128, GS1_MODE, "[8005]000365[10]123456", 0, 1, 156, 1, "GGS Figure 7.8.5.2-2",
"110100111001111010111010100111100100010011001101100110010010011000100101100001111010111011001000100101100111001000101100011100010110101100001001100011101011"
},
/* 23*/ { BARCODE_EAN128, GS1_MODE, "[403]27653113+99000900090010", 0, 1, 222, "DHL Leitcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
/* 32*/ { BARCODE_EAN128, GS1_MODE, "[403]27653113+99000900090010", 0, 1, 222, 1, "DHL Leitcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
"110100111001111010111011000101000110001101101100101000011011101110110001001001011110111011001011100110001001001011101111010111011110110110011001100100100011011001100110010010001101100110011001000100110001000101100011101011"
},
/* 24*/ { BARCODE_EAN128, GS1_MODE, "[00]340433935039756615", 0, 1, 156, "DHL Identcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
/* 33*/ { BARCODE_EAN128, GS1_MODE, "[00]340433935039756615", 0, 1, 156, 1, "DHL Identcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
"110100111001111010111011011001100100010110001001000110010100011000101000111101100010111011010001000110000100101001000011010111001100100111001101100011101011"
},
/* 25*/ { BARCODE_EAN14, GS1_MODE, "4070071967072", 0, 1, 134, "Verified manually against tec-it",
/* 34*/ { BARCODE_EAN14, GS1_MODE, "4070071967072", 0, 1, 134, 1, "Verified manually against tec-it",
"11010011100111101011101100110110011000101000101100001001001100010011001011100100001011001001100010011001001110110111001001100011101011"
},
/* 26*/ { BARCODE_NVE18, GS1_MODE, "40700000071967072", 0, 1, 156, "Verified manually against tec-it",
/* 35*/ { BARCODE_NVE18, GS1_MODE, "40700000071967072", 0, 1, 156, 1, "Verified manually against tec-it",
"110100111001111010111011011001100110001010001011000010011011001100110110011001001100010011001011100100001011001001100010011001001110110111011101100011101011"
},
/* 27*/ { BARCODE_HIBC_128, UNICODE_MODE, "83278F8G9H0J2G", 0, 1, 211, "ANSI/HIBC 2.6 - 2016 Section 4.1, not same, uses different encoding (eg begins StartA instead of StartB)",
/* 36*/ { BARCODE_HIBC_128, UNICODE_MODE, "83278F8G9H0J2G", 0, 1, 211, 1, "ANSI/HIBC 2.6 - 2016 Section 4.1, not same, uses different encoding (eg begins StartA instead of StartB)",
"1101001000011000100100111010011001011101111011000110110110000101001011110111010001100010111010011001101000100011100101100110001010001001110110010110111000110011100101101000100010001001100111101010001100011101011"
},
/* 28*/ { BARCODE_HIBC_128, UNICODE_MODE, "A123BJC5D6E71", 0, 1, 200, "ANSI/HIBC 2.6 - 2016 Figure 1, same",
/* 37*/ { BARCODE_HIBC_128, UNICODE_MODE, "A123BJC5D6E71", 0, 1, 200, 1, "ANSI/HIBC 2.6 - 2016 Figure 1, same",
"11010010000110001001001010001100010011100110110011100101100101110010001011000101101110001000100011011011100100101100010001100111010010001101000111011011101001110011011010001000110001101101100011101011"
},
/* 29*/ { BARCODE_HIBC_128, UNICODE_MODE, "$$52001510X3G", 0, 1, 178, "ANSI/HIBC 2.6 - 2016 Figure 5, same",
/* 38*/ { BARCODE_HIBC_128, UNICODE_MODE, "$$52001510X3G", 0, 1, 178, 1, "ANSI/HIBC 2.6 - 2016 Figure 5, same",
"1101001000011000100100100100011001001000110010111011110110111000101101100110010111001100110010001001011110111011100010110110010111001101000100010110001000100011110101100011101011"
},
};
@ -558,9 +586,9 @@ static void test_encode(int index, int generate, int debug) {
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (generate) {
printf(" /*%3d*/ { %s, %s, \"%s\", %s, %d, %d, \"%s\",\n",
printf(" /*%3d*/ { %s, %s, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
testUtilModulesDump(symbol, " ", "\n");
printf(" },\n");
} else {
@ -575,12 +603,16 @@ static void test_encode(int index, int generate, int debug) {
}
if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) {
ret = testUtilBwipp(symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
ret = testUtilBwipp(symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
}
}
}
}

View file

@ -55,22 +55,22 @@ static void test_eanx_leading_zeroes(int index, int debug) {
/* 5*/ { BARCODE_EANX_CC, "123456", "[21]A12345678", 0, 8, 72 },
/* 6*/ { BARCODE_EANX_CC, "1234567", "[21]A12345678", 0, 8, 72 },
/* 7*/ { BARCODE_EANX_CC, "12345678", "[21]A12345678", 0, 7, 99 }, // EAN-13
/* 8*/ { BARCODE_EANX_CC, "1+12", "[21]A12345678", 0, 8, 101 }, // EAN-8 + EAN-2
/* 9*/ { BARCODE_EANX_CC, "12+12", "[21]A12345678", 0, 8, 101 },
/*10*/ { BARCODE_EANX_CC, "123+12", "[21]A12345678", 0, 8, 101 },
/*11*/ { BARCODE_EANX_CC, "1234+12", "[21]A12345678", 0, 8, 101 },
/*12*/ { BARCODE_EANX_CC, "12345+12", "[21]A12345678", 0, 8, 101 },
/*13*/ { BARCODE_EANX_CC, "123456+12", "[21]A12345678", 0, 8, 101 },
/*14*/ { BARCODE_EANX_CC, "1234567+12", "[21]A12345678", 0, 8, 101 },
/*15*/ { BARCODE_EANX_CC, "12345678+12", "[21]A12345678", 0, 7, 128 }, // EAN-13 + EAN-2
/*16*/ { BARCODE_EANX_CC, "1+123", "[21]A12345678", 0, 8, 128 }, // EAN-8 + EAN-5
/*17*/ { BARCODE_EANX_CC, "12+123", "[21]A12345678", 0, 8, 128 },
/*18*/ { BARCODE_EANX_CC, "123+123", "[21]A12345678", 0, 8, 128 },
/*19*/ { BARCODE_EANX_CC, "1234+123", "[21]A12345678", 0, 8, 128 },
/*20*/ { BARCODE_EANX_CC, "12345+123", "[21]A12345678", 0, 8, 128 },
/*21*/ { BARCODE_EANX_CC, "123456+123", "[21]A12345678", 0, 8, 128 },
/*22*/ { BARCODE_EANX_CC, "1234567+123", "[21]A12345678", 0, 8, 128 },
/*23*/ { BARCODE_EANX_CC, "12345678+123", "[21]A12345678", 0, 7, 155 }, // EAN-13 + EAN-5
/* 8*/ { BARCODE_EANX_CC, "1+12", "[21]A12345678", 0, 8, 99 }, // EAN-8 + EAN-2
/* 9*/ { BARCODE_EANX_CC, "12+12", "[21]A12345678", 0, 8, 99 },
/*10*/ { BARCODE_EANX_CC, "123+12", "[21]A12345678", 0, 8, 99 },
/*11*/ { BARCODE_EANX_CC, "1234+12", "[21]A12345678", 0, 8, 99 },
/*12*/ { BARCODE_EANX_CC, "12345+12", "[21]A12345678", 0, 8, 99 },
/*13*/ { BARCODE_EANX_CC, "123456+12", "[21]A12345678", 0, 8, 99 },
/*14*/ { BARCODE_EANX_CC, "1234567+12", "[21]A12345678", 0, 8, 99 },
/*15*/ { BARCODE_EANX_CC, "12345678+12", "[21]A12345678", 0, 7, 126 }, // EAN-13 + EAN-2
/*16*/ { BARCODE_EANX_CC, "1+123", "[21]A12345678", 0, 8, 126 }, // EAN-8 + EAN-5
/*17*/ { BARCODE_EANX_CC, "12+123", "[21]A12345678", 0, 8, 126 },
/*18*/ { BARCODE_EANX_CC, "123+123", "[21]A12345678", 0, 8, 126 },
/*19*/ { BARCODE_EANX_CC, "1234+123", "[21]A12345678", 0, 8, 126 },
/*20*/ { BARCODE_EANX_CC, "12345+123", "[21]A12345678", 0, 8, 126 },
/*21*/ { BARCODE_EANX_CC, "123456+123", "[21]A12345678", 0, 8, 126 },
/*22*/ { BARCODE_EANX_CC, "1234567+123", "[21]A12345678", 0, 8, 126 },
/*23*/ { BARCODE_EANX_CC, "12345678+123", "[21]A12345678", 0, 7, 153 }, // EAN-13 + EAN-5
};
int data_size = sizeof(data) / sizeof(struct item);
@ -1129,6 +1129,93 @@ static void test_examples(int index, int generate, int debug) {
"000000000101100011000010100010011001001101001100011011101001110001110100100111101011001000010010100110001100100111001010000100010111001000100111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"000000011010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110101111011101000110111011000111010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
},
/*56*/ { BARCODE_EANX_CC, 1, "123456789012+12", "[91]123456789012345678901", 0, 8, 126, "Example of EAN-13 with 2-digit addon, CC-A 4 cols, 4 rows",
"110100100011110011010011100101110111000100001001000110101110111001000001100000100110111011101100101000000000000000000000000000"
"110101100011101011001000000110011110101111101001000010110010111101100001100100111000001011001100101000000000000000000000000000"
"110101110011101011111010000111111001101110101011000010111110101111001101001101001110000011011100101000000000000000000000000000"
"110101111010001100110000100100001011100011101011100010100011100111000101101000100011000011011110101000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000"
"001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000"
"000101001001101111010011101011000100001010010001010101001000111010011100101100110110110010010001010000000101100110010100100110"
},
/*57*/ { BARCODE_EANX_CC, 1, "123456789012+54321", "[91]1234567890", 0, 7, 153, "Example of EAN-13 with 5-digit addon, CC-B 4 cols, 3 rows",
"110110111011110011010011100101110111000100001001110100101110111001000001100000100110111011011000101000000000000000000000000000000000000000000000000000000"
"110110110011111101010011100111110001001001101001100100110100011100010001001011111100111011001000101000000000000000000000000000000000000000000000000000000"
"110110100010100000101111000111001111001011101001100110110011111010010001001111101101000011101000101000000000000000000000000000000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"000101001001101111010011101011000100001010010001010101001000111010011100101100110110110010010001010000000101101110010101000110101000010100100110100110010"
},
/*58*/ { BARCODE_UPCA_CC, 1, "12345678901+12", "[91]123456789", 0, 7, 128, "Example of UPC-A with 2-digit addon, CC-A 4 cols, 3 rows",
"11011011101111001101001110010111011100010000100111010010111011100100000110000010011011101101100010100000000000000000000000000000"
"11011011001110011100111101011000010001110010100110010011101011001000000100101111110011101100100010100000000000000000000000000000"
"11011010001000011110010001010111101000000100100110011010001110000101100110111000100011101110100010100000000000000000000000000000"
"00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000"
"00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000"
"00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000"
"00010100110010010011011110101000110110001010111101010100010010010001110100111001011001101101100101000000000101100110010100100110"
},
/*59*/ { BARCODE_UPCA_CC, 2, "12345678901+12121", "[91]1234567890123", 0, 8, 155, "Example of UPC-A with 5-digit addon, CC-B 4 cols, 4 rows",
"11010011101000111110100111011011111101011100100111011011010000111101100110010111000010001101001000100000000000000000000000000000000000000000000000000000000"
"11010011001011001001110000010111110110000010100111010011011111100110100111010011111001001101011000100000000000000000000000000000000000000000000000000000000"
"11010001001110011010000110011001000001011000100110010010011110111101000111000111010001001101011100100000000000000000000000000000000000000000000000000000000"
"11010001101100010111000001011101101110010000100110011011111000101011000111100010010100001101011110100000000000000000000000000000000000000000000000000000000"
"00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000"
"00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000"
"00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000"
"00010100110010010011011110101000110110001010111101010100010010010001110100111001011001101101100101000000000101100110010100100110101100110100110110100110010"
},
/*60*/ { BARCODE_UPCE_CC, 1, "0654321+89", "[91]1", 0, 9, 82, "Example of UPC-E with 2-digit addon, CC-A 2 cols, 5 rows",
"1101100110111101110101111101010001000111100011110101001000000000000000000000000000"
"1101101110111011000010001101110010101110000011100101001000000000000000000000000000"
"1101101100110001011111011101111010000100100011101101001000000000000000000000000000"
"1101101000100111011100111101110011110101110011101001001000000000000000000000000000"
"1101001000110011001000000101110100011011110011101001101000000000000000000000000000"
"0001000000000000000000000000000000000000000000000000010000000000000000000000000000"
"0010000000000000000000000000000000000000000000000000001000000000000000000000000000"
"0001000000000000000000000000000000000000000000000000010000000000000000000000000000"
"0001010000101011000100111010111101001101100110010101010000000101101101110100101110"
},
/*61*/ { BARCODE_UPCE_CC, 2, "1876543+56789", "[91]12345", 0, 12, 109, "Example of UPC-E with 5-digit addon, CC-B 2 cols, 8 rows",
"1100100010111011111011101001000001000010001011001000101000000000000000000000000000000000000000000000000000000"
"1110100010110100001111011001100101110000100011101000101000000000000000000000000000000000000000000000000000000"
"1110110010111011001001111101000111100100001011101100101000000000000000000000000000000000000000000000000000000"
"1100110010110011101100010001010111110111110011001100101000000000000000000000000000000000000000000000000000000"
"1101110010111110010011011101001111110100110011011100101000000000000000000000000000000000000000000000000000000"
"1101111010110011100001011101001101000011100011011110101000000000000000000000000000000000000000000000000000000"
"1100111010101000100000100001011110111110110011001110101000000000000000000000000000000000000000000000000000000"
"1110111010101111001011110001011110001001111011101110101000000000000000000000000000000000000000000000000000000"
"0001000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"0010000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000"
"0001000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"0001010110111001000100001010110001010001101000010101010000000101101100010101011110100100010101101110100101110"
},
/*62*/ { BARCODE_EANX_CC, 1, "9876543+65", "[91]1234567", 0, 8, 99, "Example of EAN-8 with 2-digit addon, CC-A 3 cols, 4 rows",
"100100011111001101010011000111000101110011001100010111010000011101001101000000000000000000000000000"
"110111111001101001010111000110111100101100001111000100111101011101011101000000000000000000000000000"
"100001011000001101010110000101011111011111001110100100001110011101011001000000000000000000000000000"
"111100100011001101010010000110010011111011101010011111000110011101010001000000000000000000000000000"
"000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000"
"000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000"
"000010100010110110111011101101011110101010011101011100100001011100101010000000101101011110101110010"
},
/*63*/ { BARCODE_EANX_CC, 2, "9876543+74083", "[91]123456789012345678", 0, 12, 136, "Example of EAN-8 with 5-digit addon, CC-B 3 cols, 8 rows",
"1100111010111011111011101001000010110100000100001000101111101101001111011001110101000000000000000000000000000000000000000000000000000000"
"1110111010110010111000010001000010010111001011001000001110001101110100011101110101000000000000000000000000000000000000000000000000000000"
"1110011010110111111001101001000011010101000101111000001100100110111111011100110101000000000000000000000000000000000000000000000000000000"
"1111011010111011010000110001000111010110000110110011001110011010011000011110110101000000000000000000000000000000000000000000000000000000"
"1111001010111011011100100001000110010111011101111001001010011110000100011110010101000000000000000000000000000000000000000000000000000000"
"1110001010111111010110001001000100010111001011111101101001111000011011011100010101000000000000000000000000000000000000000000000000000000"
"1100001010111100100010111101001100010111001111001100101001110001110010011000010101000000000000000000000000000000000000000000000000000000"
"1100011010110011001111010001001110010111110111101110101011100111111001011000110101000000000000000000000000000000000000000000000000000000"
"0000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"0000000000000100000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000"
"0000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"0000000000000010100010110110111011101101011110101010011101011100100001011100101010000000101101110110100111010100011010101101110101000010"
},
};
int data_size = sizeof(data) / sizeof(struct item);
@ -1469,7 +1556,7 @@ static void test_ean128_cc_shift(int index, int generate, int debug) {
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s skipped, not BWIPP compatible\n", i, testUtilBarcodeName(symbol->symbology));
if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
ret = testUtilBwipp(symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);

View file

@ -125,6 +125,16 @@ static void test_print(int index, int generate, int debug) {
};
struct item data[] = {
/* 0*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/png/codablockf_3rows.png" },
/* 1*/ { BARCODE_EANX, -1, -1, "9771384524017+12", "../data/png/ean13_2addon_ggs_5.2.2.5.1-2.png" },
/* 2*/ { BARCODE_EANX, -1, -1, "9780877799306+54321", "../data/png/ean13_5addon_ggs_5.2.2.5.2-2.png" },
/* 3*/ { BARCODE_UPCA, -1, -1, "012345678905+24", "../data/png/upca_2addon_ggs_5.2.6.6-5.png" },
/* 4*/ { BARCODE_UPCA, -1, -1, "614141234417+12345", "../data/png/upca_5addon.png" },
/* 5*/ { BARCODE_UPCE, -1, -1, "1234567+12", "../data/png/upce_2addon.png" },
/* 6*/ { BARCODE_UPCE, -1, -1, "1234567+12345", "../data/png/upce_5addon.png" },
/* 7*/ { BARCODE_EANX, -1, -1, "1234567+12", "../data/png/ean8_2addon.png" },
/* 8*/ { BARCODE_EANX, -1, -1, "1234567+12345", "../data/png/ean8_5addon.png" },
/* 9*/ { BARCODE_EANX, -1, -1, "12345", "../data/png/ean5.png" },
/* 10*/ { BARCODE_EANX, -1, -1, "12", "../data/png/ean2.png" },
};
int data_size = ARRAY_SIZE(data);

View file

@ -124,111 +124,122 @@ static void test_buffer(int index, int generate, int debug) {
/* 5*/ { BARCODE_C25IND, "0000000000", "", 50, 1, 159, 318, 118 },
/* 6*/ { BARCODE_CODE39, "0000000000", "", 50, 1, 155, 310, 118 },
/* 7*/ { BARCODE_EXCODE39, "0000000000", "", 50, 1, 155, 310, 118 },
/* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 230, 118 },
/* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 230, 118 },
/* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 124, 288, 118 },
/* 11*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 151, 342, 118 },
/* 12*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 134, 118 },
/* 13*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 96, 192, 118 },
/* 14*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 123, 246, 118 },
/* 15*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 94, 118 },
/* 16*/ { BARCODE_EANX, "12", "", 50, 1, 20, 40, 118 },
/* 17*/ { BARCODE_EAN128, "[01]12345678901234", "", 50, 1, 134, 268, 118 },
/* 18*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 118 },
/* 19*/ { BARCODE_CODE128, "0000000000", "", 50, 1, 90, 180, 118 },
/* 20*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 118 },
/* 21*/ { BARCODE_DPIDENT, "12345678901", "", 50, 1, 117, 234, 118 },
/* 22*/ { BARCODE_CODE16K, "0000000000", "", 20, 2, 70, 162, 44 },
/* 23*/ { BARCODE_CODE49, "0000000000", "", 20, 2, 70, 162, 44 },
/* 24*/ { BARCODE_CODE93, "0000000000", "", 50, 1, 127, 254, 118 },
/* 25*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
/* 26*/ { BARCODE_RSS14, "1234567890123", "", 50, 1, 96, 192, 118 },
/* 27*/ { BARCODE_RSS_LTD, "1234567890123", "", 50, 1, 74, 148, 118 },
/* 28*/ { BARCODE_RSS_EXP, "[01]12345678901234", "", 34, 1, 134, 268, 86 },
/* 29*/ { BARCODE_TELEPEN, "0000000000", "", 50, 1, 208, 416, 118 },
/* 30*/ { BARCODE_UPCA, "12345678904", "", 50, 1, 95, 230, 118 },
/* 31*/ { BARCODE_UPCA_CHK, "12345678905", "", 50, 1, 95, 230, 118 },
/* 32*/ { BARCODE_UPCA, "12345678904+12", "", 50, 1, 124, 288, 118 },
/* 33*/ { BARCODE_UPCA, "12345678904+12345", "", 50, 1, 151, 342, 118 },
/* 34*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 142, 118 },
/* 35*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 142, 118 },
/* 36*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 80, 200, 118 },
/* 37*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 107, 254, 118 },
/* 38*/ { BARCODE_POSTNET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 39*/ { BARCODE_MSI_PLESSEY, "0000000000", "", 50, 1, 127, 254, 118 },
/* 40*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34, 100 },
/* 41*/ { BARCODE_LOGMARS, "0000000000", "", 50, 1, 191, 382, 118 },
/* 42*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116, 100 },
/* 43*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284, 118 },
/* 44*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58, 20 },
/* 45*/ { BARCODE_PDF417, "0000000000", "", 21, 7, 103, 206, 42 },
/* 46*/ { BARCODE_PDF417TRUNC, "0000000000", "", 21, 7, 68, 136, 42 },
/* 47*/ { BARCODE_MAXICODE, "0000000000", "", 165, 33, 30, 300, 300 },
/* 48*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 49*/ { BARCODE_CODE128B, "0000000000", "", 50, 1, 145, 290, 118 },
/* 50*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266, 16 },
/* 51*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146, 16 },
/* 52*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146, 16 },
/* 53*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146, 16 },
/* 54*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 230, 118 },
/* 55*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 124, 288, 118 },
/* 56*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 151, 342, 118 },
/* 57*/ { BARCODE_RM4SCC, "0000000000", "", 8, 3, 91, 182, 16 },
/* 58*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20, 20 },
/* 59*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268, 118 },
/* 60*/ { BARCODE_VIN, "00000000000000000", "", 50, 1, 246, 492, 118 },
/* 61*/ { BARCODE_CODABLOCKF, "0000000000", "", 20, 2, 101, 242, 44 },
/* 62*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312, 118 },
/* 63*/ { BARCODE_JAPANPOST, "0000000000", "", 8, 3, 133, 266, 16 },
/* 64*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 118 },
/* 65*/ { BARCODE_RSS14STACK, "0000000000000", "", 13, 3, 50, 100, 26 },
/* 66*/ { BARCODE_RSS14STACK_OMNI, "0000000000000", "", 69, 5, 50, 100, 138 },
/* 67*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", "", 71, 5, 102, 204, 142 },
/* 68*/ { BARCODE_PLANET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 69*/ { BARCODE_MICROPDF417, "0000000000", "", 12, 6, 82, 164, 24 },
/* 70*/ { BARCODE_ONECODE, "12345678901234567890", "", 8, 3, 129, 258, 16 },
/* 71*/ { BARCODE_PLESSEY, "0000000000", "", 50, 1, 227, 454, 118 },
/* 72*/ { BARCODE_TELEPEN_NUM, "0000000000", "", 50, 1, 128, 256, 118 },
/* 73*/ { BARCODE_ITF14, "0000000000", "", 50, 1, 135, 382, 150 },
/* 74*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 },
/* 75*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 },
/* 76*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
/* 77*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 },
/* 78*/ { BARCODE_HIBC_128, "0000000000", "", 50, 1, 134, 268, 118 },
/* 79*/ { BARCODE_HIBC_39, "0000000000", "", 50, 1, 223, 446, 118 },
/* 80*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 },
/* 81*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 82*/ { BARCODE_HIBC_PDF, "0000000000", "", 27, 9, 103, 206, 54 },
/* 83*/ { BARCODE_HIBC_MICPDF, "0000000000", "", 34, 17, 38, 76, 68 },
/* 84*/ { BARCODE_HIBC_BLOCKF, "0000000000", "", 30, 3, 101, 242, 64 },
/* 85*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 },
/* 86*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 33, 23 },
/* 87*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 },
/* 88*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
/* 89*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 },
/* 90*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 118 },
/* 91*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 238, 118 },
/* 92*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 128, 296, 118 },
/* 93*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 155, 350, 118 },
/* 94*/ { BARCODE_EAN128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290, 118 },
/* 95*/ { BARCODE_RSS14_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60 },
/* 96*/ { BARCODE_RSS_LTD_CC, "1234567890123", "[20]01", 19, 6, 74, 148, 56 },
/* 97*/ { BARCODE_RSS_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268, 100 },
/* 98*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 238, 118 },
/* 99*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 296, 118 },
/*100*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 350, 118 },
/*101*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 150, 118 },
/*102*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 84, 208, 118 },
/*103*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 111, 262, 118 },
/*104*/ { BARCODE_RSS14STACK_CC, "0000000000000", "[20]01", 24, 9, 56, 112, 48 },
/*105*/ { BARCODE_RSS14_OMNI_CC, "0000000000000", "[20]01", 80, 11, 56, 112, 160 },
/*106*/ { BARCODE_RSS_EXPSTACK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204, 156 },
/*107*/ { BARCODE_CHANNEL, "00", "", 50, 1, 19, 38, 118 },
/*108*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
/*109*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
/*110*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
/*111*/ { BARCODE_ULTRA, "0000000000", "", 13, 13, 18, 36, 26 },
/*112*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 },
/* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 226, 118 },
/* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 226, 118 },
/* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 122, 276, 118 },
/* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 50, 1, 122, 276, 118 },
/* 12*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 149, 330, 118 },
/* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 50, 1, 149, 330, 118 },
/* 14*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 162, 118 },
/* 15*/ { BARCODE_EANX_CHK, "12345670", "", 50, 1, 67, 162, 118 },
/* 16*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 94, 216, 118 },
/* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", 50, 1, 94, 216, 118 },
/* 18*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 121, 270, 118 },
/* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", 50, 1, 121, 270, 118 },
/* 20*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 118, 118 },
/* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 118 },
/* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 118 },
/* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 118 },
/* 24*/ { BARCODE_EAN128, "[01]12345678901234", "", 50, 1, 134, 268, 118 },
/* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 118 },
/* 26*/ { BARCODE_CODE128, "0000000000", "", 50, 1, 90, 180, 118 },
/* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 118 },
/* 28*/ { BARCODE_DPIDENT, "12345678901", "", 50, 1, 117, 234, 118 },
/* 29*/ { BARCODE_CODE16K, "0000000000", "", 20, 2, 70, 162, 44 },
/* 30*/ { BARCODE_CODE49, "0000000000", "", 20, 2, 70, 162, 44 },
/* 31*/ { BARCODE_CODE93, "0000000000", "", 50, 1, 127, 254, 118 },
/* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
/* 33*/ { BARCODE_RSS14, "1234567890123", "", 50, 1, 96, 192, 118 },
/* 34*/ { BARCODE_RSS_LTD, "1234567890123", "", 50, 1, 74, 148, 118 },
/* 35*/ { BARCODE_RSS_EXP, "[01]12345678901234", "", 34, 1, 134, 268, 86 },
/* 36*/ { BARCODE_TELEPEN, "0000000000", "", 50, 1, 208, 416, 118 },
/* 37*/ { BARCODE_UPCA, "12345678904", "", 50, 1, 95, 226, 118 },
/* 38*/ { BARCODE_UPCA_CHK, "123456789043", "", 50, 1, 95, 226, 118 },
/* 39*/ { BARCODE_UPCA, "12345678904+12", "", 50, 1, 124, 276, 118 },
/* 40*/ { BARCODE_UPCA_CHK, "123456789043+12", "", 50, 1, 124, 276, 118 },
/* 41*/ { BARCODE_UPCA, "12345678904+12345", "", 50, 1, 151, 330, 118 },
/* 42*/ { BARCODE_UPCA_CHK, "123456789043+12345", "", 50, 1, 151, 330, 118 },
/* 43*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 134, 118 },
/* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 134, 118 },
/* 45*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 78, 184, 118 },
/* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 50, 1, 78, 184, 118 },
/* 47*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 105, 238, 118 },
/* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 50, 1, 105, 238, 118 },
/* 49*/ { BARCODE_POSTNET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 50*/ { BARCODE_MSI_PLESSEY, "0000000000", "", 50, 1, 127, 254, 118 },
/* 51*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34, 100 },
/* 52*/ { BARCODE_LOGMARS, "0000000000", "", 50, 1, 191, 382, 118 },
/* 53*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116, 100 },
/* 54*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284, 118 },
/* 55*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58, 20 },
/* 56*/ { BARCODE_PDF417, "0000000000", "", 21, 7, 103, 206, 42 },
/* 57*/ { BARCODE_PDF417TRUNC, "0000000000", "", 21, 7, 68, 136, 42 },
/* 58*/ { BARCODE_MAXICODE, "0000000000", "", 165, 33, 30, 300, 300 }, // Differs from vector
/* 59*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 60*/ { BARCODE_CODE128B, "0000000000", "", 50, 1, 145, 290, 118 },
/* 61*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266, 16 },
/* 62*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146, 16 },
/* 63*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146, 16 },
/* 64*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146, 16 },
/* 65*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 226, 118 },
/* 66*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 122, 276, 118 },
/* 67*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 149, 330, 118 },
/* 68*/ { BARCODE_RM4SCC, "0000000000", "", 8, 3, 91, 182, 16 },
/* 69*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20, 20 },
/* 70*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268, 118 },
/* 71*/ { BARCODE_VIN, "00000000000000000", "", 50, 1, 246, 492, 118 },
/* 72*/ { BARCODE_CODABLOCKF, "0000000000", "", 20, 2, 101, 242, 44 },
/* 73*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312, 118 },
/* 74*/ { BARCODE_JAPANPOST, "0000000000", "", 8, 3, 133, 266, 16 },
/* 75*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 118 },
/* 76*/ { BARCODE_RSS14STACK, "0000000000000", "", 13, 3, 50, 100, 26 },
/* 77*/ { BARCODE_RSS14STACK_OMNI, "0000000000000", "", 69, 5, 50, 100, 138 },
/* 78*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", "", 71, 5, 102, 204, 142 },
/* 79*/ { BARCODE_PLANET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 80*/ { BARCODE_MICROPDF417, "0000000000", "", 12, 6, 82, 164, 24 },
/* 81*/ { BARCODE_ONECODE, "12345678901234567890", "", 8, 3, 129, 258, 16 },
/* 82*/ { BARCODE_PLESSEY, "0000000000", "", 50, 1, 227, 454, 118 },
/* 83*/ { BARCODE_TELEPEN_NUM, "0000000000", "", 50, 1, 128, 256, 118 },
/* 84*/ { BARCODE_ITF14, "0000000000", "", 50, 1, 135, 330, 138 },
/* 85*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 },
/* 86*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 },
/* 87*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
/* 88*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 },
/* 89*/ { BARCODE_HIBC_128, "0000000000", "", 50, 1, 134, 268, 118 },
/* 90*/ { BARCODE_HIBC_39, "0000000000", "", 50, 1, 223, 446, 118 },
/* 91*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 },
/* 92*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 93*/ { BARCODE_HIBC_PDF, "0000000000", "", 27, 9, 103, 206, 54 },
/* 94*/ { BARCODE_HIBC_MICPDF, "0000000000", "", 34, 17, 38, 76, 68 },
/* 95*/ { BARCODE_HIBC_BLOCKF, "0000000000", "", 30, 3, 101, 242, 64 },
/* 96*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 },
/* 97*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 33, 23 }, // Differs from vector
/* 98*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 },
/* 99*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
/*100*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 },
/*101*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 118 },
/*102*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 234, 118 },
/*103*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 126, 284, 118 },
/*104*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 153, 338, 118 },
/*105*/ { BARCODE_EAN128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290, 118 },
/*106*/ { BARCODE_RSS14_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60 },
/*107*/ { BARCODE_RSS_LTD_CC, "1234567890123", "[20]01", 19, 6, 74, 148, 56 },
/*108*/ { BARCODE_RSS_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268, 100 },
/*109*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 118 },
/*110*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 118 },
/*111*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 118 },
/*112*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 142, 118 },
/*113*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 82, 192, 118 },
/*114*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 118 },
/*115*/ { BARCODE_RSS14STACK_CC, "0000000000000", "[20]01", 24, 9, 56, 112, 48 },
/*116*/ { BARCODE_RSS14_OMNI_CC, "0000000000000", "[20]01", 80, 11, 56, 112, 160 },
/*117*/ { BARCODE_RSS_EXPSTACK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204, 156 },
/*118*/ { BARCODE_CHANNEL, "00", "", 50, 1, 19, 38, 118 },
/*119*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
/*120*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
/*121*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
/*122*/ { BARCODE_ULTRA, "0000000000", "", 13, 13, 18, 36, 26 },
/*123*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 },
};
int data_size = ARRAY_SIZE(data);
@ -305,34 +316,38 @@ static void test_upcean_hrt(int index, int debug) {
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 1*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 3*/ { BARCODE_EANX_CHK, 0, "1234567890128", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 4*/ { BARCODE_EANX_CHK, -1, "1234567890128+12", 0, 50, 1, 124, 288, 118, 103 /*text_row*/, 0, 20, 5, 210, 78 }, // EAN-13 + EAN-2
/* 5*/ { BARCODE_EANX_CHK, 0, "1234567890128+12", 0, 50, 1, 124, 288, 118, 103 /*text_row*/, 0, 20, 5, 210, 78 }, // EAN-13 + EAN-2
/* 6*/ { BARCODE_EANX, -1, "1234567890128+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, // EAN-13 + EAN-5
/* 7*/ { BARCODE_EANX, 0, "1234567890128+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, // EAN-13 + EAN-5
/* 8*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, // ISBNX + EAN-5
/* 9*/ { BARCODE_ISBNX, 0, "9784567890120+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, // ISBNX + EAN-5
/* 10*/ { BARCODE_EANX, -1, "123456", 0, 50, 1, 67, 134, 118, 103 /*text_row*/, 6, 58, -1, -1, -1 }, // EAN-8
/* 11*/ { BARCODE_EANX, 0, "123456", 0, 50, 1, 67, 134, 118, 103 /*text_row*/, 6, 58, -1, -1, -1 }, // EAN-8
/* 12*/ { BARCODE_EANX, -1, "123456+12", 0, 50, 1, 96, 192, 118, 103 /*text_row*/, 6, 58, 5, 134, 58 }, // EAN-8 + EAN-2
/* 13*/ { BARCODE_EANX, 0, "123456+12", 0, 50, 1, 96, 192, 118, 103 /*text_row*/, 6, 58, 5, 134, 58 }, // EAN-8 + EAN-2
/* 14*/ { BARCODE_EANX, -1, "123456+12345", 0, 50, 1, 123, 246, 118, 103 /*text_row*/, 6, 58, 5, 134, 112 }, // EAN-8 + EAN-5
/* 15*/ { BARCODE_EANX, 0, "123456+12345", 0, 50, 1, 123, 246, 118, 103 /*text_row*/, 6, 58, 5, 134, 112 }, // EAN-8 + EAN-5
/* 16*/ { BARCODE_UPCA, -1, "123456789012", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 },
/* 17*/ { BARCODE_UPCA, 0, "123456789012", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 },
/* 18*/ { BARCODE_UPCA, -1, "123456789012+12", 0, 50, 1, 124, 288, 118, 103 /*text_row*/, 0, 20, 5, 210, 78 },
/* 19*/ { BARCODE_UPCA, 0, "123456789012+12", 0, 50, 1, 124, 288, 118, 103 /*text_row*/, 0, 20, 5, 210, 78 },
/* 20*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 },
/* 21*/ { BARCODE_UPCA_CHK, 0, "123456789012+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 },
/* 22*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 142, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 },
/* 23*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 142, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 },
/* 24*/ { BARCODE_UPCE_CHK, -1, "12345670+12", 0, 50, 1, 80, 200, 118, 103 /*text_row*/, 0, 20, 5, 122, 78 },
/* 25*/ { BARCODE_UPCE_CHK, 0, "12345670+12", 0, 50, 1, 80, 200, 118, 103 /*text_row*/, 0, 20, 5, 122, 78 },
/* 26*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 107, 254, 118, 103 /*text_row*/, 0, 20, 5, 122, 130 },
/* 27*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 107, 254, 118, 103 /*text_row*/, 0, 20, 5, 122, 130 },
/* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 1*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 3*/ { BARCODE_EANX_CHK, 0, "1234567890128", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 4*/ { BARCODE_EANX_CHK, -1, "1234567890128+12", 0, 50, 1, 122, 276, 118, 103 /*text_row*/, 0, 20, 5, 212, 64 }, // EAN-13 + EAN-2
/* 5*/ { BARCODE_EANX_CHK, 0, "1234567890128+12", 0, 50, 1, 122, 276, 118, 103 /*text_row*/, 0, 20, 5, 212, 64 }, // EAN-13 + EAN-2
/* 6*/ { BARCODE_EANX, -1, "1234567890128+12345", 0, 50, 1, 149, 330, 118, 103 /*text_row*/, 0, 20, 5, 212, 118 }, // EAN-13 + EAN-5
/* 7*/ { BARCODE_EANX, 0, "1234567890128+12345", 0, 50, 1, 149, 330, 118, 103 /*text_row*/, 0, 20, 5, 212, 118 }, // EAN-13 + EAN-5
/* 8*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 149, 330, 118, 103 /*text_row*/, 0, 20, 5, 212, 118 }, // ISBNX + EAN-5
/* 9*/ { BARCODE_ISBNX, 0, "9784567890120+12345", 0, 50, 1, 149, 330, 118, 103 /*text_row*/, 0, 20, 5, 212, 118 }, // ISBNX + EAN-5
/* 10*/ { BARCODE_EANX, -1, "123456", 0, 50, 1, 67, 162, 118, 103 /*text_row*/, 20, 58, -1, -1, -1 }, // EAN-8
/* 11*/ { BARCODE_EANX, 0, "123456", 0, 50, 1, 67, 162, 118, 103 /*text_row*/, 20, 58, -1, -1, -1 }, // EAN-8
/* 12*/ { BARCODE_EANX, -1, "123456+12", 0, 50, 1, 94, 216, 118, 103 /*text_row*/, 20, 58, 5, 148, 68 }, // EAN-8 + EAN-2
/* 13*/ { BARCODE_EANX, 0, "123456+12", 0, 50, 1, 94, 216, 118, 103 /*text_row*/, 20, 58, 5, 148, 68 }, // EAN-8 + EAN-2
/* 14*/ { BARCODE_EANX, -1, "123456+12345", 0, 50, 1, 121, 270, 118, 103 /*text_row*/, 20, 58, 5, 148, 122 }, // EAN-8 + EAN-5
/* 15*/ { BARCODE_EANX, 0, "123456+12345", 0, 50, 1, 121, 270, 118, 103 /*text_row*/, 20, 58, 5, 148, 122 }, // EAN-8 + EAN-5
/* 16*/ { BARCODE_EANX, -1, "1234", 0, 50, 1, 47, 118, 118, 103 /*text_row*/, 40, 36, -1, -1, -1 }, // EAN-5
/* 17*/ { BARCODE_EANX, 0, "1234", 0, 50, 1, 47, 118, 118, 103 /*text_row*/, 40, 36, -1, -1, -1 }, // EAN-5
/* 18*/ { BARCODE_EANX, -1, "12", 0, 50, 1, 20, 64, 118, 103 /*text_row*/, 20, 20, -1, -1, -1 }, // EAN-2
/* 19*/ { BARCODE_EANX, 0, "12", 0, 50, 1, 20, 64, 118, 103 /*text_row*/, 20, 20, -1, -1, -1 }, // EAN-2
/* 20*/ { BARCODE_UPCA, -1, "123456789012", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 18, -1, -1, -1 },
/* 21*/ { BARCODE_UPCA, 0, "123456789012", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 18, -1, -1, -1 },
/* 22*/ { BARCODE_UPCA, -1, "123456789012+12", 0, 50, 1, 124, 276, 118, 103 /*text_row*/, 0, 18, 5, 208, 68 },
/* 23*/ { BARCODE_UPCA, 0, "123456789012+12", 0, 50, 1, 124, 276, 118, 103 /*text_row*/, 0, 18, 5, 208, 68 },
/* 24*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", 0, 50, 1, 151, 330, 118, 103 /*text_row*/, 0, 18, 5, 208, 122 },
/* 25*/ { BARCODE_UPCA_CHK, 0, "123456789012+12345", 0, 50, 1, 151, 330, 118, 103 /*text_row*/, 0, 18, 5, 208, 122 },
/* 26*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 118, 103 /*text_row*/, 0, 18, -1, -1, -1 },
/* 27*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 134, 118, 103 /*text_row*/, 0, 18, -1, -1, -1 },
/* 28*/ { BARCODE_UPCE_CHK, -1, "12345670+12", 0, 50, 1, 78, 184, 118, 103 /*text_row*/, 0, 18, 5, 120, 64 },
/* 29*/ { BARCODE_UPCE_CHK, 0, "12345670+12", 0, 50, 1, 78, 184, 118, 103 /*text_row*/, 0, 18, 5, 120, 64 },
/* 30*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238, 118, 103 /*text_row*/, 0, 18, 5, 120, 118 },
/* 31*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238, 118, 103 /*text_row*/, 0, 18, 5, 120, 118 },
};
int data_size = ARRAY_SIZE(data);
@ -357,11 +372,13 @@ static void test_upcean_hrt(int index, int debug) {
if (index != -1) testUtilBitmapPrint(symbol);
assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, data[i].symbology, symbol->height, data[i].expected_height);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, data[i].symbology, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%d) symbol->width %d != %d\n", i, data[i].symbology, symbol->width, data[i].expected_width);
assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%d) symbol->bitmap_width %d != %d\n", i, data[i].symbology, symbol->bitmap_width, data[i].expected_bitmap_width);
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%d) symbol->bitmap_height %d != %d\n", i, data[i].symbology, symbol->bitmap_height, data[i].expected_bitmap_height);
assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width);
assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%s) symbol->bitmap_width %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_bitmap_width);
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%s) symbol->bitmap_height %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_height, data[i].expected_bitmap_height);
if (data[i].expected_text_row != -1) {
int text_bits_set = 0;

View file

@ -49,6 +49,16 @@ static void test_print(int index, int generate, int debug) {
struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, -1, "<>\"&'", "../data/svg/code128_amperands.svg" },
/* 1*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/svg/codablockf_3rows.svg"},
/* 2*/ { BARCODE_EANX, -1, -1, "9771384524017+12", "../data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg" },
/* 3*/ { BARCODE_EANX, -1, -1, "9780877799306+54321", "../data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg" },
/* 4*/ { BARCODE_UPCA, -1, -1, "012345678905+24", "../data/svg/upca_2addon_ggs_5.2.6.6-5.svg" },
/* 5*/ { BARCODE_UPCA, -1, -1, "614141234417+12345", "../data/svg/upca_5addon.svg" },
/* 6*/ { BARCODE_UPCE, -1, -1, "1234567+12", "../data/svg/upce_2addon.svg" },
/* 7*/ { BARCODE_UPCE, -1, -1, "1234567+12345", "../data/svg/upce_5addon.svg" },
/* 8*/ { BARCODE_EANX, -1, -1, "1234567+12", "../data/svg/ean8_2addon.svg" },
/* 9*/ { BARCODE_EANX, -1, -1, "1234567+12345", "../data/svg/ean8_5addon.svg" },
/* 10*/ { BARCODE_EANX, -1, -1, "12345", "../data/svg/ean5.svg" },
/* 11*/ { BARCODE_EANX, -1, -1, "12", "../data/svg/ean2.svg" },
};
int data_size = sizeof(data) / sizeof(struct item);

View file

@ -74,7 +74,7 @@ static void test_upce_length(int index, int debug) {
int length = strlen(data[i].data);
ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol);
}
@ -112,11 +112,11 @@ static void test_upca_print(int index, int debug) {
int length = strlen(data[i].data);
ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
strcpy(symbol->outfile, "out.gif");
ret = ZBarcode_Print(symbol, 0);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret);
assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt);
assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile);
@ -136,48 +136,51 @@ static void test_isbn(int index, int debug) {
int ret_encode;
int ret_vector;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<"))
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { "0", 0, 0 }, // Left zero-padded if < 10 chars
/* 1*/ { "12345678", ZINT_ERROR_INVALID_CHECK, -1 },
/* 2*/ { "12345679", 0, 0 }, // 9 is correct check digit
/* 3*/ { "123456789", 0, 0 },
/* 4*/ { "0123456789", 0, 0 },
/* 5*/ { "1234567890", ZINT_ERROR_INVALID_CHECK, -1 },
/* 6*/ { "123456789X", 0, 0 }, // X is correct check digit
/* 7*/ { "8175257660", 0, 0 }, // 0 is correct check digit
/* 8*/ { "0590764845", 0, 0 }, // 5 is correct check digit
/* 9*/ { "0906495741", 0, 0 }, // 1 is correct check digit
/*10*/ { "0140430016", 0, 0 }, // 6 is correct check digit
/*11*/ { "0571086187", 0, 0 }, // 7 is correct check digit
/*12*/ { "0486600882", 0, 0 }, // 2 is correct check digit
/*13*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1 },
/*14*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1 },
/*15*/ { "1234567890123", ZINT_ERROR_INVALID_DATA, -1 },
/*16*/ { "9784567890120", 0, 0 }, // 0 is correct check digit
/*17*/ { "9783161484100", 0, 0 }, // 0 is correct check digit
/*18*/ { "9781846688225", 0, 0 }, // 5 is correct check digit
/*19*/ { "9781847657954", 0, 0 }, // 4 is correct check digit
/*20*/ { "9781846688188", 0, 0 }, // 8 is correct check digit
/*21*/ { "9781847659293", 0, 0 }, // 3 is correct check digit
/*22*/ { "97845678901201", ZINT_ERROR_TOO_LONG, -1 },
/*23*/ { "3954994+12", 0, 0 },
/*24*/ { "3954994+12345", 0, 0 },
/*25*/ { "3954994+123456", ZINT_ERROR_TOO_LONG, -1 },
/*26*/ { "3954994+", 0, 0 },
/*27*/ { "61954993+1", 0, 0 },
/*28*/ { "61954993+123", 0, 0 },
/*29*/ { "361954999+12", 0, 0 },
/*30*/ { "361954999+1234", 0, 0 },
/*31*/ { "361954999+12", 0, 0 },
/*32*/ { "199900003X+12", 0, 0 },
/*33*/ { "199900003X+12345", 0, 0 },
/*34*/ { "9791234567896+12", 0, 0 },
/*35*/ { "9791234567896+12345", 0, 0 },
/*36*/ { "9791234567896+", 0, 0 },
/*37*/ { "97912345678961+", ZINT_ERROR_TOO_LONG, -1 },
/*38*/ { "97912345678961+12345", ZINT_ERROR_TOO_LONG, -1 },
/*39*/ { "9791234567896+123456", ZINT_ERROR_TOO_LONG, -1 },
/* 0*/ { "0", 0, 0 }, // Left zero-padded if < 10 chars
/* 1*/ { "12345678", ZINT_ERROR_INVALID_CHECK, -1 },
/* 2*/ { "12345679", 0, 0 }, // 9 is correct check digit
/* 3*/ { "123456789", 0, 0 },
/* 4*/ { "0123456789", 0, 0 },
/* 5*/ { "1234567890", ZINT_ERROR_INVALID_CHECK, -1 },
/* 6*/ { "123456789X", 0, 0 }, // X is correct check digit
/* 7*/ { "123456789x", 0, 0 }, // x is correct check digit
/* 8*/ { "8175257660", 0, 0 }, // 0 is correct check digit
/* 9*/ { "0590764845", 0, 0 }, // 5 is correct check digit
/* 10*/ { "0906495741", 0, 0 }, // 1 is correct check digit
/* 11*/ { "0140430016", 0, 0 }, // 6 is correct check digit
/* 12*/ { "0571086187", 0, 0 }, // 7 is correct check digit
/* 13*/ { "0486600882", 0, 0 }, // 2 is correct check digit
/* 14*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1 },
/* 15*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1 },
/* 16*/ { "1234567890123", ZINT_ERROR_INVALID_DATA, -1 },
/* 17*/ { "9784567890120", 0, 0 }, // 0 is correct check digit
/* 18*/ { "9783161484100", 0, 0 }, // 0 is correct check digit
/* 19*/ { "9781846688225", 0, 0 }, // 5 is correct check digit
/* 20*/ { "9781847657954", 0, 0 }, // 4 is correct check digit
/* 21*/ { "9781846688188", 0, 0 }, // 8 is correct check digit
/* 22*/ { "9781847659293", 0, 0 }, // 3 is correct check digit
/* 23*/ { "97845678901201", ZINT_ERROR_TOO_LONG, -1 },
/* 24*/ { "3954994+12", 0, 0 },
/* 25*/ { "3954994+12345", 0, 0 },
/* 26*/ { "3954994+123456", ZINT_ERROR_TOO_LONG, -1 },
/* 27*/ { "3954994+", 0, 0 },
/* 28*/ { "61954993+1", 0, 0 },
/* 29*/ { "61954993+123", 0, 0 },
/* 30*/ { "361954999+12", 0, 0 },
/* 31*/ { "361954999+1234", 0, 0 },
/* 32*/ { "361954999+12", 0, 0 },
/* 33*/ { "199900003X+12", 0, 0 },
/* 34*/ { "199900003x+12", 0, 0 },
/* 35*/ { "199900003X+12345", 0, 0 },
/* 36*/ { "199900003x+12345", 0, 0 },
/* 37*/ { "9791234567896+12", 0, 0 },
/* 38*/ { "9791234567896+12345", 0, 0 },
/* 39*/ { "9791234567896+", 0, 0 },
/* 40*/ { "97912345678961+", ZINT_ERROR_TOO_LONG, -1 },
/* 41*/ { "97912345678961+12345", ZINT_ERROR_TOO_LONG, -1 },
/* 42*/ { "9791234567896+123456", ZINT_ERROR_TOO_LONG, -1 },
};
int data_size = sizeof(data) / sizeof(struct item);
@ -194,11 +197,11 @@ static void test_isbn(int index, int debug) {
int length = strlen(data[i].data);
ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d, errtxt %s\n", i, ret, data[i].ret_encode, symbol->errtxt);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
if (data[i].ret_vector != -1) {
ret = ZBarcode_Buffer_Vector(symbol, 0);
assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d\n", i, ret, data[i].ret_vector);
assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d (%s)\n", i, ret, data[i].ret_vector, symbol->errtxt);
}
ZBarcode_Delete(symbol);
@ -242,10 +245,10 @@ static void test_vector_same(int index, int debug) {
int length = strlen(data[i].data);
ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret_encode);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d\n", i, ret, data[i].ret_vector);
assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d (%s)\n", i, ret, data[i].ret_vector, symbol->errtxt);
assert_nonnull(symbol->vector, "i:%d symbol->vector NULL\n", i);
vectors[j] = testUtilVectorCpy(symbol->vector);
@ -268,13 +271,18 @@ static void test_vector_same(int index, int debug) {
testFinish();
}
// https://www.isbn-international.org/content/isbn-users-manual ISBN Users' Manual
// https://bisg.org/page/BarcodingGuidelines BISG Barcode Guidelines for the US Book Industry (BISG BGUSBI)
static void test_encode(int index, int generate, int debug) {
testStart("");
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise
int ret;
struct item {
int symbology;
int option_2;
unsigned char *data;
int ret;
@ -284,15 +292,120 @@ static void test_encode(int index, int generate, int debug) {
char *expected;
};
struct item data[] = {
/* 0*/ { BARCODE_UPCA, "1234567890", 0, 1, 95, "GS1 General Specifications 20.0 Figure 5.1-1 left",
/* 0*/ { BARCODE_UPCA, -1, "01234567890", 0, 1, 95, "GGS Figure 5.1-1 UPC-A (also Figure 5.2.2.3-1., 5.2.6.6-2., 6.4.9-1. and BS EN 797:1996 Figure 3)",
"10100011010011001001001101111010100011011000101010101000010001001001000111010011100101001110101"
},
/* 1*/ { BARCODE_EANX, "4512345678906", 0, 1, 95, "GS1 General Specifications 20.0 Figure 5.1-1 right",
/* 1*/ { BARCODE_EANX, -1, "4512345678906", 0, 1, 95, "GGS Figure 5.1-1 EAN-13",
"10101100010110011001001101111010011101011100101010101000010001001001000111010011100101010000101"
},
/* 2*/ { BARCODE_EANX_CHK, -1, "9501101531000", 0, 1, 95, "GGS Figure 5.2.2.1-2. EAN-13 (also Figure 6.5.2.2-1., 6.5.3.2-1., 6.5.3.2-2., 6.5.6.4-1.)",
"10101100010100111011001100110010100111001100101010100111010000101100110111001011100101110010101"
},
/* 3*/ { BARCODE_EANX, -1, "9501234", 0, 1, 67, "GGS Figure 5.2.2.2-1. EAN-8",
"1010001011011000100011010011001010101101100100001010111001010000101"
},
/* 4*/ { BARCODE_UPCE, -1, "0012345", 0, 1, 51, "GGS Figure 5.2.2.4-1. UPC-E (also BS EN 797:1996 Figure 4)",
"101010011100110010011011011110100111010110001010101"
},
/* 5*/ { BARCODE_EANX, -1, "9771384524017+12", 0, 1, 122, "GGS Figure 5.2.2.5.1-2. EAN-13 barcode with two-digit add-on",
"10101110110010001011001101111010001001010001101010100111011011001011100111001011001101000100101000000010110011001010010011"
},
/* 6*/ { BARCODE_EANX, -1, "9780877799306+54321", 0, 1, 149, "GGS Figure 5.2.2.5.2-2. EAN-13 barcode with five-digit add-on",
"10101110110001001010011101101110010001011101101010100010011101001110100100001011100101010000101000000010110111001010100011010100001010010011010011001"
},
/* 7*/ { BARCODE_EANX, -1, "501234567890", 0, 1, 95, "GGS Figure 5.2.6.6-1. EAN-13 (also BS EN 797:1996 Figure 1)",
"10100011010110011001101101111010100011011100101010101000010001001001000111010011100101110010101"
},
/* 8*/ { BARCODE_EANX, -1, "2012345", 0, 1, 67, "GGS Figure 5.2.6.6-3. EAN-8",
"1010010011000110100110010010011010101000010101110010011101100110101"
},
/* 9*/ { BARCODE_UPCE_CHK, -1, "00783491", 0, 1, 51, "GGS Figure 5.2.6.6-4. UPC-E",
"101010011100100010110111010000101000110001011010101"
},
/* 10*/ { BARCODE_UPCA, -1, "01234567890+24", 0, 1, 124, "GGS Figure 5.2.6.6-5. UPC-A barcode with two-digit add-on",
"1010001101001100100100110111101010001101100010101010100001000100100100011101001110010100111010100000000010110010011010100011"
},
/* 11*/ { BARCODE_EANX, -1, "1234567891019+45678", 0, 1, 149, "GGS Figure 5.2.6.6-6. EAN-13 barcode with five-digit add-on",
"10100100110111101001110101100010000101001000101010100100011101001100110111001011001101110100101000000010110011101010110001010101111010010001010110111"
},
/* 12*/ { BARCODE_EANX, -1, "5024425377399", 0, 1, 95, "GGS Figure 5.10.5.12-1. EAN-13",
"10100011010011011001110101000110010011011100101010100001010001001000100100001011101001110100101"
},
/* 13*/ { BARCODE_UPCA_CHK, -1, "614141000302", 0, 1, 95, "GGS Figure 5.10.6.3-1. UPC-A",
"10101011110011001010001100110010100011001100101010111001011100101110010100001011100101101100101"
},
/* 14*/ { BARCODE_UPCA, -1, "61414123440", 0, 1, 95, "GGS Figure 6.4.17-2. UPC-A Daisy 5pc Set",
"10101011110011001010001100110010100011001100101010110110010000101011100101110011100101110010101"
},
/* 15*/ { BARCODE_EANX, -1, "5410038302178", 0, 1, 95, "GGS Figure 6.5.5.3-1. EAN-13",
"10101000110110011010011100011010111101000100101010100001011100101101100110011010001001001000101"
},
/* 16*/ { BARCODE_EANX, -1, "501234567890+12", 0, 1, 122, "BS EN 797:1996 Figure 5 EAN-13 with 2-digit add-on",
"10100011010110011001101101111010100011011100101010101000010001001001000111010011100101110010101000000010110011001010010011"
},
/* 17*/ { BARCODE_EANX, -1, "501234567890+86104", 0, 1, 149, "BS EN 797:1996 Figure 6 EAN-13 with 5-digit add-on",
"10100011010110011001101101111010100011011100101010101000010001001001000111010011100101110010101000000010110001001010101111010011001010001101010011101"
},
/* 18*/ { BARCODE_UPCA_CHK, -1, "614141234417+12345", 0, 1, 151, "Example of UPC-A with 5-digit add-on",
"1010101111001100101000110011001010001100110010101011011001000010101110010111001100110100010010100000000010110110011010010011010100001010100011010110001"
},
/* 19*/ { BARCODE_UPCE, -1, "1234567+12", 0, 1, 78, "Example of UPC-E with 2-digit add-on",
"101001001101111010100011011100100001010010001010101000000010110011001010010011"
},
/* 20*/ { BARCODE_UPCE_CHK, -1, "12345670+12345", 0, 1, 105, "Example of UPC-E with 5-digit add-on",
"101001001101111010100011011100100001010010001010101000000010110110011010010011010100001010100011010110001"
},
/* 21*/ { BARCODE_EANX, -1, "1234567+12", 0, 1, 94, "Example of EAN-8 with 2-digit add-on",
"1010011001001001101111010100011010101001110101000010001001110010101000000010110011001010010011"
},
/* 22*/ { BARCODE_EANX_CHK, -1, "12345670+12345", 0, 1, 121, "Example of EAN-8 with 5-digit add-on",
"1010011001001001101111010100011010101001110101000010001001110010101000000010110110011010010011010100001010100011010110001"
},
/* 23*/ { BARCODE_EANX, -1, "54321", 0, 1, 47, "Example of EAN-5",
"10110111001010100011010100001010010011010011001"
},
/* 24*/ { BARCODE_EANX, -1, "21", 0, 1, 20, "Example of EAN-2",
"10110010011010110011"
},
/* 25*/ { BARCODE_EANX_CHK, 9, "76543210+21", 0, 1, 96, "Example of EAN-8 barcode with two-digit add-on, addon_gap 9",
"101011101101011110110001010001101010100001011011001100110111001010100000000010110010011010110011"
},
/* 26*/ { BARCODE_EANX, 12, "7654321+54321", 0, 1, 126, "Example of EAN-8 barcode with five-digit add-on, addon_gap 12",
"101011101101011110110001010001101010100001011011001100110111001010100000000000010110111001010100011010100001010010011010011001"
},
/* 27*/ { BARCODE_UPCA_CHK, 10, "210987654329+21", 0, 1, 125, "Example of UPC-A with 2-digit add-on, addon_gap 10",
"10100100110011001000110100010110110111011101101010101000010011101011100100001011011001110100101000000000010110010011010110011"
},
/* 28*/ { BARCODE_UPCA, 12, "21098765432+12121", 0, 1, 154, "Example of UPC-A with 5-digit add-on, addon_gap 12",
"1010010011001100100011010001011011011101110110101010100001001110101110010000101101100111010010100000000000010110011001010010011010110011010011011010011001"
},
/* 29*/ { BARCODE_UPCE_CHK, 8, "06543217+21", 0, 1, 79, "Example of UPC-A with 2-digit add-on, addon_gap 8",
"1010000101011000100111010111101001101100110010101010000000010110010011010110011"
},
/* 30*/ { BARCODE_UPCE, 11, "1654321+12121", 0, 1, 109, "Example of UPC-A with 5-digit add-on, addon_gap 11",
"1010101111011100101000110111101001101101100110101010000000000010110011001010010011010110011010011011010011001"
},
/* 31*/ { BARCODE_ISBNX, -1, "9789295055124", 0, 1, 95, "ISBN Users' Manual 7th Ed. 13.2",
"10101110110001001001011100100110010111011000101010111001010011101001110110011011011001011100101"
},
/* 32*/ { BARCODE_ISBNX, -1, "9780123456786+50995", 0, 1, 149, "BISG BGUSBI Figure 1: Bookland EAN (with Price Add-On) (and Figures 4, 5, 6)",
"10101110110001001010011100110010011011011110101010101110010011101010000100010010010001010000101000000010110110001010100111010001011010001011010111001"
},
/* 33*/ { BARCODE_ISBNX, -1, "9781402894626+50495", 0, 1, 149, "BISG BGUSBI Figure 2",
"10101110110001001011001101000110100111001001101010100100011101001011100101000011011001010000101000000010110111001010001101010100011010001011010111001"
},
/* 34*/ { BARCODE_ISBNX, 10, "9780940016644+50750", 0, 1, 152, "BISG BGUSBI Figure 3, addon_gap 10",
"10101110110001001010011100010110011101000110101010111001011001101010000101000010111001011100101000000000010110111001010001101010010001010110001010001101"
},
/* 35*/ { BARCODE_ISBNX, -1, "9791234567896+12", 0, 1, 122, "Example of ISBN with 2-digit add-on",
"10101110110010111011001100100110100001010001101010100111010100001000100100100011101001010000101000000010110011001010010011"
},
};
int data_size = ARRAY_SIZE(data);
char bwipp_buf[4096];
char bwipp_msg[1024];
for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
@ -300,14 +413,14 @@ static void test_encode(int index, int generate, int debug) {
struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (generate) {
printf(" /*%3d*/ { %s, \"%s\", %s, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), data[i].data, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), data[i].option_2, data[i].data, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
testUtilModulesDump(symbol, " ", "\n");
printf(" },\n");
} else {
@ -320,6 +433,15 @@ static void test_encode(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
}
if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, data[i].option_2, -1, debug)) {
ret = testUtilBwipp(symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
}
}
}

View file

@ -138,119 +138,130 @@ static void test_buffer_vector(int index, int generate, int debug) {
float expected_vector_height;
};
struct item data[] = {
/* 0*/ { BARCODE_CODE11, "0000000000", "", 50, 1, 99, 198.0, 118.0 },
/* 1*/ { BARCODE_C25MATRIX, "0000000000", "", 50, 1, 117, 234.0, 118.0 },
/* 2*/ { BARCODE_C25INTER, "0000000000", "", 50, 1, 99, 198.0, 118.0 },
/* 3*/ { BARCODE_C25IATA, "0000000000", "", 50, 1, 149, 298.0, 118.0 },
/* 4*/ { BARCODE_C25LOGIC, "0000000000", "", 50, 1, 109, 218.0, 118.0 },
/* 5*/ { BARCODE_C25IND, "0000000000", "", 50, 1, 159, 318.0, 118.0 },
/* 6*/ { BARCODE_CODE39, "0000000000", "", 50, 1, 155, 310.0, 118.0 },
/* 7*/ { BARCODE_EXCODE39, "0000000000", "", 50, 1, 155, 310.0, 118.0 },
/* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 230.0, 118.0 },
/* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 230.0, 118.0 },
/* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 124, 288.0, 118.0 },
/* 11*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 151, 342.0, 118.0 },
/* 12*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 134.0, 118.0 },
/* 13*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 96, 192.0, 118.0 },
/* 14*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 123, 246.0, 118.0 },
/* 15*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 94.0, 118.0 },
/* 16*/ { BARCODE_EANX, "12", "", 50, 1, 20, 40.0, 118.0 },
/* 17*/ { BARCODE_EAN128, "[01]12345678901234", "", 50, 1, 134, 268.0, 118.0 },
/* 18*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204.0, 118.0 },
/* 19*/ { BARCODE_CODE128, "0000000000", "", 50, 1, 90, 180.0, 118.0 },
/* 20*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270.0, 118.0 },
/* 21*/ { BARCODE_DPIDENT, "12345678901", "", 50, 1, 117, 234.0, 118.0 },
/* 22*/ { BARCODE_CODE16K, "0000000000", "", 20, 2, 70, 162.0, 44.0 },
/* 23*/ { BARCODE_CODE49, "0000000000", "", 20, 2, 70, 162.0, 44.0 },
/* 24*/ { BARCODE_CODE93, "0000000000", "", 50, 1, 127, 254.0, 118.0 },
/* 25*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180.0, 100.0 },
/* 26*/ { BARCODE_RSS14, "1234567890123", "", 50, 1, 96, 192.0, 118.0 },
/* 27*/ { BARCODE_RSS_LTD, "1234567890123", "", 50, 1, 74, 148.0, 118.0 },
/* 28*/ { BARCODE_RSS_EXP, "[01]12345678901234", "", 34, 1, 134, 268.0, 86.0 },
/* 29*/ { BARCODE_TELEPEN, "0000000000", "", 50, 1, 208, 416.0, 118.0 },
/* 30*/ { BARCODE_UPCA, "12345678904", "", 50, 1, 95, 230.0, 118.0 },
/* 31*/ { BARCODE_UPCA_CHK, "12345678905", "", 50, 1, 95, 230.0, 118.0 },
/* 32*/ { BARCODE_UPCA, "12345678904+12", "", 50, 1, 124, 288.0, 118.0 },
/* 33*/ { BARCODE_UPCA, "12345678904+12345", "", 50, 1, 151, 342.0, 118.0 },
/* 34*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 142.0, 118.0 },
/* 35*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 142.0, 118.0 },
/* 36*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 80, 200.0, 118.0 },
/* 37*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 107, 254.0, 118.0 },
/* 38*/ { BARCODE_POSTNET, "00000000000", "", 12, 2, 185, 370.0, 24.0 },
/* 39*/ { BARCODE_MSI_PLESSEY, "0000000000", "", 50, 1, 127, 254.0, 118.0 },
/* 40*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34.0, 100.0 },
/* 41*/ { BARCODE_LOGMARS, "0000000000", "", 50, 1, 191, 382.0, 118.0 },
/* 42*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116.0, 100.0 },
/* 43*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284.0, 118.0 },
/* 44*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58.0, 20.0 },
/* 45*/ { BARCODE_PDF417, "0000000000", "", 21, 7, 103, 206.0, 42.0 },
/* 46*/ { BARCODE_PDF417TRUNC, "0000000000", "", 21, 7, 68, 136.0, 42.0 },
/* 47*/ { BARCODE_MAXICODE, "0000000000", "", 165, 33, 30, 74.0, 72.0 },
/* 48*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42.0, 42.0 },
/* 49*/ { BARCODE_CODE128B, "0000000000", "", 50, 1, 145, 290.0, 118.0 },
/* 50*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266.0, 16.0 },
/* 51*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146.0, 16.0 },
/* 52*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146.0, 16.0 },
/* 53*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146.0, 16.0 },
/* 54*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 230.0, 118.0 },
/* 55*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 124, 288.0, 118.0 },
/* 56*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 151, 342.0, 118.0 },
/* 57*/ { BARCODE_RM4SCC, "0000000000", "", 8, 3, 91, 182.0, 16.0 },
/* 58*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20.0, 20.0 },
/* 59*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268.0, 118.0 },
/* 60*/ { BARCODE_VIN, "00000000000000000", "", 50, 1, 246, 492.0, 118.0 },
/* 61*/ { BARCODE_CODABLOCKF, "0000000000", "", 20, 2, 101, 242.0, 44.0 },
/* 62*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312.0, 118.0 },
/* 63*/ { BARCODE_JAPANPOST, "0000000000", "", 8, 3, 133, 266.0, 16.0 },
/* 64*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334.0, 118.0 },
/* 65*/ { BARCODE_RSS14STACK, "0000000000000", "", 13, 3, 50, 100.0, 26.0 },
/* 66*/ { BARCODE_RSS14STACK_OMNI, "0000000000000", "", 69, 5, 50, 100.0, 138.0 },
/* 67*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", "", 71, 5, 102, 204.0, 142.0 },
/* 68*/ { BARCODE_PLANET, "00000000000", "", 12, 2, 185, 370.0, 24.0 },
/* 69*/ { BARCODE_MICROPDF417, "0000000000", "", 12, 6, 82, 164.0, 24.0 },
/* 70*/ { BARCODE_ONECODE, "12345678901234567890", "", 8, 3, 129, 258.0, 16.0 },
/* 71*/ { BARCODE_PLESSEY, "0000000000", "", 50, 1, 227, 454.0, 118.0 },
/* 72*/ { BARCODE_TELEPEN_NUM, "0000000000", "", 50, 1, 128, 256.0, 118.0 },
/* 73*/ { BARCODE_ITF14, "0000000000", "", 50, 1, 135, 382.0, 150.0 },
/* 74*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174.0, 16.0 },
/* 75*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30.0, 30.0 },
/* 76*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62.0, 16.0 },
/* 77*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22.0, 22.0 },
/* 78*/ { BARCODE_HIBC_128, "0000000000", "", 50, 1, 134, 268.0, 118.0 },
/* 79*/ { BARCODE_HIBC_39, "0000000000", "", 50, 1, 223, 446.0, 118.0 },
/* 80*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24.0, 24.0 },
/* 81*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42.0, 42.0 },
/* 82*/ { BARCODE_HIBC_PDF, "0000000000", "", 27, 9, 103, 206.0, 54.0 },
/* 83*/ { BARCODE_HIBC_MICPDF, "0000000000", "", 34, 17, 38, 76.0, 68.0 },
/* 84*/ { BARCODE_HIBC_BLOCKF, "0000000000", "", 30, 3, 101, 242.0, 64.0 },
/* 85*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38.0, 38.0 },
/* 86*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 32.0, 22.0 },
/* 87*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46.0, 46.0 },
/* 88*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310.0, 20.0 },
/* 89*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22.0, 22.0 },
/* 90*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206.0, 118.0 },
/* 91*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 238.0, 118.0 },
/* 92*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 128, 296.0, 118.0 },
/* 93*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 155, 350.0, 118.0 },
/* 94*/ { BARCODE_EAN128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290.0, 118.0 },
/* 95*/ { BARCODE_RSS14_CC, "1234567890123", "[20]01", 21, 5, 100, 200.0, 60.0 },
/* 96*/ { BARCODE_RSS_LTD_CC, "1234567890123", "[20]01", 19, 6, 74, 148.0, 56.0 },
/* 97*/ { BARCODE_RSS_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268.0, 100.0 },
/* 98*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 238.0, 118.0 },
/* 99*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 296.0, 118.0 },
/*100*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 350.0, 118.0 },
/*101*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 150.0, 118.0 },
/*102*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 84, 208.0, 118.0 },
/*103*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 111, 262.0, 118.0 },
/*104*/ { BARCODE_RSS14STACK_CC, "0000000000000", "[20]01", 24, 9, 56, 112.0, 48.0 },
/*105*/ { BARCODE_RSS14_OMNI_CC, "0000000000000", "[20]01", 80, 11, 56, 112.0, 160.0 },
/*106*/ { BARCODE_RSS_EXPSTACK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204.0, 156.0 },
/*107*/ { BARCODE_CHANNEL, "00", "", 50, 1, 19, 38.0, 118.0 },
/*108*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44.0, 44.0 },
/*109*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36.0, 36.0 },
/*110*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154.0, 154.0 },
/*111*/ { BARCODE_ULTRA, "0000000000", "", 13, 13, 18, 36.0, 26.0 },
/*112*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54.0, 22.0 },
/* 0*/ { BARCODE_CODE11, "0000000000", "", 50, 1, 99, 198, 118 },
/* 1*/ { BARCODE_C25MATRIX, "0000000000", "", 50, 1, 117, 234, 118 },
/* 2*/ { BARCODE_C25INTER, "0000000000", "", 50, 1, 99, 198, 118 },
/* 3*/ { BARCODE_C25IATA, "0000000000", "", 50, 1, 149, 298, 118 },
/* 4*/ { BARCODE_C25LOGIC, "0000000000", "", 50, 1, 109, 218, 118 },
/* 5*/ { BARCODE_C25IND, "0000000000", "", 50, 1, 159, 318, 118 },
/* 6*/ { BARCODE_CODE39, "0000000000", "", 50, 1, 155, 310, 118 },
/* 7*/ { BARCODE_EXCODE39, "0000000000", "", 50, 1, 155, 310, 118 },
/* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 226, 118 },
/* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 226, 118 },
/* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 122, 276, 118 },
/* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 50, 1, 122, 276, 118 },
/* 12*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 149, 330, 118 },
/* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 50, 1, 149, 330, 118 },
/* 14*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 162, 118 },
/* 15*/ { BARCODE_EANX_CHK, "12345670", "", 50, 1, 67, 162, 118 },
/* 16*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 94, 216, 118 },
/* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", 50, 1, 94, 216, 118 },
/* 18*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 121, 270, 118 },
/* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", 50, 1, 121, 270, 118 },
/* 20*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 118, 118 },
/* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 118 },
/* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 118 },
/* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 118 },
/* 24*/ { BARCODE_EAN128, "[01]12345678901234", "", 50, 1, 134, 268, 118 },
/* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 118 },
/* 26*/ { BARCODE_CODE128, "0000000000", "", 50, 1, 90, 180, 118 },
/* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 118 },
/* 28*/ { BARCODE_DPIDENT, "12345678901", "", 50, 1, 117, 234, 118 },
/* 29*/ { BARCODE_CODE16K, "0000000000", "", 20, 2, 70, 162, 44 },
/* 30*/ { BARCODE_CODE49, "0000000000", "", 20, 2, 70, 162, 44 },
/* 31*/ { BARCODE_CODE93, "0000000000", "", 50, 1, 127, 254, 118 },
/* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
/* 33*/ { BARCODE_RSS14, "1234567890123", "", 50, 1, 96, 192, 118 },
/* 34*/ { BARCODE_RSS_LTD, "1234567890123", "", 50, 1, 74, 148, 118 },
/* 35*/ { BARCODE_RSS_EXP, "[01]12345678901234", "", 34, 1, 134, 268, 86 },
/* 36*/ { BARCODE_TELEPEN, "0000000000", "", 50, 1, 208, 416, 118 },
/* 37*/ { BARCODE_UPCA, "12345678904", "", 50, 1, 95, 226, 118 },
/* 38*/ { BARCODE_UPCA_CHK, "123456789043", "", 50, 1, 95, 226, 118 },
/* 39*/ { BARCODE_UPCA, "12345678904+12", "", 50, 1, 124, 276, 118 },
/* 40*/ { BARCODE_UPCA_CHK, "123456789043+12", "", 50, 1, 124, 276, 118 },
/* 41*/ { BARCODE_UPCA, "12345678904+12345", "", 50, 1, 151, 330, 118 },
/* 42*/ { BARCODE_UPCA_CHK, "123456789043+12345", "", 50, 1, 151, 330, 118 },
/* 43*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 134, 118 },
/* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 134, 118 },
/* 45*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 78, 184, 118 },
/* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 50, 1, 78, 184, 118 },
/* 47*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 105, 238, 118 },
/* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 50, 1, 105, 238, 118 },
/* 49*/ { BARCODE_POSTNET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 50*/ { BARCODE_MSI_PLESSEY, "0000000000", "", 50, 1, 127, 254, 118 },
/* 51*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34, 100 },
/* 52*/ { BARCODE_LOGMARS, "0000000000", "", 50, 1, 191, 382, 118 },
/* 53*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116, 100 },
/* 54*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284, 118 },
/* 55*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58, 20 },
/* 56*/ { BARCODE_PDF417, "0000000000", "", 21, 7, 103, 206, 42 },
/* 57*/ { BARCODE_PDF417TRUNC, "0000000000", "", 21, 7, 68, 136, 42 },
/* 58*/ { BARCODE_MAXICODE, "0000000000", "", 165, 33, 30, 74, 72 }, // Differs from raster
/* 59*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 60*/ { BARCODE_CODE128B, "0000000000", "", 50, 1, 145, 290, 118 },
/* 61*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266, 16 },
/* 62*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146, 16 },
/* 63*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146, 16 },
/* 64*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146, 16 },
/* 65*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 226, 118 },
/* 66*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 122, 276, 118 },
/* 67*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 149, 330, 118 },
/* 68*/ { BARCODE_RM4SCC, "0000000000", "", 8, 3, 91, 182, 16 },
/* 69*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20, 20 },
/* 70*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268, 118 },
/* 71*/ { BARCODE_VIN, "00000000000000000", "", 50, 1, 246, 492, 118 },
/* 72*/ { BARCODE_CODABLOCKF, "0000000000", "", 20, 2, 101, 242, 44 },
/* 73*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312, 118 },
/* 74*/ { BARCODE_JAPANPOST, "0000000000", "", 8, 3, 133, 266, 16 },
/* 75*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 118 },
/* 76*/ { BARCODE_RSS14STACK, "0000000000000", "", 13, 3, 50, 100, 26 },
/* 77*/ { BARCODE_RSS14STACK_OMNI, "0000000000000", "", 69, 5, 50, 100, 138 },
/* 78*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", "", 71, 5, 102, 204, 142 },
/* 79*/ { BARCODE_PLANET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 80*/ { BARCODE_MICROPDF417, "0000000000", "", 12, 6, 82, 164, 24 },
/* 81*/ { BARCODE_ONECODE, "12345678901234567890", "", 8, 3, 129, 258, 16 },
/* 82*/ { BARCODE_PLESSEY, "0000000000", "", 50, 1, 227, 454, 118 },
/* 83*/ { BARCODE_TELEPEN_NUM, "0000000000", "", 50, 1, 128, 256, 118 },
/* 84*/ { BARCODE_ITF14, "0000000000", "", 50, 1, 135, 330, 138 },
/* 85*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 },
/* 86*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 },
/* 87*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
/* 88*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 },
/* 89*/ { BARCODE_HIBC_128, "0000000000", "", 50, 1, 134, 268, 118 },
/* 90*/ { BARCODE_HIBC_39, "0000000000", "", 50, 1, 223, 446, 118 },
/* 91*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 },
/* 92*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 93*/ { BARCODE_HIBC_PDF, "0000000000", "", 27, 9, 103, 206, 54 },
/* 94*/ { BARCODE_HIBC_MICPDF, "0000000000", "", 34, 17, 38, 76, 68 },
/* 95*/ { BARCODE_HIBC_BLOCKF, "0000000000", "", 30, 3, 101, 242, 64 },
/* 96*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 },
/* 97*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 32, 22 }, // Differs from raster
/* 98*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 },
/* 99*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
/*100*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 },
/*101*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 118 },
/*102*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 234, 118 },
/*103*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 126, 284, 118 },
/*104*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 153, 338, 118 },
/*105*/ { BARCODE_EAN128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290, 118 },
/*106*/ { BARCODE_RSS14_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60 },
/*107*/ { BARCODE_RSS_LTD_CC, "1234567890123", "[20]01", 19, 6, 74, 148, 56 },
/*108*/ { BARCODE_RSS_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268, 100 },
/*109*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 118 },
/*110*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 118 },
/*111*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 118 },
/*112*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 142, 118 },
/*113*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 82, 192, 118 },
/*114*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 118 },
/*115*/ { BARCODE_RSS14STACK_CC, "0000000000000", "[20]01", 24, 9, 56, 112, 48 },
/*116*/ { BARCODE_RSS14_OMNI_CC, "0000000000000", "[20]01", 80, 11, 56, 112, 160 },
/*117*/ { BARCODE_RSS_EXPSTACK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204, 156 },
/*118*/ { BARCODE_CHANNEL, "00", "", 50, 1, 19, 38, 118 },
/*119*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
/*120*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
/*121*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
/*122*/ { BARCODE_ULTRA, "0000000000", "", 13, 13, 18, 36, 26 },
/*123*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 },
};
int data_size = sizeof(data) / sizeof(struct item);
@ -323,34 +334,46 @@ static void test_upcean_hrt(int index, int debug) {
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 230.0, 118.0, 10, -1 }, // EAN-13
/* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 230.0, 118.0, 8, -1 }, // EAN-13
/* 1*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 230.0, 118.0, -1, -1 }, // EAN-13
/* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 230.0, 118.0, 10, -1 }, // EAN-13
/* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 230.0, 118.0, 8, -1 }, // EAN-13
/* 3*/ { BARCODE_EANX_CHK, 0, "1234567890128", 0, 50, 1, 95, 230.0, 118.0, -1, -1 }, // EAN-13
/* 4*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 124, 288.0, 118.0, 10, 70 }, // EAN-13 + EAN-2
/* 5*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 124, 288.0, 118.0, -1, -1 }, // EAN-13 + EAN-2
/* 6*/ { BARCODE_EANX, -1, "123456789012+12345", 0, 50, 1, 151, 342.0, 118.0, 10, 70 }, // EAN-13 + EAN-5
/* 7*/ { BARCODE_EANX, 0, "123456789012+12345", 0, 50, 1, 151, 342.0, 118.0, -1, -1 }, // EAN-13 + EAN-5
/* 8*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 151, 342.0, 118.0, 10, 70 }, // ISBNX + EAN-5
/* 9*/ { BARCODE_ISBNX, 0, "9784567890120+12345", 0, 50, 1, 151, 342.0, 118.0, -1, -1 }, // ISBNX + EAN-5
/* 10*/ { BARCODE_EANX, -1, "1234567", 0, 50, 1, 67, 134.0, 118.0, 34, -1 }, // EAN-8
/* 11*/ { BARCODE_EANX, 0, "1234567", 0, 50, 1, 67, 134.0, 118.0, -1, -1 }, // EAN-8
/* 12*/ { BARCODE_EANX, -1, "1234567+12", 0, 50, 1, 96, 192.0, 118.0, 34, 100 }, // EAN-8 + EAN-2
/* 13*/ { BARCODE_EANX, 0, "1234567+12", 0, 50, 1, 96, 192.0, 118.0, -1, -1 }, // EAN-8 + EAN-2
/* 14*/ { BARCODE_EANX, -1, "1234567+12345", 0, 50, 1, 123, 246.0, 118.0, 34, 100 }, // EAN-8 + EAN-5
/* 15*/ { BARCODE_EANX, 0, "1234567+12345", 0, 50, 1, 123, 246.0, 118.0, -1, -1 }, // EAN-8 + EAN-5
/* 16*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 230.0, 118.0, 10, -1 },
/* 17*/ { BARCODE_UPCA, 0, "12345678901", 0, 50, 1, 95, 230.0, 118.0, -1, -1 },
/* 18*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 288.0, 118.0, 10, 74 },
/* 19*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 288.0, 118.0, -1, -1 },
/* 20*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", 0, 50, 1, 151, 342.0, 118.0, 10, 74 },
/* 21*/ { BARCODE_UPCA_CHK, 0, "123456789012+12345", 0, 50, 1, 151, 342.0, 118.0, -1, -1 },
/* 22*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 142.0, 118.0, 10, -1 },
/* 23*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 142.0, 118.0, -1, -1 },
/* 24*/ { BARCODE_UPCE_CHK, -1, "12345670+12", 0, 50, 1, 80, 200.0, 118.0, 10, 68 },
/* 25*/ { BARCODE_UPCE_CHK, 0, "12345670+12", 0, 50, 1, 80, 200.0, 118.0, -1, -1 },
/* 26*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 107, 254.0, 118.0, 10, 68 },
/* 27*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 107, 254.0, 118.0, -1, -1 },
/* 4*/ { BARCODE_ISBNX, -1, "9784567890120", 0, 50, 1, 95, 230.0, 118.0, 8, -1 },
/* 5*/ { BARCODE_ISBNX, 0, "9784567890120", 0, 50, 1, 95, 230.0, 118.0, -1, -1 },
/* 6*/ { BARCODE_EANX, -1, "1234567", 0, 50, 1, 67, 134.0, 118.0, 48, -1 }, // EAN-8
/* 7*/ { BARCODE_EANX, 0, "1234567", 0, 50, 1, 67, 134.0, 118.0, -1, -1 }, // EAN-8
/* 8*/ { BARCODE_EANX, -1, "1234", 0, 50, 1, 47, 94.0, 118.0, 61, -1 }, // EAN-5
/* 9*/ { BARCODE_EANX, 0, "1234", 0, 50, 1, 47, 94.0, 118.0, -1, -1 }, // EAN-5
/* 10*/ { BARCODE_EANX, -1, "12", 0, 50, 1, 20, 40.0, 118.0, 34, -1 }, // EAN-2
/* 11*/ { BARCODE_EANX, 0, "12", 0, 50, 1, 20, 40.0, 118.0, -1, -1 }, // EAN-2
/* 12*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 230.0, 118.0, 8, -1 },
/* 13*/ { BARCODE_UPCA, 0, "12345678901", 0, 50, 1, 95, 230.0, 118.0, -1, -1 },
/* 14*/ { BARCODE_UPCA_CHK, -1, "123456789012", 0, 50, 1, 95, 230.0, 118.0, 8, -1 },
/* 15*/ { BARCODE_UPCA_CHK, 0, "123456789012", 0, 50, 1, 95, 230.0, 118.0, -1, -1 },
/* 16*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 142.0, 118.0, 8, -1 },
/* 17*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 142.0, 118.0, -1, -1 },
/* 18*/ { BARCODE_UPCE_CHK, -1, "12345670", 0, 50, 1, 51, 142.0, 118.0, 8, -1 },
/* 19*/ { BARCODE_UPCE_CHK, 0, "12345670", 0, 50, 1, 51, 142.0, 118.0, -1, -1 },
/* 20*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276.0, 118.0, 8, 70 }, // EAN-13 + EAN-2
/* 21*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 122, 276.0, 118.0, -1, -1 }, // EAN-13 + EAN-2
/* 22*/ { BARCODE_ISBNX, -1, "9784567890120+12", 0, 50, 1, 122, 276.0, 118.0, 8, 70 }, // ISBN + EAN-2
/* 23*/ { BARCODE_ISBNX, 0, "9784567890120+12", 0, 50, 1, 122, 276.0, 118.0, -1, -1 }, // ISBN + EAN-2
/* 24*/ { BARCODE_EANX, -1, "123456789012+12345", 0, 50, 1, 149, 330.0, 118.0, 8, 70 }, // EAN-13 + EAN-5
/* 25*/ { BARCODE_EANX, 0, "123456789012+12345", 0, 50, 1, 149, 330.0, 118.0, -1, -1 }, // EAN-13 + EAN-5
/* 26*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 149, 330.0, 118.0, 8, 70 }, // ISBN + EAN-5
/* 27*/ { BARCODE_ISBNX, 0, "9784567890120+12345", 0, 50, 1, 149, 330.0, 118.0, -1, -1 }, // ISBN + EAN-5
/* 28*/ { BARCODE_EANX, -1, "1234567+12", 0, 50, 1, 94, 216.0, 118.0, 48, 114 }, // EAN-8 + EAN-2
/* 29*/ { BARCODE_EANX, 0, "1234567+12", 0, 50, 1, 94, 216.0, 118.0, -1, -1 }, // EAN-8 + EAN-2
/* 30*/ { BARCODE_EANX, -1, "1234567+12345", 0, 50, 1, 121, 270.0, 118.0, 48, 114 }, // EAN-8 + EAN-5
/* 31*/ { BARCODE_EANX, 0, "1234567+12345", 0, 50, 1, 121, 270.0, 118.0, -1, -1 }, // EAN-8 + EAN-5
/* 32*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 288.0, 118.0, 8, 72 },
/* 33*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 288.0, 118.0, -1, -1 },
/* 34*/ { BARCODE_UPCA, -1, "12345678901+12345", 0, 50, 1, 151, 342.0, 118.0, 8, 72 },
/* 35*/ { BARCODE_UPCA, 0, "12345678901+12345", 0, 50, 1, 151, 342.0, 118.0, -1, -1 },
/* 36*/ { BARCODE_UPCE, -1, "1234567+12", 0, 50, 1, 78, 184.0, 118.0, 8, 66 },
/* 37*/ { BARCODE_UPCE, 0, "1234567+12", 0, 50, 1, 78, 184.0, 118.0, -1, -1 },
/* 38*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238.0, 118.0, 8, 66 },
/* 39*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238.0, 118.0, -1, -1 },
};
int data_size = sizeof(data) / sizeof(struct item);
@ -647,10 +670,10 @@ static void test_upcean_whitespace_width(int index, int debug) {
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_UPCA, "12345678904+12345", 0, 151, 342.0, 5, 16.0 },
/* 1*/ { BARCODE_UPCA, "12345678904+12345", 11, 151, 342.0 + 4 * (11 - 10), 5, 16.0 },
/* 2*/ { BARCODE_UPCE, "1234567+12", 0, 80, 200.0, 4, 16.0 },
/* 3*/ { BARCODE_UPCE, "1234567+12", 8, 80, 200.0 + 4 * (8 - 10), 4, 16.0 }, // Note: change from previous behaviour where if whitespace < 10 then set to 10
/* 0*/ { BARCODE_UPCA, "12345678904+12345", 0, 151, 330.0, 5, 16.0 },
/* 1*/ { BARCODE_UPCA, "12345678904+12345", 11, 151, 330.0 + 4 * 11, 5, 16.0 },
/* 2*/ { BARCODE_UPCE, "1234567+12", 0, 78, 184.0, 4, 16.0 },
/* 3*/ { BARCODE_UPCE, "1234567+12", 8, 78, 184.0 + 4 * 8, 4, 16.0 }, // Note: change from previous behaviour where if whitespace < 10 then set to 10
};
int data_size = sizeof(data) / sizeof(struct item);

View file

@ -383,7 +383,7 @@ char *testUtilBarcodeName(int symbology) {
return "";
}
if (data[symbology].val != symbology || (data[symbology].define != -1 && data[symbology].define != symbology)) { // Self-check
fprintf(stderr, "testUtilBarcodeName data table out of sync (%d)\n", symbology);
fprintf(stderr, "testUtilBarcodeName: data table out of sync (%d)\n", symbology);
abort();
}
return data[symbology].name;
@ -443,7 +443,7 @@ char *testUtilErrorName(int error_number) {
return "";
}
if (data[error_number].val != error_number || (data[error_number].define != -1 && data[error_number].define != error_number)) { // Self-check
fprintf(stderr, "testUtilErrorName data table out of sync (%d)\n", error_number);
fprintf(stderr, "testUtilErrorName: data table out of sync (%d)\n", error_number);
abort();
}
return data[error_number].name;
@ -474,7 +474,7 @@ char *testUtilInputModeName(int input_mode) {
return input_mode == -1 ? "-1" : "";
}
if (data[input_mode].val != input_mode || (data[input_mode].define != -1 && data[input_mode].define != input_mode)) { // Self-check
fprintf(stderr, "testUtilInputModeName data table out of sync (%d)\n", input_mode);
fprintf(stderr, "testUtilInputModeName: data table out of sync (%d)\n", input_mode);
abort();
}
return data[input_mode].name;
@ -487,7 +487,11 @@ char *testUtilOption3Name(int option_3) {
case ZINT_FULL_MULTIBYTE: return "ZINT_FULL_MULTIBYTE";
case ULTRA_COMPRESSION: return "ULTRA_COMPRESSION";
}
return "-1";
if (option_3 != -1 && option_3 != 0) {
fprintf(stderr, "testUtilOption3Name: unknown value (%d)\n", option_3);
abort();
}
return option_3 ? "-1" : "0";
}
char *testUtilOutputOptionsName(int output_options) {
@ -523,7 +527,7 @@ char *testUtilOutputOptionsName(int output_options) {
buf[0] = '\0';
for (i = 0; i < data_size; i++) {
if (data[i].define != data[i].val) { // Self-check
fprintf(stderr, "testUtilOutputOptionsName data table out of sync (%d)\n", i);
fprintf(stderr, "testUtilOutputOptionsName: data table out of sync (%d)\n", i);
abort();
}
if (output_options & data[i].define) {
@ -531,9 +535,13 @@ char *testUtilOutputOptionsName(int output_options) {
strcat(buf, " | ");
}
strcat(buf, data[i].name);
set = 1;
set |= data[i].define;
}
}
if (set != output_options) {
fprintf(stderr, "testUtilOutputOptionsName: unknown output option(s) %d (%d)\n", output_options & set, output_options);
abort();
}
return buf;
}
@ -1472,10 +1480,10 @@ static char *testUtilBwippName(int symbology, int option_1, int option_2, int op
{ "", -1, 10, 0, 0, 0, 0, 0, },
{ "", -1, 11, 0, 0, 0, 0, 0, },
{ "", -1, 12, 0, 0, 0, 0, 0, },
{ "ean13", BARCODE_EANX, 13, 0, 0, 0, 0, 0, },
{ "ean13", BARCODE_EANX_CHK, 14, 0, 0, 0, 0, 0, },
{ "ean13", BARCODE_EANX, 13, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "ean13", BARCODE_EANX_CHK, 14, 0, 1, 0, 0, 1, },
{ "", -1, 15, 0, 0, 0, 0, 0, },
{ "gs1-128", BARCODE_EAN128, 16, 0, 0, 0, 0, 1 /*gs1_cnt*/, },
{ "gs1-128", BARCODE_EAN128, 16, 0, 0, 0, 0, 1 /*gs1_cvt*/, },
{ "", -1, 17, 0, 0, 0, 0, 0, },
{ "rationalizedCodabar", BARCODE_CODABAR, 18, 0, 0, 0, 0, 0, },
{ "", -1, 19, 0, 0, 0, 0, 0, },
@ -1493,11 +1501,11 @@ static char *testUtilBwippName(int symbology, int option_1, int option_2, int op
{ "databarexpanded", BARCODE_RSS_EXP, 31, 0, 1, 0, 1 /*linear_row_height*/, 1, },
{ "telepen", BARCODE_TELEPEN, 32, 0, 0, 0, 0, 0, },
{ "", -1, 33, 0, 0, 0, 0, 0, },
{ "upca", BARCODE_UPCA, 34, 0, 0, 0, 0, 0, },
{ "upca", BARCODE_UPCA_CHK, 35, 0, 0, 0, 0, 0, },
{ "upca", BARCODE_UPCA, 34, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "upca", BARCODE_UPCA_CHK, 35, 0, 1, 0, 0, 1, },
{ "", -1, 36, 0, 0, 0, 0, 0, },
{ "upce", BARCODE_UPCE, 37, 0, 0, 0, 0, 0, },
{ "upce", BARCODE_UPCE_CHK, 38, 0, 0, 0, 0, 0, },
{ "upce", BARCODE_UPCE, 37, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "upce", BARCODE_UPCE_CHK, 38, 0, 1, 0, 0, 1, },
{ "", -1, 39, 0, 0, 0, 0, 0, },
{ "postnet", BARCODE_POSTNET, 40, 0, 0, 0, 0, 0, },
{ "", -1, 41, 0, 0, 0, 0, 0, },
@ -1528,7 +1536,7 @@ static char *testUtilBwippName(int symbology, int option_1, int option_2, int op
{ "", BARCODE_AUSREPLY, 66, 0, 0, 0, 0, 0, },
{ "", BARCODE_AUSROUTE, 67, 0, 0, 0, 0, 0, },
{ "", BARCODE_AUSREDIRECT, 68, 0, 0, 0, 0, 0, },
{ "isbn", BARCODE_ISBNX, 69, 0, 0, 0, 0, 0, },
{ "isbn", BARCODE_ISBNX, 69, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "royalmail", BARCODE_RM4SCC, 70, 0, 0, 0, 0, 0, },
{ "datamatrix", BARCODE_DATAMATRIX, 71, 0, 0, 0, 0, 0, },
{ "ean14", BARCODE_EAN14, 72, 0, 0, 0, 0, 1 /*gs1_cvt*/, },
@ -1612,7 +1620,7 @@ static char *testUtilBwippName(int symbology, int option_1, int option_2, int op
return NULL;
}
if (data[symbology].val != symbology || (data[symbology].define != -1 && data[symbology].define != symbology)) { // Self-check
fprintf(stderr, "testUtilBarcodeName data table out of sync (%d)\n", symbology);
fprintf(stderr, "testUtilBwippName: data table out of sync (%d)\n", symbology);
abort();
}
if (data[symbology].name[0] == '\0') {
@ -1654,14 +1662,22 @@ int testUtilCanBwipp(int symbology, int option_1, int option_2, int option_3, in
return 0;
}
static void testUtilBwippCvtGS1Data(char *bwipp_data) {
static void testUtilBwippCvtGS1Data(char *bwipp_data, int upcean, int *addon_posn) {
char *b;
int pipe = 0;
*addon_posn = 0;
for (b = bwipp_data; *b; b++) {
if (upcean && *b == '|') {
pipe = 1;
}
if (*b == '[') {
*b = '(';
} else if (*b == ']') {
*b = ')';
} else if (*b == '+' && upcean && !pipe) {
*b = ' ';
*addon_posn = b - bwipp_data;
}
}
}
@ -1693,6 +1709,24 @@ static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const ch
return bwipp_data;
}
static void testUtilISBNHyphenate(char *bwipp_data, int addon_posn) {
/* Hack in 4 hyphens in fixed format, wrong for many ISBNs */
char temp[13 + 4 + 1 + 5 + 1];
int len = strlen(bwipp_data);
int i, j;
if (len < 13 || (addon_posn && addon_posn < 13 ) || len >= (int) sizeof(temp)) {
return;
}
for (i = 0, j = 0; i <= len; i++, j++) {
if (i == 3 || i == 5 || i == 10 || i == 12) {
temp[j++] = '-';
}
temp[j] = bwipp_data[i];
}
strcpy(bwipp_data, temp);
}
#define GS_INITIAL_LEN 35 /* Length of cmd up to -q */
int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2, int option_3, const char *data, int length, const char *primary, char *buffer, int buffer_size) {
@ -1704,7 +1738,7 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
int symbology = symbol->symbology;
int data_len = length == -1 ? (int) strlen(data) : length;
int primary_len = primary ? (int) strlen(primary) : 0;
int max_data_len = 4 + primary_len + 1 + 1 + data_len * 4; /* 4 AI prefix + primary + '|' + leading zero + escaped data */
int max_data_len = 4 + primary_len + 1 + 1 + data_len * 4 + 32; /* 4 AI prefix + primary + '|' + leading zero + escaped data + fudge */
char cmd[max_data_len + 1024];
char *bwipp_barcode = NULL;
@ -1723,6 +1757,10 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
int r, h;
int parse;
int upcean = is_extendable(symbology);
int upca = symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC;
int addon_posn;
bwipp_data[0] = bwipp_opts_buf[0] = '\0';
bwipp_barcode = testUtilBwippName(symbology, option_1, option_2, option_3, &linear_row_height, &gs1_cvt);
@ -1739,20 +1777,27 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
}
if (is_composite(symbology)) {
if (symbology == BARCODE_EANX_CC && primary_len <= 7) {
bwipp_barcode = "ean8composite";
}
if (!primary) {
fprintf(stderr, "testUtilBwipp: no primary data given %s\n", testUtilBarcodeName(symbology));
return -1;
}
if (*primary != '[' && symbology != BARCODE_EANX_CC && symbology != BARCODE_UPCE_CC && symbology != BARCODE_UPCA_CC) {
if (*primary != '[' && !upcean) {
strcat(bwipp_data, "(01)");
}
strcat(bwipp_data, primary);
strcat(bwipp_data, "|");
strcat(bwipp_data, data);
testUtilBwippCvtGS1Data(bwipp_data);
testUtilBwippCvtGS1Data(bwipp_data, upcean, &addon_posn);
if (upcean) {
if (symbology == BARCODE_EANX_CC && (primary_len <= 8 || (addon_posn && addon_posn <= 8))) {
bwipp_barcode = "ean8composite";
}
if (addon_posn) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%saddongap=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 > 0 ? option_2 : upca ? 9 : 7);
bwipp_opts = bwipp_opts_buf;
}
}
if (option_1 > 0) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sccversion=%c", strlen(bwipp_opts_buf) ? " " : "", option_1 == 1 ? 'a' : option_1 == 2 ? 'b' : 'c');
@ -1764,11 +1809,24 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
}
} else {
if (gs1_cvt) {
if (*data != '[') {
if (*data != '[' && !upcean) {
strcat(bwipp_data, symbology == BARCODE_NVE18 ? "(00)" : "(01)");
}
strcat(bwipp_data, data);
testUtilBwippCvtGS1Data(bwipp_data);
testUtilBwippCvtGS1Data(bwipp_data, upcean, &addon_posn);
if (upcean) {
if ((symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) && (data_len <= 8 || (addon_posn && addon_posn <= 8))) {
bwipp_barcode = data_len <= 3 ? "ean2" : data_len <= 5 ? "ean5" : "ean8";
}
if (symbology == BARCODE_ISBNX) {
testUtilISBNHyphenate(bwipp_data, addon_posn);
}
if (addon_posn) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%saddongap=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 > 0 ? option_2 : upca ? 9 : 7);
bwipp_opts = bwipp_opts_buf;
}
}
if (option_2 > 0) {
if (symbology == BARCODE_RSS_EXP || symbology == BARCODE_RSS_EXPSTACK) {
@ -1802,13 +1860,11 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
if (option_1 > 0) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%srows=%d", strlen(bwipp_opts_buf) ? " " : "", option_1);
}
//} else { /* BWIPP does not really support both row and column given */
if (option_2 > 0) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 - 5);
} else {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", (symbol->width - 57) / 11);
}
//}
if (option_2 > 0) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 - 5);
} else {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", (symbol->width - 57) / 11);
}
bwipp_opts = bwipp_opts_buf;
} else if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_LOGMARS) {
if (option_2 > 0) {
@ -1843,19 +1899,35 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
/* Hack in various adjustments */
if (symbology == BARCODE_RSS14 || symbology == BARCODE_RSS_LTD || symbology == BARCODE_RSS_EXP) {
/* Begin with space */
memmove(cmd + GS_INITIAL_LEN + 5, cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, " -sbs", 5);
char adj[5] = " -sbs";
memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
}
if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_PZN || symbology == BARCODE_VIN) {
/* Ratio 3 width bar/space -> 2 width */
memmove(cmd + GS_INITIAL_LEN + 8, cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, " -sr=0.6", 8);
char adj[8] = " -sr=0.6";
memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
}
if (symbology == BARCODE_C25INTER || symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT || symbology == BARCODE_ITF14) {
/* Ratio 2 width bar/space -> 3 width */
char adj[8] = " -sr=1.3";
memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
}
if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_HIBC_39
|| symbology == BARCODE_LOGMARS || symbology == BARCODE_PZN || symbology == BARCODE_VIN) {
|| symbology == BARCODE_LOGMARS || symbology == BARCODE_PZN || symbology == BARCODE_VIN
|| symbology == BARCODE_C25INTER || symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT || symbology == BARCODE_ITF14) {
/* End sbs loop on bar */
memmove(cmd + GS_INITIAL_LEN + 6, cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, " -selb", 6);
char adj[6] = " -selb";
memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
}
if (symbology == BARCODE_C25MATRIX) {
/* Zint uses 4X start/stop wides while BWIPP uses 3X - convert */
char adj[91] = " -sp='i 0 eq i limit 4 sub eq or sbs i get 3 eq and { (1111) print true } { false } ifelse'";
memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
}
if (symbol->debug & ZINT_DEBUG_TEST_PRINT) {

View file

@ -1,5 +1,5 @@
--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-07-10 13:08:57.215118693 +0100
+++ ../tools/bwipp_dump.ps 2020-07-10 13:44:00.892056648 +0100
--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-07-14 14:52:24.208222925 +0100
+++ ../tools/bwipp_dump.ps 2020-07-14 17:29:15.314238749 +0100
@@ -29,6 +29,8 @@
% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
% IN THE SOFTWARE.
@ -9,7 +9,7 @@
% --BEGIN TEMPLATE--
% --BEGIN RESOURCE preamble--
@@ -24484,34 +24486,72 @@
@@ -24485,34 +24487,80 @@
pop
} ifelse
@ -64,7 +64,7 @@
+ } {
+ /linsym exch def
+ /linpixs [
+ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def
@ -75,18 +75,26 @@
+
+ /linpad [ ccpixx 97 sub {0} repeat ] def
+
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop } repeat
+ 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat
+ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def
+
+ /pixx ccpixx def
+ /pixy pixs length pixx idiv def
+ <<
+ /ren //renmatrix
@ -101,7 +109,7 @@
end
@@ -24570,7 +24610,7 @@
@@ -24571,7 +24619,7 @@
pop
} ifelse
@ -110,7 +118,7 @@
% Get the result of encoding with ean8 and gs1-cc
options (lintype) (ean8) put
@@ -24578,29 +24618,67 @@
@@ -24579,29 +24627,75 @@
options (dontdraw) true put
% Plot the linear part
@ -157,7 +165,7 @@
+ } {
+ /linsym exch def
+ /linpixs [
+ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def
@ -172,18 +180,26 @@
- grestore
+ /linpad [ ccpixx 69 sub {0} repeat ] def
+
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop } repeat
+ 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 } repeat
+ 2 { linpad aload pop 1 0 65 {0} repeat 0 1 } repeat
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 } repeat
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 65 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def
+
+ /pixx ccpixx def
+ /pixy pixs length pixx idiv def
+ <<
+ /ren //renmatrix
@ -198,7 +214,7 @@
end
@@ -24659,34 +24737,72 @@
@@ -24660,34 +24754,80 @@
pop
} ifelse
@ -253,7 +269,7 @@
+ } {
+ /linsym exch def
+ /linpixs [
+ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def
@ -264,18 +280,26 @@
+
+ /linpad [ ccpixx 97 sub {0} repeat ] def
+
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop } repeat
+ 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat
+ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def
+
+ /pixx ccpixx def
+ /pixy pixs length pixx idiv def
+ <<
+ /ren //renmatrix
@ -290,7 +314,7 @@
end
@@ -24760,34 +24876,72 @@
@@ -24761,34 +24901,80 @@
/opt options
>> def
@ -345,7 +369,7 @@
+ } {
+ /linsym exch def
+ /linpixs [
+ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def
@ -356,18 +380,26 @@
+
+ /linpad [ ccpixx 53 sub {0} repeat ] def
+
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop } repeat
+ 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for
+ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 } repeat
+ 2 { linpad aload pop 1 0 49 {0} repeat 0 1 } repeat
+ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 } repeat
+ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 49 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def
+
+ /pixx ccpixx def
+ /pixy pixs length pixx idiv def
+ <<
+ /ren //renmatrix
@ -382,7 +414,7 @@
end
@@ -24846,7 +25000,7 @@
@@ -24847,7 +25033,7 @@
pop
} ifelse
@ -391,7 +423,7 @@
options (lintype) (databaromni) put
options (linkage) true put
@@ -24857,7 +25011,7 @@
@@ -24858,7 +25044,7 @@
linear options //databaromni exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -400,7 +432,7 @@
% Plot the separator
/sepfinder {
@@ -24888,20 +25042,66 @@
@@ -24889,20 +25075,66 @@
sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval
18 sepfinder 64 sepfinder
@ -436,14 +468,14 @@
+ /ccpixs compsym /pixs get def
+ /ccpixx compsym /pixx get def
+
+ /linpixs [ 0 % Begin with left guard space
+ linsbs { 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ /linpixs [ 0 % Begin with left guard space
+ linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /sep [ 0 sep aload pop ] def % Pad with left guard space
+ /sep [ 0 sep aload pop ] def % Pad with left guard space
+
+ /linheight linheight cvi def
+ /diff linpixs length ccpixx sub def
+ diff 0 gt { % Centre align composite, doubling up rows
+ diff 0 gt { % Centre align composite, doubling up rows
+ /ccpad [ diff 2 idiv {0} repeat ] def
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
@ -453,10 +485,10 @@
+ sep aload pop linheight { linpixs aload pop } repeat
+ ] def
+ /pixx linpixs length def
+ } { % Right pad composite, doubling up rows, and left pad (right align) separator/linear
+ } { % Right pad composite, doubling up rows, and left pad (right align) separator/linear
+ /linpad [ diff neg 1 add {0} repeat ] def
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space
+ 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop 0 } repeat
+ } for
@ -479,7 +511,7 @@
end
@@ -24959,7 +25159,7 @@
@@ -24960,7 +25192,7 @@
pop
} ifelse
@ -488,7 +520,7 @@
options (lintype) (databarstacked) put
options (linkage) true put
@@ -24970,7 +25170,7 @@
@@ -24971,7 +25203,7 @@
linear options //databarstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -497,7 +529,7 @@
% Plot the separator
/sepfinder {
@@ -24998,20 +25198,52 @@
@@ -24999,20 +25231,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -537,12 +569,12 @@
+ /pixx ccpixx 1 add def
+ /linpad [ pixx linwidth sub {0} repeat ] def
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows
+ 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows
+ /i exch def
+ 2 { 0 ccpixs i ccpixx getinterval aload pop } repeat
+ } for
+ sep aload pop linpad aload pop
+ 0 linwidth linpixs length 1 sub { % Right pad linear
+ 0 linwidth linpixs length 1 sub { % Right pad linear
+ /i exch def
+ linpixs i linwidth getinterval aload pop linpad aload pop
+ } for
@ -562,7 +594,7 @@
end
@@ -25069,7 +25301,7 @@
@@ -25070,7 +25334,7 @@
pop
} ifelse
@ -571,7 +603,7 @@
options (lintype) (databarstackedomni) put
options (linkage) true put
@@ -25080,7 +25312,7 @@
@@ -25081,7 +25345,7 @@
linear options //databarstackedomni exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -580,7 +612,7 @@
% Plot the separator
/sepfinder {
@@ -25108,20 +25340,52 @@
@@ -25109,20 +25373,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -620,12 +652,12 @@
+ /pixx ccpixx 1 add def
+ /linpad [ pixx linwidth sub {0} repeat ] def
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows
+ 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows
+ /i exch def
+ 2 { 0 ccpixs i ccpixx getinterval aload pop } repeat
+ } for
+ sep aload pop linpad aload pop
+ 0 linwidth linpixs length 1 sub { % Right pad linear
+ 0 linwidth linpixs length 1 sub { % Right pad linear
+ /i exch def
+ linpixs i linwidth getinterval aload pop linpad aload pop
+ } for
@ -645,7 +677,7 @@
end
@@ -25294,7 +25558,7 @@
@@ -25295,7 +25591,7 @@
pop
} ifelse
@ -654,7 +686,7 @@
options (lintype) (databarlimited) put
options (linkage) true put
@@ -25305,7 +25569,7 @@
@@ -25306,7 +25602,7 @@
linear options //databarlimited exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -663,7 +695,7 @@
% Plot the separator
mark
@@ -25313,22 +25577,68 @@
@@ -25314,22 +25610,68 @@
counttomark 1 sub array astore /sep exch def pop pop
sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval
@ -703,14 +735,14 @@
+ /ccpixx compsym /pixx get def
- grestore
+ /linpixs [ 0 % Begin with left guard space
+ linsbs { 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ /linpixs [ 0 % Begin with left guard space
+ linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /sep [ 0 sep aload pop ] def % Offset by 1
+ /sep [ 0 sep aload pop ] def % Offset by 1
+
+ /linheight linheight cvi def
+ /diff linpixs length ccpixx sub def
+ diff 0 gt { % 2 column - centre align
+ diff 0 gt { % 2 column - centre align
+ /ccpad [ diff 2 idiv {0} repeat ] def
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub {
@ -720,10 +752,10 @@
+ sep aload pop linheight { linpixs aload pop } repeat
+ ] def
+ /pixx linpixs length def
+ } { % 3/4 column - right pad 1 and right align separator/linear
+ } { % 3/4 column - right pad 1 and right align separator/linear
+ /linpad [ diff neg 1 add {0} repeat ] def
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space
+ 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space
+ /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop 0 } repeat
+ } for
@ -746,7 +778,7 @@
end
@@ -25387,7 +25697,7 @@
@@ -25388,7 +25730,7 @@
pop
} ifelse
@ -755,7 +787,7 @@
options (lintype) (databarexpanded) put
options (linkage) true put
@@ -25398,7 +25708,7 @@
@@ -25399,7 +25741,7 @@
linear options //databarexpanded exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -764,7 +796,7 @@
% Plot the separator
/sepfinder {
@@ -25427,20 +25737,60 @@
@@ -25428,20 +25770,60 @@
18 98 bot length 13 sub {} for
69 98 bot length 13 sub {} for
] {sepfinder} forall
@ -800,10 +832,10 @@
+ /ccpixs compsym /pixs get def
+ /ccpixx compsym /pixx get def
+
+ /linpixs [ 0 % Begin with left guard space
+ linsbs { 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ /linpixs [ 0 % Begin with left guard space
+ linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+ /sep [ 0 sep aload pop ] def % Offset by 1
+ /sep [ 0 sep aload pop ] def % Offset by 1
+
+ /linheight linheight cvi def
+ /diff linpixs length ccpixx sub def
@ -837,7 +869,7 @@
end
@@ -25498,7 +25848,7 @@
@@ -25499,7 +25881,7 @@
pop
} ifelse
@ -846,7 +878,7 @@
options (lintype) (databarexpandedstacked) put
options (linkage) true put
@@ -25509,7 +25859,7 @@
@@ -25510,7 +25892,7 @@
linear options //databarexpandedstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -855,7 +887,7 @@
% Plot the separator
/sepfinder {
@@ -25529,27 +25879,55 @@
@@ -25530,27 +25912,55 @@
} for
} bind def
/sep [ bot {1 exch sub} forall ] def
@ -900,10 +932,10 @@
+ /ccpixx compsym /pixx get def
+
+ /pixx sep length def
+ /cclpad [ pixx ccpixx sub 1 add 2 idiv {0} repeat ] def % Add 1 to allow for odd difference
+ /cclpad [ pixx ccpixx sub 1 add 2 idiv {0} repeat ] def % Add 1 to allow for odd difference
+ /ccrpad [ pixx ccpixx sub 2 idiv {0} repeat ] def
+ /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Centre align composite
+ 0 ccpixx ccpixs length 1 sub { % Centre align composite
+ /i exch def
+ 2 { cclpad aload pop ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for
@ -925,7 +957,7 @@
end
@@ -25608,7 +25986,7 @@
@@ -25609,7 +26019,7 @@
pop
} ifelse
@ -934,7 +966,7 @@
options (inkspread) (0) put
options (dontdraw) true put
@@ -25635,35 +26013,87 @@
@@ -25636,35 +26046,87 @@
linear << options {} forall >> //gs1-128 exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -989,23 +1021,23 @@
+ /ccpixx compsym /pixx get def
+
+ /linpixs [
+ linsbs { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ linsbs { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def
+
+ x 0 gt { % Left pad composite
+ x 0 gt { % Left pad composite
+ /cclpad [ x {0} repeat ] def
+ /linlpad 0 array def
+ /diff linwidth ccpixx x add sub def
+ } { % Left pad linear
+ } { % Left pad linear
+ /cclpad 0 array def
+ /linlpad [ x neg {0} repeat ] def
+ /diff linwidth x sub ccpixx sub def
+ } ifelse
+
+ diff 0 gt { % Right pad composite
+ diff 0 gt { % Right pad composite
+ /ccrpad [ diff {0} repeat ] def
+ /linrpad 0 array def
+ } { % Right pad linear
+ } { % Right pad linear
+ /ccrpad 0 array def
+ /linrpad [ diff neg {0} repeat ] def
+ } ifelse
@ -1036,7 +1068,7 @@
end
@@ -26961,3 +27391,115 @@
@@ -26962,3 +27424,124 @@
% --END ENCODER hibcazteccode--
% --END TEMPLATE--
@ -1099,15 +1131,15 @@
+ret /pixs known {
+ /pixs ret /pixs get def
+
+ n ret /pixx known and { % If newlines requested and have row width
+ n ret /pixx known and { % If newlines requested and have row width
+ /pixx ret /pixx get def
+ 0 pixx pixs length 1 sub { % For i = 0; i < pixs length; i += pixx
+ pixs exch pixx getinterval { % For j = i; j < i + pixx; j++
+ 0 pixx pixs length 1 sub { % For i = 0; i < pixs length; i += pixx
+ pixs exch pixx getinterval { % For j = i; j < i + pixx; j++
+ 1 string cvs print
+ } forall
+ (\n) print
+ } for
+ } { % Else dump the whole thing, no newlines
+ } { % Else dump the whole thing, no newlines
+ pixs { 1 string cvs print } forall
+ } ifelse
+} {
@ -1115,10 +1147,17 @@
+ ret /sbs known {
+ /sbs ret /sbs get def
+
+ % Check if given ratio arg to adjust width of bars/spaces (eg "0.6" reduces 3 -> 2)
+ % Check if given preprocessor override
+ systemdict /p known {
+ /p systemdict /p get cvx def
+ } {
+ /p { false } def
+ } ifelse
+
+ % Check if given ratio arg to adjust width of bars/spaces (e.g. "0.6" reduces 3 -> 2, "1.3" increases 2 -> 3)
+ systemdict /r known {
+ /r systemdict /r get cvr def
+ /f { r mul ceiling cvi } def
+ /f { r mul round cvi } def
+ } {
+ /f {} def
+ } ifelse
@ -1135,11 +1174,13 @@
+
+ 0 1 limit {
+ /i exch def
+ i 2 mod 0 eq { % i is even
+ sbs i get f { (1) print } repeat
+ } {
+ sbs i get f { (0) print } repeat
+ } ifelse
+ p not { % If not preprocessed
+ i 2 mod 0 eq { % i is even
+ sbs i get f cvi { (1) print } repeat
+ } {
+ sbs i get f cvi { (0) print } repeat
+ } ifelse
+ } if
+ } for
+ n { (\n) print } if
+ } if

View file

@ -0,0 +1,11 @@
#!/bin/bash
./test_2of5 -f encode -d $(expr 128 + 16)
./test_channel -f encode -d $(expr 128 + 16)
./test_codablock -f encode -d $(expr 128 + 16)
./test_code -f encode -d $(expr 128 + 16)
./test_code128 -f encode -d $(expr 128 + 16)
./test_composite -d $(expr 128 + 16)
./test_gs1 -f gs1_reduce -d $(expr 128 + 16)
./test_rss -d $(expr 128 + 16)
./test_telepen -f encode -d $(expr 128 + 16)
./test_upcean -f encode -d $(expr 128 + 16)