1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-06-10 07:33:43 +00:00

AZTEC: use algorithm adapted from ZXing for optimized encodation

(ticket #347), props Frank Yellin and Rustam Abdullaev;
   also improve performance of `FAST_MODE`
DATAMATRIX: assert max size on `edges` will fit in unsigned short;
   use MASK for DMRE/SQUARE `option_3` setting
PDF417: assert max size on `edges` will fit in unsigned short
GUI: fix setting AZTEC size and ECC combos if not previously set
manual: fix not mentioning AZTEC re `FAST_MODE`;
  gs1 mode footnote: mention 3940's length; pandoc -> 3.9
test suite: DOTCODE: account for new BWIPP input length guard
This commit is contained in:
gitlost
2026-03-11 15:48:24 +00:00
parent ee71a5cc56
commit b3a3c0d3b4
19 changed files with 3668 additions and 1558 deletions
+4 -3
View File
@@ -1,4 +1,4 @@
Version 2.16.0.9 (dev) not released yet (2026-02-26)
Version 2.16.0.9 (dev) not released yet (2026-03-11)
====================================================
**Incompatible changes**
@@ -19,8 +19,9 @@ Changes
add `ZINT_TEST`-only "--test" option to do various internal tests
- GS1SE: exclude GS1_128 from requisite AIs check as may be spread across more
than one barcode (ticket #348, props Harald Oehlmann and Terry Burton)
- AZTEC: add improved encoding algorithm, previous algorithm available via
"--fast" (input_mode |= FAST_MODE)
- AZTEC: add improved encoding algorithm adapted from ZXing, props Frank Yellin
and Rustam Abdullaev; previous algorithm available via "--fast" (input_mode
|= FAST_MODE)
- AZTEC: add new option "--azfull" (option_3 = ZINT_AZTEC_FULL) to only
consider Full symbols (not Compact ones) on automatic sizing
- GS1: new `GS1RAW_MODE` (CLI "--gs1raw") and GS1 Syntax Engine "Unbracketed AI
+715 -631
View File
File diff suppressed because it is too large Load Diff
+102 -34
View File
@@ -84,31 +84,19 @@ static const short AztecMapCore[15][15] = {
{ 0, 0, 20029, 20028, 20027, 20026, 20025, 0, 20024, 20023, 20022, 20021, 20020, 0, 0, },
};
/* From Table 2 */
static const char AztecSymbolChar[128] = {
0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 15, 16, 17, 18, 19,
1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 18, 0, 20,
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 22, 23, 24, 25, 26,
20, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 27, 21, 28, 22, 23,
24, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 25, 30, 26, 27
};
/* Modes */
#define AZ_U 1
#define AZ_L 2
#define AZ_M 3
#define AZ_P 4
#define AZ_D 5
#define AZ_B 6 /* 5 or 11-bit Byte (ideally would be separate modes, but not done due to performance hit) */
#define AZ_U 0
#define AZ_L 1
#define AZ_M 2
#define AZ_P 3
#define AZ_D 4
/* Pseudo-modes */
#define AZ_X 7 /* Used to indicate chars belonging to more than one mode */
#define AZ_E 8 /* Used to signal no next mode */
#define AZ_B 5 /* Byte */
#define AZ_X 6 /* Indicates chars belonging to more than one mode */
#define AZ_E 7 /* Signals no next mode */
#define AZ_NUM_MODES 6
#define AZ_NUM_MODES 5
#define AZ_MASK(m) ((m) & 0x0F)
@@ -126,22 +114,22 @@ static const char AztecSymbolChar[128] = {
#define AZ_D_US (AZ_D | AZ_US)
static const char AztecModes[128] = {
AZ_B, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_X, AZ_B, AZ_B,
AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M,
AZ_X, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_X, AZ_P, AZ_X, AZ_P,
AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P,
AZ_M, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U,
AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_P, AZ_M, AZ_P, AZ_M, AZ_M,
AZ_M, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L,
AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_P, AZ_M, AZ_P, AZ_M, AZ_M
AZ_B, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, AZ_X, AZ_B, AZ_B, /*0-15*/
AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_B, AZ_M, AZ_M, AZ_M, AZ_M, AZ_M, /*16-31*/
AZ_X, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_X, AZ_P, AZ_X, AZ_P, /*32-47*/
AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_D, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, AZ_P, /*48-63*/
AZ_M, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, /*64-79*/
AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_U, AZ_P, AZ_M, AZ_P, AZ_M, AZ_M, /*80-95*/
AZ_M, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, /*96-111*/
AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_L, AZ_P, AZ_M, AZ_P, AZ_M, AZ_M /*112-127*/
};
/* Testable flags */
#define AZ_U_F 0x01
#define AZ_L_F 0x02
#define AZ_M_F 0x04
#define AZ_P_F 0x08
#define AZ_D_F 0x10
#define AZ_U_F 0x01 /* 1 << AZ_U */
#define AZ_L_F 0x02 /* 1 << AZ_L */
#define AZ_M_F 0x04 /* 1 << AZ_M */
#define AZ_P_F 0x08 /* 1 << AZ_P */
#define AZ_D_F 0x10 /* 1 << AZ_D */
/* Flag version of `AztecModes[]` */
static const char AztecFlags[128] = {
@@ -179,6 +167,86 @@ static const char AztecFlags[128] = {
AZ_M_F, AZ_P_F, AZ_M_F, AZ_M_F, /* 124-127*/
};
/* The number of bits latch takes (AZ_B column used in FAST_MODE only) */
static const char AztecLatchNum[5][6] = {
/* U L M P D B */
/*U*/ { 0, 5, 5, 10, 5, 5 },
/*L*/ { 9, 0, 5, 10, 5, 5 },
/*M*/ { 5, 5, 0, 5, 10, 5 },
/*P*/ { 5, 10, 10, 0, 10, 10 },
/*D*/ { 4, 9, 9, 14, 0, 9 },
};
/* Bit pattern to latch (AZ_B column used in FAST_MODE only) */
static const short AztecLatch[5][6] = {
/* U L M P D B */
/*U*/ { 0, 28, 29, (29 << 5) + 30, 30, 31 },
/*L*/ { (30 << 4) + 14, 0, 29, (29 << 5) + 30, 30, 31 },
/*M*/ { 29, 28, 0, 30, (29 << 5) + 30, 31 },
/*P*/ { 31, (31 << 5) + 28, (31 << 5) + 29, 0, (31 << 5) + 30, (31 << 5) + 31 },
/*D*/ { 14, (14 << 5) + 28, (14 << 5) + 29, (14 << 10) + (29 << 5) + 30, 0, (14 << 5) + 31 },
};
/* From Table 2 */
static const char AztecChar[5][128] = {
{ /* AZ_U */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*0-15*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*16-31*/
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*32-47*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*48-63*/
0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, /*64-79*/
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 0, 0, 0, 0, 0, /*80-95*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*96-111*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /*112-127*/
}, { /* AZ_L */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*0-15*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*16-31*/
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*32-47*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*48-63*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*64-79*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80-95*/
0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, /*96-111*/
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 0, 0, 0, 0, 0 /*112-127*/
}, { /* AZ_M */
0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 0, /*0-15*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 16, 17, 18, 19, /*16-31*/
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*32-47*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*48-63*/
20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*64-79*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 22, 23, /*80-95*/
24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*96-111*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 26, 27 /*112-127*/
}, { /* AZ_P with [abcd] mapped to doubles */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, /*0-15*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*16-31*/
0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, /*32-47*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 22, 23, 24, 25, 26, /*48-63*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*64-79*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 0, 28, 0, 0, /*80-95*/
0, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*96-111*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 30, 0, 0 /*112-127*/
}, { /* AZ_D */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*0-15*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*16-31*/
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 13, 0, /*32-47*/
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 0, 0, 0, 0, 0, /*48-63*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*64-79*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*80-95*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*96-111*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /*112-127*/
}
};
/* A map showing the available shift codes (B/S not shown) */
static const signed char AztecShift[5][5] = {
/* U L M P D */
/*U*/ { -1, -1, -1, 0, -1 },
/*L*/ { 28, -1, -1, 0, -1 },
/*M*/ { -1, -1, -1, 0, -1 },
/*P*/ { -1, -1, -1, -1, -1 },
/*D*/ { 15, -1, -1, 0, -1 },
};
/* Codewords per symbol */
static const short AztecSizes[32] = {
21, 48, 60, 88, 120, 156, 196, 240, 230, 272, 316, 364, 416, 470, 528, 588,
+7 -3
View File
@@ -1,7 +1,7 @@
/* dmatrix.c Handles Data Matrix ECC 200 symbols */
/*
libzint - the open source barcode library
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2026 Robin Stuart <rstuart114@gmail.com>
developed from and including some functions from:
IEC16022 bar code generation
@@ -580,6 +580,8 @@ static int dm_edi_buffer_xfer(int process_buffer[8], int process_p, unsigned cha
return process_p;
}
#define DM_DMRE_SQUARE_MASK 0x65 /* 101 */
/* Get index of symbol size in codewords array `dm_matrixbytes`, as specified or
else smallest containing `minimum` codewords */
static int dm_get_symbolsize(struct zint_symbol *symbol, const int minimum) {
@@ -593,10 +595,10 @@ static int dm_get_symbolsize(struct zint_symbol *symbol, const int minimum) {
}
for (i = minimum >= 62 ? 23 : 0; minimum > dm_matrixbytes[i]; i++);
if ((symbol->option_3 & 0x7F) == DM_DMRE) {
if ((symbol->option_3 & DM_DMRE_SQUARE_MASK) == DM_DMRE) {
return i;
}
if ((symbol->option_3 & 0x7F) == DM_SQUARE) {
if ((symbol->option_3 & DM_DMRE_SQUARE_MASK) == DM_SQUARE) {
/* Skip rectangular symbols in square only mode */
for (; dm_matrixH[i] != dm_matrixW[i]; i++);
return i;
@@ -992,6 +994,8 @@ static int dm_define_modes(struct zint_symbol *symbol, char modes[], const unsig
if (!edges) {
return 0;
}
assert((length + 1) * DM_NUM_MODES < USHRT_MAX); /* Guaranteed by input length limit */
dm_addEdges(symbol, source, length, last_seg, edges, 0, NULL, gs1);
DM_TRACE_Edges("DEBUG Initial situation\n", source, length, edges, 0);
+3 -1
View File
@@ -1,7 +1,7 @@
/* pdf417.c - Handles PDF417 stacked symbology */
/*
libzint - the open source barcode library
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2026 Robin Stuart <rstuart114@gmail.com>
Portions Copyright (C) 2004 Grandzebu
Bug Fixes thanks to KL Chin <klchin@users.sourceforge.net>
@@ -932,6 +932,8 @@ static int pdf_define_modes(short liste[3][PDF_MAX_LEN], int *p_indexliste, cons
if (!edges) {
return 0;
}
assert((length + 1) * PDF_NUM_MODES < USHRT_MAX); /* Guaranteed by input length limit */
pdf_addEdges(source, length, lastmode, edges, 0, NULL);
PDF_TRACE_Edges("DEBUG Initial situation\n", source, length, edges, 0);
+2659 -749
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -52,7 +52,7 @@ static void test_large(const testCtx *const p_ctx) {
/* 3*/ { 200, '0', 2974, ZINT_ERROR_INVALID_OPTION, "Error 735: Resulting symbol height '203' is too large (maximum 200)", 1, 1, "" }, /* Width > 200 also */
/* 4*/ { 200, 'A', 1470, 0, "", 1, 1, "" },
/* 5*/ { 200, 'A', 1471, ZINT_ERROR_INVALID_OPTION, "Error 735: Resulting symbol height '201' is too large (maximum 200)", 1, 1, "" },
/* 6*/ { 200, '\240', 1225, 0, "", 1, 899, "" },
/* 6*/ { 200, '\240', 1225, 0, "", 0, 899, "BWIPP limit now 4000 (== 1000 with caret escaping) TODO: suggest change to BWIPP" },
/* 7*/ { 200, '\240', 1226, ZINT_ERROR_INVALID_OPTION, "Error 735: Resulting symbol height '201' is too large (maximum 200)", 1, 899, "" },
/* 8*/ { 200, '0', 1, 0, "", 1, 1, "" }, /* Padding codewords 35 - probably max */
/* 9*/ { 200, '0', 2, 0, "", 1, 1, "" }, /* Padding codewords 35 */
+35 -1
View File
@@ -642,6 +642,40 @@ static void test_2d_encode(const testCtx *const p_ctx) {
"10111101100000001010110001010110"
"11111111111111111111111111111111"
},
/* 6*/ { 10, "JGB 010100000700009001B707RH1A 0SN35XX é", 0, 32, 32, 1, "",
"10101010101010101010101010101010"
"11000001010001111001101100001111"
"10100101110000101011111110000000"
"10101000010110011001101011000101"
"10001100111000101111000111011110"
"10011100011000011100101000100101"
"11001111001000101010010010011110"
"10100101011000111100001100101111"
"10101111010111101100111100110100"
"11001001100100111001110000010111"
"11001000001001001101001111011110"
"11010000001111111011011101101101"
"11001000010000101001101010011010"
"11010111000101011111111101111111"
"10111101100011101110001100110100"
"11111111111111111111111111111111"
"10101010101010101010101010101010"
"11011101100000011000000001110001"
"11110000111100101000011000101010"
"11001011110010011000011101110001"
"11011111000101001011100101011100"
"10010101101100011100010000011101"
"10011001101011101110100111101000"
"11101010110010111001111100100101"
"10011011111101001000101111110100"
"10011101010101111111111000111101"
"11100001010010101011001010000000"
"10011010101011111000011010001001"
"11101001100100001101010001011000"
"10001001100100011011110101100101"
"11001011100001001010111101010100"
"11111111111111111111111111111111"
},
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
@@ -714,7 +748,7 @@ static void test_2d_encode(const testCtx *const p_ctx) {
char modules_dump[144 * 144 + 1];
assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)), -1,
"i:%d testUtilModulesDump == -1\n", i);
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 1 /*zxingcpp_cmp*/, cmp_buf,
ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
sizeof(cmp_buf), &cmp_len);
assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
i, testUtilBarcodeName(symbol->symbology), ret);
+3 -3
View File
@@ -4118,9 +4118,9 @@ static const char *testUtilZXingCPPCharSet(int eci) {
/* Run "zxingcppdecoder", returning result in `buffer` */
int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source, const int length, const char *bits,
const int zxingcpp_cmp, char *buffer, const int buffer_size, int *p_cmp_len) {
static const char cmd_fmt[] = "zxingcppdecoder -textonly -format %s -width %d -bits '%s'";
static const char opts_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -opts '%s' -width %d -bits '%s'";
static const char cs_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -charset %s -width %d -bits '%s'";
static const char cmd_fmt[] = "zxingcppdecoder -textonly -format %s -width %d -bits %s";
static const char opts_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -opts '%s' -width %d -bits %s";
static const char cs_cmd_fmt[] = "zxingcppdecoder -textonly -format %s -charset %s -width %d -bits %s";
const int bits_len = (int) strlen(bits);
const int width = symbol->width;
+1
View File
@@ -48,6 +48,7 @@ extern "C" {
#define ZINT_DEBUG_TEST_PERFORMANCE 256
#define ZINT_DEBUG_TEST_ZXINGCPP 512
#define ZINT_DEBUG_TEST_BWIPP_ZXINGCPP 1024
#define ZINT_DEBUG_TEST_AZTEC_SKIP_ALL 2048
#ifdef ZINT_SANITIZEM /* Suppress clang -fsanitize=memory false positives */
#define ZINT_TESTUTIL_SANITIZEM_INIT = {0}
Binary file not shown.
@@ -16,6 +16,8 @@ function run_zxingcpp_test() {
run_zxingcpp_test "test_2of5" "encode"
run_zxingcpp_test "test_aztec" "large"
run_zxingcpp_test "test_aztec" "bs"
run_zxingcpp_test "test_aztec" "many_states"
run_zxingcpp_test "test_aztec" "encode"
run_zxingcpp_test "test_aztec" "encode_segs"
run_zxingcpp_test "test_aztec" "fuzz"
+6 -6
View File
@@ -1,12 +1,12 @@
% docs/README 2025-12-09
% docs/README 2026-03-11
For generation of "docs/manual.html", "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd"
and man page "docs/zint.1" from "docs/zint.1.pmd" using pandoc >= 3.8.2.
On Ubuntu/Debian (tested on Ubuntu 22.04 and Ubuntu 24.04)
wget https://github.com/jgm/pandoc/releases/download/3.8.3/pandoc-3.8.3-1-amd64.deb
sudo dpkg -i pandoc-3.8.3-1-amd64.deb
wget https://github.com/jgm/pandoc/releases/download/3.9/pandoc-3.9-1-amd64.deb
sudo dpkg -i pandoc-3.9-1-amd64.deb
sudo apt install librsvg2-bin
sudo apt install texlive-xetex
sudo apt install texlive-lang-cjk
@@ -15,9 +15,9 @@ On Ubuntu/Debian (tested on Ubuntu 22.04 and Ubuntu 24.04)
On Fedora (tested on Fedora Linux 38 (Workstation Edition) and Fedora Linux 42 (Workstation Edition))
wget https://github.com/jgm/pandoc/releases/download/3.8.3/pandoc-3.8.3-linux-amd64.tar.gz
tar xf pandoc-3.8.3-linux-amd64.tar.gz
sudo mv -i pandoc-3.8.3/bin/pandoc /usr/local/bin
wget https://github.com/jgm/pandoc/releases/download/3.9/pandoc-3.9-linux-amd64.tar.gz
tar xf pandoc-3.9-linux-amd64.tar.gz
sudo mv -i pandoc-3.9/bin/pandoc /usr/local/bin
sudo dnf install librsvg2-tools.x86_64
sudo dnf install texlive-xetex
sudo dnf install texlive-ctex.noarch
+19 -18
View File
@@ -334,7 +334,7 @@
<h1 class="title">Zint Barcode Generator and Zint Barcode Studio User
Manual</h1>
<p class="author">Version 2.16.0.9</p>
<p class="date">February 2026</p>
<p class="date">March 2026</p>
</header>
<nav id="TOC" role="doc-toc">
<ul>
@@ -2601,13 +2601,12 @@ Modes and ECI</a> below.</p>
<p>GS1 data can be encoded in a number of symbologies - see <a
href="#gs1-data-entry-and-options">4.11.3 GS1 Data Entry and
Options</a>.</p>
<p>Health Industry Barcode (HIBC) data may also be encoded in the
symbologies Aztec Code, Codablock-F, Code 128, Code 39, Data Matrix,
MicroPDF417, PDF417 and QR Code. Within this mode, the leading
<code>'+'</code> and the check character are automatically added by
Zint, conforming to HIBC Labeler Identification Code (HIBC LIC). For
HIBC Provider Applications Standard (HIBC PAS), preface the data with a
slash <code>'/'</code>.</p>
<p>Health Industry Barcode (HIBC) data may be encoded in the symbologies
Aztec Code, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417,
PDF417 and QR Code. Within this mode, the leading <code>'+'</code> and
the check character are automatically added by Zint, conforming to HIBC
Labeler Identification Code (HIBC LIC). For HIBC Provider Applications
Standard (HIBC PAS), preface the data with a slash <code>'/'</code>.</p>
<p>The <code>--binary</code> option encodes the input data as given.
Automatic code page translation to an ECI page is disabled, and no
validation of the datas encoding takes place. This may be used for raw
@@ -4240,9 +4239,9 @@ as per-row rather than as overall height.</td>
<tr>
<td style="text-align: left;"><code>FAST_MODE</code></td>
<td style="text-align: left;">Use faster if less optimal encodation or
other shortcuts if available (affects <code>DATAMATRIX</code>,
<code>MICROPDF417</code>, <code>PDF417</code>, <code>QRCODE</code> and
<code>UPNQR</code> only).</td>
other shortcuts if available (affects <code>AZTEC</code>,
<code>DATAMATRIX</code>, <code>MICROPDF417</code>, <code>PDF417</code>,
<code>QRCODE</code> and <code>UPNQR</code> only).</td>
</tr>
<tr>
<td style="text-align: left;"><code>EXTRA_ESCAPE_MODE</code></td>
@@ -4297,8 +4296,8 @@ in section <a href="#adjusting-height">4.4 Adjusting Height</a>. The
<code>height</code> member should be set to the desired per-row value on
input (it will be set to the overall height on output).</p>
<p><code>FAST_MODE</code> causes a less optimal encodation scheme to be
used for Data Matrix, MicroPDF417 and PDF417. For QR Code and UPNQR, it
limits Zints automatic mask selection - see <a
used for Aztec Code, Data Matrix, MicroPDF417 and PDF417. For QR Code
and UPNQR, it limits Zints automatic mask selection - see <a
href="#qr-code-iso-18004">6.6.3 QR Code (ISO 18004)</a> for details.</p>
<h2 id="multiple-segments-1">5.12 Multiple Segments</h2>
<p>For input data requiring multiple ECIs, the following functions may
@@ -5890,8 +5889,9 @@ or 3 for CC-A, CC-B or CC-C respectively.</p>
into a small space. The size of the 2D component and the amount of error
correction is determined by the amount of data to be encoded and the
type of linear component which is being used. CC-A can encode up to 56
numeric digits or an alphanumeric string of shorter length. To select
CC-A use <code>--mode=1</code> (API <code>option_1 = 1</code>).</p>
numeric digits (including AIs) or an alphanumeric string of shorter
length (e.g. if all capitals, at most 30, excluding AI). To select CC-A
use <code>--mode=1</code> (API <code>option_1 = 1</code>).</p>
<figure>
<img src="images/ean13_cc_a.svg" class="upcean"
alt="zint -b EAN13_CC --compliantheight -d &quot;[99]1234-abcd&quot; --mode=1 --primary=331234567890" />
@@ -9946,9 +9946,10 @@ of any AI (except when the last) <strong>apart</strong> from those whose
11, 12, 13, 15, 16, 17, 20, 31, 32, 33, 34, 35, 36 and 41, as specified
in GS1 General Specifications 26.0 Table 7-6 “Element strings with
predefined length using GS1 Application Identifiers”. Note that this
applies even to AIs with fixed lengths, so e.g. the data for AI 3940
must have a terminating <code>FNC1</code> (except when the last AI).<a
href="#fnref11" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
applies even to AIs with fixed lengths, so e.g. the data for AI 3940,
which has a fixed length of 4, must have a terminating <code>FNC1</code>
(except when the last AI).<a href="#fnref11" class="footnote-back"
role="doc-backlink">↩︎</a></p></li>
<li id="fn12"><p>BARCODE_MEMORY_FILE textual formats EPS and SVG will
have Unix newlines (LF) on both Windows and Unix, i.e. not CR+LF on
Windows.<a href="#fnref12" class="footnote-back"
+11 -10
View File
@@ -1,6 +1,6 @@
% Zint Barcode Generator and Zint Barcode Studio User Manual
% Version 2.16.0.9
% February 2026
% March 2026
# 1. Introduction
@@ -1289,7 +1289,7 @@ Interpretations) mechanism to encode the data if the symbology supports it - see
GS1 data can be encoded in a number of symbologies - see [4.11.3 GS1 Data Entry
and Options].
Health Industry Barcode (HIBC) data may also be encoded in the symbologies Aztec
Health Industry Barcode (HIBC) data may be encoded in the symbologies Aztec
Code, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR
Code. Within this mode, the leading `'+'` and the check character are
automatically added by Zint, conforming to HIBC Labeler Identification Code
@@ -1550,8 +1550,8 @@ last) **apart** from those whose **first two digits** match the following: 00,
01, 02, 03, 11, 12, 13, 15, 16, 17, 20, 31, 32, 33, 34, 35, 36 and 41, as
specified in GS1 General Specifications 26.0 Table 7-6 "Element strings with
predefined length using GS1 Application Identifiers". Note that this applies
even to AIs with fixed lengths, so e.g. the data for AI 3940 must have a
terminating `FNC1` (except when the last AI).
even to AIs with fixed lengths, so e.g. the data for AI 3940, which has a fixed
length of 4, must have a terminating `FNC1` (except when the last AI).
The final way to specify input is the related "raw" mode using the `--gs1raw`
option. Here `FNC1`s are indicated by Group Separators (`GS`, ASCII 29, escape
@@ -2517,7 +2517,7 @@ Value Effect
as overall height.
`FAST_MODE` Use faster if less optimal encodation or other
shortcuts if available (affects `DATAMATRIX`,
shortcuts if available (affects `AZTEC`, `DATAMATRIX`,
`MICROPDF417`, `PDF417`, `QRCODE` and `UPNQR` only).
`EXTRA_ESCAPE_MODE` Process special symbology-specific escape sequences
@@ -2572,9 +2572,9 @@ For `HEIGHTPERROW_MODE`, see `--heightperrow` in section [4.4 Adjusting Height].
The `height` member should be set to the desired per-row value on input (it will
be set to the overall height on output).
`FAST_MODE` causes a less optimal encodation scheme to be used for Data Matrix,
MicroPDF417 and PDF417. For QR Code and UPNQR, it limits Zint's automatic mask
selection - see [6.6.3 QR Code (ISO 18004)] for details.
`FAST_MODE` causes a less optimal encodation scheme to be used for Aztec Code,
Data Matrix, MicroPDF417 and PDF417. For QR Code and UPNQR, it limits Zint's
automatic mask selection - see [6.6.3 QR Code (ISO 18004)] for details.
## 5.12 Multiple Segments
@@ -3972,8 +3972,9 @@ followed by 1, 2 or 3 for CC-A, CC-B or CC-C respectively.
This system uses a variation of MicroPDF417 which is optimised to fit into a
small space. The size of the 2D component and the amount of error correction is
determined by the amount of data to be encoded and the type of linear component
which is being used. CC-A can encode up to 56 numeric digits or an alphanumeric
string of shorter length. To select CC-A use `--mode=1` (API `option_1 = 1`).
which is being used. CC-A can encode up to 56 numeric digits (including AIs) or
an alphanumeric string of shorter length (e.g. if all capitals, at most 30,
excluding AI). To select CC-A use `--mode=1` (API `option_1 = 1`).
![`zint -b EAN13_CC --compliantheight -d "[99]1234-abcd" --mode=1
--primary=331234567890`](images/ean13_cc_a.svg){.upcean}
+12 -11
View File
@@ -1,6 +1,6 @@
Zint Barcode Generator and Zint Barcode Studio User Manual
Version 2.16.0.9
February 2026
March 2026
*******************************************************************************
* For reference the following is a text-only version of the Zint manual, *
@@ -1370,7 +1370,7 @@ Interpretations) mechanism to encode the data if the symbology supports it - see
GS1 data can be encoded in a number of symbologies - see 4.11.3 GS1 Data Entry
and Options.
Health Industry Barcode (HIBC) data may also be encoded in the symbologies Aztec
Health Industry Barcode (HIBC) data may be encoded in the symbologies Aztec
Code, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR
Code. Within this mode, the leading '+' and the check character are
automatically added by Zint, conforming to HIBC Labeler Identification Code
@@ -2476,7 +2476,7 @@ member:
overall height.
FAST_MODE Use faster if less optimal encodation or other
shortcuts if available (affects DATAMATRIX,
shortcuts if available (affects AZTEC, DATAMATRIX,
MICROPDF417, PDF417, QRCODE and UPNQR only).
EXTRA_ESCAPE_MODE Process special symbology-specific escape sequences
@@ -2524,9 +2524,9 @@ For HEIGHTPERROW_MODE, see --heightperrow in section 4.4 Adjusting Height. The
height member should be set to the desired per-row value on input (it will be
set to the overall height on output).
FAST_MODE causes a less optimal encodation scheme to be used for Data Matrix,
MicroPDF417 and PDF417. For QR Code and UPNQR, it limits Zints automatic mask
selection - see 6.6.3 QR Code (ISO 18004) for details.
FAST_MODE causes a less optimal encodation scheme to be used for Aztec Code,
Data Matrix, MicroPDF417 and PDF417. For QR Code and UPNQR, it limits Zints
automatic mask selection - see 6.6.3 QR Code (ISO 18004) for details.
5.12 Multiple Segments
@@ -3794,8 +3794,9 @@ followed by 1, 2 or 3 for CC-A, CC-B or CC-C respectively.
This system uses a variation of MicroPDF417 which is optimised to fit into a
small space. The size of the 2D component and the amount of error correction is
determined by the amount of data to be encoded and the type of linear component
which is being used. CC-A can encode up to 56 numeric digits or an alphanumeric
string of shorter length. To select CC-A use --mode=1 (API option_1 = 1).
which is being used. CC-A can encode up to 56 numeric digits (including AIs) or
an alphanumeric string of shorter length (e.g. if all capitals, at most 30,
excluding AI). To select CC-A use --mode=1 (API option_1 = 1).
[zint -b EAN13_CC --compliantheight -d "[99]1234-abcd" --mode=1 --primary=331234
567890]
@@ -5185,7 +5186,7 @@ configured barcode is updated when the "Generate" button is pressed.
Annex D. Man Page ZINT(1)
% ZINT(1) Version 2.16.0.9 % % February 2026
% ZINT(1) Version 2.16.0.9 % % March 2026
NAME
@@ -5963,8 +5964,8 @@ apart from those whose first two digits match the following: 00, 01, 02, 03, 11,
12, 13, 15, 16, 17, 20, 31, 32, 33, 34, 35, 36 and 41, as specified in GS1
General Specifications 26.0 Table 7-6 “Element strings with predefined length
using GS1 Application Identifiers”. Note that this applies even to AIs with
fixed lengths, so e.g. the data for AI 3940 must have a terminating FNC1 (except
when the last AI).
fixed lengths, so e.g. the data for AI 3940, which has a fixed length of 4, must
have a terminating FNC1 (except when the last AI).
[12] BARCODE_MEMORY_FILE textual formats EPS and SVG will have Unix newlines
(LF) on both Windows and Unix, i.e. not CR+LF on Windows.
+2 -2
View File
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.8.3
.\" Automatically generated by Pandoc 3.9
.\"
.TH "ZINT" "1" "February 2026" "Version 2.16.0.9"
.TH "ZINT" "1" "March 2026" "Version 2.16.0.9"
.SH NAME
\f[CR]zint\f[R] \- encode data as a barcode image
.SH SYNOPSIS
+1 -1
View File
@@ -1,6 +1,6 @@
% ZINT(1) Version 2.16.0.9
%
% February 2026
% March 2026
# NAME
+3 -2
View File
@@ -3709,12 +3709,13 @@ void MainWindow::automatic_info_set()
}
txt->setText(QSL("ECC %1").arg(eccStr));
if (get_rad_val("radAztecSize")) {
set_cmb_index(QSL("cmbAztecSize"), m_aztecSizeIndex);
set_cmb_index(QSL("cmbAztecSize"),
m_aztecSizeIndex == -1 ? z >= 1 && z <= 36 ? z - 1 : 0 : m_aztecSizeIndex);
} else if (z >= 1 && z <= 36) {
set_cmb_index(QSL("cmbAztecSize"), z - 1);
}
if (get_rad_val("radAztecECC")) {
set_cmb_index(QSL("cmbAztecECC"), m_aztecECCIndex);
set_cmb_index(QSL("cmbAztecECC"), m_aztecECCIndex == -1 ? 1 /*>=23%+3*/ : m_aztecECCIndex);
} else {
static int ecc_percents[] = { 10, 23, 36, 50 };
for (int i = ARRAY_SIZE(ecc_percents) - 1; i >= 0; i--) {