1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-06-09 23:23:36 +00:00

GS1: new GS1RAW_MODE (CLI "--gs1raw") and GS1 Syntax Engine

"Unbracketed AI" (caret) options for specifying GS1 input
  (ticket #350, props Mario Verbruggen)
DBAR_EXP_CC/DBAR_EXPSTK_CC: fix separator over finder patterns
  when linear part is greater than 4 codeblocks
general: left-over raw_text -> content_segs in comments;
  update & expand some GS1 General Specs refs;
  some minor code fiddling
test suite: suppress some additional ZINT_SANITIZEM false positives
  (& add new ZINT_TESTUTIL_SANITIZEM_INIT helpers)
This commit is contained in:
gitlost
2026-02-26 15:05:45 +00:00
parent 3b24d129d7
commit 0a8a79fa6c
59 changed files with 7504 additions and 4206 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
Version 2.16.0.9 (dev) not released yet (2026-02-05) Version 2.16.0.9 (dev) not released yet (2026-02-26)
==================================================== ====================================================
**Incompatible changes** **Incompatible changes**
@@ -7,6 +7,8 @@ Version 2.16.0.9 (dev) not released yet (2026-02-05)
(may cause symbol size change, and generation failure if specified) (may cause symbol size change, and generation failure if specified)
- Improved Aztec encodation algorithm (may cause symbol size change) - Improved Aztec encodation algorithm (may cause symbol size change)
- New Qt Backend method `save_as_memfile()` to save file to memory - New Qt Backend method `save_as_memfile()` to save file to memory
- New Qt Backend methods `gs1Raw()` and `setGS1Raw()` for new `GS1RAW_MODE`
option for processing GS1 input
Changes Changes
------- -------
@@ -21,6 +23,9 @@ Changes
"--fast" (input_mode |= FAST_MODE) "--fast" (input_mode |= FAST_MODE)
- AZTEC: add new option "--azfull" (option_3 = ZINT_AZTEC_FULL) to only - AZTEC: add new option "--azfull" (option_3 = ZINT_AZTEC_FULL) to only
consider Full symbols (not Compact ones) on automatic sizing consider Full symbols (not Compact ones) on automatic sizing
- GS1: new `GS1RAW_MODE` (CLI "--gs1raw") and GS1 Syntax Engine "Unbracketed AI
element strings" (caret) options for specifying GS1 input (ticket #350, props
Mario Verbruggen)
Bugs Bugs
---- ----
@@ -34,6 +39,8 @@ Bugs
- AZTEC: fix ECC to be at least advertised percentages (ticket #347, props - AZTEC: fix ECC to be at least advertised percentages (ticket #347, props
Francois Grieu) Francois Grieu)
- CODE32/PZN: fix not restoring `option_2` (props axxel) - CODE32/PZN: fix not restoring `option_2` (props axxel)
- DBAR_EXP_CC/DBAR_EXPSTK_CC: fix separator over finder patterns when linear
part is greater than 4 codeblocks
Version 2.16.0 (2025-12-19) Version 2.16.0 (2025-12-19)
+4 -4
View File
@@ -1,7 +1,7 @@
/* 2of5_based.c - Handles Code 2 of 5 Interleaved derivatives ITF-14, DP Leitcode and DP Identcode */ /* 2of5_based.c - Handles Code 2 of 5 Interleaved derivatives ITF-14, DP Leitcode and DP Identcode */
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -109,7 +109,7 @@ INTERNAL int zint_itf14(struct zint_symbol *symbol, unsigned char source[], int
z_hrt_cpy_nochk(symbol, local_source, 14); z_hrt_cpy_nochk(symbol, local_source, 14);
/* Use `raw_text` set by `zint_c25_inter_common()` */ /* Use `content_segs` set by `zint_c25_inter_common()` */
return error_number; return error_number;
} }
@@ -161,7 +161,7 @@ INTERNAL int zint_dpleit(struct zint_symbol *symbol, unsigned char source[], int
z_hrt_printf_nochk(symbol, "%.5s.%.3s.%.3s.%.3s", local_source, local_source + 5, local_source + 8, z_hrt_printf_nochk(symbol, "%.5s.%.3s.%.3s.%.3s", local_source, local_source + 5, local_source + 8,
local_source + 11); local_source + 11);
/* Use `raw_text` set by `zint_c25_inter_common()` */ /* Use `content_segs` set by `zint_c25_inter_common()` */
return error_number; return error_number;
} }
@@ -204,7 +204,7 @@ INTERNAL int zint_dpident(struct zint_symbol *symbol, unsigned char source[], in
z_hrt_printf_nochk(symbol, "%.2s.%.2s %c.%.3s.%.3s %c", local_source, local_source + 2, local_source[4], z_hrt_printf_nochk(symbol, "%.2s.%.2s %c.%.3s.%.3s %c", local_source, local_source + 2, local_source[4],
local_source + 5, local_source + 8, local_source[11]); local_source + 5, local_source + 8, local_source[11]);
/* Use `raw_text` set by `zint_c25_inter_common()` */ /* Use `content_segs` set by `zint_c25_inter_common()` */
return error_number; return error_number;
} }
+1 -1
View File
@@ -107,7 +107,7 @@ endif()
if(NOT ZINT_SANITIZE AND ZINT_SANITIZEM AND CMAKE_C_COMPILER_ID MATCHES "Clang") if(NOT ZINT_SANITIZE AND ZINT_SANITIZEM AND CMAKE_C_COMPILER_ID MATCHES "Clang")
add_compile_options(-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -O2) add_compile_options(-fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -O2)
link_libraries(-fsanitize=memory) link_libraries(-fsanitize=memory)
zint_target_compile_definitions(PRIVATE ZINT_SANITIZEM) zint_target_compile_definitions(PUBLIC ZINT_SANITIZEM)
endif() endif()
if(ZINT_TEST) if(ZINT_TEST)
+121
View File
@@ -0,0 +1,121 @@
/* aztec_trace.h - Trace routines for optimized AZTEC encodation algorithm */
/*
libzint - the open source barcode library
Copyright (C) 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
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef Z_AZTEC_TRACE_H
#define Z_AZTEC_TRACE_H
static void AZ_TRACE_EdgeToString(char *buf, const unsigned char *source, const int length, const char initial_mode,
struct az_edge *edges, struct az_edge *edge) {
struct az_edge *previous_edge = AZ_PREVIOUS(edges, edge);
int previousMode = previous_edge ? previous_edge->mode : initial_mode;
int previous = previous_edge ? (int) (previous_edge - edges) : 0;
int current = (int) (edge - edges);
(void)length;
if (buf) {
sprintf(buf, "%d_%c_%d %c(%d,%d) %d -> %d_%c_%d",
edge->from, az_mode_char(previousMode), previous, az_mode_char(edge->mode), source[edge->from], edge->len,
edge->size, edge->from + 1, az_mode_char(edge->mode), current);
} else {
printf("%d_%c_%d %c(%d,%d) %d -> %d_%c_%d",
edge->from, az_mode_char(previousMode), previous, az_mode_char(edge->mode), source[edge->from], edge->len,
edge->size, edge->from + 1, az_mode_char(edge->mode), current);
}
}
static void AZ_TRACE_Path(const unsigned char *source, const int length, const char initial_mode,
struct az_edge *edges, struct az_edge *edge, char *result, const int result_size) {
struct az_edge *current;
AZ_TRACE_EdgeToString(result, source, length, initial_mode, edges, edge);
current = AZ_PREVIOUS(edges, edge);
while (current) {
char s[256];
char *pos;
int len;
AZ_TRACE_EdgeToString(s, source, length, initial_mode, edges, current);
pos = strrchr(s, ' ');
assert(pos);
len = strlen(result);
if ((pos - s) + 1 + len + 1 >= result_size) {
memcpy(result + result_size - 4, "...", 4); /* Include terminating NUL */
break;
}
memmove(result + (pos - s) + 1, result, len + 1);
memcpy(result, s, (pos - s) + 1);
current = AZ_PREVIOUS(edges, current);
}
puts(result);
}
static void AZ_TRACE_Edges(const char *prefix, const unsigned char *source, const int length, const char initial_mode,
struct az_edge *edges, const int vertexIndex) {
int i, j, e_i;
char result[1024 * 2];
if (vertexIndex) {
printf(prefix, vertexIndex);
} else {
fputs(prefix, stdout);
}
for (i = vertexIndex; i <= length; i++) {
e_i = i * AZ_NUM_MODES;
for (j = 0; j < AZ_NUM_MODES; j++) {
if (edges[e_i + j].mode) {
fputs(" **** ", stdout);
AZ_TRACE_Path(source, length, initial_mode, edges, edges + e_i + j, result, (int) ARRAY_SIZE(result));
}
}
}
}
static void AZ_TRACE_AddEdge(const unsigned char *source, const int length, struct az_edge *edges,
struct az_edge *previous, const int vertexIndex, struct az_edge *edge) {
const int v_ij = vertexIndex * AZ_NUM_MODES + AZ_MASK(edge->mode) - 1;
(void)source; (void)length;
printf("add mode %c_%d, previous %d, from %d, len %d, v_ij mode %d || v_ij.size %d >= edge->size %d\n",
az_mode_char(edge->mode), v_ij, previous ? (int) (previous - edges) : 0, edge->from, edge->len,
edges[v_ij].mode, edges[v_ij].size, edge->size);
}
static void AZ_TRACE_NotAddEdge(const unsigned char *source, const int length, struct az_edge *edges,
struct az_edge *previous, const int vertexIndex, const int e_ij, struct az_edge *edge) {
const int v_ij = vertexIndex * AZ_NUM_MODES + AZ_MASK(edge->mode) - 1;
(void)source; (void)length; (void)e_ij;
printf("NOT mode %c_%d, previous %d, from %d, len %d, v_ij.size %d < edge->size %d\n",
az_mode_char(edge->mode), v_ij, previous ? (int) (previous - edges) : 0, edge->from, edge->len,
edges[v_ij].size, edge->size);
}
/* vim: set ts=4 sw=4 et : */
#endif /* Z_AZTEC_TRACE_H */
+4 -9
View File
@@ -542,7 +542,7 @@ INTERNAL int zint_gs1_128_cc(struct zint_symbol *symbol, unsigned char source[],
symbol->row_height[separator_row] = 1; symbol->row_height[separator_row] = 1;
} }
error_number = zint_gs1_verify(symbol, source, length, reduced, &reduced_length); error_number = zint_gs1_verify(symbol, source, length, reduced, &reduced_length, 1 /*set_hrt*/);
if (error_number >= ZINT_ERROR) { if (error_number >= ZINT_ERROR) {
return error_number; return error_number;
} }
@@ -612,7 +612,7 @@ INTERNAL int zint_gs1_128_cc(struct zint_symbol *symbol, unsigned char source[],
} }
} }
if (reduced_length > 48) { /* GS1 General Specifications 5.4.4.3 */ if (reduced_length > 48) { /* GS1 General Specifications Release 26.0 5.4.4.3 Maximum symbol length */
if (error_number == 0) { /* Don't overwrite any `zint_gs1_verify()` warning */ if (error_number == 0) { /* Don't overwrite any `zint_gs1_verify()` warning */
error_number = z_errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 843, error_number = z_errtxtf(ZINT_WARN_NONCOMPLIANT, symbol, 843,
"Input too long, requires %d characters (maximum 48)", reduced_length); "Input too long, requires %d characters (maximum 48)", reduced_length);
@@ -620,7 +620,7 @@ INTERNAL int zint_gs1_128_cc(struct zint_symbol *symbol, unsigned char source[],
} }
if (symbol->output_options & COMPLIANT_HEIGHT) { if (symbol->output_options & COMPLIANT_HEIGHT) {
/* GS1 General Specifications 21.0.1 5.12.3.2 table 2, including footnote (**): /* GS1 General Specifications Release 26.0 5.12.3.2 Symbol specification table 2, including footnote (**):
same as ITF-14: "in case of further space constraints" height 5.8mm / 1.016mm (X max) ~ 5.7; same as ITF-14: "in case of further space constraints" height 5.8mm / 1.016mm (X max) ~ 5.7;
default 31.75mm / 0.495mm ~ 64.14 */ default 31.75mm / 0.495mm ~ 64.14 */
const float min_height = 5.70866156f; /* 5.8 / 1.016 */ const float min_height = 5.70866156f; /* 5.8 / 1.016 */
@@ -650,12 +650,7 @@ INTERNAL int zint_gs1_128_cc(struct zint_symbol *symbol, unsigned char source[],
"Cannot use Reader Initialisation in GS1 mode, ignoring"); "Cannot use Reader Initialisation in GS1 mode, ignoring");
} }
/* Note won't overflow `text` buffer due to symbol character maximum restricted to C128_SYMBOL_MAX */ /* HRT set by `zint_gs1_verify()` */
if (symbol->input_mode & GS1PARENS_MODE) {
z_hrt_cpy_nochk(symbol, source, length);
} else {
z_hrt_conv_gs1_brackets_nochk(symbol, source, length);
}
if (content_segs && z_ct_cpy(symbol, reduced, reduced_length)) { if (content_segs && z_ct_cpy(symbol, reduced, reduced_length)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy()` only fails with OOM */ return ZINT_ERROR_MEMORY; /* `z_ct_cpy()` only fails with OOM */
+4 -4
View File
@@ -1,7 +1,7 @@
/* code128_based.c - Handles Code 128 derivatives NVE-18, EAN-14, DPD and Universal Postal Union S10 */ /* code128_based.c - Handles Code 128 derivatives NVE-18, EAN-14, DPD and Universal Postal Union S10 */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008-2025 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2008-2026 Robin Stuart <rstuart114@gmail.com>
Bugfixes thanks to Christian Sakowski and BogDan Vatra Bugfixes thanks to Christian Sakowski and BogDan Vatra
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@@ -94,7 +94,7 @@ static int nve18_or_ean14(struct zint_symbol *symbol, const unsigned char source
error_number = zint_gs1_128(symbol, ean128_equiv, data_len + 5); error_number = zint_gs1_128(symbol, ean128_equiv, data_len + 5);
/* Use `raw_text` set by `zint_gs1_128()` */ /* Use `content_segs` set by `zint_gs1_128()` */
return error_number; return error_number;
} }
@@ -219,7 +219,7 @@ INTERNAL int zint_dpd(struct zint_symbol *symbol, unsigned char source[], int le
z_hrt_cpy_nochk(symbol, hrt, p + 1); z_hrt_cpy_nochk(symbol, hrt, p + 1);
/* Use `raw_text` from `zint_code128()` */ /* Use `content_segs` from `zint_code128()` */
/* Some compliance checks */ /* Some compliance checks */
if (z_not_sane(NEON_F, local_source + length - 16, 16)) { if (z_not_sane(NEON_F, local_source + length - 16, 16)) {
@@ -323,7 +323,7 @@ INTERNAL int zint_upu_s10(struct zint_symbol *symbol, unsigned char source[], in
} }
z_hrt_cpy_nochk(symbol, hrt, j); z_hrt_cpy_nochk(symbol, hrt, j);
/* Use `raw_text` set by `zint_code128()` */ /* Use `content_segs` set by `zint_code128()` */
if (symbol->output_options & COMPLIANT_HEIGHT) { if (symbol->output_options & COMPLIANT_HEIGHT) {
/* Universal Postal Union S10 Section 8, using max X 0.51mm & minimum height 12.5mm or 15% of width */ /* Universal Postal Union S10 Section 8, using max X 0.51mm & minimum height 12.5mm or 15% of width */
+13 -6
View File
@@ -117,7 +117,7 @@ static const unsigned short flags[256] = {
/* Whether a character `ch` matches `flag` */ /* Whether a character `ch` matches `flag` */
INTERNAL int z_is_chr(const unsigned int flag, const unsigned int ch) { 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 */ return z_isascii(ch) && (flags[ch] & flag); /* As `ch` passed as an int 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 */ /* Verifies if a string only uses valid characters, returning 1-based position in `source` if not, 0 for success */
@@ -780,15 +780,16 @@ INTERNAL int z_utf8_to_unicode(struct zint_symbol *symbol, const unsigned char s
INTERNAL int z_hrt_cpy_iso8859_1(struct zint_symbol *symbol, const unsigned char source[], const int length) { INTERNAL int z_hrt_cpy_iso8859_1(struct zint_symbol *symbol, const unsigned char source[], const int length) {
int i, j; int i, j;
int warn_number = 0; int warn_number = 0;
const int text_size = ARRAY_SIZE(symbol->text);
for (i = 0, j = 0; i < length && j < ARRAY_SIZE(symbol->text); i++) { for (i = 0, j = 0; i < length && j < text_size; i++) {
if (z_isascii(source[i])) { if (z_isascii(source[i])) {
symbol->text[j++] = z_iscntrl(source[i]) ? ' ' : source[i]; symbol->text[j++] = z_iscntrl(source[i]) ? ' ' : source[i];
} else if (source[i] < 0xC0) { } else if (source[i] < 0xC0) {
if (source[i] < 0xA0) { /* 0x80-0x9F not valid ISO/IEC 8859-1 */ if (source[i] < 0xA0) { /* 0x80-0x9F not valid ISO/IEC 8859-1 */
symbol->text[j++] = ' '; symbol->text[j++] = ' ';
} else { } else {
if (j + 2 >= ARRAY_SIZE(symbol->text)) { if (j + 2 >= text_size) {
warn_number = ZINT_WARN_HRT_TRUNCATED; warn_number = ZINT_WARN_HRT_TRUNCATED;
break; break;
} }
@@ -796,7 +797,7 @@ INTERNAL int z_hrt_cpy_iso8859_1(struct zint_symbol *symbol, const unsigned char
symbol->text[j++] = source[i]; symbol->text[j++] = source[i];
} }
} else { } else {
if (j + 2 >= ARRAY_SIZE(symbol->text)) { if (j + 2 >= text_size) {
warn_number = ZINT_WARN_HRT_TRUNCATED; warn_number = ZINT_WARN_HRT_TRUNCATED;
break; break;
} }
@@ -804,7 +805,7 @@ INTERNAL int z_hrt_cpy_iso8859_1(struct zint_symbol *symbol, const unsigned char
symbol->text[j++] = source[i] - 0x40; symbol->text[j++] = source[i] - 0x40;
} }
} }
if (j == ARRAY_SIZE(symbol->text)) { if (j == text_size) {
warn_number = ZINT_WARN_HRT_TRUNCATED; warn_number = ZINT_WARN_HRT_TRUNCATED;
j--; j--;
} }
@@ -955,7 +956,7 @@ static int ct_init_seg_source(struct zint_symbol *symbol, const int seg_idx, con
assert(length > 0); assert(length > 0);
if (!(symbol->content_segs[seg_idx].source = (unsigned char *) malloc((size_t) length))) { if (!(symbol->content_segs[seg_idx].source = (unsigned char *) malloc((size_t) length))) {
return z_errtxt(ZINT_ERROR_MEMORY, symbol, 245, "Insufficient memory for content text source buffer"); return z_errtxt(ZINT_ERROR_MEMORY, symbol, 245, "Insufficient memory for content segs source buffer");
} }
return 0; return 0;
} }
@@ -1013,6 +1014,9 @@ INTERNAL int z_ct_cpy_cat(struct zint_symbol *symbol, const unsigned char source
if (z_ct_init_segs(symbol, 1 /*seg_count*/) || ct_init_seg_source(symbol, 0 /*seg_idx*/, total_length)) { if (z_ct_init_segs(symbol, 1 /*seg_count*/) || ct_init_seg_source(symbol, 0 /*seg_idx*/, total_length)) {
return ZINT_ERROR_MEMORY; /* `z_ct_init_segs()` & `ct_init_seg_source()` only fail with OOM */ return ZINT_ERROR_MEMORY; /* `z_ct_init_segs()` & `ct_init_seg_source()` only fail with OOM */
} }
#ifdef ZINT_SANITIZEM /* Suppress clang-22 -fsanitize=memory false positive (seems unable to track `*s++ =`) */
memset(symbol->content_segs[0].source, 0, total_length);
#endif
s = symbol->content_segs[0].source; s = symbol->content_segs[0].source;
if (length > 0) { if (length > 0) {
memcpy(s, source, (size_t) length); memcpy(s, source, (size_t) length);
@@ -1044,6 +1048,9 @@ INTERNAL int z_ct_cpy_iso8859_1(struct zint_symbol *symbol, const unsigned char
if (z_ct_init_segs(symbol, 1 /*seg_count*/) || ct_init_seg_source(symbol, 0 /*seg_idx*/, length + iso_cnt)) { if (z_ct_init_segs(symbol, 1 /*seg_count*/) || ct_init_seg_source(symbol, 0 /*seg_idx*/, length + iso_cnt)) {
return ZINT_ERROR_MEMORY; /* `z_ct_init_segs()` & `ct_init_seg_source()` only fail with OOM */ return ZINT_ERROR_MEMORY; /* `z_ct_init_segs()` & `ct_init_seg_source()` only fail with OOM */
} }
#ifdef ZINT_SANITIZEM /* Suppress clang-22 -fsanitize=memory false positive (seems unable to track `*s++ =`) */
memset(symbol->content_segs[0].source, 0, length + iso_cnt);
#endif
s = symbol->content_segs[0].source; s = symbol->content_segs[0].source;
for (i = 0; i < length; i++) { for (i = 0; i < length; i++) {
+492 -152
View File
@@ -95,7 +95,7 @@ static int gs1_numeric(const unsigned char *data, int data_len, int offset, int
return 1; return 1;
} }
/* GS1 General Specifications 21.0.1 Figure 7.9.5-1. GS1 AI encodable character reference values. /* GS1 General Specifications Release 26.0 Table 7-18 GS1 AI encodable character reference values.
Also used to determine if character in set 82 - a value of 82 means not in */ Also used to determine if character in set 82 - a value of 82 means not in */
static const char gs1_c82[] = { static const char gs1_c82[] = {
/* ! " # $ % & ' ( ) * */ /* ! " # $ % & ' ( ) * */
@@ -118,7 +118,8 @@ static const char gs1_c82[] = {
72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
}; };
/* Validate of character set 82 (GS1 General Specifications Figure 7.11-1) */ /* Validate of character set 82
(GS1 General Specifications Release 26.0 Table 7-20 GS1 AI encodable character set 82) */
static int gs1_cset82(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, static int gs1_cset82(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
int *p_err_posn, char err_msg[50]) { int *p_err_posn, char err_msg[50]) {
@@ -144,7 +145,8 @@ static int gs1_cset82(const unsigned char *data, int data_len, int offset, int m
return 1; return 1;
} }
/* Validate of character set 39 (GS1 General Specifications Figure 7.11-2) */ /* Validate of character set 39
(GS1 General Specifications Release 26.0 Table 7-21 GS1 AI encodable character set 39) */
static int gs1_cset39(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, static int gs1_cset39(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
int *p_err_posn, char err_msg[50]) { int *p_err_posn, char err_msg[50]) {
@@ -203,7 +205,8 @@ static int gs1_cset64(const unsigned char *data, int data_len, int offset, int m
return 1; return 1;
} }
/* Check a check digit (GS1 General Specifications 7.9.1) */ /* Check a check digit
(GS1 General Specifications Release 26.0 7.9.1 Standard check digit calculations for GS1 data structures) */
static int gs1_csum(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, static int gs1_csum(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
int *p_err_posn, char err_msg[50], const int length_only) { int *p_err_posn, char err_msg[50], const int length_only) {
@@ -237,7 +240,8 @@ static int gs1_csum(const unsigned char *data, int data_len, int offset, int min
return 1; return 1;
} }
/* Check alphanumeric check characters (GS1 General Specifications 7.9.5) */ /* Check alphanumeric check characters
(GS1 General Specifications Release 26.0 7.9.5 Check character calculation (for alphanumeric keys)) */
static int gs1_csumalpha(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, static int gs1_csumalpha(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
int *p_err_posn, char err_msg[50], const int length_only) { int *p_err_posn, char err_msg[50], const int length_only) {
@@ -280,7 +284,7 @@ static int gs1_csumalpha(const unsigned char *data, int data_len, int offset, in
#define GS1_GCP_MIN_LENGTH 4 /* Minimum length of GS1 Company Prefix */ #define GS1_GCP_MIN_LENGTH 4 /* Minimum length of GS1 Company Prefix */
/* Check for a GS1 Prefix (GS1 General Specifications GS1 1.4.2) */ /* Check for a GS1 Prefix (GS1 General Specifications Release 26.0 1.2.3.3 GS1 Company Prefix) */
static int gs1_gcppos1(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, static int gs1_gcppos1(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
int *p_err_posn, char err_msg[50], const int length_only) { int *p_err_posn, char err_msg[50], const int length_only) {
(void)max; (void)max;
@@ -406,7 +410,8 @@ static int gs1_yymmd0(const unsigned char *data, int data_len, int offset, int m
if (!length_only && data_len) { if (!length_only && data_len) {
/* For leap year detection, only matters if 00 represents century divisible by 400 or not */ /* For leap year detection, only matters if 00 represents century divisible by 400 or not */
/* Following good until 2050 when 00 will mean 2100 (GS1 General Specifications 7.12) */ /* Following good until 2050 when 00 will mean 2100
(GS1 General Specifications Release 26.0 7.12 Determination of century in dates) */
unsigned char buf[8] = { '2', '0' }; unsigned char buf[8] = { '2', '0' };
memcpy(buf + 2, data + offset, 6); memcpy(buf + 2, data + offset, 6);
@@ -697,7 +702,8 @@ static int gs1_yesno(const unsigned char *data, int data_len, int offset, int mi
return 1; return 1;
} }
/* Check for importer index (GS1 General Specifications 3.8.17) */ /* Check for importer index
(GS1 General Specifications Release 26.0 3.8.18 GS1 UIC with Extension 1 and Importer index: AI (7040)) */
static int gs1_importeridx(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, static int gs1_importeridx(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
int *p_err_posn, char err_msg[50], const int length_only) { int *p_err_posn, char err_msg[50], const int length_only) {
(void)max; (void)max;
@@ -745,7 +751,7 @@ static int gs1_nonzero(const unsigned char *data, int data_len, int offset, int
return 1; return 1;
} }
/* Check winding direction (0/1/9) (GS1 General Specifications 3.9.1) */ /* Check winding direction (0/1/9) (GS1 General Specifications Release 26.0 3.9.1 Roll products) */
static int gs1_winding(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, static int gs1_winding(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
int *p_err_posn, char err_msg[50], const int length_only) { int *p_err_posn, char err_msg[50], const int length_only) {
(void)max; (void)max;
@@ -789,7 +795,9 @@ static int gs1_zero(const unsigned char *data, int data_len, int offset, int min
return 1; return 1;
} }
/* Check piece of a trade item (GS1 General Specifications 3.9.6 and 3.9.17) */ /* Check piece of a trade item
(GS1 General Specifications Release 26.0 3.9.6 Identification of an individual trade item piece
and 3.9.18 Identification of pieces of a trade item (ITIP) contained in a logistic unit) */
static int gs1_pieceoftotal(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no, static int gs1_pieceoftotal(const unsigned char *data, int data_len, int offset, int min, int max, int *p_err_no,
int *p_err_posn, char err_msg[50], const int length_only) { int *p_err_posn, char err_msg[50], const int length_only) {
(void)max; (void)max;
@@ -914,8 +922,8 @@ static int gs1_nozeroprefix(const unsigned char *data, int data_len, int offset,
} }
if (!length_only && data_len) { if (!length_only && data_len) {
/* GS1 General Specifications 3.9.11 "The C/P serial number SHALL NOT begin with a "0" digit, unless the /* GS1 General Specifications Release 26.0 3.9.11 "The C/P serial number SHALL NOT begin with a "0" digit,
entire serial number consists of the single digit '0'." */ unless the entire serial number consists of the single digit '0'." */
if (data[0] == '0' && data_len != 1) { if (data[0] == '0' && data_len != 1) {
*p_err_no = 3; *p_err_no = 3;
*p_err_posn = offset + 1; *p_err_posn = offset + 1;
@@ -1609,34 +1617,72 @@ static int gs1_packagetype(const unsigned char *data, int data_len, int offset,
return 1; return 1;
} }
/* Helper to say if AI pointed to by `source` has predefined length according to GS1 General Specifications 26.0
Figure 7-6 "Element strings with predefined length using GS1 Application Identifiers" */
static int gs1_predefined_len(const unsigned char source[]) {
const int ai2 = z_to_int(source, 2); /* First 2 digits */
/* NOTE: previously allowed legacy 23, removed 2026-02-26 */
return (ai2 >= 0 && ai2 <= 4) || (ai2 >= 11 && ai2 <= 20) || (ai2 >= 31 && ai2 <= 36) || ai2 == 41;
}
/* Generated by "php backend/tools/gen_gs1_linter.php > backend/gs1_lint.h" */ /* Generated by "php backend/tools/gen_gs1_linter.php > backend/gs1_lint.h" */
#include "gs1_lint.h" #include "gs1_lint.h"
#ifdef ZINT_TEST /* Wrapper for direct testing */
INTERNAL int zint_test_gs1_lint_parse_raw_caret(const unsigned char source[], const int length,
const int ai_max, int *ai_vals, int *ai_locs, int *data_locs, int *data_lens, int *p_ai_count,
int *p_err_no, int *p_err_posn) {
return gs1_lint_parse_raw_caret(source, length,
ai_max, ai_vals, ai_locs, data_locs, data_lens, p_ai_count, p_err_no, p_err_posn);
}
#endif
/* Whether starts with Digital Link URI */ /* Whether starts with Digital Link URI */
static int gs1_is_digital_link(const unsigned char *source, const int length) { static int gs1_is_digital_link(const unsigned char *source, const int length) {
return (length >= 8 && (memcmp(source, "https://", 8) == 0 || memcmp(source, "HTTPS://", 8) == 0)) return length >= 7 && (memcmp(source, "http://", 7) == 0 || memcmp(source, "HTTP://", 7) == 0
|| (length >= 7 && (memcmp(source, "http://", 7) == 0 || memcmp(source, "HTTP://", 7) == 0)); || (length >= 8 && (memcmp(source, "https://", 8) == 0
|| memcmp(source, "HTTPS://", 8) == 0)));
} }
/* If built with GS1 Syntax Engine library */ /* If built with GS1 Syntax Engine library */
#ifdef ZINT_HAVE_GS1SE #ifdef ZINT_HAVE_GS1SE
/* Helper to set `errtxt` on internal error and exit, freeing `ctx` */
static int gs1se_internal_errtxt(struct zint_symbol *symbol, const int err_id, gs1_encoder *ctx) {
const char *errmsg = gs1_encoder_getErrMsg(ctx);
z_errtxtf(0, symbol, err_id, "Internal error using GS1 Syntax Engine: %.80s", *errmsg ? errmsg : "unknown");
gs1_encoder_free(ctx);
return ZINT_ERROR_ENCODING_PROBLEM;
}
/* Helper to replace GSs with carets */
static void gs1se_gs_caret_sub(const unsigned char *src, const int length, unsigned char *dst) {
int i;
for (i = 0; i < length; i++) {
dst[i] = src[i] == '\x1D' ? '^' : src[i];
}
dst[length] = '\0';
}
/* Use GS1 Syntax Engine to verify */ /* Use GS1 Syntax Engine to verify */
static int gs1se_verify(struct zint_symbol *symbol, const unsigned char source[], const int length, static int gs1se_verify(struct zint_symbol *symbol, const unsigned char source[], const int length,
unsigned char reduced[], int *p_reduced_length) { unsigned char reduced[], int *p_reduced_length) {
int i, j; int i, j;
const int is_composite = z_is_composite(symbol->symbology); const int primary_len = z_is_composite(symbol->symbology) ? (int) strlen(symbol->primary) : 0;
const int primary_len = is_composite ? (int) strlen(symbol->primary) : 0;
const int gs1parens_mode = symbol->input_mode & GS1PARENS_MODE; const int gs1parens_mode = symbol->input_mode & GS1PARENS_MODE;
const char obracket = gs1parens_mode ? '(' : '['; const int gs1raw_mode = !!(symbol->input_mode & GS1RAW_MODE);
const int parens_cnt = !gs1parens_mode ? z_chr_cnt(source, length, '(') : 0; const int gs1_caret = source[0] == '^';
const int is_digital_link = !primary_len && !gs1_caret && gs1_is_digital_link(source, length);
const int parens_cnt = !gs1parens_mode && !gs1raw_mode && !gs1_caret ? z_chr_cnt(source, length, '(') : 0;
int local_length = length; int local_length = length;
const unsigned char *local_source = source; const unsigned char *local_source = source;
const unsigned char *local_source2 = source; const unsigned char *local_source2 = source;
unsigned char *local_source_buf = (unsigned char *) z_alloca(ARRAY_SIZE(symbol->primary) + length + 1); unsigned char *local_source_buf = (unsigned char *) z_alloca(ARRAY_SIZE(symbol->primary) + 4 + length + 1);
unsigned char *local_source2_buf = (unsigned char *) z_alloca(ARRAY_SIZE(symbol->primary) * 2 + length unsigned char *local_source2_buf = (unsigned char *) z_alloca(ARRAY_SIZE(symbol->primary) * 2 + length
+ parens_cnt + 1); + parens_cnt + 1);
int is_digital_link = 0; int linear_len = 0;
char msgBuf[120]; char msgBuf[120];
gs1_encoder_init_status_t status = GS1_ENCODERS_INIT_SUCCESS; gs1_encoder_init_status_t status = GS1_ENCODERS_INIT_SUCCESS;
gs1_encoder_init_opts_t opts = { gs1_encoder_init_opts_t opts = {
@@ -1646,35 +1692,89 @@ static int gs1se_verify(struct zint_symbol *symbol, const unsigned char source[]
gs1_encoder *ctx; gs1_encoder *ctx;
int gs1se_ret; int gs1se_ret;
if (length < 2 + gs1_caret) {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 802, "Data does not start with an AI");
}
/* Only matrix symbols can encode Digital Link URIs */
if (is_digital_link && !z_is_fixed_ratio(symbol->symbology)) {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 264, "Data does not start with an AI");
}
/* Need "linear|composite" format to check required AIs */ /* Need "linear|composite" format to check required AIs */
if (is_composite && primary_len) { if (primary_len) {
if (symbol->symbology == BARCODE_GS1_128_CC || symbol->symbology == BARCODE_DBAR_EXP_CC if (symbol->symbology == BARCODE_GS1_128_CC || symbol->symbology == BARCODE_DBAR_EXP_CC
|| symbol->symbology == BARCODE_DBAR_EXPSTK_CC) { || symbol->symbology == BARCODE_DBAR_EXPSTK_CC) {
memcpy(local_source_buf, symbol->primary, primary_len); /* These take GS1 data in the linear part */
local_source_buf[primary_len] = '|'; if (gs1raw_mode) {
memcpy(local_source_buf + 1 + primary_len, source, length + 1); /* Include terminating NUL */ /* Need to add initial carets */
local_length += 1 + primary_len; local_source_buf[0] = '^';
local_length = 1;
if (symbol->primary[0] == '\x1D') { /* Allow initial GS */
gs1se_gs_caret_sub(ZCUCP(symbol->primary + 1), primary_len - 1, local_source_buf + 1); /* Linear GSs */
local_length += primary_len - 1;
} else {
gs1se_gs_caret_sub(ZCUCP(symbol->primary), primary_len, local_source_buf + 1); /* Linear GSs */
local_length += primary_len;
}
local_source_buf[local_length++] = '|';
local_source_buf[local_length++] = '^';
if (source[0] == '\x1D') { /* Allow initial GS */
gs1se_gs_caret_sub(source + 1, length - 1, local_source_buf + primary_len + 3); /* CC GSs */
local_length += length - 1;
} else {
gs1se_gs_caret_sub(source, length, local_source_buf + primary_len + 3); /* CC GSs */
local_length += length;
}
linear_len = primary_len;
} else {
memcpy(local_source_buf, symbol->primary, primary_len);
local_source_buf[primary_len] = '|';
memcpy(local_source_buf + primary_len + 1, source, length + 1); /* Include terminating NUL */
local_length += primary_len + 1;
linear_len = primary_len - 1; /* Only actual linear data counts - exclude initial caret */
}
} else { } else {
/* Just use dummy "01" linear */ /* Just use dummy "01" linear */
memcpy(local_source_buf, gs1parens_mode ? "(01)12345678901231|" : "[01]12345678901231|", 19); if (gs1_caret || gs1raw_mode) {
memcpy(local_source_buf + 19, source, length + 1); /* Include terminating NUL */ memcpy(local_source_buf, "^0112345678901231|^", 18 + gs1raw_mode);
local_length += 19; if (gs1_caret) {
memcpy(local_source_buf + 18, source, length + 1); /* Include terminating NUL */
} else {
gs1se_gs_caret_sub(source, length, local_source_buf + 19);
}
local_length += 18 + gs1raw_mode;
} else {
memcpy(local_source_buf, gs1parens_mode ? "(01)12345678901231|" : "[01]12345678901231|", 19);
memcpy(local_source_buf + 19, source, length + 1); /* Include terminating NUL */
local_length += 19;
}
linear_len = 16; /* Only actual linear data "0112345678901231" counts */
}
local_source = local_source_buf;
local_source2 = local_source_buf;
} else if (gs1raw_mode && !is_digital_link) {
if (symbol->symbology == BARCODE_GS1_128 || symbol->symbology == BARCODE_DBAR_EXP
|| symbol->symbology == BARCODE_DBAR_EXPSTK || z_is_fixed_ratio(symbol->symbology)
|| symbol->symbology == BARCODE_CODABLOCKF) { /* Codablock-F will be GS1-enabled in the future */
/* Prefix caret */
local_source_buf[0] = '^';
if (source[0] == '\x1D') { /* Allow initial GS */
gs1se_gs_caret_sub(source + 1, length - 1, local_source_buf + 1);
} else {
gs1se_gs_caret_sub(source, length, local_source_buf + 1);
local_length++;
}
} else {
/* Just copy over */
memcpy(local_source_buf, source, length + 1); /* Include terminating NULL */
} }
local_source = local_source_buf; local_source = local_source_buf;
local_source2 = local_source_buf; local_source2 = local_source_buf;
} }
if (local_source[0] != obracket) { if (!is_digital_link && !gs1raw_mode && !gs1_caret) {
if (!z_is_fixed_ratio(symbol->symbology)) { /* Only matrix symbols can encode Digital Link URIs */ assert(local_length > 0);
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 264, "Data does not start with an AI");
}
if (!(is_digital_link = gs1_is_digital_link(local_source, local_length))) {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 265,
"Data does not start with an AI or a Digital Link URI");
}
}
if (!is_digital_link) {
/* Convert to GS1 Syntax Engine parenthesis mode */ /* Convert to GS1 Syntax Engine parenthesis mode */
if (!gs1parens_mode) { if (!gs1parens_mode) {
/* Replace '[' and ']' with '(' and ')' & escape any data opening parentheses (not closing parentheses) */ /* Replace '[' and ']' with '(' and ')' & escape any data opening parentheses (not closing parentheses) */
@@ -1711,19 +1811,20 @@ static int gs1se_verify(struct zint_symbol *symbol, const unsigned char source[]
if (!(ctx = gs1_encoder_init_ex(NULL /*mem*/, &opts))) { if (!(ctx = gs1_encoder_init_ex(NULL /*mem*/, &opts))) {
const int error_number = status == GS1_ENCODERS_INIT_FAILED_NO_MEM const int error_number = status == GS1_ENCODERS_INIT_FAILED_NO_MEM
? ZINT_ERROR_MEMORY : ZINT_ERROR_ENCODING_PROBLEM; ? ZINT_ERROR_MEMORY : ZINT_ERROR_ENCODING_PROBLEM;
return z_errtxtf(error_number, symbol, 266, "GS1 Syntax Engine: %s", opts.msgBuf); return z_errtxtf(error_number, symbol, 266, "Failed to initialize GS1 Syntax Engine: %.80s",
*opts.msgBuf ? opts.msgBuf : "unknown error");
} }
/* Do not check for required checks for GS1-128 as may be spread across multiple barcodes - ticket #348 /* Do not check for required checks for GS1-128 as may be spread across multiple barcodes - ticket #348
and https://github.com/gs1/gs1-syntax-dictionary/issues/24 */ and https://github.com/gs1/gs1-syntax-dictionary/issues/24 */
if (symbol->symbology == BARCODE_GS1_128) { if (symbol->symbology == BARCODE_GS1_128) {
if (!gs1_encoder_setValidationEnabled(ctx, gs1_encoder_vREQUISITE_AIS, false)) { if (!gs1_encoder_setValidationEnabled(ctx, gs1_encoder_vREQUISITE_AIS, false)) {
const char *errmsg = gs1_encoder_getErrMsg(ctx); return gs1se_internal_errtxt(symbol, 0 /*err_id*/, ctx);
return z_errtxtf(ZINT_ERROR_ENCODING_PROBLEM, symbol, 0, "Internal error using GS1SE: %.80s",
errmsg ? errmsg : "unknown");
} }
} }
if (is_digital_link) { if (is_digital_link || gs1raw_mode || gs1_caret) {
/* Required for `gs1_encoder_getScanData()` */
gs1_encoder_setSym(ctx, primary_len ? gs1_encoder_sGS1_128_CCA : gs1_encoder_sDM);
gs1se_ret = gs1_encoder_setDataStr(ctx, ZCCP(local_source2)); gs1se_ret = gs1_encoder_setDataStr(ctx, ZCCP(local_source2));
} else { } else {
gs1se_ret = gs1_encoder_setAIdataStr(ctx, ZCCP(local_source2)); gs1se_ret = gs1_encoder_setAIdataStr(ctx, ZCCP(local_source2));
@@ -1733,81 +1834,285 @@ static int gs1se_verify(struct zint_symbol *symbol, const unsigned char source[]
const int errmsg_len = (int) strlen(errmsg); const int errmsg_len = (int) strlen(errmsg);
const char *errmarkup = gs1_encoder_getErrMarkup(ctx); const char *errmarkup = gs1_encoder_getErrMarkup(ctx);
int errmarkup_len = (int) strlen(errmarkup); int errmarkup_len = (int) strlen(errmarkup);
if (errmarkup_len && errmsg_len + 1 + errmarkup_len < ARRAY_SIZE(symbol->errtxt)) { int errtxt_set = 0;
if (errmsg_len && errmarkup_len && errmsg_len + 1 + errmarkup_len < ARRAY_SIZE(symbol->errtxt)) {
char *local_errmarkup = (char *) z_alloca(errmarkup_len * 4 + 1); char *local_errmarkup = (char *) z_alloca(errmarkup_len * 4 + 1);
z_debug_print_escape(ZCUCP(errmarkup), errmarkup_len, local_errmarkup); z_debug_print_escape(ZCUCP(errmarkup), errmarkup_len, local_errmarkup);
errmarkup_len = (int) strlen(local_errmarkup); errmarkup_len = (int) strlen(local_errmarkup);
if (errmsg_len + 1 + errmarkup_len < ARRAY_SIZE(symbol->errtxt)) { if (errmsg_len + 1 + errmarkup_len < ARRAY_SIZE(symbol->errtxt)) {
ZEXT z_errtxtf(0, symbol, 267, "%1$s %2$s", errmsg, local_errmarkup); ZEXT z_errtxtf(0, symbol, 267, "%1$s %2$s", errmsg, local_errmarkup);
} else { errtxt_set = 1;
z_errtxt(0, symbol, 268, errmsg);
} }
} else { }
z_errtxt(0, symbol, 268, errmsg); if (!errtxt_set) {
z_errtxt(0, symbol, 268, *errmsg ? errmsg : "Unknown error using GS1 Syntax Engine");
} }
gs1_encoder_free(ctx); gs1_encoder_free(ctx);
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
/* If Digital Link, set `reduced` */ /* If Digital Link or raw/caret mode, set `reduced` */
if (is_digital_link) { if (is_digital_link || gs1raw_mode || gs1_caret) {
const char *scan_data; const char *scan_data;
int reduced_length;
gs1_encoder_setSym(ctx, gs1_encoder_sDM); /* Required for `gs1_encoder_getScanData()` */
if (!(scan_data = gs1_encoder_getScanData(ctx))) { /* Shouldn't happen */ if (!(scan_data = gs1_encoder_getScanData(ctx))) { /* Shouldn't happen */
const char *errmsg = gs1_encoder_getErrMsg(ctx); return gs1se_internal_errtxt(symbol, 269 /*err_id*/, ctx);
z_errtxt(0, symbol, 269, strlen(errmsg) ? errmsg : "Internal error");
gs1_encoder_free(ctx);
return ZINT_ERROR_ENCODING_PROBLEM;
} }
*p_reduced_length = (int) strlen(scan_data); reduced_length = (int) strlen(scan_data);
/* Skip over Symbology Identifier */ /* Skip over Symbology Identifier */
if (*p_reduced_length >= 3 && scan_data[0] == ']') { if (reduced_length >= 3 && scan_data[0] == ']') {
scan_data += 3; scan_data += 3;
*p_reduced_length -= 3; reduced_length -= 3;
} }
/* Skip over any linear stuff */
if (linear_len) {
scan_data += linear_len;
reduced_length -= linear_len;
/* Need to check if the last linear AI was non-predefined length, when a GS is added */
if (*scan_data == '\x1D') { /* Skip */
scan_data++;
reduced_length--;
}
}
assert(reduced_length <= length);
memcpy(reduced, scan_data, *p_reduced_length + 1); /* Include terminating NUL */ memcpy(reduced, scan_data, reduced_length + 1); /* Include terminating NUL */
reduced[reduced_length] = '\0';
*p_reduced_length = reduced_length;
} else { } else {
*p_reduced_length = 0; /* Not Digital Link & `reduced` not set */ *p_reduced_length = 0; /* `reduced` not set */
} }
gs1_encoder_free(ctx); gs1_encoder_free(ctx);
return 0; return 0;
} }
#endif /* ZINT_HAVE_GS1SE */ #endif /* ZINT_HAVE_GS1SE */
/* Check for valid AI values and data lengths according to GS1 General Specifications Release 26, January 2026 */
static int gs1_run_lint(struct zint_symbol *symbol, const unsigned char source[], const int ai_count,
int *ai_vals, int *ai_locs, int *data_locs, int *data_lens) {
int i;
int error_number = 0;
for (i = 0; i < ai_count; i++) {
int err_no, err_posn;
char err_msg[50];
if (!gs1_lint(ai_vals[i], source + data_locs[i], data_lens[i], &err_no, &err_posn,
err_msg)) {
if (err_no == 1) {
ZEXT z_errtxtf(0, symbol, 260, "Invalid AI (%1$02d) at position %2$d",
ai_vals[i], ai_locs[i] + 1);
} else if (err_no == 2 || err_no == 4) { /* 4 is backward-incompatible bad length */
ZEXT z_errtxtf(0, symbol, 259, "Invalid data length for AI (%1$02d) at position %2$d",
ai_vals[i], ai_locs[i] + 1);
} else {
ZEXT z_errtxtf(0, symbol, 261, "AI (%1$02d) data position %2$d: %3$s", ai_vals[i], err_posn, err_msg);
}
/* For backward compatibility only error on unknown AI or bad length */
if (err_no == 1 || err_no == 2) {
return ZINT_ERROR_INVALID_DATA;
}
error_number = ZINT_WARN_NONCOMPLIANT;
}
}
return error_number;
}
/* Helper to convert parsed AIs to HRT */
static int gs1_hrt_conv_parsed(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int ai_count, const int *ai_vals, const int *ai_locs, const int *data_locs, const int *data_lens,
const int no_errtxt) {
int i, j;
int warn_number = 0;
const int text_size = ARRAY_SIZE(symbol->text);
#ifdef NDEBUG
(void)length;
#endif
for (i = 0, j = 0; i < ai_count && j < text_size; i++) {
const int ai_len = 2 + (ai_vals[i] >= 100) + (ai_vals[i] >= 1000);
if (j + 1 + ai_len + 1 + data_lens[i] >= text_size) {
warn_number = ZINT_WARN_HRT_TRUNCATED;
break;
}
symbol->text[j++] = '(';
memcpy(symbol->text + j, source + ai_locs[i], ai_len);
j += ai_len;
symbol->text[j++] = ')';
assert(data_locs[i] + data_lens[i] <= length);
memcpy(symbol->text + j, source + data_locs[i], data_lens[i]);
j += data_lens[i];
}
if (j == text_size) {
warn_number = ZINT_WARN_HRT_TRUNCATED;
j--;
}
symbol->text_length = j;
symbol->text[j] = '\0';
if (warn_number && !no_errtxt) {
z_errtxt(0, symbol, 799, "Human Readable Text truncated");
}
return warn_number;
}
#ifdef ZINT_TEST /* Wrapper for direct testing */
INTERNAL int zint_test_gs1_hrt_conv_parsed(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int ai_count, const int *ai_vals, const int *ai_locs, const int *data_locs, const int *data_lens,
const int no_errtxt) {
return gs1_hrt_conv_parsed(symbol, source, length, ai_count, ai_vals, ai_locs, data_locs, data_lens,
no_errtxt);
}
#endif
/* Helper to set HRT when have GS1PARENS_MODE - truncates if too long for HRT buffer */
static int gs1_hrt_cpy(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int no_errtxt) {
int warn_number;
const int text_size = ARRAY_SIZE(symbol->text);
assert(symbol->input_mode & GS1PARENS_MODE);
assert(source[0] == '(');
if (length < text_size) {
memcpy(symbol->text, source, length + 1); /* Include terminating NUL */
symbol->text_length = length;
warn_number = 0;
} else {
/* Find last full AI - need to scan forward to track escaped opening parens */
int i, last_opening_bracket = 0;
for (i = 0; i < text_size; i++) {
if (source[i] == '\\' && i + 1 < length && (source[i + 1] == '\\' || source[i + 1] == '(')) {
i++;
} else if (source[i] == '(') {
last_opening_bracket = i;
}
}
if (text_size < length && source[text_size] == '(') {
/* Finished at end of AI data */
memcpy(symbol->text, source, text_size - 1);
symbol->text_length = text_size - 1;
symbol->text[text_size - 1] = '\0';
} else {
/* Use last full AI + data */
memcpy(symbol->text, source, last_opening_bracket);
symbol->text_length = last_opening_bracket;
symbol->text[last_opening_bracket] = '\0';
}
warn_number = ZINT_WARN_HRT_TRUNCATED;
if (!no_errtxt) {
z_errtxt(0, symbol, 801, "Human Readable Text truncated");
}
}
return warn_number;
}
#ifdef ZINT_TEST /* Wrapper for direct testing */
INTERNAL int zint_test_gs1_hrt_cpy(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int no_errtxt) {
return gs1_hrt_cpy(symbol, source, length, no_errtxt);
}
#endif
/* Helper to set HRT when don't have GS1PARENS_MODE - substitutes square brackets with parentheses
& truncates if too long for HRT buffer */
static int gs1_hrt_conv_brackets(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int no_errtxt) {
int i;
int warn_number = 0;
int bracket_level = 0; /* Non-compliant closing square brackets may be in text */
int last_opening_bracket = 0;
const int text_size = ARRAY_SIZE(symbol->text);
const int max_len = length > text_size ? text_size : length;
assert((symbol->input_mode & GS1PARENS_MODE) == 0);
assert(source[0] == '[');
for (i = 0; i < max_len; i++) {
if (source[i] == '[') {
symbol->text[i] = '(';
bracket_level++;
last_opening_bracket = i;
} else if (source[i] == ']' && bracket_level) {
symbol->text[i] = ')';
bracket_level--;
} else {
symbol->text[i] = source[i];
}
}
if (i == text_size) {
i--;
if (source[i] != '[') {
i = last_opening_bracket;
}
warn_number = ZINT_WARN_HRT_TRUNCATED;
}
symbol->text_length = i;
symbol->text[i] = '\0';
if (warn_number && !no_errtxt) {
z_errtxt(0, symbol, 798, "Human Readable Text truncated");
}
return warn_number;
}
#ifdef ZINT_TEST /* Wrapper for direct testing */
INTERNAL int zint_test_gs1_hrt_conv_brackets(struct zint_symbol *symbol, const unsigned char source[],
const int length, const int no_errtxt) {
return gs1_hrt_conv_brackets(symbol, source, length, no_errtxt);
}
#endif
#define GS1_PARENS_PLACEHOLDER_MASK 0x20 /* Mask `(` or `)` by this if escaped (get BS (\x08) or HT (\x09)) */ #define GS1_PARENS_PLACEHOLDER_MASK 0x20 /* Mask `(` or `)` by this if escaped (get BS (\x08) or HT (\x09)) */
/* Helper to re-instate escaped parentheses */
static void gs1_reinstate_escaped_parens(unsigned char source[], const int length) {
int i;
for (i = 0; i < length; i++) {
if (source[i] < '\x1D') {
source[i] |= GS1_PARENS_PLACEHOLDER_MASK;
}
}
}
/* Verify a GS1 input string */ /* Verify a GS1 input string */
INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const int length, INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const int length,
unsigned char reduced[], int *p_reduced_length) { unsigned char reduced[], int *p_reduced_length, const int set_hrt) {
int i, j; int i, j;
int error_number = 0; int error_number = 0, warn_number = 0;
int bracket_level = 0; int bracket_level = 0;
int ai_latch; int ai_latch;
int local_length = length; int local_length = length;
const unsigned char *local_source = source; const unsigned char *local_source = source;
unsigned char *local_source_buf = (unsigned char *) z_alloca(length + 1); unsigned char *local_source_buf = (unsigned char *) z_alloca(length + 1);
int *ai_vals, *ai_locs, *data_locs, *data_lens;
const int gs1parens_mode = symbol->input_mode & GS1PARENS_MODE; const int gs1parens_mode = symbol->input_mode & GS1PARENS_MODE;
const char obracket = gs1parens_mode ? '(' : '['; const char obracket = gs1parens_mode ? '(' : '[';
const char cbracket = gs1parens_mode ? ')' : ']'; const char cbracket = gs1parens_mode ? ')' : ']';
int done_gs1se = 0; int done_gs1se = 0;
int is_digital_link = 0; /* Is Digital Link? */ int is_digital_link = 0; /* Is Digital Link? */
const int gs1raw_mode = symbol->input_mode & GS1RAW_MODE;
const int gs1nocheck_mode = symbol->input_mode & GS1NOCHECK_MODE;
/* Note: Digital Link URIs only validated if have GS1 Syntax Engine and GS1SYNTAXENGINE_MODE set */ /* Note: Digital Link URIs only validated if have GS1 Syntax Engine and GS1SYNTAXENGINE_MODE set */
*p_reduced_length = 0;
#ifdef ZINT_HAVE_GS1SE #ifdef ZINT_HAVE_GS1SE
if ((symbol->input_mode & GS1SYNTAXENGINE_MODE) && !(symbol->input_mode & GS1NOCHECK_MODE)) { if ((symbol->input_mode & GS1SYNTAXENGINE_MODE) && !gs1nocheck_mode) {
/* Strict verification */ /* Strict verification */
if ((error_number = gs1se_verify(symbol, source, length, reduced, p_reduced_length))) { if ((error_number = gs1se_verify(symbol, source, length, reduced, p_reduced_length))) {
return error_number; return error_number;
} }
done_gs1se = 1; done_gs1se = 1;
is_digital_link = *p_reduced_length != 0; /* `p_reduced_length` will be set if Digital Link */ /* `p_reduced_length` will be set if Digital Link or raw/caret */
} }
#endif #endif
@@ -1821,7 +2126,7 @@ INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char sou
if (source[i] == '\0') { if (source[i] == '\0') {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 262, "NUL characters not permitted in GS1 mode"); return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 262, "NUL characters not permitted in GS1 mode");
} }
if (source[i] < 32) { if (source[i] < 32 && (!gs1raw_mode || source[i] != '\x1D')) {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 251, "Control characters are not supported by GS1"); return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 251, "Control characters are not supported by GS1");
} }
if (source[i] == 127) { if (source[i] == 127) {
@@ -1829,24 +2134,90 @@ INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char sou
} }
} }
is_digital_link = gs1_is_digital_link(source, length);
if (source[0] != obracket && !is_digital_link && (gs1raw_mode || source[0] == '^')) {
int ai_count;
int err_no, err_posn;
const int ai_max = (length + 2) / 3 + 1; /* Min AI 2, min data 1 */
ai_vals = (int *) z_alloca(sizeof(int) * ai_max);
ai_locs = (int *) z_alloca(sizeof(int) * ai_max);
data_locs = (int *) z_alloca(sizeof(int) * ai_max);
data_lens = (int *) z_alloca(sizeof(int) * ai_max);
if (!gs1_lint_parse_raw_caret(source, length, ai_max, ai_vals, ai_locs, data_locs, data_lens, &ai_count,
&err_no, &err_posn)) {
/* Both raw & caret modes require valid AIs and underlong data lengths to work, so check regardless of
GS1NOCHECK_MODE */
if (err_no == 1) {
if (ai_vals[ai_count] != -1) {
ZEXT z_errtxtf(0, symbol, 856, "Invalid AI (%1$02d) at position %2$d", ai_vals[ai_count],
err_posn);
} else {
z_errtxtf(0, symbol, 857, "Invalid AI at position %d", err_posn);
}
} else {
assert(err_no == 2);
if (data_lens[ai_count] == 0) {
ZEXT z_errtxtf(0, symbol, 858, "Empty data field for AI (%1$02d) at position %2$d",
ai_vals[ai_count], err_posn);
} else {
ZEXT z_errtxtf(0, symbol, 859, "Invalid data length for AI (%1$02d) at position %2$d",
ai_vals[ai_count], err_posn);
}
}
return ZINT_ERROR_INVALID_DATA;
}
assert(ai_count < ai_max); /* Suppress clang-tidy-22 clang-analyzer-security.ArrayBound */
if (!gs1nocheck_mode) {
/* Do lint to check that data values are ok */
error_number = gs1_run_lint(symbol, source, ai_count, ai_vals, ai_locs, data_locs, data_lens);
if (error_number >= ZINT_ERROR) {
return error_number;
}
}
if (set_hrt) {
warn_number = gs1_hrt_conv_parsed(symbol, source, length, ai_count, ai_vals, ai_locs, data_locs,
data_lens, error_number != 0 /*no_errtxt*/);
}
/* Set reduced - need to set it via `ai_vals` etc. so as to lose any superfluous carets/GSs */
for (i = 0, j = 0; i < ai_count; i++) {
const int ai_len = 2 + (ai_vals[i] >= 100) + (ai_vals[i] >= 1000);
memcpy(reduced + j, source + ai_locs[i], ai_len);
j += ai_len;
memcpy(reduced + j, source + data_locs[i], data_lens[i]);
j += data_lens[i];
if (i + 1 != ai_count && !gs1_predefined_len(source + ai_locs[i])) {
reduced[j++] = '\x1D';
}
}
reduced[j] = '\0';
*p_reduced_length = j;
return error_number ? error_number : warn_number;
}
if (source[0] != obracket) { if (source[0] != obracket) {
if (!z_is_fixed_ratio(symbol->symbology)) { /* Only matrix symbols can encode Digital Link URIs */ if (!z_is_fixed_ratio(symbol->symbology)) { /* Only matrix symbols can encode Digital Link URIs */
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 252, "Data does not start with an AI"); return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 252, "Data does not start with an AI");
} }
if (!(is_digital_link = gs1_is_digital_link(source, length))) { if (!is_digital_link) {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 855, return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 855,
"Data does not start with an AI or Digital Link URI"); "Data does not start with an AI or Digital Link URI");
} }
} }
} }
if (is_digital_link) { if (is_digital_link || (done_gs1se && *p_reduced_length)) {
if (!done_gs1se) { if (!done_gs1se) {
/* Just copy over Digital Link URI - no verification */ /* Just copy over Digital Link URI - no verification */
memcpy(reduced, source, length + 1); /* Include terminating NUL */ memcpy(reduced, source, length + 1); /* Include terminating NUL */
*p_reduced_length = length; *p_reduced_length = length;
if (set_hrt) {
error_number = z_hrt_cpy_iso8859_1(symbol, source, length);
}
} }
return 0; return error_number;
} }
if (gs1parens_mode) { if (gs1parens_mode) {
@@ -1881,10 +2252,11 @@ INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char sou
int ai_zero_len_no_data = 0, ai_single_digit = 0, ai_nonnumeric = 0; int ai_zero_len_no_data = 0, ai_single_digit = 0, ai_nonnumeric = 0;
int ai_nonnumeric_pos = 0; /* Suppress gcc 14 "-Wmaybe-uninitialized" false positive */ int ai_nonnumeric_pos = 0; /* Suppress gcc 14 "-Wmaybe-uninitialized" false positive */
const int ai_max = z_chr_cnt(local_source, local_length, obracket) + 1; /* Plus 1 so non-zero */ const int ai_max = z_chr_cnt(local_source, local_length, obracket) + 1; /* Plus 1 so non-zero */
int *ai_value = (int *) z_alloca(sizeof(int) * ai_max);
int *ai_location = (int *) z_alloca(sizeof(int) * ai_max); ai_vals = (int *) z_alloca(sizeof(int) * ai_max);
int *data_location = (int *) z_alloca(sizeof(int) * ai_max); ai_locs = (int *) z_alloca(sizeof(int) * ai_max);
int *data_length = (int *) z_alloca(sizeof(int) * ai_max); data_locs = (int *) z_alloca(sizeof(int) * ai_max);
data_lens = (int *) z_alloca(sizeof(int) * ai_max);
/* Check the balance of the brackets & AI lengths */ /* Check the balance of the brackets & AI lengths */
ai_latch = 0; ai_latch = 0;
@@ -1941,7 +2313,7 @@ INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char sou
if (min_ai_length <= 1) { if (min_ai_length <= 1) {
/* Allow too short AI if GS1NOCHECK_MODE and no single-digit AIs and all zero-length AIs have some data /* Allow too short AI if GS1NOCHECK_MODE and no single-digit AIs and all zero-length AIs have some data
- permits dummy "[]" workaround for ticket #204 data with no valid AI */ - permits dummy "[]" workaround for ticket #204 data with no valid AI */
if (!(symbol->input_mode & GS1NOCHECK_MODE) || ai_single_digit || ai_zero_len_no_data) { if (!gs1nocheck_mode || ai_single_digit || ai_zero_len_no_data) {
/* AI is too short */ /* AI is too short */
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 256, return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 256,
"Invalid AI at position %d in input (AI too short)", min_ai_pos); "Invalid AI at position %d in input (AI too short)", min_ai_pos);
@@ -1954,36 +2326,32 @@ INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char sou
"Invalid AI at position %d in input (non-numeric characters in AI)", ai_nonnumeric_pos); "Invalid AI at position %d in input (non-numeric characters in AI)", ai_nonnumeric_pos);
} }
if (!(symbol->input_mode & GS1NOCHECK_MODE)) { if (!gs1nocheck_mode) {
const unsigned char *local_source2 = local_source; const unsigned char *local_source2 = local_source;
unsigned char *local_source2_buf = (unsigned char *) z_alloca(local_length + 1); unsigned char *local_source2_buf = (unsigned char *) z_alloca(local_length + 1);
int ai_count = 0; int ai_count = 0;
for (i = 1; i < local_length; i++) { for (i = 1; i < local_length; i++) {
if (local_source[i - 1] == obracket) { if (local_source[i - 1] == obracket) {
ai_location[ai_count] = i; ai_locs[ai_count] = i - 1;
for (j = 1; local_source[i + j] != cbracket; j++); for (j = 1; local_source[i + j] != cbracket; j++);
ai_value[ai_count] = z_to_int(local_source + i, j); ai_vals[ai_count] = z_to_int(local_source + i, j);
ai_count++; ai_count++;
i += j; i += j;
} }
} }
for (i = 0; i < ai_count; i++) { for (i = 0; i < ai_count; i++) {
if (ai_value[i] >= 1000) { data_locs[i] = ai_locs[i] + 2 /*brackets*/ + 2 + (ai_vals[i] >= 100) + (ai_vals[i] >= 1000);
data_location[i] = ai_location[i] + 5; data_lens[i] = 0;
} else if (ai_value[i] >= 100) { while (data_locs[i] + data_lens[i] < local_length
data_location[i] = ai_location[i] + 4; && local_source[data_locs[i] + data_lens[i]] != obracket) {
} else { data_lens[i]++;
data_location[i] = ai_location[i] + 3;
} }
data_length[i] = 0; if (data_lens[i] == 0) {
while (data_location[i] + data_length[i] < local_length
&& local_source[data_location[i] + data_length[i]] != obracket) {
data_length[i]++;
}
if (data_length[i] == 0) {
/* No data for given AI */ /* No data for given AI */
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 258, "Empty data field in input"); return ZEXT z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 258,
"Empty data field for AI (%1$02d) at position %2$d",
ai_vals[i], ai_locs[i] + 1);
} }
} }
@@ -1991,82 +2359,54 @@ INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char sou
/* Temporarily re-instate escaped parentheses before linting */ /* Temporarily re-instate escaped parentheses before linting */
local_source2 = local_source2_buf; local_source2 = local_source2_buf;
memcpy(local_source2_buf, local_source, local_length + 1); /* Include terminating NUL */ memcpy(local_source2_buf, local_source, local_length + 1); /* Include terminating NUL */
for (i = 0; i < local_length; i++) { gs1_reinstate_escaped_parens(local_source2_buf, local_length);
if (local_source2_buf[i] < '\x1D') {
local_source2_buf[i] |= GS1_PARENS_PLACEHOLDER_MASK;
}
}
} }
/* Check for valid AI values and data lengths according to GS1 General /* Check AI/data */
Specifications Release 25, January 2025 */ error_number = gs1_run_lint(symbol, local_source2, ai_count, ai_vals, ai_locs, data_locs, data_lens);
for (i = 0; i < ai_count; i++) { if (error_number >= ZINT_ERROR) {
int err_no, err_posn; return error_number;
char err_msg[50];
if (!gs1_lint(ai_value[i], local_source2 + data_location[i], data_length[i], &err_no, &err_posn,
err_msg)) {
if (err_no == 1) {
z_errtxtf(0, symbol, 260, "Invalid AI (%02d)", ai_value[i]);
} else if (err_no == 2 || err_no == 4) { /* 4 is backward-incompatible bad length */
z_errtxtf(0, symbol, 259, "Invalid data length for AI (%02d)", ai_value[i]);
} else {
ZEXT z_errtxtf(0, symbol, 261, "AI (%1$02d) position %2$d: %3$s", ai_value[i], err_posn,
err_msg);
}
/* For backward compatibility only error on unknown AI or bad length */
if (err_no == 1 || err_no == 2) {
return ZINT_ERROR_INVALID_DATA;
}
error_number = ZINT_WARN_NONCOMPLIANT;
}
} }
} }
} }
/* Resolve AI data - put resulting string in 'reduced' */ if (!*p_reduced_length) {
j = 0; /* Resolve AI data - put resulting string in `reduced` */
ai_latch = 1; j = 0;
for (i = 0; i < local_length; i++) { ai_latch = 1;
if (local_source[i] == obracket) { for (i = 0; i < local_length; i++) {
bracket_level++; if (local_source[i] == obracket) {
/* Start of an AI string */ bracket_level++;
if (ai_latch == 0) { /* Start of an AI string */
reduced[j++] = '\x1D'; if (ai_latch == 0) {
} reduced[j++] = '\x1D';
if (i + 1 != local_length) {
int last_ai = z_to_int(local_source + i + 1, 2);
ai_latch = 0;
/* The following values from GS1 General Specifications Release 25.0
Figure 7.8.5-2 "Element strings with predefined length using GS1 Application Identifiers" */
if ((last_ai >= 0 && last_ai <= 4) || (last_ai >= 11 && last_ai <= 20)
/* NOTE: as noted by Terry Burton the following complies with ISO/IEC 24724:2011 Table
D.1, but clashes with TPX AI [235], introduced May 2019; awaiting feedback from GS1 */
|| last_ai == 23 /* legacy support */ /* TODO: probably remove */
|| (last_ai >= 31 && last_ai <= 36) || last_ai == 41) {
ai_latch = 1;
} }
if (i + 1 != local_length) {
ai_latch = gs1_predefined_len(local_source + i + 1);
}
} else if (local_source[i] == cbracket && bracket_level) {
bracket_level--;
} else {
reduced[j++] = local_source[i];
} }
} else if (local_source[i] == cbracket && bracket_level) {
/* The closing bracket is simply dropped from the input */
bracket_level--;
} else {
reduced[j++] = local_source[i];
} }
} reduced[j] = '\0';
reduced[j] = '\0'; *p_reduced_length = j;
*p_reduced_length = j;
if (local_length != length) { if (local_length != length) {
/* Re-instate escaped parentheses */ gs1_reinstate_escaped_parens(reduced, *p_reduced_length);
for (i = 0; i < *p_reduced_length; i++) { }
if (reduced[i] < '\x1D') { if (set_hrt) {
reduced[i] |= GS1_PARENS_PLACEHOLDER_MASK; if (gs1parens_mode) {
warn_number = gs1_hrt_cpy(symbol, source, length, error_number != 0 /*no_errtxt*/);
} else {
warn_number = gs1_hrt_conv_brackets(symbol, source, length, error_number != 0 /*no_errtxt*/);
} }
} }
} }
/* The character '\x1D' (GS) in the reduced string refers to the FNC1 character */ /* The character '\x1D' (GS) in the reduced string refers to the FNC1 character */
return error_number; return error_number ? error_number : warn_number;
} }
/* Helper to return standard GS1 check digit (GS1 General Specifications 7.9.1) */ /* Helper to return standard GS1 check digit (GS1 General Specifications 7.9.1) */
+2 -2
View File
@@ -1,7 +1,7 @@
/* gs1.h - Verifies GS1 data */ /* gs1.h - Verifies GS1 data */
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -38,7 +38,7 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const int length, INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char source[], const int length,
unsigned char reduced[], int *p_reduced_length); unsigned char reduced[], int *p_reduced_length, const int set_hrt);
INTERNAL char zint_gs1_check_digit(const unsigned char source[], const int length); INTERNAL char zint_gs1_check_digit(const unsigned char source[], const int length);
INTERNAL int zint_gs1_iso3166_alpha2(const unsigned char *cc); INTERNAL int zint_gs1_iso3166_alpha2(const unsigned char *cc);
+384 -1
View File
@@ -4,7 +4,7 @@
*/ */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021-2025 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2021-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -713,6 +713,7 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len,
/* Assume data length failure */ /* Assume data length failure */
*p_err_no = 2; *p_err_no = 2;
*p_err_posn = 1;
if (ai < 100) { if (ai < 100) {
@@ -1072,4 +1073,386 @@ static int gs1_lint(const int ai, const unsigned char *data, const int data_len,
return 0; return 0;
} }
/* Helper to parse non-bracketed input */
static int gs1_lint_parse_ai(const unsigned char source[], const int length, const int position,
int *p_ai, int *p_min, int *p_max) {
int ai, ai2, ai3 = -1, ai4 = -1, min, max = 0;
*p_ai = -1;
if (position + 1 >= length || !z_isdigit(source[position]) || !z_isdigit(source[position + 1])) {
return 0;
}
ai2 = z_to_int(source + position, 2);
if (position + 3 < length && z_isdigit(source[position + 2])) {
ai3 = z_to_int(source + position, 3);
if (position + 4 < length && z_isdigit(source[position + 3])) {
ai4 = z_to_int(source + position, 4);
}
}
ai = ai2;
if (ai == 0) {
min = 18, max = 18;
} else if (ai >= 1 && ai <= 3) {
min = 14, max = 14;
} else if (ai == 10 || ai == 21 || ai == 22) {
min = 1, max = 20;
} else if ((ai >= 11 && ai <= 13) || (ai >= 15 && ai <= 17)) {
min = 6, max = 6;
} else if (ai == 20) {
min = 2, max = 2;
} else if (ai == 30 || ai == 37) {
min = 1, max = 8;
} else if (ai == 90) {
min = 1, max = 30;
} else if (ai >= 91) {
min = 1, max = 90;
}
if (max == 0 && ai3 != -1) {
if (ai3 < 300) {
ai = ai3;
if (ai == 235) {
min = 1, max = 28;
} else if (ai == 240 || ai == 241 || ai == 250 || ai == 251) {
min = 1, max = 30;
} else if (ai == 242) {
min = 1, max = 6;
} else if (ai == 243 || ai == 254) {
min = 1, max = 20;
} else if (ai == 253) {
min = 13, max = 30;
} else if (ai == 255) {
min = 13, max = 25;
}
} else if (ai3 < 500) {
ai = ai3;
if (ai == 400 || ai == 403) {
min = 1, max = 30;
} else if (ai == 401) {
min = 1, max = 30;
} else if (ai == 402) {
min = 17, max = 17;
} else if (ai >= 410 && ai <= 417) {
min = 13, max = 13;
} else if (ai == 420) {
min = 1, max = 20;
} else if (ai == 421) {
min = 4, max = 12;
} else if (ai == 422 || ai == 424 || ai == 426) {
min = 3, max = 3;
} else if (ai == 423 || ai == 425) {
min = 3, max = 15;
} else if (ai == 427) {
min = 1, max = 3;
}
} else if (ai3 < 800) {
ai = ai3;
if (ai >= 710 && ai <= 717) {
min = 1, max = 20;
}
}
}
if (max == 0 && ai4 != -1) {
if (ai4 < 3200) {
ai = ai4;
if ((ai >= 3100 && ai <= 3105) || (ai >= 3110 && ai <= 3115) || (ai >= 3120 && ai <= 3125)
|| (ai >= 3130 && ai <= 3135) || (ai >= 3140 && ai <= 3145) || (ai >= 3150 && ai <= 3155)
|| (ai >= 3160 && ai <= 3165)) {
min = 6, max = 6;
}
} else if (ai4 < 3300) {
ai = ai4;
if (ai <= 3205 || (ai >= 3210 && ai <= 3215) || (ai >= 3220 && ai <= 3225) || (ai >= 3230 && ai <= 3235)
|| (ai >= 3240 && ai <= 3245) || (ai >= 3250 && ai <= 3255) || (ai >= 3260 && ai <= 3265)
|| (ai >= 3270 && ai <= 3275) || (ai >= 3280 && ai <= 3285) || (ai >= 3290 && ai <= 3295)) {
min = 6, max = 6;
}
} else if (ai4 < 3400) {
ai = ai4;
if (ai <= 3305 || (ai >= 3310 && ai <= 3315) || (ai >= 3320 && ai <= 3325) || (ai >= 3330 && ai <= 3335)
|| (ai >= 3340 && ai <= 3345) || (ai >= 3350 && ai <= 3355) || (ai >= 3360 && ai <= 3365)
|| (ai >= 3370 && ai <= 3375)) {
min = 6, max = 6;
}
} else if (ai4 < 3500) {
ai = ai4;
if (ai <= 3405 || (ai >= 3410 && ai <= 3415) || (ai >= 3420 && ai <= 3425) || (ai >= 3430 && ai <= 3435)
|| (ai >= 3440 && ai <= 3445) || (ai >= 3450 && ai <= 3455) || (ai >= 3460 && ai <= 3465)
|| (ai >= 3470 && ai <= 3475) || (ai >= 3480 && ai <= 3485) || (ai >= 3490 && ai <= 3495)) {
min = 6, max = 6;
}
} else if (ai4 < 3600) {
ai = ai4;
if (ai <= 3505 || (ai >= 3510 && ai <= 3515) || (ai >= 3520 && ai <= 3525) || (ai >= 3530 && ai <= 3535)
|| (ai >= 3540 && ai <= 3545) || (ai >= 3550 && ai <= 3555) || (ai >= 3560 && ai <= 3565)
|| (ai >= 3570 && ai <= 3575)) {
min = 6, max = 6;
}
} else if (ai4 < 3700) {
ai = ai4;
if (ai <= 3605 || (ai >= 3610 && ai <= 3615) || (ai >= 3620 && ai <= 3625) || (ai >= 3630 && ai <= 3635)
|| (ai >= 3640 && ai <= 3645) || (ai >= 3650 && ai <= 3655) || (ai >= 3660 && ai <= 3665)
|| (ai >= 3670 && ai <= 3675) || (ai >= 3680 && ai <= 3685) || (ai >= 3690 && ai <= 3695)) {
min = 6, max = 6;
}
} else if (ai4 < 4000) {
ai = ai4;
if ((ai >= 3900 && ai <= 3909) || (ai >= 3920 && ai <= 3929)) {
min = 1, max = 15;
} else if ((ai >= 3910 && ai <= 3919) || (ai >= 3930 && ai <= 3939)) {
min = 4, max = 18;
} else if (ai >= 3940 && ai <= 3943) {
min = 4, max = 4;
} else if (ai >= 3950 && ai <= 3955) {
min = 6, max = 6;
}
} else if (ai4 < 4400) {
ai = ai4;
if (ai == 4300 || ai == 4301 || ai == 4310 || ai == 4311 || ai == 4320) {
min = 1, max = 35;
} else if ((ai >= 4302 && ai <= 4306) || (ai >= 4312 && ai <= 4316)) {
min = 1, max = 70;
} else if (ai == 4307 || ai == 4317) {
min = 2, max = 2;
} else if (ai == 4308 || ai == 4319) {
min = 1, max = 30;
} else if (ai == 4309) {
min = 20, max = 20;
} else if (ai == 4318) {
min = 1, max = 20;
} else if (ai >= 4321 && ai <= 4323) {
min = 1, max = 1;
} else if (ai == 4324 || ai == 4325) {
min = 10, max = 10;
} else if (ai == 4326) {
min = 6, max = 6;
} else if (ai >= 4330 && ai <= 4333) {
min = 6, max = 7;
}
} else if (ai4 < 7100) {
ai = ai4;
if (ai == 7001) {
min = 13, max = 13;
} else if (ai == 7002) {
min = 1, max = 30;
} else if (ai == 7003) {
min = 10, max = 10;
} else if (ai == 7004) {
min = 1, max = 4;
} else if (ai == 7005) {
min = 1, max = 12;
} else if (ai == 7006) {
min = 6, max = 6;
} else if (ai == 7007) {
min = 6, max = 12;
} else if (ai == 7008) {
min = 1, max = 3;
} else if (ai == 7009) {
min = 1, max = 10;
} else if (ai == 7010) {
min = 1, max = 2;
} else if (ai == 7011) {
min = 6, max = 10;
} else if (ai >= 7020 && ai <= 7022) {
min = 1, max = 20;
} else if (ai == 7023) {
min = 1, max = 30;
} else if (ai >= 7030 && ai <= 7039) {
min = 4, max = 30;
} else if (ai == 7040) {
min = 4, max = 4;
} else if (ai == 7041) {
min = 1, max = 4;
}
} else if (ai4 < 7300) {
ai = ai4;
if (ai >= 7230 && ai <= 7239) {
min = 3, max = 30;
} else if (ai == 7240) {
min = 1, max = 20;
} else if (ai == 7241) {
min = 2, max = 2;
} else if (ai == 7242) {
min = 1, max = 25;
} else if (ai == 7250) {
min = 8, max = 8;
} else if (ai == 7251) {
min = 12, max = 12;
} else if (ai == 7252) {
min = 1, max = 1;
} else if (ai == 7253 || ai == 7254 || ai == 7259) {
min = 1, max = 40;
} else if (ai == 7255) {
min = 1, max = 10;
} else if (ai == 7256) {
min = 1, max = 90;
} else if (ai == 7257) {
min = 1, max = 70;
} else if (ai == 7258) {
min = 3, max = 3;
}
} else if (ai4 < 8100) {
ai = ai4;
if (ai == 8001) {
min = 14, max = 14;
} else if (ai == 8002 || ai == 8012) {
min = 1, max = 20;
} else if (ai == 8003) {
min = 14, max = 30;
} else if (ai == 8004) {
min = 1, max = 30;
} else if (ai == 8005) {
min = 6, max = 6;
} else if (ai == 8006 || ai == 8026) {
min = 18, max = 18;
} else if (ai == 8007) {
min = 1, max = 34;
} else if (ai == 8008) {
min = 8, max = 12;
} else if (ai == 8009) {
min = 1, max = 50;
} else if (ai == 8010) {
min = 1, max = 30;
} else if (ai == 8011) {
min = 1, max = 12;
} else if (ai == 8013) {
min = 1, max = 25;
} else if (ai == 8014) {
min = 1, max = 25;
} else if (ai == 8017 || ai == 8018) {
min = 18, max = 18;
} else if (ai == 8019) {
min = 1, max = 10;
} else if (ai == 8020) {
min = 1, max = 25;
} else if (ai == 8030) {
min = 1, max = 90;
} else if (ai == 8040 || ai == 8041) {
min = 15, max = 15;
} else if (ai == 8042) {
min = 32, max = 32;
} else if (ai == 8043) {
min = 18, max = 20;
}
} else if (ai4 < 8200) {
ai = ai4;
if (ai == 8110) {
min = 1, max = 70;
} else if (ai == 8111) {
min = 4, max = 4;
} else if (ai == 8112) {
min = 1, max = 70;
}
} else if (ai4 < 8300) {
ai = ai4;
if (ai == 8200) {
min = 1, max = 70;
}
}
}
if (max == 0) {
*p_ai = ai2; /* Use 2-digit as feedback */
return 0;
}
assert(ai >= 0 && ai <= 9999);
assert(min >= 1);
assert(max >= min);
*p_ai = ai;
if (p_min) {
*p_min = min;
}
if (p_max) {
*p_max = max;
}
return 1;
}
/* Parse non-bracketed input */
static int gs1_lint_parse_raw_caret(const unsigned char source[], const int length,
const int ai_max, int *ai_vals, int *ai_locs, int *data_locs, int *data_lens, int *p_ai_count,
int *p_err_no, int *p_err_posn) {
int i, j;
const int gs1_caret = source[0] == '^';
const unsigned char separator = gs1_caret ? '^' : '\x1D';
int ai, max;
int ai_count = 0, ai_len;
#ifdef NDEBUG
(void)ai_max;
#endif
i = gs1_caret || source[0] == '\x1D'; /* Allow GS at start also */
if (i >= length) {
*p_ai_count = 0; /* For feedback */
ai_vals[0] = -1;
ai_locs[0] = i - 1;
*p_err_no = 1;
*p_err_posn = i;
return 0;
}
while (i < length) {
int data_start, data_max, on_separator;
assert(ai_count < ai_max);
ai_locs[ai_count] = i;
if (!gs1_lint_parse_ai(source, length, i, &ai, NULL /*min*/, &max)) {
*p_ai_count = ai_count; /* For feedback */
ai_vals[ai_count] = ai; /* May be -1 */
*p_err_no = 1;
*p_err_posn = i + 1; /* Position 1-base */
return 0;
}
ai_vals[ai_count] = ai;
ai_len = ai < 100 ? 2 : ai < 1000 ? 3 : 4;
/* Following GS1 Syntax Engine tolerating superfluous FNC1s at end of AI data
(for both final AI and AIs with predefined length) */
data_start = i + ai_len;
data_max = data_start + max;
for (j = data_start; j < length && j < data_max; j++) {
if (source[j] == separator) {
break;
}
}
data_locs[ai_count] = data_start;
/* Only checking that have at least one char, and haven't exceeded max */
on_separator = j < length && source[j] == separator;
if (j == data_start || (j + 1 == length && length > data_max && !on_separator)) {
*p_ai_count = ai_count; /* For feedback */
data_lens[ai_count] = j - data_start;
*p_err_no = 2;
*p_err_posn = i + 1; /* Position 1-base */
return 0;
}
data_lens[ai_count] = j - data_locs[ai_count];
ai_count++;
i = j + on_separator;
}
*p_ai_count = ai_count;
return 1;
}
#endif /* Z_GS1_LINT_H */ #endif /* Z_GS1_LINT_H */
+2 -2
View File
@@ -1218,7 +1218,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
if (is_composite || !check_force_gs1(symbol->symbology)) { if (is_composite || !check_force_gs1(symbol->symbology)) {
unsigned char *reduced = (unsigned char *) z_alloca(local_segs[0].length + 1); unsigned char *reduced = (unsigned char *) z_alloca(local_segs[0].length + 1);
error_number = zint_gs1_verify(symbol, local_segs[0].source, local_segs[0].length, reduced, error_number = zint_gs1_verify(symbol, local_segs[0].source, local_segs[0].length, reduced,
&local_segs[0].length); &local_segs[0].length, 0 /*set_hrt*/);
if (error_number) { if (error_number) {
#ifdef ZINT_HAVE_GS1SE #ifdef ZINT_HAVE_GS1SE
if (is_composite && !(symbol->input_mode & GS1SYNTAXENGINE_MODE)) { if (is_composite && !(symbol->input_mode & GS1SYNTAXENGINE_MODE)) {
@@ -1387,7 +1387,7 @@ static int txt_hex_plot(struct zint_symbol *symbol) {
} }
if (!zint_fm_close(fmp, symbol)) { if (!zint_fm_close(fmp, symbol)) {
return ZEXT z_errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 792, "Failure on closing TXT output file (%1$d: %2$s)", return ZEXT z_errtxtf(ZINT_ERROR_FILE_WRITE, symbol, 796, "Failure on closing TXT output file (%1$d: %2$s)",
fmp->err, strerror(fmp->err)); fmp->err, strerror(fmp->err));
} }
+10 -19
View File
@@ -1,7 +1,7 @@
/* rss.c - GS1 DataBar (formerly Reduced Space Symbology) */ /* rss.c - GS1 DataBar (formerly Reduced Space Symbology) */
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -1188,17 +1188,6 @@ static void dbar_exp_separator(struct zint_symbol *symbol, int width, const int
} }
} }
/* Set HRT for DataBar Expanded */
static void dbar_exp_hrt(struct zint_symbol *symbol, unsigned char source[], const int length) {
/* Max possible length is 77 digits so will fit */
if (symbol->input_mode & GS1PARENS_MODE) {
z_hrt_cpy_nochk(symbol, source, length);
} else {
z_hrt_conv_gs1_brackets_nochk(symbol, source, length);
}
}
/* Return DataBar Expanded group (-1) */ /* Return DataBar Expanded group (-1) */
static int dbar_exp_group(const int val) { static int dbar_exp_group(const int val) {
int i; int i;
@@ -1225,10 +1214,11 @@ INTERNAL int zint_dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[]
int reduced_length; int reduced_length;
/* Allow for 8 bits + 5-bit latch per char + 200 bits overhead/padding */ /* Allow for 8 bits + 5-bit latch per char + 200 bits overhead/padding */
char *binary_string = (char *) z_alloca(13 * length + 200 + 1); char *binary_string = (char *) z_alloca(13 * length + 200 + 1);
const int set_hrt = symbol->symbology == BARCODE_DBAR_EXP || symbol->symbology == BARCODE_DBAR_EXP_CC;
const int content_segs = symbol->output_options & BARCODE_CONTENT_SEGS; const int content_segs = symbol->output_options & BARCODE_CONTENT_SEGS;
const int debug_print = symbol->debug & ZINT_DEBUG_PRINT; const int debug_print = symbol->debug & ZINT_DEBUG_PRINT;
error_number = zint_gs1_verify(symbol, source, length, reduced, &reduced_length); error_number = zint_gs1_verify(symbol, source, length, reduced, &reduced_length, set_hrt);
if (error_number >= ZINT_ERROR) { if (error_number >= ZINT_ERROR) {
return error_number; return error_number;
} }
@@ -1318,10 +1308,6 @@ INTERNAL int zint_dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[]
check_char = 211 * (symbol_chars - 4) + checksum % 211; check_char = 211 * (symbol_chars - 4) + checksum % 211;
if (debug_print) {
printf("Data chars: %d, Check char: %d\n", data_chars, check_char);
}
group = dbar_exp_group(check_char); group = dbar_exp_group(check_char);
odd = (check_char - dbar_exp_g_sum[group]) / dbar_exp_t_even[group]; odd = (check_char - dbar_exp_g_sum[group]) / dbar_exp_t_even[group];
@@ -1335,6 +1321,11 @@ INTERNAL int zint_dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[]
pattern_width = codeblocks * 5 + symbol_chars * 8 + 4; pattern_width = codeblocks * 5 + symbol_chars * 8 + 4;
memset(elements, 0, sizeof(int) * pattern_width); memset(elements, 0, sizeof(int) * pattern_width);
if (debug_print) {
printf("Data chars: %d, Check char: %d, Codeblocks: %d, Symbol chars: %d\n",
data_chars, check_char, codeblocks, symbol_chars);
}
/* Put finder patterns in element array */ /* Put finder patterns in element array */
p = (symbol_chars - 1) / 2 - 1; p = (symbol_chars - 1) / 2 - 1;
for (i = 0; i < codeblocks; i++) { for (i = 0; i < codeblocks; i++) {
@@ -1380,7 +1371,7 @@ INTERNAL int zint_dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[]
} }
symbol->rows++; symbol->rows++;
dbar_exp_hrt(symbol, source, length); /* HRT set by `zint_gs1_verify()` */
if (content_segs && z_ct_cpy(symbol, reduced, reduced_length)) { if (content_segs && z_ct_cpy(symbol, reduced, reduced_length)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy()` only fails with OOM */ return ZINT_ERROR_MEMORY; /* `z_ct_cpy()` only fails with OOM */
@@ -1498,7 +1489,7 @@ INTERNAL int zint_dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[]
if (symbol->symbology == BARCODE_DBAR_EXP_CC || symbol->symbology == BARCODE_DBAR_EXPSTK_CC) { if (symbol->symbology == BARCODE_DBAR_EXP_CC || symbol->symbology == BARCODE_DBAR_EXPSTK_CC) {
/* Composite separator */ /* Composite separator */
dbar_exp_separator(symbol, symbol->width, 4, separator_row, 1 /*above*/, 0 /*special_case_row*/, dbar_exp_separator(symbol, symbol->width, codeblocks, separator_row, 1 /*above*/, 0 /*special_case_row*/,
1 /*left_to_right*/, 0 /*odd_last_row*/, NULL); 1 /*left_to_right*/, 0 /*odd_last_row*/, NULL);
} }
+1 -1
View File
@@ -4934,7 +4934,7 @@ static void test_encode(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[8192]; char escaped[8192];
char cmp_buf[32768]; char cmp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */ /* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
+4 -4
View File
@@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -2897,7 +2897,7 @@ static void test_encode(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[8192]; char escaped[8192];
char bwipp_buf[32768]; char bwipp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char bwipp_msg[1024]; char bwipp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
@@ -3286,7 +3286,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[8192]; char escaped[8192];
char bwipp_buf[32768]; char bwipp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char bwipp_msg[1024]; char bwipp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
@@ -3574,7 +3574,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char bwipp_buf[32768]; char bwipp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char bwipp_msg[1024]; char bwipp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
+2 -2
View File
@@ -104,7 +104,7 @@ static void test_large(const testCtx *const p_ctx) {
char escaped2[1024]; char escaped2[1024];
char cmp_buf[8192]; char cmp_buf[8192];
char cmp_msg[1024]; char cmp_msg[1024];
char ret_buf[8192] = {0}; /* Suppress clang -fsanitize=memory false positive */ char ret_buf[8192] ZINT_TESTUTIL_SANITIZEM_INIT;
/* Only do BWIPP/zxing-cpp tests if asked, too slow otherwise */ /* Only do BWIPP/zxing-cpp tests if asked, too slow otherwise */
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript();
@@ -937,7 +937,7 @@ static void test_hibc_input(const testCtx *const p_ctx) {
char escaped[1024]; char escaped[1024];
char escaped2[1024]; char escaped2[1024];
char cmp_buf[8192]; char cmp_buf[8192] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
char ret_buf[8192]; char ret_buf[8192];
File diff suppressed because it is too large Load Diff
+13 -11
View File
@@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -360,7 +360,7 @@ static void test_large(const testCtx *const p_ctx) {
char data_buf[ZINT_MAX_DATA_LEN]; char data_buf[ZINT_MAX_DATA_LEN];
char escaped[8192]; char escaped[8192] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_buf[32768]; char cmp_buf[32768];
char cmp_msg[1024]; char cmp_msg[1024];
@@ -1304,7 +1304,7 @@ static void test_input(const testCtx *const p_ctx) {
&& data[i].option_3 == data[i - 1].option_3 && data[i].option_3 == data[i - 1].option_3
&& data[i].output_options == data[i - 1].output_options && data[i].output_options == data[i - 1].output_options
&& strcmp(data[i].data, data[i - 1].data) == 0) { && strcmp(data[i].data, data[i - 1].data) == 0) {
unsigned char binary[2][2200]; unsigned char binary[2][2200] ZINT_TESTUTIL_SANITIZEM_INIT_2D;
int gs1; int gs1;
int binlen; int binlen;
int binlens[2] = {0}; int binlens[2] = {0};
@@ -1319,7 +1319,7 @@ static void test_input(const testCtx *const p_ctx) {
i, expected_rows_width, prev_expected_rows_width); i, expected_rows_width, prev_expected_rows_width);
if ((data[i].input_mode & 0x07) == GS1_MODE) { if ((data[i].input_mode & 0x07) == GS1_MODE) {
ret = zint_gs1_verify(symbol, ZUCP(data[i].data), length, reduced, &length); ret = zint_gs1_verify(symbol, ZUCP(data[i].data), length, reduced, &length, 0 /*set_hrt*/);
assert_zero(ret, "i:%d zint_gs1_verify() ret %d != 0 (%s)\n", i, ret, symbol->errtxt); assert_zero(ret, "i:%d zint_gs1_verify() ret %d != 0 (%s)\n", i, ret, symbol->errtxt);
text = reduced; text = reduced;
} else { } else {
@@ -6395,7 +6395,7 @@ static void test_encode_segs(const testCtx *const p_ctx) {
testFinish(); testFinish();
} }
static void test_rt(const testCtx *const p_ctx) { static void test_ct(const testCtx *const p_ctx) {
int debug = p_ctx->debug; int debug = p_ctx->debug;
struct item { struct item {
@@ -6427,9 +6427,11 @@ static void test_rt(const testCtx *const p_ctx) {
/* 11*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 899, BARCODE_CONTENT_SEGS, "é", -1, 0, 899, "é", -1, 899 }, /* 11*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 899, BARCODE_CONTENT_SEGS, "é", -1, 0, 899, "é", -1, 899 },
/* 12*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "", -1, 0 }, /* 12*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "", -1, 0 },
/* 13*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, BARCODE_CONTENT_SEGS, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "01049123451234591597033130128\03510ABC123", -1, 3 }, /* 13*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, BARCODE_CONTENT_SEGS, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 0, "01049123451234591597033130128\03510ABC123", -1, 3 },
/* 14*/ { BARCODE_DATAMATRIX, GS1_MODE, 28, BARCODE_CONTENT_SEGS, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 28, "01049123451234591597033130128\03510ABC123", -1, 3 }, /* Note: content seg ECI rremains at default 3 */ /* 14*/ { BARCODE_DATAMATRIX, GS1_MODE, 28, BARCODE_CONTENT_SEGS, "[01]04912345123459[15]970331[30]128[10]ABC123", -1, 0, 28, "01049123451234591597033130128\03510ABC123", -1, 3 }, /* Note: content seg ECI remains at default 3 */
/* 15*/ { BARCODE_HIBC_DM, UNICODE_MODE, -1, -1, "H123ABC01234567890", -1, 0, 0, "", -1, 0 }, /* 15*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, -1, "https://example.com/01/09506000134369", -1, 0, 0, "", -1, 0 },
/* 16*/ { BARCODE_HIBC_DM, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "H123ABC01234567890", -1, 0, 0, "+H123ABC01234567890D", -1, 3 }, /* 16*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, BARCODE_CONTENT_SEGS, "https://example.com/01/09506000134369", -1, 0, 0, "https://example.com/01/09506000134369", -1, 3 },
/* 17*/ { BARCODE_HIBC_DM, UNICODE_MODE, -1, -1, "H123ABC01234567890", -1, 0, 0, "", -1, 0 },
/* 18*/ { BARCODE_HIBC_DM, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "H123ABC01234567890", -1, 0, 0, "+H123ABC01234567890D", -1, 3 },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@@ -6487,7 +6489,7 @@ static void test_rt(const testCtx *const p_ctx) {
testFinish(); testFinish();
} }
static void test_rt_segs(const testCtx *const p_ctx) { static void test_ct_segs(const testCtx *const p_ctx) {
int debug = p_ctx->debug; int debug = p_ctx->debug;
struct item { struct item {
@@ -7686,8 +7688,8 @@ int main(int argc, char *argv[]) {
{ "test_input", test_input }, { "test_input", test_input },
{ "test_encode", test_encode }, { "test_encode", test_encode },
{ "test_encode_segs", test_encode_segs }, { "test_encode_segs", test_encode_segs },
{ "test_rt", test_rt }, { "test_ct", test_ct },
{ "test_rt_segs", test_rt_segs }, { "test_ct_segs", test_ct_segs },
#ifdef ZINT_TEST_ENCODING #ifdef ZINT_TEST_ENCODING
{ "test_minimalenc", test_minimalenc }, { "test_minimalenc", test_minimalenc },
#endif #endif
+2 -2
View File
@@ -71,7 +71,7 @@ static void test_large(const testCtx *const p_ctx) {
char data_buf[4096]; char data_buf[4096];
char escaped[8192]; char escaped[8192];
char cmp_buf[50000]; char cmp_buf[50000] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/zxing-cpp tests if asked, too slow otherwise */ /* Only do BWIPP/zxing-cpp tests if asked, too slow otherwise */
@@ -294,7 +294,7 @@ static void test_input(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[1024]; char escaped[1024];
char cmp_buf[32768]; char cmp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */ /* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
+2949 -2247
View File
File diff suppressed because it is too large Load Diff
+854 -416
View File
File diff suppressed because it is too large Load Diff
+6 -6
View File
@@ -195,15 +195,15 @@ static void test_checks(const testCtx *const p_ctx) {
/*131*/ { BARCODE_CODE128, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 }, /*131*/ { BARCODE_CODE128, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
/*132*/ { BARCODE_MAXICODE, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 }, /*132*/ { BARCODE_MAXICODE, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
/*133*/ { BARCODE_MAXICODE, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 }, /*133*/ { BARCODE_MAXICODE, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
/*134*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /*134*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) data position 14: Bad checksum '4', expected '1'", -1 },
/*135*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /*135*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) data position 14: Bad checksum '4', expected '1'", -1 },
/*136*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, /*136*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 },
/*137*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /*137*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*138*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, /*138*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
/*139*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /*139*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 },
/*140*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 }, /*140*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 },
/*141*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /* Warning in encoder overrides library warnings */ /*141*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /* Warning in encoder overrides library warnings */
/*142*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /* But not errors */ /*142*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) data position 14: Bad checksum '4', expected '1'", -1 }, /* But not errors */
/*143*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, /*143*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 },
/*144*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /*144*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*145*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, /*145*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
@@ -2105,7 +2105,7 @@ static int test_prev_ZBarcode_BarcodeName(int symbol_id, char name[32]) {
static void test_barcode_name(const testCtx *const p_ctx) { static void test_barcode_name(const testCtx *const p_ctx) {
int ret; int ret;
char name[32] = {0}; /* Suppress clang -fsanitize=memory false positive */ char name[32] ZINT_TESTUTIL_SANITIZEM_INIT;
int symbol_id; int symbol_id;
(void)p_ctx; (void)p_ctx;
@@ -2810,8 +2810,8 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
for (i = 0; i < data_size; i++) { for (i = 0; i < data_size; i++) {
int ret_dest; int ret_dest;
unsigned char dest[1024]; unsigned char dest[1024] ZINT_TESTUTIL_SANITIZEM_INIT;
int dest_length; int dest_length ZINT_TESTUTIL_SANITIZEM_INIT;
if (testContinue(p_ctx, i)) continue; if (testContinue(p_ctx, i)) continue;
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -648,7 +648,7 @@ static void test_2d_encode(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[8192]; char escaped[8192];
char cmp_buf[32768]; char cmp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */ /* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
+10 -10
View File
@@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -70,10 +70,10 @@ static void test_qr_large(const testCtx *const p_ctx) {
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char data_buf[ZINT_MAX_DATA_LEN]; char data_buf[ZINT_MAX_DATA_LEN] ZINT_TESTUTIL_SANITIZEM_INIT;
char escaped[ZINT_MAX_DATA_LEN] = {0}; /* Suppress clang -fsanitize=memory false positive */ char escaped[ZINT_MAX_DATA_LEN] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_buf[177 * 177 + 1] = {0}; /* Suppress clang -fsanitize=memory false positive */ char cmp_buf[177 * 177 + 1] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */ /* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
@@ -489,7 +489,7 @@ static void test_qr_input(const testCtx *const p_ctx) {
char escaped[4096]; char escaped[4096];
char escaped2[4096]; char escaped2[4096];
char ret_buf[4096]; char ret_buf[4096];
char cmp_buf[32768] = {0}; /* Suppress clang -fsanitize=memory false positive */ char cmp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */ /* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
@@ -856,7 +856,7 @@ static void test_qr_optimize(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[4096]; char escaped[4096];
char cmp_buf[32768] = {0}; /* Suppress clang -fsanitize=memory false positive */ char cmp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */ /* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
@@ -4740,7 +4740,7 @@ static void test_qr_encode_segs(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[4096]; char escaped[4096];
char cmp_buf[32768]; char cmp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */ /* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
@@ -7369,7 +7369,7 @@ static void test_upnqr_encode(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[4096]; char escaped[4096];
char cmp_buf[32768]; char cmp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
#if 0 /* Need to add "force binary mode" to BWIPP for this to work */ #if 0 /* Need to add "force binary mode" to BWIPP for this to work */
@@ -8078,7 +8078,7 @@ static void test_rmqr_large(const testCtx *const p_ctx) {
char data_buf[ZINT_MAX_DATA_LEN]; char data_buf[ZINT_MAX_DATA_LEN];
char escaped[4096]; char escaped[4096];
char cmp_buf[32768]; char cmp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do ZXing-C++ test if asked, too slow otherwise */ /* Only do ZXing-C++ test if asked, too slow otherwise */
@@ -9397,7 +9397,7 @@ static void test_rmqr_encode_segs(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[4096]; char escaped[4096];
char cmp_buf[32768] = {0}; /* Suppress clang -fsanitize=memory false positive */ char cmp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */ /* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
+21 -19
View File
@@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -790,7 +790,7 @@ static void test_examples(const testCtx *const p_ctx) {
"00000100010110000110100000001010101010111100111101110010110001110011101000000000100010000011010010000100011110111011001000101010101010011101111111010000000000000000000000000000000000000000000000000000" "00000100010110000110100000001010101010111100111101110010110001110011101000000000100010000011010010000100011110111011001000101010101010011101111111010000000000000000000000000000000000000000000000000000"
"00100011101001111001001111110000010101000011000010001101001110001100010111111111001101111100101101111011100001000100110011000000000101100010000000101010000000000000000000000000000000000000000000000000" "00100011101001111001001111110000010101000011000010001101001110001100010111111111001101111100101101111011100001000100110011000000000101100010000000101010000000000000000000000000000000000000000000000000"
}, },
/* 90*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141416543213500110000310123196000", 0, 5, 200, 1, "NACAG Figure 1 (& Appendix C: Example 6) specifying max rows", /* 90*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141416543213500110000310123196000", 0, 5, 200, 0, "NACAG Figure 1 (& Appendix C: Example 6) specifying max rows; BWIPP need segments arg, see above",
"01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111100001010100011111100001010000010101111000111010000011001101011111111001110000001101101000101" "01001100101110001110111111110000101000001101000001010111100110111000101111100000011011010001000000110000111100001010100011111100001010000010101111000111010000011001101011111111001110000001101101000101"
"00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000011110101010100000010100101111101010000111000101111100110010100000000100001111110010010110000" "00000011010001110001000000001010010111110010111110101000011001000111010000010101000100101110111111001111000011110101010100000010100101111101010000111000101111100110010100000000100001111110010010110000"
"00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "00000101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
@@ -804,7 +804,7 @@ static void test_examples(const testCtx *const p_ctx) {
"0000001000100001011010000000010000111001101101100001100111100100100010100001010100100001101011111000000000000000000000000000000000000000000000000000000" "0000001000100001011010000000010000111001101101100001100111100100100010100001010100100001101011111000000000000000000000000000000000000000000000000000000"
"1011110111011110100101111111100111000110010010011110011000011011011100011110000001011110010100000100100000000000000000000000000000000000000000000000000" "1011110111011110100101111111100111000110010010011110011000011011011100011110000001011110010100000100100000000000000000000000000000000000000000000000000"
}, },
/* 92*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]10614141011111275110111", 0, 5, 151, 1, "NACAG Figure 3 specifying max rows", /* 92*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]10614141011111275110111", 0, 5, 151, 0, "NACAG Figure 3 specifying max rows; BWIPP need segments arg, see above",
"0101011110011100001011111111000010100000110100000101011110011011100010111110000001101101000100000011000011100001101010001111110000101010000011000111010" "0101011110011100001011111111000010100000110100000101011110011011100010111110000001101101000100000011000011100001101010001111110000101010000011000111010"
"0000100001100011110100000000101001011111001011111010100001100100011101000001010100010010111011111100111100011110010101010000001010010101111100111000000" "0000100001100011110100000000101001011111001011111010100001100100011101000001010100010010111011111100111100011110010101010000001010010101111100111000000"
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
@@ -818,7 +818,7 @@ static void test_examples(const testCtx *const p_ctx) {
"0000011010011011100010100101010100100111000100000101010000111000110010100000101010001111000101110100011001110001101000100000001010101011011110000111010111110001101011101000000000100011110100100010000110101100111000001000101010101000000000000000000000000000000000000000000000000000000000000000000000" "0000011010011011100010100101010100100111000100000101010000111000110010100000101010001111000101110100011001110001101000100000001010101011011110000111010111110001101011101000000000100011110100100010000110101100111000001000101010101000000000000000000000000000000000000000000000000000000000000000000000"
"0010000101100100011100011000000001011000111011111010101111000111001101011111000000110000111010001011100110001110010111001111110000010100100001111000101000001110010100010111111111001100001011011101111001010011000111110011000000000101000000000000000000000000000000000000000000000000000000000000000000" "0010000101100100011100011000000001011000111011111010101111000111001101011111000000110000111010001011100110001110010111001111110000010100100001111000101000001110010100010111111111001100001011011101111001010011000111110011000000000101000000000000000000000000000000000000000000000000000000000000000000"
}, },
/* 94*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 1, "NACAG Figure 4, specifying max rows", /* 94*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]106141410222223100110222111101231023456721104561045678991201", 0, 5, 298, 0, "NACAG Figure 4, specifying max rows; BWIPP need segments arg, see above",
"0100101111101001111011111111000010110010000011001101011110011011100010111100000000101101000100000011000011100001101010001111110000101011000011100001010111000011011110101111000000111010011111000101110001110110011001100011110000001011100110000101000110101111110111001011111111001110011010011100001101" "0100101111101001111011111111000010110010000011001101011110011011100010111100000000101101000100000011000011100001101010001111110000101011000011100001010111000011011110101111000000111010011111000101110001110110011001100011110000001011100110000101000110101111110111001011111111001110011010011100001101"
"0000010000010110000100000000101001001101111100110010100001100100011101000010101010010010111011111100111100011110010101010000001010010100111100011110101000111100100001010000101010000101100000111010001110001001100110010100001010100100011001111010111001010000001000110100000000100001100101100011110000" "0000010000010110000100000000101001001101111100110010100001100100011101000010101010010010111011111100111100011110010101010000001010010100111100011110101000111100100001010000101010000101100000111010001110001001100110010100001010100100011001111010111001010000001000110100000000100001100101100011110000"
"0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000" "0000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010000"
@@ -832,7 +832,7 @@ static void test_examples(const testCtx *const p_ctx) {
"000001110000100101101000000101000011110100100011100111100001001101001010010101010010011111110101101100010010110011111010000010101000111101010000010001110001001100110010001010101010100011000111001011000010011010000010100000000010000000000000000000000" "000001110000100101101000000101000011110100100011100111100001001101001010010101010010011111110101101100010010110011111010000010101000111101010000010001110001001100110010001010101010100011000111001011000010011010000010100000000010000000000000000000000"
"101110001111011010010111111000011100001011011100011000011110110010110001100000000101100000001010010011101101001100000101111100000011000010101111101110001110110011001100110000000001011100111000110100111101100101111101011111111100110100000000000000000" "101110001111011010010111111000011100001011011100011000011110110010110001100000000101100000001010010011101101001100000101111100000011000010101111101110001110110011001100110000000001011100111000110100111101100101111101011111111100110100000000000000000"
}, },
/* 96*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 1, "NACAG Appendix C: Example 1, specifying max row", /* 96*/ { BARCODE_DBAR_EXPSTK, -1, -1, 2, "[8110]1061414165432131501101201211014092110256100126663101231", 0, 5, 249, 0, "NACAG Appendix C: Example 1, specifying max row; BWIPP need segments arg, see above",
"010111101100011011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010100000101011110001110100000110011010111100000011101001111000101111000111011001001110001111000000101011001000001110010" "010111101100011011101111111100001011001000001100110101111001101110001011110000000010110100010000001100001111000010101000111111000010100000101011110001110100000110011010111100000011101001111000101111000111011001001110001111000000101011001000001110010"
"000000010011100100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001011111010100001110001011111001100101000010101000010110000111010000111000100110110001010000101010010100110111110000000" "000000010011100100010000000010100100110111110011001010000110010001110100001010101001001011101111110011110000111101010101000000101001011111010100001110001011111001100101000010101000010110000111010000111000100110110001010000101010010100110111110000000"
"000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000" "000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010100000"
@@ -872,8 +872,8 @@ static void test_examples(const testCtx *const p_ctx) {
int i, length, ret; int i, length, ret;
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[4096] = {0}; /* Suppress clang -fsanitize=memory false positive */ char escaped[4096] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_buf[16384]; char cmp_buf[16384] ZINT_TESTUTIL_SANITIZEM_INIT;
char cmp_msg[1024]; char cmp_msg[1024];
/* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */ /* Only do BWIPP/ZXing-C++ tests if asked, too slow otherwise */
@@ -1332,12 +1332,14 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 9*/ { BARCODE_DBAR_LTD, BARCODE_CONTENT_SEGS, "13410567901384", 0, "(01)13410567901384", "0113410567901384" }, /* 9*/ { BARCODE_DBAR_LTD, BARCODE_CONTENT_SEGS, "13410567901384", 0, "(01)13410567901384", "0113410567901384" },
/* 10*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", 0, "(01)12345678901231", "" }, /* See test_hrt() in "test_gs1.c" for full HRT tests */ /* 10*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", 0, "(01)12345678901231", "" }, /* See test_hrt() in "test_gs1.c" for full HRT tests */
/* 11*/ { BARCODE_DBAR_EXP, BARCODE_CONTENT_SEGS, "[01]12345678901231", 0, "(01)12345678901231", "0112345678901231" }, /* 11*/ { BARCODE_DBAR_EXP, BARCODE_CONTENT_SEGS, "[01]12345678901231", 0, "(01)12345678901231", "0112345678901231" },
/* 12*/ { BARCODE_DBAR_STK, -1, "12345678901231", 0, "", "" }, /* No HRT for stacked */ /* 12*/ { BARCODE_DBAR_EXP, -1, "^0112345678901231", 0, "(01)12345678901231", "" },
/* 13*/ { BARCODE_DBAR_STK, BARCODE_CONTENT_SEGS, "12345678901231", 0, "", "0112345678901231" }, /* But have content segs */ /* 13*/ { BARCODE_DBAR_EXP, BARCODE_CONTENT_SEGS, "^0112345678901231", 0, "(01)12345678901231", "0112345678901231" },
/* 14*/ { BARCODE_DBAR_OMNSTK, -1, "10000000000090", 0, "", "" }, /* 14*/ { BARCODE_DBAR_STK, -1, "12345678901231", 0, "", "" }, /* No HRT for stacked */
/* 15*/ { BARCODE_DBAR_OMNSTK, BARCODE_CONTENT_SEGS, "10000000000090", 0, "", "0110000000000090" }, /* 15*/ { BARCODE_DBAR_STK, BARCODE_CONTENT_SEGS, "12345678901231", 0, "", "0112345678901231" }, /* But have content segs */
/* 16*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", 0, "", "" }, /* 16*/ { BARCODE_DBAR_OMNSTK, -1, "10000000000090", 0, "", "" },
/* 17*/ { BARCODE_DBAR_EXPSTK, BARCODE_CONTENT_SEGS, "[01]12345678901231", 0, "", "0112345678901231" }, /* 17*/ { BARCODE_DBAR_OMNSTK, BARCODE_CONTENT_SEGS, "10000000000090", 0, "", "0110000000000090" },
/* 18*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", 0, "", "" },
/* 19*/ { BARCODE_DBAR_EXPSTK, BARCODE_CONTENT_SEGS, "[01]12345678901231", 0, "", "0112345678901231" },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int i, length, ret; int i, length, ret;
@@ -1441,16 +1443,16 @@ static void test_input(const testCtx *const p_ctx) {
/* 34*/ { BARCODE_DBAR_LTD, -1, -1, -1, "[01)12345678901231", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 18 too long (maximum 14)", 0, 0 }, /* 34*/ { BARCODE_DBAR_LTD, -1, -1, -1, "[01)12345678901231", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 18 too long (maximum 14)", 0, 0 },
/* 35*/ { BARCODE_DBAR_LTD, -1, -1, -1, "[10]12345678901231", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 18 too long (maximum 14)", 0, 0 }, /* 35*/ { BARCODE_DBAR_LTD, -1, -1, -1, "[10]12345678901231", ZINT_ERROR_TOO_LONG, -1, -1, "Error 382: Input length 18 too long (maximum 14)", 0, 0 },
/* 36*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)", 0, 0 }, /* 36*/ { BARCODE_DBAR_LTD, GS1NOCHECK_MODE, -1, -1, "22345678901238", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 384: Input value out of range (0 to 1999999999999)", 0, 0 },
/* 37*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", 0, 0 }, /* 37*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) data position 14: Bad checksum '4', expected '1'", 0, 0 },
/* 38*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "", 0, 0 }, /* 38*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "", 0, 0 },
/* 39*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231", 0, 1, 134, "", 0, 0 }, /* 39*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231", 0, 1, 134, "", 0, 0 },
/* 40*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 }, /* 40*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 },
/* 41*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 }, /* 41*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 },
/* 42*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)", 0, 0 }, /* 42*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01) at position 1", 0, 0 },
/* 43*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 1, 151, "", 0, 0 }, /* 43*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 1, 151, "", 0, 0 },
/* 44*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", 0, 0 }, /* 44*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 1, 134, "Warning 261: AI (01) data position 14: Bad checksum '4', expected '1'", 0, 0 },
/* 45*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "", 0, 0 }, /* 45*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 1, 134, "", 0, 0 },
/* 46*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", ZINT_WARN_NONCOMPLIANT, 1, 526, "Warning 261: AI (91) position 21: Invalid CSET 82 character ' '", 0, 0 }, /* ISOIEC punc */ /* 46*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", ZINT_WARN_NONCOMPLIANT, 1, 526, "Warning 261: AI (91) data position 21: Invalid CSET 82 character ' '", 0, 0 }, /* ISOIEC punc */
/* 47*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", 0, 1, 526, "", 0, 0 }, /* 47*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_ ", 0, 1, 526, "", 0, 0 },
/* 48*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "", 0, 0 }, /* ISOIEC punc less space */ /* 48*/ { BARCODE_DBAR_EXP, -1, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "", 0, 0 }, /* ISOIEC punc less space */
/* 49*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "", 0, 0 }, /* 49*/ { BARCODE_DBAR_EXP, GS1NOCHECK_MODE, -1, -1, "[01]12345678901231[91]!\"%&'()*+,-./:;<=>?_", 0, 1, 494, "", 0, 0 },
@@ -1486,12 +1488,12 @@ static void test_input(const testCtx *const p_ctx) {
/* 79*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "(01)12345678901231", 0, 5, 50, "", 0, 0 }, /* Allow '(01)' prefix if check digit given */ /* 79*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "(01)12345678901231", 0, 5, 50, "", 0, 0 }, /* Allow '(01)' prefix if check digit given */
/* 80*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "(01)1234567890123", 0, 5, 50, "", 0, 0 }, /* Or not */ /* 80*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "(01)1234567890123", 0, 5, 50, "", 0, 0 }, /* Or not */
/* 81*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "(00)12345678901231", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 18 too long (maximum 14)", 0, 0 }, /* 81*/ { BARCODE_DBAR_OMNSTK, -1, -1, -1, "(00)12345678901231", ZINT_ERROR_TOO_LONG, -1, -1, "Error 380: Input length 18 too long (maximum 14)", 0, 0 },
/* 82*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 102, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", 2, 0 }, /* 82*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901234", ZINT_WARN_NONCOMPLIANT, 5, 102, "Warning 261: AI (01) data position 14: Bad checksum '4', expected '1'", 2, 0 },
/* 83*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 5, 102, "", 2, 0 }, /* 83*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]12345678901234", 0, 5, 102, "", 2, 0 },
/* 84*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901231", 0, 5, 102, "", 2, 0 }, /* 84*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]12345678901231", 0, 5, 102, "", 2, 0 },
/* 85*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 }, /* 85*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 },
/* 86*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 }, /* 86*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]1234567890123A", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 385: Invalid character in Compressed Field data (digits only)", 0, 0 },
/* 87*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01)", 0, 0 }, /* 87*/ { BARCODE_DBAR_EXPSTK, -1, -1, -1, "[01]123456789012315", ZINT_ERROR_INVALID_DATA, -1, -1, "Error 259: Invalid data length for AI (01) at position 1", 0, 0 },
/* 88*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 5, 102, "", 2, 0 }, /* 88*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, -1, "[01]123456789012315", 0, 5, 102, "", 2, 0 },
/* 89*/ { BARCODE_DBAR_EXPSTK, -1, 12, -1, "[01]12345678901231", 0, 5, 102, "", 2, 0 }, /* Cols > 11 ignored */ /* 89*/ { BARCODE_DBAR_EXPSTK, -1, 12, -1, "[01]12345678901231", 0, 5, 102, "", 2, 0 }, /* Cols > 11 ignored */
/* 90*/ { BARCODE_DBAR_EXPSTK, -1, -1, 12, "[01]12345678901231", 0, 5, 102, "", 2, 0 }, /* Rows > 11 ignored */ /* 90*/ { BARCODE_DBAR_EXPSTK, -1, -1, 12, "[01]12345678901231", 0, 5, 102, "", 2, 0 }, /* Rows > 11 ignored */
+2 -2
View File
@@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -810,7 +810,7 @@ static void test_encode(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL; struct zint_symbol *symbol = NULL;
char escaped[1024]; char escaped[1024];
char bwipp_buf[32768]; char bwipp_buf[32768] ZINT_TESTUTIL_SANITIZEM_INIT;
char bwipp_msg[1024]; char bwipp_msg[1024];
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */
+54 -34
View File
@@ -570,6 +570,7 @@ const char *testUtilInputModeName(int input_mode) {
{ "FAST_MODE", FAST_MODE, 0x0080 }, { "FAST_MODE", FAST_MODE, 0x0080 },
{ "EXTRA_ESCAPE_MODE", EXTRA_ESCAPE_MODE, 0x0100 }, { "EXTRA_ESCAPE_MODE", EXTRA_ESCAPE_MODE, 0x0100 },
{ "GS1SYNTAXENGINE_MODE", GS1SYNTAXENGINE_MODE, 0x0200 }, { "GS1SYNTAXENGINE_MODE", GS1SYNTAXENGINE_MODE, 0x0200 },
{ "GS1RAW_MODE", GS1RAW_MODE, 0x0400 },
}; };
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
int set, i; int set, i;
@@ -2296,7 +2297,7 @@ int testUtilVerifyTiffInfo(const char *filename, int debug) {
/* Map Zint symbology to BWIPP routine */ /* Map Zint symbology to BWIPP routine */
static const char *testUtilBwippName(int index, const struct zint_symbol *symbol, int option_1, int option_2, static const char *testUtilBwippName(int index, const struct zint_symbol *symbol, int option_1, int option_2,
int option_3, int debug, int *linear_row_height, int *gs1_cvt) { int option_3, int debug, int *p_linear_row_height, int *p_gs1_cvt) {
struct item { struct item {
const char *name; const char *name;
int define; int define;
@@ -2324,7 +2325,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "ean13", BARCODE_EANX, 13, 0, 1, 0, 0, 1 /*gs1_cvt*/, }, { "ean13", BARCODE_EANX, 13, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "ean13", BARCODE_EANX_CHK, 14, 0, 1, 0, 0, 1, }, { "ean13", BARCODE_EANX_CHK, 14, 0, 1, 0, 0, 1, },
{ "ean13", BARCODE_EAN13, 15, 0, 1, 0, 0, 1, }, { "ean13", BARCODE_EAN13, 15, 0, 1, 0, 0, 1, },
{ "gs1-128", BARCODE_GS1_128, 16, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, { "gs1-128", BARCODE_GS1_128, 16, 0, 0, 1 /*GS1CARET*/, 0, 1 /*gs1_cvt*/, },
{ "", -1, 17, 0, 0, 0, 0, 0, }, { "", -1, 17, 0, 0, 0, 0, 0, },
{ "rationalizedCodabar", BARCODE_CODABAR, 18, 0, 1, 0, 0, 0, }, { "rationalizedCodabar", BARCODE_CODABAR, 18, 0, 1, 0, 0, 0, },
{ "", -1, 19, 0, 0, 0, 0, 0, }, { "", -1, 19, 0, 0, 0, 0, 0, },
@@ -2339,7 +2340,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "flattermarken", BARCODE_FLAT, 28, 0, 0, 0, 0, 0, }, { "flattermarken", BARCODE_FLAT, 28, 0, 0, 0, 0, 0, },
{ "databaromni", BARCODE_DBAR_OMN, 29, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, { "databaromni", BARCODE_DBAR_OMN, 29, 0, 0, 0, 0, 1 /*gs1_cvt*/, },
{ "databarlimited", BARCODE_DBAR_LTD, 30, 0, 0, 0, 0, 1, }, { "databarlimited", BARCODE_DBAR_LTD, 30, 0, 0, 0, 0, 1, },
{ "databarexpanded", BARCODE_DBAR_EXP, 31, 0, 1, 0, 1 /*linear_row_height*/, 1, }, { "databarexpanded", BARCODE_DBAR_EXP, 31, 0, 1, 1 /*GS1CARET*/, 1 /*linear_row_height*/, 1, },
{ "telepen", BARCODE_TELEPEN, 32, 0, 0, 0, 0, 0, }, { "telepen", BARCODE_TELEPEN, 32, 0, 0, 0, 0, 0, },
{ "", -1, 33, 0, 0, 0, 0, 0, }, { "", -1, 33, 0, 0, 0, 0, 0, },
{ "upca", BARCODE_UPCA, 34, 0, 1, 0, 0, 1 /*gs1_cvt*/, }, { "upca", BARCODE_UPCA, 34, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
@@ -2380,7 +2381,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "isbn", BARCODE_ISBNX, 69, 0, 1, 0, 0, 1 /*gs1_cvt*/, }, { "isbn", BARCODE_ISBNX, 69, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "royalmail", BARCODE_RM4SCC, 70, 0, 0, 0, 0, 0, }, { "royalmail", BARCODE_RM4SCC, 70, 0, 0, 0, 0, 0, },
{ "datamatrix", BARCODE_DATAMATRIX, 71, 0, 1, 1, 1, 0, }, { "datamatrix", BARCODE_DATAMATRIX, 71, 0, 1, 1, 1, 0, },
{ "ean14", BARCODE_EAN14, 72, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, { "ean14", BARCODE_EAN14, 72, 0, 0, 1 /*GS1CARET*/, 0, 1 /*gs1_cvt*/, },
{ "code39", BARCODE_VIN, 73, 0, 0, 0, 0, 0, }, { "code39", BARCODE_VIN, 73, 0, 0, 0, 0, 0, },
{ "codablockf", BARCODE_CODABLOCKF, 74, 1, 1, 0, 10 /*linear_row_height*/, 0, }, { "codablockf", BARCODE_CODABLOCKF, 74, 1, 1, 0, 10 /*linear_row_height*/, 0, },
{ "sscc18", BARCODE_NVE18, 75, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, { "sscc18", BARCODE_NVE18, 75, 0, 0, 0, 0, 1 /*gs1_cvt*/, },
@@ -2389,7 +2390,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "", -1, 78, 0, 0, 0, 0, 0, }, { "", -1, 78, 0, 0, 0, 0, 0, },
{ "databarstacked", BARCODE_DBAR_STK, 79, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, { "databarstacked", BARCODE_DBAR_STK, 79, 0, 0, 0, 0, 1 /*gs1_cvt*/, },
{ "databarstackedomni", BARCODE_DBAR_OMNSTK, 80, 0, 0, 0, 33 /*linear_row_height*/, 1, }, { "databarstackedomni", BARCODE_DBAR_OMNSTK, 80, 0, 0, 0, 33 /*linear_row_height*/, 1, },
{ "databarexpandedstacked", BARCODE_DBAR_EXPSTK, 81, 0, 1, 0, 34 /*linear_row_height*/, 1, }, { "databarexpandedstacked", BARCODE_DBAR_EXPSTK, 81, 0, 1, 1 /*GS1CARET*/, 34 /*linear_row_height*/, 1, },
{ "planet", BARCODE_PLANET, 82, 0, 0, 0, 0, 0, }, { "planet", BARCODE_PLANET, 82, 0, 0, 0, 0, 0, },
{ "", -1, 83, 0, 0, 0, 0, 0, }, { "", -1, 83, 0, 0, 0, 0, 0, },
{ "micropdf417", BARCODE_MICROPDF417, 84, 0, 1, 0, 0, 0, }, { "micropdf417", BARCODE_MICROPDF417, 84, 0, 1, 0, 0, 0, },
@@ -2439,15 +2440,15 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "aztecrune", BARCODE_AZRUNE, 128, 0, 0, 0, 0, 0, }, { "aztecrune", BARCODE_AZRUNE, 128, 0, 0, 0, 0, 0, },
{ "code32", BARCODE_CODE32, 129, 0, 0, 0, 0, 0, }, { "code32", BARCODE_CODE32, 129, 0, 0, 0, 0, 0, },
{ "ean13composite", BARCODE_EANX_CC, 130, 1, 1, 0, 72 /*linear_row_height*/, 1 /*gs1_cvt*/, }, { "ean13composite", BARCODE_EANX_CC, 130, 1, 1, 0, 72 /*linear_row_height*/, 1 /*gs1_cvt*/, },
{ "gs1-128composite", BARCODE_GS1_128_CC, 131, 1, 0, 0, 36, 1, }, { "gs1-128composite", BARCODE_GS1_128_CC, 131, 1, 0, 1 /*GS1CARET*/, 36, 1, },
{ "databaromnicomposite", BARCODE_DBAR_OMN_CC, 132, 1, 0, 0, 33, 1, }, { "databaromnicomposite", BARCODE_DBAR_OMN_CC, 132, 1, 0, 0, 33, 1, },
{ "databarlimitedcomposite", BARCODE_DBAR_LTD_CC, 133, 1, 0, 0, 10 /*linear_row_height*/, 1, }, { "databarlimitedcomposite", BARCODE_DBAR_LTD_CC, 133, 1, 0, 0, 10 /*linear_row_height*/, 1, },
{ "databarexpandedcomposite", BARCODE_DBAR_EXP_CC, 134, 1, 1, 0, 34 /*linear_row_height*/, 1, }, { "databarexpandedcomposite", BARCODE_DBAR_EXP_CC, 134, 1, 1, 1 /*GS1CARET*/, 34 /*linear_row_height*/, 1, },
{ "upcacomposite", BARCODE_UPCA_CC, 135, 1, 1, 0, 72, 1, }, { "upcacomposite", BARCODE_UPCA_CC, 135, 1, 1, 0, 72, 1, },
{ "upcecomposite", BARCODE_UPCE_CC, 136, 1, 1, 0, 72, 1, }, { "upcecomposite", BARCODE_UPCE_CC, 136, 1, 1, 0, 72, 1, },
{ "databarstackedcomposite", BARCODE_DBAR_STK_CC, 137, 1, 0, 0, 0, 1, }, { "databarstackedcomposite", BARCODE_DBAR_STK_CC, 137, 1, 0, 0, 0, 1, },
{ "databarstackedomnicomposite", BARCODE_DBAR_OMNSTK_CC, 138, 1, 0, 0, 33 /*linear_row_height*/, 1, }, { "databarstackedomnicomposite", BARCODE_DBAR_OMNSTK_CC, 138, 1, 0, 0, 33 /*linear_row_height*/, 1, },
{ "databarexpandedstackedcomposite", BARCODE_DBAR_EXPSTK_CC, 139, 1, 1, 0, 34 /*linear_row_height*/, 1, }, { "databarexpandedstackedcomposite", BARCODE_DBAR_EXPSTK_CC, 139, 1, 1, 1 /*GS1CARET*/, 34 /*lin_r_h*/, 1, },
{ "channelcode", BARCODE_CHANNEL, 140, 0, 0, 0, 0, 0, }, { "channelcode", BARCODE_CHANNEL, 140, 0, 0, 0, 0, 0, },
{ "codeone", BARCODE_CODEONE, 141, 0, 1, 0, 0, 0, }, { "codeone", BARCODE_CODEONE, 141, 0, 1, 0, 0, 0, },
{ "", BARCODE_GRIDMATRIX, 142, 0, 0, 0, 0, 0, }, { "", BARCODE_GRIDMATRIX, 142, 0, 0, 0, 0, 0, },
@@ -2462,7 +2463,9 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
const int data_size = ARRAY_SIZE(data); const int data_size = ARRAY_SIZE(data);
const int symbology = symbol->symbology; const int symbology = symbol->symbology;
const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE; const int gs1raw_mode = !!(symbol->input_mode & GS1RAW_MODE);
const int gs1_caret = option_3 != -1 && !!(option_3 & ZINT_TESTUTIL_GS1CARET); /* Hack indicator */
const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE || gs1raw_mode || gs1_caret;
if (symbology < 0 || symbology >= data_size) { if (symbology < 0 || symbology >= data_size) {
fprintf(stderr, "testUtilBwippName: unknown symbology (%d)\n", symbology); fprintf(stderr, "testUtilBwippName: unknown symbology (%d)\n", symbology);
@@ -2544,16 +2547,30 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
} }
} }
if (linear_row_height) { if (p_linear_row_height) {
*linear_row_height = data[symbology].linear_row_height; *p_linear_row_height = data[symbology].linear_row_height;
} }
if (gs1_cvt) { if (p_gs1_cvt) {
*gs1_cvt = data[symbology].gs1_cvt; *p_gs1_cvt = data[symbology].gs1_cvt;
} }
if (gs1) { if (gs1) {
if (gs1raw_mode) {
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible, GS1RAW_MODE not supported\n",
index, testUtilBarcodeName(symbology));
}
return NULL;
}
if (gs1_caret) {
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible, GS1 Syntax Engine caret input not supported\n",
index, testUtilBarcodeName(symbology));
}
return NULL;
}
if (symbology == BARCODE_DATAMATRIX) { if (symbology == BARCODE_DATAMATRIX) {
if (gs1_cvt) { if (p_gs1_cvt) {
*gs1_cvt = 1; *p_gs1_cvt = 1;
} }
return "gs1datamatrix"; return "gs1datamatrix";
} else if (symbology == BARCODE_AZTEC || symbology == BARCODE_CODE16K || symbology == BARCODE_ULTRA } else if (symbology == BARCODE_AZTEC || symbology == BARCODE_CODE16K || symbology == BARCODE_ULTRA
@@ -2564,13 +2581,13 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
} }
return NULL; return NULL;
} else if (symbology == BARCODE_QRCODE) { } else if (symbology == BARCODE_QRCODE) {
if (gs1_cvt) { if (p_gs1_cvt) {
*gs1_cvt = 1; *p_gs1_cvt = 1;
} }
return "gs1qrcode"; return "gs1qrcode";
} else if (symbology == BARCODE_DOTCODE) { } else if (symbology == BARCODE_DOTCODE) {
if (gs1_cvt) { if (p_gs1_cvt) {
*gs1_cvt = 1; *p_gs1_cvt = 1;
} }
return "gs1dotcode"; return "gs1dotcode";
} }
@@ -3876,8 +3893,8 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "", -1, 5, }, { "", -1, 5, },
{ "", BARCODE_C25LOGIC, 6, }, { "", BARCODE_C25LOGIC, 6, },
{ "", BARCODE_C25IND, 7, }, { "", BARCODE_C25IND, 7, },
{ "Code39", BARCODE_CODE39, 8, }, { "Code39Std", BARCODE_CODE39, 8, },
{ "Code39", BARCODE_EXCODE39, 9, }, /* TODO: Code39 with specially encoded chars */ { "Code39", BARCODE_EXCODE39, 9, },
{ "EAN8", BARCODE_EAN8, 10, }, { "EAN8", BARCODE_EAN8, 10, },
{ "", BARCODE_EAN_2ADDON, 11, }, { "", BARCODE_EAN_2ADDON, 11, },
{ "", BARCODE_EAN_5ADDON, 12, }, { "", BARCODE_EAN_5ADDON, 12, },
@@ -3918,9 +3935,9 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "", BARCODE_MSI_PLESSEY, 47, }, { "", BARCODE_MSI_PLESSEY, 47, },
{ "", -1, 48, }, { "", -1, 48, },
{ "", BARCODE_FIM, 49, }, { "", BARCODE_FIM, 49, },
{ "Code39", BARCODE_LOGMARS, 50, }, { "Code39Std", BARCODE_LOGMARS, 50, },
{ "", BARCODE_PHARMA, 51, }, { "", BARCODE_PHARMA, 51, },
{ "Code39", BARCODE_PZN, 52, }, { "Code39Std", BARCODE_PZN, 52, },
{ "", BARCODE_PHARMA_TWO, 53, }, { "", BARCODE_PHARMA_TWO, 53, },
{ "", -1, 54, }, { "", -1, 54, },
{ "PDF417", BARCODE_PDF417, 55, }, { "PDF417", BARCODE_PDF417, 55, },
@@ -3941,7 +3958,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "", BARCODE_RM4SCC, 70, }, { "", BARCODE_RM4SCC, 70, },
{ "DataMatrix", BARCODE_DATAMATRIX, 71, }, { "DataMatrix", BARCODE_DATAMATRIX, 71, },
{ "Code128", BARCODE_EAN14, 72, }, { "Code128", BARCODE_EAN14, 72, },
{ "Code39", BARCODE_VIN, 73, }, { "Code39Std", BARCODE_VIN, 73, },
{ "CodablockF", BARCODE_CODABLOCKF, 74, }, { "CodablockF", BARCODE_CODABLOCKF, 74, },
{ "Code128", BARCODE_NVE18, 75, }, { "Code128", BARCODE_NVE18, 75, },
{ "", BARCODE_JAPANPOST, 76, }, { "", BARCODE_JAPANPOST, 76, },
@@ -3967,7 +3984,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "Code128", BARCODE_DPD, 96, }, { "Code128", BARCODE_DPD, 96, },
{ "MicroQRCode", BARCODE_MICROQR, 97, }, { "MicroQRCode", BARCODE_MICROQR, 97, },
{ "Code128", BARCODE_HIBC_128, 98, }, { "Code128", BARCODE_HIBC_128, 98, },
{ "Code39", BARCODE_HIBC_39, 99, }, { "Code39Std", BARCODE_HIBC_39, 99, },
{ "", -1, 100, }, { "", -1, 100, },
{ "", -1, 101, }, { "", -1, 101, },
{ "DataMatrix", BARCODE_HIBC_DM, 102, }, { "DataMatrix", BARCODE_HIBC_DM, 102, },
@@ -4127,12 +4144,12 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
if (symbology == BARCODE_EXCODE39) { if (symbology == BARCODE_EXCODE39) {
if (symbol->option_2 == 1) { if (symbol->option_2 == 1) {
opts = "tryCode39ExtendedMode,validateCode39CheckSum"; opts = "tryCode39ExtendedMode,validateOptionalChecksum";
} else { } else {
opts = "tryCode39ExtendedMode"; opts = "tryCode39ExtendedMode";
} }
} else if ((symbology == BARCODE_CODE39 || symbology == BARCODE_LOGMARS) && symbol->option_2 == 1) { } else if ((symbology == BARCODE_CODE39 || symbology == BARCODE_LOGMARS) && symbol->option_2 == 1) {
opts = "validateCode39CheckSum"; opts = "validateOptionalChecksum";
} }
if (zxingcpp_cmp > 1 && symbol->eci == 0) { if (zxingcpp_cmp > 1 && symbol->eci == 0) {
@@ -4283,8 +4300,8 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
const int is_extra_escaped = (symbol->input_mode & EXTRA_ESCAPE_MODE) && symbol->symbology == BARCODE_CODE128; const int is_extra_escaped = (symbol->input_mode & EXTRA_ESCAPE_MODE) && symbol->symbology == BARCODE_CODE128;
const int is_escaped = (symbol->input_mode & ESCAPE_MODE) || is_extra_escaped; const int is_escaped = (symbol->input_mode & ESCAPE_MODE) || is_extra_escaped;
const int is_hibc = symbology >= BARCODE_HIBC_128 && symbology <= BARCODE_HIBC_AZTEC; const int is_hibc = symbology >= BARCODE_HIBC_128 && symbology <= BARCODE_HIBC_AZTEC;
const int have_c25checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2; const int have_ccheckdigit = symbol->option_2 == 1 || symbol->option_2 == 2; /* Good for C25, CODE39, CODABAR */
const int have_c25inter = (symbology == BARCODE_C25INTER && ((expected_len & 1) || have_c25checkdigit)) const int have_c25inter = (symbology == BARCODE_C25INTER && ((expected_len & 1) || have_ccheckdigit))
|| symbology == BARCODE_ITF14 || symbology == BARCODE_DPLEIT || symbology == BARCODE_ITF14 || symbology == BARCODE_DPLEIT
|| symbology == BARCODE_DPIDENT; || symbology == BARCODE_DPIDENT;
const int is_upcean = (ZBarcode_Cap(symbology, ZINT_CAP_EANUPC) & ZINT_CAP_EANUPC) == ZINT_CAP_EANUPC; const int is_upcean = (ZBarcode_Cap(symbology, ZINT_CAP_EANUPC) & ZINT_CAP_EANUPC) == ZINT_CAP_EANUPC;
@@ -4362,7 +4379,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
expected = escaped; expected = escaped;
} }
if (gs1 && symbology != BARCODE_EAN14 && symbology != BARCODE_NVE18) { if (gs1 && symbology != BARCODE_EAN14 && symbology != BARCODE_NVE18) {
ret = zint_gs1_verify(symbol, ZUCP(expected), expected_len, ZUCP(reduced), &expected_len); ret = zint_gs1_verify(symbol, ZUCP(expected), expected_len, ZUCP(reduced), &expected_len, 0 /*set_hrt*/);
if (ret >= ZINT_ERROR) { if (ret >= ZINT_ERROR) {
sprintf(msg, "zint_gs1_verify %d != 0", ret); sprintf(msg, "zint_gs1_verify %d != 0", ret);
return 3; return 3;
@@ -4441,7 +4458,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
cmp_len -= 2; cmp_len -= 2;
expected++; expected++;
expected_len -= 2; expected_len -= 2;
if (symbol->option_2 == 1 || symbol->option_2 == 2) { if (have_ccheckdigit) {
cmp_len--; /* Too messy to calc the check digit so ignore */ cmp_len--; /* Too messy to calc the check digit so ignore */
} }
} else if (is_vin_international) { } else if (is_vin_international) {
@@ -4451,15 +4468,15 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
expected = vin; expected = vin;
} else if (have_c25inter) { } else if (have_c25inter) {
if (symbology == BARCODE_C25INTER) { if (symbology == BARCODE_C25INTER) {
if ((expected_len & 1) || have_c25checkdigit) { if ((expected_len & 1) || have_ccheckdigit) {
if (((expected_len & 1) && !have_c25checkdigit) || (!(expected_len & 1) && have_c25checkdigit)) { if (((expected_len & 1) && !have_ccheckdigit) || (!(expected_len & 1) && have_ccheckdigit)) {
c25inter[0] = '0'; c25inter[0] = '0';
memcpy(c25inter + 1, expected, expected_len); memcpy(c25inter + 1, expected, expected_len);
expected_len++; expected_len++;
} else { } else {
memcpy(c25inter, expected, expected_len); memcpy(c25inter, expected, expected_len);
} }
if (have_c25checkdigit) { if (have_ccheckdigit) {
c25inter[expected_len] = zint_gs1_check_digit((const unsigned char *) c25inter, expected_len); c25inter[expected_len] = zint_gs1_check_digit((const unsigned char *) c25inter, expected_len);
expected_len++; expected_len++;
} }
@@ -4652,6 +4669,9 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
expected = azrune; expected = azrune;
expected_len = 3; expected_len = 3;
} }
} else if ((symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_LOGMARS)
&& have_ccheckdigit) {
cmp_len--; /* Too tedious to calculate so ignore */
} }
if (ret_buf) { if (ret_buf) {
+12 -1
View File
@@ -1,6 +1,6 @@
/* /*
libzint - the open source barcode library 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 Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -49,6 +49,17 @@ extern "C" {
#define ZINT_DEBUG_TEST_ZXINGCPP 512 #define ZINT_DEBUG_TEST_ZXINGCPP 512
#define ZINT_DEBUG_TEST_BWIPP_ZXINGCPP 1024 #define ZINT_DEBUG_TEST_BWIPP_ZXINGCPP 1024
#ifdef ZINT_SANITIZEM /* Suppress clang -fsanitize=memory false positives */
#define ZINT_TESTUTIL_SANITIZEM_INIT = {0}
#define ZINT_TESTUTIL_SANITIZEM_INIT_2D = {{0}}
#else
#define ZINT_TESTUTIL_SANITIZEM_INIT
#define ZINT_TESTUTIL_SANITIZEM_INIT_2D
#endif
/* Hack `option_3` flag to indicate GS1 Syntax Engine caret input */
#define ZINT_TESTUTIL_GS1CARET (1 << 24)
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include "../common.h" #include "../common.h"
Binary file not shown.
+238 -6
View File
@@ -2,7 +2,7 @@
/* Generate GS1 verify include "backend/gs1_lint.h" for "backend/gs1.c" */ /* Generate GS1 verify include "backend/gs1_lint.h" for "backend/gs1.c" */
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021-2025 <rstuart114@gmail.com> Copyright (C) 2021-2026 <rstuart114@gmail.com>
*/ */
/* SPDX-License-Identifier: BSD-3-Clause */ /* SPDX-License-Identifier: BSD-3-Clause */
@@ -76,8 +76,8 @@ foreach ($lines as $line) {
} }
if (($hyphen = strpos($ai, '-')) !== false) { if (($hyphen = strpos($ai, '-')) !== false) {
if ($fixed !== '') { if ($fixed) {
$fixed_ais[substr($ai, 0, 2)] = true; $fixed_ais[substr($ai, 0, 2)] = strlen(substr($ai, 0, $hyphen));
} }
$ai_s = (int) substr($ai, 0, $hyphen); $ai_s = (int) substr($ai, 0, $hyphen);
$ai_e = (int) substr($ai, $hyphen + 1); $ai_e = (int) substr($ai, $hyphen + 1);
@@ -98,8 +98,8 @@ foreach ($lines as $line) {
} }
} }
} else { } else {
if ($fixed !== '') { if ($fixed) {
$fixed_ais[substr($ai, 0, 2)] = true; $fixed_ais[substr($ai, 0, 2)] = strlen($ai);
} }
$ai = (int) $ai; $ai = (int) $ai;
$ais[] = $ai; $ais[] = $ai;
@@ -243,7 +243,7 @@ if ($print_copyright) {
print <<<'EOD' print <<<'EOD'
/* /*
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2021-2025 Robin Stuart <rstuart114@gmail.com> Copyright (C) 2021-2026 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions modification, are permitted provided that the following conditions
@@ -365,6 +365,7 @@ $tab$tab{$tab}char err_msg[50]) {
$tab/* Assume data length failure */ $tab/* Assume data length failure */
$tab*p_err_no = 2; $tab*p_err_no = 2;
$tab*p_err_posn = 1;
EOD; EOD;
@@ -477,6 +478,237 @@ $tab}
EOD; EOD;
print <<<EOD
/* Helper to parse non-bracketed input */
static int gs1_lint_parse_ai(const unsigned char source[], const int length, const int position,
$tab$tab{$tab}int *p_ai, int *p_min, int *p_max) {
${tab}int ai, ai2, ai3 = -1, ai4 = -1, min, max = 0;
{$tab}*p_ai = -1;
{$tab}if (position + 1 >= length || !z_isdigit(source[position]) || !z_isdigit(source[position + 1])) {
$tab{$tab}return 0;
{$tab}}
{$tab}ai2 = z_to_int(source + position, 2);
{$tab}if (position + 3 < length && z_isdigit(source[position + 2])) {
$tab{$tab}ai3 = z_to_int(source + position, 3);
$tab{$tab}if (position + 4 < length && z_isdigit(source[position + 3])) {
$tab$tab{$tab}ai4 = z_to_int(source + position, 4);
$tab{$tab}}
{$tab}}
EOD;
$not_first_batch = false;
$last_batch_e = -1;
$big_batch = 2;
foreach ($batches as $batch => $batch_specs) {
if (empty($batch_specs)) {
continue;
}
$batch_s = $batch * 100;
$batch_e = $batch_s + 100;
$n = $batch_s < 100 ? 2 : ($batch_s < 1000 ? 3 : 4);
$first_tab = $n == 2 ? "" : $tab . $tab;
if ($n == 2) {
print "\n{$first_tab}{$tab}ai = ai2;\n";
} else {
if ($n != $big_batch) {
if ($n == 3) {
print "\n{$tab}if (max == 0 && ai3 != -1) {\n";
} else {
print "{$first_tab}}\n\n{$tab}}\n\n{$tab}if (max == 0 && ai4 != -1) {\n";
}
$not_first_batch = false;
}
if ($not_first_batch) {
print "\n$first_tab} else if (ai" . $n. " < $batch_e) {\n{$first_tab}{$tab}ai = ai" . $n . ";\n";
} else {
print "\n{$first_tab}if (ai" . $n . " < $batch_e) {\n{$first_tab}{$tab}ai = ai" . $n . ";\n";
$not_first_batch = true;
}
}
$not_first_spec = false;
foreach ($batch_specs as $spec) {
$total_min = $spec_ais[$spec][0];
$total_max = $spec_ais[$spec][1];
$ais = $spec_ais[$spec][2];
if ($not_first_spec) {
$str = "$first_tab{$tab}} else if (";
} else {
$str = "$first_tab{$tab}if (";
$not_first_spec = true;
}
print $str;
$width = strlen($str);
// Count the applicable AIs
$ais_cnt = 0;
foreach ($ais as $ai) {
if (is_array($ai)) {
if ($ai[1] < $batch_s || $ai[0] >= $batch_e) {
continue;
}
} else {
if ($ai < $batch_s || $ai >= $batch_e) {
continue;
}
}
$ais_cnt++;
}
// Output
$not_first_ai = false;
foreach ($ais as $ai) {
if (is_array($ai)) {
if ($ai[1] < $batch_s || $ai[0] >= $batch_e) {
continue;
}
} else {
if ($ai < $batch_s || $ai >= $batch_e) {
continue;
}
}
$str = '';
if ($not_first_ai) {
$str .= " || ";
} else {
$not_first_ai = true;
}
if (is_array($ai)) {
if ($ai[0] === $last_batch_e) { // Don't need 1st element of range if excluded by previous batch
$str .= "ai <= " . $ai[1];
} else if ($ai[1] + 1 == $batch_e) { // Don't need 2nd element of range if excluded by this batch
$str .= "ai >= " . $ai[0];
} else {
if ($ais_cnt > 1) {
$str .= "(ai >= " . $ai[0] . " && ai <= " . $ai[1] . ")";
} else {
$str .= "ai >= " . $ai[0] . " && ai <= " . $ai[1];
}
}
} else {
$str .= "ai == " . $ai;
}
if ($width + strlen($str) > 118) {
print "\n";
$str2 = "$first_tab$tab$tab ";
print $str2;
$width = strlen($str2);
}
print $str;
$width += strlen($str);
}
list($min, $max) = $spec_ais[$spec];
$str = "$first_tab$tab{$tab}min = $min, max = $max;";
print ") {\n$str\n";
print <<<EOD
EOD;
}
$last_batch_e = $batch_e;
if ($big_batch != $n) {
$big_batch = $n;
}
print <<<EOD
$first_tab{$tab}}
EOD;
}
print <<<EOD
$first_tab}
$tab}
{$tab}if (max == 0) {
$tab{$tab}*p_ai = ai2; /* Use 2-digit as feedback */
$tab{$tab}return 0;
$tab}
{$tab}assert(ai >= 0 && ai <= 9999);
{$tab}assert(min >= 1);
{$tab}assert(max >= min);
{$tab}*p_ai = ai;
{$tab}if (p_min) {
$tab{$tab}*p_min = min;
{$tab}}
{$tab}if (p_max) {
$tab{$tab}*p_max = max;
{$tab}}
{$tab}return 1;
}
/* Parse non-bracketed input */
static int gs1_lint_parse_raw_caret(const unsigned char source[], const int length,
$tab$tab{$tab}const int ai_max, int *ai_vals, int *ai_locs, int *data_locs, int *data_lens, int *p_ai_count,
$tab$tab{$tab}int *p_err_no, int *p_err_posn) {
{$tab}int i, j;
{$tab}const int gs1_caret = source[0] == '^';
{$tab}const unsigned char separator = gs1_caret ? '^' : '\\x1D';
{$tab}int ai, max;
{$tab}int ai_count = 0, ai_len;
{$tab}#ifdef NDEBUG
{$tab}(void)ai_max;
{$tab}#endif
{$tab}i = gs1_caret || source[0] == '\\x1D'; /* Allow GS at start also */
{$tab}if (i >= length) {
$tab{$tab}*p_ai_count = 0; /* For feedback */
$tab{$tab}ai_vals[0] = -1;
$tab{$tab}ai_locs[0] = i - 1;
$tab{$tab}*p_err_no = 1;
$tab{$tab}*p_err_posn = i;
$tab{$tab}return 0;
{$tab}}
{$tab}while (i < length) {
$tab{$tab}int data_start, data_max, on_separator;
$tab{$tab}assert(ai_count < ai_max);
$tab{$tab}ai_locs[ai_count] = i;
$tab{$tab}if (!gs1_lint_parse_ai(source, length, i, &ai, NULL /*min*/, &max)) {
$tab$tab{$tab}*p_ai_count = ai_count; /* For feedback */
$tab$tab{$tab}ai_vals[ai_count] = ai; /* May be -1 */
$tab$tab{$tab}*p_err_no = 1;
$tab$tab{$tab}*p_err_posn = i + 1; /* Position 1-base */
$tab$tab{$tab}return 0;
$tab{$tab}}
$tab{$tab}ai_vals[ai_count] = ai;
$tab{$tab}ai_len = ai < 100 ? 2 : ai < 1000 ? 3 : 4;
$tab{$tab}/* Following GS1 Syntax Engine tolerating superfluous FNC1s at end of AI data
$tab{$tab} (for both final AI and AIs with predefined length) */
$tab{$tab}data_start = i + ai_len;
$tab{$tab}data_max = data_start + max;
$tab{$tab}for (j = data_start; j < length && j < data_max; j++) {
$tab$tab{$tab}if (source[j] == separator) {
$tab$tab$tab{$tab}break;
$tab$tab{$tab}}
$tab{$tab}}
$tab{$tab}data_locs[ai_count] = data_start;
$tab{$tab}/* Only checking that have at least one char, and haven't exceeded max */
$tab{$tab}on_separator = j < length && source[j] == separator;
$tab{$tab}if (j == data_start || (j + 1 == length && length > data_max && !on_separator)) {
$tab$tab{$tab}*p_ai_count = ai_count; /* For feedback */
$tab$tab{$tab}data_lens[ai_count] = j - data_start;
$tab$tab{$tab}*p_err_no = 2;
$tab$tab{$tab}*p_err_posn = i + 1; /* Position 1-base */
$tab$tab{$tab}return 0;
$tab{$tab}}
$tab{$tab}data_lens[ai_count] = j - data_locs[ai_count];
$tab{$tab}ai_count++;
$tab{$tab}i = j + on_separator;
{$tab}}
{$tab}*p_ai_count = ai_count;
{$tab}return 1;
}
EOD;
if ($print_h_guard) { if ($print_h_guard) {
print <<<'EOD' print <<<'EOD'
+1
View File
@@ -326,6 +326,7 @@ extern "C" {
#define EXTRA_ESCAPE_MODE 0x0100 /* Process special symbology-specific escape sequences as well as others */ #define EXTRA_ESCAPE_MODE 0x0100 /* Process special symbology-specific escape sequences as well as others */
/* Note: currently Code 128 only */ /* Note: currently Code 128 only */
#define GS1SYNTAXENGINE_MODE 0x0200 /* Use the GS1 Syntax Engine (if available) to strictly validate GS1 input */ #define GS1SYNTAXENGINE_MODE 0x0200 /* Use the GS1 Syntax Engine (if available) to strictly validate GS1 input */
#define GS1RAW_MODE 0x0400 /* Process GS1 data literally (no AI delimiters), parsing GSs as FNC1s */
/* Aztec Code specific options (`symbol->option_3`) */ /* Aztec Code specific options (`symbol->option_3`) */
#define ZINT_AZTEC_FULL 128 /* Only consider Full versions on automatic symbol size selection */ #define ZINT_AZTEC_FULL 128 /* Only consider Full versions on automatic symbol size selection */
+20 -4
View File
@@ -199,7 +199,7 @@ namespace Zint {
m_compliant_height(false), m_compliant_height(false),
m_rotate_angle(0), m_rotate_angle(0),
m_eci(0), m_eci(0),
m_gs1parens(false), m_gs1nocheck(false), m_gs1syntaxengine(false), m_gs1parens(false), m_gs1nocheck(false), m_gs1raw(false), m_gs1syntaxengine(false),
m_reader_init(false), m_reader_init(false),
m_guard_whitespace(false), m_guard_whitespace(false),
m_embed_vector_font(false), m_embed_vector_font(false),
@@ -278,6 +278,9 @@ namespace Zint {
if (m_gs1nocheck) { if (m_gs1nocheck) {
m_zintSymbol->input_mode |= GS1NOCHECK_MODE; m_zintSymbol->input_mode |= GS1NOCHECK_MODE;
} }
if (m_gs1raw) {
m_zintSymbol->input_mode |= GS1RAW_MODE;
}
if (m_gs1syntaxengine) { if (m_gs1syntaxengine) {
m_zintSymbol->input_mode |= GS1SYNTAXENGINE_MODE; m_zintSymbol->input_mode |= GS1SYNTAXENGINE_MODE;
} }
@@ -741,6 +744,15 @@ namespace Zint {
m_gs1nocheck = gs1NoCheck; m_gs1nocheck = gs1NoCheck;
} }
/* Process as raw GS1 input (no brackets/parentheses), with separator GS for FNC1 */
bool QZint::gs1Raw() const {
return m_gs1raw;
}
void QZint::setGS1Raw(bool gs1Raw) {
m_gs1raw = gs1Raw;
}
/* Use GS1 Syntax Engine to validate GS1 data */ /* Use GS1 Syntax Engine to validate GS1 data */
bool QZint::gs1SyntaxEngine() const { bool QZint::gs1SyntaxEngine() const {
return m_gs1syntaxengine; return m_gs1syntaxengine;
@@ -1394,12 +1406,16 @@ namespace Zint {
if (supportsGS1()) { if (supportsGS1()) {
bool gs1_implied = false; bool gs1_implied = false;
if (gs1NoCheck() || (inputMode() & GS1NOCHECK_MODE)) {
arg_bool(cmd, "--gs1nocheck", (gs1_implied = true));
}
if (gs1Parens() || (inputMode() & GS1PARENS_MODE)) { if (gs1Parens() || (inputMode() & GS1PARENS_MODE)) {
arg_bool(cmd, "--gs1parens", (gs1_implied = true)); arg_bool(cmd, "--gs1parens", (gs1_implied = true));
} }
if (gs1NoCheck() || (inputMode() & GS1NOCHECK_MODE)) { if (gs1Raw() || (inputMode() & GS1RAW_MODE)) {
arg_bool(cmd, "--gs1nocheck", (gs1_implied = true)); arg_bool(cmd, "--gs1raw", (gs1_implied = true));
} else if (gs1SyntaxEngine() || (inputMode() & GS1SYNTAXENGINE_MODE)) { }
if (gs1SyntaxEngine() || (inputMode() & GS1SYNTAXENGINE_MODE)) {
arg_bool(cmd, "--gs1strict", (gs1_implied = true)); arg_bool(cmd, "--gs1strict", (gs1_implied = true));
} }
arg_bool(cmd, "--gs1", (inputMode() & 0x07) == GS1_MODE && !gs1_implied); arg_bool(cmd, "--gs1", (inputMode() & 0x07) == GS1_MODE && !gs1_implied);
+6 -1
View File
@@ -1,7 +1,7 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2008 by BogDan Vatra * * Copyright (C) 2008 by BogDan Vatra *
* bogdan@licentia.eu * * 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 * * 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 * * it under the terms of the GNU General Public License as published by *
@@ -208,6 +208,10 @@ public:
bool gs1NoCheck() const; // `symbol->input_mode | GS1NOCHECK_MODE` bool gs1NoCheck() const; // `symbol->input_mode | GS1NOCHECK_MODE`
void setGS1NoCheck(bool gs1NoCheck); void setGS1NoCheck(bool gs1NoCheck);
/* Process as raw GS1 input (no brackets/parentheses), with separator GS for FNC1 */
bool gs1Raw() const; // `symbol->input_mode | GS1RAW_MODE`
void setGS1Raw(bool gs1Raw);
/* Use GS1 Syntax Engine to validate GS1 data */ /* Use GS1 Syntax Engine to validate GS1 data */
bool gs1SyntaxEngine() const; // `symbol->input_mode | GS1SYNTAXENGINE_MODE` bool gs1SyntaxEngine() const; // `symbol->input_mode | GS1SYNTAXENGINE_MODE`
void setGS1SyntaxEngine(bool gs1SyntaxEngine); void setGS1SyntaxEngine(bool gs1SyntaxEngine);
@@ -402,6 +406,7 @@ private:
int m_eci; int m_eci;
bool m_gs1parens; bool m_gs1parens;
bool m_gs1nocheck; bool m_gs1nocheck;
bool m_gs1raw;
bool m_gs1syntaxengine; bool m_gs1syntaxengine;
bool m_reader_init; bool m_reader_init;
bool m_guard_whitespace; bool m_guard_whitespace;
+213 -90
View File
@@ -288,6 +288,10 @@ private slots:
bc.setGS1NoCheck(gs1NoCheck); bc.setGS1NoCheck(gs1NoCheck);
QCOMPARE(bc.gs1NoCheck(), gs1NoCheck); QCOMPARE(bc.gs1NoCheck(), gs1NoCheck);
bool gs1Raw = true;
bc.setGS1Raw(gs1Raw);
QCOMPARE(bc.gs1Raw(), gs1Raw);
bool gs1SyntaxEngine = true; bool gs1SyntaxEngine = true;
bc.setGS1SyntaxEngine(gs1SyntaxEngine); bc.setGS1SyntaxEngine(gs1SyntaxEngine);
QCOMPARE(bc.gs1SyntaxEngine(), gs1SyntaxEngine); QCOMPARE(bc.gs1SyntaxEngine(), gs1SyntaxEngine);
@@ -656,6 +660,7 @@ private slots:
QTest::addColumn<int>("option2"); QTest::addColumn<int>("option2");
QTest::addColumn<int>("option3"); QTest::addColumn<int>("option3");
QTest::addColumn<float>("scale"); QTest::addColumn<float>("scale");
QTest::addColumn<float>("dpmm"); QTest::addColumn<float>("dpmm");
QTest::addColumn<bool>("dotty"); QTest::addColumn<bool>("dotty");
QTest::addColumn<float>("dotSize"); QTest::addColumn<float>("dotSize");
@@ -688,7 +693,9 @@ private slots:
QTest::addColumn<int>("eci"); QTest::addColumn<int>("eci");
QTest::addColumn<bool>("gs1Parens"); QTest::addColumn<bool>("gs1Parens");
QTest::addColumn<bool>("gs1NoCheck"); QTest::addColumn<bool>("gs1NoCheck");
QTest::addColumn<bool>("gs1Raw");
QTest::addColumn<bool>("gs1SyntaxEngine"); QTest::addColumn<bool>("gs1SyntaxEngine");
QTest::addColumn<bool>("readerInit"); QTest::addColumn<bool>("readerInit");
QTest::addColumn<bool>("guardWhitespace"); QTest::addColumn<bool>("guardWhitespace");
QTest::addColumn<bool>("embedVectorFont"); QTest::addColumn<bool>("embedVectorFont");
@@ -712,12 +719,14 @@ private slots:
QTest::newRow("BARCODE_AUSPOST") << true << 0.0f << "" QTest::newRow("BARCODE_AUSPOST") << true << 0.0f << ""
<< BARCODE_AUSPOST << DATA_MODE // symbology-inputMode << BARCODE_AUSPOST << DATA_MODE // symbology-inputMode
<< "12345678" << "" // text-primary << "12345678" << "" // text-primary
<< 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 30.0f << -1 << 0 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 63 --binary --compliantheight -d '12345678'" << "zint -b 63 --binary --compliantheight -d '12345678'"
<< "zint.exe -b 63 --binary --compliantheight -d \"12345678\"" << "zint.exe -b 63 --binary --compliantheight -d \"12345678\""
@@ -729,12 +738,14 @@ private slots:
QTest::newRow("BARCODE_AZTEC") << false << 0.0f << "" QTest::newRow("BARCODE_AZTEC") << false << 0.0f << ""
<< BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode << BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode
<< "12345678Ж0%var%" << "" // text-primary << "12345678Ж0%var%" << "" // text-primary
<< 0.0f << 1 << 0 << ZINT_AZTEC_FULL << 4.0f << 0.0f << true << 0.9f << 1.0f // height-textGap << 0.0f << 1 << 0 << ZINT_AZTEC_FULL << 4.0f // height-scale
<< 0.0f << true << 0.9f << 1.0f // dpmm-textGap
<< 5.0f << 2 << 1 << "as\"dfa'sdf" // guardDescent-structAppID << 5.0f << 2 << 1 << "as\"dfa'sdf" // guardDescent-structAppID
<< "" << "" << QColor(Qt::blue) << QColor(Qt::white) << true // fgStr-cmyk << "" << "" << QColor(Qt::blue) << QColor(Qt::white) << true // fgStr-cmyk
<< 0 << 0 << 2 << 3 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 2 << 3 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << false << 0 // showText-rotateAngle << true << false << false << false << false << 0 // showText-rotateAngle
<< 7 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 7 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 92 --azfull --cmyk --eci=7 -d '12345678Ж0%var%' --dotsize=0.9 --dotty --fg=0000FF" << "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" " --scale=4 --secure=1 --structapp='1,2,as\"dfa'\\''sdf' --vwhitesp=3 -w 2"
@@ -745,12 +756,14 @@ private slots:
QTest::newRow("BARCODE_AZTEC (bgStr CMYK, fgStr CMYK)") << false << 0.0f << "" QTest::newRow("BARCODE_AZTEC (bgStr CMYK, fgStr CMYK)") << false << 0.0f << ""
<< BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode << BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode
<< "12345678Ж0%var%" << "" // text-primary << "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 << 0 << 4.0f // height-scale
<< 0.0f << true << 0.9f << 1.0f // dpmm-textGap
<< 5.0f << 2 << 1 << "as\"dfa'sdf" // guardDescent-structAppID << 5.0f << 2 << 1 << "as\"dfa'sdf" // guardDescent-structAppID
<< "71,0,40,44" << "0,0,0,0" << QColor(Qt::black) << QColor(Qt::white) << true // fgStr-cmyk << "71,0,40,44" << "0,0,0,0" << QColor(Qt::black) << QColor(Qt::white) << true // fgStr-cmyk
<< 0 << 0 << 2 << 3 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 2 << 3 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << false << 0 // showText-rotateAngle << true << false << false << false << false << 0 // showText-rotateAngle
<< 7 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 7 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 92 --bg=0,0,0,0 --cmyk --eci=7 -d '12345678Ж0%var%' --dotsize=0.9 --dotty --fg=71,0,40,44 --scale=4" << "zint -b 92 --bg=0,0,0,0 --cmyk --eci=7 -d '12345678Ж0%var%' --dotsize=0.9 --dotty --fg=71,0,40,44 --scale=4"
" --secure=1 --structapp='1,2,as\"dfa'\\''sdf' --vwhitesp=3 -w 2" " --secure=1 --structapp='1,2,as\"dfa'\\''sdf' --vwhitesp=3 -w 2"
@@ -761,12 +774,14 @@ private slots:
QTest::newRow("BARCODE_C25INTER") << true << 0.0f << "" QTest::newRow("BARCODE_C25INTER") << true << 0.0f << ""
<< BARCODE_C25INTER << UNICODE_MODE // symbology-inputMode << BARCODE_C25INTER << UNICODE_MODE // symbology-inputMode
<< "12345" << "" // text-primary << "12345" << "" // text-primary
<< 0.0f << -1 << 2 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 0.0f << -1 << 2 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << SMALL_TEXT // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << SMALL_TEXT // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 3 --compliantheight -d '12345' --small --vers=2" << "zint -b 3 --compliantheight -d '12345' --small --vers=2"
<< "zint.exe -b 3 --compliantheight -d \"12345\" --small --vers=2" << "zint.exe -b 3 --compliantheight -d \"12345\" --small --vers=2"
@@ -775,12 +790,14 @@ private slots:
QTest::newRow("BARCODE_CHANNEL") << false << 0.0f << "" QTest::newRow("BARCODE_CHANNEL") << false << 0.0f << ""
<< BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode << BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode
<< "453678" << "" // text-primary << "453678" << "" // text-primary
<< 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 19.7f << -1 << 7 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(255, 255, 255, 0) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(255, 255, 255, 0) << false // fgStr-cmyk
<< 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting << 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting
<< true << false << true << false << false << 90 // showText-rotateAngle << true << false << true << false << false << 90 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << true // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << true // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 140 --bind --bold --border=2 -d '453678' --height=19.7 --nobackground --quietzones" << "zint -b 140 --bind --bold --border=2 -d '453678' --height=19.7 --nobackground --quietzones"
" --rotate=90 --verbose --vers=7" " --rotate=90 --verbose --vers=7"
@@ -791,12 +808,14 @@ private slots:
QTest::newRow("BARCODE_CHANNEL (bgStr FFFFFF00)") << false << 0.0f << "" QTest::newRow("BARCODE_CHANNEL (bgStr FFFFFF00)") << false << 0.0f << ""
<< BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode << BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode
<< "453678" << "" // text-primary << "453678" << "" // text-primary
<< 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 19.7f << -1 << 7 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "FFFFFF00" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "FFFFFF00" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting << 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting
<< true << false << true << false << false << 90 // showText-rotateAngle << true << false << true << false << false << 90 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << true // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << true // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 140 --bind --bold --border=2 -d '453678' --height=19.7 --nobackground --quietzones" << "zint -b 140 --bind --bold --border=2 -d '453678' --height=19.7 --nobackground --quietzones"
" --rotate=90 --verbose --vers=7" " --rotate=90 --verbose --vers=7"
@@ -807,12 +826,14 @@ private slots:
QTest::newRow("BARCODE_CHANNEL (bgStr 12345600)") << false << 0.0f << "" QTest::newRow("BARCODE_CHANNEL (bgStr 12345600)") << false << 0.0f << ""
<< BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode << BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode
<< "453678" << "" // text-primary << "453678" << "" // text-primary
<< 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 19.7f << -1 << 7 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "12345600" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "12345600" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting << 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting
<< true << false << true << false << false << 90 // showText-rotateAngle << true << false << true << false << false << 90 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << true // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << true // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 140 --bind --bold --border=2 -d '453678' --height=19.7 --nobackground --quietzones" << "zint -b 140 --bind --bold --border=2 -d '453678' --height=19.7 --nobackground --quietzones"
" --rotate=90 --verbose --vers=7" " --rotate=90 --verbose --vers=7"
@@ -823,12 +844,14 @@ private slots:
QTest::newRow("BARCODE_CODE128") << false << 0.0f << "" QTest::newRow("BARCODE_CODE128") << false << 0.0f << ""
<< BARCODE_CODE128 << (UNICODE_MODE | EXTRA_ESCAPE_MODE) // symbology-inputMode << BARCODE_CODE128 << (UNICODE_MODE | EXTRA_ESCAPE_MODE) // symbology-inputMode
<< "1234\\^A56" << "" // text-primary << "1234\\^A56" << "" // text-primary
<< 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 0.0f << -1 << 0 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< false << false << true << false << true << 0 // showText-rotateAngle << false << false << true << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 20 -d '1234\\^A56' --extraesc --notext --quietzones" << "zint -b 20 -d '1234\\^A56' --extraesc --notext --quietzones"
<< "zint.exe -b 20 -d \"1234\\^A56\" --extraesc --notext --quietzones" << "zint.exe -b 20 -d \"1234\\^A56\" --extraesc --notext --quietzones"
@@ -837,12 +860,14 @@ private slots:
QTest::newRow("BARCODE_GS1_128_CC") << false << 0.0f << "" QTest::newRow("BARCODE_GS1_128_CC") << false << 0.0f << ""
<< BARCODE_GS1_128_CC << UNICODE_MODE // symbology-inputMode << BARCODE_GS1_128_CC << UNICODE_MODE // symbology-inputMode
<< "[01]12345678901231[15]121212" << "[11]901222[99]ABCDE" // text-primary << "[01]12345678901231[15]121212" << "[11]901222[99]ABCDE" // text-primary
<< 71.142f << 3 << 0 << 0 << 3.5f << 0.0f << false << 0.8f << 1.0f // height-textGap << 71.142f << 3 << 0 << 0 << 3.5f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< false << false << true << false << true << 0 // showText-rotateAngle << false << false << true << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 131 --compliantheight -d '[11]901222[99]ABCDE' --height=71.142 --mode=3 --notext" << "zint -b 131 --compliantheight -d '[11]901222[99]ABCDE' --height=71.142 --mode=3 --notext"
" --primary='[01]12345678901231[15]121212' --quietzones --scale=3.5" " --primary='[01]12345678901231[15]121212' --quietzones --scale=3.5"
@@ -853,12 +878,14 @@ private slots:
QTest::newRow("BARCODE_CODE16K") << false << 11.7f << "" QTest::newRow("BARCODE_CODE16K") << false << 11.7f << ""
<< BARCODE_CODE16K << (UNICODE_MODE | HEIGHTPERROW_MODE) // symbology-inputMode << BARCODE_CODE16K << (UNICODE_MODE | HEIGHTPERROW_MODE) // symbology-inputMode
<< "12345678901234567890123456789012" << "" // text-primary << "12345678901234567890123456789012" << "" // text-primary
<< 0.0f << 4 << 0 << 2 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 0.0f << 4 << 0 << 2 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 1 << 1 << 0 << 0 << SMALL_TEXT // borderTypeIndex-fontSetting << 1 << 1 << 0 << 0 << SMALL_TEXT // borderTypeIndex-fontSetting
<< true << false << false << true << true << 0 // showText-rotateAngle << true << false << false << true << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 23 --compliantheight -d '12345678901234567890123456789012'" << "zint -b 23 --compliantheight -d '12345678901234567890123456789012'"
" --height=11.7 --heightperrow --noquietzones --rows=4 --separator=2 --small" " --height=11.7 --heightperrow --noquietzones --rows=4 --separator=2 --small"
@@ -869,12 +896,14 @@ private slots:
QTest::newRow("BARCODE_CODE49") << true << 0.0f << "" QTest::newRow("BARCODE_CODE49") << true << 0.0f << ""
<< BARCODE_CODE49 << UNICODE_MODE // symbology-inputMode << BARCODE_CODE49 << UNICODE_MODE // symbology-inputMode
<< "12345678901234567890" << "" // text-primary << "12345678901234567890" << "" // text-primary
<< 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 30.0f << -1 << 0 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 24 --compliantheight -d '12345678901234567890'" << "zint -b 24 --compliantheight -d '12345678901234567890'"
<< "zint.exe -b 24 --compliantheight -d \"12345678901234567890\"" << "zint.exe -b 24 --compliantheight -d \"12345678901234567890\""
@@ -883,12 +912,14 @@ private slots:
QTest::newRow("BARCODE_CODABLOCKF") << true << 0.0f << "" QTest::newRow("BARCODE_CODABLOCKF") << true << 0.0f << ""
<< BARCODE_CODABLOCKF << (DATA_MODE | ESCAPE_MODE) // symbology-inputMode << BARCODE_CODABLOCKF << (DATA_MODE | ESCAPE_MODE) // symbology-inputMode
<< "T\\n\\xA0t\\\"" << "" // text-primary << "T\\n\\xA0t\\\"" << "" // text-primary
<< 0.0f << 2 << 5 << 3 << 3.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 0.0f << 2 << 5 << 3 << 3.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 2 << 4 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 2 << 4 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << true << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< true << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 74 --binary --border=4 --box --cols=5 --compliantheight -d 'T\\n\\xA0t\\\"' --esc --init" << "zint -b 74 --binary --border=4 --box --cols=5 --compliantheight -d 'T\\n\\xA0t\\\"' --esc --init"
" --rows=2 --scale=3 --separator=3" " --rows=2 --scale=3 --separator=3"
@@ -899,12 +930,14 @@ private slots:
QTest::newRow("BARCODE_DAFT") << false << 0.0f << "" QTest::newRow("BARCODE_DAFT") << false << 0.0f << ""
<< BARCODE_DAFT << UNICODE_MODE // symbology-inputMode << BARCODE_DAFT << UNICODE_MODE // symbology-inputMode
<< "daft" << "" // text-primary << "daft" << "" // text-primary
<< 9.2f << -1 << 251 << 0 << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 9.2f << -1 << 251 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(0x30, 0x31, 0x32, 0x33) << QColor(0xBF, 0xBE, 0xBD, 0xBC) << false // fgStr-cmyk << "" << "" << QColor(0x30, 0x31, 0x32, 0x33) << QColor(0xBF, 0xBE, 0xBD, 0xBC) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 93 --bg=BFBEBDBC -d 'daft' --fg=30313233 --height=9.2 --vers=251" << "zint -b 93 --bg=BFBEBDBC -d 'daft' --fg=30313233 --height=9.2 --vers=251"
<< "zint.exe -b 93 --bg=BFBEBDBC -d \"daft\" --fg=30313233 --height=9.2 --vers=251" << "zint.exe -b 93 --bg=BFBEBDBC -d \"daft\" --fg=30313233 --height=9.2 --vers=251"
@@ -913,68 +946,94 @@ private slots:
QTest::newRow("BARCODE_DATAMATRIX (GS1)") << true << 0.0f << "" QTest::newRow("BARCODE_DATAMATRIX (GS1)") << true << 0.0f << ""
<< BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode << BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode
<< "[20]12" << "" // text-primary << "[20]12" << "" // text-primary
<< 0.0f << -1 << 0 << DM_SQUARE << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 0.0f << -1 << 0 << DM_SQUARE << 1.0f // height-scale
<< 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << true << false << false << true << 0 // showText-rotateAngle << true << true << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 71 -d '[20]12' --gs1 --gssep --square" << "zint -b 71 -d '[20]12' --gs1 --gssep --square"
<< "zint.exe -b 71 -d \"[20]12\" --gs1 --gssep --square" << "zint.exe -b 71 -d \"[20]12\" --gs1 --gssep --square"
<< "" << "" << "" << ""; << "" << "" << "" << "";
QTest::newRow("BARCODE_DATAMATRIX (GS1Parens + Strict)") << true << 0.0f << "" QTest::newRow("BARCODE_DATAMATRIX (GS1Parens + GS1SyntaxEngine)") << true << 0.0f << ""
<< BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode << BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode
<< "[20]12" << "" // text-primary << "[20]12" << "" // text-primary
<< 0.0f << -1 << 0 << DM_SQUARE << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 0.0f << -1 << 0 << DM_SQUARE << 1.0f // height-scale
<< 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << true << false << false << true << 0 // showText-rotateAngle << true << true << false << false << true << 0 // showText-rotateAngle
<< 0 << true << false << true << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << true << false << false << true // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 71 -d '[20]12' --gs1parens --gs1strict --gssep --square" << "zint -b 71 -d '[20]12' --gs1parens --gs1strict --gssep --square"
<< "zint.exe -b 71 -d \"[20]12\" --gs1parens --gs1strict --gssep --square" << "zint.exe -b 71 -d \"[20]12\" --gs1parens --gs1strict --gssep --square"
<< "" << "" << "" << ""; << "" << "" << "" << "";
QTest::newRow("BARCODE_DATAMATRIX (GS1Strict)") << true << 0.0f << "" QTest::newRow("BARCODE_DATAMATRIX (GS1SyntaxEngine)") << true << 0.0f << ""
<< BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode << BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode
<< "[20]12" << "" // text-primary << "[20]12" << "" // text-primary
<< 0.0f << -1 << 0 << DM_SQUARE << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 0.0f << -1 << 0 << DM_SQUARE << 1.0f // height-scale
<< 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << true << false << false << true << 0 // showText-rotateAngle << true << true << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << true << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << true // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 71 -d '[20]12' --gs1strict --gssep --square" << "zint -b 71 -d '[20]12' --gs1strict --gssep --square"
<< "zint.exe -b 71 -d \"[20]12\" --gs1strict --gssep --square" << "zint.exe -b 71 -d \"[20]12\" --gs1strict --gssep --square"
<< "" << "" << "" << ""; << "" << "" << "" << "";
QTest::newRow("BARCODE_DATAMATRIX (GS1NoCheck + Strict (ignored))") << true << 0.0f << "" QTest::newRow("BARCODE_DATAMATRIX (GS1NoCheck + GS1SyntaxEngine)") << true << 0.0f << ""
<< BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode << BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode
<< "[20]12" << "" // text-primary << "[20]12" << "" // text-primary
<< 0.0f << -1 << 0 << DM_SQUARE << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 0.0f << -1 << 0 << DM_SQUARE << 1.0f // height-scale
<< 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << true << false << false << true << 0 // showText-rotateAngle << true << true << false << false << true << 0 // showText-rotateAngle
<< 0 << false << true << true << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << true << false << true // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 71 -d '[20]12' --gs1nocheck --gssep --square" << "zint -b 71 -d '[20]12' --gs1nocheck --gs1strict --gssep --square"
<< "zint.exe -b 71 -d \"[20]12\" --gs1nocheck --gssep --square" << "zint.exe -b 71 -d \"[20]12\" --gs1nocheck --gs1strict --gssep --square"
<< "" << "" << "" << "";
QTest::newRow("BARCODE_DATAMATRIX (GS1Raw + GS1SyntaxEngine)") << true << 0.0f << ""
<< BARCODE_DATAMATRIX << (GS1_MODE | ESCAPE_MODE) // symbology-inputMode
<< "010952012345678810BATCH4\\G2107" << "" // text-primary
<< 0.0f << -1 << 0 << DM_SQUARE << 1.0f // height-scale
<< 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << true << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << true << true // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 71 -d '010952012345678810BATCH4\\G2107' --esc --gs1raw --gs1strict --gssep --square"
<< "zint.exe -b 71 -d \"010952012345678810BATCH4\\G2107\" --esc --gs1raw --gs1strict --gssep --square"
<< "" << "" << "" << ""; << "" << "" << "" << "";
QTest::newRow("BARCODE_DATAMATRIX") << false << 0.0f << "" QTest::newRow("BARCODE_DATAMATRIX") << false << 0.0f << ""
<< BARCODE_DATAMATRIX << (DATA_MODE | ESCAPE_MODE | FAST_MODE) // symbology-inputMode << BARCODE_DATAMATRIX << (DATA_MODE | ESCAPE_MODE | FAST_MODE) // symbology-inputMode
<< "ABCDEFGH\\x01I" << "" // text-primary << "ABCDEFGH\\x01I" << "" // text-primary
<< 0.0f << -1 << 0 << DM_ISO_144 << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 0.0f << -1 << 0 << DM_ISO_144 << 1.0f // height-scale
<< 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 71 --binary -d 'ABCDEFGH\\x01I' --dmiso144 --esc --fast" << "zint -b 71 --binary -d 'ABCDEFGH\\x01I' --dmiso144 --esc --fast"
<< "zint.exe -b 71 --binary -d \"ABCDEFGH\\x01I\" --dmiso144 --esc --fast" << "zint.exe -b 71 --binary -d \"ABCDEFGH\\x01I\" --dmiso144 --esc --fast"
@@ -983,12 +1042,14 @@ private slots:
QTest::newRow("BARCODE_DBAR_EXPSTK_CC") << false << 40.8f << "" QTest::newRow("BARCODE_DBAR_EXPSTK_CC") << false << 40.8f << ""
<< BARCODE_DBAR_EXPSTK_CC << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode << BARCODE_DBAR_EXPSTK_CC << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode
<< "[91]ABCDEFGHIJKL" << "[11]901222[99]ABCDE" // text-primary << "[91]ABCDEFGHIJKL" << "[11]901222[99]ABCDE" // text-primary
<< 0.0f << -1 << 0 << 2 << 1.0f << 0.0f << true << 0.9f << 1.0f // height-textGap << 0.0f << -1 << 0 << 2 << 1.0f // height-scale
<< 0.0f << true << 0.9f << 1.0f // dpmm-textGap
<< 3.0f << 2 << 1 << "" // guardDescent-structAppID << 3.0f << 2 << 1 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 139 --binary --compliantheight -d '[11]901222[99]ABCDE' --height=40.8 --heightperrow" << "zint -b 139 --binary --compliantheight -d '[11]901222[99]ABCDE' --height=40.8 --heightperrow"
" --primary='[91]ABCDEFGHIJKL' --rows=2" " --primary='[91]ABCDEFGHIJKL' --rows=2"
@@ -999,26 +1060,30 @@ private slots:
QTest::newRow("BARCODE_DOTCODE") << false << 1.0f << "" QTest::newRow("BARCODE_DOTCODE") << false << 1.0f << ""
<< BARCODE_DOTCODE << GS1_MODE // symbology-inputMode << BARCODE_DOTCODE << GS1_MODE // symbology-inputMode
<< "[20]01" << "" // text-primary << "[20]01" << "" // text-primary
<< 30.0f << -1 << 8 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 30.0f << -1 << 8 << ((0 + 1) // height-scale
<< 8) << 1.0f << 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 0.0f << 0 << 0 << "" // guardDescent-structAppID << 0.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 115 --cols=8 -d '[20]01' --dotsize=0.7 --gs1 --mask=0" << "zint -b 115 --cols=8 -d '[20]01' --dotsize=0.7 --gs1 --mask=0"
<< "zint.exe -b 115 --cols=8 -d \"[20]01\" --dotsize=0.7 --gs1 --mask=0" << "zint.exe -b 115 --cols=8 -d \"[20]01\" --dotsize=0.7 --gs1 --mask=0"
<< "" << "" << "" << ""; << "" << "" << "" << "";
QTest::newRow("BARCODE_DOTCODE (GS1Strict") << false << 1.0f << "" QTest::newRow("BARCODE_DOTCODE (GS1SyntaxEngine") << false << 1.0f << ""
<< BARCODE_DOTCODE << (GS1_MODE | GS1SYNTAXENGINE_MODE) // symbology-inputMode << BARCODE_DOTCODE << (GS1_MODE | GS1SYNTAXENGINE_MODE) // symbology-inputMode
<< "[20]01" << "" // text-primary << "[20]01" << "" // text-primary
<< 30.0f << -1 << 8 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 30.0f << -1 << 8 << ((0 + 1) // height-scale
<< 8) << 1.0f << 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 0.0f << 0 << 0 << "" // guardDescent-structAppID << 0.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 115 --cols=8 -d '[20]01' --dotsize=0.7 --gs1strict --mask=0" << "zint -b 115 --cols=8 -d '[20]01' --dotsize=0.7 --gs1strict --mask=0"
<< "zint.exe -b 115 --cols=8 -d \"[20]01\" --dotsize=0.7 --gs1strict --mask=0" << "zint.exe -b 115 --cols=8 -d \"[20]01\" --dotsize=0.7 --gs1strict --mask=0"
@@ -1027,12 +1092,14 @@ private slots:
QTest::newRow("BARCODE_DPD") << true << 0.0f << "" QTest::newRow("BARCODE_DPD") << true << 0.0f << ""
<< BARCODE_DPD << UNICODE_MODE // symbology-inputMode << BARCODE_DPD << UNICODE_MODE // symbology-inputMode
<< "1234567890123456789012345678" << "" // text-primary << "1234567890123456789012345678" << "" // text-primary
<< 0.0f << -1 << 0 << 0 << 4.5f << 24.0f << true << 0.8f << 1.0f // height-textGap << 0.0f << -1 << 0 << 0 << 4.5f // height-scale
<< 24.0f << true << 0.8f << 1.0f // dpmm-textGap
<< 0.0f << 0 << 0 << "" // guardDescent-structAppID << 0.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.375 << 0 << 600 << 1 << 0 << 0 // xdimdp << 0.375 << 0 << 600 << 1 << 0 << 0 // xdimdp
<< "zint -b 96 --compliantheight -d '1234567890123456789012345678' --scalexdimdp=0.375,24" << "zint -b 96 --compliantheight -d '1234567890123456789012345678' --scalexdimdp=0.375,24"
<< "zint.exe -b 96 --compliantheight -d \"1234567890123456789012345678\" --scalexdimdp=0.375,24" << "zint.exe -b 96 --compliantheight -d \"1234567890123456789012345678\" --scalexdimdp=0.375,24"
@@ -1042,12 +1109,14 @@ private slots:
QTest::newRow("BARCODE_EAN13") << true << 0.0f << "" QTest::newRow("BARCODE_EAN13") << true << 0.0f << ""
<< BARCODE_EAN13 << UNICODE_MODE // symbology-inputMode << BARCODE_EAN13 << UNICODE_MODE // symbology-inputMode
<< "123456789012+12" << "" // text-primary << "123456789012+12" << "" // text-primary
<< 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f << 1.0f // height-textGap << 0.0f << -1 << 8 << 0 << 1.0f // height-scale
<< 0.0f << true << 0.8f << 1.0f // dpmm-textGap
<< 0.0f << 0 << 0 << "" // guardDescent-structAppID << 0.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 15 --addongap=8 --compliantheight -d '123456789012+12' --guarddescent=0" << "zint -b 15 --addongap=8 --compliantheight -d '123456789012+12' --guarddescent=0"
<< "zint.exe -b 15 --addongap=8 --compliantheight -d \"123456789012+12\" --guarddescent=0" << "zint.exe -b 15 --addongap=8 --compliantheight -d \"123456789012+12\" --guarddescent=0"
@@ -1056,12 +1125,14 @@ private slots:
QTest::newRow("BARCODE_EANX") << true << 0.0f << "" QTest::newRow("BARCODE_EANX") << true << 0.0f << ""
<< BARCODE_EANX << UNICODE_MODE // symbology-inputMode << BARCODE_EANX << UNICODE_MODE // symbology-inputMode
<< "123456789012+12" << "" // text-primary << "123456789012+12" << "" // text-primary
<< 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f << 1.0f // height-textGap << 0.0f << -1 << 8 << 0 << 1.0f // height-scale
<< 0.0f << true << 0.8f << 1.0f // dpmm-textGap
<< 0.0f << 0 << 0 << "" // guardDescent-structAppID << 0.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 13 --addongap=8 --compliantheight -d '123456789012+12' --guarddescent=0" << "zint -b 13 --addongap=8 --compliantheight -d '123456789012+12' --guarddescent=0"
<< "zint.exe -b 13 --addongap=8 --compliantheight -d \"123456789012+12\" --guarddescent=0" << "zint.exe -b 13 --addongap=8 --compliantheight -d \"123456789012+12\" --guarddescent=0"
@@ -1070,12 +1141,14 @@ private slots:
QTest::newRow("BARCODE_EAN13 (guardWhitespace/embedVectorFont") << true << 0.0f << "" QTest::newRow("BARCODE_EAN13 (guardWhitespace/embedVectorFont") << true << 0.0f << ""
<< BARCODE_EAN13 << UNICODE_MODE // symbology-inputMode << BARCODE_EAN13 << UNICODE_MODE // symbology-inputMode
<< "123456789012+12" << "" // text-primary << "123456789012+12" << "" // text-primary
<< 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f << 1.0f // height-textGap << 0.0f << -1 << 8 << 0 << 1.0f // height-scale
<< 0.0f << true << 0.8f << 1.0f // dpmm-textGap
<< 0.0f << 0 << 0 << "" // guardDescent-structAppID << 0.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << true << true << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << true << true << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 15 --addongap=8 --compliantheight -d '123456789012+12' --embedfont --guarddescent=0 --guardwhitespace" << "zint -b 15 --addongap=8 --compliantheight -d '123456789012+12' --embedfont --guarddescent=0 --guardwhitespace"
<< "zint.exe -b 15 --addongap=8 --compliantheight -d \"123456789012+12\" --embedfont --guarddescent=0 --guardwhitespace" << "zint.exe -b 15 --addongap=8 --compliantheight -d \"123456789012+12\" --embedfont --guarddescent=0 --guardwhitespace"
@@ -1084,12 +1157,14 @@ private slots:
QTest::newRow("BARCODE_EANX (guardWhitespace/embedVectorFont") << true << 0.0f << "" QTest::newRow("BARCODE_EANX (guardWhitespace/embedVectorFont") << true << 0.0f << ""
<< BARCODE_EANX << UNICODE_MODE // symbology-inputMode << BARCODE_EANX << UNICODE_MODE // symbology-inputMode
<< "123456789012+12" << "" // text-primary << "123456789012+12" << "" // text-primary
<< 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f << 1.0f // height-textGap << 0.0f << -1 << 8 << 0 << 1.0f // height-scale
<< 0.0f << true << 0.8f << 1.0f // dpmm-textGap
<< 0.0f << 0 << 0 << "" // guardDescent-structAppID << 0.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << true << true << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << true << true << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 13 --addongap=8 --compliantheight -d '123456789012+12' --embedfont --guarddescent=0 --guardwhitespace" << "zint -b 13 --addongap=8 --compliantheight -d '123456789012+12' --embedfont --guarddescent=0 --guardwhitespace"
<< "zint.exe -b 13 --addongap=8 --compliantheight -d \"123456789012+12\" --embedfont --guarddescent=0 --guardwhitespace" << "zint.exe -b 13 --addongap=8 --compliantheight -d \"123456789012+12\" --embedfont --guarddescent=0 --guardwhitespace"
@@ -1098,12 +1173,14 @@ private slots:
QTest::newRow("BARCODE_GRIDMATRIX") << false << 0.0f << "" QTest::newRow("BARCODE_GRIDMATRIX") << false << 0.0f << ""
<< BARCODE_GRIDMATRIX << UNICODE_MODE // symbology-inputMode << BARCODE_GRIDMATRIX << UNICODE_MODE // symbology-inputMode
<< "Your Data Here!" << "" // text-primary << "Your Data Here!" << "" // text-primary
<< 0.0f << 1 << 5 << 0 << 0.5f << 0.0f << false << 0.8f << 1.0f // height-textGap << 0.0f << 1 << 5 << 0 << 0.5f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << true << false << true << 270 // showText-rotateAngle << true << false << true << false << true << 270 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 142 -d 'Your Data Here!' --quietzones --rotate=270 --scale=0.5 --secure=1 --vers=5" << "zint -b 142 -d 'Your Data Here!' --quietzones --rotate=270 --scale=0.5 --secure=1 --vers=5"
<< "zint.exe -b 142 -d \"Your Data Here!\" --quietzones --rotate=270 --scale=0.5 --secure=1 --vers=5" << "zint.exe -b 142 -d \"Your Data Here!\" --quietzones --rotate=270 --scale=0.5 --secure=1 --vers=5"
@@ -1112,12 +1189,14 @@ private slots:
QTest::newRow("BARCODE_HANXIN") << false << 0.0f << "" QTest::newRow("BARCODE_HANXIN") << false << 0.0f << ""
<< BARCODE_HANXIN << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode << BARCODE_HANXIN << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode
<< "éβÿ啊\\e\"'" << "" // text-primary << "éβÿ啊\\e\"'" << "" // text-primary
<< 30.0f << 2 << 5 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 30.0f << 2 << 5 << ((0 + 1) // height-scale
<< 8) << 1.0f << 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 29 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 29 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 116 --eci=29 -d 'éβÿ啊\\e\"'\\''' --esc --mask=0 --secure=2 --vers=5" << "zint -b 116 --eci=29 -d 'éβÿ啊\\e\"'\\''' --esc --mask=0 --secure=2 --vers=5"
<< "zint.exe -b 116 --eci=29 -d \"éβÿ啊\\e\\\"'\" --esc --mask=0 --secure=2 --vers=5" << "zint.exe -b 116 --eci=29 -d \"éβÿ啊\\e\\\"'\" --esc --mask=0 --secure=2 --vers=5"
@@ -1126,12 +1205,14 @@ private slots:
QTest::newRow("BARCODE_HIBC_DM") << false << 10.0f << "" QTest::newRow("BARCODE_HIBC_DM") << false << 10.0f << ""
<< BARCODE_HIBC_DM << UNICODE_MODE // symbology-inputMode << BARCODE_HIBC_DM << UNICODE_MODE // symbology-inputMode
<< "1234" << "" // text-primary << "1234" << "" // text-primary
<< 0.0f << -1 << 8 << DM_DMRE << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 0.0f << -1 << 8 << DM_DMRE << 1.0f // height-scale
<< 0.0f << false << 0.7f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << true << false << false << true << 0 // showText-rotateAngle << true << true << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 102 -d '1234' --dmre --vers=8" << "zint -b 102 -d '1234' --dmre --vers=8"
<< "zint.exe -b 102 -d \"1234\" --dmre --vers=8" << "zint.exe -b 102 -d \"1234\" --dmre --vers=8"
@@ -1140,12 +1221,14 @@ private slots:
QTest::newRow("BARCODE_HIBC_PDF") << false << 0.0f << "" QTest::newRow("BARCODE_HIBC_PDF") << false << 0.0f << ""
<< BARCODE_HIBC_PDF << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode << BARCODE_HIBC_PDF << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode
<< "TEXT" << "" // text-primary << "TEXT" << "" // text-primary
<< 3.5f << 3 << 4 << 10 << 10.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 3.5f << 3 << 4 << 10 << 10.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 2 << 1 << "" // guardDescent-structAppID << 5.0f << 2 << 1 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << true << false << true << 0 // showText-rotateAngle << true << false << true << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 106 --binary --cols=4 -d 'TEXT' --height=3.5 --heightperrow --quietzones" << "zint -b 106 --binary --cols=4 -d 'TEXT' --height=3.5 --heightperrow --quietzones"
" --rows=10 --scale=10 --secure=3 --structapp=1,2" " --rows=10 --scale=10 --secure=3 --structapp=1,2"
@@ -1156,12 +1239,14 @@ private slots:
QTest::newRow("BARCODE_ITF14") << true << 0.0f << "" QTest::newRow("BARCODE_ITF14") << true << 0.0f << ""
<< BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode << BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode
<< "9212320967145" << "" // text-primary << "9212320967145" << "" // text-primary
<< 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 30.0f << -1 << 0 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 89 --compliantheight -d '9212320967145'" << "zint -b 89 --compliantheight -d '9212320967145'"
<< "zint.exe -b 89 --compliantheight -d \"9212320967145\"" << "zint.exe -b 89 --compliantheight -d \"9212320967145\""
@@ -1170,12 +1255,14 @@ private slots:
QTest::newRow("BARCODE_ITF14 (border)") << true << 0.0f << "" QTest::newRow("BARCODE_ITF14 (border)") << true << 0.0f << ""
<< BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode << BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode
<< "9212320967145" << "" // text-primary << "9212320967145" << "" // text-primary
<< 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 30.0f << -1 << 0 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 1 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 1 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 89 --border=1 --compliantheight -d '9212320967145'" << "zint -b 89 --border=1 --compliantheight -d '9212320967145'"
<< "zint.exe -b 89 --border=1 --compliantheight -d \"9212320967145\"" << "zint.exe -b 89 --border=1 --compliantheight -d \"9212320967145\""
@@ -1185,12 +1272,14 @@ private slots:
<< BARCODE_MAXICODE << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode << BARCODE_MAXICODE << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode
<< "152382802840001" << "152382802840001"
<< "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G1 MAIN ST\\GTOWN\\GNY\\R\\E" // text-primary << "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G1 MAIN ST\\GTOWN\\GNY\\R\\E" // text-primary
<< 0.0f << -1 << (96 + 1) << 0 << 2.5f << 0.0f << false << 0.8f << 1.0f // height-textGap << 0.0f << -1 << (96 + 1) << 0 // height-scale
<< 2.5f << 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << true << false << true << 0 // showText-rotateAngle << true << false << true << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 57 -d '1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G1 MAIN ST\\GTOWN\\GNY\\R\\E'" << "zint -b 57 -d '1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G1 MAIN ST\\GTOWN\\GNY\\R\\E'"
" --esc --primary='152382802840001' --quietzones --scale=2.5 --scmvv=96" " --esc --primary='152382802840001' --quietzones --scale=2.5 --scmvv=96"
@@ -1201,12 +1290,14 @@ private slots:
QTest::newRow("BARCODE_MICROQR") << false << 0.0f << "" QTest::newRow("BARCODE_MICROQR") << false << 0.0f << ""
<< BARCODE_MICROQR << UNICODE_MODE // symbology-inputMode << BARCODE_MICROQR << UNICODE_MODE // symbology-inputMode
<< "1234" << "" // text-primary << "1234" << "" // text-primary
<< 30.0f << 2 << 3 << (ZINT_FULL_MULTIBYTE | (3 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 30.0f << 2 << 3 << (ZINT_FULL_MULTIBYTE | (3 // height-scale
+ 1) << 8) << 1.0f << 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 97 -d '1234' --fullmultibyte --mask=3 --secure=2 --vers=3" << "zint -b 97 -d '1234' --fullmultibyte --mask=3 --secure=2 --vers=3"
<< "zint.exe -b 97 -d \"1234\" --fullmultibyte --mask=3 --secure=2 --vers=3" << "zint.exe -b 97 -d \"1234\" --fullmultibyte --mask=3 --secure=2 --vers=3"
@@ -1215,28 +1306,32 @@ private slots:
QTest::newRow("BARCODE_QRCODE") << true << 0.0f << "" QTest::newRow("BARCODE_QRCODE") << true << 0.0f << ""
<< BARCODE_QRCODE << GS1_MODE // symbology-inputMode << BARCODE_QRCODE << GS1_MODE // symbology-inputMode
<< "(01)12" << "" // text-primary << "(01)12" << "" // text-primary
<< 0.0f << 1 << 5 << (ZINT_FULL_MULTIBYTE | (0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 0.0f << 1 << 5 << (ZINT_FULL_MULTIBYTE | (0 // height-scale
+ 1) << 8) << 1.0f << 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << true << false << true << 0 // showText-rotateAngle << true << false << true << false << true << 0 // showText-rotateAngle
<< 0 << true << true << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << true << true << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 58 -d '(01)12' --fullmultibyte --gs1parens --gs1nocheck --mask=0 --quietzones" << "zint -b 58 -d '(01)12' --fullmultibyte --gs1nocheck --gs1parens --mask=0 --quietzones"
" --secure=1 --vers=5" " --secure=1 --vers=5"
<< "zint.exe -b 58 -d \"(01)12\" --fullmultibyte --gs1parens --gs1nocheck --mask=0 --quietzones" << "zint.exe -b 58 -d \"(01)12\" --fullmultibyte --gs1nocheck --gs1parens --mask=0 --quietzones"
" --secure=1 --vers=5" " --secure=1 --vers=5"
<< "" << "" << "" << ""; << "" << "" << "" << "";
QTest::newRow("BARCODE_RMQR") << true << 0.0f << "" QTest::newRow("BARCODE_RMQR") << true << 0.0f << ""
<< BARCODE_RMQR << UNICODE_MODE // symbology-inputMode << BARCODE_RMQR << UNICODE_MODE // symbology-inputMode
<< "" << "" // text-primary << "" << "" // text-primary
<< 30.0f << -1 << 8 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 30.0f << -1 << 8 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 180 // showText-rotateAngle << true << false << false << false << true << 180 // showText-rotateAngle
<< 20 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 20 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 145 --eci=20 -d 'テ' --rotate=180 --vers=8" << "zint -b 145 --eci=20 -d 'テ' --rotate=180 --vers=8"
<< "zint.exe -b 145 --eci=20 -d \"\" --rotate=180 --vers=8" << "zint.exe -b 145 --eci=20 -d \"\" --rotate=180 --vers=8"
@@ -1245,26 +1340,30 @@ private slots:
QTest::newRow("BARCODE_ULTRA") << false << 0.0f << "" QTest::newRow("BARCODE_ULTRA") << false << 0.0f << ""
<< BARCODE_ULTRA << (GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE) // symbology-inputMode << BARCODE_ULTRA << (GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE) // symbology-inputMode
<< "(01)1" << "" // text-primary << "(01)1" << "" // text-primary
<< 0.0f << 6 << 2 << 0 << 1.0f << 0.0f << true << 0.8f << 1.0f // height-textGap << 0.0f << 6 << 2 << 0 << 1.0f // height-scale
<< 0.0f << true << 0.8f << 1.0f // dpmm-textGap
<< 5.0f << 2 << 1 << "4" // guardDescent-structAppID << 5.0f << 2 << 1 << "4" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 144 -d '(01)1' --gs1parens --gs1nocheck --secure=6 --structapp='1,2,4' --vers=2" << "zint -b 144 -d '(01)1' --gs1nocheck --gs1parens --secure=6 --structapp='1,2,4' --vers=2"
<< "zint.exe -b 144 -d \"(01)1\" --gs1parens --gs1nocheck --secure=6 --structapp=\"1,2,4\" --vers=2" << "zint.exe -b 144 -d \"(01)1\" --gs1nocheck --gs1parens --secure=6 --structapp=\"1,2,4\" --vers=2"
<< "" << "" << "" << ""; << "" << "" << "" << "";
QTest::newRow("BARCODE_UPCE_CC") << true << 0.0f << "out.svg" QTest::newRow("BARCODE_UPCE_CC") << true << 0.0f << "out.svg"
<< BARCODE_UPCE_CC << UNICODE_MODE // symbology-inputMode << BARCODE_UPCE_CC << UNICODE_MODE // symbology-inputMode
<< "12345670+1234" << "[11]901222[99]ABCDE" // text-primary << "12345670+1234" << "[11]901222[99]ABCDE" // text-primary
<< 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 0.0f << -1 << 0 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 6.5f << 0 << 0 << "" // guardDescent-structAppID << 6.5f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(0xEF, 0x29, 0x29) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(0xEF, 0x29, 0x29) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting
<< true << false << false << true << true << 0 // showText-rotateAngle << true << false << false << true << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_FAIL_ALL << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_FAIL_ALL << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 136 --compliantheight -d '[11]901222[99]ABCDE' --fg=EF2929 --guarddescent=6.5" << "zint -b 136 --compliantheight -d '[11]901222[99]ABCDE' --fg=EF2929 --guarddescent=6.5"
" --noquietzones -o 'out.svg' --primary='12345670+1234' --small --werror" " --noquietzones -o 'out.svg' --primary='12345670+1234' --small --werror"
@@ -1278,15 +1377,35 @@ private slots:
" --noquietzones -o \"out.svg\" --primary=\"12345670+1234\" --small --werror" " --noquietzones -o \"out.svg\" --primary=\"12345670+1234\" --small --werror"
<< ""; << "";
QTest::newRow("BARCODE_UPCE_CC (GS1NoCheck + GS1Raw + GS1SyntaxEngine)") << true << 0.0f << "out.svg"
<< BARCODE_UPCE_CC << UNICODE_MODE // symbology-inputMode
<< "12345670+1234" << "1190122299ABCDE" // text-primary
<< 0.0f << -1 << 0 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.0f // dpmm-textGap
<< 6.5f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(0xEF, 0x29, 0x29) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting
<< true << false << false << true << true << 0 // showText-rotateAngle
<< 0 << false << true << true << true // eci-gs1SyntaxEngine
<< false << false << false << WARN_FAIL_ALL << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 136 --compliantheight -d '1190122299ABCDE' --fg=EF2929 --gs1nocheck --gs1raw --gs1strict --guarddescent=6.5"
" --noquietzones -o 'out.svg' --primary='12345670+1234' --small --werror"
<< "zint.exe -b 136 --compliantheight -d \"1190122299ABCDE\" --fg=EF2929 --gs1nocheck --gs1raw --gs1strict --guarddescent=6.5"
" --noquietzones -o \"out.svg\" --primary=\"12345670+1234\" --small --werror"
<< "" << "" << "" << "";
QTest::newRow("BARCODE_VIN") << false << 2.0f << "" QTest::newRow("BARCODE_VIN") << false << 2.0f << ""
<< BARCODE_VIN << UNICODE_MODE // symbology-inputMode << BARCODE_VIN << UNICODE_MODE // symbology-inputMode
<< "12345678701234567" << "" // text-primary << "12345678701234567" << "" // text-primary
<< 20.0f << -1 << 1 << 0 << 1.0f << 0.0f << false << 0.8f << 1.2f // height-textGap << 20.0f << -1 << 1 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.2f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting
<< true << false << false << false << true << 0 // showText-rotateAngle << true << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 73 --bold -d '12345678701234567' --height=20 --small --textgap=1.2 --vers=1" << "zint -b 73 --bold -d '12345678701234567' --height=20 --small --textgap=1.2 --vers=1"
<< "zint.exe -b 73 --bold -d \"12345678701234567\" --height=20 --small --textgap=1.2 --vers=1" << "zint.exe -b 73 --bold -d \"12345678701234567\" --height=20 --small --textgap=1.2 --vers=1"
@@ -1295,12 +1414,14 @@ private slots:
QTest::newRow("BARCODE_VIN (notext)") << false << 2.0f << "" QTest::newRow("BARCODE_VIN (notext)") << false << 2.0f << ""
<< BARCODE_VIN << UNICODE_MODE // symbology-inputMode << BARCODE_VIN << UNICODE_MODE // symbology-inputMode
<< "12345678701234567" << "" // text-primary << "12345678701234567" << "" // text-primary
<< 20.0f << -1 << 1 << 0 << 1.0f << 0.0f << false << 0.8f << 1.2f // height-textGap << 20.0f << -1 << 1 << 0 << 1.0f // height-scale
<< 0.0f << false << 0.8f << 1.2f // dpmm-textGap
<< 5.0f << 0 << 0 << "" // guardDescent-structAppID << 5.0f << 0 << 0 << "" // guardDescent-structAppID
<< "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk
<< 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting << 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting
<< false << false << false << false << true << 0 // showText-rotateAngle << false << false << false << false << true << 0 // showText-rotateAngle
<< 0 << false << false << false << false << false << false << WARN_DEFAULT << false // eci-debug << 0 << false << false << false << false // eci-gs1SyntaxEngine
<< false << false << false << WARN_DEFAULT << false // readerInit-debug
<< 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
<< "zint -b 73 -d '12345678701234567' --height=20 --notext --vers=1" << "zint -b 73 -d '12345678701234567' --height=20 --notext --vers=1"
<< "zint.exe -b 73 -d \"12345678701234567\" --height=20 --notext --vers=1" << "zint.exe -b 73 -d \"12345678701234567\" --height=20 --notext --vers=1"
@@ -1353,6 +1474,7 @@ private slots:
QFETCH(int, eci); QFETCH(int, eci);
QFETCH(bool, gs1Parens); QFETCH(bool, gs1Parens);
QFETCH(bool, gs1NoCheck); QFETCH(bool, gs1NoCheck);
QFETCH(bool, gs1Raw);
QFETCH(bool, gs1SyntaxEngine); QFETCH(bool, gs1SyntaxEngine);
QFETCH(bool, readerInit); QFETCH(bool, readerInit);
QFETCH(bool, guardWhitespace); QFETCH(bool, guardWhitespace);
@@ -1418,6 +1540,7 @@ private slots:
bc.setECIValue(eci); bc.setECIValue(eci);
bc.setGS1Parens(gs1Parens); bc.setGS1Parens(gs1Parens);
bc.setGS1NoCheck(gs1NoCheck); bc.setGS1NoCheck(gs1NoCheck);
bc.setGS1Raw(gs1Raw);
bc.setGS1SyntaxEngine(gs1SyntaxEngine); bc.setGS1SyntaxEngine(gs1SyntaxEngine);
bc.setReaderInit(readerInit); bc.setReaderInit(readerInit);
bc.setGuardWhitespace(guardWhitespace); bc.setGuardWhitespace(guardWhitespace);
+15 -5
View File
@@ -189,6 +189,8 @@
2026-02-20 GL 2026-02-20 GL
- Added -azfull switch. - Added -azfull switch.
- Fiddled with some help capitalization. - Fiddled with some help capitalization.
2026-02-25 GL
- Added -gs1raw switch.
*/ */
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
@@ -580,10 +582,11 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n"
/* cli option --gs1 replaced by -format */ /* cli option --gs1 replaced by -format */
" -gs1nocheck bool: for gs1, do not check validity of data (allows non-standard symbols)\n" " -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" " -gs1parens bool: for gs1, AIs enclosed in parentheses instead of square brackets\n"
" -gs1raw bool: for gs1, raw GS1 input (no square brackets or parentheses), with GS for FNC1\n"
#ifdef ZINT_HAVE_GS1SE #ifdef ZINT_HAVE_GS1SE
" -gs1strict bool: use GS1 Syntax Engine to strictly validate GS1 data\n" " -gs1strict bool: use GS1 Syntax Engine to strictly validate GS1 data\n"
#else #else
" -gs1strict 0: GS1 syntax engine not compiled in, may not be activated.\n" " -gs1strict 0: GS1 syntax engine not compiled in, may not be activated\n"
#endif #endif
" -gssep bool: for gs1, use gs as separator instead fnc1 (Data Matrix 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" " -guarddescent double: height of guard bar descent in modules (EAN/UPC only)\n"
@@ -910,8 +913,7 @@ static int Encode(Tcl_Interp *interp, int objc,
"-barcode", "-bg", "-bind", "-bindtop", "-bold", "-border", "-box", "-barcode", "-bg", "-bind", "-bindtop", "-bold", "-border", "-box",
"-cols", "-compliantheight", "-dmiso144", "-dmre", "-dotsize", "-dotty", "-cols", "-compliantheight", "-dmiso144", "-dmre", "-dotsize", "-dotty",
"-eci", "-esc", "-extraesc", "-fast", "-fg", "-format", "-fullmultibyte", "-eci", "-esc", "-extraesc", "-fast", "-fg", "-format", "-fullmultibyte",
"-gs1nocheck", "-gs1parens", "-gs1nocheck", "-gs1parens", "-gs1raw", "-gs1strict",
"-gs1strict",
"-gssep", "-guarddescent", "-gssep", "-guarddescent",
"-guardwhitespace", "-height", "-heightperrow", "-init", "-mask", "-mode", "-guardwhitespace", "-height", "-heightperrow", "-init", "-mask", "-mode",
"-nobackground", "-noquietzones", "-notext", "-primary", "-quietzones", "-nobackground", "-noquietzones", "-notext", "-primary", "-quietzones",
@@ -925,8 +927,7 @@ static int Encode(Tcl_Interp *interp, int objc,
iBarcode, iBG, iBind, iBindTop, iBold, iBorder, iBox, iBarcode, iBG, iBind, iBindTop, iBold, iBorder, iBox,
iCols, iCompliantHeight, iDMISO144, iDMRE, iDotSize, iDotty, iCols, iCompliantHeight, iDMISO144, iDMRE, iDotSize, iDotty,
iECI, iEsc, iExtraEsc, iFast, iFG, iFormat, iFullMultiByte, iECI, iEsc, iExtraEsc, iFast, iFG, iFormat, iFullMultiByte,
iGS1NoCheck, iGS1Parens, iGS1NoCheck, iGS1Parens, iGS1Raw, iGS1Strict,
iGS1Strict,
iGSSep, iGuardDescent, iGSSep, iGuardDescent,
iGuardWhitespace, iHeight, iHeightPerRow, iInit, iMask, iMode, iGuardWhitespace, iHeight, iHeightPerRow, iInit, iMask, iMode,
iNoBackground, iNoQuietZones, iNoText, iPrimary, iQuietZones, iNoBackground, iNoQuietZones, iNoText, iPrimary, iQuietZones,
@@ -964,6 +965,7 @@ static int Encode(Tcl_Interp *interp, int objc,
case iFast: case iFast:
case iGS1NoCheck: case iGS1NoCheck:
case iGS1Parens: case iGS1Parens:
case iGS1Raw:
case iGS1Strict: case iGS1Strict:
case iGSSep: case iGSSep:
case iGuardWhitespace: case iGuardWhitespace:
@@ -1177,6 +1179,14 @@ static int Encode(Tcl_Interp *interp, int objc,
my_symbol->input_mode &= ~GS1PARENS_MODE; my_symbol->input_mode &= ~GS1PARENS_MODE;
} }
break; break;
case iGS1Raw:
if (intValue) {
my_symbol->input_mode |= GS1RAW_MODE;
my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | GS1_MODE;
} else {
my_symbol->input_mode &= ~GS1RAW_MODE;
}
break;
case iGS1Strict: case iGS1Strict:
if (intValue) { if (intValue) {
#ifdef ZINT_HAVE_GS1SE #ifdef ZINT_HAVE_GS1SE
+4 -4
View File
@@ -4,15 +4,15 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="452" height="313" fill="#FFFFFF"/> <rect x="0" y="0" width="452" height="313" fill="#FFFFFF"/>
<path d="M44 0h4v296.97h-4ZM52 0h4v296.97h-4ZM60 0h8v276.97h-8ZM80 0h4v276.97h-4ZM88 0h8v276.97h-8ZM104 0h8v276.97h-8ZM120 0h4v276.97h-4ZM132 0h8v276.97h-8ZM144 0h16v276.97h-16ZM164 0h4v276.97h-4ZM176 0h12v276.97h-12ZM192 0h4v276.97h-4ZM200 0h12v276.97h-12ZM220 0h4v276.97h-4ZM228 0h4v296.97h-4ZM236 0h4v296.97h-4ZM244 0h4v276.97h-4ZM252 0h4v276.97h-4ZM272 0h4v276.97h-4ZM288 0h4v276.97h-4ZM300 0h4v276.97h-4ZM312 0h4v276.97h-4ZM328 0h12v276.97h-12ZM344 0h4v276.97h-4ZM356 0h12v276.97h-12ZM376 0h4v276.97h-4ZM384 0h4v276.97h-4ZM392 0h4v276.97h-4ZM412 0h4v296.97h-4ZM420 0h4v296.97h-4Z"/> <path d="M44 0h4v296.97h-4ZM52 0h4v296.97h-4ZM60 0h8v276.97h-8ZM80 0h4v276.97h-4ZM92 0h8v276.97h-8ZM104 0h8v276.97h-8ZM116 0h4v276.97h-4ZM128 0h12v276.97h-12ZM148 0h8v276.97h-8ZM164 0h4v276.97h-4ZM176 0h8v276.97h-8ZM188 0h8v276.97h-8ZM200 0h16v276.97h-16ZM220 0h4v276.97h-4ZM228 0h4v296.97h-4ZM236 0h4v296.97h-4ZM244 0h4v276.97h-4ZM252 0h12v276.97h-12ZM272 0h4v276.97h-4ZM284 0h12v276.97h-12ZM300 0h4v276.97h-4ZM308 0h4v276.97h-4ZM328 0h4v276.97h-4ZM344 0h4v276.97h-4ZM356 0h4v276.97h-4ZM368 0h4v276.97h-4ZM384 0h4v276.97h-4ZM396 0h4v276.97h-4ZM412 0h4v296.97h-4ZM420 0h4v296.97h-4Z"/>
<text x="24.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="40"> <text x="24.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="40">
4 9
</text> </text>
<text x="142" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="142" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
512345 520123
</text> </text>
<text x="326" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="326" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
678906 456788
</text> </text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

+4 -4
View File
@@ -4,15 +4,15 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="552" height="313" fill="#FFFFFF"/> <rect x="0" y="0" width="552" height="313" fill="#FFFFFF"/>
<path d="M44 0h4v296.97h-4ZM52 0h4v296.97h-4ZM60 0h8v276.97h-8ZM80 0h4v276.97h-4ZM88 0h8v276.97h-8ZM104 0h8v276.97h-8ZM120 0h4v276.97h-4ZM132 0h8v276.97h-8ZM144 0h16v276.97h-16ZM164 0h4v276.97h-4ZM176 0h12v276.97h-12ZM192 0h4v276.97h-4ZM200 0h12v276.97h-12ZM220 0h4v276.97h-4ZM228 0h4v296.97h-4ZM236 0h4v296.97h-4ZM244 0h4v276.97h-4ZM252 0h4v276.97h-4ZM272 0h4v276.97h-4ZM288 0h4v276.97h-4ZM300 0h4v276.97h-4ZM312 0h4v276.97h-4ZM328 0h12v276.97h-12ZM344 0h4v276.97h-4ZM356 0h12v276.97h-12ZM376 0h4v276.97h-4ZM384 0h4v276.97h-4ZM392 0h4v276.97h-4ZM412 0h4v296.97h-4ZM420 0h4v296.97h-4ZM452 36h4v260.97h-4ZM460 36h8v260.97h-8ZM476 36h4v260.97h-4ZM488 36h8v260.97h-8ZM500 36h4v260.97h-4ZM508 36h8v260.97h-8ZM524 36h8v260.97h-8Z"/> <path d="M44 0h4v296.97h-4ZM52 0h4v296.97h-4ZM60 0h8v276.97h-8ZM80 0h4v276.97h-4ZM92 0h8v276.97h-8ZM104 0h8v276.97h-8ZM116 0h4v276.97h-4ZM128 0h12v276.97h-12ZM148 0h8v276.97h-8ZM164 0h4v276.97h-4ZM176 0h8v276.97h-8ZM188 0h8v276.97h-8ZM200 0h16v276.97h-16ZM220 0h4v276.97h-4ZM228 0h4v296.97h-4ZM236 0h4v296.97h-4ZM244 0h4v276.97h-4ZM252 0h12v276.97h-12ZM272 0h4v276.97h-4ZM284 0h12v276.97h-12ZM300 0h4v276.97h-4ZM308 0h4v276.97h-4ZM328 0h4v276.97h-4ZM344 0h4v276.97h-4ZM356 0h4v276.97h-4ZM368 0h4v276.97h-4ZM384 0h4v276.97h-4ZM396 0h4v276.97h-4ZM412 0h4v296.97h-4ZM420 0h4v296.97h-4ZM452 36h4v260.97h-4ZM460 36h8v260.97h-8ZM476 36h4v260.97h-4ZM488 36h8v260.97h-8ZM500 36h4v260.97h-4ZM508 36h8v260.97h-8ZM524 36h8v260.97h-8Z"/>
<text x="24.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="40"> <text x="24.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="40">
4 9
</text> </text>
<text x="142" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="142" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
512345 520123
</text> </text>
<text x="326" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="326" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
678906 456788
</text> </text>
<text x="492" y="31.2" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="492" y="31.2" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
21 21

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

+4 -4
View File
@@ -4,15 +4,15 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="452" height="313" fill="#FFFFFF"/> <rect x="0" y="0" width="452" height="313" fill="#FFFFFF"/>
<path d="M44 0h4v286.97h-4ZM52 0h4v286.97h-4ZM60 0h8v276.97h-8ZM80 0h4v276.97h-4ZM88 0h8v276.97h-8ZM104 0h8v276.97h-8ZM120 0h4v276.97h-4ZM132 0h8v276.97h-8ZM144 0h16v276.97h-16ZM164 0h4v276.97h-4ZM176 0h12v276.97h-12ZM192 0h4v276.97h-4ZM200 0h12v276.97h-12ZM220 0h4v276.97h-4ZM228 0h4v286.97h-4ZM236 0h4v286.97h-4ZM244 0h4v276.97h-4ZM252 0h4v276.97h-4ZM272 0h4v276.97h-4ZM288 0h4v276.97h-4ZM300 0h4v276.97h-4ZM312 0h4v276.97h-4ZM328 0h12v276.97h-12ZM344 0h4v276.97h-4ZM356 0h12v276.97h-12ZM376 0h4v276.97h-4ZM384 0h4v276.97h-4ZM392 0h4v276.97h-4ZM412 0h4v286.97h-4ZM420 0h4v286.97h-4Z"/> <path d="M44 0h4v286.97h-4ZM52 0h4v286.97h-4ZM60 0h8v276.97h-8ZM80 0h4v276.97h-4ZM92 0h8v276.97h-8ZM104 0h8v276.97h-8ZM116 0h4v276.97h-4ZM128 0h12v276.97h-12ZM148 0h8v276.97h-8ZM164 0h4v276.97h-4ZM176 0h8v276.97h-8ZM188 0h8v276.97h-8ZM200 0h16v276.97h-16ZM220 0h4v276.97h-4ZM228 0h4v286.97h-4ZM236 0h4v286.97h-4ZM244 0h4v276.97h-4ZM252 0h12v276.97h-12ZM272 0h4v276.97h-4ZM284 0h12v276.97h-12ZM300 0h4v276.97h-4ZM308 0h4v276.97h-4ZM328 0h4v276.97h-4ZM344 0h4v276.97h-4ZM356 0h4v276.97h-4ZM368 0h4v276.97h-4ZM384 0h4v276.97h-4ZM396 0h4v276.97h-4ZM412 0h4v286.97h-4ZM420 0h4v286.97h-4Z"/>
<text x="24.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="40"> <text x="24.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="40">
4 9
</text> </text>
<text x="142" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="142" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
512345 520123
</text> </text>
<text x="326" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="326" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
678906 456788
</text> </text>
<text x="454" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="40"> <text x="454" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="40">
&gt; &gt;

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

+3 -3
View File
@@ -4,12 +4,12 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="324" height="257" fill="#FFFFFF"/> <rect x="0" y="0" width="324" height="257" fill="#FFFFFF"/>
<path d="M28 0h4v240.97h-4ZM36 0h4v240.97h-4ZM44 0h12v220.97h-12ZM60 0h8v220.97h-8ZM72 0h4v220.97h-4ZM88 0h8v220.97h-8ZM100 0h16v220.97h-16ZM120 0h4v220.97h-4ZM132 0h4v220.97h-4ZM144 0h8v220.97h-8ZM156 0h4v240.97h-4ZM164 0h4v240.97h-4ZM172 0h4v220.97h-4ZM192 0h4v220.97h-4ZM200 0h4v220.97h-4ZM208 0h4v220.97h-4ZM228 0h4v220.97h-4ZM240 0h12v220.97h-12ZM256 0h4v220.97h-4ZM264 0h12v220.97h-12ZM284 0h4v240.97h-4ZM292 0h4v240.97h-4Z"/> <path d="M28 0h4v240.97h-4ZM36 0h4v240.97h-4ZM52 0h4v220.97h-4ZM60 0h8v220.97h-8ZM72 0h8v220.97h-8ZM92 0h4v220.97h-4ZM104 0h4v220.97h-4ZM116 0h8v220.97h-8ZM136 0h8v220.97h-8ZM148 0h4v220.97h-4ZM156 0h4v240.97h-4ZM164 0h4v240.97h-4ZM172 0h12v220.97h-12ZM192 0h4v220.97h-4ZM200 0h12v220.97h-12ZM220 0h4v220.97h-4ZM228 0h12v220.97h-12ZM248 0h4v220.97h-4ZM256 0h8v220.97h-8ZM268 0h8v220.97h-8ZM284 0h4v240.97h-4ZM292 0h4v240.97h-4Z"/>
<text x="98" y="255.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="98" y="255.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
7432 9520
</text> </text>
<text x="226" y="255.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="226" y="255.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
3654 0002
</text> </text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1019 B

After

Width:  |  Height:  |  Size: 1017 B

+3 -3
View File
@@ -4,15 +4,15 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="324" height="257" fill="#FFFFFF"/> <rect x="0" y="0" width="324" height="257" fill="#FFFFFF"/>
<path d="M28 0h4v240.97h-4ZM36 0h4v240.97h-4ZM44 0h12v220.97h-12ZM60 0h8v220.97h-8ZM72 0h4v220.97h-4ZM88 0h8v220.97h-8ZM100 0h16v220.97h-16ZM120 0h4v220.97h-4ZM132 0h4v220.97h-4ZM144 0h8v220.97h-8ZM156 0h4v240.97h-4ZM164 0h4v240.97h-4ZM172 0h4v220.97h-4ZM192 0h4v220.97h-4ZM200 0h4v220.97h-4ZM208 0h4v220.97h-4ZM228 0h4v220.97h-4ZM240 0h12v220.97h-12ZM256 0h4v220.97h-4ZM264 0h12v220.97h-12ZM284 0h4v240.97h-4ZM292 0h4v240.97h-4Z"/> <path d="M28 0h4v240.97h-4ZM36 0h4v240.97h-4ZM52 0h4v220.97h-4ZM60 0h8v220.97h-8ZM72 0h8v220.97h-8ZM92 0h4v220.97h-4ZM104 0h4v220.97h-4ZM116 0h8v220.97h-8ZM136 0h8v220.97h-8ZM148 0h4v220.97h-4ZM156 0h4v240.97h-4ZM164 0h4v240.97h-4ZM172 0h12v220.97h-12ZM192 0h4v220.97h-4ZM200 0h12v220.97h-12ZM220 0h4v220.97h-4ZM228 0h12v220.97h-12ZM248 0h4v220.97h-4ZM256 0h8v220.97h-8ZM268 0h8v220.97h-8ZM284 0h4v240.97h-4ZM292 0h4v240.97h-4Z"/>
<text x="-2" y="255.37" text-anchor="start" font-family="OCRB, monospace" font-size="40"> <text x="-2" y="255.37" text-anchor="start" font-family="OCRB, monospace" font-size="40">
&lt; &lt;
</text> </text>
<text x="98" y="255.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="98" y="255.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
7432 9520
</text> </text>
<text x="226" y="255.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="226" y="255.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
3654 0002
</text> </text>
<text x="326" y="255.37" text-anchor="end" font-family="OCRB, monospace" font-size="40"> <text x="326" y="255.37" text-anchor="end" font-family="OCRB, monospace" font-size="40">
&gt; &gt;

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 KiB

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 271 KiB

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 KiB

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 KiB

After

Width:  |  Height:  |  Size: 279 KiB

+5 -5
View File
@@ -4,18 +4,18 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="452" height="313" fill="#FFFFFF"/> <rect x="0" y="0" width="452" height="313" fill="#FFFFFF"/>
<path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM52 0h12v296.97h-12ZM68 0h8v296.97h-8ZM84 0h4v276.97h-4ZM96 0h8v276.97h-8ZM108 0h8v276.97h-8ZM128 0h4v276.97h-4ZM140 0h4v276.97h-4ZM152 0h8v276.97h-8ZM164 0h12v276.97h-12ZM180 0h8v276.97h-8ZM196 0h4v276.97h-4ZM208 0h8v276.97h-8ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h4v276.97h-4ZM252 0h4v276.97h-4ZM264 0h12v276.97h-12ZM284 0h4v276.97h-4ZM292 0h8v276.97h-8ZM304 0h8v276.97h-8ZM320 0h4v276.97h-4ZM336 0h4v276.97h-4ZM348 0h12v276.97h-12ZM368 0h4v276.97h-4ZM376 0h4v296.97h-4ZM396 0h4v296.97h-4ZM404 0h4v296.97h-4ZM412 0h4v296.97h-4Z"/> <path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM60 0h8v296.97h-8ZM72 0h4v296.97h-4ZM84 0h8v276.97h-8ZM100 0h4v276.97h-4ZM112 0h4v276.97h-4ZM124 0h8v276.97h-8ZM136 0h16v276.97h-16ZM156 0h4v276.97h-4ZM164 0h4v276.97h-4ZM180 0h8v276.97h-8ZM192 0h8v276.97h-8ZM212 0h4v276.97h-4ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h12v276.97h-12ZM256 0h4v276.97h-4ZM264 0h12v276.97h-12ZM284 0h4v276.97h-4ZM292 0h12v276.97h-12ZM312 0h4v276.97h-4ZM320 0h12v276.97h-12ZM340 0h4v276.97h-4ZM348 0h4v276.97h-4ZM360 0h12v276.97h-12ZM376 0h4v296.97h-4ZM388 0h4v296.97h-4ZM404 0h4v296.97h-4ZM412 0h4v296.97h-4Z"/>
<text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28"> <text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28">
7 0
</text> </text>
<text x="148" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="148" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
25272 12345
</text> </text>
<text x="304" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="304" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
70270 00005
</text> </text>
<text x="430.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28"> <text x="430.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28">
3 8
</text> </text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

+5 -5
View File
@@ -4,18 +4,18 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="660" height="313" fill="#FFFFFF"/> <rect x="0" y="0" width="660" height="313" fill="#FFFFFF"/>
<path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM52 0h12v296.97h-12ZM68 0h8v296.97h-8ZM84 0h4v276.97h-4ZM96 0h8v276.97h-8ZM108 0h8v276.97h-8ZM128 0h4v276.97h-4ZM140 0h4v276.97h-4ZM152 0h8v276.97h-8ZM164 0h12v276.97h-12ZM180 0h8v276.97h-8ZM196 0h4v276.97h-4ZM208 0h8v276.97h-8ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h4v276.97h-4ZM252 0h4v276.97h-4ZM264 0h12v276.97h-12ZM284 0h4v276.97h-4ZM292 0h8v276.97h-8ZM304 0h8v276.97h-8ZM320 0h4v276.97h-4ZM336 0h4v276.97h-4ZM348 0h12v276.97h-12ZM368 0h4v276.97h-4ZM376 0h4v296.97h-4ZM396 0h4v296.97h-4ZM404 0h4v296.97h-4ZM412 0h4v296.97h-4ZM452 36h4v260.97h-4ZM460 36h8v260.97h-8ZM472 36h8v260.97h-8ZM488 36h8v260.97h-8ZM500 36h4v260.97h-4ZM512 36h4v260.97h-4ZM524 36h8v260.97h-8ZM536 36h4v260.97h-4ZM544 36h4v260.97h-4ZM564 36h4v260.97h-4ZM572 36h4v260.97h-4ZM580 36h4v260.97h-4ZM596 36h8v260.97h-8ZM608 36h4v260.97h-4ZM616 36h8v260.97h-8ZM636 36h4v260.97h-4Z"/> <path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM60 0h8v296.97h-8ZM72 0h4v296.97h-4ZM84 0h8v276.97h-8ZM100 0h4v276.97h-4ZM112 0h4v276.97h-4ZM124 0h8v276.97h-8ZM136 0h16v276.97h-16ZM156 0h4v276.97h-4ZM164 0h4v276.97h-4ZM180 0h8v276.97h-8ZM192 0h8v276.97h-8ZM212 0h4v276.97h-4ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h12v276.97h-12ZM256 0h4v276.97h-4ZM264 0h12v276.97h-12ZM284 0h4v276.97h-4ZM292 0h12v276.97h-12ZM312 0h4v276.97h-4ZM320 0h12v276.97h-12ZM340 0h4v276.97h-4ZM348 0h4v276.97h-4ZM360 0h12v276.97h-12ZM376 0h4v296.97h-4ZM388 0h4v296.97h-4ZM404 0h4v296.97h-4ZM412 0h4v296.97h-4ZM452 36h4v260.97h-4ZM460 36h8v260.97h-8ZM472 36h8v260.97h-8ZM488 36h8v260.97h-8ZM500 36h4v260.97h-4ZM512 36h4v260.97h-4ZM524 36h8v260.97h-8ZM536 36h4v260.97h-4ZM544 36h4v260.97h-4ZM564 36h4v260.97h-4ZM572 36h4v260.97h-4ZM580 36h4v260.97h-4ZM596 36h8v260.97h-8ZM608 36h4v260.97h-4ZM616 36h8v260.97h-8ZM636 36h4v260.97h-4Z"/>
<text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28"> <text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28">
7 0
</text> </text>
<text x="148" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="148" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
25272 12345
</text> </text>
<text x="304" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="304" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
70270 00005
</text> </text>
<text x="430.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28"> <text x="430.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28">
3 8
</text> </text>
<text x="548" y="31.2" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="548" y="31.2" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
12345 12345

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

+5 -5
View File
@@ -4,18 +4,18 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="660" height="313" fill="#FFFFFF"/> <rect x="0" y="0" width="660" height="313" fill="#FFFFFF"/>
<path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM52 0h12v296.97h-12ZM68 0h8v296.97h-8ZM84 0h4v276.97h-4ZM96 0h8v276.97h-8ZM108 0h8v276.97h-8ZM128 0h4v276.97h-4ZM140 0h4v276.97h-4ZM152 0h8v276.97h-8ZM164 0h12v276.97h-12ZM180 0h8v276.97h-8ZM196 0h4v276.97h-4ZM208 0h8v276.97h-8ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h4v276.97h-4ZM252 0h4v276.97h-4ZM264 0h12v276.97h-12ZM284 0h4v276.97h-4ZM292 0h8v276.97h-8ZM304 0h8v276.97h-8ZM320 0h4v276.97h-4ZM336 0h4v276.97h-4ZM348 0h12v276.97h-12ZM368 0h4v276.97h-4ZM376 0h4v296.97h-4ZM396 0h4v296.97h-4ZM404 0h4v296.97h-4ZM412 0h4v296.97h-4ZM452 36h4v260.97h-4ZM460 36h8v260.97h-8ZM472 36h8v260.97h-8ZM488 36h8v260.97h-8ZM500 36h4v260.97h-4ZM512 36h4v260.97h-4ZM524 36h8v260.97h-8ZM536 36h4v260.97h-4ZM544 36h4v260.97h-4ZM564 36h4v260.97h-4ZM572 36h4v260.97h-4ZM580 36h4v260.97h-4ZM596 36h8v260.97h-8ZM608 36h4v260.97h-4ZM616 36h8v260.97h-8ZM636 36h4v260.97h-4Z"/> <path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM60 0h8v296.97h-8ZM72 0h4v296.97h-4ZM84 0h8v276.97h-8ZM100 0h4v276.97h-4ZM112 0h4v276.97h-4ZM124 0h8v276.97h-8ZM136 0h16v276.97h-16ZM156 0h4v276.97h-4ZM164 0h4v276.97h-4ZM180 0h8v276.97h-8ZM192 0h8v276.97h-8ZM212 0h4v276.97h-4ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h12v276.97h-12ZM256 0h4v276.97h-4ZM264 0h12v276.97h-12ZM284 0h4v276.97h-4ZM292 0h12v276.97h-12ZM312 0h4v276.97h-4ZM320 0h12v276.97h-12ZM340 0h4v276.97h-4ZM348 0h4v276.97h-4ZM360 0h12v276.97h-12ZM376 0h4v296.97h-4ZM388 0h4v296.97h-4ZM404 0h4v296.97h-4ZM412 0h4v296.97h-4ZM452 36h4v260.97h-4ZM460 36h8v260.97h-8ZM472 36h8v260.97h-8ZM488 36h8v260.97h-8ZM500 36h4v260.97h-4ZM512 36h4v260.97h-4ZM524 36h8v260.97h-8ZM536 36h4v260.97h-4ZM544 36h4v260.97h-4ZM564 36h4v260.97h-4ZM572 36h4v260.97h-4ZM580 36h4v260.97h-4ZM596 36h8v260.97h-8ZM608 36h4v260.97h-4ZM616 36h8v260.97h-8ZM636 36h4v260.97h-4Z"/>
<text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28"> <text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28">
7 0
</text> </text>
<text x="148" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="148" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
25272 12345
</text> </text>
<text x="304" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="304" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
70270 00005
</text> </text>
<text x="430.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28"> <text x="430.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28">
3 8
</text> </text>
<text x="548" y="31.2" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="548" y="31.2" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
12345 12345

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

+3 -3
View File
@@ -4,15 +4,15 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="268" height="313" fill="#FFFFFF"/> <rect x="0" y="0" width="268" height="313" fill="#FFFFFF"/>
<path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM52 0h8v276.97h-8ZM68 0h8v276.97h-8ZM84 0h4v276.97h-4ZM96 0h8v276.97h-8ZM108 0h16v276.97h-16ZM128 0h4v276.97h-4ZM140 0h12v276.97h-12ZM156 0h4v276.97h-4ZM164 0h12v276.97h-12ZM184 0h4v276.97h-4ZM192 0h4v276.97h-4ZM200 0h16v276.97h-16ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h4v296.97h-4Z"/> <path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM52 0h8v276.97h-8ZM68 0h8v276.97h-8ZM84 0h4v276.97h-4ZM96 0h8v276.97h-8ZM108 0h4v276.97h-4ZM128 0h4v276.97h-4ZM136 0h4v276.97h-4ZM152 0h8v276.97h-8ZM164 0h8v276.97h-8ZM184 0h4v276.97h-4ZM192 0h12v276.97h-12ZM212 0h4v276.97h-4ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h4v296.97h-4Z"/>
<text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28"> <text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28">
0 0
</text> </text>
<text x="134" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="134" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
123456 123455
</text> </text>
<text x="246.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28"> <text x="246.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28">
5 8
</text> </text>
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

+3 -3
View File
@@ -4,15 +4,15 @@
<desc>Zint Generated Symbol</desc> <desc>Zint Generated Symbol</desc>
<g id="barcode" fill="#000000"> <g id="barcode" fill="#000000">
<rect x="0" y="0" width="368" height="313" fill="#FFFFFF"/> <rect x="0" y="0" width="368" height="313" fill="#FFFFFF"/>
<path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM52 0h8v276.97h-8ZM68 0h8v276.97h-8ZM84 0h4v276.97h-4ZM96 0h8v276.97h-8ZM108 0h16v276.97h-16ZM128 0h4v276.97h-4ZM140 0h12v276.97h-12ZM156 0h4v276.97h-4ZM164 0h12v276.97h-12ZM184 0h4v276.97h-4ZM192 0h4v276.97h-4ZM200 0h16v276.97h-16ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h4v296.97h-4ZM268 36h4v260.97h-4ZM276 36h8v260.97h-8ZM292 36h8v260.97h-8ZM308 36h4v260.97h-4ZM316 36h4v260.97h-4ZM328 36h4v260.97h-4ZM340 36h8v260.97h-8Z"/> <path d="M36 0h4v296.97h-4ZM44 0h4v296.97h-4ZM52 0h8v276.97h-8ZM68 0h8v276.97h-8ZM84 0h4v276.97h-4ZM96 0h8v276.97h-8ZM108 0h4v276.97h-4ZM128 0h4v276.97h-4ZM136 0h4v276.97h-4ZM152 0h8v276.97h-8ZM164 0h8v276.97h-8ZM184 0h4v276.97h-4ZM192 0h12v276.97h-12ZM212 0h4v276.97h-4ZM220 0h4v296.97h-4ZM228 0h4v296.97h-4ZM236 0h4v296.97h-4ZM268 36h4v260.97h-4ZM276 36h8v260.97h-8ZM292 36h8v260.97h-8ZM308 36h4v260.97h-4ZM316 36h4v260.97h-4ZM328 36h4v260.97h-4ZM340 36h8v260.97h-8Z"/>
<text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28"> <text x="17.4" y="311.37" text-anchor="end" font-family="OCRB, monospace" font-size="28">
0 0
</text> </text>
<text x="134" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="134" y="311.37" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
123456 123455
</text> </text>
<text x="246.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28"> <text x="246.6" y="311.37" text-anchor="start" font-family="OCRB, monospace" font-size="28">
5 8
</text> </text>
<text x="308" y="31.2" text-anchor="middle" font-family="OCRB, monospace" font-size="40"> <text x="308" y="31.2" text-anchor="middle" font-family="OCRB, monospace" font-size="40">
12 12

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

+738 -546
View File
File diff suppressed because it is too large Load Diff
+194 -104
View File
@@ -320,10 +320,15 @@ context menu by right-clicking the preview.
In the middle of the Data tab is an area for creating composite symbologies In the middle of the Data tab is an area for creating composite symbologies
which appears when the currently selected symbology supports the GS1 Composite which appears when the currently selected symbology supports the GS1 Composite
symbology standard. GS1 data can then be entered with square brackets used to symbology standard - namely EAN-13, EAN-8, GS1-128, GS1 DataBar (all variants),
separate Application Identifier (AI) information from data as shown here. Round UPC-A and UPC-E. See [6.3 GS1 Composite Symbols (ISO 24723)] for details.
brackets (parentheses) can be used instead if the `"GS1 ()"` checkbox is set.
For details, see [6.3 GS1 Composite Symbols (ISO 24723)]. If the `"Add 2D Component"` checkbox is checked, GS1 data can then be entered in
the `"2D Component Data"` text box, with square brackets used to separate
Application Identifier (AI) information from data as shown here, or using one of
the other formats described in [4.11.3 GS1 Data Entry and Options], where the
GS1 checkbox options `"()"` (Parentheses), `"Raw"`, `"No Check"` and `"Strict"`
are also discussed.
## 3.3 Additional ECI/Data Segments Groupbox ## 3.3 Additional ECI/Data Segments Groupbox
@@ -1163,11 +1168,11 @@ zint -d "1234" --scalexdimdp=0.33mm,300dpi
### 4.9.2 Scaling Example ### 4.9.2 Scaling Example
The GS1 General Specifications Section 5.2.6.6 'Symbol dimensions at nominal The GS1 General Specifications 26.0 Section 5.2.6.6 "Symbol dimensions at
size' gives an example of an EAN-13 barcode using the X-dimension of 0.33mm. To nominal size" gives an example of an EAN-13 barcode using the X-dimension of
print that example as a PNG at 12 dpmm, the approximate equivalent of 300 dpi 0.33mm. To print that example as a PNG at 12 dpmm, the approximate equivalent of
(`dpi = dpmm * 25.4`), specify a scale of 2, since `0.33 * 12 = 3.96` pixels, or 300 dpi (`dpi = dpmm * 25.4`), specify a scale of 2, since `0.33 * 12 = 3.96`
4 pixels rounding to the nearest pixel: pixels, or 4 pixels rounding to the nearest pixel:
```bash ```bash
zint -b EAN13 -d "501234567890" --compliantheight --scale=2 zint -b EAN13 -d "501234567890" --compliantheight --scale=2
@@ -1281,15 +1286,8 @@ character encoding then it will take advantage of the ECI (Extended Channel
Interpretations) mechanism to encode the data if the symbology supports it - see Interpretations) mechanism to encode the data if the symbology supports it - see
[4.11.2 Input Modes and ECI] below. [4.11.2 Input Modes and ECI] below.
GS1 data can be encoded in a number of symbologies. Application Identifiers GS1 data can be encoded in a number of symbologies - see [4.11.3 GS1 Data Entry
(AIs) should be enclosed in `[square brackets]` followed by the data to be and Options].
encoded (see [6.1.10.3 GS1-128]). For matrix symbologies, GS1 Digital Link URIs
can also be given. To encode GS1 data use the `--gs1` option. Alternatively,
use the `--gs1strict` option, which strictly verifies the GS1 data.
GS1 mode is assumed (and doesn't need to be set) for GS1-128, EAN-14, GS1
DataBar and GS1 Composite symbologies but is also available for Aztec Code, Code
16K, Code 49, Code One, Data Matrix, DotCode, QR Code and Ultracode.
Health Industry Barcode (HIBC) data may also be encoded in the symbologies Aztec 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, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR
@@ -1470,6 +1468,121 @@ zint -b QRCODE --binary -d "UTF-8 data"
![`zint -b QRCODE --binary -d "\xE2\x82\xAC\xE5\xB8\xB8" ![`zint -b QRCODE --binary -d "\xE2\x82\xAC\xE5\xB8\xB8"
--esc`](images/qrcode_binary_utf8.svg){.i2d} --esc`](images/qrcode_binary_utf8.svg){.i2d}
### 4.11.3 GS1 Data Entry and Options
The following symbologies accept GS1 data:
Symbology Implicit AI? Assumed? Supports Composite?
------------- ------------ -------- -------------------
Aztec Code No No No
Code 16K No No No
Code 49 No No No
Code One No No No
Data Matrix No No No
DotCode No No No
EAN-13, EAN-8 Yes (01) Yes Yes
EAN-14 Yes (01) Yes No
GS1-128 No Yes Yes
GS1 DataBar Expanded (Stacked) No Yes Yes
GS1 DataBar (all others) Yes (01) Yes Yes
NVE-18 Yes (00) Yes No
QR Code No No No
rMQR No No No
Ultracode No No No
UPC-A, UPC-E Yes (01) Yes Yes
Table: GS1-Enabled Symbologies
#### 4.11.3.1 GS1 Data Entry
Those that encode an implicit AI take numeric data in their linear part without
any further markup - see respective descriptions in [6. Types of Symbology].
GS1-128, GS1 DataBar Expanded (including Expanded Stacked), the matrix
symbologies and the 2D component of GS1 Composite symbologies, all of which can
encode multiple AIs, require markup in the data to distinguish AIs.
The traditional way in Zint of specifying GS1 data for these cases is to delimit
the GS1 AIs in square brackets:
```bash
zint -b AZTEC -d "[01]09520123456788[10]BATCH4[21]07" --gs1
```
(Note that for the matrix symbologies the `--gs1` option must be given.)
Parentheses (round brackets) may be used instead by giving the `--gs1parens`
option:
```bash
zint -b AZTEC -d "(01)09520123456788(10)BATCH4(21)07" --gs1parens
```
If the data includes opening parentheses when using the latter format, they must
be escaped and the `--esc` option given:
```bash
zint -b AZTEC -d "(01)09520123456788(90)Var\(34)" --esc --gs1parens
```
Closing parentheses may also be escaped for clarity.
For matrix symbologies, a GS1 Digital Link URI may be used:
```bash
zint -b AZTEC -d "https://example.com/01/09520123456788/10/BATCH4/21/07" --gs1
```
A further way to specify GS1 input is "Unbracketed AI", a GS1 Syntax Engine
format[^10] that uses carets (`^`) to indicate any required `FNC1`s.[^11] The
data must start with a caret:
```bash
zint -b AZTEC -d "^010952012345678810BATCH4^2107" --gs1
```
[^10]: For more information on the "Unbracketed AI" format for GS1 data entry,
see the [GS1 Barcode Syntax Engine overview](
https://gs1.github.io/gs1-syntax-engine/).
[^11]: `FNC1`s are required to terminate the data of any AI (except when the
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).
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
sequence `\G`). It does not start with a `GS`:
```bash
zint -b AZTEC -d "010952012345678810BATCH4\G2107" --esc --gs1raw
```
#### 4.11.3.2 GS1 Options
Apart from `--gs1`, `--gs1parens` and `--gs1raw` discussed above, there are two
other GS1 options.
- `--gs1strict`, which enables the use the GS1 Syntax Engine to
strictly validate GS1 data, including GS1 Digital Link URIs (by default Zint
does not validate Digital Links at all). It requires that the `gs1encoders`
library was present when Zint was built, otherwise the default built-in
validation will be used.
- `--gs1nocheck`, for use with legacy systems that have data that does not
conform to the current GS1 standard. Printable ASCII input is still checked for,
as is the validity of GS1 data specified without AIs (e.g. linear data for GS1
DataBar Omnidirectional/Limited/etc.). Also checked is GS1 DataBar Expanded and
GS1 Composite input that is not in the GS1 encodable character set 82 (see GS1
General Specifications 26.0 Table 7-2 "GS1 AI encodable character set 82"),
otherwise encodation would fail. In "Unbracketed AI" and raw mode, overlong AI
data will also fail.
All the GS1 options imply `--gs1`.
## 4.12 Batch Processing ## 4.12 Batch Processing
Data can be batch processed by reading from a text file and producing a Data can be batch processed by reading from a text file and producing a
@@ -1936,10 +2049,10 @@ int main(int argc, char **argv)
``` ```
will print the SVG output to `stdout` (the file `"mem.svg"` is not created). will print the SVG output to `stdout` (the file `"mem.svg"` is not created).
This is particularly useful for the textual formats EPS and SVG,[^10] allowing This is particularly useful for the textual formats EPS and SVG,[^12] allowing
the output to be manipulated and processed by the client. the output to be manipulated and processed by the client.
[^10]: BARCODE_MEMORY_FILE textual formats EPS and SVG will have Unix newlines [^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. (LF) on both Windows and Unix, i.e. not CR+LF on Windows.
## 5.7 Setting Options ## 5.7 Setting Options
@@ -1960,7 +2073,7 @@ Member Name Type Meaning Default Value
`height` float Symbol height in Symbol dependent `height` float Symbol height in Symbol dependent
X-dimensions, excluding X-dimensions, excluding
fixed width-to-height fixed width-to-height
symbols.[^11] symbols.[^13]
`scale` float Scale factor for 1.0 `scale` float Scale factor for 1.0
adjusting size of image adjusting size of image
@@ -2010,7 +2123,7 @@ Member Name Type Meaning Default Value
`.eps`, `.pcx`, `.svg`, `.eps`, `.pcx`, `.svg`,
`.tif` or `.txt` followed `.tif` or `.txt` followed
by a terminating by a terminating
`NUL`.[^12] `NUL`.[^14]
`primary` character Primary message data for `""` (empty) `primary` character Primary message data for `""` (empty)
string more complex symbols, string more complex symbols,
@@ -2122,7 +2235,7 @@ Member Name Type Meaning Default Value
array of content segments if array of content segments if
segments `BARCODE_CONTENT_SEGS` segments `BARCODE_CONTENT_SEGS`
set in `output_options` set in `output_options`
- see [5.16 Feedback]. - see [5.16 Feedback].
`content_seg_count` integer Number of content (output only) `content_seg_count` integer Number of content (output only)
segments. segments.
@@ -2138,13 +2251,13 @@ Member Name Type Meaning Default Value
Table: API Structure `zint_symbol` {#tbl:api_structure_zint_symbol} Table: API Structure `zint_symbol` {#tbl:api_structure_zint_symbol}
[^11]: The `height` value is ignored for Aztec (including HIBC and Aztec Rune), [^13]: The `height` value is ignored for Aztec (including HIBC and Aztec Rune),
Code One, Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode, Code One, Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode,
QR Code (including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which QR Code (including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which
have a fixed width-to-height ratio (or, in the case of Code One, a fixed have a fixed width-to-height ratio (or, in the case of Code One, a fixed
height). height).
[^12]: For Windows, `outfile` is assumed to be UTF-8 encoded. [^14]: For Windows, `outfile` is assumed to be UTF-8 encoded.
To alter these values use the syntax shown in the example below. This code has To alter these values use the syntax shown in the example below. This code has
the same result as the previous example except the output is now taller and the same result as the previous example except the output is now taller and
@@ -2310,10 +2423,10 @@ Value Effect
------------------------- --------------------------------------------------- ------------------------- ---------------------------------------------------
0 No options selected. 0 No options selected.
`BARCODE_BIND_TOP` Boundary bar above the symbol only.[^13] `BARCODE_BIND_TOP` Boundary bar above the symbol only.[^15]
`BARCODE_BIND` Boundary bars above and below the symbol and `BARCODE_BIND` Boundary bars above and below the symbol and
between rows if stacking multiple symbols.[^14] between rows if stacking multiple symbols.[^16]
`BARCODE_BOX` Add a box surrounding the symbol and whitespace. `BARCODE_BOX` Add a box surrounding the symbol and whitespace.
@@ -2340,7 +2453,7 @@ Value Effect
Symbols in Memory (raster)]. Symbols in Memory (raster)].
`BARCODE_QUIET_ZONES` Add compliant quiet zones (additional to any `BARCODE_QUIET_ZONES` Add compliant quiet zones (additional to any
specified whitespace).[^15] specified whitespace).[^17]
`BARCODE_NO_QUIET_ZONES` Disable quiet zones, notably those with defaults. `BARCODE_NO_QUIET_ZONES` Disable quiet zones, notably those with defaults.
@@ -2362,13 +2475,13 @@ Value Effect
Table: API `output_options` Values {#tbl:api_output_options} Table: API `output_options` Values {#tbl:api_output_options}
[^13]: The `BARCODE_BIND_TOP` flag is set by default for DPD - see [6.1.10.7 DPD [^15]: The `BARCODE_BIND_TOP` flag is set by default for DPD - see [6.1.10.7 DPD
Code]. Code].
[^14]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code [^16]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code
49. Special considerations apply to ITF-14 - see [6.1.2.6 ITF-14]. 49. Special considerations apply to ITF-14 - see [6.1.2.6 ITF-14].
[^15]: Codablock-F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, [^17]: Codablock-F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN,
ITF-14, UPC-A and UPC-E have compliant quiet zones added by default. ITF-14, UPC-A and UPC-E have compliant quiet zones added by default.
## 5.11 Setting the Input Mode ## 5.11 Setting the Input Mode
@@ -2412,6 +2525,9 @@ Value Effect
`GS1SYNTAXENGINE_MODE` Use the GS1 Syntax Engine (if available) to strictly `GS1SYNTAXENGINE_MODE` Use the GS1 Syntax Engine (if available) to strictly
validate GS1 input. validate GS1 input.
`GS1RAW_MODE` Process GS1 data literally (no AI delimiters), parsing
Group Separators (`GS`, ASCII 29) as `FNC1`s.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Table: API `input_mode` Values {#tbl:api_input_mode} Table: API `input_mode` Values {#tbl:api_input_mode}
@@ -2421,8 +2537,8 @@ from the default for the CLI and GUI, which is `UNICODE_MODE`.)
`DATA_MODE`, `UNICODE_MODE` and `GS1_MODE` are mutually exclusive, whereas `DATA_MODE`, `UNICODE_MODE` and `GS1_MODE` are mutually exclusive, whereas
`ESCAPE_MODE`, `GS1PARENS_MODE`, `GS1NOCHECK_MODE`, `HEIGHTPERROW_MODE`, `ESCAPE_MODE`, `GS1PARENS_MODE`, `GS1NOCHECK_MODE`, `HEIGHTPERROW_MODE`,
`FAST_MODE`, `EXTRA_ESCAPE_MODE` and `GS1SYNTAXENGINE_MODE` are optional. So, `FAST_MODE`, `EXTRA_ESCAPE_MODE`, `GS1SYNTAXENGINE_MODE` and `GS1RAW_MODE` are
for example, you can set optional. So, for example, you can set
```c ```c
symbol->input_mode = UNICODE_MODE | ESCAPE_MODE; symbol->input_mode = UNICODE_MODE | ESCAPE_MODE;
@@ -2444,22 +2560,11 @@ is not valid.
Permissible escape sequences (`ESCAPE_MODE`) are listed in Permissible escape sequences (`ESCAPE_MODE`) are listed in
[#tbl:escape_sequences], and the special Code 128-only `EXTRA_ESCAPE_MODE` [#tbl:escape_sequences], and the special Code 128-only `EXTRA_ESCAPE_MODE`
escape sequences are given in [6.1.10.1 Standard Code 128 (ISO 15417)]. An escape sequences are given in [6.1.10.1 Standard Code 128 (ISO 15417)].
example of `GS1PARENS_MODE` usage is given in section [6.1.10.3 GS1-128].
`GS1NOCHECK_MODE` (CLI `--gs1nocheck`) is for use with legacy systems that have The GS1 options `GS1PARENS_MODE` (CLI `--gs1parens`) , `GS1NOCHECK_MODE` (CLI
data that does not conform to the current GS1 standard. Printable ASCII input is `--gs1nocheck`), `GS1SYNTAXENGINE_MODE` (CLI `--gs1strict`) and `GS1RAW_MODE`
still checked for, as is the validity of GS1 data specified without AIs (e.g. (CLI `--gs1raw`) are described in [4.11.3 GS1 Data Entry and Options].
linear data for GS1 DataBar Omnidirectional/Limited/etc.). Also checked is GS1
DataBar Expanded and GS1 Composite input that is not in the GS1 encodable
character set 82 (see GS1 General Specifications Figure 7.11.1 'GS1 AI encodable
character set 82'), otherwise encodation would fail.
In contrast `GS1SYNTAXENGINE_MODE` (CLI `--gs1strict`) enables the use the GS1
Syntax Engine to strictly validate GS1 data, including GS1 Digital Link URIs (by
default ZINT does not validate Digital Links at all). It requires that the
`gs1encoders` library was present when Zint was built, otherwise the default
built-in validation will be used.
For `HEIGHTPERROW_MODE`, see `--heightperrow` in section [4.4 Adjusting Height]. 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 The `height` member should be set to the desired per-row value on input (it will
@@ -2634,7 +2739,7 @@ Value Meaning
`ZINT_CAP_STACKABLE` Is the symbology stackable? Note that stacked `ZINT_CAP_STACKABLE` Is the symbology stackable? Note that stacked
symbologies are not stackable. symbologies are not stackable.
`ZINT_CAP_EANUPC`[^16] Is the symbology EAN/UPC? `ZINT_CAP_EANUPC`[^18] Is the symbology EAN/UPC?
`ZINT_CAP_COMPOSITE` Does the symbology support composite data? (see `ZINT_CAP_COMPOSITE` Does the symbology support composite data? (see
[6.3 GS1 Composite Symbols (ISO 24723)] below) [6.3 GS1 Composite Symbols (ISO 24723)] below)
@@ -2670,7 +2775,7 @@ Value Meaning
Table: API Capability Flags {#tbl:api_cap} Table: API Capability Flags {#tbl:api_cap}
[^16]: `ZINT_CAP_EANUPC` was previously named `ZINT_CAP_EXTENDABLE`, which is [^18]: `ZINT_CAP_EANUPC` was previously named `ZINT_CAP_EXTENDABLE`, which is
still recognised. still recognised.
For example: For example:
@@ -2697,7 +2802,7 @@ On successful encodation (after using `ZBarcode_Encode()` etc.) the `option_1`,
create the barcode. This is useful for feedback if the values were left as create the barcode. This is useful for feedback if the values were left as
defaults or were overridden by Zint. defaults or were overridden by Zint.
In particular for symbologies that have masks,[^17] `option_3` will contain the In particular for symbologies that have masks,[^19] `option_3` will contain the
mask used as `(N + 1) << 8`, N being the mask. Also Aztec Code will return the mask used as `(N + 1) << 8`, N being the mask. Also Aztec Code will return the
actual ECC percentage used in `option_1` as `P << 8`, where P is the integer actual ECC percentage used in `option_1` as `P << 8`, where P is the integer
percentage, the low byte containing the values given in [#tbl:aztec_eccs] (with percentage, the low byte containing the values given in [#tbl:aztec_eccs] (with
@@ -2715,7 +2820,7 @@ least one.
The `source`, `length` and `eci` members of `zint_seg` will be set accordingly - The `source`, `length` and `eci` members of `zint_seg` will be set accordingly -
the unconverted data in `source`, the data length in `length`, and the character the unconverted data in `source`, the data length in `length`, and the character
set the data was converted to in `eci`. Any check characters encoded will be set the data was converted to in `eci`. Any check characters encoded will be
included,[^18] and for GS1 data any `FNC1` separators will be represented as included,[^20] and for GS1 data any `FNC1` separators will be represented as
`GS` (ASCII 29) characters. UPC-A and UPC-E data will be expanded to EAN-13, as `GS` (ASCII 29) characters. UPC-A and UPC-E data will be expanded to EAN-13, as
will EAN-8 but only if it has an add-on (otherwise it will remain at 8 digits), will EAN-8 but only if it has an add-on (otherwise it will remain at 8 digits),
and any add-ons will follow the 13 digits directly (no separator). GS1 Composite and any add-ons will follow the 13 digits directly (no separator). GS1 Composite
@@ -2727,16 +2832,16 @@ is `DATA_MODE`, it remains in binary; otherwise it will be in UTF-8. The UTF-8
source may be converted to the character set of the corresponding `eci` member source may be converted to the character set of the corresponding `eci` member
using the two helper functions discussed next. using the two helper functions discussed next.
[^17]: DotCode, Han Xin, Micro QR Code, QR Code and UPNQR have variable masks. [^19]: DotCode, Han Xin, Micro QR Code, QR Code and UPNQR have variable masks.
Rectangular Micro QR Code has a fixed mask (4). Rectangular Micro QR Code has a fixed mask (4).
[^18]: Except for Japanese Postal Code, whose check character is not truly [^20]: Except for Japanese Postal Code, whose check character is not truly
representable in the encoded data. representable in the encoded data.
## 5.17 UTF-8 to ECI convenience functions ## 5.17 UTF-8 to ECI convenience functions
As a convenience the conversion done by Zint from UTF-8 to ECIs is exposed in As a convenience the conversion done by Zint from UTF-8 to ECIs is exposed in
two helper functions (compatible with the `libzueci`[^19] functions two helper functions (compatible with the `libzueci`[^21] functions
`zueci_utf8_to_eci()` and `zueci_dest_len_eci()`): `zueci_utf8_to_eci()` and `zueci_dest_len_eci()`):
@@ -2756,7 +2861,7 @@ returned in `p_dest_length`, may be smaller than the estimate given by
NUL-terminated. The destination buffer is not NUL-terminated. The obsolete ECIs NUL-terminated. The destination buffer is not NUL-terminated. The obsolete ECIs
0, 1 and 2 are supported. 0, 1 and 2 are supported.
[^19]: The library `libzueci`, which can convert both to and from UTF-8 and ECI, [^21]: The library `libzueci`, which can convert both to and from UTF-8 and ECI,
is available at [https://sourceforge.net/projects/libzueci/]( is available at [https://sourceforge.net/projects/libzueci/](
https://sourceforge.net/projects/libzueci/). https://sourceforge.net/projects/libzueci/).
@@ -2918,7 +3023,7 @@ UPC-A is used in the United States for retail applications, and encodes a
GTIN-12, a 12-digit Global Trade Item Number that includes a standard GS1 check GTIN-12, a 12-digit Global Trade Item Number that includes a standard GS1 check
digit. digit.
![`zint -b UPCA --compliantheight -d "72527270270"`](images/upca.svg){.upcean} ![`zint -b UPCA --compliantheight -d "01234500005"`](images/upca.svg){.upcean}
Input up to 11 digits may be given, to which a check digit will be added by Input up to 11 digits may be given, to which a check digit will be added by
Zint. A 12-digit input including the check digit may also be supplied, in which Zint. A 12-digit input including the check digit may also be supplied, in which
@@ -2928,11 +3033,11 @@ Input less than 11 digits will be zero-filled.
In addition 2-digit and 5-digit add-on symbols can be added, their data In addition 2-digit and 5-digit add-on symbols can be added, their data
separated from the main data by a `'+'` character or a space. For example, to separated from the main data by a `'+'` character or a space. For example, to
draw a UPC-A symbol with the data "72527270270" and 5-digit add-on data "12345" draw a UPC-A symbol with the data "01234500005" and 5-digit add-on data "12345"
use the command: use the command:
```bash ```bash
zint -b UPCA -d "72527270270+12345" zint -b UPCA -d "01234500005+12345"
``` ```
or using the API: or using the API:
@@ -2940,20 +3045,20 @@ or using the API:
```c ```c
symbol->symbology = BARCODE_UPCA; symbol->symbology = BARCODE_UPCA;
/* Using '+' */ /* Using '+' */
error = ZBarcode_Encode_and_Print(symbol, "72527270270+12345", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "01234500005+12345", 0, 0);
/* Or a space */ /* Or a space */
error = ZBarcode_Encode_and_Print(symbol, "72527270270 12345", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "01234500005 12345", 0, 0);
``` ```
![`zint -b UPCA --compliantheight -d ![`zint -b UPCA --compliantheight -d
"72527270270+12345"`](images/upca_5.svg){.upcean} "01234500005+12345"`](images/upca_5.svg){.upcean}
A quiet zone indicator can be added to the HRT by setting `--guardwhitespace` A quiet zone indicator can be added to the HRT by setting `--guardwhitespace`
(API `output_options |= EANUPC_GUARD_WHITESPACE`). For UPC, this is only (API `output_options |= EANUPC_GUARD_WHITESPACE`). For UPC, this is only
relevant when there is an add-on: relevant when there is an add-on:
```bash ```bash
zint -b UPCA -d "72527270270+12345" --guardwhitespace zint -b UPCA -d "01234500005+12345" --guardwhitespace
``` ```
or using the API: or using the API:
@@ -2961,10 +3066,10 @@ or using the API:
```c ```c
symbol->symbology = BARCODE_UPCA; symbol->symbology = BARCODE_UPCA;
symbol->output_options |= EANUPC_GUARD_WHITESPACE; symbol->output_options |= EANUPC_GUARD_WHITESPACE;
error = ZBarcode_Encode_and_Print(symbol, "72527270270+12345", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "01234500005+12345", 0, 0);
``` ```
![`zint -b UPCA --compliantheight -d "72527270270+12345" ![`zint -b UPCA --compliantheight -d "01234500005+12345"
--guardwhitespace`](images/upca_5_gws.svg){.upcean} --guardwhitespace`](images/upca_5_gws.svg){.upcean}
You can adjust the gap between the main symbol and an add-on in integral You can adjust the gap between the main symbol and an add-on in integral
@@ -2981,7 +3086,7 @@ Zint. If 7 digits are given then the first must be '0' or '1' (the latter is
known as number system 1 and is non-standard). Input less than 7 digits will be known as number system 1 and is non-standard). Input less than 7 digits will be
zero-filled. zero-filled.
![`zint -b UPCE --compliantheight -d "123456"`](images/upce.svg){.upcean} ![`zint -b UPCE --compliantheight -d "123455"`](images/upce.svg){.upcean}
An 8-digit input including the check digit may also be supplied, in which case An 8-digit input including the check digit may also be supplied, in which case
Zint will verify the check digit, or the symbology `BARCODE_UPCE_CHK` (38) may Zint will verify the check digit, or the symbology `BARCODE_UPCE_CHK` (38) may
@@ -2993,10 +3098,10 @@ when there is an add-on by setting `--guardwhitespace` (API `output_options |=
EANUPC_GUARD_WHITESPACE`): EANUPC_GUARD_WHITESPACE`):
```bash ```bash
zint -b UPCE -d "123456+12" --guardwhitespace zint -b UPCE -d "123455+12" --guardwhitespace
``` ```
![`zint -b UPCE --compliantheight -d "123456+12" ![`zint -b UPCE --compliantheight -d "123455+12"
--guardwhitespace`](images/upce_2_gws.svg){.upcean} --guardwhitespace`](images/upce_2_gws.svg){.upcean}
You can adjust the gap between the main symbol and an add-on in integral You can adjust the gap between the main symbol and an add-on in integral
@@ -3018,7 +3123,7 @@ EAN-13 encodes a GTIN-13, a 13-digit Global Trade Item Number that includes a
standard GS1 check digit. standard GS1 check digit.
![`zint -b EAN13 --compliantheight -d ![`zint -b EAN13 --compliantheight -d
"451234567890"`](images/ean13.svg){.upcean} "952012345678"`](images/ean13.svg){.upcean}
Input up to 12 digits may be given, to which a check digit will be added by Input up to 12 digits may be given, to which a check digit will be added by
Zint, or a 13-digit input can be supplied in which case Zint will validate the Zint, or a 13-digit input can be supplied in which case Zint will validate the
@@ -3028,7 +3133,7 @@ A 2-digit or 5-digit add-on can be added by using a '+' or space character as
with UPC symbols. For example: with UPC symbols. For example:
```bash ```bash
zint -b EAN13 -d "451234567890+21" zint -b EAN13 -d "952012345678+21"
``` ```
will encode an EAN-13 symbol with a 2-digit add-on. As before these results will encode an EAN-13 symbol with a 2-digit add-on. As before these results
@@ -3036,20 +3141,20 @@ can be achieved using the API:
```c ```c
symbol->symbology = BARCODE_EAN13; symbol->symbology = BARCODE_EAN13;
error = ZBarcode_Encode_and_Print(symbol, "451234567890+21", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "952012345678+21", 0, 0);
``` ```
![`zint -b EAN13 --compliantheight -d ![`zint -b EAN13 --compliantheight -d
"451234567890+21"`](images/ean13_2.svg){.upcean} "952012345678+21"`](images/ean13_2.svg){.upcean}
Options to add quiet zone indicators and to adjust the add-on gap and the guard Options to add quiet zone indicators and to adjust the add-on gap and the guard
bar descent height are the same as for [6.1.3.2 UPC Version E]. For instance: bar descent height are the same as for [6.1.3.2 UPC Version E]. For instance:
```bash ```bash
zint -b EAN13 -d "4512345678906" --guarddescent=2.5 --guardwhitespace zint -b EAN13 -d "9520123456788" --guarddescent=2.5 --guardwhitespace
``` ```
![`zint -b EAN13 --compliantheight -d "4512345678906"` ![`zint -b EAN13 --compliantheight -d "9520123456788"`
--guarddescent=2.5 --guardwhitespace](images/ean13_gd_gws.svg){.upcean} --guarddescent=2.5 --guardwhitespace](images/ean13_gd_gws.svg){.upcean}
#### 6.1.4.2 EAN-8 #### 6.1.4.2 EAN-8
@@ -3057,7 +3162,7 @@ zint -b EAN13 -d "4512345678906" --guarddescent=2.5 --guardwhitespace
EAN-8 is a shortened version of EAN-13, encoding a GTIN-8 (a GTIN-13 with 5 EAN-8 is a shortened version of EAN-13, encoding a GTIN-8 (a GTIN-13 with 5
leading zeroes implied), for use with small packages. leading zeroes implied), for use with small packages.
![`zint -b EAN8 --compliantheight -d "7432365"`](images/ean8.svg){.upcean} ![`zint -b EAN8 --compliantheight -d "9520000"`](images/ean8.svg){.upcean}
Input up to 7 digits may be supplied, to which Zint will add a standard GS1 Input up to 7 digits may be supplied, to which Zint will add a standard GS1
check digit. An 8-digit input including the check digit may also be given, in check digit. An 8-digit input including the check digit may also be given, in
@@ -3068,7 +3173,7 @@ Options to add quiet zone indicators and to adjust the guard bar descent height
are the same as for [6.1.3.2 UPC Version E]. For instance: are the same as for [6.1.3.2 UPC Version E]. For instance:
```bash ```bash
zint -b EAN8 -d "7432365" --guardwhitespace zint -b EAN8 -d "9520000" --guardwhitespace
``` ```
or using the API: or using the API:
@@ -3076,10 +3181,10 @@ or using the API:
```c ```c
symbol->symbology = BARCODE_EAN8; symbol->symbology = BARCODE_EAN8;
symbol->output_options |= EANUPC_GUARD_WHITESPACE; symbol->output_options |= EANUPC_GUARD_WHITESPACE;
error = ZBarcode_Encode_and_Print(symbol, "7432365", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "9520000", 0, 0);
``` ```
![`zint -b EAN8 --compliantheight -d "7432365"` ![`zint -b EAN8 --compliantheight -d "9520000"`
--guardwhitespace](images/ean8_gws.svg){.upcean} --guardwhitespace](images/ean8_gws.svg){.upcean}
2-digit and 5-digit add-ons may also be added, and the gap adjusted, as with 2-digit and 5-digit add-ons may also be added, and the gap adjusted, as with
@@ -3361,7 +3466,7 @@ alphanumerics) are not recommended.
#### 6.1.10.2 Code 128 Suppress Code Set C (Code Sets A and B only) #### 6.1.10.2 Code 128 Suppress Code Set C (Code Sets A and B only)
It is sometimes advantageous to stop Code 128 from using Code Set C which It is sometimes advantageous to stop Code 128 from using Code Set C which
compresses numerical data. The `BARCODE_CODE128AB`[^20] variant (symbology 60) compresses numerical data. The `BARCODE_CODE128AB`[^22] variant (symbology 60)
suppresses Code Set C in favour of Code Sets A and B. suppresses Code Set C in favour of Code Sets A and B.
![`zint -b CODE128AB -d "130170X178"`](images/code128ab.svg){.lin} ![`zint -b CODE128AB -d "130170X178"`](images/code128ab.svg){.lin}
@@ -3369,26 +3474,19 @@ suppresses Code Set C in favour of Code Sets A and B.
Note that the special extra escapes mentioned above are not available for this Note that the special extra escapes mentioned above are not available for this
variant (nor for any other). variant (nor for any other).
[^20]: `BARCODE_CODE128AB` previously used the name `BARCODE_CODE128B`, which is [^22]: `BARCODE_CODE128AB` previously used the name `BARCODE_CODE128B`, which is
still recognised. still recognised.
#### 6.1.10.3 GS1-128 #### 6.1.10.3 GS1-128
A variation of Code 128 previously known as UCC/EAN-128, this symbology is A variation of Code 128 previously known as UCC/EAN-128, this symbology is
defined by the GS1 General Specifications. Application Identifiers (AIs) should defined by the GS1 General Specifications. Data should be in one of the formats
be entered using [square bracket] notation. These will be converted to described in [4.11.3.1 GS1 Data Entry]. Here we will use the square bracket
parentheses (round brackets) for the Human Readable Text. This method allows the format.
inclusion of parentheses in the AI data without escaping.
![`zint -b GS1_128 --compliantheight -d ![`zint -b GS1_128 --compliantheight -d
"[01]98898765432106[3202]012345[15]991231"`](images/gs1_128.svg){.lin} "[01]98898765432106[3202]012345[15]991231"`](images/gs1_128.svg){.lin}
For compatibility with data entry in other systems, the option `--gs1parens`
(API `input_mode |= GS1PARENS_MODE`) may be used to signal that AIs are encased
in parentheses. If there are any opening parentheses in the AI data, they must
be escaped with a backslash (`\(`). Optionally, for clarity, closing parentheses
may also be escaped,
Fixed length data should be entered at the appropriate length for correct Fixed length data should be entered at the appropriate length for correct
encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters. encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters.
Check digits for GTIN data AI (01) are not generated and need to be included in Check digits for GTIN data AI (01) are not generated and need to be included in
@@ -3398,12 +3496,6 @@ the input data. The following is an example of a valid GS1-128 input:
zint -b GS1_128 -d "[01]98898765432106[3202]012345[15]991231" zint -b GS1_128 -d "[01]98898765432106[3202]012345[15]991231"
``` ```
or using the `--gs1parens` option:
```bash
zint -b GS1_128 --gs1parens -d "(01)98898765432106(3202)012345(15)991231"
```
#### 6.1.10.4 EAN-14 #### 6.1.10.4 EAN-14
A shorter version of GS1-128 which encodes GTIN-14 data only, EAN-14 takes a A shorter version of GS1-128 which encodes GTIN-14 data only, EAN-14 takes a
@@ -3533,11 +3625,9 @@ less than 13 digits will be zero-filled.
#### 6.1.11.3 GS1 DataBar Expanded #### 6.1.11.3 GS1 DataBar Expanded
Previously known as RSS Expanded this is a variable length symbology capable of Previously known as RSS Expanded this is a variable length symbology capable of
encoding data from a number of AIs in a single symbol. AIs should be encased in encoding multiple AIs in a single symbol. Data should be in one of the formats
[square brackets] in the input data, which will be displayed as parentheses described in [4.11.3.1 GS1 Data Entry], and will be displayed using parentheses
(round brackets) in the Human Readable Text. This method allows the inclusion of (round brackets) in the Human Readable Text.
parentheses in the AI data without escaping. The AIs may alternatively be
encased in parentheses using the `--gs1parens` switch - see [6.1.10.3 GS1-128].
![`zint -b DBAR_EXP --compliantheight -d ![`zint -b DBAR_EXP --compliantheight -d
"[01]98898765432106[3202]012345[15]991231"`](images/dbar_exp.svg){.lin} "[01]98898765432106[3202]012345[15]991231"`](images/dbar_exp.svg){.lin}
@@ -3976,7 +4066,7 @@ first and last digit are ignored, leaving a 4-digit DX Extract number in any
case, which must be in the range 16 to 2047. The second format `"NNN-NN"` case, which must be in the range 16 to 2047. The second format `"NNN-NN"`
represents the DX Extract as two numbers separated by a dash (`-`), the first represents the DX Extract as two numbers separated by a dash (`-`), the first
number being 1 to 3 digits (range 1 to 127) and the second 1 to 2 digits (range number being 1 to 3 digits (range 1 to 127) and the second 1 to 2 digits (range
0 to 15).[^21] 0 to 15).[^23]
The optional frame number is a number in the range 0 to 63, and may have a half The optional frame number is a number in the range 0 to 63, and may have a half
frame indicator `"A"` appended. Special character sequences (with or without a frame indicator `"A"` appended. Special character sequences (with or without a
@@ -3986,7 +4076,7 @@ number 62, `"K"` or `"00"` means frame number 63, and `"F"` means frame number
A parity bit is automatically added by Zint. A parity bit is automatically added by Zint.
[^21]: The DX number may be looked up in The (Modified) Big Film Database at [^23]: The DX number may be looked up in The (Modified) Big Film Database at
[https://thebigfilmdatabase.merinorus.com]( [https://thebigfilmdatabase.merinorus.com](
https://thebigfilmdatabase.merinorus.com). https://thebigfilmdatabase.merinorus.com).
@@ -5163,7 +5253,7 @@ company references in particular.
May 2004) May 2004)
- AIM ITS/04-023 International Technical Standard - Extended Channel - AIM ITS/04-023 International Technical Standard - Extended Channel
Interpretations Part 3: Register (Version 2, February 2022) Interpretations Part 3: Register (Version 2, February 2022)
- GS1 General Specifications Release 25.0 (Jan 2025) - GS1 General Specifications Release 26.0 (Jan 2026)
- ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling - ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard Standard
+232 -142
View File
@@ -48,6 +48,9 @@ February 2026
- 4.11.2.1 Input Modes and ECI Example 1 - 4.11.2.1 Input Modes and ECI Example 1
- 4.11.2.2 Input Modes and ECI Example 2 - 4.11.2.2 Input Modes and ECI Example 2
- 4.11.2.3 Input Modes and ECI Example 3 - 4.11.2.3 Input Modes and ECI Example 3
- 4.11.3 GS1 Data Entry and Options
- 4.11.3.1 GS1 Data Entry
- 4.11.3.2 GS1 Options
- 4.12 Batch Processing - 4.12 Batch Processing
- 4.13 Direct Output to stdout - 4.13 Direct Output to stdout
- 4.14 Automatic Filenames - 4.14 Automatic Filenames
@@ -487,10 +490,15 @@ right-clicking the preview.
In the middle of the Data tab is an area for creating composite symbologies In the middle of the Data tab is an area for creating composite symbologies
which appears when the currently selected symbology supports the GS1 Composite which appears when the currently selected symbology supports the GS1 Composite
symbology standard. GS1 data can then be entered with square brackets used to symbology standard - namely EAN-13, EAN-8, GS1-128, GS1 DataBar (all variants),
separate Application Identifier (AI) information from data as shown here. Round UPC-A and UPC-E. See 6.3 GS1 Composite Symbols (ISO 24723) for details.
brackets (parentheses) can be used instead if the "GS1 ()" checkbox is set. For
details, see 6.3 GS1 Composite Symbols (ISO 24723). If the "Add 2D Component" checkbox is checked, GS1 data can then be entered in
the "2D Component Data" text box, with square brackets used to separate
Application Identifier (AI) information from data as shown here, or using one of
the other formats described in 4.11.3 GS1 Data Entry and Options, where the GS1
checkbox options "()" (Parentheses), "Raw", "No Check" and "Strict" are also
discussed.
3.3 Additional ECI/Data Segments Groupbox 3.3 Additional ECI/Data Segments Groupbox
@@ -1258,11 +1266,11 @@ appropriate, and may be mixed with U.S. units:
4.9.2 Scaling Example 4.9.2 Scaling Example
The GS1 General Specifications Section 5.2.6.6 Symbol dimensions at nominal The GS1 General Specifications 26.0 Section 5.2.6.6 Symbol dimensions at
size gives an example of an EAN-13 barcode using the X-dimension of 0.33mm. To nominal size gives an example of an EAN-13 barcode using the X-dimension of
print that example as a PNG at 12 dpmm, the approximate equivalent of 300 dpi 0.33mm. To print that example as a PNG at 12 dpmm, the approximate equivalent of
(dpi = dpmm * 25.4), specify a scale of 2, since 0.33 * 12 = 3.96 pixels, or 4 300 dpi (dpi = dpmm * 25.4), specify a scale of 2, since 0.33 * 12 = 3.96
pixels rounding to the nearest pixel: pixels, or 4 pixels rounding to the nearest pixel:
zint -b EAN13 -d "501234567890" --compliantheight --scale=2 zint -b EAN13 -d "501234567890" --compliantheight --scale=2
@@ -1359,15 +1367,8 @@ character encoding then it will take advantage of the ECI (Extended Channel
Interpretations) mechanism to encode the data if the symbology supports it - see Interpretations) mechanism to encode the data if the symbology supports it - see
4.11.2 Input Modes and ECI below. 4.11.2 Input Modes and ECI below.
GS1 data can be encoded in a number of symbologies. Application Identifiers GS1 data can be encoded in a number of symbologies - see 4.11.3 GS1 Data Entry
(AIs) should be enclosed in [square brackets] followed by the data to be encoded and Options.
(see 6.1.10.3 GS1-128). For matrix symbologies, GS1 Digital Link URIs can also
be given. To encode GS1 data use the --gs1 option. Alternatively, use the
--gs1strict option, which strictly verifies the GS1 data.
GS1 mode is assumed (and doesnt need to be set) for GS1-128, EAN-14, GS1
DataBar and GS1 Composite symbologies but is also available for Aztec Code, Code
16K, Code 49, Code One, Data Matrix, DotCode, QR Code and Ultracode.
Health Industry Barcode (HIBC) data may also be encoded in the symbologies Aztec 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, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR
@@ -1525,6 +1526,98 @@ by default and do not support ECI. In this case supply UTF-8 data and use the
[zint -b QRCODE --binary -d "\xE2\x82\xAC\xE5\xB8\xB8" --esc] [zint -b QRCODE --binary -d "\xE2\x82\xAC\xE5\xB8\xB8" --esc]
4.11.3 GS1 Data Entry and Options
The following symbologies accept GS1 data:
Symbology Implicit AI? Assumed? Supports Composite?
-------------------------------- -------------- ---------- -------------------
--
Aztec Code No No No
Code 16K No No No
Code 49 No No No
Code One No No No
Data Matrix No No No
DotCode No No No
EAN-13, EAN-8 Yes (01) Yes Yes
EAN-14 Yes (01) Yes No
GS1-128 No Yes Yes
GS1 DataBar Expanded (Stacked) No Yes Yes
GS1 DataBar (all others) Yes (01) Yes Yes
NVE-18 Yes (00) Yes No
QR Code No No No
rMQR No No No
Ultracode No No No
UPC-A, UPC-E Yes (01) Yes Yes
Table 9: GS1-Enabled Symbologies
4.11.3.1 GS1 Data Entry
Those that encode an implicit AI take numeric data in their linear part without
any further markup - see respective descriptions in 6. Types of Symbology.
GS1-128, GS1 DataBar Expanded (including Expanded Stacked), the matrix
symbologies and the 2D component of GS1 Composite symbologies, all of which can
encode multiple AIs, require markup in the data to distinguish AIs.
The traditional way in Zint of specifying GS1 data for these cases is to delimit
the GS1 AIs in square brackets:
zint -b AZTEC -d "[01]09520123456788[10]BATCH4[21]07" --gs1
(Note that for the matrix symbologies the --gs1 option must be given.)
Parentheses (round brackets) may be used instead by giving the --gs1parens
option:
zint -b AZTEC -d "(01)09520123456788(10)BATCH4(21)07" --gs1parens
If the data includes opening parentheses when using the latter format, they must
be escaped and the --esc option given:
zint -b AZTEC -d "(01)09520123456788(90)Var\(34)" --esc --gs1parens
Closing parentheses may also be escaped for clarity.
For matrix symbologies, a GS1 Digital Link URI may be used:
zint -b AZTEC -d "https://example.com/01/09520123456788/10/BATCH4/21/07" --g
s1
A further way to specify GS1 input is “Unbracketed AI”, a GS1 Syntax Engine
format[10] that uses carets (^) to indicate any required FNC1s.[11] The data
must start with a caret:
zint -b AZTEC -d "^010952012345678810BATCH4^2107" --gs1
The final way to specify input is the related “raw” mode using the --gs1raw
option. Here FNC1s are indicated by Group Separators (GS, ASCII 29, escape
sequence \G). It does not start with a GS:
zint -b AZTEC -d "010952012345678810BATCH4\G2107" --esc --gs1raw
4.11.3.2 GS1 Options
Apart from --gs1, --gs1parens and --gs1raw discussed above, there are two other
GS1 options.
- --gs1strict, which enables the use the GS1 Syntax Engine to strictly validate
GS1 data, including GS1 Digital Link URIs (by default Zint does not validate
Digital Links at all). It requires that the gs1encoders library was present
when Zint was built, otherwise the default built-in validation will be used.
- --gs1nocheck, for use with legacy systems that have data that does not conform
to the current GS1 standard. Printable ASCII input is still checked for, as is
the validity of GS1 data specified without AIs (e.g. linear data for GS1
DataBar Omnidirectional/Limited/etc.). Also checked is GS1 DataBar Expanded
and GS1 Composite input that is not in the GS1 encodable character set 82 (see
GS1 General Specifications 26.0 Table 7-2 “GS1 AI encodable character set
82”), otherwise encodation would fail. In “Unbracketed AI” and raw mode,
overlong AI data will also fail.
All the GS1 options imply --gs1.
4.12 Batch Processing 4.12 Batch Processing
Data can be batch processed by reading from a text file and producing a separate Data can be batch processed by reading from a text file and producing a separate
@@ -1553,7 +1646,7 @@ characters in the output filename as shown in the table below:
@ Insert a number or * (or + on Windows) @ Insert a number or * (or + on Windows)
Any other Insert literally Any other Insert literally
Table 9: Batch Filename Formatting Table 10: Batch Filename Formatting
For instance For instance
@@ -1569,7 +1662,7 @@ The following table shows some examples to clarify this method:
-o "my~~bar~.eps" "my00bar1.eps", "my00bar2.eps", "my00bar3.eps" -o "my~~bar~.eps" "my00bar1.eps", "my00bar2.eps", "my00bar3.eps"
-o "t###est.png" "t 1est.png", "t 2est.png", "t 3est.png" -o "t###est.png" "t 1est.png", "t 2est.png", "t 3est.png"
Table 10: Batch Filename Examples Table 11: Batch Filename Examples
The special characters can span directories also, which is useful when creating The special characters can span directories also, which is useful when creating
a large number of barcodes: a large number of barcodes:
@@ -1579,7 +1672,7 @@ a large number of barcodes:
-o "dir~/file~~~.svg" "dir0/file001.svg", "dir0/file002.svg", … -o "dir~/file~~~.svg" "dir0/file001.svg", "dir0/file002.svg", …
"dir0/file999.svg", "dir1/file000.svg", … "dir0/file999.svg", "dir1/file000.svg", …
Table 11: Batch Directory Examples Table 12: Batch Directory Examples
For an alternative method of naming output files see the --mirror option in 4.14 For an alternative method of naming output files see the --mirror option in 4.14
Automatic Filenames below. Automatic Filenames below.
@@ -1954,7 +2047,7 @@ the buffer is given in memfile_size. For instance:
} }
will print the SVG output to stdout (the file "mem.svg" is not created). This is will print the SVG output to stdout (the file "mem.svg" is not created). This is
particularly useful for the textual formats EPS and SVG,[10] allowing the output particularly useful for the textual formats EPS and SVG,[12] allowing the output
to be manipulated and processed by the client. to be manipulated and processed by the client.
5.7 Setting Options 5.7 Setting Options
@@ -1975,7 +2068,7 @@ the following members:
height float Symbol height in Symbol dependent height float Symbol height in Symbol dependent
X-dimensions, excluding X-dimensions, excluding
fixed width-to-height fixed width-to-height
symbols.[11] symbols.[13]
scale float Scale factor for adjusting 1.0 scale float Scale factor for adjusting 1.0
size of image (sets size of image (sets
@@ -2022,7 +2115,7 @@ the following members:
end in .png, .gif, .bmp, end in .png, .gif, .bmp,
.emf, .eps, .pcx, .svg, .emf, .eps, .pcx, .svg,
.tif or .txt followed by a .tif or .txt followed by a
terminating NUL.[12] terminating NUL.[14]
primary character Primary message data for "" (empty) primary character Primary message data for "" (empty)
string more complex symbols, with string more complex symbols, with
@@ -2144,7 +2237,7 @@ the following members:
floats floats
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Table 12: API Structure zint_symbol Table 13: API Structure zint_symbol
To alter these values use the syntax shown in the example below. This code has To alter these values use the syntax shown in the example below. This code has
the same result as the previous example except the output is now taller and the same result as the previous example except the output is now taller and
@@ -2243,7 +2336,7 @@ the nature of the error. The errors generated by Zint are:
ZINT_WARN_HRT_TRUNCATED occurs. ZINT_WARN_HRT_TRUNCATED occurs.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Table 13: API Warning and Error Return Values Table 14: API Warning and Error Return Values
To catch errors use an integer variable as shown in the code below: To catch errors use an integer variable as shown in the code below:
@@ -2298,10 +2391,10 @@ together when adjusting this value:
-------------------------- --------------------------------------------------- -------------------------- ---------------------------------------------------
0 No options selected. 0 No options selected.
BARCODE_BIND_TOP Boundary bar above the symbol only.[13] BARCODE_BIND_TOP Boundary bar above the symbol only.[15]
BARCODE_BIND Boundary bars above and below the symbol and BARCODE_BIND Boundary bars above and below the symbol and
between rows if stacking multiple symbols.[14] between rows if stacking multiple symbols.[16]
BARCODE_BOX Add a box surrounding the symbol and whitespace. BARCODE_BOX Add a box surrounding the symbol and whitespace.
@@ -2328,7 +2421,7 @@ together when adjusting this value:
Symbols in Memory (raster). Symbols in Memory (raster).
BARCODE_QUIET_ZONES Add compliant quiet zones (additional to any BARCODE_QUIET_ZONES Add compliant quiet zones (additional to any
specified whitespace).[15] specified whitespace).[17]
BARCODE_NO_QUIET_ZONES Disable quiet zones, notably those with defaults. BARCODE_NO_QUIET_ZONES Disable quiet zones, notably those with defaults.
@@ -2348,7 +2441,7 @@ together when adjusting this value:
symbol->contentsegs (see 5.16 Feedback). symbol->contentsegs (see 5.16 Feedback).
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Table 14: API output_options Values Table 15: API output_options Values
5.11 Setting the Input Mode 5.11 Setting the Input Mode
@@ -2390,17 +2483,20 @@ member:
GS1SYNTAXENGINE_MODE Use the GS1 Syntax Engine (if available) to strictly GS1SYNTAXENGINE_MODE Use the GS1 Syntax Engine (if available) to strictly
validate GS1 input. validate GS1 input.
GS1RAW_MODE Process GS1 data literally (no AI delimiters), parsing
Group Separators (GS, ASCII 29) as FNC1s.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Table 15: API input_mode Values Table 16: API input_mode Values
The default mode is DATA_MODE (CLI option --binary). (Note that this differs The default mode is DATA_MODE (CLI option --binary). (Note that this differs
from the default for the CLI and GUI, which is UNICODE_MODE.) from the default for the CLI and GUI, which is UNICODE_MODE.)
DATA_MODE, UNICODE_MODE and GS1_MODE are mutually exclusive, whereas DATA_MODE, UNICODE_MODE and GS1_MODE are mutually exclusive, whereas
ESCAPE_MODE, GS1PARENS_MODE, GS1NOCHECK_MODE, HEIGHTPERROW_MODE, FAST_MODE, ESCAPE_MODE, GS1PARENS_MODE, GS1NOCHECK_MODE, HEIGHTPERROW_MODE, FAST_MODE,
EXTRA_ESCAPE_MODE and GS1SYNTAXENGINE_MODE are optional. So, for example, you EXTRA_ESCAPE_MODE, GS1SYNTAXENGINE_MODE and GS1RAW_MODE are optional. So, for
can set example, you can set
symbol->input_mode = UNICODE_MODE | ESCAPE_MODE; symbol->input_mode = UNICODE_MODE | ESCAPE_MODE;
@@ -2416,22 +2512,11 @@ is not valid.
Permissible escape sequences (ESCAPE_MODE) are listed in Table 2: Escape Permissible escape sequences (ESCAPE_MODE) are listed in Table 2: Escape
Sequences, and the special Code 128-only EXTRA_ESCAPE_MODE escape sequences are Sequences, and the special Code 128-only EXTRA_ESCAPE_MODE escape sequences are
given in 6.1.10.1 Standard Code 128 (ISO 15417). An example of GS1PARENS_MODE given in 6.1.10.1 Standard Code 128 (ISO 15417).
usage is given in section 6.1.10.3 GS1-128.
GS1NOCHECK_MODE (CLI --gs1nocheck) is for use with legacy systems that have data The GS1 options GS1PARENS_MODE (CLI --gs1parens) , GS1NOCHECK_MODE (CLI
that does not conform to the current GS1 standard. Printable ASCII input is --gs1nocheck), GS1SYNTAXENGINE_MODE (CLI --gs1strict) and GS1RAW_MODE (CLI
still checked for, as is the validity of GS1 data specified without AIs (e.g. --gs1raw) are described in 4.11.3 GS1 Data Entry and Options.
linear data for GS1 DataBar Omnidirectional/Limited/etc.). Also checked is GS1
DataBar Expanded and GS1 Composite input that is not in the GS1 encodable
character set 82 (see GS1 General Specifications Figure 7.11.1 GS1 AI encodable
character set 82), otherwise encodation would fail.
In contrast GS1SYNTAXENGINE_MODE (CLI --gs1strict) enables the use the GS1
Syntax Engine to strictly validate GS1 data, including GS1 Digital Link URIs (by
default ZINT does not validate Digital Links at all). It requires that the
gs1encoders library was present when Zint was built, otherwise the default
built-in validation will be used.
For HEIGHTPERROW_MODE, see --heightperrow in section 4.4 Adjusting Height. The 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 height member should be set to the desired per-row value on input (it will be
@@ -2586,7 +2671,7 @@ see which are set.
ZINT_CAP_STACKABLE Is the symbology stackable? Note that stacked ZINT_CAP_STACKABLE Is the symbology stackable? Note that stacked
symbologies are not stackable. symbologies are not stackable.
ZINT_CAP_EANUPC[16] Is the symbology EAN/UPC? ZINT_CAP_EANUPC[18] Is the symbology EAN/UPC?
ZINT_CAP_COMPOSITE Does the symbology support composite data? (see ZINT_CAP_COMPOSITE Does the symbology support composite data? (see
6.3 GS1 Composite Symbols (ISO 24723) below) 6.3 GS1 Composite Symbols (ISO 24723) below)
@@ -2620,7 +2705,7 @@ see which are set.
linear symbologies. linear symbologies.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Table 16: API Capability Flags Table 17: API Capability Flags
For example: For example:
@@ -2644,10 +2729,10 @@ option_2 and option_3 members will be set to the values used by Zint to create
the barcode. This is useful for feedback if the values were left as defaults or the barcode. This is useful for feedback if the values were left as defaults or
were overridden by Zint. were overridden by Zint.
In particular for symbologies that have masks,[17] option_3 will contain the In particular for symbologies that have masks,[19] option_3 will contain the
mask used as (N + 1) << 8, N being the mask. Also Aztec Code will return the mask used as (N + 1) << 8, N being the mask. Also Aztec Code will return the
actual ECC percentage used in option_1 as P << 8, where P is the integer actual ECC percentage used in option_1 as P << 8, where P is the integer
percentage, the low byte containing the values given in Table 39: Aztec Code percentage, the low byte containing the values given in Table 40: Aztec Code
Error Correction Modes (with the addition of 0 meaning less than 5% + 3 Error Correction Modes (with the addition of 0 meaning less than 5% + 3
codewords and -1 meaning minimum 3 codewords). Micro PDF417 also will return the codewords and -1 meaning minimum 3 codewords). Micro PDF417 also will return the
ECC percentage in option_1 as P << 8. ECC percentage in option_1 as P << 8.
@@ -2660,7 +2745,7 @@ being set in content_seg_count - which will always be at least one.
The source, length and eci members of zint_seg will be set accordingly - the The source, length and eci members of zint_seg will be set accordingly - the
unconverted data in source, the data length in length, and the character set the unconverted data in source, the data length in length, and the character set the
data was converted to in eci. Any check characters encoded will be included,[18] data was converted to in eci. Any check characters encoded will be included,[20]
and for GS1 data any FNC1 separators will be represented as GS (ASCII 29) and for GS1 data any FNC1 separators will be represented as GS (ASCII 29)
characters. UPC-A and UPC-E data will be expanded to EAN-13, as will EAN-8 but characters. UPC-A and UPC-E data will be expanded to EAN-13, as will EAN-8 but
only if it has an add-on (otherwise it will remain at 8 digits), and any add-ons only if it has an add-on (otherwise it will remain at 8 digits), and any add-ons
@@ -2676,7 +2761,7 @@ two helper functions discussed next.
5.17 UTF-8 to ECI convenience functions 5.17 UTF-8 to ECI convenience functions
As a convenience the conversion done by Zint from UTF-8 to ECIs is exposed in As a convenience the conversion done by Zint from UTF-8 to ECIs is exposed in
two helper functions (compatible with the libzueci[19] functions two helper functions (compatible with the libzueci[21] functions
zueci_utf8_to_eci() and zueci_dest_len_eci()): zueci_utf8_to_eci() and zueci_dest_len_eci()):
int ZBarcode_UTF8_To_ECI(int eci, const unsigned char *source, int length, int ZBarcode_UTF8_To_ECI(int eci, const unsigned char *source, int length,
@@ -2839,7 +2924,7 @@ UPC-A is used in the United States for retail applications, and encodes a
GTIN-12, a 12-digit Global Trade Item Number that includes a standard GS1 check GTIN-12, a 12-digit Global Trade Item Number that includes a standard GS1 check
digit. digit.
[zint -b UPCA --compliantheight -d "72527270270"] [zint -b UPCA --compliantheight -d "01234500005"]
Input up to 11 digits may be given, to which a check digit will be added by Input up to 11 digits may be given, to which a check digit will be added by
Zint. A 12-digit input including the check digit may also be supplied, in which Zint. A 12-digit input including the check digit may also be supplied, in which
@@ -2849,34 +2934,34 @@ digits will be zero-filled.
In addition 2-digit and 5-digit add-on symbols can be added, their data In addition 2-digit and 5-digit add-on symbols can be added, their data
separated from the main data by a '+' character or a space. For example, to draw separated from the main data by a '+' character or a space. For example, to draw
a UPC-A symbol with the data “72527270270” and 5-digit add-on data “12345” use a UPC-A symbol with the data “01234500005” and 5-digit add-on data “12345” use
the command: the command:
zint -b UPCA -d "72527270270+12345" zint -b UPCA -d "01234500005+12345"
or using the API: or using the API:
symbol->symbology = BARCODE_UPCA; symbol->symbology = BARCODE_UPCA;
/* Using '+' */ /* Using '+' */
error = ZBarcode_Encode_and_Print(symbol, "72527270270+12345", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "01234500005+12345", 0, 0);
/* Or a space */ /* Or a space */
error = ZBarcode_Encode_and_Print(symbol, "72527270270 12345", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "01234500005 12345", 0, 0);
[zint -b UPCA --compliantheight -d "72527270270+12345"] [zint -b UPCA --compliantheight -d "01234500005+12345"]
A quiet zone indicator can be added to the HRT by setting --guardwhitespace (API A quiet zone indicator can be added to the HRT by setting --guardwhitespace (API
output_options |= EANUPC_GUARD_WHITESPACE). For UPC, this is only relevant when output_options |= EANUPC_GUARD_WHITESPACE). For UPC, this is only relevant when
there is an add-on: there is an add-on:
zint -b UPCA -d "72527270270+12345" --guardwhitespace zint -b UPCA -d "01234500005+12345" --guardwhitespace
or using the API: or using the API:
symbol->symbology = BARCODE_UPCA; symbol->symbology = BARCODE_UPCA;
symbol->output_options |= EANUPC_GUARD_WHITESPACE; symbol->output_options |= EANUPC_GUARD_WHITESPACE;
error = ZBarcode_Encode_and_Print(symbol, "72527270270+12345", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "01234500005+12345", 0, 0);
[zint -b UPCA --compliantheight -d "72527270270+12345" --guardwhitespace] [zint -b UPCA --compliantheight -d "01234500005+12345" --guardwhitespace]
You can adjust the gap between the main symbol and an add-on in integral You can adjust the gap between the main symbol and an add-on in integral
multiples of the X-dimension by setting --addongap (API option_2) to a value multiples of the X-dimension by setting --addongap (API option_2) to a value
@@ -2892,7 +2977,7 @@ Zint. If 7 digits are given then the first must be 0 or 1 (the latte
known as number system 1 and is non-standard). Input less than 7 digits will be known as number system 1 and is non-standard). Input less than 7 digits will be
zero-filled. zero-filled.
[zint -b UPCE --compliantheight -d "123456"] [zint -b UPCE --compliantheight -d "123455"]
An 8-digit input including the check digit may also be supplied, in which case An 8-digit input including the check digit may also be supplied, in which case
Zint will verify the check digit, or the symbology BARCODE_UPCE_CHK (38) may be Zint will verify the check digit, or the symbology BARCODE_UPCE_CHK (38) may be
@@ -2903,9 +2988,9 @@ character or a space as a separator, and a quiet zone indicator can be added
when there is an add-on by setting --guardwhitespace (API when there is an add-on by setting --guardwhitespace (API
output_options |= EANUPC_GUARD_WHITESPACE): output_options |= EANUPC_GUARD_WHITESPACE):
zint -b UPCE -d "123456+12" --guardwhitespace zint -b UPCE -d "123455+12" --guardwhitespace
[zint -b UPCE --compliantheight -d "123456+12" --guardwhitespace] [zint -b UPCE --compliantheight -d "123455+12" --guardwhitespace]
You can adjust the gap between the main symbol and an add-on in integral You can adjust the gap between the main symbol and an add-on in integral
multiples of the X-dimension by setting --addongap (API option_2) to a value multiples of the X-dimension by setting --addongap (API option_2) to a value
@@ -2925,7 +3010,7 @@ EAN-8 and ISBN (a subset of EAN-13).
EAN-13 encodes a GTIN-13, a 13-digit Global Trade Item Number that includes a EAN-13 encodes a GTIN-13, a 13-digit Global Trade Item Number that includes a
standard GS1 check digit. standard GS1 check digit.
[zint -b EAN13 --compliantheight -d "451234567890"] [zint -b EAN13 --compliantheight -d "952012345678"]
Input up to 12 digits may be given, to which a check digit will be added by Input up to 12 digits may be given, to which a check digit will be added by
Zint, or a 13-digit input can be supplied in which case Zint will validate the Zint, or a 13-digit input can be supplied in which case Zint will validate the
@@ -2934,22 +3019,22 @@ check digit. Input less than 12 digits will be zero-filled.
A 2-digit or 5-digit add-on can be added by using a + or space character as A 2-digit or 5-digit add-on can be added by using a + or space character as
with UPC symbols. For example: with UPC symbols. For example:
zint -b EAN13 -d "451234567890+21" zint -b EAN13 -d "952012345678+21"
will encode an EAN-13 symbol with a 2-digit add-on. As before these results can will encode an EAN-13 symbol with a 2-digit add-on. As before these results can
be achieved using the API: be achieved using the API:
symbol->symbology = BARCODE_EAN13; symbol->symbology = BARCODE_EAN13;
error = ZBarcode_Encode_and_Print(symbol, "451234567890+21", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "952012345678+21", 0, 0);
[zint -b EAN13 --compliantheight -d "451234567890+21"] [zint -b EAN13 --compliantheight -d "952012345678+21"]
Options to add quiet zone indicators and to adjust the add-on gap and the guard Options to add quiet zone indicators and to adjust the add-on gap and the guard
bar descent height are the same as for 6.1.3.2 UPC Version E. For instance: bar descent height are the same as for 6.1.3.2 UPC Version E. For instance:
zint -b EAN13 -d "4512345678906" --guarddescent=2.5 --guardwhitespace zint -b EAN13 -d "9520123456788" --guarddescent=2.5 --guardwhitespace
[zint -b EAN13 --compliantheight -d "4512345678906" guarddescent=2.5 [zint -b EAN13 --compliantheight -d "9520123456788" guarddescent=2.5
guardwhitespace] guardwhitespace]
6.1.4.2 EAN-8 6.1.4.2 EAN-8
@@ -2957,7 +3042,7 @@ bar descent height are the same as for 6.1.3.2 UPC Version E. For instance:
EAN-8 is a shortened version of EAN-13, encoding a GTIN-8 (a GTIN-13 with 5 EAN-8 is a shortened version of EAN-13, encoding a GTIN-8 (a GTIN-13 with 5
leading zeroes implied), for use with small packages. leading zeroes implied), for use with small packages.
[zint -b EAN8 --compliantheight -d "7432365"] [zint -b EAN8 --compliantheight -d "9520000"]
Input up to 7 digits may be supplied, to which Zint will add a standard GS1 Input up to 7 digits may be supplied, to which Zint will add a standard GS1
check digit. An 8-digit input including the check digit may also be given, in check digit. An 8-digit input including the check digit may also be given, in
@@ -2967,15 +3052,15 @@ zero-filled.
Options to add quiet zone indicators and to adjust the guard bar descent height Options to add quiet zone indicators and to adjust the guard bar descent height
are the same as for 6.1.3.2 UPC Version E. For instance: are the same as for 6.1.3.2 UPC Version E. For instance:
zint -b EAN8 -d "7432365" --guardwhitespace zint -b EAN8 -d "9520000" --guardwhitespace
or using the API: or using the API:
symbol->symbology = BARCODE_EAN8; symbol->symbology = BARCODE_EAN8;
symbol->output_options |= EANUPC_GUARD_WHITESPACE; symbol->output_options |= EANUPC_GUARD_WHITESPACE;
error = ZBarcode_Encode_and_Print(symbol, "7432365", 0, 0); error = ZBarcode_Encode_and_Print(symbol, "9520000", 0, 0);
[zint -b EAN8 --compliantheight -d "7432365" guardwhitespace] [zint -b EAN8 --compliantheight -d "9520000" guardwhitespace]
2-digit and 5-digit add-ons may also be added, and the gap adjusted, as with 2-digit and 5-digit add-ons may also be added, and the gap adjusted, as with
EAN-13, but this usage is non-standard and Zint will issue a warning on use. EAN-13, but this usage is non-standard and Zint will issue a warning on use.
@@ -3052,7 +3137,7 @@ MSI Plessey has a range of check digit options that are selectable by setting
5 Modulo-11 (NCR) 5 Modulo-11 (NCR)
6 Modulo-11 (NCR) & Modulo-10 6 Modulo-11 (NCR) & Modulo-10
Table 17: MSI Plessey Check Digit Options Table 18: MSI Plessey Check Digit Options
To not show the check digit or digits in the Human Readable Text, add 10 to the To not show the check digit or digits in the Human Readable Text, add 10 to the
--vers value. For example --vers=12 (API option_2 = 12) will add two hidden --vers value. For example --vers=12 (API option_2 = 12) will add two hidden
@@ -3235,7 +3320,7 @@ alphanumerics) are not recommended.
6.1.10.2 Code 128 Suppress Code Set C (Code Sets A and B only) 6.1.10.2 Code 128 Suppress Code Set C (Code Sets A and B only)
It is sometimes advantageous to stop Code 128 from using Code Set C which It is sometimes advantageous to stop Code 128 from using Code Set C which
compresses numerical data. The BARCODE_CODE128AB[20] variant (symbology 60) compresses numerical data. The BARCODE_CODE128AB[22] variant (symbology 60)
suppresses Code Set C in favour of Code Sets A and B. suppresses Code Set C in favour of Code Sets A and B.
[zint -b CODE128AB -d "130170X178"] [zint -b CODE128AB -d "130170X178"]
@@ -3246,20 +3331,13 @@ variant (nor for any other).
6.1.10.3 GS1-128 6.1.10.3 GS1-128
A variation of Code 128 previously known as UCC/EAN-128, this symbology is A variation of Code 128 previously known as UCC/EAN-128, this symbology is
defined by the GS1 General Specifications. Application Identifiers (AIs) should defined by the GS1 General Specifications. Data should be in one of the formats
be entered using [square bracket] notation. These will be converted to described in 4.11.3.1 GS1 Data Entry. Here we will use the square bracket
parentheses (round brackets) for the Human Readable Text. This method allows the format.
inclusion of parentheses in the AI data without escaping.
[zint -b GS1_128 --compliantheight -d "[01]98898765432106[3202]012345[15]991231" [zint -b GS1_128 --compliantheight -d "[01]98898765432106[3202]012345[15]991231"
] ]
For compatibility with data entry in other systems, the option --gs1parens (API
input_mode |= GS1PARENS_MODE) may be used to signal that AIs are encased in
parentheses. If there are any opening parentheses in the AI data, they must be
escaped with a backslash (\(). Optionally, for clarity, closing parentheses may
also be escaped,
Fixed length data should be entered at the appropriate length for correct Fixed length data should be entered at the appropriate length for correct
encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters. encoding. GS1-128 does not support extended ASCII (ISO/IEC 8859-1) characters.
Check digits for GTIN data AI (01) are not generated and need to be included in Check digits for GTIN data AI (01) are not generated and need to be included in
@@ -3267,10 +3345,6 @@ the input data. The following is an example of a valid GS1-128 input:
zint -b GS1_128 -d "[01]98898765432106[3202]012345[15]991231" zint -b GS1_128 -d "[01]98898765432106[3202]012345[15]991231"
or using the --gs1parens option:
zint -b GS1_128 --gs1parens -d "(01)98898765432106(3202)012345(15)991231"
6.1.10.4 EAN-14 6.1.10.4 EAN-14
A shorter version of GS1-128 which encodes GTIN-14 data only, EAN-14 takes a A shorter version of GS1-128 which encodes GTIN-14 data only, EAN-14 takes a
@@ -3321,7 +3395,7 @@ alphanumeric, and is of the form:
----------------------------------------------------------------------- -----------------------------------------------------------------------
Table 18: DPD Input Fields Table 19: DPD Input Fields
A warning will be generated if the Service Code, the Destination Country Code, A warning will be generated if the Service Code, the Destination Country Code,
or the last 10 characters of the Tracking Number are non-numeric. or the last 10 characters of the Tracking Number are non-numeric.
@@ -3395,11 +3469,9 @@ less than 13 digits will be zero-filled.
6.1.11.3 GS1 DataBar Expanded 6.1.11.3 GS1 DataBar Expanded
Previously known as RSS Expanded this is a variable length symbology capable of Previously known as RSS Expanded this is a variable length symbology capable of
encoding data from a number of AIs in a single symbol. AIs should be encased in encoding multiple AIs in a single symbol. Data should be in one of the formats
[square brackets] in the input data, which will be displayed as parentheses described in 4.11.3.1 GS1 Data Entry, and will be displayed using parentheses
(round brackets) in the Human Readable Text. This method allows the inclusion of (round brackets) in the Human Readable Text.
parentheses in the AI data without escaping. The AIs may alternatively be
encased in parentheses using the --gs1parens switch - see 6.1.10.3 GS1-128.
[zint -b DBAR_EXP --compliantheight -d "[01]98898765432106[3202]012345[15]991231 [zint -b DBAR_EXP --compliantheight -d "[01]98898765432106[3202]012345[15]991231
"] "]
@@ -3441,7 +3513,7 @@ the table below:
7 000000 576688 7 000000 576688
8 0000000 7742862 8 0000000 7742862
Table 19: Channel Value Ranges Table 20: Channel Value Ranges
6.1.14 BC412 (SEMI T1-95) 6.1.14 BC412 (SEMI T1-95)
@@ -3687,7 +3759,7 @@ encoding methods. Valid values are shown below.
component component
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Table 20: GS1 Composite Symbology Values Table 21: GS1 Composite Symbology Values
The data to be encoded in the linear component of a composite symbol should be The data to be encoded in the linear component of a composite symbol should be
entered into a primary string with the data for the 2D component being entered entered into a primary string with the data for the 2D component being entered
@@ -3809,7 +3881,7 @@ first and last digit are ignored, leaving a 4-digit DX Extract number in any
case, which must be in the range 16 to 2047. The second format "NNN-NN" case, which must be in the range 16 to 2047. The second format "NNN-NN"
represents the DX Extract as two numbers separated by a dash (-), the first represents the DX Extract as two numbers separated by a dash (-), the first
number being 1 to 3 digits (range 1 to 127) and the second 1 to 2 digits (range number being 1 to 3 digits (range 1 to 127) and the second 1 to 2 digits (range
0 to 15).[21] 0 to 15).[23]
The optional frame number is a number in the range 0 to 63, and may have a half The optional frame number is a number in the range 0 to 63, and may have a half
frame indicator "A" appended. Special character sequences (with or without a frame indicator "A" appended. Special character sequences (with or without a
@@ -3852,7 +3924,7 @@ following table.
23 99999999999999999999999 67-bar 62 N 23 99999999999999999999999 67-bar 62 N
--------------------------------------------------------------- ---------------------------------------------------------------
Table 21: Australia Post Input Formats Table 22: Australia Post Input Formats
6.5.1.2 Reply Paid Barcode 6.5.1.2 Reply Paid Barcode
@@ -3913,7 +3985,7 @@ rules for the input data are complex, as summarized in the following table.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Table 22: Royal Mail 4-State Mailmark Input Fields Table 23: Royal Mail 4-State Mailmark Input Fields
The 6 Destination+DPS (Destination Post Code plus Delivery Point Suffix) The 6 Destination+DPS (Destination Post Code plus Delivery Point Suffix)
@@ -3923,7 +3995,7 @@ patterns are:
ANNLLNLSS AANNLLNLS ANNNLLNLS AANNNLLNL ANANLLNLS AANANLLNL ANNLLNLSS AANNLLNLS ANNNLLNLS AANNNLLNL ANANLLNLS AANANLLNL
----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- -----------
Table 23: Royal Mail 4-State Mailmark Destination+DPS Patterns Table 24: Royal Mail 4-State Mailmark Destination+DPS Patterns
where 'A' stands for full alphabetic (A-Z), 'L' for limited alphabetic (A-Z less where 'A' stands for full alphabetic (A-Z), 'L' for limited alphabetic (A-Z less
@@ -4019,7 +4091,7 @@ Note that only ECC 200 symbols are supported, the older standards (ECC 000 to
9 26 x 26 19 88 x 88 29 16 x 36 9 26 x 26 19 88 x 88 29 16 x 36
10 32 x 32 20 96 x 96 30 16 x 48 10 32 x 32 20 96 x 96 30 16 x 48
Table 24: Data Matrix Sizes Table 25: Data Matrix Sizes
The largest version 24 (144 x 144) can encode 3116 digits, around 2335 The largest version 24 (144 x 144) can encode 3116 digits, around 2335
alphanumeric characters, or 1555 bytes of data. alphanumeric characters, or 1555 bytes of data.
@@ -4043,7 +4115,7 @@ the following values as before:
38 12 x 88 47 26 x 48 38 12 x 88 47 26 x 48
39 16 x 64 48 26 x 64 39 16 x 64 48 26 x 64
Table 25: DMRE Sizes Table 26: DMRE Sizes
DMRE symbol sizes may be activated in automatic size mode using the option DMRE symbol sizes may be activated in automatic size mode using the option
--dmre (API option_3 = DM_DMRE). --dmre (API option_3 = DM_DMRE).
@@ -4090,7 +4162,7 @@ section, as summarized below.
Reserved 6 Spaces Reserved 6 Spaces
Customer Data 6, 45 or 29 Anything (Latin-1) Customer Data 6, 45 or 29 Anything (Latin-1)
Table 26: Royal Mail 2D Mailmark Input Fields Table 27: Royal Mail 2D Mailmark Input Fields
The 12 Destination+DPS (Destination Post Code plus Delivery Point Suffix) The 12 Destination+DPS (Destination Post Code plus Delivery Point Suffix)
@@ -4103,7 +4175,7 @@ required (the rest can be blank), and the whole field can be blank:
ANSSSSSSS AANSSSSSS ANNSSSSSS AANNSSSSS ANASSSSSS AANASSSSS ANSSSSSSS AANSSSSSS ANNSSSSSS AANNSSSSS ANASSSSSS AANASSSSS
----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- ----------- -----------
Table 27: Royal Mail 2D Mailmark Destination+DPS Patterns Table 28: Royal Mail 2D Mailmark Destination+DPS Patterns
where 'A' is alphabetic (A-Z), 'N' numeric (0-9), and 'S' space. where 'A' is alphabetic (A-Z), 'N' numeric (0-9), and 'S' space.
@@ -4116,7 +4188,7 @@ the whole field can be):
ANNAASS AANNAAS ANNNAAS AANNNAA ANANAAS AANANAA ANNAASS AANNAAS ANNNAAS AANNNAA ANANAAS AANANAA
--------- --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- ---------
Table 28: Royal Mail 2D Mailmark RTS Patterns Table 29: Royal Mail 2D Mailmark RTS Patterns
Three sizes are defined, one rectangular, with varying maximum amounts of Three sizes are defined, one rectangular, with varying maximum amounts of
optional customer data: optional customer data:
@@ -4127,7 +4199,7 @@ optional customer data:
Type 9 32 x 32 45 characters 10 Type 9 32 x 32 45 characters 10
Type 29 16 x 48 29 characters 30 Type 29 16 x 48 29 characters 30
Table 29: Royal Mail 2D Mailmark Sizes Table 30: Royal Mail 2D Mailmark Sizes
Zint will automatically select a size based on the amount of customer data, or Zint will automatically select a size based on the amount of customer data, or
it can be specified using the --vers option (API option_2), which takes the Zint it can be specified using the --vers option (API option_2), which takes the Zint
@@ -4155,7 +4227,7 @@ option_1) as shown in the following table.
3 Q Approx 55% of symbol Approx 25% 3 Q Approx 55% of symbol Approx 25%
4 H Approx 65% of symbol Approx 30% 4 H Approx 65% of symbol Approx 30%
Table 30: QR Code ECC Levels Table 31: QR Code ECC Levels
The size of the symbol can be specified by setting the --vers option (API The size of the symbol can be specified by setting the --vers option (API
option_2) to the QR Code version required (1-40). The size of symbol generated option_2) to the QR Code version required (1-40). The size of symbol generated
@@ -4178,7 +4250,7 @@ is shown in the table below.
13 69 x 69 27 125 x 125 13 69 x 69 27 125 x 125
14 73 x 73 28 129 x 129 14 73 x 73 28 129 x 129
Table 31: QR Code Sizes Table 32: QR Code Sizes
The maximum capacity of a QR Code symbol (version 40) is 7089 numeric digits, The maximum capacity of a QR Code symbol (version 40) is 7089 numeric digits,
4296 alphanumeric characters or 2953 bytes of data. QR Code symbols can also be 4296 alphanumeric characters or 2953 bytes of data. QR Code symbols can also be
@@ -4238,7 +4310,7 @@ restrictions on what characters can be encoded.
4 M4 17 x 17 Latin-1 and Shift JIS 4 M4 17 x 17 Latin-1 and Shift JIS
------------------------------------------------------------------ ------------------------------------------------------------------
Table 32: Micro QR Code Sizes Table 33: Micro QR Code Sizes
Version M4 can encode up to 35 digits, 21 alphanumerics, 15 bytes or 9 Kanji Version M4 can encode up to 35 digits, 21 alphanumerics, 15 bytes or 9 Kanji
characters. characters.
@@ -4258,7 +4330,7 @@ not available for any version, and ECC level Q is only available for version M4:
3 Q Approx 55% of symbol Approx 25% M4 3 Q Approx 55% of symbol Approx 25% M4
---------------------------------------------------------------------- ----------------------------------------------------------------------
Table 33: Micro QR ECC Levels Table 34: Micro QR ECC Levels
The defaults for symbol size and ECC level depend on the input and whether The defaults for symbol size and ECC level depend on the input and whether
either of them is specified. either of them is specified.
@@ -4290,7 +4362,7 @@ option_1), however only ECC levels M and H are valid for this type of symbol.
2 M Approx 37% of symbol Approx 15% 2 M Approx 37% of symbol Approx 15%
4 H Approx 65% of symbol Approx 30% 4 H Approx 65% of symbol Approx 30%
Table 34: rMQR ECC Levels Table 35: rMQR ECC Levels
The preferred symbol sizes can be selected using the --vers option (API The preferred symbol sizes can be selected using the --vers option (API
option_2) as shown in the table below. Input values between 33 and 38 fix the option_2) as shown in the table below. Input values between 33 and 38 fix the
@@ -4338,7 +4410,7 @@ height of the symbol while allowing Zint to determine the minimum symbol width.
19 R13x59 13 x 59 38 R17xW 17 x automatic width 19 R13x59 13 x 59 38 R17xW 17 x automatic width
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
Table 35: rMQR Sizes Table 36: rMQR Sizes
The largest version R17x139 (32) can encode up to 361 digits, 219 alphanumerics, The largest version R17x139 (32) can encode up to 361 digits, 219 alphanumerics,
150 bytes, or 92 Kanji characters. 150 bytes, or 92 Kanji characters.
@@ -4396,7 +4468,7 @@ Zint is given in the following table.
13 - 15 Three-digit service code. This depends on your parcel courier. 13 - 15 Three-digit service code. This depends on your parcel courier.
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Table 36: MaxiCode Structured Carrier Message Format Table 37: MaxiCode Structured Carrier Message Format
The primary message can be set at the command prompt using the --primary switch The primary message can be set at the command prompt using the --primary switch
(API primary). The secondary message uses the normal data entry method. For (API primary). The secondary message uses the normal data entry method. For
@@ -4451,7 +4523,7 @@ Example maximum data lengths are given in the table below:
6 93 138 50 6 93 138 50
------------------------------------------------------------------------ ------------------------------------------------------------------------
Table 37: MaxiCode Data Length Maxima Table 38: MaxiCode Data Length Maxima
* - secondary only * - secondary only
@@ -4497,7 +4569,7 @@ symbol. Two options, mutally exclusive, are available to change this behaviour:
11 45 x 45 23 95 x 95 35 147 x 147 11 45 x 45 23 95 x 95 35 147 x 147
12 49 x 49 24 101 x 101 36 151 x 151 12 49 x 49 24 101 x 101 36 151 x 151
Table 38: Aztec Code Sizes Table 39: Aztec Code Sizes
Note that in symbols which have a specified size the amount of error correction Note that in symbols which have a specified size the amount of error correction
is dependent on the length of the data input and Zint will allow error is dependent on the length of the data input and Zint will allow error
@@ -4515,7 +4587,7 @@ recommended, and anything less than 5% + 3 codewords will result in a warning).
3 >=36% + 3 codewords 3 >=36% + 3 codewords
4 >=50% + 3 codewords 4 >=50% + 3 codewords
Table 39: Aztec Code Error Correction Modes Table 40: Aztec Code Error Correction Modes
It is not possible to select both symbol size and error correction capacity for 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 the same symbol. If both options are selected then the error correction capacity
@@ -4583,7 +4655,7 @@ below:
10 T 16 x automatic width 90 55 10 T 16 x automatic width 90 55
------------------------------------------------------------------------ ------------------------------------------------------------------------
Table 40: Code One Sizes Table 41: Code One Sizes
Version S symbols can only encode numeric data. The width of version S and Version S symbols can only encode numeric data. The width of version S and
version T symbols is determined by the length of the input data. version T symbols is determined by the length of the input data.
@@ -4621,7 +4693,7 @@ using the --secure option (API option_1), according to the following tables.
6 78 x 78 13 162 x 162 6 78 x 78 13 162 x 162
7 90 x 90 7 90 x 90
Table 41: Grid Matrix Sizes Table 42: Grid Matrix Sizes
Mode Error Correction Capacity Mode Error Correction Capacity
------ --------------------------- ------ ---------------------------
@@ -4631,7 +4703,7 @@ using the --secure option (API option_1), according to the following tables.
4 Approximately 40% 4 Approximately 40%
5 Approximately 50% 5 Approximately 50%
Table 42: Grid Matrix Error Correction Modes Table 43: Grid Matrix Error Correction Modes
Non-ASCII data density may be maximized by using the --fullmultibyte switch (API Non-ASCII data density may be maximized by using the --fullmultibyte switch (API
option_3 = ZINT_FULL_MULTIBYTE), but check that your barcode reader supports option_3 = ZINT_FULL_MULTIBYTE), but check that your barcode reader supports
@@ -4709,7 +4781,7 @@ to a value between 1 and 84 according to the following table.
27 75 x 75 55 131 x 131 83 187 x 187 27 75 x 75 55 131 x 131 83 187 x 187
28 77 x 77 56 133 x 133 84 189 x 189 28 77 x 77 56 133 x 133 84 189 x 189
Table 43: Han Xin Sizes Table 44: Han Xin Sizes
The largest version (84) can encode 7827 digits, 4350 ASCII characters, up to The largest version (84) can encode 7827 digits, 4350 ASCII characters, up to
2175 Chinese characters, or 3261 bytes, making it the most capacious of all the 2175 Chinese characters, or 3261 bytes, making it the most capacious of all the
@@ -4726,7 +4798,7 @@ following table.
3 Approx 23% 3 Approx 23%
4 Approx 30% 4 Approx 30%
Table 44: Han Xin Error Correction Modes Table 45: Han Xin Error Correction Modes
Non-ASCII data density may be maximized by using the --fullmultibyte switch (API Non-ASCII data density may be maximized by using the --fullmultibyte switch (API
option_3 = ZINT_FULL_MULTIBYTE), but check that your barcode reader supports option_3 = ZINT_FULL_MULTIBYTE), but check that your barcode reader supports
@@ -4758,7 +4830,7 @@ option_1) to a value as shown in the following table.
5 EC4 Approx 25% 5 EC4 Approx 25%
6 EC5 Approx 33% 6 EC5 Approx 33%
Table 45: Ultracode Error Correction Values Table 46: Ultracode Error Correction Values
Zint does not currently implement data compression by default, but this can be Zint does not currently implement data compression by default, but this can be
initiated through the API by setting initiated through the API by setting
@@ -4804,7 +4876,7 @@ as shown in the table below.
D Used for Information Based Indicia (IBI) postage. D Used for Information Based Indicia (IBI) postage.
E Used for customized mail with a USPS Intelligent Mail barcode. E Used for customized mail with a USPS Intelligent Mail barcode.
Table 46: Valid FIM Characters Table 47: Valid FIM Characters
6.7.2 Flattermarken 6.7.2 Flattermarken
@@ -4957,7 +5029,7 @@ company references in particular.
2004) 2004)
- AIM ITS/04-023 International Technical Standard - Extended Channel - AIM ITS/04-023 International Technical Standard - Extended Channel
Interpretations Part 3: Register (Version 2, February 2022) Interpretations Part 3: Register (Version 2, February 2022)
- GS1 General Specifications Release 25.0 (Jan 2025) - GS1 General Specifications Release 26.0 (Jan 2026)
- ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling - ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard Standard
@@ -4992,7 +5064,7 @@ reproduced here for reference.
E SO RS . > N ^ n ~ E SO RS . > N ^ n ~
F SI US / ? O _ o DEL F SI US / ? O _ o DEL
Table 47: ASCII Table 48: ASCII
A.2 Latin Alphabet No. 1 (ISO/IEC 8859-1) A.2 Latin Alphabet No. 1 (ISO/IEC 8859-1)
@@ -5021,7 +5093,7 @@ defined.
E ® ¾ Î Þ î þ E ® ¾ Î Þ î þ
F ¯ ¿ Ï ß ï ÿ F ¯ ¿ Ï ß ï ÿ
Table 48: ISO/IEC 8859-1 Table 49: ISO/IEC 8859-1
Annex B. Qt Backend QZint Annex B. Qt Backend QZint
@@ -5357,6 +5429,13 @@ OPTIONS
as GS1 AI delimiters, rather than square brackets "[]". If the AI data as GS1 AI delimiters, rather than square brackets "[]". If the AI data
contains opening parentheses, they must be backslashed ("\("). contains opening parentheses, they must be backslashed ("\(").
--gs1raw
Treat input as GS1 compatible data (as --gs1), but process literally, with
any required FNC1s represented by GS (0x1D). AIs are not delimited by
brackets ("[]" or "()"). (Similar to the GS1 Syntax Engine “Unbracketed AI”
entry mode except using GSs instead of carets, and without any initial GS.)
--gs1strict --gs1strict
Treat input as GS1 compatible data (as --gs1) and use the GS1 Syntax Engine Treat input as GS1 compatible data (as --gs1) and use the GS1 Syntax Engine
@@ -5874,40 +5953,51 @@ $, @, [, \, ], ^, `, {, |, }, ~ (tilde).
must be given as UTF-8, e.g. a byte "\x80" must be represented as the 2 bytes must be given as UTF-8, e.g. a byte "\x80" must be represented as the 2 bytes
"\xC2\x80"; similarly "\xC0" as "\xC3\x80", etc. "\xC2\x80"; similarly "\xC0" as "\xC3\x80", etc.
[10] BARCODE_MEMORY_FILE textual formats EPS and SVG will have Unix newlines [10] For more information on the “Unbracketed AI” format for GS1 data entry, see
the GS1 Barcode Syntax Engine overview.
[11] FNC1s are required to terminate the data of any AI (except when the 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).
[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. (LF) on both Windows and Unix, i.e. not CR+LF on Windows.
[11] The height value is ignored for Aztec (including HIBC and Aztec Rune), Code [13] The height value is ignored for Aztec (including HIBC and Aztec Rune), Code
One, Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode, QR One, Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode, QR
Code (including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which Code (including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which
have a fixed width-to-height ratio (or, in the case of Code One, a fixed have a fixed width-to-height ratio (or, in the case of Code One, a fixed
height). height).
[12] For Windows, outfile is assumed to be UTF-8 encoded. [14] For Windows, outfile is assumed to be UTF-8 encoded.
[13] The BARCODE_BIND_TOP flag is set by default for DPD - see 6.1.10.7 DPD [15] The BARCODE_BIND_TOP flag is set by default for DPD - see 6.1.10.7 DPD
Code. Code.
[14] The BARCODE_BIND flag is always set for Codablock-F, Code 16K and Code 49. [16] The BARCODE_BIND flag is always set for Codablock-F, Code 16K and Code 49.
Special considerations apply to ITF-14 - see 6.1.2.6 ITF-14. Special considerations apply to ITF-14 - see 6.1.2.6 ITF-14.
[15] Codablock-F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, [17] Codablock-F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN,
ITF-14, UPC-A and UPC-E have compliant quiet zones added by default. ITF-14, UPC-A and UPC-E have compliant quiet zones added by default.
[16] ZINT_CAP_EANUPC was previously named ZINT_CAP_EXTENDABLE, which is still [18] ZINT_CAP_EANUPC was previously named ZINT_CAP_EXTENDABLE, which is still
recognised. recognised.
[17] DotCode, Han Xin, Micro QR Code, QR Code and UPNQR have variable masks. [19] DotCode, Han Xin, Micro QR Code, QR Code and UPNQR have variable masks.
Rectangular Micro QR Code has a fixed mask (4). Rectangular Micro QR Code has a fixed mask (4).
[18] Except for Japanese Postal Code, whose check character is not truly [20] Except for Japanese Postal Code, whose check character is not truly
representable in the encoded data. representable in the encoded data.
[19] The library libzueci, which can convert both to and from UTF-8 and ECI, is [21] The library libzueci, which can convert both to and from UTF-8 and ECI, is
available at https://sourceforge.net/projects/libzueci/. available at https://sourceforge.net/projects/libzueci/.
[20] BARCODE_CODE128AB previously used the name BARCODE_CODE128B, which is still [22] BARCODE_CODE128AB previously used the name BARCODE_CODE128B, which is still
recognised. recognised.
[21] The DX number may be looked up in The (Modified) Big Film Database at [23] The DX number may be looked up in The (Modified) Big Film Database at
https://thebigfilmdatabase.merinorus.com. https://thebigfilmdatabase.merinorus.com.
+10
View File
@@ -248,6 +248,16 @@ square brackets \f[CR]\(dq[]\(dq\f[R].
If the AI data contains opening parentheses, they must be backslashed If the AI data contains opening parentheses, they must be backslashed
(\f[CR]\(dq\(rs(\(dq\f[R]). (\f[CR]\(dq\(rs(\(dq\f[R]).
.TP .TP
\f[CR]\-\-gs1raw\f[R]
Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]), but process
literally, with any required \f[CR]FNC1\f[R]s represented by
\f[CR]GS\f[R] (0x1D).
AIs are not delimited by brackets (\f[CR]\(dq[]\(dq\f[R] or
\f[CR]\(dq()\(dq\f[R]).
(Similar to the GS1 Syntax Engine \(lqUnbracketed AI\(rq entry mode
except using \f[CR]GS\f[R]s instead of carets, and without any initial
\f[CR]GS\f[R].)
.TP
\f[CR]\-\-gs1strict\f[R] \f[CR]\-\-gs1strict\f[R]
Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) and use the Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) and use the
GS1 Syntax Engine (if available) to strictly verify the GS1 data, GS1 Syntax Engine (if available) to strictly verify the GS1 data,
+6
View File
@@ -220,6 +220,12 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
: Treat input as GS1 compatible data (as `--gs1`) but process parentheses `"()"` as GS1 AI delimiters, rather than : Treat input as GS1 compatible data (as `--gs1`) but process parentheses `"()"` as GS1 AI delimiters, rather than
square brackets `"[]"`. If the AI data contains opening parentheses, they must be backslashed (`"\("`). square brackets `"[]"`. If the AI data contains opening parentheses, they must be backslashed (`"\("`).
`--gs1raw`
: Treat input as GS1 compatible data (as `--gs1`), but process literally, with any required `FNC1`s represented by
`GS` (0x1D). AIs are not delimited by brackets (`"[]"` or `"()"`). (Similar to the GS1 Syntax Engine "Unbracketed
AI" entry mode except using `GS`s instead of carets, and without any initial `GS`.)
`--gs1strict` `--gs1strict`
: Treat input as GS1 compatible data (as `--gs1`) and use the GS1 Syntax Engine (if available) to strictly verify : Treat input as GS1 compatible data (as `--gs1`) and use the GS1 Syntax Engine (if available) to strictly verify
+11 -11
View File
@@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Copyright (C) 2022-2025 <rstuart114@gmail.com> # Copyright (C) 2022-2026 <rstuart114@gmail.com>
# #
# Generate the barcode .svg images for manual.pdf (via manual.pmd) # Generate the barcode .svg images for manual.pdf (via manual.pmd)
@@ -46,16 +46,16 @@ zint -b ITF14 --compliantheight -d "9212320967145" --scale=$SCALE_LINEAR -o imag
zint -b ITF14 --box --compliantheight -d "9212320967145" --scale=$SCALE_LINEAR -o images/itf14_border0.svg zint -b ITF14 --box --compliantheight -d "9212320967145" --scale=$SCALE_LINEAR -o images/itf14_border0.svg
zint -b DPLEIT -d "9212320967145" --scale=$SCALE_LINEAR -o images/dpleit.svg zint -b DPLEIT -d "9212320967145" --scale=$SCALE_LINEAR -o images/dpleit.svg
zint -b DPIDENT -d "91232096712" --scale=$SCALE_LINEAR -o images/dpident.svg zint -b DPIDENT -d "91232096712" --scale=$SCALE_LINEAR -o images/dpident.svg
zint -b UPCA --compliantheight -d "72527270270" --scale=$SCALE_UPCEAN -o images/upca.svg zint -b UPCA --compliantheight -d "01234500005" --scale=$SCALE_UPCEAN -o images/upca.svg
zint -b UPCA --compliantheight -d "72527270270+12345" --scale=$SCALE_UPCEAN -o images/upca_5.svg zint -b UPCA --compliantheight -d "01234500005+12345" --scale=$SCALE_UPCEAN -o images/upca_5.svg
zint -b UPCA --compliantheight -d "72527270270+12345" --guardwhitespace --scale=$SCALE_UPCEAN -o images/upca_5_gws.svg zint -b UPCA --compliantheight -d "01234500005+12345" --guardwhitespace --scale=$SCALE_UPCEAN -o images/upca_5_gws.svg
zint -b UPCE --compliantheight -d "123456" --scale=$SCALE_UPCEAN -o images/upce.svg zint -b UPCE --compliantheight -d "123455" --scale=$SCALE_UPCEAN -o images/upce.svg
zint -b UPCE --compliantheight -d "123456+12" --guardwhitespace --scale=$SCALE_UPCEAN -o images/upce_2_gws.svg zint -b UPCE --compliantheight -d "123455+12" --guardwhitespace --scale=$SCALE_UPCEAN -o images/upce_2_gws.svg
zint -b EAN13 --compliantheight -d "451234567890" --scale=$SCALE_UPCEAN -o images/ean13.svg zint -b EAN13 --compliantheight -d "952012345678" --scale=$SCALE_UPCEAN -o images/ean13.svg
zint -b EAN13 --compliantheight -d "451234567890+21" --scale=$SCALE_UPCEAN -o images/ean13_2.svg zint -b EAN13 --compliantheight -d "952012345678+21" --scale=$SCALE_UPCEAN -o images/ean13_2.svg
zint -b EAN13 --compliantheight -d "451234567890" --guarddescent=2.5 --guardwhitespace --scale=$SCALE_UPCEAN -o images/ean13_gd_gws.svg zint -b EAN13 --compliantheight -d "952012345678" --guarddescent=2.5 --guardwhitespace --scale=$SCALE_UPCEAN -o images/ean13_gd_gws.svg
zint -b EAN8 --compliantheight -d "7432365" --scale=$SCALE_UPCEAN -o images/ean8.svg zint -b EAN8 --compliantheight -d "9520000" --scale=$SCALE_UPCEAN -o images/ean8.svg
zint -b EAN8 --compliantheight -d "7432365" --guardwhitespace --scale=$SCALE_UPCEAN -o images/ean8_gws.svg zint -b EAN8 --compliantheight -d "9520000" --guardwhitespace --scale=$SCALE_UPCEAN -o images/ean8_gws.svg
zint -b ISBNX --compliantheight -d "9789295055124" --scale=$SCALE_UPCEAN -o images/isbnx.svg zint -b ISBNX --compliantheight -d "9789295055124" --scale=$SCALE_UPCEAN -o images/isbnx.svg
zint -b ISBNX --compliantheight -d "9789295055124" --guardwhitespace --scale=$SCALE_UPCEAN -o images/isbnx_gws.svg zint -b ISBNX --compliantheight -d "9789295055124" --guardwhitespace --scale=$SCALE_UPCEAN -o images/isbnx_gws.svg
zint -b EAN_2ADDON --compliantheight -d "12" --scale=$SCALE_UPCEAN -o images/ean_2addon.svg zint -b EAN_2ADDON --compliantheight -d "12" --scale=$SCALE_UPCEAN -o images/ean_2addon.svg
+8 -2
View File
@@ -200,7 +200,8 @@ static void usage(const int no_png, const int have_gs1syntaxengine) {
fputs( " --fullmultibyte Use multibyte for binary/Latin (QR/Han Xin/Grid Matrix)\n" fputs( " --fullmultibyte Use multibyte for binary/Latin (QR/Han Xin/Grid Matrix)\n"
" --gs1 Treat input as GS1 compatible data\n" " --gs1 Treat input as GS1 compatible data\n"
" --gs1nocheck Do not check validity of GS1 data\n" " --gs1nocheck Do not check validity of GS1 data\n"
" --gs1parens Process parentheses \"()\" as GS1 AI delimiters, not \"[]\"\n", stdout); " --gs1parens Process parentheses \"()\" as GS1 AI delimiters, not \"[]\"\n"
" --gs1raw Process as raw GS1 input (no brackets), with GS for FNC1\n", stdout);
if (have_gs1syntaxengine) { if (have_gs1syntaxengine) {
fputs( " --gs1strict Use GS1 Syntax Engine to strictly validate GS1 data\n", stdout); fputs( " --gs1strict Use GS1 Syntax Engine to strictly validate GS1 data\n", stdout);
} }
@@ -1545,7 +1546,7 @@ int main(int argc, char **argv) {
OPT_CMYK, OPT_COLS, OPT_COMPLIANTHEIGHT, OPT_CMYK, OPT_COLS, OPT_COMPLIANTHEIGHT,
OPT_DIRECT, OPT_DMISO144, OPT_DMRE, OPT_DOTSIZE, OPT_DOTTY, OPT_DUMP, 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, OPT_ECI, OPT_EMBEDFONT, OPT_ESC, OPT_EXTRAESC, OPT_FAST, OPT_FG, OPT_FILETYPE, OPT_FULLMULTIBYTE,
OPT_GS1, OPT_GS1NOCHECK, OPT_GS1PARENS, OPT_GS1STRICT /*GS1SYNTAXENGINE_MODE*/, OPT_GS1, OPT_GS1NOCHECK, OPT_GS1PARENS, OPT_GS1RAW, OPT_GS1STRICT /*GS1SYNTAXENGINE_MODE*/,
OPT_GSSEP, OPT_GUARDDESCENT, OPT_GUARDWHITESPACE, OPT_GSSEP, OPT_GUARDDESCENT, OPT_GUARDWHITESPACE,
OPT_HEIGHT, OPT_HEIGHTPERROW, OPT_INIT, OPT_MIRROR, OPT_MASK, OPT_MODE, OPT_HEIGHT, OPT_HEIGHTPERROW, OPT_INIT, OPT_MIRROR, OPT_MASK, OPT_MODE,
OPT_NOBACKGROUND, OPT_NOQUIETZONES, OPT_NOTEXT, OPT_PRIMARY, OPT_QUIETZONES, OPT_NOBACKGROUND, OPT_NOQUIETZONES, OPT_NOTEXT, OPT_PRIMARY, OPT_QUIETZONES,
@@ -1595,6 +1596,7 @@ int main(int argc, char **argv) {
{"gs1", 0, 0, OPT_GS1}, {"gs1", 0, 0, OPT_GS1},
{"gs1nocheck", 0, NULL, OPT_GS1NOCHECK}, {"gs1nocheck", 0, NULL, OPT_GS1NOCHECK},
{"gs1parens", 0, NULL, OPT_GS1PARENS}, {"gs1parens", 0, NULL, OPT_GS1PARENS},
{"gs1raw", 0, NULL, OPT_GS1RAW},
{"gs1strict", 0, NULL, OPT_GS1STRICT /*GS1SYNTAXENGINE_MODE*/}, {"gs1strict", 0, NULL, OPT_GS1STRICT /*GS1SYNTAXENGINE_MODE*/},
{"gssep", 0, NULL, OPT_GSSEP}, {"gssep", 0, NULL, OPT_GSSEP},
{"guarddescent", 1, NULL, OPT_GUARDDESCENT}, {"guarddescent", 1, NULL, OPT_GUARDDESCENT},
@@ -1815,6 +1817,10 @@ int main(int argc, char **argv) {
my_symbol->input_mode |= GS1PARENS_MODE; my_symbol->input_mode |= GS1PARENS_MODE;
my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | GS1_MODE; /* Now sets GS1_MODE also */ my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | GS1_MODE; /* Now sets GS1_MODE also */
break; break;
case OPT_GS1RAW:
my_symbol->input_mode |= GS1RAW_MODE;
my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | GS1_MODE;
break;
case OPT_GS1STRICT: case OPT_GS1STRICT:
my_symbol->input_mode |= GS1SYNTAXENGINE_MODE; my_symbol->input_mode |= GS1SYNTAXENGINE_MODE;
my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | GS1_MODE; /* Now sets GS1_MODE also */ my_symbol->input_mode = (my_symbol->input_mode & ~0x07) | GS1_MODE; /* Now sets GS1_MODE also */
+39 -35
View File
@@ -231,6 +231,9 @@ static void arg_input_mode(char *cmd, int input_mode) {
if (input_mode & HEIGHTPERROW_MODE) { if (input_mode & HEIGHTPERROW_MODE) {
sprintf(cmd + strlen(cmd), "%s--heightperrow", strlen(cmd) ? " " : ""); sprintf(cmd + strlen(cmd), "%s--heightperrow", strlen(cmd) ? " " : "");
} }
if (input_mode & GS1RAW_MODE) {
sprintf(cmd + strlen(cmd), "%s--gs1raw", strlen(cmd) ? " " : "");
}
} }
} }
@@ -987,7 +990,7 @@ static void test_barcode_symbology(const testCtx *const p_ctx) {
#ifdef ZINT_HAVE_GS1SE #ifdef ZINT_HAVE_GS1SE
#define TEST_OTHER_OPTS_GS1STRICT_ERROR "Error 267: AI (00): The numeric check digit is incorrect. (00)37610425002123456|8|" #define TEST_OTHER_OPTS_GS1STRICT_ERROR "Error 267: AI (00): The numeric check digit is incorrect. (00)37610425002123456|8|"
#else #else
#define TEST_OTHER_OPTS_GS1STRICT_ERROR "Warning 261: AI (00) position 18: Bad checksum '8', expected '9'" #define TEST_OTHER_OPTS_GS1STRICT_ERROR "Warning 261: AI (00) data position 18: Bad checksum '8', expected '9'"
#endif #endif
static void test_other_opts(const testCtx *const p_ctx) { static void test_other_opts(const testCtx *const p_ctx) {
@@ -1035,43 +1038,44 @@ static void test_other_opts(const testCtx *const p_ctx) {
/* 27*/ { BARCODE_GS1_128, "0112345678901231", -1, "", NULL, "Error 252: Data does not start with an AI", 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 }, /* 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 }, /* 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 }, /* 30*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, "", NULL, "Warning 261: AI (00) data position 18: Bad checksum '8', expected '9'", 0 },
/* 31*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --gs1nocheck", NULL, "", 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 }, /* 32*/ { BARCODE_GS1_128, "[00]376104250021234568", -1, " --werror", NULL, "Error 261: AI (00) data position 18: Bad checksum '8', expected '9'", 0 },
/* 33*/ { BARCODE_GS1_128, "[00]376104250021234569", -1, " --gs1strict", NULL, "", 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 }, /* 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 }, /* 35*/ { BARCODE_GS1_128, "00376104250021234569", -1, " --gs1raw", NULL, "", 0 },
/* 36*/ { BARCODE_AZTEC, "1", -1, " --structapp=", ",", "Error 155: Structured Append index too short", 0 }, /* 36*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1", "Error 155: Invalid Structured Append argument, expect \"index,count[,ID]\"", 0 },
/* 37*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1234567890,", "Error 155: Structured Append index too long", 0 }, /* 37*/ { BARCODE_AZTEC, "1", -1, " --structapp=", ",", "Error 155: Structured Append index too short", 0 },
/* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,", "Error 155: Structured Append count too short", 0 }, /* 38*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "1234567890,", "Error 155: Structured Append index too long", 0 },
/* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890", "Error 155: Structured Append count too long", 0 }, /* 39*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,", "Error 155: Structured Append count too short", 0 },
/* 40*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,", "Error 155: Structured Append ID too short", 0 }, /* 40*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,1234567890", "Error 155: Structured Append count too long", 0 },
/* 41*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,123456789012345678901234567890123", "Error 155: Structured Append ID too long", 0 }, /* 41*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,", "Error 155: Structured Append ID too short", 0 },
/* 42*/ { 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=", "123456789,123456789,123456789012345678901234567890123", "Error 155: Structured Append ID too long", 0 },
/* 43*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,26,12345678901234567890123456789012", "", 0 }, /* 43*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "123456789,123456789,12345678901234567890123456789012", "Error 701: Structured Append count '123456789' out of range (2 to 26)", 0 },
/* 44*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "A,26,12345678901234567890123456789012", "Error 155: Invalid Structured Append index (digits only)", 0 }, /* 44*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,26,12345678901234567890123456789012", "", 0 },
/* 45*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,A,12345678901234567890123456789012", "Error 155: Invalid Structured Append count (digits only)", 0 }, /* 45*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "A,26,12345678901234567890123456789012", "Error 155: Invalid Structured Append index (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 }, /* 46*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "26,A,12345678901234567890123456789012", "Error 155: Invalid Structured Append count (digits only)", 0 },
/* 47*/ { 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=", "26,1,12345678901234567890123456789012", "Error 155: Invalid Structured Append count '1', must be greater than or equal to 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 }, /* 48*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "0,2,12345678901234567890123456789012", "Error 155: Structured Append index '0' out of range (1 to count '2')", 0 },
/* 49*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "", 0 }, /* 49*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "3,2,12345678901234567890123456789012", "Error 155: Structured Append index '3' out of range (1 to count '2')", 0 },
/* 50*/ { BARCODE_PDF417, "1", -1, " --heightperrow", "", "", 0 }, /* 50*/ { BARCODE_AZTEC, "1", -1, " --structapp=", "2,3,12345678901234567890123456789012", "", 0 },
/* 51*/ { -1, NULL, -1, " -v", NULL, "Zint version ", 1 }, /* 51*/ { BARCODE_PDF417, "1", -1, " --heightperrow", "", "", 0 },
/* 52*/ { -1, NULL, -1, " --version", NULL, "Zint version ", 1 }, /* 52*/ { -1, NULL, -1, " -v", NULL, "Zint version ", 1 },
/* 53*/ { -1, NULL, -1, " -h", NULL, "Encode input data in a barcode ", 1 }, /* 53*/ { -1, NULL, -1, " --version", NULL, "Zint version ", 1 },
/* 54*/ { -1, NULL, -1, " -e", NULL, "3: ISO/IEC 8859-1 ", 1 }, /* 54*/ { -1, NULL, -1, " -h", NULL, "Encode input data in a barcode ", 1 },
/* 55*/ { -1, NULL, -1, " -t", NULL, "1 CODE11 ", 1 }, /* 55*/ { -1, NULL, -1, " -e", NULL, "3: ISO/IEC 8859-1 ", 1 },
/* 56*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12345678", "Error 184: scalexdimdp X-dim invalid floating point: integer part must be 7 digits maximum", 0 }, /* 56*/ { -1, NULL, -1, " -t", NULL, "1 CODE11 ", 1 },
/* 57*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1234567890123", "Error 184: scalexdimdp X-dim too long", 0 }, /* 57*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12345678", "Error 184: scalexdimdp X-dim invalid floating point: integer part must be 7 digits maximum", 0 },
/* 58*/ { 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=", "1234567890123", "Error 184: scalexdimdp X-dim too long", 0 },
/* 59*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", ",12.34", "Error 184: scalexdimdp X-dim too short", 0 }, /* 59*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "123456.12", "Error 184: scalexdimdp X-dim invalid floating point: 7 significant digits maximum", 0 },
/* 60*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34,", "Error 184: scalexdimdp resolution too short", 0 }, /* 60*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", ",12.34", "Error 184: scalexdimdp X-dim too short", 0 },
/* 61*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12mm1", "Error 184: scalexdimdp X-dim unknown units: mm1", 0 }, /* 61*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34,", "Error 184: scalexdimdp resolution too short", 0 },
/* 62*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1inc", "Error 184: scalexdimdp X-dim unknown units: inc", 0 }, /* 62*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12mm1", "Error 184: scalexdimdp X-dim unknown units: mm1", 0 },
/* 63*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12.34in,123x", "Error 184: scalexdimdp resolution unknown units: x", 0 }, /* 63*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "1inc", "Error 184: scalexdimdp X-dim unknown units: inc", 0 },
/* 64*/ { 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=", "12.34in,123x", "Error 184: scalexdimdp resolution unknown units: x", 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 }, /* 65*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "12,123.45678", "Error 184: scalexdimdp resolution invalid floating point: 7 significant digits maximum", 0 },
/* 66*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10,1000.1", "Warning 186: scalexdimdp resolution '1000.1' out of range (greater than 1000), **IGNORED**", 0 }, /* 66*/ { BARCODE_EANX, "501234567890", -1, " --scalexdimdp=", "10.1,1000", "Warning 185: scalexdimdp X-dim '10.1' out of range (greater than 10), **IGNORED**", 0 },
/* 67*/ { 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 data_size = ARRAY_SIZE(data);
int i; int i;
+37 -8
View File
@@ -1594,14 +1594,43 @@ or import from file</string>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="chkGS1Parens"> <widget class="QLabel" name="lblGS1Chks">
<property name="toolTip"> <property name="toolTip">
<string>Process parentheses &quot;()&quot; instead of square brackets &quot;[]&quot; <string>GS1 options: &quot;()&quot; (Parentheses), Raw, No Check, Strict
as delimiters for GS1 Application Identifiers
(ignored if disabled)</string> (ignored if disabled)</string>
</property> </property>
<property name="text"> <property name="text">
<string>GS1 &amp;()</string> <string>GS1:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkGS1Parens">
<property name="toolTip">
<string>Process parentheses &quot;()&quot; instead of square brackets &quot;[]&quot;
as delimiters for GS1 Application Identifiers (AIs)
(ignored if disabled)</string>
</property>
<property name="text">
<string>&amp;()</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkGS1Raw">
<property name="toolTip">
<string>Process literally (no AI delimiters), parsing
Group Separators (GS, ASCII 29, \G) as FNC1s
(ignored if disabled)</string>
</property>
<property name="text">
<string>Ra&amp;w</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>false</bool> <bool>false</bool>
@@ -1616,7 +1645,7 @@ checks necessary for encodation are still performed)
(ignored if disabled)</string> (ignored if disabled)</string>
</property> </property>
<property name="text"> <property name="text">
<string>GS1 &amp;No Check</string> <string>&amp;No Check</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>false</bool> <bool>false</bool>
@@ -1626,13 +1655,13 @@ checks necessary for encodation are still performed)
<item> <item>
<widget class="QCheckBox" name="chkGS1Strict"> <widget class="QCheckBox" name="chkGS1Strict">
<property name="toolTip"> <property name="toolTip">
<string>Use GS1 Syntax Engine to <string>Use the GS1 Syntax Engine
strictly verify GS1 data, to strictly verify GS1 data,
including GS1 Digital Link URIs including GS1 Digital Link URIs
(ignored if disabled)</string> (ignored if disabled)</string>
</property> </property>
<property name="text"> <property name="text">
<string>GS1 St&amp;rict</string> <string>St&amp;rict</string>
</property> </property>
<property name="checked"> <property name="checked">
<bool>false</bool> <bool>false</bool>
+27 -24
View File
@@ -355,6 +355,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
connect(chkData, SIGNAL(toggled(bool)), SLOT(update_preview())); connect(chkData, SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(chkRInit, SIGNAL(toggled(bool)), SLOT(update_preview())); connect(chkRInit, SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(chkGS1Parens, SIGNAL(toggled(bool)), SLOT(update_preview())); connect(chkGS1Parens, SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(chkGS1Raw, SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(chkGS1NoCheck, SIGNAL(toggled(bool)), SLOT(update_preview())); connect(chkGS1NoCheck, SIGNAL(toggled(bool)), SLOT(update_preview()));
if (m_bc.bc.haveGS1SyntaxEngine()) { if (m_bc.bc.haveGS1SyntaxEngine()) {
chkGS1Strict->show(); chkGS1Strict->show();
@@ -469,10 +470,9 @@ MainWindow::~MainWindow()
settings.setValue(QSL("studio/chk_data"), chkData->isChecked() ? 1 : 0); settings.setValue(QSL("studio/chk_data"), chkData->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/chk_rinit"), chkRInit->isChecked() ? 1 : 0); settings.setValue(QSL("studio/chk_rinit"), chkRInit->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/chk_gs1parens"), chkGS1Parens->isChecked() ? 1 : 0); settings.setValue(QSL("studio/chk_gs1parens"), chkGS1Parens->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/chk_gs1raw"), chkGS1Raw->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/chk_gs1nocheck"), chkGS1NoCheck->isChecked() ? 1 : 0); settings.setValue(QSL("studio/chk_gs1nocheck"), chkGS1NoCheck->isChecked() ? 1 : 0);
if (chkGS1Strict->isVisible()) { settings.setValue(QSL("studio/chk_gs1strict"), chkGS1Strict->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/chk_gs1strict"), chkGS1Strict->isChecked() ? 1 : 0);
}
settings.setValue(QSL("studio/appearance/autoheight"), chkAutoHeight->isChecked() ? 1 : 0); settings.setValue(QSL("studio/appearance/autoheight"), chkAutoHeight->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/appearance/compliantheight"), chkCompliantHeight->isChecked() ? 1 : 0); settings.setValue(QSL("studio/appearance/compliantheight"), chkCompliantHeight->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/appearance/height"), heightb->value()); settings.setValue(QSL("studio/appearance/height"), heightb->value());
@@ -543,10 +543,9 @@ void MainWindow::load_settings(QSettings &settings)
chkData->setChecked(settings.value(QSL("studio/chk_data")).toInt() ? true : false); chkData->setChecked(settings.value(QSL("studio/chk_data")).toInt() ? true : false);
chkRInit->setChecked(settings.value(QSL("studio/chk_rinit")).toInt() ? true : false); chkRInit->setChecked(settings.value(QSL("studio/chk_rinit")).toInt() ? true : false);
chkGS1Parens->setChecked(settings.value(QSL("studio/chk_gs1parens")).toInt() ? true : false); chkGS1Parens->setChecked(settings.value(QSL("studio/chk_gs1parens")).toInt() ? true : false);
chkGS1Raw->setChecked(settings.value(QSL("studio/chk_gs1raw")).toInt() ? true : false);
chkGS1NoCheck->setChecked(settings.value(QSL("studio/chk_gs1nocheck")).toInt() ? true : false); chkGS1NoCheck->setChecked(settings.value(QSL("studio/chk_gs1nocheck")).toInt() ? true : false);
if (chkGS1Strict->isVisible()) { chkGS1Strict->setChecked(settings.value(QSL("studio/chk_gs1strict")).toInt() ? true : false);
chkGS1Strict->setChecked(settings.value(QSL("studio/chk_gs1strict")).toInt() ? true : false);
}
chkAutoHeight->setChecked(settings.value(QSL("studio/appearance/autoheight"), 1).toInt() ? true : false); chkAutoHeight->setChecked(settings.value(QSL("studio/appearance/autoheight"), 1).toInt() ? true : false);
chkCompliantHeight->setChecked( chkCompliantHeight->setChecked(
settings.value(QSL("studio/appearance/compliantheight"), 1).toInt() ? true : false); settings.value(QSL("studio/appearance/compliantheight"), 1).toInt() ? true : false);
@@ -2420,7 +2419,7 @@ void MainWindow::change_options()
break; break;
} }
// ECI, GS1Parens, GS1NoCheck, RInit, CompliantHeight will be checked in update_preview() as // ECI, GS1Parens, GS1Raw, GS1NoCheck, GS1Strict, RInit, CompliantHeight will be checked in update_preview() as
// encoding mode dependent (HIBC and/or GS1) // encoding mode dependent (HIBC and/or GS1)
chkAutoHeight->setEnabled(!m_bc.bc.isFixedRatio(symbology)); chkAutoHeight->setEnabled(!m_bc.bc.isFixedRatio(symbology));
chkHRTShow->setEnabled(m_bc.bc.hasHRT(symbology)); chkHRTShow->setEnabled(m_bc.bc.hasHRT(symbology));
@@ -3394,9 +3393,11 @@ void MainWindow::update_preview()
lblECI->setEnabled(cmbECI->isEnabled()); lblECI->setEnabled(cmbECI->isEnabled());
} }
btnClearData->setEnabled(!txtData->text().isEmpty()); btnClearData->setEnabled(!txtData->text().isEmpty());
chkGS1Parens->setEnabled(m_bc.bc.takesGS1AIData(m_symbology) || (m_bc.bc.inputMode() & 0x07) == GS1_MODE); lblGS1Chks->setEnabled(m_bc.bc.takesGS1AIData(m_symbology) || (m_bc.bc.inputMode() & 0x07) == GS1_MODE);
chkGS1NoCheck->setEnabled(chkGS1Parens->isEnabled()); chkGS1Parens->setEnabled(lblGS1Chks->isEnabled() && !chkGS1Raw->isChecked());
chkGS1Strict->setEnabled(chkGS1Parens->isEnabled() && !chkGS1NoCheck->isChecked()); chkGS1Raw->setEnabled(lblGS1Chks->isEnabled() && !chkGS1Parens->isChecked());
chkGS1NoCheck->setEnabled(lblGS1Chks->isEnabled());
chkGS1Strict->setEnabled(lblGS1Chks->isEnabled());
chkRInit->setEnabled(m_bc.bc.supportsReaderInit() && (m_bc.bc.inputMode() & 0x07) != GS1_MODE); chkRInit->setEnabled(m_bc.bc.supportsReaderInit() && (m_bc.bc.inputMode() & 0x07) != GS1_MODE);
chkCompliantHeight->setEnabled(m_bc.bc.hasCompliantHeight()); chkCompliantHeight->setEnabled(m_bc.bc.hasCompliantHeight());
@@ -3417,6 +3418,7 @@ void MainWindow::update_preview()
m_bc.bc.setCompliantHeight(chkCompliantHeight->isEnabled() && chkCompliantHeight->isChecked()); m_bc.bc.setCompliantHeight(chkCompliantHeight->isEnabled() && chkCompliantHeight->isChecked());
m_bc.bc.setECI(cmbECI->isEnabled() ? cmbECI->currentIndex() : 0); m_bc.bc.setECI(cmbECI->isEnabled() ? cmbECI->currentIndex() : 0);
m_bc.bc.setGS1Parens(chkGS1Parens->isEnabled() && chkGS1Parens->isChecked()); m_bc.bc.setGS1Parens(chkGS1Parens->isEnabled() && chkGS1Parens->isChecked());
m_bc.bc.setGS1Raw(chkGS1Raw->isEnabled() && chkGS1Raw->isChecked());
m_bc.bc.setGS1NoCheck(chkGS1NoCheck->isEnabled() && chkGS1NoCheck->isChecked()); m_bc.bc.setGS1NoCheck(chkGS1NoCheck->isEnabled() && chkGS1NoCheck->isChecked());
if (chkGS1Strict->isVisible()) { if (chkGS1Strict->isVisible()) {
m_bc.bc.setGS1SyntaxEngine(chkGS1Strict->isEnabled() && chkGS1Strict->isChecked()); m_bc.bc.setGS1SyntaxEngine(chkGS1Strict->isEnabled() && chkGS1Strict->isChecked());
@@ -4260,11 +4262,9 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
settings.setValue(QSL("studio/bc/%1/data_seg2").arg(name), txtDataSeg2->text()); settings.setValue(QSL("studio/bc/%1/data_seg2").arg(name), txtDataSeg2->text());
settings.setValue(QSL("studio/bc/%1/data_seg3").arg(name), txtDataSeg3->text()); settings.setValue(QSL("studio/bc/%1/data_seg3").arg(name), txtDataSeg3->text());
} }
if (!grpComposite->isHidden()) { settings.setValue(QSL("studio/bc/%1/composite_text").arg(name), txtComposite->toPlainText());
settings.setValue(QSL("studio/bc/%1/composite_text").arg(name), txtComposite->toPlainText()); settings.setValue(QSL("studio/bc/%1/chk_composite").arg(name), chkComposite->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/bc/%1/chk_composite").arg(name), chkComposite->isChecked() ? 1 : 0); settings.setValue(QSL("studio/bc/%1/comp_type").arg(name), cmbCompType->currentIndex());
settings.setValue(QSL("studio/bc/%1/comp_type").arg(name), cmbCompType->currentIndex());
}
if (cmbECI->isEnabled()) { if (cmbECI->isEnabled()) {
settings.setValue(QSL("studio/bc/%1/eci").arg(name), cmbECI->currentIndex()); settings.setValue(QSL("studio/bc/%1/eci").arg(name), cmbECI->currentIndex());
settings.setValue(QSL("studio/bc/%1/eci_seg1").arg(name), cmbECISeg1->currentIndex()); settings.setValue(QSL("studio/bc/%1/eci_seg1").arg(name), cmbECISeg1->currentIndex());
@@ -4277,7 +4277,9 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
settings.setValue(QSL("studio/bc/%1/chk_rinit").arg(name), chkRInit->isChecked() ? 1 : 0); settings.setValue(QSL("studio/bc/%1/chk_rinit").arg(name), chkRInit->isChecked() ? 1 : 0);
} }
settings.setValue(QSL("studio/bc/%1/chk_gs1parens").arg(name), chkGS1Parens->isChecked() ? 1 : 0); settings.setValue(QSL("studio/bc/%1/chk_gs1parens").arg(name), chkGS1Parens->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/bc/%1/chk_gs1raw").arg(name), chkGS1Raw->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/bc/%1/chk_gs1nocheck").arg(name), chkGS1NoCheck->isChecked() ? 1 : 0); settings.setValue(QSL("studio/bc/%1/chk_gs1nocheck").arg(name), chkGS1NoCheck->isChecked() ? 1 : 0);
settings.setValue(QSL("studio/bc/%1/chk_gs1strict").arg(name), chkGS1Strict->isChecked() ? 1 : 0);
if (chkAutoHeight->isEnabled()) { if (chkAutoHeight->isEnabled()) {
settings.setValue( settings.setValue(
QSL("studio/bc/%1/appearance/autoheight").arg(name), chkAutoHeight->isChecked() ? 1 : 0); QSL("studio/bc/%1/appearance/autoheight").arg(name), chkAutoHeight->isChecked() ? 1 : 0);
@@ -4688,16 +4690,14 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
txtDataSeg2->setText(settings.value(QSL("studio/bc/%1/data_seg2").arg(name), QSEmpty).toString()); txtDataSeg2->setText(settings.value(QSL("studio/bc/%1/data_seg2").arg(name), QSEmpty).toString());
txtDataSeg3->setText(settings.value(QSL("studio/bc/%1/data_seg3").arg(name), QSEmpty).toString()); txtDataSeg3->setText(settings.value(QSL("studio/bc/%1/data_seg3").arg(name), QSEmpty).toString());
} }
if (!grpComposite->isHidden()) { const QString &composite_text = settings.value(
const QString &composite_text = settings.value( QSL("studio/bc/%1/composite_text").arg(name), QSEmpty).toString();
QSL("studio/bc/%1/composite_text").arg(name), QSEmpty).toString(); if (!composite_text.isEmpty()) {
if (!composite_text.isEmpty()) { txtComposite->setText(composite_text);
txtComposite->setText(composite_text);
}
chkComposite->setChecked(settings.value(
QSL("studio/bc/%1/chk_composite").arg(name), 0).toInt() ? true : false);
cmbCompType->setCurrentIndex(settings.value(QSL("studio/bc/%1/comp_type").arg(name), 0).toInt());
} }
chkComposite->setChecked(settings.value(
QSL("studio/bc/%1/chk_composite").arg(name), 0).toInt() ? true : false);
cmbCompType->setCurrentIndex(settings.value(QSL("studio/bc/%1/comp_type").arg(name), 0).toInt());
if (cmbECI->isEnabled()) { if (cmbECI->isEnabled()) {
cmbECI->setCurrentIndex(settings.value(QSL("studio/bc/%1/eci").arg(name), 0).toInt()); cmbECI->setCurrentIndex(settings.value(QSL("studio/bc/%1/eci").arg(name), 0).toInt());
cmbECISeg1->setCurrentIndex(settings.value(QSL("studio/bc/%1/eci_seg1").arg(name), 0).toInt()); cmbECISeg1->setCurrentIndex(settings.value(QSL("studio/bc/%1/eci_seg1").arg(name), 0).toInt());
@@ -4710,8 +4710,11 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
chkRInit->setChecked(settings.value(QSL("studio/bc/%1/chk_rinit").arg(name)).toInt() ? true : false); chkRInit->setChecked(settings.value(QSL("studio/bc/%1/chk_rinit").arg(name)).toInt() ? true : false);
} }
chkGS1Parens->setChecked(settings.value(QSL("studio/bc/%1/chk_gs1parens").arg(name)).toInt() ? true : false); chkGS1Parens->setChecked(settings.value(QSL("studio/bc/%1/chk_gs1parens").arg(name)).toInt() ? true : false);
chkGS1Raw->setChecked(settings.value( QSL("studio/bc/%1/chk_gs1raw").arg(name)).toInt() ? true : false);
chkGS1NoCheck->setChecked(settings.value( chkGS1NoCheck->setChecked(settings.value(
QSL("studio/bc/%1/chk_gs1nocheck").arg(name)).toInt() ? true : false); QSL("studio/bc/%1/chk_gs1nocheck").arg(name)).toInt() ? true : false);
chkGS1Strict->setChecked(settings.value(
QSL("studio/bc/%1/chk_gs1strict").arg(name)).toInt() ? true : false);
if (chkAutoHeight->isEnabled()) { if (chkAutoHeight->isEnabled()) {
chkAutoHeight->setChecked(settings.value( chkAutoHeight->setChecked(settings.value(
QSL("studio/bc/%1/appearance/autoheight").arg(name), 1).toInt() ? true : false); QSL("studio/bc/%1/appearance/autoheight").arg(name), 1).toInt() ? true : false);