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

AZTEC: add almost optimal encoding algorithm, previous algorithm

available via "--fast" (input_mode |= FAST_MODE) (ticket #347);
  add new option "--azfull" (option_3 = ZINT_AZTEC_FULL) to only
  consider Full symbols (not Compact ones) on automatic sizing
GUI: adjust Aztec tab to show feedback by selecting combos and
  shorten message to just actual ECC;
  grpCodabar min width
library: debug source input dump 200 -> 2000
common: some code fiddling (c -> ch, flg -> flag)
backend_tcl: add "-azfull" option & make capitalization of
  help more consistent
general: remove some trailing whitespace
manual: make Aztec ECCs more precise, i.e. ">=" rather than ">"
  (similarly in GUI)
CLI: code fiddling c -> opt
This commit is contained in:
gitlost
2026-02-02 14:20:10 +00:00
parent cf5ef9ec20
commit bcb3ceefe1
33 changed files with 4430 additions and 927 deletions
+8 -3
View File
@@ -1,11 +1,12 @@
Version 2.16.0.9 (dev) not released yet (2025-01-30)
Version 2.16.0.9 (dev) not released yet (2026-02-02)
====================================================
**Incompatible changes**
------------------------
- New Qt Backend method `save_as_memfile()` to save file to memory
- Aztec error codeword percentages adjusted to be at least advertised values
(may cause symbol size change or generation failure when specified)
(may cause symbol size change, and generation failure if specified)
- Improved Aztec encodation algorithm (may cause symbol size change)
- New Qt Backend method `save_as_memfile()` to save file to memory
Changes
-------
@@ -16,6 +17,10 @@ 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 almost optimal encoding algorithm, previous algoritm 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
Bugs
----
+1013 -381
View File
File diff suppressed because it is too large Load Diff
+80 -8
View File
@@ -96,15 +96,87 @@ static const char AztecSymbolChar[128] = {
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) */
/* 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_NUM_MODES 6
#define AZ_MASK(m) ((m) & 0x0F)
#define AZ_PS 0x10
#define AZ_US 0x20
/* P/S */
#define AZ_U_PS (AZ_U | AZ_PS)
#define AZ_L_PS (AZ_L | AZ_PS)
#define AZ_M_PS (AZ_M | AZ_PS)
#define AZ_D_PS (AZ_D | AZ_PS)
/* U/S */
#define AZ_L_US (AZ_L | AZ_US)
#define AZ_D_US (AZ_D | AZ_US)
static const char AztecModes[128] = {
'B', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'X', 'B', 'B',
'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'B', 'M', 'M', 'M', 'M', 'M',
'X', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'P', 'X', 'P', 'X', 'P',
'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'D', 'P', 'P', 'P', 'P', 'P', 'P',
'M', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U',
'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'P', 'M', 'P', 'M', 'M',
'M', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L',
'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'L', 'P', 'M', 'P', 'M', '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,
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
};
/* 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
/* Flag version of `AztecModes[]` */
static const char AztecFlags[128] = {
0, AZ_M_F, AZ_M_F, AZ_M_F, /* 0-3*/
AZ_M_F, AZ_M_F, AZ_M_F, AZ_M_F, /* 4-7*/
AZ_M_F, AZ_M_F, AZ_M_F, AZ_M_F, /* 8-11*/
AZ_M_F, AZ_M_F | AZ_P_F, 0, 0, /* 12-15*/
0, 0, 0, 0, /* 16-19*/
0, 0, 0, 0, /* 20-23*/
0, 0, 0, AZ_M_F, /* 24-27*/
AZ_M_F, AZ_M_F, AZ_M_F, AZ_M_F, /* 28-31*/
AZ_U_F | AZ_L_F | AZ_M_F | AZ_D_F, AZ_P_F, AZ_P_F, AZ_P_F, /* 32-35*/
AZ_P_F, AZ_P_F, AZ_P_F, AZ_P_F, /* 36-39*/
AZ_P_F, AZ_P_F, AZ_P_F, AZ_P_F, /* 40-43*/
AZ_P_F | AZ_D_F, AZ_P_F, AZ_P_F | AZ_D_F, AZ_P_F, /* 44-47*/
AZ_D_F, AZ_D_F, AZ_D_F, AZ_D_F, /* 48-51*/
AZ_D_F, AZ_D_F, AZ_D_F, AZ_D_F, /* 52-55*/
AZ_D_F, AZ_D_F, AZ_P_F, AZ_P_F, /* 56-59*/
AZ_P_F, AZ_P_F, AZ_P_F, AZ_P_F, /* 60-63*/
AZ_M_F, AZ_U_F, AZ_U_F, AZ_U_F, /* 64-67*/
AZ_U_F, AZ_U_F, AZ_U_F, AZ_U_F, /* 68-71*/
AZ_U_F, AZ_U_F, AZ_U_F, AZ_U_F, /* 72-75*/
AZ_U_F, AZ_U_F, AZ_U_F, AZ_U_F, /* 76-79*/
AZ_U_F, AZ_U_F, AZ_U_F, AZ_U_F, /* 80-83*/
AZ_U_F, AZ_U_F, AZ_U_F, AZ_U_F, /* 84-87*/
AZ_U_F, AZ_U_F, AZ_U_F, AZ_P_F, /* 88-91*/
AZ_M_F, AZ_P_F, AZ_M_F, AZ_M_F, /* 92-95*/
AZ_M_F, AZ_L_F, AZ_L_F, AZ_L_F, /* 96-99*/
AZ_L_F, AZ_L_F, AZ_L_F, AZ_L_F, /* 100-103*/
AZ_L_F, AZ_L_F, AZ_L_F, AZ_L_F, /* 104-107*/
AZ_L_F, AZ_L_F, AZ_L_F, AZ_L_F, /* 108-111*/
AZ_L_F, AZ_L_F, AZ_L_F, AZ_L_F, /* 112-115*/
AZ_L_F, AZ_L_F, AZ_L_F, AZ_L_F, /* 116-119*/
AZ_L_F, AZ_L_F, AZ_L_F, AZ_P_F, /* 120-123*/
AZ_M_F, AZ_P_F, AZ_M_F, AZ_M_F, /* 124-127*/
};
/* Codewords per symbol */
+18 -18
View File
@@ -1,7 +1,7 @@
/* common.c - Contains functions needed for a number of barcodes */
/*
libzint - the open source barcode library
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -36,13 +36,13 @@
#include "common.h"
/* Converts a character 0-9, A-F to its equivalent integer value */
INTERNAL int z_ctoi(const char source) {
if (z_isdigit(source))
return (source - '0');
if (source >= 'A' && source <= 'F')
return (source - 'A' + 10);
if (source >= 'a' && source <= 'f')
return (source - 'a' + 10);
INTERNAL int z_ctoi(const char ch) {
if (z_isdigit(ch))
return (ch - '0');
if (ch >= 'A' && ch <= 'F')
return (ch - 'A' + 10);
if (ch >= 'a' && ch <= 'f')
return (ch - 'a' + 10);
return -1;
}
@@ -70,20 +70,20 @@ INTERNAL void z_to_upper(unsigned char source[], const int length) {
}
}
/* Returns the number of times a character occurs in `source` */
INTERNAL int z_chr_cnt(const unsigned char source[], const int length, const unsigned char c) {
/* Returns the number of times a character `ch` occurs in `source` */
INTERNAL int z_chr_cnt(const unsigned char source[], const int length, const unsigned char ch) {
int count = 0;
int i;
for (i = 0; i < length; i++) {
count += source[i] == c;
count += source[i] == ch;
}
return count;
}
/* Flag table for `is_chr()` and `z_not_sane()` */
#define IS_CLS_F (IS_CLI_F | IS_SIL_F)
static const unsigned short flgs[256] = {
static const unsigned short flags[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*00-1F*/
IS_SPC_F, IS_C82_F, IS_C82_F, IS_HSH_F, /*20-23*/ /* !"# */
IS_CLS_F, IS_SIL_F | IS_C82_F, IS_C82_F, IS_C82_F, /*24-27*/ /* $%&' */
@@ -115,17 +115,17 @@ static const unsigned short flgs[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*E0-FF*/
};
/* Whether a character matches `flg` */
INTERNAL int z_is_chr(const unsigned int flg, const unsigned int c) {
return z_isascii(c) && (flgs[c] & flg);
/* Whether a character `ch` matches `flag` */
INTERNAL int z_is_chr(const unsigned int flag, const unsigned int ch) {
return z_isascii(ch) && (flags[ch] & flag); /* As passed an int ch need to check it's ASCII */
}
/* Verifies if a string only uses valid characters, returning 1-based position in `source` if not, 0 for success */
INTERNAL int z_not_sane(const unsigned int flg, const unsigned char source[], const int length) {
INTERNAL int z_not_sane(const unsigned int flag, const unsigned char source[], const int length) {
int i;
for (i = 0; i < length; i++) {
if (!(flgs[source[i]] & flg)) {
if (!(flags[source[i]] & flag)) {
return i + 1;
}
}
@@ -849,7 +849,7 @@ INTERNAL void z_hrt_cpy_cat_nochk(struct zint_symbol *symbol, const unsigned cha
symbol->text[total_length] = '\0';
}
/* Copy a single ASCII character into `symbol->text` (i.e. replaces content) */
/* Copy a single ASCII character `ch` into `symbol->text` (i.e. replaces content) */
INTERNAL void z_hrt_cpy_chr(struct zint_symbol *symbol, const char ch) {
symbol->text[0] = ch;
symbol->text_length = 1;
+12 -12
View File
@@ -137,11 +137,11 @@ typedef unsigned __int64 uint64_t;
#define z_isfintf(arg) (fmodf(arg, 1.0f) == 0.0f)
/* Simple versions of <ctype.h> functions with no dependence on locale */
#define z_isdigit(c) ((c) <= '9' && (c) >= '0')
#define z_isupper(c) ((c) >= 'A' && (c) <= 'Z')
#define z_islower(c) ((c) >= 'a' && (c) <= 'z')
#define z_isascii(c) (!((c) & ~0x7F))
#define z_iscntrl(c) (!((c) & ~0x1F) || (c) == 127)
#define z_isdigit(ch) ((ch) <= '9' && (ch) >= '0')
#define z_isupper(ch) ((ch) >= 'A' && (ch) <= 'Z')
#define z_islower(ch) ((ch) >= 'a' && (ch) <= 'z')
#define z_isascii(ch) (!((ch) & ~0x7F))
#define z_iscntrl(ch) (!((ch) & ~0x1F) || (ch) == 127)
/* Shorthands to cast away char pointer signedness */
#define ZUCP(p) ((unsigned char *) (p))
@@ -155,7 +155,7 @@ typedef unsigned __int64 uint64_t;
#define z_xtoc(i) ((i) < 10 ? z_itoc(i) : ((i) - 10) + 'A')
/* Converts a character 0-9, A-F to its equivalent integer value */
INTERNAL int z_ctoi(const char source);
INTERNAL int z_ctoi(const char ch);
/* Converts decimal string of length <= 9 to integer value. Returns -1 if not numeric */
INTERNAL int z_to_int(const unsigned char source[], const int length);
@@ -163,8 +163,8 @@ INTERNAL int z_to_int(const unsigned char source[], const int length);
/* Converts lower case characters to upper case in string `source` */
INTERNAL void z_to_upper(unsigned char source[], const int length);
/* Returns the number of times a character occurs in `source` */
INTERNAL int z_chr_cnt(const unsigned char source[], const int length, const unsigned char c);
/* Returns the number of times a character `ch` occurs in `source` */
INTERNAL int z_chr_cnt(const unsigned char source[], const int length, const unsigned char ch);
/* `z_is_chr()` & `z_not_sane()` flags */
#define IS_SPC_F 0x0001 /* Space */
@@ -190,11 +190,11 @@ INTERNAL int z_chr_cnt(const unsigned char source[], const int length, const uns
/* The most commonly used set */
#define NEON_F IS_NUM_F /* NEON "0123456789" */
/* Whether a character matches `flg` */
INTERNAL int z_is_chr(const unsigned int flg, const unsigned int c);
/* Whether a character `ch` matches `flag` */
INTERNAL int z_is_chr(const unsigned int flag, const unsigned int ch);
/* Verifies if a string only uses valid characters, returning 1-based position in `source` if not, 0 for success */
INTERNAL int z_not_sane(const unsigned int flg, const unsigned char source[], const int length);
INTERNAL int z_not_sane(const unsigned int flag, const unsigned char source[], const int length);
/* Verifies if a string only uses valid characters as above, but also returns `test_string` position of each in
`posns` array */
@@ -319,7 +319,7 @@ INTERNAL void z_hrt_cpy_nochk(struct zint_symbol *symbol, const unsigned char so
INTERNAL void z_hrt_cpy_cat_nochk(struct zint_symbol *symbol, const unsigned char source[], const int length,
const char separator, const unsigned char cat[], const int cat_length);
/* Copy a single ASCII character into `symbol->text` (i.e. replaces content) */
/* Copy a single ASCII character `ch` into `symbol->text` (i.e. replaces content) */
INTERNAL void z_hrt_cpy_chr(struct zint_symbol *symbol, const char ch);
/* No-check as-is append of ASCII to `symbol->text`, assuming current `symbol->text_length` + `length` fits */
+3 -3
View File
@@ -1048,9 +1048,9 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
const int len = local_segs[0].length;
const int primary_len = symbol->primary[0] ? (int) strlen(symbol->primary) : 0;
char name[32];
char source[1001]; /* 200*5 + 1 = 1001 */
char source[10001]; /* 2000*5 + 1 = 10001 */
(void) ZBarcode_BarcodeName(symbol->symbology, name);
z_debug_print_escape(local_segs[0].source, len > 200 ? 200 : len, source);
z_debug_print_escape(local_segs[0].source, len > 2000 ? 2000 : len, source);
printf("\nZBarcode_Encode_Segs: %s (%d), height %g, scale: %g, whitespace: (%d, %d), border_width: %d\n"
" output_options: 0x%X, fg: \"%s\", bg: \"%s\"\n"
" outfile: \"%s\"\n"
@@ -1069,7 +1069,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
symbol->eci, symbol->dpmm, symbol->dot_size,
symbol->text_gap, symbol->guard_descent, symbol->structapp.index, symbol->structapp.count,
symbol->structapp.id, symbol->warn_level, seg_count,
len > 200 ? "first 200 " : "", seg_count > 1 ? "[0]" : "", len, source);
len > 2000 ? "first 2000 " : "", seg_count > 1 ? "[0]" : "", len, source);
fflush(stdout);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 B

After

Width:  |  Height:  |  Size: 174 B

+2848 -292
View File
File diff suppressed because it is too large Load Diff
+72 -5
View File
@@ -1,7 +1,7 @@
/* These are not real tests, just performance indicators */
/*
libzint - the open source barcode library
Copyright (C) 2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2025-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -185,11 +185,20 @@ static void test_aztec(const testCtx *const p_ctx) {
static const struct perf_item data[] = {
/* 0*/ { BARCODE_AZTEC, -1, -1, -1, -1,
"ABC xyz ~~~ ??? 1234 \377\377",
"", 0, 19, 19, "31 chars, Compact 6-bit words, mixed" },
/* 1*/ { BARCODE_AZTEC, ESCAPE_MODE, -1, -1, -1,
"[)>\\R06\\G+/ACMRN123456/V2009121908334\\R\\E",
"", 0, 23, 23, "41 chars, Compact 8-bit words, mixed" },
/* 2*/ { BARCODE_AZTEC, -1, -1, -1, -1,
"ABCDEFGHIJKLM nopqrstuvwxyz ~~~~~~~~~~~~ ???????????? 12345678901234567890 \377\377\377",
"", 0, 27, 27, "90 chars, 8-bit words, mixed" },
/* 3*/ { BARCODE_AZTEC, -1, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"", 0, 49, 49, "286 chars, 8-bit words, upper" },
/* 1*/ { BARCODE_AZTEC, -1, -1, -1, -1,
/* 4*/ { BARCODE_AZTEC, -1, -1, -1, -1,
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
@@ -197,7 +206,7 @@ static void test_aztec(const testCtx *const p_ctx) {
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
"", 0, 79, 79, "900 chars, 10-bit words, numeric" },
/* 2*/ { BARCODE_AZTEC, -1, -1, -1, -1,
/* 5*/ { BARCODE_AZTEC, -1, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
@@ -206,7 +215,7 @@ static void test_aztec(const testCtx *const p_ctx) {
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377",
"", 0, 91, 91, "980 chars, 10-bit words, mixed" },
/* 3*/ { BARCODE_AZTEC, -1, -1, -1, -1,
/* 6*/ { BARCODE_AZTEC, -1, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
@@ -219,7 +228,64 @@ static void test_aztec(const testCtx *const p_ctx) {
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377",
"", 0, 113, 113, "1540 chars, 12-bit words, mixed" },
/* 4*/ { BARCODE_AZRUNE, -1, -1, -1, -1,
/* 7*/ { BARCODE_AZRUNE, -1, -1, -1, -1,
"255",
"", 0, 11, 11, "3 chars, AZRUNE" },
};
const int data_size = ARRAY_SIZE(data);
const int default_iterations = 1 * 1000;
test_perf(p_ctx, default_iterations, data, data_size);
}
static void test_aztec_fast(const testCtx *const p_ctx) {
static const struct perf_item data[] = {
/* 0*/ { BARCODE_AZTEC, FAST_MODE, -1, -1, -1,
"ABC xyz ~~~ ??? 1234 \377\377",
"", 0, 19, 19, "31 chars, Compact 6-bit words, mixed" },
/* 1*/ { BARCODE_AZTEC, ESCAPE_MODE | FAST_MODE, -1, -1, -1,
"[)>\\R06\\G+/ACMRN123456/V2009121908334\\R\\E",
"", 0, 23, 23, "41 chars, Compact 8-bit words, mixed" },
/* 2*/ { BARCODE_AZTEC, FAST_MODE, -1, -1, -1,
"ABCDEFGHIJKLM nopqrstuvwxyz ~~~~~~~~~~~~ ???????????? 12345678901234567890 \377\377\377",
"", 0, 27, 27, "90 chars, 8-bit words, mixed" },
/* 3*/ { BARCODE_AZTEC, FAST_MODE, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
"ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"", 0, 49, 49, "286 chars, 8-bit words, upper" },
/* 4*/ { BARCODE_AZTEC, FAST_MODE, -1, -1, -1,
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890",
"", 0, 79, 79, "900 chars, 10-bit words, numeric" },
/* 5*/ { BARCODE_AZTEC, FAST_MODE, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377",
"", 0, 91, 91, "980 chars, 10-bit words, mixed" },
/* 6*/ { BARCODE_AZTEC, FAST_MODE, -1, -1, -1,
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz ~~~~~~~~~~~~~~~~~~~~~~~~~ ?????????????????????????? 12345678901234567890123456 \377\377\377\377\377\377",
"", 0, 113, 113, "1540 chars, 12-bit words, mixed" },
/* 7*/ { BARCODE_AZRUNE, -1, -1, -1, -1,
"255",
"", 0, 11, 11, "3 chars, AZRUNE" },
};
@@ -691,6 +757,7 @@ int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func */
{ "test_2of5", test_2of5 },
{ "test_aztec", test_aztec },
{ "test_aztec_fast", test_aztec_fast },
{ "test_code11", test_code11 },
{ "test_code128", test_code128 },
{ "test_composite", test_composite },
+10 -1
View File
@@ -168,7 +168,15 @@ static void test_random(const testCtx *const p_ctx, const struct random_item *rd
static void test_aztec(const testCtx *const p_ctx) {
struct random_item rdata = {
FLAG_FULL_8BIT, BARCODE_AZTEC, DATA_MODE, 899, 1, 0, 0, -1, 1590
FLAG_FULL_8BIT, BARCODE_AZTEC, DATA_MODE, 899, 1, 0, 0, -1, 1900
};
test_random(p_ctx, &rdata);
}
static void test_aztec_fast(const testCtx *const p_ctx) {
struct random_item rdata = {
FLAG_FULL_8BIT, BARCODE_AZTEC, DATA_MODE | FAST_MODE, 899, 1, 0, 0, -1, 1590
};
test_random(p_ctx, &rdata);
@@ -298,6 +306,7 @@ int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func */
{ "test_aztec", test_aztec },
{ "test_aztec_fast", test_aztec_fast },
{ "test_codablockf", test_codablockf },
{ "test_codablockf_ascii", test_codablockf_ascii },
{ "test_code128", test_code128 },
+4 -4
View File
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -1851,9 +1851,9 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
/*231*/ { BARCODE_HIBC_BLOCKF, -1, -1, -1, -1, "1234", "", 0, 20, 2, 101, 242, 44, 0 /*set*/, 0, 44, 0, 20 },
/*232*/ { BARCODE_HIBC_BLOCKF, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 20, 2, 101, 242, 44, 0 /*set*/, 0, 44, 0, 20 },
/*233*/ { BARCODE_HIBC_BLOCKF, BARCODE_NO_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 20, 2, 101, 202, 44, 1 /*set*/, 0, 44, 0, 4 },
/*234*/ { BARCODE_HIBC_AZTEC, -1, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 1 /*set*/, 8, 10, 0, 2 },
/*235*/ { BARCODE_HIBC_AZTEC, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 1 /*set*/, 8, 10, 0, 2 },
/*236*/ { BARCODE_HIBC_AZTEC, BARCODE_NO_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 1 /*set*/, 8, 10, 0, 2 },
/*234*/ { BARCODE_HIBC_AZTEC, -1, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 1 /*set*/, 8, 10, 4, 4 },
/*235*/ { BARCODE_HIBC_AZTEC, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 1 /*set*/, 8, 10, 4, 4 },
/*236*/ { BARCODE_HIBC_AZTEC, BARCODE_NO_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 1 /*set*/, 8, 10, 4, 4 },
/*237*/ { BARCODE_DOTCODE, -1, -1, -1, -1, "1234", "", 0, 10, 10, 13, 27, 21, 1 /*set*/, 5, 6, 1, 1 },
/*238*/ { BARCODE_DOTCODE, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 10, 10, 13, 39, 33, 0 /*set*/, 0, 33, 0, 7 },
/*239*/ { BARCODE_HANXIN, -1, -1, -1, -1, "1234", "", 0, 23, 23, 23, 46, 46, 1 /*set*/, 0, 2, 0, 14 },
+4 -4
View File
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -2063,9 +2063,9 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
/*230*/ { BARCODE_HIBC_BLOCKF, -1, -1, -1, -1, "1234", "", 0, 20, 2, 101, 242, 44, 20, 2, 4, 40 },
/*231*/ { BARCODE_HIBC_BLOCKF, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 20, 2, 101, 242, 44, 20, 2, 4, 40 },
/*232*/ { BARCODE_HIBC_BLOCKF, BARCODE_NO_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 20, 2, 101, 202, 44, 0, 2, 4, 40 },
/*233*/ { BARCODE_HIBC_AZTEC, -1, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 22, 0, 2, 2 },
/*234*/ { BARCODE_HIBC_AZTEC, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 22, 0, 2, 2 },
/*235*/ { BARCODE_HIBC_AZTEC, BARCODE_NO_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 22, 0, 2, 2 },
/*233*/ { BARCODE_HIBC_AZTEC, -1, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 4, 0, 2, 2 },
/*234*/ { BARCODE_HIBC_AZTEC, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 4, 0, 2, 2 },
/*235*/ { BARCODE_HIBC_AZTEC, BARCODE_NO_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 15, 15, 15, 30, 30, 4, 0, 2, 2 },
/*236*/ { BARCODE_DOTCODE, -1, -1, -1, -1, "1234", "", 0, 10, 10, 13, 26, 20, 5, 1, 1.6, 0 },
/*237*/ { BARCODE_DOTCODE, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 10, 10, 13, 38, 32, 11, 7, 1.6, 0 },
/*238*/ { BARCODE_HANXIN, -1, -1, -1, -1, "1234", "", 0, 23, 23, 23, 46, 46, 0, 0, 14, 2 },
+8 -2
View File
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -617,7 +617,13 @@ const char *testUtilOption3Name(int symbology, int option_3) {
const char *name = NULL;
const unsigned int high_byte = option_3 == -1 ? 0 : (option_3 >> 8) & 0xFF;
if (symbology == BARCODE_DATAMATRIX || symbology == BARCODE_HIBC_DM) {
if (symbology == BARCODE_AZTEC || symbology == BARCODE_HIBC_AZTEC) {
if ((option_3 & 0xFF) == ZINT_AZTEC_FULL) {
name = "ZINT_AZTEC_FULL";
} else {
name = (option_3 & 0xFF) ? "-1" : "0";
}
} else if (symbology == BARCODE_DATAMATRIX || symbology == BARCODE_HIBC_DM) {
if (option_3 > 0) {
if ((option_3 & 0x7F) == DM_SQUARE) {
if ((option_3 & DM_ISO_144) == DM_ISO_144) {
Binary file not shown.
+5 -2
View File
@@ -1,7 +1,7 @@
/* zint.h - definitions for libzint */
/*
libzint - the open source barcode library
Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -322,11 +322,14 @@ extern "C" {
#define GS1NOCHECK_MODE 0x0020 /* Do not check validity of GS1 data (except that printable ASCII only) */
#define HEIGHTPERROW_MODE 0x0040 /* Interpret `height` as per-row rather than as overall height */
#define FAST_MODE 0x0080 /* Use faster if less optimal encodation or other shortcuts if available */
/* Note: affects DATAMATRIX, MICROPDF417, PDF417, QRCODE & UPNQR only */
/* (affects AZTEC, DATAMATRIX, MICROPDF417, PDF417, QRCODE & UPNQR only) */
#define EXTRA_ESCAPE_MODE 0x0100 /* Process special symbology-specific escape sequences as well as others */
/* Note: currently Code 128 only */
#define GS1SYNTAXENGINE_MODE 0x0200 /* Use the GS1 Syntax Engine (if available) to strictly validate GS1 input */
/* Aztec Code specific options (`symbol->option_3`) */
#define ZINT_AZTEC_FULL 128 /* Only consider Full versions on automatic symbol size selection */
/* Data Matrix specific options (`symbol->option_3`) */
#define DM_SQUARE 100 /* Only consider square versions on automatic symbol size selection */
#define DM_DMRE 101 /* Consider DMRE versions on automatic symbol size selection */
+5 -1
View File
@@ -1,7 +1,7 @@
/***************************************************************************
* Copyright (C) 2008 by BogDan Vatra *
* bogdan@licentia.eu *
* Copyright (C) 2010-2025 Robin Stuart *
* Copyright (C) 2010-2026 Robin Stuart *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -1305,6 +1305,10 @@ namespace Zint {
arg_int(cmd, "--addongap=", option2());
}
if (m_symbol == BARCODE_AZTEC || m_symbol == BARCODE_HIBC_AZTEC) {
arg_bool(cmd, "--azfull", (option3() & 0xFF) == ZINT_AZTEC_FULL);
}
if (bgStr() != QSL("FFFFFF") && !nobackground) {
arg_str(cmd, "--bg=", bgStr());
}
+6 -6
View File
@@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2021-2025 by Robin Stuart <rstuart114@gmail.com> *
* Copyright (C) 2021-2026 by Robin Stuart <rstuart114@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -729,17 +729,17 @@ private slots:
QTest::newRow("BARCODE_AZTEC") << false << 0.0f << ""
<< BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode
<< "12345678Ж0%var%" << "" // text-primary
<< 0.0f << 1 << 0 << 0 << 4.0f << 0.0f << true << 0.9f << 1.0f // height-textGap
<< 0.0f << 1 << 0 << ZINT_AZTEC_FULL << 4.0f << 0.0f << true << 0.9f << 1.0f // height-textGap
<< 5.0f << 2 << 1 << "as\"dfa'sdf" // guardDescent-structAppID
<< "" << "" << QColor(Qt::blue) << QColor(Qt::white) << true // fgStr-cmyk
<< 0 << 0 << 2 << 3 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << false << 0 // showText-rotateAngle
<< 7 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 92 --cmyk --eci=7 -d '12345678Ж0%var%' --dotsize=0.9 --dotty --fg=0000FF --scale=4"
" --secure=1 --structapp='1,2,as\"dfa'\\''sdf' --vwhitesp=3 -w 2"
<< "zint.exe -b 92 --cmyk --eci=7 -d \"12345678Ж0%var%\" --dotsize=0.9 --dotty --fg=0000FF --scale=4"
" --secure=1 --structapp=\"1,2,as\\\"dfa'sdf\" --vwhitesp=3 -w 2"
<< "zint -b 92 --azfull --cmyk --eci=7 -d '12345678Ж0%var%' --dotsize=0.9 --dotty --fg=0000FF"
" --scale=4 --secure=1 --structapp='1,2,as\"dfa'\\''sdf' --vwhitesp=3 -w 2"
<< "zint.exe -b 92 --azfull --cmyk --eci=7 -d \"12345678Ж0%var%\" --dotsize=0.9 --dotty --fg=0000FF"
" --scale=4 --secure=1 --structapp=\"1,2,as\\\"dfa'sdf\" --vwhitesp=3 -w 2"
<< "" << "" << "" << "";
QTest::newRow("BARCODE_AZTEC (bgStr CMYK, fgStr CMYK)") << false << 0.0f << ""
+33 -22
View File
@@ -1,7 +1,7 @@
/* zint_tcl.c TCL binding for zint */
/*
zint - the open source tcl binding to the zint barcode library
Copyright (C) 2014-2025 Harald Oehlmann <oehhar@users.sourceforge.net>
Copyright (C) 2014-2026 Harald Oehlmann <oehhar@users.sourceforge.net>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -186,6 +186,9 @@
- Added: EAN8, EAN_2ADDON, EAN_5ADDON, EAN13, EAN8_CC, EAN13_CC, DMFILMEDGE
2025-12-17 HaO
- Added -gs1strict switch, copied from CLI program.
2026-02-20 GL
- Added -azfull switch.
- Fiddled with some help capitalization.
*/
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
@@ -547,6 +550,7 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n"
" Available options:\n"
" -barcode choice: symbology, use 'zint symbology' to get a list\n"
" -addongap integer: (7..12, default: 9) set add-on gap in multiple of module size (EAN/UPC-CC)\n"
" -azfull bool: force Aztec symbols to be Full (non-Compact) on automatic size selection\n"
" -bg color: set background color as 6 or 8 hex rrggbbaa\n"
/* cli option --binary internally handled */
" -bind bool: bars above/below the code, size set by -border\n"
@@ -558,21 +562,21 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n"
" -cols integer: Codablock F, DotCode, PDF417: number of columns\n"
" -compliantheight bool: warn if height not compliant, and use standard default\n"
/* cli option --data is standard parameter */
" -dmiso144 bool: Use ISO format for 144x144 Data Matrix symbols\n"
" -dmre bool: Allow Data Matrix Rectangular Extended\n"
" -dmiso144 bool: use ISO format for 144x144 Data Matrix symbols\n"
" -dmre bool: allow Data Matrix Rectangular Extended\n"
" -dotsize number: radius ratio of dots from 0.01 to 1.0\n"
" -dotty bool: use dots instead of boxes for matrix codes\n"
/* cli option --dump not supported */
/* cli option --ecinos not supported */
" -eci choice: ECI to use\n"
/* cli option --embedfont not supported (vector output only) */
" -esc bool: Process escape sequences in input data\n"
" -extraesc bool: Process symbology-specific escape sequences (Code 128 only)\n"
" -fast bool: use fast encodation (Data Matrix)\n"
" -esc bool: process escape sequences in input data\n"
" -extraesc bool: process symbology-specific escape sequences (Code 128 only)\n"
" -fast bool: use fast encodation (Aztec, Data Matrix, MicroPDF417, PDF417, QR, UPNQR)\n"
" -fg color: set foreground color as 6 or 8 hex rrggbbaa\n"
/* replaces cli options --binary and --gs1 */
" -format binary|unicode|gs1: input data format. Default:unicode\n"
" -fullmultibyte bool: allow multibyte compaction for xQR, HanXin, Gridmatrix\n"
" -fullmultibyte bool: allow multibyte compaction for xQR, HanXin, GridMatrix\n"
/* cli option --gs1 replaced by -format */
" -gs1nocheck bool: for gs1, do not check validity of data (allows non-standard symbols)\n"
" -gs1parens bool: for gs1, AIs enclosed in parentheses instead of square brackets\n"
@@ -581,13 +585,13 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n"
#else
" -gs1strict 0: GS1 syntax engine not compiled in, may not be activated.\n"
#endif
" -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n"
" -guarddescent double: Height of guard bar descent in modules (EAN/UPC only)\n"
" -gssep bool: for gs1, use gs as separator instead fnc1 (Data Matrix only)\n"
" -guarddescent double: height of guard bar descent in modules (EAN/UPC only)\n"
" -guardwhitespace bool: add quiet zone indicators (EAN/UPC only)\n"
" -height double: Symbol height in modules\n"
" -height double: symbol height in modules\n"
" -heightperrow bool: treat height as per-row\n"
/* cli option --input not supported */
" -init bool: Create reader initialisation symbol (Code 128, Data Matrix)\n"
" -init bool: create reader initialisation symbol (Code 128, Data Matrix)\n"
" -mask integer: set masking pattern to use (QR/MicroQR/HanXin/DotCode)\n"
/* cli option --mirror not supported */
" -mode integer: set encoding mode (MaxiCode, Composite)\n"
@@ -597,26 +601,26 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n"
/* cli option --output not supported */
" -primary text: Structured primary data (MaxiCode, Composite)\n"
" -quietzones bool: add compliant quiet zones to whitespace\n"
" -reverse bool: Reverse colours (white on black)\n"
" -rotate angle: Image rotation by 0,90 or 270 degrees\n"
" -reverse bool: reverse colours (white on black)\n"
" -rotate angle: image rotation by 0, 90 or 270 degrees\n"
" -rows integer: Codablock F, PDF417: number of rows\n"
" -scale double: Scale the image to this factor\n"
" -scalexdimdp {xdim ?resolution?}: Scale with X-dimension mm, resolution dpmm\n"
" -scmvv integer: Prefix SCM with [)>\\R01\\Gvv (vv is integer) (MaxiCode)\n"
" -scale double: scale the image to this factor\n"
" -scalexdimdp {xdim ?resolution?}: scale with X-dimension mm, resolution dpmm\n"
" -scmvv integer: prefix SCM with [)>\\R01\\Gvv (vv is integer) (MaxiCode)\n"
" -secure integer: EC Level (Aztec, GridMatrix, HanXin, PDF417, QR, UltraCode)\n"
" -segN {eci data}: Set the ECI & data content for segment N where N is 1 to 9\n"
" -segN {eci data}: set the ECI & data content for segment N where N is 1 to 9\n"
" -separator 0..4 (default: 1) : Stacked symbologies: separator width\n"
/* cli option --small replaced by -smalltext */
" -smalltext bool: tiny interpretation line font\n"
" -square bool: force Data Matrix symbols to be square\n"
" -structapp {index count ?id?}: set Structured Append info\n"
" -textgap double: Gap between barcode and text\n"
" -textgap double: gap between barcode and text\n"
/* cli option --types not supported */
" -vers integer: Symbology option\n"
" -vers integer: symbology option\n"
/* cli option --version not supported */
" -vwhitesp integer: vertical quiet zone in modules\n"
" -whitesp integer: horizontal quiet zone in modules\n"
" -werror bool: Convert all warnings into errors\n"
" -werror bool: convert all warnings into errors\n"
" -to {x0 y0 ?width? ?height?}: place to put in photo image\n"
"\n"
"zint symbologies: List available symbologies\n"
@@ -902,7 +906,8 @@ static int Encode(Tcl_Interp *interp, int objc,
/*--------------------------------------------------------------------*/
/* Option list and indexes */
static const char *optionList[] = {
"-addongap", "-barcode", "-bg", "-bind", "-bindtop", "-bold", "-border", "-box",
"-addongap", "-azfull",
"-barcode", "-bg", "-bind", "-bindtop", "-bold", "-border", "-box",
"-cols", "-compliantheight", "-dmiso144", "-dmre", "-dotsize", "-dotty",
"-eci", "-esc", "-extraesc", "-fast", "-fg", "-format", "-fullmultibyte",
"-gs1nocheck", "-gs1parens",
@@ -916,7 +921,8 @@ static int Encode(Tcl_Interp *interp, int objc,
"-textgap", "-to", "-vers", "-vwhitesp", "-werror", "-whitesp",
NULL};
enum iOption {
iAddonGap, iBarcode, iBG, iBind, iBindTop, iBold, iBorder, iBox,
iAddonGap, iAzFull,
iBarcode, iBG, iBind, iBindTop, iBold, iBorder, iBox,
iCols, iCompliantHeight, iDMISO144, iDMRE, iDotSize, iDotty,
iECI, iEsc, iExtraEsc, iFast, iFG, iFormat, iFullMultiByte,
iGS1NoCheck, iGS1Parens,
@@ -944,6 +950,7 @@ static int Encode(Tcl_Interp *interp, int objc,
/*--------------------------------------------------------------------*/
/* >> Decode object */
switch (optionIndex) {
case iAzFull:
case iBind:
case iBindTop:
case iBold:
@@ -1078,6 +1085,10 @@ static int Encode(Tcl_Interp *interp, int objc,
addon_gap = intValue;
}
break;
case iAzFull:
if (intValue)
my_symbol->option_3 = ZINT_AZTEC_FULL | (my_symbol->option_3 & ~0xFF);
break;
case iBind:
if (intValue) {
my_symbol->output_options |= BARCODE_BIND;
+17 -7
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">December 2025</p>
<p class="date">February 2026</p>
</header>
<nav id="TOC" role="doc-toc">
<ul>
@@ -7478,30 +7478,35 @@ Correction Modes</caption>
<tbody>
<tr>
<td>1</td>
<td>&gt;10% + 3 codewords</td>
<td>&gt;=10% + 3 codewords</td>
</tr>
<tr>
<td>2</td>
<td>&gt;23% + 3 codewords</td>
<td>&gt;=23% + 3 codewords</td>
</tr>
<tr>
<td>3</td>
<td>&gt;36% + 3 codewords</td>
<td>&gt;=36% + 3 codewords</td>
</tr>
<tr>
<td>4</td>
<td>&gt;50% + 3 codewords</td>
<td>&gt;=50% + 3 codewords</td>
</tr>
</tbody>
</table>
<p>It is not possible to select both symbol size and error correction
capacity for the same symbol. If both options are selected then the
error correction capacity selection will be ignored.</p>
<p>Compact symbols can be excluded from consideration on automatic
sizing by specifying <code>--azfull</code> (API
<code>symbol-&gt;option_3 = ZINT_AZTEC_FULL</code>).</p>
<p>Aztec Code supports ECI encoding and can encode up to a maximum
length of approximately 3823 numeric or 3067 alphabetic characters or
1914 bytes of data. A separate symbology ID
(<code>BARCODE_HIBC_AZTEC</code>) can be used to encode Health Industry
Barcode (HIBC) data.</p>
<p>For a faster but less optimal encodation, the <code>--fast</code>
option (API <code>input_mode |= FAST_MODE</code>) may be used.</p>
<p>Aztec Code supports Structured Append of up to 26 symbols and an
optional alphanumeric ID of up to 32 characters, which can be set by
using the <code>--structapp</code> option (see <a
@@ -8291,7 +8296,7 @@ alt="zint -b FLAT -d &quot;1304056&quot;" />
Information</h1>
<h2 id="license">7.1 License</h2>
<p>Zint, <code>libzint</code> and Zint Barcode Studio are Copyright ©
2025 Robin Stuart. All historical versions are distributed under the GNU
2026 Robin Stuart. All historical versions are distributed under the GNU
General Public License version 3 or later. Versions 2.5 and later are
released under a dual license: the encoding library is released under
the BSD (3 clause) license whereas the GUI, Zint Barcode Studio, and the
@@ -8977,6 +8982,11 @@ add-on. <em>INTEGER</em> is in integral multiples of the X-dimension.
The maximum gap that can be set is 12. The minimum is 7, except for
UPC-A, when the minimum is 9.</p>
</dd>
<dt><code>--azfull</code></dt>
<dd>
<p>For Aztec Code symbols, exclude Compact versions when considering
automatic sizes (i.e. consider Full versions only).</p>
</dd>
<dt><code>--batch</code></dt>
<dd>
<p>Treat each line of an input file specified with <code>-i</code> |
@@ -9681,7 +9691,7 @@ ISO/IEC 16390:2007, ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC
15438:2015, ISO/IEC 18004:2024, ISO/IEC 23941:2022, AIM ITS/04-023
(2022)</p>
<h2 id="copyright">COPYRIGHT</h2>
<p>Copyright © 2025 Robin Stuart. Released under GNU GPL 3.0 or
<p>Copyright © 2026 Robin Stuart. Released under GNU GPL 3.0 or
later.</p>
<h2 id="author">AUTHOR</h2>
<p>Robin Stuart <a href="mailto:robin@zint.org.uk"
+12 -6
View File
@@ -1,6 +1,6 @@
% Zint Barcode Generator and Zint Barcode Studio User Manual
% Version 2.16.0.9
% December 2025
% February 2026
# 1. Introduction
@@ -4708,10 +4708,10 @@ the `--secure` option (API `option_1`) to a value from the following table.
Mode Error Correction Capacity
---- -------------------------
1 >10% + 3 codewords
2 >23% + 3 codewords
3 >36% + 3 codewords
4 >50% + 3 codewords
1 >=10% + 3 codewords
2 >=23% + 3 codewords
3 >=36% + 3 codewords
4 >=50% + 3 codewords
Table: Aztec Code Error Correction Modes {#tbl:aztec_eccs}
@@ -4719,11 +4719,17 @@ It is not possible to select both symbol size and error correction capacity for
the same symbol. If both options are selected then the error correction capacity
selection will be ignored.
Compact symbols can be excluded from consideration on automatic sizing by
specifying `--azfull` (API `symbol->option_3 = ZINT_AZTEC_FULL`).
Aztec Code supports ECI encoding and can encode up to a maximum length of
approximately 3823 numeric or 3067 alphabetic characters or 1914 bytes of data.
A separate symbology ID (`BARCODE_HIBC_AZTEC`) can be used to encode Health
Industry Barcode (HIBC) data.
For a faster but less optimal encodation, the `--fast` option (API `input_mode
|= FAST_MODE`) may be used.
Aztec Code supports Structured Append of up to 26 symbols and an optional
alphanumeric ID of up to 32 characters, which can be set by using the
`--structapp` option (see [4.17 Structured Append]) (API `structapp`). The ID
@@ -5019,7 +5025,7 @@ maximum of 128 digits and does not include a check digit.
## 7.1 License
Zint, `libzint` and Zint Barcode Studio are Copyright © 2025 Robin Stuart. All
Zint, `libzint` and Zint Barcode Studio are Copyright © 2026 Robin Stuart. All
historical versions are distributed under the GNU General Public License version
3 or later. Versions 2.5 and later are released under a dual license: the
encoding library is released under the BSD (3 clause) license whereas the GUI,
+19 -8
View File
@@ -1,6 +1,6 @@
Zint Barcode Generator and Zint Barcode Studio User Manual
Version 2.16.0.9
December 2025
February 2026
*******************************************************************************
* For reference the following is a text-only version of the Zint manual, *
@@ -4510,10 +4510,10 @@ recommended, and anything less than 5% + 3 codewords will result in a warning).
Mode Error Correction Capacity
------ ---------------------------
1 >10% + 3 codewords
2 >23% + 3 codewords
3 >36% + 3 codewords
4 >50% + 3 codewords
1 >=10% + 3 codewords
2 >=23% + 3 codewords
3 >=36% + 3 codewords
4 >=50% + 3 codewords
Table 39: Aztec Code Error Correction Modes
@@ -4521,11 +4521,17 @@ It is not possible to select both symbol size and error correction capacity for
the same symbol. If both options are selected then the error correction capacity
selection will be ignored.
Compact symbols can be excluded from consideration on automatic sizing by
specifying --azfull (API symbol->option_3 = ZINT_AZTEC_FULL).
Aztec Code supports ECI encoding and can encode up to a maximum length of
approximately 3823 numeric or 3067 alphabetic characters or 1914 bytes of data.
A separate symbology ID (BARCODE_HIBC_AZTEC) can be used to encode Health
Industry Barcode (HIBC) data.
For a faster but less optimal encodation, the --fast option (API
input_mode |= FAST_MODE) may be used.
Aztec Code supports Structured Append of up to 26 symbols and an optional
alphanumeric ID of up to 32 characters, which can be set by using the
--structapp option (see 4.17 Structured Append) (API structapp). The ID cannot
@@ -4813,7 +4819,7 @@ maximum of 128 digits and does not include a check digit.
7.1 License
Zint, libzint and Zint Barcode Studio are Copyright © 2025 Robin Stuart. All
Zint, libzint and Zint Barcode Studio are Copyright © 2026 Robin Stuart. All
historical versions are distributed under the GNU General Public License version
3 or later. Versions 2.5 and later are released under a dual license: the
encoding library is released under the BSD (3 clause) license whereas the GUI,
@@ -5105,7 +5111,7 @@ configured barcode is updated when the "Generate" button is pressed.
Annex D. Man Page ZINT(1)
% ZINT(1) Version 2.16.0.9 % % December 2025
% ZINT(1) Version 2.16.0.9 % % February 2026
NAME
@@ -5152,6 +5158,11 @@ OPTIONS
INTEGER is in integral multiples of the X-dimension. The maximum gap that
can be set is 12. The minimum is 7, except for UPC-A, when the minimum is 9.
--azfull
For Aztec Code symbols, exclude Compact versions when considering automatic
sizes (i.e. consider Full versions only).
--batch
Treat each line of an input file specified with -i | --input as a separate
@@ -5819,7 +5830,7 @@ AIM ITS/04-023 (2022)
COPYRIGHT
Copyright © 2025 Robin Stuart. Released under GNU GPL 3.0 or later.
Copyright © 2026 Robin Stuart. Released under GNU GPL 3.0 or later.
AUTHOR
+6 -2
View File
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.8.3
.\"
.TH "ZINT" "1" "December 2025" "Version 2.16.0.9"
.TH "ZINT" "1" "February 2026" "Version 2.16.0.9"
.SH NAME
\f[CR]zint\f[R] \- encode data as a barcode image
.SH SYNOPSIS
@@ -46,6 +46,10 @@ add\-on.
The maximum gap that can be set is 12.
The minimum is 7, except for UPC\-A, when the minimum is 9.
.TP
\f[CR]\-\-azfull\f[R]
For Aztec Code symbols, exclude Compact versions when considering
automatic sizes (i.e.\ consider Full versions only).
.TP
\f[CR]\-\-batch\f[R]
Treat each line of an input file specified with \f[CR]\-i\f[R] |
\f[CR]\-\-input\f[R] as a separate data set and produce a barcode image
@@ -746,7 +750,7 @@ ISO/IEC 16390:2007, ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC
15438:2015, ISO/IEC 18004:2024, ISO/IEC 23941:2022, AIM ITS/04\-023
(2022)
.SH COPYRIGHT
Copyright © 2025 Robin Stuart.
Copyright © 2026 Robin Stuart.
Released under GNU GPL 3.0 or later.
.SH AUTHOR
Robin Stuart \c
+7 -2
View File
@@ -1,6 +1,6 @@
% ZINT(1) Version 2.16.0.9
%
% December 2025
% February 2026
# NAME
@@ -41,6 +41,11 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
: For EAN/UPC symbologies, set the gap between the main data and the add-on. *INTEGER* is in integral multiples of
the X-dimension. The maximum gap that can be set is 12. The minimum is 7, except for UPC-A, when the minimum is 9.
`--azfull`
: For Aztec Code symbols, exclude Compact versions when considering automatic sizes (i.e. consider Full versions
only).
`--batch`
: Treat each line of an input file specified with `-i` | `--input` as a separate data set and produce a barcode
@@ -668,7 +673,7 @@ ISO/IEC 18004:2024, ISO/IEC 23941:2022, AIM ITS/04-023 (2022)
# COPYRIGHT
Copyright © 2025 Robin Stuart. Released under GNU GPL 3.0 or later.
Copyright © 2026 Robin Stuart. Released under GNU GPL 3.0 or later.
# AUTHOR
+34 -28
View File
@@ -1,7 +1,7 @@
/* main.c - Command line handling routines for Zint */
/*
libzint - the open source barcode library
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2026 Robin Stuart <rstuart114@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -64,9 +64,9 @@ typedef char static_assert_int_at_least_32bits[sizeof(int) * CHAR_BIT < 32 ? -1
# define z_alloca(nmemb) alloca(nmemb)
#endif
#define z_isdigit(c) ((c) <= '9' && (c) >= '0')
#define z_isupper(c) ((c) >= 'A' && (c) <= 'Z')
#define z_islower(c) ((c) >= 'a' && (c) <= 'z')
#define z_isdigit(ch) ((ch) <= '9' && (ch) >= '0')
#define z_isupper(ch) ((ch) >= 'A' && (ch) <= 'Z')
#define z_islower(ch) ((ch) >= 'a' && (ch) <= 'z')
#define ZUCP(p) ((unsigned char *) (p))
#define ZCCP(p) ((const char *) (p))
@@ -170,30 +170,31 @@ static void usage(const int no_png, const int have_gs1syntaxengine) {
printf("Encode input data in a barcode and save as BMP/EMF/EPS/GIF/PCX%s/SVG/TIF/TXT\n\n", no_png_type);
fputs( " -b, --barcode=TYPE Number or name of barcode type. Default is 20 (CODE128)\n"
" --addongap=INTEGER Set add-on gap in multiples of X-dimension for EAN/UPC\n"
" --azfull Ignore Compact Aztec Codes on automatic size selection\n"
" --batch Treat each line of input file as a separate data set\n"
" --bg=COLOUR Specify a background colour (as RGB(A) or \"C,M,Y,K\")\n"
" --binary Treat input as raw binary data\n", stdout);
fputs( " --bind Add boundary bars\n"
" --bg=COLOUR Specify a background colour (as RGB(A) or \"C,M,Y,K\")\n", stdout);
fputs( " --binary Treat input as raw binary data\n"
" --bind Add boundary bars\n"
" --bindtop Add top boundary bar only\n"
" --bold Use bold text (HRT)\n"
" --border=INTEGER Set width of border in multiples of X-dimension\n"
" --box Add a box around the symbol\n", stdout);
fputs( " --cmyk Use CMYK colour space in EPS/TIF symbols\n"
" --border=INTEGER Set width of border in multiples of X-dimension\n", stdout);
fputs( " --box Add a box around the symbol\n"
" --cmyk Use CMYK colour space in EPS/TIF symbols\n"
" --cols=INTEGER Set the number of data columns in symbol\n"
" --compliantheight Warn if height not compliant, and use standard default\n"
" -d, --data=DATA Set the symbol data content (segment 0)\n"
" --direct Send output to stdout\n", stdout);
fputs( " --dmiso144 Use ISO format for 144x144 Data Matrix symbols\n"
" -d, --data=DATA Set the symbol data content (segment 0)\n", stdout);
fputs( " --direct Send output to stdout\n"
" --dmiso144 Use ISO format for 144x144 Data Matrix symbols\n"
" --dmre Allow Data Matrix Rectangular Extended\n"
" --dotsize=NUMBER Set radius of dots in dotty mode\n"
" --dotty Use dots instead of squares for matrix symbols\n"
" --dump Dump hexadecimal representation to stdout\n", stdout);
fputs( " -e, --ecinos Display ECI (Extended Channel Interpretation) table\n"
" --dotty Use dots instead of squares for matrix symbols\n", stdout);
fputs( " --dump Dump hexadecimal representation to stdout\n"
" -e, --ecinos Display ECI (Extended Channel Interpretation) table\n"
" --eci=INTEGER Set the ECI code for the data (segment 0)\n"
" --embedfont Embed font in vector output (SVG only)\n"
" --esc Process escape sequences in input data\n"
" --extraesc Process symbology-specific escape sequences (Code 128)\n", stdout);
fputs( " --fast Use faster encodation or other shortcuts if available\n"
" --esc Process escape sequences in input data\n", stdout);
fputs( " --extraesc Process symbology-specific escape sequences (Code 128)\n"
" --fast Use faster encodation or other shortcuts if available\n"
" --fg=COLOUR Specify a foreground colour (as RGB(A) or \"C,M,Y,K\")\n", stdout);
printf(" --filetype=TYPE Set output file type BMP/EMF/EPS/GIF/PCX%s/SVG/TIF/TXT\n", no_png_type);
fputs( " --fullmultibyte Use multibyte for binary/Latin (QR/Han Xin/Grid Matrix)\n"
@@ -1539,7 +1540,8 @@ int main(int argc, char **argv) {
opterr = 0; /* Disable `getopt_long_only()` printing errors */
while (1) {
enum options {
OPT_ADDONGAP = 128, OPT_BATCH, OPT_BINARY, OPT_BG, OPT_BIND, OPT_BIND_TOP, OPT_BOLD, OPT_BORDER, OPT_BOX,
OPT_ADDONGAP = 128, OPT_AZFULL,
OPT_BATCH, OPT_BINARY, OPT_BG, OPT_BIND, OPT_BIND_TOP, OPT_BOLD, OPT_BORDER, OPT_BOX,
OPT_CMYK, OPT_COLS, OPT_COMPLIANTHEIGHT,
OPT_DIRECT, OPT_DMISO144, OPT_DMRE, OPT_DOTSIZE, OPT_DOTTY, OPT_DUMP,
OPT_ECI, OPT_EMBEDFONT, OPT_ESC, OPT_EXTRAESC, OPT_FAST, OPT_FG, OPT_FILETYPE, OPT_FULLMULTIBYTE,
@@ -1557,6 +1559,7 @@ int main(int argc, char **argv) {
};
static const struct option long_options[] = {
{"addongap", 1, NULL, OPT_ADDONGAP},
{"azfull", 0, NULL, OPT_AZFULL},
{"barcode", 1, NULL, 'b'},
{"batch", 0, NULL, OPT_BATCH},
{"binary", 0, NULL, OPT_BINARY},
@@ -1643,10 +1646,10 @@ int main(int argc, char **argv) {
{"whitesp", 1, NULL, 'w'},
{NULL, 0, NULL, 0}
};
const int c = getopt_long_only(argc, argv, "b:d:ehi:o:rtvw:", long_options, NULL);
if (c == -1) break;
const int opt = getopt_long_only(argc, argv, "b:d:ehi:o:rtvw:", long_options, NULL);
if (opt == -1) break;
switch (c) {
switch (opt) {
case OPT_ADDONGAP:
if (!validate_int(optarg, -1 /*len*/, &val)) {
fprintf(stderr, "Error 139: Invalid add-on gap value (digits only)\n");
@@ -1660,6 +1663,9 @@ int main(int argc, char **argv) {
warn_number = ZINT_WARN_INVALID_OPTION;
}
break;
case OPT_AZFULL:
my_symbol->option_3 = ZINT_AZTEC_FULL | (my_symbol->option_3 & ~0xFF);
break;
case OPT_BATCH:
if (data_cnt == 0) {
/* Switch to batch processing mode */
@@ -2010,12 +2016,12 @@ int main(int argc, char **argv) {
case OPT_SEG8:
case OPT_SEG9:
if (batch_mode == 0) {
val = c - OPT_SEG1 + 1; /* Segment number */
val = opt - OPT_SEG1 + 1; /* Segment number */
if (segs[val].source) {
fprintf(stderr, "Error 164: Duplicate segment %d\n", val);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
if (!validate_seg(optarg, c - OPT_SEG1 + 1, segs, errbuf)) {
if (!validate_seg(optarg, opt - OPT_SEG1 + 1, segs, errbuf)) {
fprintf(stderr, "Error 166: %s\n", errbuf);
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
@@ -2160,7 +2166,7 @@ int main(int argc, char **argv) {
case 'd': /* we have some data! */
if (batch_mode == 0) {
arg_opts[data_arg_num].arg = optarg;
arg_opts[data_arg_num].opt = c;
arg_opts[data_arg_num].opt = opt;
data_arg_num++;
data_cnt++;
} else {
@@ -2173,7 +2179,7 @@ int main(int argc, char **argv) {
case 'i': /* Take data from file */
if (batch_mode == 0 || input_cnt == 0) {
arg_opts[data_arg_num].arg = optarg;
arg_opts[data_arg_num].opt = c;
arg_opts[data_arg_num].opt = opt;
data_arg_num++;
input_cnt++;
} else {
@@ -2219,7 +2225,7 @@ int main(int argc, char **argv) {
break;
default: /* Shouldn't happen */
fprintf(stderr, "Error 123: ?? getopt error 0%o\n", c); /* Not reached */
fprintf(stderr, "Error 123: ?? getopt error 0%o\n", opt); /* Not reached */
return do_exit(ZINT_ERROR_ENCODING_PROBLEM);
break;
}
+67 -66
View File
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020-2025 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -1006,71 +1006,72 @@ static void test_other_opts(const testCtx *const p_ctx) {
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
/* 0*/ { BARCODE_CODE128, "1", -1, " --test", "", "", 0 }, /* Do internal test */
/* 1*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900", "", 0 },
/* 2*/ { BARCODE_CODE128, "1", -1, " -bg=", "EF9900", "", 0 },
/* 3*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900AA", "", 0 },
/* 4*/ { BARCODE_CODE128, "1", -1, " --bg=", "GF9900", "Error 881: Malformed background RGB colour 'GF9900' (hexadecimal only)", 0 },
/* 5*/ { BARCODE_CODE128, "1", -1, " --bgcolor=", "EF9900", "", 0 },
/* 6*/ { BARCODE_CODE128, "1", -1, " --bgcolour=", "EF9900", "", 0 },
/* 7*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000", "", 0 },
/* 8*/ { BARCODE_CODE128, "1", -1, " --fg=", "00000000", "", 0 },
/* 9*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000F", "Error 880: Malformed foreground RGB colour (6 or 8 characters only)", 0 },
/* 10*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000FG", "Error 881: Malformed foreground RGB colour '000000FG' (hexadecimal only)", 0 },
/* 11*/ { BARCODE_CODE128, "1", -1, " --fg=", "0,0,0,100", "", 0 },
/* 12*/ { BARCODE_CODE128, "1", -1, " --fgcolor=", "111111", "", 0 },
/* 13*/ { BARCODE_CODE128, "1", -1, " --fgcolour=", "111111", "", 0 },
/* 14*/ { BARCODE_CODE128, "1", -1, " --compliantheight", "", "", 0 },
/* 15*/ { BARCODE_DATAMATRIX, "1", -1, " --dmiso144", "", "", 0 },
/* 16*/ { BARCODE_EANX, "123456", -1, " --guardwhitespace", "", "", 0 },
/* 17*/ { BARCODE_EANX, "123456", -1, " --embedfont", "", "", 0 },
/* 18*/ { BARCODE_CODE128, "1", -1, " --nobackground", "", "", 0 },
/* 19*/ { BARCODE_CODE128, "1", -1, " --noquietzones", "", "", 0 },
/* 20*/ { BARCODE_CODE128, "1", -1, " --notext", "", "", 0 },
/* 21*/ { BARCODE_CODE128, "1", -1, " --quietzones", "", "", 0 },
/* 22*/ { BARCODE_CODE128, "1", -1, " --reverse", "", "", 0 },
/* 23*/ { BARCODE_CODE128, "1", -1, " --werror", NULL, "", 0 },
/* 24*/ { 19, "1", -1, " --werror", NULL, "Error 207: Codabar 18 not supported", 0 },
/* 25*/ { BARCODE_GS1_128, "[01]12345678901231", -1, "", NULL, "", 0 },
/* 26*/ { BARCODE_GS1_128, "0112345678901231", -1, "", NULL, "Error 252: Data does not start with an AI", 0 },
/* 27*/ { BARCODE_GS1_128, "0112345678901231", -1, " --gs1nocheck", NULL, "Error 252: Data does not start with an AI", 0 },
/* 28*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, "", NULL, "", 0 },
/* 29*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, "", NULL, "Warning 261: AI (00) position 18: Bad checksum '8', expected '9'", 0 },
/* 30*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1nocheck", NULL, "", 0 },
/* 31*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --werror", NULL, "Error 261: AI (00) position 18: Bad checksum '8', expected '9'", 0 },
/* 32*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, " --gs1strict", NULL, "", 0 },
/* 33*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1strict", NULL, TEST_OTHER_OPTS_GS1STRICT_ERROR, 0 },
/* 34*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1", "Error 155: Invalid Structured Append argument, expect \"index,count[,ID]\"", 0 },
/* 35*/ { BARCODE_AZTEC, "1", -1, " --structapp=", ",", "Error 155: Structured Append index too short", 0 },
/* 36*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1234567890,", "Error 155: Structured Append index too long", 0 },
/* 37*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,", "Error 155: Structured Append count too short", 0 },
/* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890", "Error 155: Structured Append count too long", 0 },
/* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,", "Error 155: Structured Append ID too short", 0 },
/* 40*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,123456789012345678901234567890123", "Error 155: Structured Append ID too long", 0 },
/* 41*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,12345678901234567890123456789012", "Error 701: Structured Append count '123456789' out of range (2 to 26)", 0 },
/* 42*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,26,12345678901234567890123456789012", "", 0 },
/* 43*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "A,26,12345678901234567890123456789012", "Error 155: Invalid Structured Append index (digits only)", 0 },
/* 44*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,A,12345678901234567890123456789012", "Error 155: Invalid Structured Append count (digits only)", 0 },
/* 45*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,1,12345678901234567890123456789012", "Error 155: Invalid Structured Append count '1', must be greater than or equal to 2", 0 },
/* 46*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "0,2,12345678901234567890123456789012", "Error 155: Structured Append index '0' out of range (1 to count '2')", 0 },
/* 47*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "3,2,12345678901234567890123456789012", "Error 155: Structured Append index '3' out of range (1 to count '2')", 0 },
/* 48*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "", 0 },
/* 49*/ { BARCODE_PDF417, "1", -1, " --heightperrow", "", "", 0 },
/* 50*/ { -1, NULL, -1, " -v", NULL, "Zint version ", 1 },
/* 51*/ { -1, NULL, -1, " --version", NULL, "Zint version ", 1 },
/* 52*/ { -1, NULL, -1, " -h", NULL, "Encode input data in a barcode ", 1 },
/* 53*/ { -1, NULL, -1, " -e", NULL, "3: ISO/IEC 8859-1 ", 1 },
/* 54*/ { -1, NULL, -1, " -t", NULL, "1 CODE11 ", 1 },
/* 55*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12345678", "Error 184: scalexdimdp X-dim invalid floating point: integer part must be 7 digits maximum", 0 },
/* 56*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234567890123", "Error 184: scalexdimdp X-dim too long", 0 },
/* 57*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "123456.12", "Error 184: scalexdimdp X-dim invalid floating point: 7 significant digits maximum", 0 },
/* 58*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", ",12.34", "Error 184: scalexdimdp X-dim too short", 0 },
/* 59*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34,", "Error 184: scalexdimdp resolution too short", 0 },
/* 60*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12mm1", "Error 184: scalexdimdp X-dim unknown units: mm1", 0 },
/* 61*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1inc", "Error 184: scalexdimdp X-dim unknown units: inc", 0 },
/* 62*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34in,123x", "Error 184: scalexdimdp resolution unknown units: x", 0 },
/* 63*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12,123.45678", "Error 184: scalexdimdp resolution invalid floating point: 7 significant digits maximum", 0 },
/* 64*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10.1,1000", "Warning 185: scalexdimdp X-dim '10.1' out of range (greater than 10), **IGNORED**", 0 },
/* 65*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10,1000.1", "Warning 186: scalexdimdp resolution '1000.1' out of range (greater than 1000), **IGNORED**", 0 },
/* 1*/ { BARCODE_AZTEC, "1", -1, " --azfull", "", "", 0 },
/* 2*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900", "", 0 },
/* 3*/ { BARCODE_CODE128, "1", -1, " -bg=", "EF9900", "", 0 },
/* 4*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900AA", "", 0 },
/* 5*/ { BARCODE_CODE128, "1", -1, " --bg=", "GF9900", "Error 881: Malformed background RGB colour 'GF9900' (hexadecimal only)", 0 },
/* 6*/ { BARCODE_CODE128, "1", -1, " --bgcolor=", "EF9900", "", 0 },
/* 7*/ { BARCODE_CODE128, "1", -1, " --bgcolour=", "EF9900", "", 0 },
/* 8*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000", "", 0 },
/* 9*/ { BARCODE_CODE128, "1", -1, " --fg=", "00000000", "", 0 },
/* 10*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000F", "Error 880: Malformed foreground RGB colour (6 or 8 characters only)", 0 },
/* 11*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000FG", "Error 881: Malformed foreground RGB colour '000000FG' (hexadecimal only)", 0 },
/* 12*/ { BARCODE_CODE128, "1", -1, " --fg=", "0,0,0,100", "", 0 },
/* 13*/ { BARCODE_CODE128, "1", -1, " --fgcolor=", "111111", "", 0 },
/* 14*/ { BARCODE_CODE128, "1", -1, " --fgcolour=", "111111", "", 0 },
/* 15*/ { BARCODE_CODE128, "1", -1, " --compliantheight", "", "", 0 },
/* 16*/ { BARCODE_DATAMATRIX, "1", -1, " --dmiso144", "", "", 0 },
/* 17*/ { BARCODE_EANX, "123456", -1, " --guardwhitespace", "", "", 0 },
/* 18*/ { BARCODE_EANX, "123456", -1, " --embedfont", "", "", 0 },
/* 19*/ { BARCODE_CODE128, "1", -1, " --nobackground", "", "", 0 },
/* 20*/ { BARCODE_CODE128, "1", -1, " --noquietzones", "", "", 0 },
/* 21*/ { BARCODE_CODE128, "1", -1, " --notext", "", "", 0 },
/* 22*/ { BARCODE_CODE128, "1", -1, " --quietzones", "", "", 0 },
/* 23*/ { BARCODE_CODE128, "1", -1, " --reverse", "", "", 0 },
/* 24*/ { BARCODE_CODE128, "1", -1, " --werror", NULL, "", 0 },
/* 25*/ { 19, "1", -1, " --werror", NULL, "Error 207: Codabar 18 not supported", 0 },
/* 26*/ { BARCODE_GS1_128, "[01]12345678901231", -1, "", NULL, "", 0 },
/* 27*/ { BARCODE_GS1_128, "0112345678901231", -1, "", NULL, "Error 252: Data does not start with an AI", 0 },
/* 28*/ { BARCODE_GS1_128, "0112345678901231", -1, " --gs1nocheck", NULL, "Error 252: Data does not start with an AI", 0 },
/* 29*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, "", NULL, "", 0 },
/* 30*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, "", NULL, "Warning 261: AI (00) position 18: Bad checksum '8', expected '9'", 0 },
/* 31*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1nocheck", NULL, "", 0 },
/* 32*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --werror", NULL, "Error 261: AI (00) position 18: Bad checksum '8', expected '9'", 0 },
/* 33*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, " --gs1strict", NULL, "", 0 },
/* 34*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1strict", NULL, TEST_OTHER_OPTS_GS1STRICT_ERROR, 0 },
/* 35*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1", "Error 155: Invalid Structured Append argument, expect \"index,count[,ID]\"", 0 },
/* 36*/ { BARCODE_AZTEC, "1", -1, " --structapp=", ",", "Error 155: Structured Append index too short", 0 },
/* 37*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1234567890,", "Error 155: Structured Append index too long", 0 },
/* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,", "Error 155: Structured Append count too short", 0 },
/* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890", "Error 155: Structured Append count too long", 0 },
/* 40*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,", "Error 155: Structured Append ID too short", 0 },
/* 41*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,123456789012345678901234567890123", "Error 155: Structured Append ID too long", 0 },
/* 42*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,12345678901234567890123456789012", "Error 701: Structured Append count '123456789' out of range (2 to 26)", 0 },
/* 43*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,26,12345678901234567890123456789012", "", 0 },
/* 44*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "A,26,12345678901234567890123456789012", "Error 155: Invalid Structured Append index (digits only)", 0 },
/* 45*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,A,12345678901234567890123456789012", "Error 155: Invalid Structured Append count (digits only)", 0 },
/* 46*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,1,12345678901234567890123456789012", "Error 155: Invalid Structured Append count '1', must be greater than or equal to 2", 0 },
/* 47*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "0,2,12345678901234567890123456789012", "Error 155: Structured Append index '0' out of range (1 to count '2')", 0 },
/* 48*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "3,2,12345678901234567890123456789012", "Error 155: Structured Append index '3' out of range (1 to count '2')", 0 },
/* 49*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "", 0 },
/* 50*/ { BARCODE_PDF417, "1", -1, " --heightperrow", "", "", 0 },
/* 51*/ { -1, NULL, -1, " -v", NULL, "Zint version ", 1 },
/* 52*/ { -1, NULL, -1, " --version", NULL, "Zint version ", 1 },
/* 53*/ { -1, NULL, -1, " -h", NULL, "Encode input data in a barcode ", 1 },
/* 54*/ { -1, NULL, -1, " -e", NULL, "3: ISO/IEC 8859-1 ", 1 },
/* 55*/ { -1, NULL, -1, " -t", NULL, "1 CODE11 ", 1 },
/* 56*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12345678", "Error 184: scalexdimdp X-dim invalid floating point: integer part must be 7 digits maximum", 0 },
/* 57*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234567890123", "Error 184: scalexdimdp X-dim too long", 0 },
/* 58*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "123456.12", "Error 184: scalexdimdp X-dim invalid floating point: 7 significant digits maximum", 0 },
/* 59*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", ",12.34", "Error 184: scalexdimdp X-dim too short", 0 },
/* 60*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34,", "Error 184: scalexdimdp resolution too short", 0 },
/* 61*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12mm1", "Error 184: scalexdimdp X-dim unknown units: mm1", 0 },
/* 62*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1inc", "Error 184: scalexdimdp X-dim unknown units: inc", 0 },
/* 63*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34in,123x", "Error 184: scalexdimdp resolution unknown units: x", 0 },
/* 64*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12,123.45678", "Error 184: scalexdimdp resolution invalid floating point: 7 significant digits maximum", 0 },
/* 65*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10.1,1000", "Warning 185: scalexdimdp X-dim '10.1' out of range (greater than 10), **IGNORED**", 0 },
/* 66*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10,1000.1", "Warning 186: scalexdimdp resolution '1000.1' out of range (greater than 1000), **IGNORED**", 0 },
};
int data_size = ARRAY_SIZE(data);
int i;
+38 -6
View File
@@ -40,6 +40,21 @@ be set based on data</string>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="chkAztecFull">
<property name="text">
<string>Full O&amp;nly</string>
</property>
<property name="toolTip">
<string>Only consider Full versions on automatic symbol
size selection, suppressing Compact versions
(ignored if disabled)</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="txtAztecAutoInfo">
<property name="frame">
<bool>false</bool>
@@ -47,6 +62,9 @@ be set based on data</string>
<property name="readonly">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
@@ -62,7 +80,7 @@ be set based on data</string>
</attribute>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="cmbAztecSize">
<property name="maxVisibleItems">
<number>21</number>
@@ -269,7 +287,7 @@ for error correction codewords</string>
</attribute>
</widget>
</item>
<item row="2" column="1">
<item row="2" column="1" colspan="2">
<widget class="QComboBox" name="cmbAztecECC">
<property name="enabled">
<bool>false</bool>
@@ -280,22 +298,22 @@ for error correction codewords</string>
</property>
<item>
<property name="text">
<string>10% + 3 words</string>
<string>&gt;=10% + 3 words</string>
</property>
</item>
<item>
<property name="text">
<string>23% + 3 words</string>
<string>&gt;=23% + 3 words</string>
</property>
</item>
<item>
<property name="text">
<string>36% + 3 words</string>
<string>&gt;=36% + 3 words</string>
</property>
</item>
<item>
<property name="text">
<string>50% + 3 words</string>
<string>&gt;=50% + 3 words</string>
</property>
</item>
</widget>
@@ -354,6 +372,20 @@ the data with a slash &quot;/&quot;</string>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkAztecFast">
<property name="text">
<string>&amp;Fast encoding</string>
</property>
<property name="toolTip">
<string>Use a faster but less optimal algorithm
for encoding the data</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxAztecStructApp">
<property name="title">
+6
View File
@@ -10,6 +10,12 @@
<height>131</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
+77 -25
View File
@@ -1,6 +1,6 @@
/***************************************************************************
* Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
* Copyright (C) 2009-2025 by Robin Stuart <rstuart114@gmail.com> *
* Copyright (C) 2009-2026 by Robin Stuart <rstuart114@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -46,6 +46,8 @@
#include "scalewindow.h"
#include "sequencewindow.h"
#define ARRAY_SIZE(x) ((int) (sizeof(x) / sizeof((x)[0])))
// Shorthand
#define QSL QStringLiteral
#define QSEmpty QLatin1String("")
@@ -229,7 +231,7 @@ void MainWindow::mac_hack_statusBars(QWidget *win, const char* name)
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
: QWidget(parent, fl), m_previewBgColor(0xF4, 0xF4, 0xF4), m_optionWidget(nullptr), m_symbology(0),
m_menu(nullptr),
m_aztecSizeIndex(-1), m_aztecECCIndex(-1), m_menu(nullptr),
m_lblHeightPerRow(nullptr), m_spnHeightPerRow(nullptr),
m_btnHeightPerRowDisable(nullptr), m_btnHeightPerRowDefault(nullptr),
m_scaleWindow(nullptr)
@@ -290,7 +292,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
connect(txt_fgcolor, SIGNAL(textEdited(QString)), this, SLOT(fgcolor_edited()));
connect(txt_bgcolor, SIGNAL(textEdited(QString)), this, SLOT(bgcolor_edited()));
const int cnt = (int) (sizeof(bstyle_items) / sizeof(bstyle_items[0]));
const int cnt = ARRAY_SIZE(bstyle_items);
for (int i = 0; i < cnt; i++) {
bstyle->addItem(bstyle_items[i].text);
}
@@ -1290,6 +1292,22 @@ void MainWindow::eanaddon_no_quiet_zones_ui_set()
}
}
void MainWindow::aztec_size_index_changed()
{
if (get_rad_val(QSL("radAztecSize"))) {
m_aztecSizeIndex = get_cmb_index(QSL("cmbAztecSize"));
}
update_preview();
}
void MainWindow::aztec_ecc_index_changed()
{
if (get_rad_val(QSL("radAztecECC"))) {
m_aztecECCIndex = get_cmb_index(QSL("cmbAztecECC"));
}
update_preview();
}
void MainWindow::structapp_ui_set()
{
int symbology = bstyle_items[bstyle->currentIndex()].symbology;
@@ -1425,7 +1443,7 @@ void MainWindow::filter_symbologies()
filter_list << filter.mid(i);
}
int filter_cnt = filter_list.size();
int cnt = (int) (sizeof(bstyle_items) / sizeof(bstyle_items[0]));
int cnt = ARRAY_SIZE(bstyle_items);
if (filter_cnt) {
for (int i = 0; i < cnt; i++) {
@@ -1822,11 +1840,13 @@ void MainWindow::change_options()
connect(get_widget(QSL("radAztecAuto")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radAztecSize")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radAztecECC")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("cmbAztecSize")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("cmbAztecECC")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("cmbAztecSize")), SIGNAL(currentIndexChanged(int)), SLOT(aztec_size_index_changed()));
connect(get_widget(QSL("cmbAztecECC")), SIGNAL(currentIndexChanged(int)), SLOT(aztec_ecc_index_changed()));
connect(get_widget(QSL("radAztecStand")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radAztecGS1")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radAztecHIBC")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("chkAztecFull")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("chkAztecFast")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("cmbAztecStructAppCount")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
connect(get_widget(QSL("cmbAztecStructAppCount")), SIGNAL(currentIndexChanged(int)),
SLOT(structapp_ui_set()));
@@ -2921,14 +2941,26 @@ void MainWindow::update_preview()
else
m_bc.bc.setSymbol(BARCODE_AZTEC);
if (get_rad_val(QSL("radAztecSize")))
if (get_rad_val(QSL("radAztecSize"))) {
m_bc.bc.setOption2(get_cmb_index(QSL("cmbAztecSize")) + 1);
m_optionWidget->findChild<QCheckBox*>(QSL("chkAztecFull"))->setEnabled(false);
m_bc.bc.setOption3(0);
} else {
m_optionWidget->findChild<QCheckBox*>(QSL("chkAztecFull"))->setEnabled(true);
if (m_optionWidget->findChild<QCheckBox*>(QSL("chkAztecFull"))->isChecked()) {
m_bc.bc.setOption3(ZINT_AZTEC_FULL);
}
}
if (get_rad_val(QSL("radAztecECC")))
m_bc.bc.setOption1(get_cmb_index(QSL("cmbAztecECC")) + 1);
set_gs1_mode(get_rad_val(QSL("radAztecGS1")));
if (get_chk_val(QSL("chkAztecFast"))) {
m_bc.bc.setInputMode(FAST_MODE | m_bc.bc.inputMode());
}
if ((item_val = get_cmb_index(QSL("cmbAztecStructAppCount"))) != 0) {
m_bc.bc.setStructApp(item_val + 1, get_cmb_index(QSL("cmbAztecStructAppIndex")) + 1,
get_txt_val(QSL("txtAztecStructAppID")));
@@ -3665,30 +3697,30 @@ void MainWindow::automatic_info_set()
if (symbology == BARCODE_AZTEC || symbology == BARCODE_HIBC_AZTEC) {
if ((txt = m_optionWidget->findChild<QLineEdit*>(QSL("txtAztecAutoInfo")))) {
if (!isError) {
const int w = m_bc.bc.encodedWidth();
const int z = m_bc.bc.encodedOption2();
const int ecc = m_bc.bc.encodedOption1() >> 8; // Percentage
QString sizeStr, eccStr;
if (z >= 1 && z <= 36) {
if (z <= 4) {
sizeStr = QSL("%1 X %2 Compact (Zint %3)").arg(w).arg(w).arg(z);
} else {
sizeStr = QSL("%1 X %2 (%3 Layers) (Zint %4)").arg(w).arg(w).arg(z - 4).arg(z);
}
}
QString eccStr;
if (ecc > 0 && ecc < 100) {
eccStr = QSL("%1% + 3 words").arg(ecc);
} else {
eccStr = QSL("3 words");
}
if (get_rad_val("radAztecAuto") && !sizeStr.isEmpty() && !eccStr.isEmpty()) {
txt->setText(QSL("%1, ECC %2").arg(sizeStr).arg(eccStr));
} else if (get_rad_val("radAztecSize") && !eccStr.isEmpty()) {
txt->setText(QSL("ECC %1").arg(eccStr));
} else if (get_rad_val("radAztecECC") && !sizeStr.isEmpty()) {
txt->setText(sizeStr);
if (get_rad_val("radAztecSize")) {
set_cmb_index(QSL("cmbAztecSize"), 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);
} else {
txt->setText(QSEmpty);
static int ecc_percents[] = { 10, 23, 36, 50 };
for (int i = ARRAY_SIZE(ecc_percents) - 1; i >= 0; i--) {
if (ecc >= ecc_percents[i]) {
set_cmb_index(QSL("cmbAztecECC"), i);
break;
}
}
}
} else {
txt->setText(QSEmpty);
@@ -4130,6 +4162,15 @@ int MainWindow::get_cmb_index(const QString &name)
return comboBox ? comboBox->currentIndex() : 0;
}
/* Helper to set item in combobox from index in settings, checking for NULL */
void MainWindow::set_cmb_index(const QString &name, const int index)
{
QComboBox *comboBox = m_optionWidget ? m_optionWidget->findChild<QComboBox*>(name) : nullptr;
if (comboBox) {
comboBox->setCurrentIndex(index);
}
}
/* Helper to set item in combobox from index in settings, checking for NULL */
void MainWindow::set_cmb_from_setting(QSettings &settings, const QString &setting, const QString &name,
int default_val)
@@ -4326,11 +4367,13 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
case BARCODE_HIBC_AZTEC:
settings.setValue(QSL("studio/bc/aztec/autoresizing"), get_rad_grp_index(
QStringList() << QSL("radAztecAuto") << QSL("radAztecSize") << QSL("radAztecECC")));
settings.setValue(QSL("studio/bc/aztec/size"), get_cmb_index(QSL("cmbAztecSize")));
settings.setValue(QSL("studio/bc/aztec/ecc"), get_cmb_index(QSL("cmbAztecECC")));
settings.setValue(QSL("studio/bc/aztec/size"), m_aztecSizeIndex);
settings.setValue(QSL("studio/bc/aztec/ecc"), m_aztecECCIndex);
settings.setValue(QSL("studio/bc/aztec/encoding_mode"), get_rad_grp_index(
QStringList() << QSL("radAztecStand") << QSL("radAztecGS1") << QSL("radAztecHIBC")));
settings.setValue(QSL("studio/bc/aztec/structapp_count"), get_cmb_index(QSL("cmbAztecStructAppCount")));
settings.setValue(QSL("studio/bc/aztec/chk_full"), get_chk_val(QSL("chkAztecFull")));
settings.setValue(QSL("studio/bc/aztec/chk_fast"), get_chk_val(QSL("chkAztecFast")));
settings.setValue(QSL("studio/bc/aztec/structapp_index"), get_cmb_index(QSL("cmbAztecStructAppIndex")));
settings.setValue(QSL("studio/bc/aztec/structapp_id"), get_txt_val(QSL("txtAztecStructAppID")));
break;
@@ -4789,10 +4832,19 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
case BARCODE_HIBC_AZTEC:
set_rad_from_setting(settings, QSL("studio/bc/aztec/autoresizing"),
QStringList() << QSL("radAztecAuto") << QSL("radAztecSize") << QSL("radAztecECC"));
set_cmb_from_setting(settings, QSL("studio/bc/aztec/size"), QSL("cmbAztecSize"));
m_aztecSizeIndex = settings.value(QSL("studio/bc/aztec/size"), -1).toInt();
if (get_rad_val(QSL("radAztecSize"))) {
set_cmb_index(QSL("cmbAztecSize"), m_aztecSizeIndex);
}
m_aztecECCIndex = settings.value(QSL("studio/bc/aztec/ecc"), -1).toInt();
if (get_rad_val(QSL("radAztecECC"))) {
set_cmb_index(QSL("cmbAztecECC"), m_aztecECCIndex);
}
set_cmb_from_setting(settings, QSL("studio/bc/aztec/ecc"), QSL("cmbAztecECC"));
set_rad_from_setting(settings, QSL("studio/bc/aztec/encoding_mode"),
QStringList() << QSL("radAztecStand") << QSL("radAztecGS1") << QSL("radAztecHIBC"));
set_chk_from_setting(settings, QSL("studio/bc/aztec/chk_full"), QSL("chkAztecFull"));
set_chk_from_setting(settings, QSL("studio/bc/aztec/chk_fast"), QSL("chkAztecFast"));
set_cmb_from_setting(settings, QSL("studio/bc/aztec/structapp_count"), QSL("cmbAztecStructAppCount"));
set_cmb_from_setting(settings, QSL("studio/bc/aztec/structapp_index"), QSL("cmbAztecStructAppIndex"));
set_txt_from_setting(settings, QSL("studio/bc/aztec/structapp_id"), QSL("txtAztecStructAppID"), QSEmpty);
+6 -1
View File
@@ -1,6 +1,6 @@
/***************************************************************************
* Copyright (C) 2008 by BogDan Vatra <bogdan@licentia.eu> *
* Copyright (C) 2009-2024 by Robin Stuart <rstuart114@gmail.com> *
* Copyright (C) 2009-2026 by Robin Stuart <rstuart114@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -75,6 +75,8 @@ public slots:
void upcean_no_quiet_zones_ui_set();
void upcae_no_quiet_zones_ui_set();
void eanaddon_no_quiet_zones_ui_set();
void aztec_size_index_changed();
void aztec_ecc_index_changed();
void structapp_ui_set();
void clear_text_gap();
void on_encoded();
@@ -183,6 +185,7 @@ protected:
bool get_rad_val(const QString &name);
int get_cmb_index(const QString &name);
void set_cmb_index(const QString &name, const int index);
void set_cmb_from_setting(QSettings &settings, const QString &setting, const QString &name, int default_val = 0);
int get_chk_val(const QString &name);
@@ -215,6 +218,8 @@ private:
QWidget *m_optionWidget;
QGraphicsScene *scene;
int m_symbology;
int m_aztecSizeIndex;
int m_aztecECCIndex;
QMenu *m_menu;
QShortcut *m_saveAsShortcut;
QShortcut *m_factoryResetShortcut;