From 771a1b3cdd1f9a2217090f1e00c4092e7899008d Mon Sep 17 00:00:00 2001
From: gitlost
Date: Tue, 26 May 2026 20:32:51 +0100
Subject: [PATCH] TELEPEN/TELEPEN_NUM: support AIM-defined Start/Stop
characters with option "--vers=1" (API `option_2 = 1`); define minimum
height based on AIM USS Telepen TELEPEN_NUM: support switching to Full ASCII
mode with DLE; max digits 136 -> 138 TELEPEN: support switching to
Compressed Numeric Mode with DLE if AIM-defined Start/Stop enabled CLI:
make args for "--dmb256", "--dmc40", "--scalexdimdp" and "--scmvv"
optional library: new escape sequences `\L`, `\F`, `\N`, & refactor parsing
to use `escs` table ZBarcode_Scale_From_XdimDp: allow TXT filetype (so
"--dump" test works) output: Telepen default quiet zone confirmed as 10X
aztec/dmatrix: fix source line too long man page: embolden options and
emphasize args; add barcode names to standards; various other fixes
---
ChangeLog | 13 +-
backend/aztec.c | 3 +-
backend/dmatrix.c | 3 +-
backend/library.c | 247 +++++----
backend/output.c | 3 +-
backend/telepen.c | 349 +++++++++----
backend/tests/test_library.c | 361 +++++++------
backend/tests/test_raster.c | 12 +-
backend/tests/test_telepen.c | 480 ++++++++++++-----
backend/tests/test_vector.c | 12 +-
backend/tests/testcommon.c | 54 +-
backend/tests/tools/run_zxingcpp_tests.sh | 1 +
backend_qt/qzint.cpp | 1 +
backend_qt/tests/test_qzint.cpp | 16 +
docs/images/telepen.svg | 10 +-
docs/images/telepen_aim.svg | 12 +
docs/images/telepen_num_asc.svg | 12 +
docs/images/telepen_num_odd.svg | 12 +
docs/manual.html | 606 +++++++++++++---------
docs/manual.pmd | 67 ++-
docs/manual.txt | 138 +++--
docs/zint.1 | 310 ++++++-----
docs/zint.1.pmd | 282 +++++-----
docs/zint_images.sh | 5 +-
frontend/main.c | 34 +-
frontend/tests/test_args.c | 54 ++
frontend_qt/datawindow.cpp | 4 +-
frontend_qt/frontend_qt.pro | 2 +
frontend_qt/frontend_qt_zintdll.pro | 2 +
frontend_qt/grpTelepen.ui | 80 +++
frontend_qt/grpTelepenNum.ui | 78 +++
frontend_qt/mainWindow.ui | 3 +
frontend_qt/mainwindow.cpp | 54 ++
frontend_qt/resources.qrc | 2 +
34 files changed, 2167 insertions(+), 1155 deletions(-)
create mode 100644 docs/images/telepen_aim.svg
create mode 100644 docs/images/telepen_num_asc.svg
create mode 100644 docs/images/telepen_num_odd.svg
create mode 100644 frontend_qt/grpTelepen.ui
create mode 100644 frontend_qt/grpTelepenNum.ui
diff --git a/ChangeLog b/ChangeLog
index bc9339f5..2cd97934 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,9 @@
-Version 2.16.0.9 (dev) not released yet (2026-04-27)
+Version 2.16.0.9 (dev) not released yet (2026-05-26)
====================================================
**Incompatible changes**
------------------------
-- Code 128 now errors on unrecognized extra escape sequences
+- Code 128 now errors on unrecognised extra escape sequences
(previously just passed them through)
- Aztec error codeword percentages adjusted to be at least advertised values
(may cause symbol size change, and generation failure if specified)
@@ -13,6 +13,7 @@ Version 2.16.0.9 (dev) not released yet (2026-04-27)
option for processing GS1 input
- CLI now warns if both "--dmre" and "--square" are given
(previously silently ignored "--dmre")
+- New escape sequences `\L` (DLE), `\F` (FS), `\N` (US)
Changes
-------
@@ -20,6 +21,7 @@ Changes
`BARCODE_MEMORY_FILE` and use in GUI for pasting to clipboard instead of
creating temporary file
- CLI: allow "tiff" as filetype (saved as ".tif");
+ make args for "--scalexdimdp" and "--scmvv" optional;
add `ZINT_TEST`-only "--test" option to do various internal tests
- GS1SE: exclude GS1_128 from requisite AIs check as may be spread across more
than one barcode (ticket #348, props Harald Oehlmann and Terry Burton)
@@ -31,12 +33,17 @@ Changes
- 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)
-- DATAMATRIX: new options "--dmb256=" (`option_3 = DM_B256_START`) & "--dmc40="
+- DATAMATRIX: new options "--dmb256" (`option_3 = DM_B256_START`) & "--dmc40"
(`option_3 = DM_C40_START`) to allow forcing of initial encodation for given
no. (`option_1`) of initial characters, with 0 meaning all
- AZTEC/DATAMATRIX: add manual FNC1 support
- AUSPOST: support FCC 00 Null (DPID all zeroes) and allow variable length data
input
+- general: new escape sequences `\L` (DLE), `\F` (FS), `\N` (US)
+- TELEPEN/TELEPEN_NUM: support AIM-defined Start/Stop characters with option
+ "--vers=1" (API `option_2 = 1`)
+- TELEPEN_NUM: support switching to Full ASCII mode with DLE
+- TELEPEN: support switching to Compressed Numeric Mode with DLE if AIM enabled
Bugs
----
diff --git a/backend/aztec.c b/backend/aztec.c
index 30dddb44..00df7ec1 100644
--- a/backend/aztec.c
+++ b/backend/aztec.c
@@ -1625,7 +1625,8 @@ INTERNAL int zint_aztec(struct zint_symbol *symbol, struct zint_seg segs[], cons
return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 806, "Cannot use Extra Escape mode in GS1 mode");
}
if (reader_init) {
- return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 807, "Cannot use Reader Initialisation in Extra Escape mode");
+ return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 807,
+ "Cannot use Reader Initialisation in Extra Escape mode");
}
}
diff --git a/backend/dmatrix.c b/backend/dmatrix.c
index 6297ca15..bb28ef5c 100644
--- a/backend/dmatrix.c
+++ b/backend/dmatrix.c
@@ -1771,7 +1771,8 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
"Cannot have Structured Append and Reader Initialisation at the same time");
}
if (extra_escape_mode) {
- return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 847, "Cannot use Reader Initialisation in Extra Escape mode");
+ return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 847,
+ "Cannot use Reader Initialisation in Extra Escape mode");
}
target[tp++] = 234; /* Reader Programming */
if (debug_print) fputs("RP ", stdout);
diff --git a/backend/library.c b/backend/library.c
index d71f1d96..cea5097c 100644
--- a/backend/library.c
+++ b/backend/library.c
@@ -716,13 +716,18 @@ static int esc_base(struct zint_symbol *symbol, const unsigned char *input_strin
/* Helper to parse escape sequences. If `escaped_string` NULL, calculates length only */
static int escape_char_process(struct zint_symbol *symbol, const unsigned char *input_string, int *p_length,
unsigned char *escaped_string) {
- /* NUL EOT BEL BS HT LF VT FF CR ESC GS RS \ */
- static const char escs[] = { '0', 'E', 'a', 'b', 't', 'n', 'v', 'f', 'r', 'e', 'G', 'R', '\\', '\0' };
- static const char vals[] = { 0x00, 0x04, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x1B, 0x1D, 0x1E, 0x5C };
+ /* NOTE: if add escape character, must also update regex `escRE` in "frontend_qt/datawindow.php" */
+ static const char escs[] = {
+ /* NUL EOT BEL BS HT LF VT FF CR DLE ESC FS GS RS US \ */
+ '0', 'E', 'a', 'b', 't', 'n', 'v', 'f', 'r', 'L', 'e', 'F', 'G', 'R', 'N', '\\', '\0'
+ };
+ static const char vals[] = {
+ 0x00, 0x04, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x10, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x5C
+ };
const int length = *p_length;
int in_posn = 0, out_posn = 0;
unsigned char ch;
- int val;
+ int val, esc_posn;
int i;
unsigned int unicode;
const int extra_escape_mode = symbol->input_mode & EXTRA_ESCAPE_MODE;
@@ -736,135 +741,123 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char *
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 236, "Incomplete escape character in input");
}
ch = input_string[in_posn + 1];
- /* NOTE: if add escape character, must also update regex in "frontend_qt/datawindow.php" */
- switch (ch) {
- case '0':
- case 'E':
- case 'a':
- case 'b':
- case 't':
- case 'n':
- case 'v':
- case 'f':
- case 'r':
- case 'e':
- case 'G':
- case 'R':
- case '\\':
- if (escaped_string) escaped_string[out_posn] = vals[z_posn(escs, ch)];
- in_posn += 2;
- /* Note: if given double backslash following by caret "\\^" then will be passed through as "\^",
- i.e. the start of an extra escape sequence, avoiding the check below, so each symbology needs
- to also check themselves */
- break;
- case '^': /* Symbology specific */
- if (!extra_escape_mode || !can_extra_escape) {
- if (!extra_escape_mode) {
- return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 798,
- "Escape '\\^' only valid in Extra Escape mode");
+ if ((esc_posn = z_posn(escs, ch)) != -1) {
+ if (escaped_string) escaped_string[out_posn] = vals[esc_posn];
+ in_posn += 2;
+ /* Note: if given double backslash following by caret "\\^" then will be passed through as "\^",
+ i.e. the start of an extra escape sequence, avoiding the check below, so each symbology needs
+ to also check themselves */
+ } else {
+ switch (ch) {
+ case '^': /* Symbology specific */
+ if (!extra_escape_mode || !can_extra_escape) {
+ if (!extra_escape_mode) {
+ return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 798,
+ "Escape '\\^' only valid in Extra Escape mode");
+ }
+ return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 213,
+ "Extra escape '\\^' not valid for this symbology and/or input mode");
}
- return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 213,
- "Extra escape '\\^' not valid for this symbology and/or input mode");
- }
- /* Pass thru unaltered */
- if (escaped_string) {
- escaped_string[out_posn++] = '\\';
- escaped_string[out_posn] = '^';
- } else {
- out_posn++;
- }
- in_posn += 2;
- if (in_posn < length) { /* Note allowing '\\^' on its own at end */
+ /* Pass thru unaltered */
if (escaped_string) {
- escaped_string[++out_posn] = input_string[in_posn++];
- } else {
- ++out_posn;
- in_posn++;
- }
- }
- break;
- case '(':
- case ')':
- if (!escape_parens) {
- return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 853,
- "Escaped parentheses only valid in GS1 mode with GS1 parentheses flag");
- }
- /* Pass through unaltered */
- if (escaped_string) {
- escaped_string[out_posn++] = '\\';
- escaped_string[out_posn] = ch;
- } else {
- out_posn++;
- }
- in_posn += 2;
- break;
- case 'd':
- case 'o':
- case 'x':
- if ((val = esc_base(symbol, input_string, length, in_posn + 2, ch)) == -1) {
- return ZINT_ERROR_INVALID_DATA;
- }
- if (escaped_string) escaped_string[out_posn] = val;
- in_posn += 4 + (ch != 'x');
- break;
- case 'u':
- case 'U':
- if (in_posn + 6 > length || (ch == 'U' && in_posn + 8 > length)) {
- return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 209,
- "Incomplete '\\%c' escape sequence in input", ch);
- }
- unicode = 0;
- for (i = 0; i < 6; i++) {
- if ((val = z_ctoi(input_string[in_posn + i + 2])) == -1) {
- return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 211,
- "Invalid character for '\\%c' escape sequence in input (hexadecimal only)",
- ch);
- }
- unicode = (unicode << 4) | val;
- if (i == 3 && ch == 'u') {
- break;
- }
- }
- /* Exclude reversed BOM and surrogates and out-of-range */
- if (unicode == 0xFFFE || (unicode >= 0xD800 && unicode < 0xE000) || unicode > 0x10FFFF) {
- return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 216,
- "Value of escape sequence '%.*s' in input out of range",
- ch == 'u' ? 6 : 8, input_string + in_posn);
- }
- if (unicode < 0x80) {
- if (escaped_string) escaped_string[out_posn] = (unsigned char) unicode;
- } else if (unicode < 0x800) {
- if (escaped_string) {
- escaped_string[out_posn++] = (unsigned char) (0xC0 | (unicode >> 6));
- escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
+ escaped_string[out_posn++] = '\\';
+ escaped_string[out_posn] = '^';
} else {
out_posn++;
}
- } else if (unicode < 0x10000) {
- if (escaped_string) {
- escaped_string[out_posn++] = (unsigned char) (0xE0 | (unicode >> 12));
- escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 6) & 0x3F));
- escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
- } else {
- out_posn += 2;
+ in_posn += 2;
+ if (in_posn < length) { /* Note allowing '\\^' on its own at end */
+ if (escaped_string) {
+ escaped_string[++out_posn] = input_string[in_posn++];
+ } else {
+ ++out_posn;
+ in_posn++;
+ }
}
- } else {
- if (escaped_string) {
- escaped_string[out_posn++] = (unsigned char) (0xF0 | (unicode >> 18));
- escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 12) & 0x3F));
- escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 6) & 0x3F));
- escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
- } else {
- out_posn += 3;
+ break;
+ case '(':
+ case ')':
+ if (!escape_parens) {
+ return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 853,
+ "Escaped parentheses only valid in GS1 mode with GS1 parentheses flag");
}
- }
- in_posn += 6 + (ch == 'U') * 2;
- break;
- default:
- return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 234,
- "Unrecognised escape character '\\%c' in input",
- !z_isascii(ch) || z_iscntrl(ch) ? '?' : ch);
- break;
+ /* Pass through unaltered */
+ if (escaped_string) {
+ escaped_string[out_posn++] = '\\';
+ escaped_string[out_posn] = ch;
+ } else {
+ out_posn++;
+ }
+ in_posn += 2;
+ break;
+ case 'd':
+ case 'o':
+ case 'x':
+ if ((val = esc_base(symbol, input_string, length, in_posn + 2, ch)) == -1) {
+ return ZINT_ERROR_INVALID_DATA;
+ }
+ if (escaped_string) escaped_string[out_posn] = val;
+ in_posn += 4 + (ch != 'x');
+ break;
+ case 'u':
+ case 'U':
+ if (in_posn + 6 > length || (ch == 'U' && in_posn + 8 > length)) {
+ return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 209,
+ "Incomplete '\\%c' escape sequence in input", ch);
+ }
+ unicode = 0;
+ for (i = 0; i < 6; i++) {
+ if ((val = z_ctoi(input_string[in_posn + i + 2])) == -1) {
+ return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 211,
+ "Invalid character for '\\%c' escape sequence in input (hexadecimal only)",
+ ch);
+ }
+ unicode = (unicode << 4) | val;
+ if (i == 3 && ch == 'u') {
+ break;
+ }
+ }
+ /* Exclude reversed BOM and surrogates and out-of-range */
+ if (unicode == 0xFFFE || (unicode >= 0xD800 && unicode < 0xE000) || unicode > 0x10FFFF) {
+ return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 216,
+ "Value of escape sequence '%.*s' in input out of range",
+ ch == 'u' ? 6 : 8, input_string + in_posn);
+ }
+ if (unicode < 0x80) {
+ if (escaped_string) escaped_string[out_posn] = (unsigned char) unicode;
+ } else if (unicode < 0x800) {
+ if (escaped_string) {
+ escaped_string[out_posn++] = (unsigned char) (0xC0 | (unicode >> 6));
+ escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
+ } else {
+ out_posn++;
+ }
+ } else if (unicode < 0x10000) {
+ if (escaped_string) {
+ escaped_string[out_posn++] = (unsigned char) (0xE0 | (unicode >> 12));
+ escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 6) & 0x3F));
+ escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
+ } else {
+ out_posn += 2;
+ }
+ } else {
+ if (escaped_string) {
+ escaped_string[out_posn++] = (unsigned char) (0xF0 | (unicode >> 18));
+ escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 12) & 0x3F));
+ escaped_string[out_posn++] = (unsigned char) (0x80 | ((unicode >> 6) & 0x3F));
+ escaped_string[out_posn] = (unsigned char) (0x80 | (unicode & 0x3F));
+ } else {
+ out_posn += 3;
+ }
+ }
+ in_posn += 6 + (ch == 'U') * 2;
+ break;
+ default:
+ return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 234,
+ "Unrecognised escape character '\\%c' in input",
+ !z_isascii(ch) || z_iscntrl(ch) ? '?' : ch);
+ break;
+ }
}
} else {
if (escaped_string) escaped_string[out_posn] = input_string[in_posn];
@@ -2096,7 +2089,7 @@ float ZBarcode_Scale_From_XdimDp(int symbol_id, float x_dim_mm, float dpmm, cons
return 0.0f;
}
if (filetype && *filetype) {
- if ((i = filetype_idx(filetype)) < 0 || filetypes[i].filetype == 0) { /* Not found or TXT */
+ if ((i = filetype_idx(filetype)) < 0) { /* Not found */
return 0.0f;
}
} else {
diff --git a/backend/output.c b/backend/output.c
index d5bdb666..a5e7d8b9 100644
--- a/backend/output.c
+++ b/backend/output.c
@@ -486,8 +486,7 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
case BARCODE_TELEPEN:
case BARCODE_TELEPEN_NUM:
- /* Appears to be ~10X from diagram in Telepen Barcode Symbology information and History */
- /* TODO: Find better doc */
+ /* AIM Europe USS Telepen - 10X */
*left = *right = 10.0f;
done = 1;
break;
diff --git a/backend/telepen.c b/backend/telepen.c
index 1e170566..70982b9c 100644
--- a/backend/telepen.c
+++ b/backend/telepen.c
@@ -31,88 +31,193 @@
/* SPDX-License-Identifier: BSD-3-Clause */
/* Telepen Barcode Symbology information and History (BSiH)
- https://telepen.co.uk/wp-content/uploads/2018/10/Barcode-Symbology-information-and-History.pdf */
+ https://advanova.co.uk/wp-content/uploads/2022/05/Barcode-Symbology-information-and-History.pdf */
+/* AIM Europe USS Telepen (1991) */
#define SODIUM_X_F (IS_NUM_F | IS_UX__F | IS_LX__F) /* SODIUM "0123456789Xx" */
+#define TELE_SYMBOL_MAX 69 /* 16 * (1 (Start) + 69 + 1 (check digit) + 1 (Stop)) = 1152 */
+#define TELE_SYMBOL_MAX_S "69" /* String version of above */
+#define TELE_LENGTH_MAX 200 /* Max possible is 138 - use > for better error messages */
+
+#include
#include
#include "common.h"
-static const char TeleTable[128][16] = {
- { "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" },
- { "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" },
- { "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" },
- { "3111113131" }, { "1113133111" }, { "1311133111" }, { "111111113131" },
- { "3131113111" }, { "11313331" }, { "333331" }, { "111131113111" },
- { "31113331" }, { "1133113111" }, { "1313113111" }, { "1111113331" },
- { "31131331" }, { "113111113111" }, { "3311113111" }, { "1111131331" },
- { "311111113111" }, { "1113111331" }, { "1311111331" }, { "11111111113111" },
- { "31313311" }, { "1131311131" }, { "33311131" }, { "1111313311" },
- { "3111311131" }, { "11333311" }, { "13133311" }, { "111111311131" },
- { "31331131" }, { "1131113311" }, { "33113311" }, { "1111331131" },
- { "3111113311" }, { "1113131131" }, { "1311131131" }, { "111111113311" },
- { "3131111131" }, { "1131131311" }, { "33131311" }, { "111131111131" },
- { "3111131311" }, { "1133111131" }, { "1313111131" }, { "111111131311" },
- { "3113111311" }, { "113111111131" }, { "3311111131" }, { "111113111311" },
- { "311111111131" }, { "111311111311" }, { "131111111311" }, { "11111111111131" },
- { "3131311111" }, { "11313133" }, { "333133" }, { "111131311111" },
- { "31113133" }, { "1133311111" }, { "1313311111" }, { "1111113133" },
- { "313333" }, { "113111311111" }, { "3311311111" }, { "11113333" },
- { "311111311111" }, { "11131333" }, { "13111333" }, { "11111111311111" },
- { "31311133" }, { "1131331111" }, { "33331111" }, { "1111311133" },
- { "3111331111" }, { "11331133" }, { "13131133" }, { "111111331111" },
- { "3113131111" }, { "1131111133" }, { "33111133" }, { "111113131111" },
- { "3111111133" }, { "111311131111" }, { "131111131111" }, { "111111111133" },
- { "31311313" }, { "113131111111" }, { "3331111111" }, { "1111311313" },
- { "311131111111" }, { "11331313" }, { "13131313" }, { "11111131111111" },
- { "3133111111" }, { "1131111313" }, { "33111313" }, { "111133111111" },
- { "3111111313" }, { "111313111111" }, { "131113111111" }, { "111111111313" },
- { "313111111111" }, { "1131131113" }, { "33131113" }, { "11113111111111" },
- { "3111131113" }, { "113311111111" }, { "131311111111" }, { "111111131113" },
- { "3113111113" }, { "11311111111111" }, { "331111111111" }, { "111113111113" },
- { "31111111111111" }, { "111311111113" }, { "131111111113" },
- {'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'},
+/* Copied into "test_telepen.c" for lengths generator - see below */
+static const char TeleTable[132][16] = {
+ { "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" }, /*00-03*/
+ { "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" }, /*04-07*/
+ { "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" }, /*08-0B*/
+ { "3111113131" }, { "1113133111" }, { "1311133111" }, { "111111113131" }, /*0C-0F*/
+ { "3131113111" }, { "11313331" }, { "333331" }, { "111131113111" }, /*10-13*/
+ { "31113331" }, { "1133113111" }, { "1313113111" }, { "1111113331" }, /*14-17*/
+ { "31131331" }, { "113111113111" }, { "3311113111" }, { "1111131331" }, /*18-1B*/
+ { "311111113111" }, { "1113111331" }, { "1311111331" }, { "11111111113111" }, /*1C-1F*/
+ { "31313311" }, { "1131311131" }, { "33311131" }, { "1111313311" }, /*20-23*/
+ { "3111311131" }, { "11333311" }, { "13133311" }, { "111111311131" }, /*24-27*/
+ { "31331131" }, { "1131113311" }, { "33113311" }, { "1111331131" }, /*28-2B*/
+ { "3111113311" }, { "1113131131" }, { "1311131131" }, { "111111113311" }, /*2C-2F*/
+ { "3131111131" }, { "1131131311" }, { "33131311" }, { "111131111131" }, /*30-33*/
+ { "3111131311" }, { "1133111131" }, { "1313111131" }, { "111111131311" }, /*34-37*/
+ { "3113111311" }, { "113111111131" }, { "3311111131" }, { "111113111311" }, /*38-3B*/
+ { "311111111131" }, { "111311111311" }, { "131111111311" }, { "11111111111131" }, /*3C-3F*/
+ { "3131311111" }, { "11313133" }, { "333133" }, { "111131311111" }, /*40-43*/
+ { "31113133" }, { "1133311111" }, { "1313311111" }, { "1111113133" }, /*44-47*/
+ { "313333" }, { "113111311111" }, { "3311311111" }, { "11113333" }, /*48-4B*/
+ { "311111311111" }, { "11131333" }, { "13111333" }, { "11111111311111" }, /*4C-4F*/
+ { "31311133" }, { "1131331111" }, { "33331111" }, { "1111311133" }, /*50-53*/
+ { "3111331111" }, { "11331133" }, { "13131133" }, { "111111331111" }, /*54-57*/
+ { "3113131111" }, { "1131111133" }, { "33111133" }, { "111113131111" }, /*58-5B*/
+ { "3111111133" }, { "111311131111" }, { "131111131111" }, { "111111111133" /*START*/ }, /*5C-5F*/
+ { "31311313" }, { "113131111111" }, { "3331111111" }, { "1111311313" }, /*60-63*/
+ { "311131111111" }, { "11331313" }, { "13131313" }, { "11111131111111" }, /*64-67*/
+ { "3133111111" }, { "1131111313" }, { "33111313" }, { "111133111111" }, /*68-6B*/
+ { "3111111313" }, { "111313111111" }, { "131113111111" }, { "111111111313" }, /*6C-6F*/
+ { "313111111111" }, { "1131131113" }, { "33131113" }, { "11113111111111" }, /*70-73*/
+ { "3111131113" }, { "113311111111" }, { "131311111111" }, { "111111131113" }, /*74-77*/
+ { "3113111113" }, { "11311111111111" }, { "331111111111" /*STOP*/ }, { "111113111113" }, /*78-7B*/
+ { "31111111111111" }, { "111311111113" }, { "131111111113" }, /*7C-7E*/
+ {'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'}, /*7F*/
+ { "111111113113" /*START 2*/ }, { "311311111111" /*STOP 2*/ }, /*80-81*/
+ { "111111311113" /*START 3*/ }, { "311113111111" /*STOP 3*/ }, /*82-83*/
};
/* Generated by "backend/tests/test_telepen -f generate_lens -g" */
static const char TeleLens[128] = {
- 8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12,
- 10, 8, 6, 12, 8, 10, 10, 10, 8, 12, 10, 10, 12, 10, 10, 14,
- 8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12,
- 10, 10, 8, 12, 10, 10, 10, 12, 10, 12, 10, 12, 12, 12, 12, 14,
- 10, 8, 6, 12, 8, 10, 10, 10, 6, 12, 10, 8, 12, 8, 8, 14,
- 8, 10, 8, 10, 10, 8, 8, 12, 10, 10, 8, 12, 10, 12, 12, 12,
- 8, 12, 10, 10, 12, 8, 8, 14, 10, 10, 8, 12, 10, 12, 12, 12,
- 12, 10, 8, 14, 10, 12, 12, 12, 10, 14, 12, 12, 14, 12, 12, 16
+ 8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12, /*00-0F*/
+ 10, 8, 6, 12, 8, 10, 10, 10, 8, 12, 10, 10, 12, 10, 10, 14, /*10-1F*/
+ 8, 10, 8, 10, 10, 8, 8, 12, 8, 10, 8, 10, 10, 10, 10, 12, /*20-2F*/
+ 10, 10, 8, 12, 10, 10, 10, 12, 10, 12, 10, 12, 12, 12, 12, 14, /*30-3F*/
+ 10, 8, 6, 12, 8, 10, 10, 10, 6, 12, 10, 8, 12, 8, 8, 14, /*40-4F*/
+ 8, 10, 8, 10, 10, 8, 8, 12, 10, 10, 8, 12, 10, 12, 12, 12, /*50-5F*/
+ 8, 12, 10, 10, 12, 8, 8, 14, 10, 10, 8, 12, 10, 12, 12, 12, /*60-6F*/
+ 12, 10, 8, 14, 10, 12, 12, 12, 10, 14, 12, 12, 14, 12, 12, 16 /*70-7F*/
};
+/* Expand numeric data */
+static char *tele_num(struct zint_symbol *symbol, const unsigned char source[], const int length, int i, char *d,
+ int *p_count) {
+ assert((length & 1) == (i & 1));
+ for (; i < length; i += 2) {
+ int glyph;
+ if (source[i] == 'X') {
+ (void) z_errtxtf(0, symbol, 394, "Invalid odd position %d of \"X\" in Telepen data", i + 1);
+ return NULL;
+ }
+ glyph = source[i + 1] == 'X' ? z_ctoi(source[i]) + 17 : 10 * z_ctoi(source[i]) + z_ctoi(source[i + 1]) + 27;
+ *p_count += glyph;
+ memcpy(d, TeleTable[glyph], TeleLens[glyph]);
+ d += TeleLens[glyph];
+ }
+ return d;
+}
+
+/* Set height according to various Telepen docs and AIM USS Telepen (1991) */
+static int tele_set_height(struct zint_symbol *symbol, const int asc_length, const int num_length,
+ const int have_dle) {
+ int warn_number = 0;
+
+ assert(asc_length > 0 || num_length > 0);
+ assert(!(num_length & 1));
+
+ if (symbol->output_options & COMPLIANT_HEIGHT) {
+ /* Following based on various Telepen docs and USS Telepen Section 3.2 Dimensions.
+ Recommended X between 0.01" & 0.0125" (0.254mm & 0.3175mm), so average is 0.01125" (0.28575mm).
+ Default height based on default 26pt at average X 0.01125" is then (26 / 72) / 0.01125 ~ 32X.
+ Per USS Telepen min height is 6.35mm or 15% of the symbol length whichever is greater, with
+ symbol length calculated as 16 * X * (3 + C + D/2 + S) + 2Q where
+ C is ASCII count, D numeric count, S whether have DLE or not, and Q quiet zone width (10X).
+ As don't have max X, use 15% as min height */
+ const float mult = 0.4584f; /* 0.191 * 16 * 15% */
+ const float min_height = z_stripf(mult * (3.0f + asc_length + num_length / 2 + have_dle) + 3.0f /*20*15%*/);
+ if (symbol->debug & ZINT_DEBUG_PRINT) printf("Min height: %.8g\n", min_height);
+ warn_number = z_set_height(symbol, min_height, min_height > 32.0f ? min_height : 32.0f, 0, 0 /*no_errtxt*/);
+ } else {
+ (void) z_set_height(symbol, 0.0f, 50.0f, 0, 1 /*no_errtxt*/);
+ }
+ return warn_number;
+}
+
+/* Telepen Alpha (Full ASCII) */
INTERNAL int zint_telepen(struct zint_symbol *symbol, unsigned char source[], int length) {
- int i, count, check_digit;
+ int count, check_digit;
int error_number;
+ int i;
+ int symbol_chars = length;
char dest[1145]; /* 12 (Start) + 69 * 16 (max for DELs) + 16 (Check) + 12 (stop) + 1 = 1145 */
char *d = dest;
+ unsigned char local_source[138];
+ int asc_length = length, num_length = 0, have_dle = 0;
+ const int asc_comp_num = symbol->option_2 == 1; /* AIM Full ASCII + Compressed Numeric mode */
const int content_segs = symbol->output_options & BARCODE_CONTENT_SEGS;
- error_number = 0;
-
- count = 0;
-
- if (length > 69) { /* 16 (Start) + 69 * 16 + 16 (Check) + 16 (Stop) = 1152 */
- return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 390, "Input length %d too long (maximum 69)", length);
+ /* Check for DLE (Compressed Numeric tail) only if AIM mode enabled */
+ if (asc_comp_num && length <= TELE_LENGTH_MAX) {
+ for (i = 0; i < length; i++) {
+ if (source[i] == 0x10 /*DLE*/) {
+ if (i == 0) {
+ return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 397,
+ "DLE (ASCII 16) cannot be first character in Full ASCII + Compressed Numeric Mode");
+ }
+ asc_length = i + 1; /* Include DLE */
+ num_length = length - asc_length;
+ symbol_chars = asc_length + ((num_length + 1) >> 1);
+ have_dle = 1;
+ break;
+ }
+ }
}
+
+ if (symbol_chars > TELE_SYMBOL_MAX) {
+ if (length <= TELE_LENGTH_MAX) {
+ return ZEXT z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 390,
+ "Input length %1$d too long, requires %2$d symbol characters (maximum "
+ TELE_SYMBOL_MAX_S ")", length, symbol_chars);
+ }
+ return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 399,
+ "Input length %d too long, requires too many symbol characters (maximum "
+ TELE_SYMBOL_MAX_S ")", length);
+ }
+
/* Start character */
- memcpy(d, TeleTable['_'], 12);
+ memcpy(d, TeleTable[asc_comp_num ? 0x82 : 0x5F], 12);
d += 12;
- for (i = 0; i < length; i++) {
- if (!z_isascii(source[i])) {
+ count = 0;
+ for (i = 0; i < asc_length; i++) {
+ const unsigned char ch = source[i];
+ if (!z_isascii(ch)) {
/* Cannot encode extended ASCII */
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 391,
"Invalid character at position %d in input, extended ASCII not allowed", i + 1);
}
- memcpy(d, TeleTable[source[i]], TeleLens[source[i]]);
- d += TeleLens[source[i]];
- count += source[i];
+ memcpy(d, TeleTable[ch], TeleLens[ch]);
+ d += TeleLens[ch];
+ count += ch;
+ }
+ if (num_length) {
+ /* Compressed Numeric Mode tail */
+ if ((i = z_not_sane(SODIUM_X_F, source + asc_length, num_length))) {
+ return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 396,
+ "Invalid character at position %d in input (digits and \"X\" only)", asc_length + i);
+ }
+
+ memcpy(local_source, source, asc_length - 1); /* Exclude DLE */
+ /* Add a leading zero if required */
+ if (num_length & 1) {
+ local_source[asc_length - 1] = '0'; /* Replaces DLE */
+ memcpy(local_source + asc_length, source + asc_length, num_length++);
+ } else {
+ memcpy(local_source + asc_length - 1, source + asc_length, num_length);
+ length--; /* Less DLE */
+ }
+ asc_length--; /* Less DLE */
+ z_to_upper(local_source + asc_length, num_length);
+
+ if (!(d = tele_num(symbol, local_source, length, asc_length, d, &count))) {
+ return ZINT_ERROR_INVALID_DATA;
+ }
}
check_digit = 127 - (count % 127);
@@ -125,76 +230,110 @@ INTERNAL int zint_telepen(struct zint_symbol *symbol, unsigned char source[], in
if (symbol->debug & ZINT_DEBUG_PRINT) printf("Check digit: %d\n", check_digit);
/* Stop character */
- memcpy(d, TeleTable['z'], 12);
+ memcpy(d, TeleTable[asc_comp_num ? 0x83 : 0x7A], 12);
d += 12;
z_expand(symbol, dest, (int) (d - dest));
- if (symbol->output_options & COMPLIANT_HEIGHT) {
- /* Default height from various Telepen docs is based on default 26pt at X 0.01125"
- (average of 0.01" - 0.0125") = (26 / 72) / 0.01125 ~ 32; no min height specified */
- (void) z_set_height(symbol, 0.0f, 32.0f, 0, 1 /*no_errtxt*/);
+ error_number = tele_set_height(symbol, asc_length, num_length, have_dle);
+
+ if (num_length) {
+ z_hrt_cpy_iso8859_1(symbol, local_source, length); /* `local_source` HRT-ready */
} else {
- (void) z_set_height(symbol, 0.0f, 50.0f, 0, 1 /*no_errtxt*/);
+ /* Chop off any trailing DLE if Full ASCII + Compressed Numeric mode */
+ z_hrt_cpy_iso8859_1(symbol, source, length - (asc_comp_num && source[length - 1] == 0x10));
}
- z_hrt_cpy_iso8859_1(symbol, source, length);
-
- if (content_segs && z_ct_cpy_cat(symbol, source, length, (char) check_digit, NULL /*cat*/, 0)) {
- return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
+ if (content_segs) {
+ if (asc_length < length) {
+ local_source[length++] = check_digit;
+ if (z_ct_cpy_cat(symbol, source, asc_length, '\x10' /*DLE*/,
+ local_source + asc_length, length - asc_length)) {
+ return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
+ }
+ } else if (z_ct_cpy_cat(symbol, source, length, (char) check_digit, NULL /*cat*/, 0)) {
+ return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
+ }
}
return error_number;
}
+/* Telepen Numeric (Compressed Numeric Mode) */
INTERNAL int zint_telepen_num(struct zint_symbol *symbol, unsigned char source[], int length) {
- int count, check_digit, glyph;
+ int count, check_digit;
int error_number = 0;
int i;
- char dest[1129]; /* 12 (Start) + 68 * 16 (max for DELs) + 16 (Check) + 12 (Stop) + 1 = 1129 */
+ int symbol_chars = (length + 1) >> 1;
+ char dest[1145]; /* 12 (Start) + 69 * 16 (max for DELs) + 16 (Check) + 12 (stop) + 1 = 1145 */
char *d = dest;
- unsigned char local_source[137];
+ unsigned char local_source[136 + 1 + 1];
+ int num_length = length, have_dle = 0;
+ const int comp_num_asc = symbol->option_2 == 1; /* AIM Compressed Numeric + Full ASCII mode */
const int content_segs = symbol->output_options & BARCODE_CONTENT_SEGS;
- count = 0;
-
- if (length > 136) { /* 68*2 */
- return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 392, "Input length %d too long (maximum 136)", length);
+ /* Check for DLE (Full ASCII tail) whether AIM mode or not */
+ if (length <= TELE_LENGTH_MAX) { /* Max possible is 138 digits */
+ for (i = 0; i < length; i++) {
+ if (source[i] == 0x10 /*DLE*/) {
+ if (i == 0) {
+ return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 398,
+ "DLE (ASCII 16) cannot be first character in Compressed Numeric Mode");
+ }
+ num_length = i; /* DLE not counted */
+ symbol_chars = length - num_length + ((num_length + 1) >> 1);
+ have_dle = 1;
+ break;
+ }
+ }
}
- if ((i = z_not_sane(SODIUM_X_F, source, length))) {
+
+ if (symbol_chars > TELE_SYMBOL_MAX) {
+ if (length <= TELE_LENGTH_MAX) {
+ return ZEXT z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 392,
+ "Input length %1$d too long, requires %2$d symbol characters (maximum "
+ TELE_SYMBOL_MAX_S ")", length, symbol_chars);
+ }
+ return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 400,
+ "Input length %d too long, requires too many symbol characters (maximum "
+ TELE_SYMBOL_MAX_S ")", length);
+ }
+
+ if ((i = z_not_sane(SODIUM_X_F, source, num_length))) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 393,
"Invalid character at position %d in input (digits and \"X\" only)", i);
}
/* Add a leading zero if required */
- if (length & 1) {
+ if (num_length & 1) {
memcpy(local_source + 1, source, length++);
local_source[0] = '0';
+ num_length++;
} else {
memcpy(local_source, source, length);
}
- z_to_upper(local_source, length);
+ z_to_upper(local_source, num_length);
/* Start character */
- memcpy(d, TeleTable['_'], 12);
+ memcpy(d, TeleTable[comp_num_asc ? 0x80 : 0x5F], 12);
d += 12;
- for (i = 0; i < length; i += 2) {
- if (local_source[i] == 'X') {
- return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 394, "Invalid odd position %d of \"X\" in Telepen data",
- i + 1);
+ count = 0;
+ if (!(d = tele_num(symbol, local_source, num_length, 0 /*i*/, d, &count))) {
+ return ZINT_ERROR_INVALID_DATA;
+ }
+ for (i = num_length; i < length; i++) {
+ /* Full ASCII tail */
+ const unsigned char ch = local_source[i];
+ assert(i > num_length || ch == '\x10'); /* 1st char DLE */
+ if (!z_isascii(ch)) {
+ /* Cannot encode extended ASCII */
+ return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 395,
+ "Invalid character at position %d in input, extended ASCII not allowed", i + 1);
}
-
- if (local_source[i + 1] == 'X') {
- glyph = z_ctoi(local_source[i]) + 17;
- count += glyph;
- } else {
- glyph = 10 * z_ctoi(local_source[i]) + z_ctoi(local_source[i + 1]);
- glyph += 27;
- count += glyph;
- }
- memcpy(d, TeleTable[glyph], TeleLens[glyph]);
- d += TeleLens[glyph];
+ memcpy(d, TeleTable[ch], TeleLens[ch]);
+ d += TeleLens[ch];
+ count += ch;
}
check_digit = 127 - (count % 127);
@@ -207,21 +346,31 @@ INTERNAL int zint_telepen_num(struct zint_symbol *symbol, unsigned char source[]
if (symbol->debug & ZINT_DEBUG_PRINT) printf("Check digit: %d\n", check_digit);
/* Stop character */
- memcpy(d, TeleTable['z'], 12);
+ memcpy(d, TeleTable[comp_num_asc ? 0x81 : 0x7A], 12);
d += 12;
z_expand(symbol, dest, (int) (d - dest));
- if (symbol->output_options & COMPLIANT_HEIGHT) {
- (void) z_set_height(symbol, 0.0f, 32.0f, 0, 1 /*no_errtxt*/); /* Same as alphanumeric Telepen */
+ error_number = tele_set_height(symbol, length - num_length /*asc_length*/, num_length, have_dle);
+
+ if (num_length < length) {
+ /* Omit DLE */
+ z_hrt_cpy_cat_nochk(symbol, local_source, num_length, '\xFF' /*separator (none)*/,
+ local_source + num_length + 1, length - (num_length + 1));
} else {
- (void) z_set_height(symbol, 0.0f, 50.0f, 0, 1 /*no_errtxt*/);
+ z_hrt_cpy_nochk(symbol, local_source, length);
}
- z_hrt_cpy_nochk(symbol, local_source, length);
-
- if (content_segs && z_ct_cpy_cat(symbol, local_source, length, (char) check_digit, NULL /*cat*/, 0)) {
- return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
+ if (content_segs) {
+ if (num_length < length) {
+ local_source[length++] = check_digit;
+ if (z_ct_cpy_cat(symbol, local_source, num_length, '\xFF' /*separator (none)*/,
+ local_source + num_length, length - num_length)) {
+ return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
+ }
+ } else if (z_ct_cpy_cat(symbol, local_source, length, (char) check_digit, NULL /*cat*/, 0)) {
+ return ZINT_ERROR_MEMORY; /* `z_ct_cpy_cat()` only fails with OOM */
+ }
}
return error_number;
diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c
index 8af660f5..0d91f9d4 100644
--- a/backend/tests/test_library.c
+++ b/backend/tests/test_library.c
@@ -256,7 +256,7 @@ static void test_checks(const testCtx *const p_ctx) {
symbol->warn_level = data[i].warn_level;
}
- ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%d) ret %d != %d (%s)\n",
i, data[i].symbology, ret, data[i].ret, symbol->errtxt);
@@ -298,18 +298,18 @@ static void test_checks_segs(const testCtx *const p_ctx) {
/* 0*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 205: No input data" },
/* 1*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 257, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 771: Too many input segments (maximum 256)" },
/* 2*/ { BARCODE_CODE128, -1, { { NULL, 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 0 source NULL" },
- /* 3*/ { BARCODE_CODE128, -1, { { TU(""), 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 778: No input data" },
- /* 4*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 0 }, { NULL, 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 1 source NULL" },
- /* 5*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 0 }, { TU(""), 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 773: Input segment 1 empty" },
- /* 6*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 0 } }, 2, -1, 4, -1, ZINT_ERROR_INVALID_OPTION, "Error 774: Symbol ECI '4' must match segment zero ECI '3'" },
- /* 7*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 775: Symbology does not support multiple segments" },
- /* 8*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching" },
- /* 9*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 1 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: ECI code '1' out of range (0 to 999999, excluding 1, 2, 14 and 19)" },
- /* 10*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, GS1_MODE, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 776: GS1 mode not supported for multiple segments" },
- /* 11*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("\200"), 0, 4 } }, 2, UNICODE_MODE, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 215: Invalid UTF-8 in input" },
- /* 12*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, -1, -1, -1, 0, "" },
- /* 13*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 0 }, { TU("B"), 0, 4 } }, 2, -1, 3, -1, 0, "" },
- /* 14*/ { BARCODE_AZTEC, -1, { { TU("A"), ZINT_MAX_DATA_LEN, 3 }, { TU("B"), 1, 4 } }, 2, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 214: Input too long" },
+ /* 3*/ { BARCODE_CODE128, -1, { { ZUCP(""), 0, 0 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 778: No input data" },
+ /* 4*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 0 }, { NULL, 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 772: Input segment 1 source NULL" },
+ /* 5*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 0 }, { ZUCP(""), 0, 0 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 773: Input segment 1 empty" },
+ /* 6*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 0 } }, 2, -1, 4, -1, ZINT_ERROR_INVALID_OPTION, "Error 774: Symbol ECI '4' must match segment zero ECI '3'" },
+ /* 7*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 4 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 775: Symbology does not support multiple segments" },
+ /* 8*/ { BARCODE_CODE128, -1, { { ZUCP("A"), 0, 3 }, { NULL, 0, 0 } }, 1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching" },
+ /* 9*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 1 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: ECI code '1' out of range (0 to 999999, excluding 1, 2, 14 and 19)" },
+ /* 10*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 4 } }, 2, GS1_MODE, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 776: GS1 mode not supported for multiple segments" },
+ /* 11*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("\200"), 0, 4 } }, 2, UNICODE_MODE, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 215: Invalid UTF-8 in input" },
+ /* 12*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 3 }, { ZUCP("B"), 0, 4 } }, 2, -1, -1, -1, 0, "" },
+ /* 13*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), 0, 0 }, { ZUCP("B"), 0, 4 } }, 2, -1, 3, -1, 0, "" },
+ /* 14*/ { BARCODE_AZTEC, -1, { { ZUCP("A"), ZINT_MAX_DATA_LEN, 3 }, { ZUCP("B"), 1, 4 } }, 2, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 214: Input too long" },
};
const int data_size = ARRAY_SIZE(data);
int i, ret;
@@ -393,7 +393,7 @@ static void test_input_data(const testCtx *const p_ctx) {
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug);
- ret = ZBarcode_Encode(symbol, TCU(text), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%d) ret %d != %d (%s)\n",
i, data[i].symbology, ret, data[i].ret, symbol->errtxt);
@@ -579,7 +579,7 @@ static void test_symbologies(const testCtx *const p_ctx) {
if (testContinue(p_ctx, i)) continue;
symbol->symbology = i;
- ret = ZBarcode_Encode(symbol, TCU(""), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(""), 0);
assert_notequal(ret, ZINT_ERROR_ENCODING_PROBLEM, "i:%d Encoding problem (%s)\n", i, symbol->errtxt);
if (!ZBarcode_ValidID(i)) {
@@ -654,7 +654,7 @@ static void test_input_mode(const testCtx *const p_ctx) {
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
data[i].data, -1, debug);
- ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt);
assert_equal(symbol->input_mode, data[i].expected_input_mode, "i:%d symbol->input_mode %d != %d\n",
@@ -684,115 +684,146 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
const char *comment;
};
static const struct item data[] = {
- /* 0*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 26, "01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F EB 02 5D 81 21 0D 92 2E 3D FD B6 9A 37 2A CD 61 FB 95", 0, "" },
- /* 1*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 101, "(45) 67 62 43 40 44 47 48 29 6A 67 62 0B 49 4A 4B 4C 18 6A 67 62 0C 4D 5B 5D 5E 62 6A 67", 0, "" },
- /* 2*/ { BARCODE_CODE16K, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 70, "(20) 14 64 68 71 72 73 74 75 76 77 91 93 94 101 65 60 103 103 45 61", 0, "" },
- /* 3*/ { BARCODE_DOTCODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 28, "65 40 44 47 48 49 4A 4B 4C 4D 5B 5D 5E 6E 41 3C 6A", 0, "" },
- /* 4*/ { BARCODE_GRIDMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 30, "30 1A 00 02 01 61 00 48 28 16 0C 06 46 63 51 74 05 38 00", 0, "" },
- /* 5*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 20 E8 F4 0A E0 00", 0, "" },
- /* 6*/ { BARCODE_MAXICODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 30, "(144) 04 3E 3E 00 04 07 08 09 0A 0B 03 3D 2C 24 19 1E 23 1B 18 0E 0C 0D 1E 3F 1D 1E 3C 31", 0, "" },
- /* 7*/ { BARCODE_PDF417, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 120, "(24) 16 901 0 23 655 318 98 18 461 639 893 122 129 92 900 900 872 438 359 646 522 773 831", 0, "" },
- /* 8*/ { BARCODE_ULTRA, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 20, "(28) 257 17 262 228 6 273 193 226 91 24 283 4 0 4 7 8 9 10 11 12 13 27 29 30 129 92 284 7", 0, "" },
- /* 9*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", "", 0, 18, "(32) 01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F E7 32 45 DB 70 5D E3 16 7B 2B 44 60 E1 55 F7 08", 0, "" },
- /* 10*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 30 E8 F4 0C 0C 0A E0 00 00 00", 0, "" },
+ /* 0*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 18, "(32) 01 05 08 09 0A 0B 0C 0D 0E 11 1C 1D 1E 1F 20 EB 02 5D EE 69 A6 C6 63 7C FC 73 CE F7", 0, "" },
+ /* 1*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 101, "(54) 67 62 44 40 44 47 48 2B 6A 67 62 0B 49 4A 4B 4C 18 6A 67 62 0C 4D 50 5B 5C 20 6A 67", 0, "" },
+ /* 2*/ { BARCODE_CODE16K, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 70, "(25) 21 64 68 71 72 73 74 75 76 77 80 91 92 93 94 95 101 65 60 103 103 103 103 38 59", 0, "" },
+ /* 3*/ { BARCODE_DOTCODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 29, "65 40 44 47 48 49 4A 4B 4C 4D 50 5B 5C 5D 5E 5F 6E 41 3C", 0, "" },
+ /* 4*/ { BARCODE_GRIDMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 30, "30 20 00 02 01 61 00 48 28 16 0C 06 44 03 31 60 74 3C 1F 40 57 00", 0, "" },
+ /* 5*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 41 BF CC 00 C3 83 A3 C3 F0 2B 80 00 00", 0, "" },
+ /* 6*/ { BARCODE_MAXICODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 30, "(144) 04 3E 3E 00 04 07 08 09 0A 0B 03 3D 2C 24 19 1E 23 1B 18 0E 0C 0D 10 1E 20 21 22 23", 0, "" },
+ /* 7*/ { BARCODE_PDF417, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 120, "(27) 19 901 0 23 655 318 98 18 461 639 91 512 29 30 31 129 92 900 900 114 476 670 717 35", 0, "" },
+ /* 8*/ { BARCODE_ULTRA, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\", "", 0, 22, "(30) 257 20 227 30 152 79 176 10 152 27 283 4 0 4 7 8 9 10 11 12 13 16 27 28 29 30 31 129", 0, "" },
+ /* 9*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\d129\\o201\\\\", "", 0, 20, "(40) 01 05 08 09 0A 0B 0C 0D 0E 11 1C 1D 1E 1F 20 E7 F2 06 9C 31 5D 81 AE E5 8D 14 8D 36", 0, "" },
+ /* 10*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\d129\\o201\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 41 BF CC 01 03 83 A3 C3 F0 30 30 2B 80", 0, "" },
/* 11*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input", 0, "" },
- /* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", "", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input", 0, "" },
- /* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" },
- /* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" },
- /* 15*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\x1g' in input (hexadecimal only)", 0, "" },
- /* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" },
- /* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" },
- /* 18*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" },
- /* 19*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12a", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\d12a' in input (decimal only)", 0, "" },
- /* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d256", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\d256' in input out of range (000 to 255)", 0, "" },
- /* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" },
- /* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" },
- /* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" },
- /* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o128", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\o128' in input (octal only)", 0, "" },
- /* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o400", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\o400' in input out of range (000 to 377)", 0, "" },
- /* 26*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xA01\\xFF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 0, "" },
- /* 27*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1601\\d255", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
- /* 28*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o2401\\o377", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
- /* 29*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00A01\\u00FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
- /* 30*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000A01\\U0000FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
- /* 31*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xc3\\xbF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 0, "" },
- /* 32*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d195\\d191", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
- /* 33*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o303\\o277", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
- /* 34*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
- /* 35*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
- /* 36*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\xc3\\xbF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 0, "" },
- /* 37*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\d195\\d191", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
- /* 38*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\o303\\o277", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
- /* 39*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
- /* 40*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
- /* 41*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
- /* 42*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
- /* 43*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
- /* 44*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
- /* 45*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
- /* 46*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Invalid character for '\\u' escape sequence in input (hexadecimal only)", 0, "" },
- /* 47*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\ufffe' in input out of range", 0, "Reversed BOM" },
- /* 48*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\ud800' in input out of range", 0, "Surrogate" },
- /* 49*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\udfff' in input out of range", 0, "Surrogate" },
- /* 50*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uffff", "", 0, 12, "E7 2C B0 16 AB A1 1F 85 EB 50 A1 4C", 0, "" },
- /* 51*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\xE2\\x82\\xAC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 0, "Zint manual 4.10 Ex1" },
- /* 52*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\u20AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
- /* 53*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\U0020AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
- /* 54*/ { BARCODE_DATAMATRIX, DATA_MODE, 17, "\\xA4", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
- /* 55*/ { BARCODE_DATAMATRIX, DATA_MODE, 28, "\\xB1\\x60", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 0, "Zint manual 4.10 Ex2" },
- /* 56*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\u5E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
- /* 57*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\U005E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
- /* 58*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
- /* 59*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U00007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
- /* 60*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
- /* 61*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
- /* 62*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
- /* 63*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
- /* 64*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
- /* 65*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
- /* 66*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Reversed BOM" },
- /* 67*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" },
- /* 68*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" },
- /* 69*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
- /* 70*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
- /* 71*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U110000", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\U110000' in input out of range", 0, "" },
- /* 72*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 25, "\\U10FFFF", "", 0, 14, "F1 1A E7 57 C7 81 F7 AC 09 06 28 51 F3 00 E1 8C 2A 1C", 0, "" },
- /* 73*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 26, "\\U10FFFF", "", 0, 14, "F1 1B E7 57 E0 11 D7 6C 4F 45 E2 B3 FF F1 72 AB 54 9F", 0, "" },
- /* 74*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 32, "\\U10FFFF", "", 0, 14, "F1 21 EB 64 33 EB 1B 36 1D F7 B1 6D 8C A6 34 64 19 3A", 0, "" },
- /* 75*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 33, "\\U10FFFF", "", 0, 14, "F1 22 E7 57 EB 5D 17 8C C1 B0 B6 B2 53 78 E4 7D 61 CB", 0, "" },
- /* 76*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 34, "\\U10FFFF", "", 0, 14, "F1 23 01 11 EB 80 EB 80 90 33 51 1B FA AE 78 F7 05 44", 0, "" },
- /* 77*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 35, "\\U10FFFF", "", 0, 14, "F1 24 EB 80 EB 80 11 01 17 BA C6 05 9F 4C EA E5 18 31", 0, "" },
- /* 78*/ { BARCODE_GS1_128_CC, GS1_MODE, -1, "[20]10", "[10]A", 0, 99, "(7) 105 102 20 10 100 59 106", 0, "" },
- /* 79*/ { BARCODE_GS1_128_CC, GS1_MODE, -1, "[2\\x30]1\\d048", "[\\x310]\\x41", 0, 99, "(7) 105 102 20 10 100 59 106", 1, "" },
- /* 80*/ { BARCODE_AZTEC, DATA_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
- /* 81*/ { BARCODE_AZTEC, GS1_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
- /* 82*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", 0, 15, "(102) 31 31 30 30 31 31 30 31 31 31 30 30 31 31 30 30 31 31 30 31 30 30 31 30 30 30 30 30", 0, "" },
- /* 83*/ { BARCODE_AZTEC, DATA_MODE, -1, "\\\\^11", "", 0, 15, "(102) 30 31 31 30 31 31 31 30 31 31 30 30 31 31 31 31 30 31 31 30 31 31 30 30 31 31 31 31", 0, "Note double-backslash caret passed thru as backslash caret but does not error in non-EXTRA_ESCAPE_MODE, treated literally" },
- /* 84*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^11", "", 0, 15, "(102) 31 31 30 30 31 31 30 31 31 31 30 30 31 31 30 30 31 31 30 31 30 30 31 30 30 30 30 30", 0, "Treated as backslash caret 1 (FNC1)" },
- /* 85*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^A\"", 0, "" },
- /* 86*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
- /* 87*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
- /* 88*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", 0, 10, "E8 32 81 98 94 7B 7F 6D", 0, "" },
- /* 89*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^A\"", 0, "" },
- /* 90*/ { BARCODE_DATAMATRIX, GS1_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 213: Extra escape '\\^' not valid for this symbology and/or input mode", 0, "Not allowed of DATAMATRIX in GS1_MODE" },
- /* 91*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\\\^11", "", 0, 10, "5D 5F 8D 5C FB D1 69 3F", 0, "Note double-backslash caret passed thru as backslash caret but does not error in non-EXTRA_ESCAPE_MODE, treated literally" },
- /* 92*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^11", "", 0, 10, "E8 32 81 98 94 7B 7F 6D", 0, "Treated as backslash caret 1 (FNC1)" },
- /* 93*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^B2", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^B\"", 0, "Passed thru as backslash caret B" },
- /* 94*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 18, "A\\^1B", "", 0, 12, "42 E8 F1 13 43 F5 A4 26 80 68 7A AD", 0, "" },
- /* 95*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 20, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
- /* 96*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 20, "バ\\^1ーコ\\^1ード\\^1東京\\^1都", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
- /* 97*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 25, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
- /* 98*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 33, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
- /* 99*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 170, "A\\^1B", "", ZINT_ERROR_INVALID_DATA, 0, "Error 244: Invalid character in input for ECI '170'", 0, "" },
- /*100*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 899, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
- /*101*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\w", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\w' in input", 0, "" },
- /*102*/ { BARCODE_CODE128, DATA_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
- /*103*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "" },
- /*104*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^", "", 0, 57, "(5) 104 60 62 82 106", 0, "Partial special escape '\\^' at end allowed" },
- /*105*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^D1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 348: Unrecognized extra escape \"\\^D\"", 0, "" },
- /*106*/ { BARCODE_CODE128, DATA_MODE, -1, "\\\\^A1", "", 0, 79, "(7) 104 60 62 33 17 43 106", 0, "Treated as literal backslash caret A" },
- /*107*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "Treated as backslash caret A (manual Code Set A)" },
- /*108*/ { BARCODE_CODE128, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input", 0, "" },
+ /* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\g", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\g' in input", 0, "" },
+ /* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\h", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\h' in input", 0, "" },
+ /* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\i", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\i' in input", 0, "" },
+ /* 15*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\j", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\j' in input", 0, "" },
+ /* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\k", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\k' in input", 0, "" },
+ /* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\l", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\l' in input", 0, "" },
+ /* 18*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\m", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\m' in input", 0, "" },
+ /* 19*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\p", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\p' in input", 0, "" },
+ /* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\q", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\q' in input", 0, "" },
+ /* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\s", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\s' in input", 0, "" },
+ /* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\w", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\w' in input", 0, "" },
+ /* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\y", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\y' in input", 0, "" },
+ /* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\z", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\z' in input", 0, "" },
+ /* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\A", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\A' in input", 0, "" },
+ /* 26*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\B", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\B' in input", 0, "" },
+ /* 27*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\C", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\C' in input", 0, "" },
+ /* 28*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\D", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\D' in input", 0, "" },
+ /* 29*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\H", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\H' in input", 0, "" },
+ /* 30*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\I", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\I' in input", 0, "" },
+ /* 31*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\J", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\J' in input", 0, "" },
+ /* 32*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\K", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\K' in input", 0, "" },
+ /* 33*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\M", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\M' in input", 0, "" },
+ /* 34*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\O", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\O' in input", 0, "" },
+ /* 35*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\P", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\P' in input", 0, "" },
+ /* 36*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Q", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\Q' in input", 0, "" },
+ /* 37*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\S", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\S' in input", 0, "" },
+ /* 38*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\T", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\T' in input", 0, "" },
+ /* 39*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\V", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\V' in input", 0, "" },
+ /* 40*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\W", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\W' in input", 0, "" },
+ /* 41*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\X", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\X' in input", 0, "" },
+ /* 42*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Y", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\Y' in input", 0, "" },
+ /* 43*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Z", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\Z' in input", 0, "" },
+ /* 44*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", "", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input", 0, "" },
+ /* 45*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" },
+ /* 46*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input", 0, "" },
+ /* 47*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\x1g' in input (hexadecimal only)", 0, "" },
+ /* 48*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" },
+ /* 49*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" },
+ /* 50*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input", 0, "" },
+ /* 51*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12a", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\d12a' in input (decimal only)", 0, "" },
+ /* 52*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d256", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\d256' in input out of range (000 to 255)", 0, "" },
+ /* 53*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" },
+ /* 54*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" },
+ /* 55*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input", 0, "" },
+ /* 56*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o128", "", ZINT_ERROR_INVALID_DATA, 0, "Error 238: Invalid character in escape sequence '\\o128' in input (octal only)", 0, "" },
+ /* 57*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o400", "", ZINT_ERROR_INVALID_DATA, 0, "Error 237: Value of escape sequence '\\o400' in input out of range (000 to 377)", 0, "" },
+ /* 58*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xA01\\xFF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 0, "" },
+ /* 59*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1601\\d255", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
+ /* 60*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o2401\\o377", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
+ /* 61*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00A01\\u00FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
+ /* 62*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000A01\\U0000FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
+ /* 63*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xc3\\xbF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 0, "" },
+ /* 64*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d195\\d191", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
+ /* 65*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o303\\o277", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
+ /* 66*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
+ /* 67*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
+ /* 68*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\xc3\\xbF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 0, "" },
+ /* 69*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\d195\\d191", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
+ /* 70*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\o303\\o277", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
+ /* 71*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
+ /* 72*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
+ /* 73*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
+ /* 74*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
+ /* 75*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
+ /* 76*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
+ /* 77*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input", 0, "" },
+ /* 78*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Invalid character for '\\u' escape sequence in input (hexadecimal only)", 0, "" },
+ /* 79*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\ufffe' in input out of range", 0, "Reversed BOM" },
+ /* 80*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\ud800' in input out of range", 0, "Surrogate" },
+ /* 81*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\udfff' in input out of range", 0, "Surrogate" },
+ /* 82*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uffff", "", 0, 12, "E7 2C B0 16 AB A1 1F 85 EB 50 A1 4C", 0, "" },
+ /* 83*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\xE2\\x82\\xAC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 0, "Zint manual 4.10 Ex1" },
+ /* 84*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\u20AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
+ /* 85*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\U0020AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
+ /* 86*/ { BARCODE_DATAMATRIX, DATA_MODE, 17, "\\xA4", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
+ /* 87*/ { BARCODE_DATAMATRIX, DATA_MODE, 28, "\\xB1\\x60", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 0, "Zint manual 4.10 Ex2" },
+ /* 88*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\u5E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
+ /* 89*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\U005E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
+ /* 90*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
+ /* 91*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U00007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
+ /* 92*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
+ /* 93*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
+ /* 94*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
+ /* 95*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
+ /* 96*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
+ /* 97*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
+ /* 98*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Reversed BOM" },
+ /* 99*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" },
+ /*100*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "Surrogate" },
+ /*101*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
+ /*102*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input", 0, "" },
+ /*103*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U110000", "", ZINT_ERROR_INVALID_DATA, 0, "Error 216: Value of escape sequence '\\U110000' in input out of range", 0, "" },
+ /*104*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 25, "\\U10FFFF", "", 0, 14, "F1 1A E7 57 C7 81 F7 AC 09 06 28 51 F3 00 E1 8C 2A 1C", 0, "" },
+ /*105*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 26, "\\U10FFFF", "", 0, 14, "F1 1B E7 57 E0 11 D7 6C 4F 45 E2 B3 FF F1 72 AB 54 9F", 0, "" },
+ /*106*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 32, "\\U10FFFF", "", 0, 14, "F1 21 EB 64 33 EB 1B 36 1D F7 B1 6D 8C A6 34 64 19 3A", 0, "" },
+ /*107*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 33, "\\U10FFFF", "", 0, 14, "F1 22 E7 57 EB 5D 17 8C C1 B0 B6 B2 53 78 E4 7D 61 CB", 0, "" },
+ /*108*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 34, "\\U10FFFF", "", 0, 14, "F1 23 01 11 EB 80 EB 80 90 33 51 1B FA AE 78 F7 05 44", 0, "" },
+ /*109*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 35, "\\U10FFFF", "", 0, 14, "F1 24 EB 80 EB 80 11 01 17 BA C6 05 9F 4C EA E5 18 31", 0, "" },
+ /*110*/ { BARCODE_GS1_128_CC, GS1_MODE, -1, "[20]10", "[10]A", 0, 99, "(7) 105 102 20 10 100 59 106", 0, "" },
+ /*111*/ { BARCODE_GS1_128_CC, GS1_MODE, -1, "[2\\x30]1\\d048", "[\\x310]\\x41", 0, 99, "(7) 105 102 20 10 100 59 106", 1, "" },
+ /*112*/ { BARCODE_AZTEC, DATA_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
+ /*113*/ { BARCODE_AZTEC, GS1_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
+ /*114*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", 0, 15, "(102) 31 31 30 30 31 31 30 31 31 31 30 30 31 31 30 30 31 31 30 31 30 30 31 30 30 30 30 30", 0, "" },
+ /*115*/ { BARCODE_AZTEC, DATA_MODE, -1, "\\\\^11", "", 0, 15, "(102) 30 31 31 30 31 31 31 30 31 31 30 30 31 31 31 31 30 31 31 30 31 31 30 30 31 31 31 31", 0, "Note double-backslash caret passed thru as backslash caret but does not error in non-EXTRA_ESCAPE_MODE, treated literally" },
+ /*116*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^11", "", 0, 15, "(102) 31 31 30 30 31 31 30 31 31 31 30 30 31 31 30 30 31 31 30 31 30 30 31 30 30 30 30 30", 0, "Treated as backslash caret 1 (FNC1)" },
+ /*117*/ { BARCODE_AZTEC, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^A\"", 0, "" },
+ /*118*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
+ /*119*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
+ /*120*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", 0, 10, "E8 32 81 98 94 7B 7F 6D", 0, "" },
+ /*121*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^A\"", 0, "" },
+ /*122*/ { BARCODE_DATAMATRIX, GS1_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 213: Extra escape '\\^' not valid for this symbology and/or input mode", 0, "Not allowed of DATAMATRIX in GS1_MODE" },
+ /*123*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\\\^11", "", 0, 10, "5D 5F 8D 5C FB D1 69 3F", 0, "Note double-backslash caret passed thru as backslash caret but does not error in non-EXTRA_ESCAPE_MODE, treated literally" },
+ /*124*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^11", "", 0, 10, "E8 32 81 98 94 7B 7F 6D", 0, "Treated as backslash caret 1 (FNC1)" },
+ /*125*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^B2", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^B\"", 0, "Passed thru as backslash caret B" },
+ /*126*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 18, "A\\^1B", "", 0, 12, "42 E8 F1 13 43 F5 A4 26 80 68 7A AD", 0, "" },
+ /*127*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 20, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
+ /*128*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 20, "バ\\^1ーコ\\^1ード\\^1東京\\^1都", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
+ /*129*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 25, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
+ /*130*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 33, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
+ /*131*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 170, "A\\^1B", "", ZINT_ERROR_INVALID_DATA, 0, "Error 244: Invalid character in input for ECI '170'", 0, "" },
+ /*132*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 899, "A\\^1B", "", ZINT_ERROR_INVALID_OPTION, 0, "Error 716: Extra Escape mode requires ASCII-compatible ECI", 0, "" },
+ /*133*/ { BARCODE_CODE128, DATA_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in Extra Escape mode", 0, "" },
+ /*134*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "" },
+ /*135*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^", "", 0, 57, "(5) 104 60 62 82 106", 0, "Partial special escape '\\^' at end allowed" },
+ /*136*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^D1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 348: Unrecognized extra escape \"\\^D\"", 0, "" },
+ /*137*/ { BARCODE_CODE128, DATA_MODE, -1, "\\\\^A1", "", 0, 79, "(7) 104 60 62 33 17 43 106", 0, "Treated as literal backslash caret A" },
+ /*138*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "Treated as backslash caret A (manual Code Set A)" },
+ /*139*/ { BARCODE_CODE128, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input", 0, "" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
@@ -827,7 +858,7 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug);
- ret = ZBarcode_Encode(symbol, TCU(text), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
i, ret, data[i].ret, symbol->errtxt);
@@ -911,7 +942,7 @@ static void test_escape_char_process_test(const testCtx *const p_ctx) {
};
static const struct item data[] = {
/* 0*/ { 0, 0, "BLANK", 0, "BLANK", 5 },
- /* 1*/ { 0, 0, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\\\o201\\d255", 0, "\000\004\a\b\t\n\v\f\r\033\035\036\201\\\201\377", 16 },
+ /* 1*/ { 0, 0, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\L\\e\\F\\G\\R\\N\\x81\\\\\\o201\\d255", 0, "\000\004\a\b\t\n\v\f\r\020\033\034\035\036\037\201\\\201\377", 19 },
/* 2*/ { 0, 0, "\\U010283", 0, "\360\220\212\203", 4 },
/* 3*/ { 0, 0, "\\u007F\\u0080\\u011E\\u13C9\\U010283", 0, "\177\302\200\304\236\341\217\211\360\220\212\203", 12 },
/* 4*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, "\\^A\\^^\\^B", 0, "\\^A\\^^\\^B", 9 },
@@ -1249,7 +1280,7 @@ static void test_cap_stackable(const testCtx *const p_ctx) {
-1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, -1 /*output_options*/,
text, -1, debug);
- ret = ZBarcode_Encode(symbol, TCU(text), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode prestacked ret %d != 0 %s\n", i, ret, symbol->errtxt);
prestacked_rows = symbol->rows;
@@ -1259,7 +1290,7 @@ static void test_cap_stackable(const testCtx *const p_ctx) {
symbol->option_1 = -1;
symbol->option_2 = symbol->option_3 = 0;
- ret = ZBarcode_Encode(symbol, TCU(text), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode stacked ret %d != 0 %s\n", i, ret, symbol->errtxt);
stacked_rows = symbol->rows;
@@ -1328,14 +1359,14 @@ static void test_bindable(const testCtx *const p_ctx) {
text, -1, debug);
if (stackable) {
- ret = ZBarcode_Encode(symbol, TCU(text), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode prebind ret %d != 0 %s\n", i, ret, symbol->errtxt);
symbol->option_1 = -1;
symbol->option_2 = 0;
symbol->option_3 = option_3;
}
- ret = ZBarcode_Encode_and_Print(symbol, TCU(text), length, 0 /*rotate*/);
+ ret = ZBarcode_Encode_and_Print(symbol, ZCUCP(text), length, 0 /*rotate*/);
assert_zero(ret, "i:%d ZBarcode_Encode_and_Print prebind ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_nonzero(symbol->memfile_size, "i:%d prebind memfile_size zero\n", i);
@@ -1361,14 +1392,14 @@ static void test_bindable(const testCtx *const p_ctx) {
text, -1, debug);
if (stackable) {
- ret = ZBarcode_Encode(symbol, TCU(text), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode bind ret %d != 0 %s\n", i, ret, symbol->errtxt);
symbol->option_1 = -1;
symbol->option_2 = 0;
symbol->option_3 = option_3;
}
- ret = ZBarcode_Encode_and_Print(symbol, TCU(text), length, 0 /*rotate*/);
+ ret = ZBarcode_Encode_and_Print(symbol, ZCUCP(text), length, 0 /*rotate*/);
assert_zero(ret, "i:%d ZBarcode_Encode_and_Print bind ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_nonzero(symbol->memfile_size, "i:%d bind memfile_size zero\n", i);
@@ -1645,7 +1676,7 @@ static void test_encode_print_outfile_directory(const testCtx *const p_ctx) {
assert_zero(ret, "testUtilMkDir(%s) %d != 0 (%d: %s)\n", dirname, ret, errno, strerror(errno));
strcpy(symbol->outfile, dirname);
- ret = ZBarcode_Encode_and_Print(symbol, TCU("1"), 0, 0);
+ ret = ZBarcode_Encode_and_Print(symbol, ZCUCP("1"), 0, 0);
assert_equal(ret, ZINT_ERROR_FILE_ACCESS, "ret %d != ZINT_ERROR_FILE_ACCESS (%s)\n", ret, symbol->errtxt);
assert_zero(strncmp(symbol->errtxt, expected, sizeof(expected) - 1), "strncmp(%s, %s) != 0\n",
symbol->errtxt, expected);
@@ -1665,9 +1696,9 @@ static void test_bad_args(const testCtx *const p_ctx) {
const char *data = "1";
const char *filename = "1.png";
const char *empty = "";
- struct zint_seg seg = { TU("1"), -1, 4 };
- struct zint_seg seg_empty = { TU(""), -1, 4 };
- struct zint_seg seg_too_long = { TU("1"), ZINT_MAX_DATA_LEN + 1, 4 };
+ struct zint_seg seg = { ZUCP("1"), -1, 4 };
+ struct zint_seg seg_empty = { ZUCP(""), -1, 4 };
+ struct zint_seg seg_too_long = { ZUCP("1"), ZINT_MAX_DATA_LEN + 1, 4 };
const char *expected[] = {
"Error 772: Input segment 0 source NULL",
"Error 200: Input segments NULL",
@@ -1701,7 +1732,7 @@ static void test_bad_args(const testCtx *const p_ctx) {
assert_zero(uret, "ZBarcode_Cap(17, ~0) uret 0x%X != 0\n", uret);
/* NULL symbol */
- assert_equal(ZBarcode_Encode(NULL, TCU(data), 1), ZINT_ERROR_INVALID_DATA,
+ assert_equal(ZBarcode_Encode(NULL, ZCUCP(data), 1), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode(NULL, data, 1) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs(NULL, &seg, 1), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Segs(NULL, &seg, 1) != ZINT_ERROR_INVALID_DATA\n");
@@ -1711,15 +1742,15 @@ static void test_bad_args(const testCtx *const p_ctx) {
"ZBarcode_Buffer(NULL, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Buffer_Vector(NULL, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Buffer_Vector(NULL, 0) != ZINT_ERROR_INVALID_DATA\n");
- assert_equal(ZBarcode_Encode_and_Print(NULL, TCU(data), 1, 0), ZINT_ERROR_INVALID_DATA,
+ assert_equal(ZBarcode_Encode_and_Print(NULL, ZCUCP(data), 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Print(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs_and_Print(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Seg_and_Print(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
- assert_equal(ZBarcode_Encode_and_Buffer(NULL, TCU(data), 1, 0), ZINT_ERROR_INVALID_DATA,
+ assert_equal(ZBarcode_Encode_and_Buffer(NULL, ZCUCP(data), 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Buffer(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs_and_Buffer(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Segs_and_Buffer(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
- assert_equal(ZBarcode_Encode_and_Buffer_Vector(NULL, TCU(data), 1, 0), ZINT_ERROR_INVALID_DATA,
+ assert_equal(ZBarcode_Encode_and_Buffer_Vector(NULL, ZCUCP(data), 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Buffer_Vector(NULL, data, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(NULL, &seg, 1, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Segs_and_Buffer_Vector(NULL, &seg, 1, 0) != ZINT_ERROR_INVALID_DATA\n");
@@ -1797,26 +1828,26 @@ static void test_bad_args(const testCtx *const p_ctx) {
/* Empty data/segs/filename */
symbol->errtxt[0] = '\0';
- assert_equal(ZBarcode_Encode(symbol, TCU(empty), 0), ZINT_ERROR_INVALID_DATA,
+ assert_equal(ZBarcode_Encode(symbol, ZCUCP(empty), 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode(symbol, empty, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt),
- "ZBarcode_Encode(symbol, TCU(empty), 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
+ "ZBarcode_Encode(symbol, ZCUCP(empty), 0) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs(symbol, &seg_empty, 1), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_Segs(symbol, &seg_empty, 1) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt),
"ZBarcode_Encode_Segs(symbol, &seg_empty, 1) strcmp(%s, %s) != 0\n", expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
- assert_equal(ZBarcode_Encode_and_Print(symbol, TCU(empty), 0, 0), ZINT_ERROR_INVALID_DATA,
+ assert_equal(ZBarcode_Encode_and_Print(symbol, ZCUCP(empty), 0, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Print(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt),
- "ZBarcode_Encode_and_Print(symbol, TCU(empty), 0, 0) strcmp(%s, %s) != 0\n",
+ "ZBarcode_Encode_and_Print(symbol, ZCUCP(empty), 0, 0) strcmp(%s, %s) != 0\n",
expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
- assert_equal(ZBarcode_Encode_and_Buffer(symbol, TCU(empty), 0, 0), ZINT_ERROR_INVALID_DATA,
+ assert_equal(ZBarcode_Encode_and_Buffer(symbol, ZCUCP(empty), 0, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Buffer(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt),
- "ZBarcode_Encode_and_Buffer(symbol, TCU(empty), 0, 0) strcmp(%s, %s) != 0\n",
+ "ZBarcode_Encode_and_Buffer(symbol, ZCUCP(empty), 0, 0) strcmp(%s, %s) != 0\n",
expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA,
@@ -1825,10 +1856,10 @@ static void test_bad_args(const testCtx *const p_ctx) {
"ZBarcode_Encode_Segs_and_Buffer(symbol, &seg_empty, 1, 0) strcmp(%s, %s) != 0\n",
expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
- assert_equal(ZBarcode_Encode_and_Buffer_Vector(symbol, TCU(empty), 0, 0), ZINT_ERROR_INVALID_DATA,
+ assert_equal(ZBarcode_Encode_and_Buffer_Vector(symbol, ZCUCP(empty), 0, 0), ZINT_ERROR_INVALID_DATA,
"ZBarcode_Encode_and_Buffer_Vector(symbol, empty, 0, 0) != ZINT_ERROR_INVALID_DATA\n");
assert_zero(strcmp(expected[3], symbol->errtxt),
- "ZBarcode_Encode_and_Buffer_Vector(symbol, TCU(empty), 0, 0) strcmp(%s, %s) != 0\n",
+ "ZBarcode_Encode_and_Buffer_Vector(symbol, ZCUCP(empty), 0, 0) strcmp(%s, %s) != 0\n",
expected[3], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs_and_Buffer_Vector(symbol, &seg_empty, 1, 0), ZINT_ERROR_INVALID_DATA,
@@ -1881,10 +1912,10 @@ static void test_bad_args(const testCtx *const p_ctx) {
/* Data/seg too big */
symbol->errtxt[0] = '\0';
- assert_equal(ZBarcode_Encode(symbol, TCU(empty), ZINT_MAX_DATA_LEN + 1), ZINT_ERROR_TOO_LONG,
+ assert_equal(ZBarcode_Encode(symbol, ZCUCP(empty), ZINT_MAX_DATA_LEN + 1), ZINT_ERROR_TOO_LONG,
"ZBarcode_Encode(symbol, empty, ZINT_MAX_DATA_LEN + 1) != ZINT_ERROR_TOO_LONG\n");
assert_zero(strcmp(expected[7], symbol->errtxt),
- "ZBarcode_Encode(symbol, TCU(empty), ZINT_MAX_DATA_LEN + 1) strcmp(%s, %s) != 0\n",
+ "ZBarcode_Encode(symbol, ZCUCP(empty), ZINT_MAX_DATA_LEN + 1) strcmp(%s, %s) != 0\n",
expected[7], symbol->errtxt);
symbol->errtxt[0] = '\0';
assert_equal(ZBarcode_Encode_Segs(symbol, &seg_too_long, 1), ZINT_ERROR_TOO_LONG,
@@ -1913,10 +1944,10 @@ static void test_stacking(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n");
for (i = 0; i < ARRAY_SIZE(symbol->row_height); i++) {
- ret = ZBarcode_Encode(symbol, TCU(data), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, data, ret, symbol->errtxt);
}
- ret = ZBarcode_Encode(symbol, TCU(data), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_equal(ret, ZINT_ERROR_TOO_LONG, "i:%d ZBarcode_Encode ret %d != ZINT_ERROR_TOO_LONG (%s)\n",
i, ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, expected_error), "i:%d strcmp(%s, %s) != 0\n",
@@ -1924,11 +1955,11 @@ static void test_stacking(const testCtx *const p_ctx) {
ZBarcode_Clear(symbol);
- ret = ZBarcode_Encode(symbol, TCU(data), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, data, ret, symbol->errtxt);
symbol->output_options |= BARCODE_CONTENT_SEGS;
- ret = ZBarcode_Encode(symbol, TCU(data), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_equal(ret, ZINT_ERROR_INVALID_OPTION, "i:%d ZBarcode_Encode ret %d != ZINT_ERROR_INVALID_OPTION (%s)\n",
i, ret, symbol->errtxt);
assert_zero(strcmp(symbol->errtxt, expected_error_content), "i:%d strcmp(%s, %s) != 0\n",
@@ -2254,7 +2285,7 @@ static void test_strip_bom(const testCtx *const p_ctx) {
strcpy(buf, data);
length = (int) strlen(buf);
- zint_test_strip_bom(TU(buf), &length);
+ zint_test_strip_bom(ZUCP(buf), &length);
assert_equal(length, 1, "length %d != 1\n", length);
assert_zero(buf[1], "buf[1] %d != 0\n", buf[1]);
@@ -2262,7 +2293,7 @@ static void test_strip_bom(const testCtx *const p_ctx) {
strcpy(buf, bom_only);
length = (int) strlen(buf);
- zint_test_strip_bom(TU(buf), &length);
+ zint_test_strip_bom(ZUCP(buf), &length);
assert_equal(length, 3, "BOM only length %d != 3\n", length);
ret = strcmp(buf, bom_only);
assert_zero(ret, "BOM only strcmp ret %d != 0\n", ret);
@@ -2286,7 +2317,7 @@ static void test_zero_outfile(const testCtx *const p_ctx) {
assert_nonzero(symbol->outfile[0], "ZBarcode_Create() outfile zero\n");
symbol->outfile[0] = '\0';
- ret = ZBarcode_Encode(symbol, TCU(data), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode(%s) ret %d != 0 (%s)\n", data, ret, symbol->errtxt);
assert_zero(symbol->outfile[0], "ZBarcode_Encode() outfile non-zero\n");
@@ -2327,7 +2358,7 @@ static void test_clear(const testCtx *const p_ctx) {
/* Raster */
- ret = ZBarcode_Encode(symbol, TCU(data), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@@ -2358,7 +2389,7 @@ static void test_clear(const testCtx *const p_ctx) {
/* Vector */
- ret = ZBarcode_Encode(symbol, TCU(data), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@@ -2444,7 +2475,7 @@ static void test_reset(const testCtx *const p_ctx) {
/* Raster */
- ret = ZBarcode_Encode(symbol, TCU(data), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@@ -2501,7 +2532,7 @@ static void test_reset(const testCtx *const p_ctx) {
set_symbol_fields(symbol);
- ret = ZBarcode_Encode(symbol, TCU(data), 0);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data), 0);
assert_zero(ret, "ZBarcode_Encode() ret %d != 0 (%s)\n", ret, symbol->errtxt);
assert_nonzero(symbol->rows, "ZBarcode_Encode() rows 0\n");
@@ -2858,7 +2889,7 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
length = data[i].length == -1 && data[i].data ? (int) strlen(data[i].data) : data[i].length;
- ret_dest = ZBarcode_Dest_Len_ECI(data[i].eci, TCU(data[i].data), length, &dest_length);
+ ret_dest = ZBarcode_Dest_Len_ECI(data[i].eci, ZCUCP(data[i].data), length, &dest_length);
assert_equal(ret_dest, data[i].ret_dest, "i:%d ZBarcode_Dest_Len_ECI(%d, %s) ret_dest %d != %d\n",
i, data[i].eci, data[i].data, ret_dest, data[i].ret_dest);
@@ -2868,7 +2899,7 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
i, dest_length, data[i].expected_dest_length);
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
- ret = ZBarcode_UTF8_To_ECI(data[i].eci, TCU(data[i].data), length, dest, &dest_length);
+ ret = ZBarcode_UTF8_To_ECI(data[i].eci, ZCUCP(data[i].data), length, dest, &dest_length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_UTF8_To_ECI(%d, %s) ret %d != %d\n",
i, data[i].eci, data[i].data, ret, data[i].ret);
if (ret < ZINT_ERROR) {
@@ -2876,7 +2907,7 @@ static void test_utf8_to_eci(const testCtx *const p_ctx) {
"i:%d ZBarcode_UTF8_To_ECI dest_length %d != expected_length %d\n",
i, dest_length, expected_length);
#if 0
- printf("dest_length %d\n", dest_length); z_debug_print_escape(TCU(dest), dest_length, NULL);
+ printf("dest_length %d\n", dest_length); z_debug_print_escape(ZCUCP(dest), dest_length, NULL);
printf("\n");
#endif
assert_zero(memcmp(dest, data[i].expected, expected_length),
@@ -3046,7 +3077,7 @@ static void test_content_segs(const testCtx *const p_ctx) {
expected = data[i].expected[0] ? data[i].expected : data[i].data;
expected_length = (int) strlen(expected);
- ret = ZBarcode_Encode(symbol, TCU(text), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(text), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
assert_nonnull(symbol->content_segs, "i:%d content_segs NULL\n", i);
diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c
index a6da2f30..3d373aa1 100644
--- a/backend/tests/test_raster.c
+++ b/backend/tests/test_raster.c
@@ -2545,9 +2545,9 @@ static void test_height(const testCtx *const p_ctx) {
/*110*/ { BARCODE_DBAR_EXP, -1, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "", "" },
/*111*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 33, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 33, 1, 134, 268, 66, "Warning 247: Height not compliant with standards (too small)", "" },
/*112*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "", "" },
- /*113*/ { BARCODE_TELEPEN, -1, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "", "" },
- /*114*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "", "No known min" },
- /*115*/ { BARCODE_TELEPEN, -1, 4, "1234567890", "", 0, 4, 1, 208, 416, 8, "", "" },
+ /*113*/ { BARCODE_TELEPEN, -1, 8.9, "1234567890", "", 0, 9, 1, 208, 416, 18, "", "" },
+ /*114*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 8.9, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 9, 1, 208, 416, 18, "Warning 247: Height not compliant with standards (too small)", "" },
+ /*115*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 9, "1234567890", "", 0, 9, 1, 208, 416, 18, "", "" },
/*116*/ { BARCODE_UPCA, -1, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "", "" },
/*117*/ { BARCODE_UPCA, -1, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "", "" },
/*118*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "Warning 247: Height not compliant with standards (too small)", "" },
@@ -2764,9 +2764,9 @@ static void test_height(const testCtx *const p_ctx) {
/*329*/ { BARCODE_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "", "" },
/*330*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "", "TODO: Find doc" },
/*331*/ { BARCODE_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "", "" },
- /*332*/ { BARCODE_TELEPEN_NUM, -1, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "", "" },
- /*333*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "", "No known min" },
- /*334*/ { BARCODE_TELEPEN_NUM, -1, 4, "1234567890", "", 0, 4, 1, 128, 256, 8, "", "" },
+ /*332*/ { BARCODE_TELEPEN_NUM, -1, 6.6, "1234567890", "", 0, 6.5, 1, 128, 256, 13, "", "" },
+ /*333*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 6.6, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 6.5, 1, 128, 256, 13, "Warning 247: Height not compliant with standards (too small)", "" },
+ /*334*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 6.7, "1234567890", "", 0, 6.5, 1, 128, 256, 13, "", "" },
/*335*/ { BARCODE_ITF14, -1, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "", "" },
/*336*/ { BARCODE_ITF14, -1, 5.7, "1234567890", "", 0, 5.5, 1, 135, 330, 31, "", "" },
/*337*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.7, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.5, 1, 135, 330, 31, "Warning 247: Height not compliant with standards (too small)", "" },
diff --git a/backend/tests/test_telepen.c b/backend/tests/test_telepen.c
index 59684174..9889d860 100644
--- a/backend/tests/test_telepen.c
+++ b/backend/tests/test_telepen.c
@@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
- Copyright (C) 2020-2025 Robin Stuart
+ Copyright (C) 2020-2026 Robin Stuart
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -36,6 +36,7 @@ static void test_large(const testCtx *const p_ctx) {
struct item {
int symbology;
+ int option_2;
const char *pattern;
int length;
int ret;
@@ -45,10 +46,40 @@ static void test_large(const testCtx *const p_ctx) {
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
- /* 0*/ { BARCODE_TELEPEN, "\177", 69, 0, 1, 1152, "" },
- /* 1*/ { BARCODE_TELEPEN, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 70 too long (maximum 69)" },
- /* 2*/ { BARCODE_TELEPEN_NUM, "1", 136, 0, 1, 1136, "" },
- /* 3*/ { BARCODE_TELEPEN_NUM, "1", 137, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 137 too long (maximum 136)" },
+ /* 0*/ { BARCODE_TELEPEN, -1, "\177", 69, 0, 1, 1152, "" },
+ /* 1*/ { BARCODE_TELEPEN, -1, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 70 too long, requires 70 symbol characters (maximum 69)" },
+ /* 2*/ { BARCODE_TELEPEN, 1, "\177", 69, 0, 1, 1152, "" },
+ /* 3*/ { BARCODE_TELEPEN, 1, "\177", 70, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 70 too long, requires 70 symbol characters (maximum 69)" },
+ /* 4*/ { BARCODE_TELEPEN, 1, "\177", 136, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 136 too long, requires 136 symbol characters (maximum 69)" },
+ /* 5*/ { BARCODE_TELEPEN, 1, "\177", 137, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 137 too long, requires 137 symbol characters (maximum 69)" },
+ /* 6*/ { BARCODE_TELEPEN, 1, "\177", 200, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 200 too long, requires 200 symbol characters (maximum 69)" },
+ /* 7*/ { BARCODE_TELEPEN, 1, "\177", 201, ZINT_ERROR_TOO_LONG, -1, -1, "Error 399: Input length 201 too long, requires too many symbol characters (maximum 69)" },
+ /* 8*/ { BARCODE_TELEPEN, -1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\020", 69, 0, 1, 1152, "" },
+ /* 9*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\020", 69, 0, 1, 1152, "" },
+ /* 10*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\0201", 69, 0, 1, 1152, "" },
+ /* 11*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\02012", 70, 0, 1, 1152, "" },
+ /* 12*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\020123", 71, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 71 too long, requires 70 symbol characters (maximum 69)" },
+ /* 13*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\0201234", 72, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 72 too long, requires 70 symbol characters (maximum 69)" },
+ /* 14*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\0201234", 71, 0, 1, 1152, "" },
+ /* 15*/ { BARCODE_TELEPEN, 1, "\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\177\02012345", 72, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 72 too long, requires 70 symbol characters (maximum 69)" },
+ /* 16*/ { BARCODE_TELEPEN, 1, "\177\02012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234", 136, 0, 1, 1152, "" },
+ /* 17*/ { BARCODE_TELEPEN, 1, "\177\020123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345", 137, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 137 too long, requires 70 symbol characters (maximum 69)" },
+ /* 18*/ { BARCODE_TELEPEN, 1, "\177\177\020123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", 135, 0, 1, 1152, "" },
+ /* 19*/ { BARCODE_TELEPEN, 1, "\177\177\0201234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123", 136, ZINT_ERROR_TOO_LONG, -1, -1, "Error 390: Input length 136 too long, requires 70 symbol characters (maximum 69)" },
+ /* 20*/ { BARCODE_TELEPEN_NUM, -1, "1", 138, 0, 1, 1152, "" },
+ /* 21*/ { BARCODE_TELEPEN_NUM, -1, "1", 139, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 139 too long, requires 70 symbol characters (maximum 69)" },
+ /* 22*/ { BARCODE_TELEPEN_NUM, 1, "1", 138, 0, 1, 1152, "" },
+ /* 23*/ { BARCODE_TELEPEN_NUM, 1, "1", 139, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 139 too long, requires 70 symbol characters (maximum 69)" },
+ /* 24*/ { BARCODE_TELEPEN_NUM, 1, "1", 200, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 200 too long, requires 100 symbol characters (maximum 69)" },
+ /* 25*/ { BARCODE_TELEPEN_NUM, 1, "1", 201, ZINT_ERROR_TOO_LONG, -1, -1, "Error 400: Input length 201 too long, requires too many symbol characters (maximum 69)" },
+ /* 26*/ { BARCODE_TELEPEN_NUM, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456\020", 137, 0, 1, 1152, "" },
+ /* 27*/ { BARCODE_TELEPEN_NUM, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567\020", 138, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 138 too long, requires 70 symbol characters (maximum 69)" },
+ /* 28*/ { BARCODE_TELEPEN_NUM, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234\020\177", 136, 0, 1, 1152, "" },
+ /* 29*/ { BARCODE_TELEPEN_NUM, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345\020\177", 137, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 137 too long, requires 70 symbol characters (maximum 69)" },
+ /* 30*/ { BARCODE_TELEPEN_NUM, -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012\020\177\177", 135, 0, 1, 1152, "" },
+ /* 31*/ { BARCODE_TELEPEN_NUM, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123\020\177\177", 136, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 136 too long, requires 70 symbol characters (maximum 69)" },
+ /* 32*/ { BARCODE_TELEPEN_NUM, -1, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\020\177\177\177", 134, 0, 1, 1152, "" },
+ /* 33*/ { BARCODE_TELEPEN_NUM, -1, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901\020\177\177\177", 135, ZINT_ERROR_TOO_LONG, -1, -1, "Error 392: Input length 135 too long, requires 70 symbol characters (maximum 69)" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
@@ -56,6 +87,15 @@ static void test_large(const testCtx *const p_ctx) {
char data_buf[256];
+ char escaped[8192];
+ char escaped2[8192];
+ char cmp_buf[8192];
+ char cmp_msg[1024];
+ char ret_buf[8192];
+
+ /* Only do zxing-cpp tests if asked, too slow otherwise */
+ int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
+
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@@ -66,18 +106,44 @@ static void test_large(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n");
testUtilStrCpyRepeat(data_buf, data[i].pattern, data[i].length);
- assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n", i, data[i].length, (int) strlen(data_buf));
+ assert_equal(data[i].length, (int) strlen(data_buf), "i:%d length %d != strlen(data_buf) %d\n",
+ i, data[i].length, (int) strlen(data_buf));
- length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug);
+ length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
+ -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/,
+ data_buf, data[i].length, debug);
- ret = ZBarcode_Encode(symbol, TCU(data_buf), length);
- assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
- assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
- assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data_buf), length);
+ assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
+ i, ret, data[i].ret, symbol->errtxt);
+ assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n",
+ i, ret ? "set" : "empty", symbol->errtxt);
+ assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n",
+ i, symbol->errtxt, data[i].expected_errtxt);
if (ret < ZINT_ERROR) {
- assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
- assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
+ assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n",
+ i, symbol->rows, data[i].expected_rows);
+ assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n",
+ i, symbol->width, data[i].expected_width);
+
+ if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data_buf, length, debug)) {
+ int cmp_len, ret_len;
+ char modules_dump[4096];
+ assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)),-1,
+ "i:%d testUtilModulesDump == -1\n", i);
+ ret = testUtilZXingCPP(i, symbol, data_buf, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
+ sizeof(cmp_buf), &cmp_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
+ i, testUtilBarcodeName(symbol->symbology), ret);
+
+ ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data_buf, length,
+ NULL /*primary*/, ret_buf, &ret_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
+ i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
+ testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
+ testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
+ }
}
ZBarcode_Delete(symbol);
@@ -91,6 +157,7 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
+ int option_2;
int output_options;
const char *data;
int length;
@@ -102,30 +169,63 @@ static void test_hrt(const testCtx *const p_ctx) {
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
- /* 0*/ { BARCODE_TELEPEN, -1, "ABC1234.;$", -1, "ABC1234.;$", -1, "", -1 },
- /* 1*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "ABC1234.;$", -1, "ABC1234.;$", -1, "ABC1234.;$^", -1 },
- /* 2*/ { BARCODE_TELEPEN, -1, "abc1234.;$", -1, "abc1234.;$", -1, "", -1 },
- /* 3*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "abc1234.;$", -1, "abc1234.;$", -1, "abc1234.;$}", -1 },
- /* 4*/ { BARCODE_TELEPEN, -1, "ABC1234\001", -1, "ABC1234 ", -1, "", -1 }, /* Note used to put control chars (apart from NUL) in HRT */
- /* 5*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "ABC1234\001", -1, "ABC1234 ", -1, "ABC1234\001k", -1 },
- /* 6*/ { BARCODE_TELEPEN, -1, "ABC\0001234", 8, "ABC 1234", -1, "", -1 },
- /* 7*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "ABC\0001234", 8, "ABC 1234", -1, "ABC\0001234l", 9 },
- /* 8*/ { BARCODE_TELEPEN, -1, "ABK0", -1, "ABK0", -1, "", -1 },
- /* 9*/ { BARCODE_TELEPEN, BARCODE_CONTENT_SEGS, "ABK0", -1, "ABK0", -1, "ABK0\000", 5 },
- /* 10*/ { BARCODE_TELEPEN_NUM, -1, "1234", -1, "1234", -1, "", -1 },
- /* 11*/ { BARCODE_TELEPEN_NUM, BARCODE_CONTENT_SEGS, "1234", -1, "1234", -1, "1234\033", -1 },
- /* 12*/ { BARCODE_TELEPEN_NUM, -1, "123X", -1, "123X", -1, "", -1 },
- /* 13*/ { BARCODE_TELEPEN_NUM, BARCODE_CONTENT_SEGS, "123X", -1, "123X", -1, "123XD", -1 },
- /* 14*/ { BARCODE_TELEPEN_NUM, -1, "123x", -1, "123X", -1, "", -1 }, /* Converts to upper */
- /* 15*/ { BARCODE_TELEPEN_NUM, BARCODE_CONTENT_SEGS, "123x", -1, "123X", -1, "123XD", -1 },
- /* 16*/ { BARCODE_TELEPEN_NUM, -1, "12345", -1, "012345", -1, "", -1 }, /* Adds leading zero if odd */
- /* 17*/ { BARCODE_TELEPEN_NUM, BARCODE_CONTENT_SEGS, "12345", -1, "012345", -1, "012345h", -1 },
+ /* 0*/ { BARCODE_TELEPEN, -1, -1, "ABC1234.;$", -1, "ABC1234.;$", -1, "", -1 },
+ /* 1*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABC1234.;$", -1, "ABC1234.;$", -1, "ABC1234.;$^", -1 },
+ /* 2*/ { BARCODE_TELEPEN, -1, -1, "abc1234.;$", -1, "abc1234.;$", -1, "", -1 },
+ /* 3*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "abc1234.;$", -1, "abc1234.;$", -1, "abc1234.;$}", -1 },
+ /* 4*/ { BARCODE_TELEPEN, -1, -1, "ABC1234\001", -1, "ABC1234 ", -1, "", -1 }, /* Note used to put control chars (apart from NUL) in HRT */
+ /* 5*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABC1234\001", -1, "ABC1234 ", -1, "ABC1234\001k", -1 },
+ /* 6*/ { BARCODE_TELEPEN, -1, -1, "ABC\0001234", 8, "ABC 1234", -1, "", -1 },
+ /* 7*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABC\0001234", 8, "ABC 1234", -1, "ABC\0001234l", 9 },
+ /* 8*/ { BARCODE_TELEPEN, -1, -1, "ABK0", -1, "ABK0", -1, "", -1 },
+ /* 9*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABK0", -1, "ABK0", -1, "ABK0\000", 5 },
+ /* 10*/ { BARCODE_TELEPEN, -1, -1, "ABK0\020", -1, "ABK0 ", -1, "", -1 }, /* Trailing DLE is literal DLE, space in HRT */
+ /* 11*/ { BARCODE_TELEPEN, -1, BARCODE_CONTENT_SEGS, "ABK0\020", -1, "ABK0 ", -1, "ABK0\020o", -1 },
+ /* 12*/ { BARCODE_TELEPEN, 1, -1, "ABK0\020", -1, "ABK0", -1, "", -1 }, /* Trailing DLE in Full ASCII + Compressed Numeric mode, remove from HRT */
+ /* 13*/ { BARCODE_TELEPEN, 1, BARCODE_CONTENT_SEGS, "ABK0\020", -1, "ABK0", -1, "ABK0\020o", -1 },
+ /* 14*/ { BARCODE_TELEPEN, 1, -1, "ABC\0201234", -1, "ABC1234", -1, "", -1 }, /* Trailing numeric, no leading zero needed */
+ /* 15*/ { BARCODE_TELEPEN, 1, BARCODE_CONTENT_SEGS, "ABC\0201234", -1, "ABC1234", -1, "ABC\0201234C", -1 },
+ /* 16*/ { BARCODE_TELEPEN, 1, -1, "ABC\020123", -1, "ABC0123", -1, "", -1 }, /* Trailing numeric, add leading zero */
+ /* 17*/ { BARCODE_TELEPEN, 1, BARCODE_CONTENT_SEGS, "ABC\020123", -1, "ABC0123", -1, "ABC\0200123Y", -1 },
+ /* 18*/ { BARCODE_TELEPEN, 1, -1, "ABC\020123x", -1, "ABC123X", -1, "", -1 }, /* Converts to upper */
+ /* 19*/ { BARCODE_TELEPEN, 1, BARCODE_CONTENT_SEGS, "ABC\020123x", -1, "ABC123X", -1, "ABC\020123Xl", -1 },
+ /* 20*/ { BARCODE_TELEPEN_NUM, -1, -1, "1234", -1, "1234", -1, "", -1 },
+ /* 21*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "1234", -1, "1234", -1, "1234\033", -1 },
+ /* 22*/ { BARCODE_TELEPEN_NUM, -1, -1, "123X", -1, "123X", -1, "", -1 },
+ /* 23*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "123X", -1, "123X", -1, "123XD", -1 },
+ /* 24*/ { BARCODE_TELEPEN_NUM, -1, -1, "123x", -1, "123X", -1, "", -1 }, /* Converts to upper */
+ /* 25*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "123x", -1, "123X", -1, "123XD", -1 },
+ /* 26*/ { BARCODE_TELEPEN_NUM, -1, -1, "12345", -1, "012345", -1, "", -1 }, /* Adds leading zero if odd */
+ /* 27*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "12345", -1, "012345", -1, "012345h", -1 },
+ /* 28*/ { BARCODE_TELEPEN_NUM, -1, -1, "1234\0205", -1, "12345", -1, "", -1 }, /* Trailing ASCII, no leading zero needed */
+ /* 29*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "1234\0205", -1, "12345", -1, "1234\0205U", -1 },
+ /* 30*/ { BARCODE_TELEPEN_NUM, -1, -1, "123\020AB", -1, "0123AB", -1, "", -1 }, /* Trailing ASCII, add leading zero */
+ /* 31*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "123\020AB", -1, "0123AB", -1, "0123\020AB\035", -1 },
+ /* 32*/ { BARCODE_TELEPEN_NUM, -1, -1, "123\020", -1, "0123", -1, "", -1 }, /* Trailing DLE, remove from HRT */
+ /* 33*/ { BARCODE_TELEPEN_NUM, -1, BARCODE_CONTENT_SEGS, "123\020", -1, "0123", -1, "0123\020!", -1 },
+ /* 34*/ { BARCODE_TELEPEN_NUM, 1, -1, "12345", -1, "012345", -1, "", -1 },
+ /* 35*/ { BARCODE_TELEPEN_NUM, 1, BARCODE_CONTENT_SEGS, "12345", -1, "012345", -1, "012345h", -1 },
+ /* 36*/ { BARCODE_TELEPEN_NUM, 1, -1, "1234\020567", -1, "1234567", -1, "", -1 },
+ /* 37*/ { BARCODE_TELEPEN_NUM, 1, BARCODE_CONTENT_SEGS, "1234\020567", -1, "1234567", -1, "1234\020567g", -1 },
+ /* 38*/ { BARCODE_TELEPEN_NUM, 1, -1, "12345\020A", -1, "012345A", -1, "", -1 },
+ /* 39*/ { BARCODE_TELEPEN_NUM, 1, BARCODE_CONTENT_SEGS, "12345\020A", -1, "012345A", -1, "012345\020A\027", -1 },
+ /* 40*/ { BARCODE_TELEPEN_NUM, 1, -1, "123\020", -1, "0123", -1, "", -1 },
+ /* 41*/ { BARCODE_TELEPEN_NUM, 1, BARCODE_CONTENT_SEGS, "123\020", -1, "0123", -1, "0123\020!", -1 },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol = NULL;
int expected_length, expected_content_length;
+ char escaped[1024];
+ char escaped2[1024];
+ char cmp_buf[8192];
+ char cmp_msg[1024];
+ char ret_buf[8192];
+
+ /* Only do zxing-cpp tests if asked, too slow otherwise */
+ int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
+
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@@ -136,32 +236,60 @@ static void test_hrt(const testCtx *const p_ctx) {
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
- -1 /*option_1*/, -1 /*option_2*/, -1 /*option_3*/, data[i].output_options,
- data[i].data, data[i].length, debug);
+ -1 /*option_1*/, data[i].option_2, -1 /*option_3*/, data[i].output_options,
+ data[i].data, data[i].length, debug);
expected_length = data[i].expected_length == -1 ? (int) strlen(data[i].expected) : data[i].expected_length;
- expected_content_length = data[i].expected_content_length == -1 ? (int) strlen(data[i].expected_content) : data[i].expected_content_length;
+ expected_content_length = data[i].expected_content_length == -1
+ ? (int) strlen(data[i].expected_content) : data[i].expected_content_length;
- ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
- assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d\n",
- i, symbol->text_length, expected_length);
- assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d memcmp(%s, %s, %d) != 0\n",
- i, symbol->text, data[i].expected, expected_length);
+ assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d (%s, %s)\n",
+ i, symbol->text_length, expected_length,
+ testUtilEscape(ZCCP(symbol->text), symbol->text_length, escaped, sizeof(escaped)),
+ testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)));
+ assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d text memcmp(%s, %s, %d) != 0\n",
+ i, testUtilEscape(ZCCP(symbol->text), symbol->text_length, escaped, sizeof(escaped)),
+ testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)), expected_length);
if (symbol->output_options & BARCODE_CONTENT_SEGS) {
assert_nonnull(symbol->content_segs, "i:%d content_segs NULL\n", i);
assert_nonnull(symbol->content_segs[0].source, "i:%d content_segs[0].source NULL\n", i);
assert_equal(symbol->content_segs[0].length, expected_content_length,
- "i:%d content_segs[0].length %d != expected_content_length %d\n",
- i, symbol->content_segs[0].length, expected_content_length);
+ "i:%d content_segs[0].length %d != expected_content_length %d (%s, %s)\n",
+ i, symbol->content_segs[0].length, expected_content_length,
+ testUtilEscape(ZCCP(symbol->content_segs[0].source), symbol->content_segs[0].length, escaped,
+ sizeof(escaped)),
+ testUtilEscape(data[i].expected_content, expected_content_length, escaped2,
+ sizeof(escaped2)));
assert_zero(memcmp(symbol->content_segs[0].source, data[i].expected_content, expected_content_length),
- "i:%d memcmp(%.*s, %.*s, %d) != 0\n",
- i, symbol->content_segs[0].length, symbol->content_segs[0].source, expected_content_length,
- data[i].expected_content, expected_content_length);
+ "i:%d content_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
+ testUtilEscape(ZCCP(symbol->content_segs[0].source), symbol->content_segs[0].length, escaped,
+ sizeof(escaped)),
+ testUtilEscape(data[i].expected_content, expected_content_length, escaped2,
+ sizeof(escaped2)), expected_content_length);
} else {
assert_null(symbol->content_segs, "i:%d content_segs not NULL\n", i);
}
+ if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
+ int cmp_len, ret_len;
+ char modules_dump[4096];
+ assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)),-1,
+ "i:%d testUtilModulesDump == -1\n", i);
+ ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
+ sizeof(cmp_buf), &cmp_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
+ i, testUtilBarcodeName(symbol->symbology), ret);
+
+ ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
+ NULL /*primary*/, ret_buf, &ret_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
+ i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
+ testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
+ testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
+ }
+
ZBarcode_Delete(symbol);
}
@@ -173,6 +301,7 @@ static void test_input(const testCtx *const p_ctx) {
struct item {
int symbology;
+ int option_2;
const char *data;
int length;
int ret;
@@ -182,20 +311,37 @@ static void test_input(const testCtx *const p_ctx) {
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
- /* 0*/ { BARCODE_TELEPEN, " !\"#$%&'()*+,-./0123456789:;<", -1, 0, 1, 512, "" },
- /* 1*/ { BARCODE_TELEPEN, "AZaz\176\001", -1, 0, 1, 144, "" },
- /* 2*/ { BARCODE_TELEPEN, "\000\177", 2, 0, 1, 80, "" },
- /* 3*/ { BARCODE_TELEPEN, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 391: Invalid character at position 1 in input, extended ASCII not allowed" },
- /* 4*/ { BARCODE_TELEPEN_NUM, "1234567890", -1, 0, 1, 128, "" },
- /* 5*/ { BARCODE_TELEPEN_NUM, "123456789A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 393: Invalid character at position 10 in input (digits and \"X\" only)" },
- /* 6*/ { BARCODE_TELEPEN_NUM, "123456789X", -1, 0, 1, 128, "" }, /* [0-9]X allowed */
- /* 7*/ { BARCODE_TELEPEN_NUM, "12345678X9", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 394: Invalid odd position 9 of \"X\" in Telepen data" }, /* X[0-9] not allowed */
- /* 8*/ { BARCODE_TELEPEN_NUM, "1X34567X9X", -1, 0, 1, 128, "" }, /* [0-9]X allowed multiple times */
+ /* 0*/ { BARCODE_TELEPEN, -1, " !\"#$%&'()*+,-./0123456789:;<", -1, 0, 1, 512, "" },
+ /* 1*/ { BARCODE_TELEPEN, -1, "AZaz\176\001", -1, 0, 1, 144, "" },
+ /* 2*/ { BARCODE_TELEPEN, -1, "\000\177", 2, 0, 1, 80, "" },
+ /* 3*/ { BARCODE_TELEPEN, -1, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 391: Invalid character at position 1 in input, extended ASCII not allowed" },
+ /* 4*/ { BARCODE_TELEPEN, -1, "\020", -1, 0, 1, 64, "" },
+ /* 5*/ { BARCODE_TELEPEN, 1, "\020", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 397: DLE (ASCII 16) cannot be first character in Full ASCII + Compressed Numeric Mode" },
+ /* 6*/ { BARCODE_TELEPEN, -1, "A\020B", -1, 0, 1, 96, "" },
+ /* 7*/ { BARCODE_TELEPEN, 1, "A\020B", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 396: Invalid character at position 3 in input (digits and \"X\" only)" },
+ /* 8*/ { BARCODE_TELEPEN_NUM, -1, "1234567890", -1, 0, 1, 128, "" },
+ /* 9*/ { BARCODE_TELEPEN_NUM, -1, "123456789A", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 393: Invalid character at position 10 in input (digits and \"X\" only)" },
+ /* 10*/ { BARCODE_TELEPEN_NUM, -1, "123456789X", -1, 0, 1, 128, "" }, /* [0-9]X allowed */
+ /* 11*/ { BARCODE_TELEPEN_NUM, -1, "12345678X9", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 394: Invalid odd position 9 of \"X\" in Telepen data" }, /* X[0-9] not allowed */
+ /* 12*/ { BARCODE_TELEPEN_NUM, -1, "1X34567X9X", -1, 0, 1, 128, "" }, /* [0-9]X allowed multiple times */
+ /* 13*/ { BARCODE_TELEPEN_NUM, -1, "\020", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 398: DLE (ASCII 16) cannot be first character in Compressed Numeric Mode" },
+ /* 14*/ { BARCODE_TELEPEN_NUM, 1, "\020", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 398: DLE (ASCII 16) cannot be first character in Compressed Numeric Mode" },
+ /* 15*/ { BARCODE_TELEPEN_NUM, -1, "12\020é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 395: Invalid character at position 4 in input, extended ASCII not allowed" },
+ /* 16*/ { BARCODE_TELEPEN_NUM, 1, "12\020é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, "Error 395: Invalid character at position 4 in input, extended ASCII not allowed" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol = NULL;
+ char escaped[1024];
+ char escaped2[1024];
+ char cmp_buf[8192];
+ char cmp_msg[1024];
+ char ret_buf[8192];
+
+ /* Only do zxing-cpp tests if asked, too slow otherwise */
+ int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
+
testStartSymbol(p_ctx->func_name, &symbol);
for (i = 0; i < data_size; i++) {
@@ -205,16 +351,41 @@ static void test_input(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
- length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
+ length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
+ -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/,
+ data[i].data, data[i].length, debug);
- ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
- assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
- assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n", i, ret ? "set" : "empty", symbol->errtxt);
- assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected_errtxt);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
+ assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
+ i, ret, data[i].ret, symbol->errtxt);
+ assert_equal(symbol->errtxt[0] == '\0', ret == 0, "i:%d symbol->errtxt not %s (%s)\n",
+ i, ret ? "set" : "empty", symbol->errtxt);
+ assert_zero(strcmp(symbol->errtxt, data[i].expected_errtxt), "i:%d strcmp(%s, %s) != 0\n",
+ i, symbol->errtxt, data[i].expected_errtxt);
if (ret < ZINT_ERROR) {
- assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows);
- assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width);
+ assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n",
+ i, symbol->rows, data[i].expected_rows);
+ assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n",
+ i, symbol->width, data[i].expected_width);
+
+ if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
+ int cmp_len, ret_len;
+ char modules_dump[4096];
+ assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)),-1,
+ "i:%d testUtilModulesDump == -1\n", i);
+ ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
+ sizeof(cmp_buf), &cmp_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
+ i, testUtilBarcodeName(symbol->symbology), ret);
+
+ ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
+ NULL /*primary*/, ret_buf, &ret_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
+ i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
+ testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
+ testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
+ }
}
ZBarcode_Delete(symbol);
@@ -224,14 +395,15 @@ static void test_input(const testCtx *const p_ctx) {
}
/* Telepen Barcode Symbology information and History (BSiH)
- https://telepen.co.uk/wp-content/uploads/2018/10/Barcode-Symbology-information-and-History.pdf */
-/* E2326U: SB Telepen Barcode Fonts Guide Issue 2 (Apr 2009)
- https://telepen.co.uk/wp-content/uploads/2018/09/SB-Telepen-Barcode-Fonts-V2.pdf */
+ https://advanova.co.uk/wp-content/uploads/2022/05/Barcode-Symbology-information-and-History.pdf */
+/* E2326U: SB Telepen Fonts Guide. Issue 3 13/5/2022
+ https://advanova.co.uk/wp-content/uploads/2022/05/SB-Telepen-Barcode-Fonts-V3.pdf */
static void test_encode(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
int symbology;
+ int option_2;
const char *data;
int length;
int ret;
@@ -241,35 +413,48 @@ static void test_encode(const testCtx *const p_ctx) {
const char *comment;
const char *expected;
};
+ /* s/\v(\/\*)[ 0-9]*(\*\/)/\=printf("%s%3d%s", submatch(1), (@z+setreg('z',@z+1)), submatch(2))/ | let @z=0: */
static const struct item data[] = {
- /* 0*/ { BARCODE_TELEPEN, "1A", -1, 0, 1, 80, "Telepen BSiH Example, same",
+ /* 0*/ { BARCODE_TELEPEN, -1, "1A", -1, 0, 1, 80, "Telepen BSiH Example, same",
"10101010101110001011101000100010101110111011100010100010001110101110001010101010"
},
- /* 1*/ { BARCODE_TELEPEN, "ABC", -1, 0, 1, 96, "Telepen E2326U Example, same",
+ /* 1*/ { BARCODE_TELEPEN, -1, "ABC", -1, 0, 1, 96, "Telepen E2326U Example, same",
"101010101011100010111011101110001110001110111000101011101110101011101000101000101110001010101010"
},
- /* 2*/ { BARCODE_TELEPEN, "RST", -1, 0, 1, 96, "Verified manually against tec-it",
+ /* 2*/ { BARCODE_TELEPEN, -1, "RST", -1, 0, 1, 96, "Verified manually against TEC-IT",
"101010101011100011100011100010101010111010111000111010111000101010111000111011101110001010101010"
},
- /* 3*/ { BARCODE_TELEPEN, "?@", -1, 0, 1, 80, "ASCII count 127, check 0; verified manually against tec-it",
+ /* 3*/ { BARCODE_TELEPEN, -1, "?@", -1, 0, 1, 80, "ASCII count 127, check 0; verified manually against TEC-IT",
"10101010101110001010101010101110111011101110101011101110111011101110001010101010"
},
- /* 4*/ { BARCODE_TELEPEN, "\000", 1, 0, 1, 64, "Verified manually against tec-it",
+ /* 4*/ { BARCODE_TELEPEN, -1, "\000", 1, 0, 1, 64, "Verified manually against TEC-IT",
"1010101010111000111011101110111011101110111011101110001010101010"
},
- /* 5*/ { BARCODE_TELEPEN_NUM, "1234567890", -1, 0, 1, 128, "Verified manually against tec-it",
+ /* 5*/ { BARCODE_TELEPEN, 1, "AB\0201234", -1, 0, 1, 128, "",
+ "10101011101010001011101110111000111000111011100011101110101110101010101110101110101000101010001010101011101110101110101000101010"
+ },
+ /* 6*/ { BARCODE_TELEPEN, 1, "AB\020123", -1, 0, 1, 128, "",
+ "10101011101010001011101110111000111000111011100011101110101110101110101010111010111000100010001010100010100011101110101000101010"
+ },
+ /* 7*/ { BARCODE_TELEPEN, 1, "AB\020", -1, 0, 1, 96, "",
+ "101010111010100010111011101110001110001110111000111011101011101010101110001010101110101000101010"
+ },
+ /* 8*/ { BARCODE_TELEPEN, 1, "AB", -1, 0, 1, 80, "",
+ "10101011101010001011101110111000111000111011100010101000101010001110101000101010"
+ },
+ /* 9*/ { BARCODE_TELEPEN_NUM, -1, "1234567890", -1, 0, 1, 128, "Verified manually against TEC-IT",
"10101010101110001010101110101110101000101010001010101110101110001011101010001000101110001010101010101011101010101110001010101010"
},
- /* 6*/ { BARCODE_TELEPEN_NUM, "123456789", -1, 0, 1, 128, "Verified manually against tec-it (012345679)",
+ /* 10*/ { BARCODE_TELEPEN_NUM, -1, "123456789", -1, 0, 1, 128, "Verified manually against TEC-IT (012345679)",
"10101010101110001110101010111010111000100010001011101110001110001000101010001010111010100010100010111000101110101110001010101010"
},
- /* 7*/ { BARCODE_TELEPEN_NUM, "123X", -1, 0, 1, 80, "Verified manually against tec-it",
+ /* 11*/ { BARCODE_TELEPEN_NUM, -1, "123X", -1, 0, 1, 80, "Verified manually against TEC-IT",
"10101010101110001010101110101110111010111000111011101011101110001110001010101010"
},
- /* 8*/ { BARCODE_TELEPEN_NUM, "1X3X", -1, 0, 1, 80, "Verified manually against tec-it",
+ /* 12*/ { BARCODE_TELEPEN_NUM, -1, "1X3X", -1, 0, 1, 80, "Verified manually against TEC-IT",
"10101010101110001110001110001110111010111000111010111010101110001110001010101010"
},
- /* 9*/ { BARCODE_TELEPEN_NUM, "3637", -1, 0, 1, 80, "Glyph count 127, check 0; verified manually against tec-it",
+ /* 13*/ { BARCODE_TELEPEN_NUM, -1, "3637", -1, 0, 1, 80, "Glyph count 127, check 0; verified manually against TEC-IT",
"10101010101110001010101010101110111011101110101011101110111011101110001010101010"
},
};
@@ -278,10 +463,14 @@ static void test_encode(const testCtx *const p_ctx) {
struct zint_symbol *symbol = NULL;
char escaped[1024];
- char bwipp_buf[8192];
- char bwipp_msg[1024];
+ char escaped2[1024];
+ char cmp_buf[8192];
+ char cmp_msg[1024];
+ char ret_buf[8192];
- int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test 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_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder();
testStartSymbol(p_ctx->func_name, &symbol);
@@ -292,14 +481,18 @@ static void test_encode(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
- length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
+ length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/,
+ -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/,
+ data[i].data, data[i].length, debug);
- ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
- assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
+ assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
+ i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
- printf(" /*%3d*/ { %s, \"%s\", %d, %s, %d, %d, \"%s\",\n",
- i, testUtilBarcodeName(data[i].symbology), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
+ printf(" /*%3d*/ { %s, %d, \"%s\", %d, %s, %d, %d, \"%s\",\n",
+ i, testUtilBarcodeName(data[i].symbology), data[i].option_2,
+ testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), data[i].length,
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
testUtilModulesPrint(symbol, " ", "\n");
printf(" },\n");
@@ -307,19 +500,41 @@ static void test_encode(const testCtx *const p_ctx) {
if (ret < ZINT_ERROR) {
int width, row;
- assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data);
- assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data);
+ assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n",
+ i, symbol->rows, data[i].expected_rows, data[i].data);
+ assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n",
+ i, symbol->width, data[i].expected_width, data[i].data);
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
- assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
+ assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n",
+ i, ret, width, row, data[i].data);
- if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
- ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf), NULL);
- assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
+ if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
+ ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf,
+ sizeof(cmp_buf), NULL /*p_parsefnc*/);
+ assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n",
+ i, testUtilBarcodeName(symbol->symbology), ret);
- ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
+ ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
- i, testUtilBarcodeName(symbol->symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
+ i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg, cmp_buf, data[i].expected);
+ }
+ if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
+ int cmp_len, ret_len;
+ char modules_dump[4096];
+ assert_notequal(testUtilModulesDump(symbol, modules_dump, sizeof(modules_dump)),-1,
+ "i:%d testUtilModulesDump == -1\n", i);
+ ret = testUtilZXingCPP(i, symbol, data[i].data, length, modules_dump, 3 /*zxingcpp_cmp*/, cmp_buf,
+ sizeof(cmp_buf), &cmp_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPP ret %d != 0\n",
+ i, testUtilBarcodeName(symbol->symbology), ret);
+
+ ret = testUtilZXingCPPCmp(symbol, cmp_msg, cmp_buf, cmp_len, data[i].data, length,
+ NULL /*primary*/, ret_buf, &ret_len);
+ assert_zero(ret, "i:%d %s testUtilZXingCPPCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
+ i, testUtilBarcodeName(symbol->symbology), ret, cmp_msg,
+ testUtilEscape(cmp_buf, cmp_len, escaped, sizeof(escaped)),
+ testUtilEscape(ret_buf, ret_len, escaped2, sizeof(escaped2)));
}
}
}
@@ -347,7 +562,7 @@ static void test_fuzz(const testCtx *const p_ctx) {
/* 1*/ { BARCODE_TELEPEN, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_TOO_LONG },
/* 2*/ { BARCODE_TELEPEN_NUM, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000", 70, ZINT_ERROR_INVALID_DATA },
/* 3*/ { BARCODE_TELEPEN_NUM, "0404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404", 136, 0 },
- /* 4*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", 137, ZINT_ERROR_TOO_LONG },
+ /* 4*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", 137, 0 },
/* 5*/ { BARCODE_TELEPEN_NUM, "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000X", 136, 0 },
/* 6*/ { BARCODE_TELEPEN_NUM, "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999", 136, 0 },
/* 7*/ { BARCODE_TELEPEN_NUM, "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 4, 0 }, /* Length given, strlen > 137, so pseudo not NUL-terminated */
@@ -370,8 +585,9 @@ static void test_fuzz(const testCtx *const p_ctx) {
length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
- ret = ZBarcode_Encode(symbol, TCU(data[i].data), length);
- assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
+ ret = ZBarcode_Encode(symbol, ZCUCP(data[i].data), length);
+ assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n",
+ i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol);
}
@@ -379,40 +595,43 @@ static void test_fuzz(const testCtx *const p_ctx) {
testFinish();
}
-static const char TeleTable[128][16] = {
- { "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" },
- { "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" },
- { "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" },
- { "3111113131" }, { "1113133111" }, { "1311133111" }, { "111111113131" },
- { "3131113111" }, { "11313331" }, { "333331" }, { "111131113111" },
- { "31113331" }, { "1133113111" }, { "1313113111" }, { "1111113331" },
- { "31131331" }, { "113111113111" }, { "3311113111" }, { "1111131331" },
- { "311111113111" }, { "1113111331" }, { "1311111331" }, { "11111111113111" },
- { "31313311" }, { "1131311131" }, { "33311131" }, { "1111313311" },
- { "3111311131" }, { "11333311" }, { "13133311" }, { "111111311131" },
- { "31331131" }, { "1131113311" }, { "33113311" }, { "1111331131" },
- { "3111113311" }, { "1113131131" }, { "1311131131" }, { "111111113311" },
- { "3131111131" }, { "1131131311" }, { "33131311" }, { "111131111131" },
- { "3111131311" }, { "1133111131" }, { "1313111131" }, { "111111131311" },
- { "3113111311" }, { "113111111131" }, { "3311111131" }, { "111113111311" },
- { "311111111131" }, { "111311111311" }, { "131111111311" }, { "11111111111131" },
- { "3131311111" }, { "11313133" }, { "333133" }, { "111131311111" },
- { "31113133" }, { "1133311111" }, { "1313311111" }, { "1111113133" },
- { "313333" }, { "113111311111" }, { "3311311111" }, { "11113333" },
- { "311111311111" }, { "11131333" }, { "13111333" }, { "11111111311111" },
- { "31311133" }, { "1131331111" }, { "33331111" }, { "1111311133" },
- { "3111331111" }, { "11331133" }, { "13131133" }, { "111111331111" },
- { "3113131111" }, { "1131111133" }, { "33111133" }, { "111113131111" },
- { "3111111133" }, { "111311131111" }, { "131111131111" }, { "111111111133" },
- { "31311313" }, { "113131111111" }, { "3331111111" }, { "1111311313" },
- { "311131111111" }, { "11331313" }, { "13131313" }, { "11111131111111" },
- { "3133111111" }, { "1131111313" }, { "33111313" }, { "111133111111" },
- { "3111111313" }, { "111313111111" }, { "131113111111" }, { "111111111313" },
- { "313111111111" }, { "1131131113" }, { "33131113" }, { "11113111111111" },
- { "3111131113" }, { "113311111111" }, { "131311111111" }, { "111111131113" },
- { "3113111113" }, { "11311111111111" }, { "331111111111" }, { "111113111113" },
- { "31111111111111" }, { "111311111113" }, { "131111111113" },
- {'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'},
+/* Copy of "telepen.c" one */
+static const char TeleTable[132][16] = {
+ { "31313131" }, { "1131313111" }, { "33313111" }, { "1111313131" }, /*00-03*/
+ { "3111313111" }, { "11333131" }, { "13133131" }, { "111111313111" }, /*04-07*/
+ { "31333111" }, { "1131113131" }, { "33113131" }, { "1111333111" }, /*08-0B*/
+ { "3111113131" }, { "1113133111" }, { "1311133111" }, { "111111113131" }, /*0C-0F*/
+ { "3131113111" }, { "11313331" }, { "333331" }, { "111131113111" }, /*10-13*/
+ { "31113331" }, { "1133113111" }, { "1313113111" }, { "1111113331" }, /*14-17*/
+ { "31131331" }, { "113111113111" }, { "3311113111" }, { "1111131331" }, /*18-1B*/
+ { "311111113111" }, { "1113111331" }, { "1311111331" }, { "11111111113111" }, /*1C-1F*/
+ { "31313311" }, { "1131311131" }, { "33311131" }, { "1111313311" }, /*20-23*/
+ { "3111311131" }, { "11333311" }, { "13133311" }, { "111111311131" }, /*24-27*/
+ { "31331131" }, { "1131113311" }, { "33113311" }, { "1111331131" }, /*28-2B*/
+ { "3111113311" }, { "1113131131" }, { "1311131131" }, { "111111113311" }, /*2C-2F*/
+ { "3131111131" }, { "1131131311" }, { "33131311" }, { "111131111131" }, /*30-33*/
+ { "3111131311" }, { "1133111131" }, { "1313111131" }, { "111111131311" }, /*34-37*/
+ { "3113111311" }, { "113111111131" }, { "3311111131" }, { "111113111311" }, /*38-3B*/
+ { "311111111131" }, { "111311111311" }, { "131111111311" }, { "11111111111131" }, /*3C-3F*/
+ { "3131311111" }, { "11313133" }, { "333133" }, { "111131311111" }, /*40-43*/
+ { "31113133" }, { "1133311111" }, { "1313311111" }, { "1111113133" }, /*44-47*/
+ { "313333" }, { "113111311111" }, { "3311311111" }, { "11113333" }, /*48-4B*/
+ { "311111311111" }, { "11131333" }, { "13111333" }, { "11111111311111" }, /*4C-4F*/
+ { "31311133" }, { "1131331111" }, { "33331111" }, { "1111311133" }, /*50-53*/
+ { "3111331111" }, { "11331133" }, { "13131133" }, { "111111331111" }, /*54-57*/
+ { "3113131111" }, { "1131111133" }, { "33111133" }, { "111113131111" }, /*58-5B*/
+ { "3111111133" }, { "111311131111" }, { "131111131111" }, { "111111111133" /*START*/ }, /*5C-5F*/
+ { "31311313" }, { "113131111111" }, { "3331111111" }, { "1111311313" }, /*60-63*/
+ { "311131111111" }, { "11331313" }, { "13131313" }, { "11111131111111" }, /*64-67*/
+ { "3133111111" }, { "1131111313" }, { "33111313" }, { "111133111111" }, /*68-6B*/
+ { "3111111313" }, { "111313111111" }, { "131113111111" }, { "111111111313" }, /*6C-6F*/
+ { "313111111111" }, { "1131131113" }, { "33131113" }, { "11113111111111" }, /*70-73*/
+ { "3111131113" }, { "113311111111" }, { "131311111111" }, { "111111131113" }, /*74-77*/
+ { "3113111113" }, { "11311111111111" }, { "331111111111" /*STOP*/ }, { "111113111113" }, /*78-7B*/
+ { "31111111111111" }, { "111311111113" }, { "131111111113" }, /*7C-7E*/
+ {'1','1','1','1','1','1','1','1','1','1','1','1','1','1','1','1'}, /*7F*/
+ { "111111113113" /*START 2*/ }, { "311311111111" /*STOP 2*/ }, /*80-81*/
+ { "111111311113" /*START 3*/ }, { "311113111111" /*STOP 3*/ }, /*82-83*/
};
/* Dummy to generate lengths table */
@@ -424,15 +643,16 @@ static void test_generate_lens(const testCtx *const p_ctx) {
return;
}
- printf("static const char TeleLens[128] = {");
+ printf("static const char TeleLens[128] = {\n ");
for (i = 0; i < 127; i++) {
- if ((i % 16) == 0) {
- printf("\n %2d,", (int) strlen(TeleTable[i]));
+ if (i && (i % 16) == 0) {
+ printf(" /*%02X-%02X*/\n %2d,", i - 16, i - 1, (int) strlen(TeleTable[i]));
} else {
printf(" %2d,", (int) strlen(TeleTable[i]));
}
}
- printf(" 16\n};\n");
+ printf(" 16 /*70-7F*/\n};\n");
+ /* Not bothering with START/STOP 2/3 */
}
int main(int argc, char *argv[]) {
diff --git a/backend/tests/test_vector.c b/backend/tests/test_vector.c
index 254cdcb4..2bd7f8ac 100644
--- a/backend/tests/test_vector.c
+++ b/backend/tests/test_vector.c
@@ -2545,9 +2545,9 @@ static void test_height(const testCtx *const p_ctx) {
/*110*/ { BARCODE_DBAR_EXP, -1, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "" },
/*111*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 33, "[01]12345678901231", "", ZINT_WARN_NONCOMPLIANT, 33, 1, 134, 268, 66, "" },
/*112*/ { BARCODE_DBAR_EXP, COMPLIANT_HEIGHT, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" },
- /*113*/ { BARCODE_TELEPEN, -1, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "" },
- /*114*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "No known min" },
- /*115*/ { BARCODE_TELEPEN, -1, 4, "1234567890", "", 0, 4, 1, 208, 416, 8, "" },
+ /*113*/ { BARCODE_TELEPEN, -1, 8.95, "1234567890", "", 0, 8.95, 1, 208, 416, 17.9, "" },
+ /*114*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 8.95, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 8.95, 1, 208, 416, 17.9, "" },
+ /*115*/ { BARCODE_TELEPEN, COMPLIANT_HEIGHT, 9, "1234567890", "", 0, 9, 1, 208, 416, 18, "" },
/*116*/ { BARCODE_UPCA, -1, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "" },
/*117*/ { BARCODE_UPCA, -1, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "" },
/*118*/ { BARCODE_UPCA, COMPLIANT_HEIGHT, 69, "12345678901", "", ZINT_WARN_NONCOMPLIANT, 69, 1, 95, 226, 148, "" },
@@ -2764,9 +2764,9 @@ static void test_height(const testCtx *const p_ctx) {
/*329*/ { BARCODE_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "" },
/*330*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "TODO: Find doc" },
/*331*/ { BARCODE_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "" },
- /*332*/ { BARCODE_TELEPEN_NUM, -1, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "" },
- /*333*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "No known min" },
- /*334*/ { BARCODE_TELEPEN_NUM, -1, 4, "1234567890", "", 0, 4, 1, 128, 256, 8, "" },
+ /*332*/ { BARCODE_TELEPEN_NUM, -1, 6.65, "1234567890", "", 0, 6.65, 1, 128, 256, 13.3, "" },
+ /*333*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 6.65, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 6.65, 1, 128, 256, 13.3, "" },
+ /*334*/ { BARCODE_TELEPEN_NUM, COMPLIANT_HEIGHT, 6.7, "1234567890", "", 0, 6.7, 1, 128, 256, 13.4, "" },
/*335*/ { BARCODE_ITF14, -1, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "" },
/*336*/ { BARCODE_ITF14, -1, 5.7, "1234567890", "", 0, 5.6999998, 1, 135, 330, 31.4, "" },
/*337*/ { BARCODE_ITF14, COMPLIANT_HEIGHT, 5.7, "1234567890", "", ZINT_WARN_NONCOMPLIANT, 5.6999998, 1, 135, 330, 31.4, "" },
diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c
index 477343b4..b1360977 100644
--- a/backend/tests/testcommon.c
+++ b/backend/tests/testcommon.c
@@ -3985,7 +3985,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "DataBar", BARCODE_DBAR_OMN, 29, },
{ "DataBarLimited", BARCODE_DBAR_LTD, 30, },
{ "DataBarExpanded", BARCODE_DBAR_EXP, 31, },
- { "", BARCODE_TELEPEN, 32, },
+ { "TelepenAlpha", BARCODE_TELEPEN, 32, },
{ "", -1, 33, },
{ "UPC-A", BARCODE_UPCA, 34, },
{ "UPC-A", BARCODE_UPCA_CHK, 35, },
@@ -4040,7 +4040,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym
{ "MicroPDF417", BARCODE_MICROPDF417, 84, },
{ "", BARCODE_USPS_IMAIL, 85, },
{ "", BARCODE_PLESSEY, 86, },
- { "", BARCODE_TELEPEN_NUM, 87, },
+ { "TelepenNumeric", BARCODE_TELEPEN_NUM, 87, },
{ "", -1, 88, },
{ "ITF", BARCODE_ITF14, 89, },
{ "", BARCODE_KIX, 90, },
@@ -4400,6 +4400,8 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
char *pzn = symbology == BARCODE_PZN ? (char *) z_alloca(expected_len + 1 + 1) : NULL;
char *dxfe = symbology == BARCODE_DXFILMEDGE ? (char *) z_alloca(expected_len * 2 + 1) : NULL;
char azrune[4];
+ char *telepen = symbology == BARCODE_TELEPEN || symbology == BARCODE_TELEPEN_NUM
+ ? (char *) z_alloca(expected_len + 1 + 1 + 1) : NULL;
int ret;
int ret_memcmp;
@@ -4740,6 +4742,54 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
} else if ((symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_LOGMARS)
&& have_ccheckdigit) {
cmp_len--; /* Too tedious to calculate so ignore */
+
+ } else if (symbology == BARCODE_TELEPEN_NUM) {
+ const int dle_posn = z_posn(expected, '\x10');
+ if (dle_posn != -1) {
+ if (dle_posn & 1) {
+ telepen[0] = '0';
+ memcpy(telepen + 1, expected, dle_posn);
+ z_to_upper(ZUCP(telepen + 1), dle_posn);
+ memcpy(telepen + dle_posn + 1, expected + dle_posn + 1, expected_len - (dle_posn + 1));
+ expected = telepen;
+ } else {
+ memcpy(telepen, expected, dle_posn);
+ z_to_upper(ZUCP(telepen), dle_posn);
+ memcpy(telepen + dle_posn, expected + dle_posn + 1, expected_len - (dle_posn + 1));
+ expected = telepen;
+ expected_len--;
+ }
+ } else if (expected_len & 1) {
+ telepen[0] = '0';
+ memcpy(telepen + 1, expected, expected_len);
+ z_to_upper(ZUCP(telepen + 1), expected_len);
+ expected = telepen;
+ expected_len++;
+ } else {
+ memcpy(telepen, expected, expected_len);
+ z_to_upper(ZUCP(telepen), expected_len);
+ expected = telepen;
+ }
+
+ } else if (symbology == BARCODE_TELEPEN && symbol->option_2 == 1) {
+ const int dle_posn = z_posn(expected, '\x10');
+ if (dle_posn != -1) {
+ memcpy(telepen, expected, dle_posn);
+ if (dle_posn + 1 < expected_len) {
+ if ((expected_len - (dle_posn + 1)) & 1) {
+ telepen[dle_posn] = '0';
+ memcpy(telepen + dle_posn + 1, expected + dle_posn + 1, expected_len - (dle_posn + 1));
+ z_to_upper(ZUCP(telepen + dle_posn + 1), expected_len - (dle_posn + 1));
+ } else {
+ memcpy(telepen + dle_posn, expected + dle_posn + 1, expected_len - (dle_posn + 1));
+ z_to_upper(ZUCP(telepen + dle_posn), expected_len - (dle_posn + 1));
+ expected_len--;
+ }
+ } else {
+ expected_len--;
+ }
+ expected = telepen;
+ }
}
if (ret_buf) {
diff --git a/backend/tests/tools/run_zxingcpp_tests.sh b/backend/tests/tools/run_zxingcpp_tests.sh
index 8b27660d..ed20c171 100755
--- a/backend/tests/tools/run_zxingcpp_tests.sh
+++ b/backend/tests/tools/run_zxingcpp_tests.sh
@@ -56,5 +56,6 @@ run_zxingcpp_test "test_pdf417" "fuzz"
run_zxingcpp_test "test_qr"
run_zxingcpp_test "test_rss" "binary_div_modulo_divisor"
run_zxingcpp_test "test_rss" "examples"
+run_zxingcpp_test "test_telepen"
run_zxingcpp_test "test_upcean" "upce_input"
run_zxingcpp_test "test_upcean" "encode"
diff --git a/backend_qt/qzint.cpp b/backend_qt/qzint.cpp
index a27846df..5361fa2e 100644
--- a/backend_qt/qzint.cpp
+++ b/backend_qt/qzint.cpp
@@ -1531,6 +1531,7 @@ namespace Zint {
|| m_symbol == BARCODE_QRCODE || m_symbol == BARCODE_HIBC_QR || m_symbol == BARCODE_MICROQR
|| m_symbol == BARCODE_RMQR || m_symbol == BARCODE_GRIDMATRIX || m_symbol == BARCODE_HANXIN
|| m_symbol == BARCODE_CHANNEL || m_symbol == BARCODE_CODEONE || m_symbol == BARCODE_CODE93
+ || m_symbol == BARCODE_TELEPEN || m_symbol == BARCODE_TELEPEN_NUM
|| m_symbol == BARCODE_ULTRA || m_symbol == BARCODE_VIN) {
arg_int(cmd, "--vers=", option2());
} else if (m_symbol == BARCODE_DAFT && option2() != 250) {
diff --git a/backend_qt/tests/test_qzint.cpp b/backend_qt/tests/test_qzint.cpp
index 07126466..9a8f5ef2 100644
--- a/backend_qt/tests/test_qzint.cpp
+++ b/backend_qt/tests/test_qzint.cpp
@@ -1353,6 +1353,22 @@ private slots:
<< "zint.exe -b 145 --eci=20 -d \"テ\" --rotate=180 --vers=8"
<< "" << "" << "" << "";
+ QTest::newRow("BARCODE_TELEPEN") << false << 0.0f << ""
+ << BARCODE_TELEPEN << (DATA_MODE | ESCAPE_MODE) // symbology-inputMode
+ << "ABCDE\\L123" << "" // text-primary
+ << 0.0f << -1 << 1 << 0 << 1.0f // height-scale
+ << 0.0f << false << 0.8f << 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 << false << false << false << true << 0 // showText-rotateAngle
+ << 0 << false << false << false << false // eci-gs1SyntaxEngine
+ << false << false << false << WARN_DEFAULT << false // readerInit-debug
+ << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp
+ << "zint -b 32 --binary --compliantheight -d 'ABCDE\\L123' --esc --vers=1"
+ << "zint.exe -b 32 --binary --compliantheight -d \"ABCDE\\L123\" --esc --vers=1"
+ << "" << "" << "" << "";
+
QTest::newRow("BARCODE_ULTRA") << false << 0.0f << ""
<< BARCODE_ULTRA << (GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE) // symbology-inputMode
<< "(01)1" << "" // text-primary
diff --git a/docs/images/telepen.svg b/docs/images/telepen.svg
index 2ce4076d..fcf37c3e 100644
--- a/docs/images/telepen.svg
+++ b/docs/images/telepen.svg
@@ -1,12 +1,12 @@
-
+
Zint Generated Symbol
-
-
-
- Z80
+
+
+
+ Z8000
diff --git a/docs/images/telepen_aim.svg b/docs/images/telepen_aim.svg
new file mode 100644
index 00000000..665fb9d2
--- /dev/null
+++ b/docs/images/telepen_aim.svg
@@ -0,0 +1,12 @@
+
+
+
+ Zint Generated Symbol
+
+
+
+
+ Z8000
+
+
+
diff --git a/docs/images/telepen_num_asc.svg b/docs/images/telepen_num_asc.svg
new file mode 100644
index 00000000..edf7a32e
--- /dev/null
+++ b/docs/images/telepen_num_asc.svg
@@ -0,0 +1,12 @@
+
+
+
+ Zint Generated Symbol
+
+
+
+
+ 12AB
+
+
+
diff --git a/docs/images/telepen_num_odd.svg b/docs/images/telepen_num_odd.svg
new file mode 100644
index 00000000..84c14037
--- /dev/null
+++ b/docs/images/telepen_num_odd.svg
@@ -0,0 +1,12 @@
+
+
+
+ Zint Generated Symbol
+
+
+
+
+ 123
+
+
+
diff --git a/docs/manual.html b/docs/manual.html
index bf669079..0c4b23b2 100644
--- a/docs/manual.html
+++ b/docs/manual.html
@@ -334,7 +334,7 @@
Zint Barcode Generator and Zint Barcode Studio User
Manual
Version 2.16.0.9
-April 2026
+May 2026
@@ -1416,12 +1416,24 @@ Sequences
Carriage Return
+\L
+0x10
+DLE
+Data Link Escape
+
+
\e
0x1B
ESC
Escape
+\F
+0x1C
+FS
+File Separator
+
+
\G
0x1D
GS
@@ -1434,6 +1446,12 @@ Sequences
Record Separator
+\N
+0x1F
+US
+Unit Separator
+
+
\(
0x28
(
@@ -1537,7 +1555,7 @@ automatic Code Set selection
-Currently the only special character recognized is the Function Code
+
Currently the only special character recognised is the Function Code
1 character FNC1. If your data contains the sequence
“\^” then it must be escaped using the extra escape
sequence “\^^”, i.e. by doubling the caret.
@@ -2443,17 +2461,17 @@ X-dimension and Resolution
An alternative way to specify the scale, which takes the above
details into account, is to specify measurable units using the
--scalexdimdp option, which has the format
- --scalexdimdp=X[,R]
+--scalexdimdp[=X[,R]]
where X is the X-dimension (in mm by default) and
R is the resolution (in dpmm, dots per mm, by default).
R is optional, and defaults to 12 dpmm, and X
-may be zero, in which case it uses a symbology-specific default. The
-units may be given in inches for X by appending
-"in", and in dpi (dots per inch) for R by
-appending "dpi". For example
+is optional or may be zero, in which case it uses a symbology-specific
+default. The units may be given in inches for X by
+appending "in", and in dpi (dots per inch) for
+R by appending "dpi". For example
zint -d "1234" --scalexdimdp = 0.013in,300dpi
-Explicit metric units may also be given by appending
+
Explicit metric units may also be given (for clarity) by appending
"mm" and "dpmm" as appropriate, and may be
mixed with U.S. units:
--scalexdimdp option
with
zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp = 0
+class="sourceCode bash">zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp
as 0.33mm is the default X-dimension for EAN, and 12 dpmm the default
resolution.
4.9.3 MaxiCode Raster Scaling
@@ -5102,23 +5120,60 @@ and can encode ASCII text input, up to a maximum of 69 characters.
Telepen includes a hidden modulo-127 check digit, added by Zint.
+alt="zint -b TELEPEN --compliantheight -d "Z8000"" />
Figure 55:
-zint -b TELEPEN --compliantheight -d "Z80"
+zint -b TELEPEN --compliantheight -d "Z8000"
+Full ASCII + Compressed Numeric Mode, which uses different
+AIM-defined Start/Stop characters, may be enabled by setting
+--vers=1 (API option_2 = 1). In this mode
+control character DLE (ASCII 16, escape sequence
+\L) indicates a switch from Full ASCII to Compressed
+Numeric, where each symbol character encodes a digit pair:
+
+
+Figure 56:
+zint -b TELEPEN --compliantheight -d "Z\L8000" -esc --vers=1
+
+However not all barcode readers recognise this mode so check before
+using.
6.1.6.2 Telepen Numeric
Telepen Numeric allows compression of numeric data into a Telepen
symbol. Data can consist of pairs of numbers or pairs consisting of a
numerical digit followed an X character. For example: 466333 and 466X33
are valid codes whereas 46X333 is not (the digit pair "X3"
-is not valid). Up to 136 digits can be encoded. Telepen Numeric includes
+is not valid). Up to 138 digits can be encoded. Telepen Numeric includes
a hidden modulo-127 check digit which is added by Zint.
-Figure 56:
+Figure 57:
zint -b TELEPEN_NUM --compliantheight -d "466X33"
+Trailing ASCII characters may also be encoded by prefixing them with
+a DLE control character (ASCII 16, escape sequence
+\L) and appending them to the numeric data:
+
+
+Figure 58:
+zint -b TELEPEN_NUM --compliantheight -d "12\LAB"
+–esc
+
+This method allows odd numbers to be encoded without a leading
+zero:
+
+
+Figure 59:
+zint -b TELEPEN_NUM --compliantheight -d "123\L4"
+–esc
+
+AIM-defined Start/Stop characters may be enabled by setting
+--vers=1 (API option_2 = 1). This allows
+barcode readers that recognise them to detect Compressed Numeric data
+automatically.
6.1.7 Code 39
6.1.7.1 Standard Code 39 (ISO
16388)
@@ -5130,7 +5185,7 @@ A-Z, dash (-), full stop (.), space, asterisk
-Figure 57:
+Figure 60:
zint -b CODE39 --compliantheight -d "1A" --vers=1
The standard does not require a check digit but a modulo-43 check
@@ -5145,7 +5200,7 @@ set.
-Figure 58:
+Figure 61:
zint -b EXCODE39 --compliantheight -d "123.45#@fd"
The check digit options are the same as for --vers=1 (API
-Figure 59:
+Figure 62:
zint -b CODE93 --compliantheight -d "C93"
6.1.7.4 PZN (Pharmazentralnummer)
@@ -5172,7 +5227,7 @@ validate the check digit.
-Figure 60:
+Figure 63:
zint -b PZN --compliantheight -d "2758089"
To encode a PZN7 (obsolete since 2013) instead set
@@ -5189,7 +5244,7 @@ restricted to a maximum of 30 characters.
-Figure 61:
+Figure 64:
zint -b LOGMARS --compliantheight -d "12345/ABCDE" --vers=1
6.1.7.6 Code 32
@@ -5200,7 +5255,7 @@ length. A check digit is added by Zint.
-Figure 62:
+Figure 65:
zint -b CODE32 --compliantheight -d "14352312"
6.1.7.7 HIBC Code 39
@@ -5210,7 +5265,7 @@ Health Industry Barcode standards.
-Figure 63:
+Figure 66:
zint -b HIBC_39 --compliantheight -d "14352312"
6.1.7.8 Vehicle
@@ -5223,7 +5278,7 @@ is required.
-Figure 64:
+Figure 67:
zint -b VIN -d "2FTPX28L0XCA15511" --vers=1
An invisible Import character prefix 'I' can be added by
@@ -5237,7 +5292,7 @@ barcode for blood products.
-Figure 65:
+Figure 68:
zint -b CODABAR --compliantheight -d "A37859B"
Codabar can encode up to 103 characters starting and ending with the
@@ -5257,7 +5312,7 @@ numbers between 3 and 131070.
-Figure 66:
+Figure 69:
zint -b PHARMA --compliantheight -d "130170"
6.1.10 Code 128
@@ -5271,7 +5326,7 @@ B and C (but see below) and adds a hidden modulo-103 check digit.
-Figure 67:
+Figure 70:
zint -b CODE128 --bind -d "130170X178"
Code 128 is the default barcode symbology used by Zint. In addition
@@ -5320,7 +5375,7 @@ Code Set C in favour of Code Sets A and B.
-Figure 68:
+Figure 71:
zint -b CODE128AB -d "130170X178"
Note that the special extra escapes mentioned above are not available
@@ -5333,7 +5388,7 @@ GS1 Data Entry. Here we will use the square bracket format.
-Figure 69:
+Figure 72:
zint -b GS1_128 --compliantheight -d "[01]98898765432106[3202]012345[15]991231"
Fixed length data should be entered at the appropriate length for
@@ -5353,7 +5408,7 @@ are added by Zint.
-Figure 70:
+Figure 73:
zint -b EAN14 --compliantheight -d "9889876543210"
6.1.10.5 NVE-18 (SSCC-18)
@@ -5367,7 +5422,7 @@ digit(s) and HRT-only AI "(00)" are added by Zint.
-Figure 71:
+Figure 74:
zint -b NVE18 --compliantheight -d "37612345000001003"
6.1.10.6 HIBC Code 128
@@ -5377,7 +5432,7 @@ by the Health Industry Barcode standards.
-Figure 72:
+Figure 75:
zint -b HIBC_128 -d "A123BJC5D6E71"
6.1.10.7 DPD Code
@@ -5386,7 +5441,7 @@ Paketdienst).
-Figure 73:
+Figure 76:
zint -b DPD --compliantheight -d "000393206219912345678101040"
DPD Code requires a 27 or 28 character input. For 28 character input,
@@ -5447,7 +5502,7 @@ a modulo-11 check digit, and "CC" is a two-character ISO
-Figure 74:
+Figure 77:
zint -b UPU_S10 --compliantheight -d "EE876543216CA"
The check digit may be omitted in which case Zint will add it.
@@ -5472,7 +5527,7 @@ will be verified.) Input less than 13 digits will be zero-filled.
-Figure 75:
+Figure 78:
zint -b DBAR_OMN --compliantheight -d "0950110153001"
GS1 DataBar Omnidirectional symbols should have a height of 33 or
@@ -5482,7 +5537,7 @@ omnidirectional scanners.
-Figure 76:
+Figure 79:
zint -b DBAR_OMN -d "0950110153001" --height=13
6.1.11.2 GS1 DataBar Limited
@@ -5497,7 +5552,7 @@ than 13 digits will be zero-filled.
-Figure 77:
+Figure 80:
zint -b DBAR_LTD --compliantheight -d "0950110153001"
6.1.11.3 GS1 DataBar Expanded
@@ -5509,7 +5564,7 @@ in the Human Readable Text.
-Figure 78:
+Figure 81:
zint -b DBAR_EXP --compliantheight -d "[01]98898765432106[3202]012345[15]991231"
The GTIN-14 data for AI (01) must include the standard GS1 check
@@ -5525,7 +5580,7 @@ includes one check digit.
-Figure 79:
+Figure 82:
zint -b KOREAPOST -d "923457"
6.1.13 Channel Code
@@ -5538,7 +5593,7 @@ code by default.
-Figure 80:
+Figure 83:
zint -b CHANNEL -d "453678" --compliantheight
The maximum values permitted depend on the number of channels used as
@@ -5597,7 +5652,7 @@ position. Lowercase input is automatically made uppercase.
-Figure 81:
+Figure 84:
zint -b BC412 -d "AQ45670" --compliantheight
6.2 Stacked Symbologies
@@ -5620,7 +5675,7 @@ class="sourceCode c">
-Figure 82:
+Figure 85:
zint -d "This" -d "That"
Note that the Human Readable Text will be that of the last data, so
@@ -5637,7 +5692,7 @@ class="sourceCode bash">
-Figure 83:
+Figure 86:
zint --notext --bind --separator=2 -d "This" -d "That"
A more sophisticated method is to use some type of line indexing
@@ -5651,7 +5706,7 @@ to 1363 all extended ASCII (ISO/IEC 8859-1).
-Figure 84:
+Figure 87:
zint -b CODABLOCKF -d "CODABLOCK F Symbology" --rows=3
The width of the Codablock F symbol can be set using the
@@ -5676,7 +5731,7 @@ use can be set using the --rows option (API
-Figure 85:
+Figure 88:
zint -b CODE16K --compliantheight -d "ab0123456789"
6.2.4 PDF417 (ISO 15438)
@@ -5688,7 +5743,7 @@ or 2710 digits.
-Figure 86:
+Figure 89:
zint -b PDF417 -d "PDF417"
The width of the generated PDF417 symbol can be specified at the
@@ -5725,7 +5780,7 @@ are the same as for PDF417 above.
-Figure 87:
+Figure 90:
zint -b PDF417COMP -d "PDF417"
6.2.6 MicroPDF417 (ISO 24728)
@@ -5740,7 +5795,7 @@ The amount of data determines the number of rows.
-Figure 88:
+Figure 91:
zint -b MICROPDF417 -d "12345678"
MicroPDF417 uses Latin-1 character encoding by default but also
@@ -5769,7 +5824,7 @@ not required.
-Figure 89:
+Figure 92:
zint -b DBAR_STK --compliantheight -d "9889876543210"
6.2.7.2 GS1 DataBar Stacked
@@ -5782,7 +5837,7 @@ encoded in two rows of bars with a central 3-row separator.
-Figure 90:
+Figure 93:
zint -b DBAR_OMNSTK --compliantheight -d "9889876543210"
6.2.7.3 GS1 DataBar Expanded
@@ -5794,7 +5849,7 @@ the same maximum capacity.
-Figure 91:
+Figure 94:
zint -b DBAR_EXPSTK --compliantheight -d "[01]98898765432106[3202]012345[15]991231"
The width of the symbol can be altered using the --cols
@@ -5818,7 +5873,7 @@ with values from 2 to 8.
-Figure 92:
+Figure 95:
zint -b CODE49 --compliantheight -d "MULTIPLE ROWS IN CODE 49"
6.3 GS1 Composite Symbols (ISO
@@ -5957,7 +6012,7 @@ use --mode=1 (API option_1 = 1).
-Figure 93:
+Figure 96:
zint -b EAN13_CC --compliantheight -d "[99]1234-abcd" --mode=1 --primary=331234567890
6.3.2 CC-B
@@ -5970,7 +6025,7 @@ string of shorter length. To select CC-B use --mode=2 (API
-Figure 94:
+Figure 97:
zint -b EAN13_CC --compliantheight -d "[99]1234-abcd" --mode=2 --primary=331234567890
6.3.3 CC-C
@@ -5981,7 +6036,7 @@ an alphanumeric string of shorter length. To select CC-C use
-Figure 95:
+Figure 98:
zint -b GS1_128_CC --compliantheight -d "[99]1234-abcd" --mode=3 --primary="[01]03312345678903"
6.4 Two-Track Symbols
@@ -5994,7 +6049,7 @@ and 64570080.
-Figure 96:
+Figure 99:
zint -b PHARMA_TWO --compliantheight -d "29876543"
6.4.2 POSTNET
@@ -6009,7 +6064,7 @@ will be issued if the input length is not one of these.
-Figure 97:
+Figure 100:
zint -b POSTNET --compliantheight -d "12345678901"
6.4.3 PLANET
@@ -6024,7 +6079,7 @@ length is not one of these.
-Figure 98:
+Figure 101:
zint -b PLANET --compliantheight -d "4012345235636"
6.4.4 Brazilian CEPNet
@@ -6035,7 +6090,7 @@ check digit being automatically added by Zint.
-Figure 99:
+Figure 102:
zint -b CEPNET --compliantheight -d "12345678"
6.4.5 DX Film Edge Barcode
@@ -6045,7 +6100,7 @@ post-processing of prints.
-Figure 100:
+Figure 103:
zint -b DXFILMEDGE --compliantheight -d "112-1/10A"
The data can be in two parts. The first part (required) is the “DX
@@ -6080,7 +6135,7 @@ respectively, developed by Australia Post for printing Delivery Point ID
-Figure 101:
+Figure 104:
zint -b AUSPOST --compliantheight -d "96184209"
Valid data characters are 0-9, A-Z, a-z, space and hash (#). A Format
@@ -6161,7 +6216,7 @@ which requires an 8-digit DPID input.
-Figure 102:
+Figure 105:
zint -b AUSREPLY --compliantheight -d "12345678"
6.5.1.3 Routing Barcode
@@ -6170,7 +6225,7 @@ which requires an 8-digit DPID input.
-Figure 103:
+Figure 106:
zint -b AUSROUTE --compliantheight -d "34567890"
6.5.1.4 Redirect Barcode
@@ -6179,7 +6234,7 @@ which requires an 8-digit DPID input.
-Figure 104:
+Figure 107:
zint -b AUSREDIRECT --compliantheight -d "98765432"
6.5.2 Dutch Post KIX Code
@@ -6190,7 +6245,7 @@ check digit is included.
-Figure 105:
+Figure 108:
zint -b KIX --compliantheight -d "2500GG30250"
6.5.3 Royal Mail
@@ -6203,7 +6258,7 @@ Piccadilly Circus in London. Check digit data is generated by Zint.
-Figure 106:
+Figure 109:
zint -b RM4SCC --compliantheight -d "W1J0TR01"
6.5.4 Royal Mail 4-State
@@ -6213,7 +6268,7 @@ includes Reed- Solomon error correction.
-Figure 107:
+Figure 110:
zint -b MAILMARK_4S --compliantheight -d "21B2254800659JW5O9QA6Y"
Input is a pre-formatted alphanumeric string of 22 (for Barcode C) or
@@ -6286,7 +6341,7 @@ POSTNET and PLANET symbologies in 2009.
-Figure 108:
+Figure 111:
zint -b USPS_IMAIL --compliantheight -d "01234567094987654321-01234"
Intelligent Mail is a fixed length 65-bar symbol which combines
@@ -6308,7 +6363,7 @@ by Zint.
-Figure 109:
+Figure 112:
zint -b JAPANPOST --compliantheight -d "15400233-16-4-205"
6.5.7 DAFT Code
@@ -6321,7 +6376,7 @@ respectively. All other characters are invalid.
-Figure 110:
+Figure 113:
zint -b DAFT -d "AAFDTTDAFADTFTTFFFDATFTADTTFFTDAFAFDTF" --height=8.494 --vers=256
The ratio of the tracker size to full height can be given in
@@ -6343,7 +6398,7 @@ encode a large amount of data in a small area.
-Figure 111:
+Figure 114:
zint -b HIBC_DM -d "/ACMRN123456/V200912190833" --fast --square
Data Matrix encodes characters in the Latin-1 set by default but also
@@ -6607,7 +6662,7 @@ Mailmark (CMDM) (Data Matrix)
-Figure 112:
+Figure 115:
zint -b MAILMARK_2D -d "JGB 01Z999999900000001EC1A1AA1A0SN35TQ" --vers=30
This variant of Data Matrix, also known as “Complex Mail Data Mark”
@@ -6780,7 +6835,7 @@ Denso.
-Figure 113:
+Figure 116:
zint -b QRCODE -d "QR Code Symbol" --mask=5
Four levels of error correction are available using the
@@ -7027,7 +7082,7 @@ Latin-1 or Shift JIS being carried out automatically by Zint.
-Figure 114:
+Figure 117:
zint -b MICROQR -d "01234567"
A preferred symbol size can be selected by using the
@@ -7150,7 +7205,7 @@ be entered as UTF-8 with conversion being handled by Zint.
-Figure 115:
+Figure 118:
zint -b RMQR -d "0123456"
The amount of ECC codewords can be adjusted using the
@@ -7395,7 +7450,7 @@ set by Zint and do not need to be specified.
-Figure 116:
+Figure 119:
zint -b UPNQR -i upn_utf8.txt --quietzones
UPNQR is unusual in that it uses Latin-2 (ISO/IEC 8859-2 plus ASCII)
@@ -7417,7 +7472,7 @@ the identification of parcels.
-Figure 117:
+Figure 120:
zint -b MAXICODE -d "1Z00004951\GUPSN\G06X610\G159\G1234567\G1/1\G\GY\G1 MAIN ST\GNY\GNY\R\E" --esc --primary="152382802000000" --scmvv=96
MaxiCode symbols can be encoded in one of five modes. In modes 2 and
@@ -7567,7 +7622,7 @@ pattern.
-Figure 118:
+Figure 121:
zint -b AZTEC -d "123456789012"
Zint can generate Compact Aztec Code (sometimes called Small Aztec
@@ -7795,7 +7850,7 @@ Append.
-Figure 119:
+Figure 122:
zint -b AZRUNE -d "125"
6.6.10 Code One
@@ -7806,7 +7861,7 @@ mechanism.
-Figure 120:
+Figure 123:
zint -b CODEONE -d "1234567890123456789012"
There are two types of Code One symbol - fixed-ratio symbols which
@@ -7925,7 +7980,7 @@ data has not yet been implemented.
-Figure 121:
+Figure 124:
zint -b GRIDMATRIX --eci=29 -d "AAT2556 电池充电器+降压转换器 200mA至2A tel:86 019 82512738"
The size of the symbol and the error correction capacity can be
@@ -8055,7 +8110,7 @@ correction codewords.
-Figure 122:
+Figure 125:
zint -b DOTCODE -d "[01]00012345678905[17]201231[10]ABC123456" --gs1
DotCode has two sets of 4 masks, designated 0-3 and 0’-3’, the second
@@ -8077,7 +8132,7 @@ Support for the encoding of GS1 data has not yet been implemented.
-Figure 123:
+Figure 126:
zint -b HANXIN -d "Hanxin Code symbol"
The size of the symbol can be specified using the --vers
@@ -8433,7 +8488,7 @@ and GS1 modes are supported.
-Figure 124:
+Figure 127:
zint -b ULTRA -d "HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS"
The amount of error correction can be set using the
@@ -8508,7 +8563,7 @@ used to assist automated mail processing.
-Figure 125:
+Figure 128:
zint -b FIM --compliantheight -d "C"
There are only 5 valid symbols which can be generated using the
@@ -8563,7 +8618,7 @@ not include a check digit.
-Figure 126:
+Figure 129:
zint -b FLAT -d "1304056"
ISO/IEC 16022:2024 Information technology - Automatic identification
and data capture techniques - Data Matrix bar code symbology
specification
-ISO/IEC 21471:2020 Information technology - Automatic identification
+ ISO/IEC 21471:2025 Information technology - Automatic identification
and data capture techniques - Extended rectangular data matrix (DMRE)
bar code symbology specification
AIM TSC1705001 (v 4.0 Draft 0.15) - Information technology -
Automatic identification and data capture techniques - Bar code
symbology specification - DotCode (Revised 28th May 2019)
-ISO/IEC 15420:2009 Information technology - Automatic identification
+ ISO/IEC 15420:2025 Information technology - Automatic identification
and data capture techniques - EAN/UPC bar code symbology
specification
AIMD014 (v 1.63) - Information technology, Automatic identification
@@ -8699,6 +8754,8 @@ specification
ISO/IEC 23941:2022 Information technology - Automatic identification
and data capture techniques - Rectangular Micro QR Code (rMQR) bar code
symbology specification
+AIM Europe X-25 - Uniform Symbology Specification Telepen
+(1991)
AIMD/TSC15032-43 (v 0.99c) - International Technical Specification -
Ultracode Symbology (Draft) (Released 4th Nov 2015)
@@ -8716,6 +8773,13 @@ Interpretations Part 3: Register (Version 2, February 2022)
GS1 General Specifications Release 26.0 (Jan 2026)
ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier
Labeling Standard
+ANSI/HIBC 1.3-2010 - The Health Industry Bar Code (HIBC) Provider
+Applications Standard
+ISO/IEC 15424:2025 Information technology - Automatic identification
+and data capture techniques - Data carrier identifiers (including
+symbology identifiers)
+ISO/IEC 15434:2019 Information technology — Automatic identification
+and data capture techniques — Syntax for high-capacity ADC media
Annex A. Character Encoding
This section is intended as a quick reference to the character sets
@@ -9207,7 +9271,7 @@ class="sourceCode bash">
-Figure 127: Tcl/Tk
+Figure 130: Tcl/Tk
demonstration program window
You can select the symbology, enter the data to encode, and set
@@ -9219,9 +9283,9 @@ raster preview of the configured barcode is updated when the
NAME
zint - encode data as a barcode image
SYNOPSIS
-zint [-h |
---help]
-zint [options ]
+zint
+[-h | --help]
+zint [options ]
DESCRIPTION
zint takes input data from the command line or a file to encode in a
barcode which is then output to an image file.
@@ -9237,31 +9301,34 @@ Network Format (PNG), Scalable Vector Graphic
(SVG), or Tagged Image File Format (TIF).
OPTIONS
--h, --help
+-h ,
+--help
Print usage information summarizing command line options.
--b TYPE, --barcode=TYPE
+-b TYPE ,
+--barcode=TYPE
Set the barcode symbology that will be used to encode the data.
-TYPE is the number or name of the barcode symbology. If not
-given, the symbology defaults to 20 (Code 128). To see what types are
-available, use the -t | --types option. Type
-names are case-insensitive, and non-alphanumerics are ignored.
+TYPE is the number or name of the barcode
+symbology. If not given, the symbology defaults to 20 (Code 128). To see
+what types are available, use the -t | --types
+option. Type names are case-insensitive, and non-alphanumerics are
+ignored.
---addongap=INTEGER
+--addongap=INTEGER
For EAN/UPC symbologies, set the gap between the main data and the
-add-on. INTEGER is in integral multiples of the X-dimension.
-The maximum gap that can be set is 12. The minimum is 7, except for
-UPC-A, when the minimum is 9.
+add-on. INTEGER is in integral multiples of the
+X-dimension. The maximum gap that can be set is 12. The minimum is 7,
+except for UPC-A, when the minimum is 9.
---azfull
+--azfull
For Aztec Code symbols, exclude Compact versions when considering
automatic sizes (i.e. consider Full versions only).
---batch
+--batch
Treat each line of an input file specified with -i |
--input as a separate data set and produce a barcode image
@@ -9269,19 +9336,20 @@ for each one. The barcode images are outputted by default to numbered
filenames starting with “00001.png”, “00002.png” etc., which can be
changed by using the -o | --output option.
---bg=COLOUR
+--bg=COLOUR
-Specify a background (paper) colour where COLOUR is in
-hexadecimal RRGGBB or RRGGBBAA format or in
-decimal C,M,Y,K percentages format.
+Specify a background (paper) colour where
+COLOUR is in hexadecimal RRGGBB or
+RRGGBBAA format or in decimal C,M,Y,K
+percentages format.
---binary
+--binary
Treat input data as raw 8-bit binary data instead of the default
UTF-8. Automatic code page translation to an ECI page is disabled, and
no validation of the data’s character encoding takes place.
---bind
+--bind
Add horizontal boundary bars (also known as bearer bars) to the
symbol. The width of the boundary bars is specified by the
@@ -9290,118 +9358,122 @@ add row separator bars to symbols stacked with multiple -d
| --data inputs, in which case the width of the separator
bars is specified with the --separator option.
---bindtop
+--bindtop
Add a horizontal boundary bar to the top of the symbol. The width of
the boundary bar is specified by the --border option.
---bold
+--bold
Use a bold font for the Human Readable Text (HRT).
---border=INTEGER
+--border=INTEGER
Set the width of boundary bars (--bind or
--bindtop) or box borders (--box), where
-INTEGER is in integral multiples of the X-dimension. The
-default is zero.
+INTEGER is in integral multiples of the
+X-dimension. The default is zero.
---box
+--box
Add a box around the symbol. The width of the borders is specified by
the --border option.
---cmyk
+--cmyk
Use the CMYK colour space when outputting to Encapsulated PostScript
(EPS) or TIF files.
---cols=INTEGER
+--cols=INTEGER
-Set the number of data columns in the symbol to INTEGER .
-Affects Codablock F, DotCode, GS1 DataBar Expanded Stacked
-(DBAR_EXPSTK), MicroPDF417 and PDF417 symbols.
+Set the number of data columns in the symbol to
+INTEGER . Affects Codablock F, DotCode, GS1 DataBar
+Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417 symbols.
---compliantheight
+--compliantheight
Warn if the height specified by the --height option is
not compliant with the barcode’s specification, or if
--height is not given, default to the height specified by
the specification (if any).
--d, --data=DATA
+-d DATA ,
+--data=DATA
-Specify the input DATA to encode. The --esc
-option may be used to enter non-printing characters using escape
-sequences. The DATA should be UTF-8, unless the
---binary option is given, in which case it can be
-anything.
+Specify the input DATA to encode. The
+--esc option may be used to enter non-printing characters
+using escape sequences. The DATA should be UTF-8,
+unless the --binary option is given, in which case it can
+be anything.
---direct
+--direct
Send output to stdout, which in most cases should be re-directed to a
pipe or a file. Use --filetype to specify output
format.
---dmb256=INTEGER
+--dmb256[=INTEGER]
-For Data Matrix symbols, encode the first INTEGER input
+
For Data Matrix symbols, encode the first
+INTEGER (optional, 0 if not given) input
characters in Base 256 mode. 0 means all input.
---dmc40=INTEGER
+--dmc40[=INTEGER]
-For Data Matrix symbols, encode the first INTEGER input
+
For Data Matrix symbols, encode the first
+INTEGER (optional, 0 if not given) input
characters in C40 mode. 0 means all input.
---dmiso144
+--dmiso144
For Data Matrix symbols, use the standard ISO/IEC codeword placement
for 144 x 144 (--vers=24) sized symbols, instead of the
default “de facto” placement (which rotates the placement of ECC
codewords).
---dmre
+--dmre
For Data Matrix symbols, allow Data Matrix Rectangular Extended
(DMRE) sizes when considering automatic sizes. See also
--square.
---dotsize=NUMBER
+--dotsize=NUMBER
Set the radius of the dots in dotty mode (--dotty).
-NUMBER is in X-dimensions, and may be floating-point. The
-default is 0.8.
+NUMBER is in X-dimensions, and may be
+floating-point. The default is 0.8.
---dotty
+--dotty
Use dots instead of squares for matrix symbols. DotCode is always in
dotty mode.
---dump
+--dump
Dump a hexadecimal representation of the symbol’s encodation to
stdout. The same representation may be outputted to a file by using a
.txt extension with -o | --output
or by specifying --filetype=txt.
--e, --ecinos
+-e ,
+--ecinos
Display the table of ECIs (Extended Channel Interpretations).
---eci=INTEGER
+--eci=INTEGER
-Set the ECI code for the input data to INTEGER . See
--e | --ecinos for a list of the ECIs
+
Set the ECI code for the input data to INTEGER .
+See -e | --ecinos for a list of the ECIs
available. ECIs are supported by Aztec Code, Code One, Data Matrix,
DotCode, Grid Matrix, Han Xin Code, MaxiCode, MicroPDF417, PDF417, QR
Code, rMQR and Ultracode.
---embedfont
+--embedfont
For vector output, embed the font in the file for portability.
Currently only available for SVG output.
---esc
+--esc
Process escape characters in the input data. The escape sequences
are:
@@ -9414,9 +9486,12 @@ are:
\v (0x0B) VT Vertical Tab
\f (0x0C) FF Form Feed
\r (0x0D) CR Carriage Return
+\L (0x10) DLE Data Link Escape
\e (0x1B) ESC Escape
+\F (0x1C) FS File Separator
\G (0x1D) GS Group Separator
\R (0x1E) RS Record Separator
+\N (0x1F) US Unit Separator
\( (0x28) ( Opening parenthesis (only with
--gs1parens)
\) (0x29) ) Closing parenthesis (only with
@@ -9433,7 +9508,7 @@ are:
\UNNNNNN (U+NNNNNN) Any 21-bit Unicode character
where NNNNNN is hexadecimal
---extraesc
+--extraesc
As well as processing the normal escape sequences above, process the
special escape sequences beginning with \^. For Aztec Code,
@@ -9444,30 +9519,31 @@ only, process the escape sequences \^A, \^B,
\^C and \^@ that allow manual switching of
Code Sets. The sequence \^@ turns off manual switching.
---fast
+--fast
Use faster if less optimal encodation or other shortcuts (affects
-Data Matrix, MicroPDF417, PDF417, QRCODE & UPNQR only).
+Aztec Code, Data Matrix, MicroPDF417, PDF417, QR Code & UPNQR
+only).
---fg=COLOUR
+--fg=COLOUR
-Specify a foreground (ink) colour where COLOUR is in
-hexadecimal RRGGBB or RRGGBBAA format or in
-decimal C,M,Y,K percentages format.
+Specify a foreground (ink) colour where COLOUR
+is in hexadecimal RRGGBB or RRGGBBAA format or
+in decimal C,M,Y,K percentages format.
---filetype=TYPE
+--filetype=TYPE
-Set the output file type to TYPE , which is one of
-BMP, EMF, EPS, GIF,
-PCX, PNG, SVG, TIF,
-TXT.
+Set the output file type to TYPE , which is one
+of BMP, EMF, EPS,
+GIF, PCX, PNG, SVG,
+TIF, TXT.
---fullmultibyte
+--fullmultibyte
Use the multibyte modes of Grid Matrix, Han Xin and QR Code for
non-ASCII data.
---gs1
+--gs1
Treat input as GS1 compatible data. A number of input formats are
available. Application Identifiers (AIs) may be placed in square
@@ -9478,19 +9554,19 @@ brackets "[]". Alternatively the GS1 Syntax Engine
(unverified) may be given. Further input options are available with
--gs1parens and --gs1raw.
---gs1nocheck
+--gs1nocheck
Treat input as GS1 compatible data (as --gs1) but do not
check the validity of the data.
---gs1parens
+--gs1parens
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 ("\(").
---gs1raw
+--gs1raw
Treat input as GS1 compatible data (as --gs1), but
process literally, with any required FNC1s represented by
@@ -9499,64 +9575,66 @@ process literally, with any required FNC1s represented by
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 (if available) to strictly verify the GS1 data,
including GS1 Digital Link URIs. Ignored if --gs1nocheck
also given.
---gssep
+--gssep
For Data Matrix in GS1 mode, use GS (0x1D) as the GS1
data separator instead of FNC1.
---guarddescent=NUMBER
+--guarddescent=NUMBER
For EAN/UPC symbols, set the height the guard bars descend below the
-main bars, where NUMBER is in X-dimensions. NUMBER may
-be floating-point.
+main bars, where NUMBER is in X-dimensions.
+NUMBER may be floating-point.
---guardwhitespace
+--guardwhitespace
For EAN/UPC symbols, add quiet zone indicators "<"
and/or ">" to HRT where applicable.
---height=NUMBER
+--height=NUMBER
-Set the height of the symbol in X-dimensions. NUMBER may be
-floating-point.
+Set the height of the symbol in X-dimensions.
+NUMBER may be floating-point.
---heightperrow
+--heightperrow
Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1
DataBar Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417.
--i, --input=FILE
+-i FILE ,
+--input=FILE
-Read the input data from FILE . Specify a single hyphen
-(-) for FILE to read from stdin.
+Read the input data from FILE . Specify a single
+hyphen (-) for FILE to read from
+stdin.
---init
+--init
Create a Reader Initialisation (Programming) symbol.
---mask=INTEGER
+--mask=INTEGER
Set the masking pattern to use for DotCode, Han Xin or QR Code to
-INTEGER , overriding the automatic selection.
+INTEGER , overriding the automatic selection.
---mirror
+--mirror
Use the batch data to determine the filename in batch mode
(--batch). The -o | --output
option can be used to specify an output directory (any filename will be
ignored).
---mode=INTEGER
+--mode=INTEGER
For MaxiCode and GS1 Composite symbols, set the encoding mode to
-INTEGER .
+INTEGER .
For MaxiCode (SCM is Structured Carrier Message, with 3 fields:
postcode, 3-digit ISO 3166-1 country code, 3-digit service code):
2 SCM with 9-digit numeric postcode
@@ -9571,62 +9649,64 @@ i.e. EAN8_CC, EAN13_CC,
2 CC-B
3 CC-C (GS1_128_CC only)
---nobackground
+--nobackground
Remove the background colour (EMF, EPS, GIF, PNG, SVG and TIF
only).
---noquietzones
+--noquietzones
Disable any quiet zones for symbols that define them by default.
---notext
+--notext
Remove the Human Readable Text (HRT).
--o, --output=FILE
+-o FILE ,
+--output=FILE
-Send the output to FILE . When not in batch mode, the default
-is “out.png” (or “out.gif” if zint built without PNG support). When in
-batch mode (--batch), special characters can be used to
-format the output filenames:
+Send the output to FILE . When not in batch
+mode, the default is “out.png” (or “out.gif” if zint built without PNG
+support). When in batch mode (--batch), special characters
+can be used to format the output filenames:
~ Insert a number or 0
# Insert a number or space
@ Insert a number or * (+ on Windows)
Any other Insert literally
---primary=STRING
+--primary=STRING
For MaxiCode, set the content of the primary message. For GS1
Composite symbols, set the content of the linear symbol.
---quietzones
+--quietzones
Add compliant quiet zones for symbols that specify them. This is in
addition to any whitespace specified by -w |
--whitesp or --vwhitesp.
--r, --reverse
+-r ,
+--reverse
Reverse the foreground and background colours (white on black). Known
as “reflectance reversal” or “reversed reflectance”.
---rotate=INTEGER
+--rotate=INTEGER
-Rotate the symbol by INTEGER degrees, where INTEGER
-can be 0, 90, 270 or 360.
+Rotate the symbol by INTEGER degrees, where
+INTEGER can be 0, 90, 270 or 360.
---rows=INTEGER
+--rows=INTEGER
-Set the number of rows for Codablock F or PDF417 to INTEGER .
-It will also set the minimum number of rows for Code 16K or Code 49, and
-the maximum number of rows for GS1 DataBar Expanded Stacked
-(DBAR_EXPSTK).
+Set the number of rows for Codablock F or PDF417 to
+INTEGER . It will also set the minimum number of
+rows for Code 16K or Code 49, and the maximum number of rows for GS1
+DataBar Expanded Stacked (DBAR_EXPSTK).
---scale=NUMBER
+--scale=NUMBER
-Adjust the size of the X-dimension. NUMBER may be
-floating-point, and is multiplied by 2 (except for MaxiCode) before
+
Adjust the size of the X-dimension. NUMBER may
+be floating-point, and is multiplied by 2 (except for MaxiCode) before
being applied. The default scale is 1.
For MaxiCode, the scale is multiplied by 10 for raster output, by 40
for EMF output, and by 2 otherwise.
@@ -9635,30 +9715,33 @@ raster output (BMP, GIF, PCX, PNG and TIF). Human Readable Text (HRT)
for raster output will not be shown for scales less than 1.
See also --scalexdimdp below.
---scalexdimdp=X[,R]
+--scalexdimdp[=X[,R]]
-Scale the image according to X-dimension X and resolution
-R , where X is in mm and R is in dpmm (dots
-per mm). X and R may be floating-point. R is
-optional and defaults to 12 dpmm (approximately 300 dpi). X may
+
Scale the image according to X-dimension X and
+resolution R , where X is in
+mm and R is in dpmm (dots per mm).
+X and R may be
+floating-point. R is optional and defaults to 12
+dpmm (approximately 300 dpi). X is optional or may
be zero in which case a symbology-specific default is used.
The scaling takes into account the output filetype, and deals with
-all the details mentioned above. Units may be specified for X
-by appending “in” (inch) or “mm”, and for R by appending “dpi”
-(dots per inch) or “dpmm” -
+all the details mentioned above in --scale. Units may be
+specified for X by appending “in” (inch) or “mm”, and for
+R by appending “dpi” (dots per inch) or “dpmm” -
e.g. --scalexdimdp=0.013in,300dpi.
---scmvv=INTEGER
+--scmvv[=INTEGER]
For MaxiCode, prefix the Structured Carrier Message (SCM) with
-"[)>\R01\Gvv", where vv is a 2-digit
-INTEGER .
+"[)>\R01\Gvv", where vv is an optional
+2-digit INTEGER . If INTEGER
+is omitted it defaults to 96 (ASC MH10/SC 8).
---secure=INTEGER
+--secure=INTEGER
-Set the error correction level (ECC) to INTEGER . The meaning
-is specific to the following matrix symbols (all except PDF417 are
-approximate):
+Set the error correction level (ECC) to
+INTEGER . The meaning is specific to the following
+matrix symbols (all except PDF417 are approximate):
Aztec Code 1 to 4 (10%, 23%, 36%, 50%)
Grid Matrix 1 to 5 (10% to 50%)
Han Xin 1 to 4 (8%, 15%, 23%, 30%)
@@ -9668,56 +9751,58 @@ QR Code 1 to 4 (7%, 15%, 25%, 30%) (L, M, Q, H)
rMQR 2 or 4 (15% or 30%) (M or H)
Ultracode 1 to 6 (0%, 5%, 9%, 17%, 25%, 33%)
---segN=ECI,DATA
+--segN=ECI,DATA
-Set the ECI & DATA content for segment N, where
-N is 1 to 9. -d | --data must still be given,
-and counts as segment 0, its ECI given by --eci. Segments
-must be consecutive.
+Set the ECI & DATA
+content for segment N, where N is 1 to 9. -d |
+--data must still be given, and counts as segment 0, its
+ECI given by --eci. Segments must be consecutive.
---separator=INTEGER
+--separator=INTEGER
Set the height of row separator bars for stacked symbologies, where
-INTEGER is in integral multiples of the X-dimension. The
-default is zero.
+INTEGER is in integral multiples of the
+X-dimension. The default is zero.
---small
+--small
Use a smaller font for Human Readable Text (HRT).
---square
+--square
For Data Matrix symbols, exclude rectangular sizes when considering
automatic sizes. See also --dmre.
---structapp=I,C[,ID]
+--structapp=I,C[,ID]
-Set Structured Append info, where I is the 1-based index,
-C is the total number of symbols in the sequence, and
-ID , which is optional, is the identifier that all symbols in
-the sequence share. Structured Append is supported by Aztec Code, Code
-One, Data Matrix, DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417,
-QR Code and Ultracode.
+Set Structured Append info, where I is the
+1-based index, C is the total number of symbols in
+the sequence, and ID , which is optional, is the
+identifier that all symbols in the sequence share. Structured Append is
+supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix,
+MaxiCode, MicroPDF417, PDF417, QR Code and Ultracode. Code One, DotCode
+and MaxiCode do not support an ID .
--t, --types
+-t ,
+--types
Display the table of barcode types (symbologies). The numbers or
names can be used with -b | --barcode.
---textgap=NUMBER
+--textgap=NUMBER
Adjust the gap between the barcode and the Human Readable Text (HRT).
-NUMBER is in X-dimensions, and may be floating-point. Maximum
-is 10 and minimum is -5. The default is 1.
+NUMBER is in X-dimensions, and may be
+floating-point. Maximum is 10 and minimum is -5. The default is 1.
---verbose
+--verbose
Output debug information to stdout.
---vers=INTEGER
+--vers=INTEGER
Set the symbol version (size, check digits, other options) to
-INTEGER . The meaning is symbol-specific.
+INTEGER . The meaning is symbol-specific.
For most matrix symbols, it specifies size:
Aztec Code 1 to 36 (1 to 4 compact)
1 15x15 13 53x53 25 105x105
@@ -9852,29 +9937,35 @@ MSI Plessey 0 to 6 (none to various visible options)
3, 4 (mod-11 IBM, mod-11 IBM + mod-10)
5, 6 (mod-11 NCR, mod-11 NCR + mod-10)
+10 (hide)
-For a few other symbologies, it specifies other characteristics:
+For some other symbologies, it specifies other characteristics:
Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel)
PZN 1 (PZN7 instead of default PZN8)
+Telepen 1 (use AIM-defined Start/Stop)
+Telepen Numeric 1 (use AIM-defined Start/Stop)
Ultracode 2 (revision 2)
VIN 1 (add international prefix)
--v, --version
+-v ,
+--version
Display zint version.
---vwhitesp=INTEGER
+--vwhitesp=INTEGER
Set the height of vertical whitespace above and below the barcode,
-where INTEGER is in integral multiples of the X-dimension.
+where INTEGER is in integral multiples of the
+X-dimension.
--w, --whitesp=INTEGER
+-w INTEGER ,
+--whitesp=INTEGER
Set the width of horizontal whitespace either side of the barcode,
-where INTEGER is in integral multiples of the X-dimension.
+where INTEGER is in integral multiples of the
+X-dimension.
---werror
+--werror
Convert all warnings into errors.
@@ -9983,14 +10074,19 @@ from
Zint is designed to be compliant with a number of international
standards, including:
-ISO/IEC 24778:2024, ANSI/AIM BC12-1998, EN 798:1996, AIM ISS-X-24
-(1995), ISO/IEC 15417:2007, EN 12323:2005, ISO/IEC 16388:2023, ANSI/AIM
-BC6-2000, ANSI/AIM BC5-1995, AIM USS Code One (1994), ISO/IEC
-16022:2024, ISO/IEC 21471:2019, ISO/IEC 15420:2009, AIMD014 (v 1.63)
-(2008), ISO/IEC 24723:2010, ISO/IEC 24724:2011, ISO/IEC 20830:2021,
-ISO/IEC 16390:2007, ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC
-15438:2015, ISO/IEC 18004:2024, ISO/IEC 23941:2022, AIM ITS/04-023
-(2022)
+ISO/IEC 24778:2024 (Aztec Code), SEMI T1-95 (1996) (BC412), ANSI/AIM
+BC12-1998 (Channel Code), EN 798:1996 (Codabar), AIM ISS-X-24 (1995)
+(Codablock F), ISO/IEC 15417:2007 (Code 128), EN 12323:2005 (Code 16K),
+ISO/IEC 16388:2023 (Code 39), ANSI/AIM BC6-2000 (Code 49), ANSI/AIM
+BC5-1995 (Code 93), AIM USS Code One (1994), ISO/IEC 16022:2024 (Data
+Matrix), ISO/IEC 21471:2025 (DMRE), AIM TSC1705001 (2019) (DotCode),
+ISO/IEC 15420:2025 (EAN/UPC), AIMD014 (v 1.63) (2008) (Grid Matrix),
+ISO/IEC 24723:2010 (GS1 Composite), ISO/IEC 24724:2011 (GS1 DataBar),
+ISO/IEC 20830:2021 (Han Xin Code), ISO/IEC 16390:2007 (Interleaved 2 of
+5), ISO/IEC 16023:2000 (MaxiCode), ISO/IEC 24728:2006 (MicroPDF417),
+ISO/IEC 15438:2015 (PDF417), ISO/IEC 18004:2024 (QR Code), ISO/IEC
+23941:2022 (rMQR), AIM Europe X-25 (1991) (Telepen), AIMD/TSC15032-43
+(2015) (Ultracode)
COPYRIGHT
Copyright © 2026 Robin Stuart. Released under GNU GPL 3.0 or
later.
diff --git a/docs/manual.pmd b/docs/manual.pmd
index bda1c160..5112ee73 100644
--- a/docs/manual.pmd
+++ b/docs/manual.pmd
@@ -1,6 +1,6 @@
% Zint Barcode Generator and Zint Barcode Studio User Manual
% Version 2.16.0.9
-% April 2026
+% May 2026
[//]: # ( vim: set ts=4 sw=4 et : )
@@ -560,12 +560,18 @@ Sequence Equivalent
`\r` 0x0D `CR` Carriage Return
+`\L` 0x10 `DLE` Data Link Escape
+
`\e` 0x1B `ESC` Escape
+`\F` 0x1C `FS` File Separator
+
`\G` 0x1D `GS` Group Separator
`\R` 0x1E `RS` Record Separator
+`\N` 0x1F `US` Unit Separator
+
`\(` 0x28 `(` Opening parenthesis (only with `--gs1parens`)
`\)` 0x29 `)` Closing parenthesis (only with `--gs1parens`)
@@ -619,7 +625,7 @@ Sequence
Table: Extra Escape Sequences {#tbl:extra_escapes}
-Currently the only special character recognized is the Function Code 1 character
+Currently the only special character recognised is the Function Code 1 character
`FNC1`. If your data contains the sequence "`\^`" then it must be escaped using
the extra escape sequence "`\^^`", i.e. by doubling the caret.
@@ -1176,21 +1182,21 @@ account, is to specify measurable units using the `--scalexdimdp` option, which
has the format
```
---scalexdimdp=X[,R]
+--scalexdimdp[=X[,R]]
```
where `X` is the X-dimension (in mm by default) and `R` is the resolution (in
dpmm, dots per mm, by default). `R` is optional, and defaults to 12 dpmm, and
-`X` may be zero, in which case it uses a symbology-specific default. The units
-may be given in inches for `X` by appending `"in"`, and in dpi (dots per inch)
-for `R` by appending `"dpi"`. For example
+`X` is optional or may be zero, in which case it uses a symbology-specific
+default. The units may be given in inches for `X` by appending `"in"`, and in
+dpi (dots per inch) for `R` by appending `"dpi"`. For example
```bash
zint -d "1234" --scalexdimdp=0.013in,300dpi
```
-Explicit metric units may also be given by appending `"mm"` and `"dpmm"` as
-appropriate, and may be mixed with U.S. units:
+Explicit metric units may also be given (for clarity) by appending `"mm"` and
+`"dpmm"` as appropriate, and may be mixed with U.S. units:
```bash
zint -d "1234" --scalexdimdp=0.33mm,300dpi
@@ -1212,7 +1218,7 @@ This will result in output of 37.29mm x 25.56mm (WxH) at 12 dpmm. The same
result can be achieved using the `--scalexdimdp` option with
```bash
-zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp=0
+zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp
```
as 0.33mm is the default X-dimension for EAN, and 12 dpmm the default
@@ -3325,20 +3331,47 @@ Telepen Alpha was developed in 1972 by SB Electronic Systems Limited and can
encode ASCII text input, up to a maximum of 69 characters. Telepen includes a
hidden modulo-127 check digit, added by Zint.
-{.lin}
+{.lin}
+
+Full ASCII + Compressed Numeric Mode, which uses different AIM-defined
+Start/Stop characters, may be enabled by setting `--vers=1` (API
+`option_2 = 1`). In this mode control character `DLE` (ASCII 16, escape sequence
+`\L`) indicates a switch from Full ASCII to Compressed Numeric, where each
+symbol character encodes a digit pair:
+
+{.lin}
+
+However not all barcode readers recognise this mode so check before using.
#### 6.1.6.2 Telepen Numeric
Telepen Numeric allows compression of numeric data into a Telepen symbol. Data
can consist of pairs of numbers or pairs consisting of a numerical digit
followed an X character. For example: 466333 and 466X33 are valid codes whereas
-46X333 is not (the digit pair `"X3"` is not valid). Up to 136 digits can be
+46X333 is not (the digit pair `"X3"` is not valid). Up to 138 digits can be
encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added
by Zint.
{.lin}
+Trailing ASCII characters may also be encoded by prefixing them with a `DLE`
+control character (ASCII 16, escape sequence `\L`) and appending them to the
+numeric data:
+
+{.lin}
+
+This method allows odd numbers to be encoded without a leading zero:
+
+{.lin}
+
+AIM-defined Start/Stop characters may be enabled by setting `--vers=1` (API
+`option_2 = 1`). This allows barcode readers that recognise them to detect
+Compressed Numeric data automatically.
+
### 6.1.7 Code 39
#### 6.1.7.1 Standard Code 39 (ISO 16388)
@@ -5286,13 +5319,13 @@ international standards:
- AIM Uniform Symbology Specification Code One (1994)
- ISO/IEC 16022:2024 Information technology - Automatic identification and data
capture techniques - Data Matrix bar code symbology specification
-- ISO/IEC 21471:2020 Information technology - Automatic identification and data
+- ISO/IEC 21471:2025 Information technology - Automatic identification and data
capture techniques - Extended rectangular data matrix (DMRE) bar code
symbology specification
- AIM TSC1705001 (v 4.0 Draft 0.15) - Information technology - Automatic
identification and data capture techniques - Bar code symbology
specification - DotCode (Revised 28th May 2019)
-- ISO/IEC 15420:2009 Information technology - Automatic identification and data
+- ISO/IEC 15420:2025 Information technology - Automatic identification and data
capture techniques - EAN/UPC bar code symbology specification
- AIMD014 (v 1.63) - Information technology, Automatic identification and data
capture techniques - Bar code symbology specification - Grid Matrix
@@ -5316,6 +5349,7 @@ international standards:
- ISO/IEC 23941:2022 Information technology - Automatic identification and data
capture techniques - Rectangular Micro QR Code (rMQR) bar code symbology
specification
+- AIM Europe X-25 - Uniform Symbology Specification Telepen (1991)
- AIMD/TSC15032-43 (v 0.99c) - International Technical Specification - Ultracode
Symbology (Draft) (Released 4th Nov 2015)
@@ -5334,6 +5368,13 @@ company references in particular.
- GS1 General Specifications Release 26.0 (Jan 2026)
- ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard
+- ANSI/HIBC 1.3-2010 - The Health Industry Bar Code (HIBC) Provider Applications
+ Standard
+- ISO/IEC 15424:2025 Information technology - Automatic identification and data
+ capture techniques - Data carrier identifiers (including symbology
+ identifiers)
+- ISO/IEC 15434:2019 Information technology — Automatic identification and data
+ capture techniques — Syntax for high-capacity ADC media
# Annex A. Character Encoding
diff --git a/docs/manual.txt b/docs/manual.txt
index 329d0619..0c732f04 100644
--- a/docs/manual.txt
+++ b/docs/manual.txt
@@ -1,6 +1,6 @@
Zint Barcode Generator and Zint Barcode Studio User Manual
Version 2.16.0.9
-April 2026
+May 2026
*******************************************************************************
* For reference the following is a text-only version of the Zint manual, *
@@ -716,12 +716,18 @@ sequences are shown in the table below.
\r 0x0D CR Carriage Return
+ \L 0x10 DLE Data Link Escape
+
\e 0x1B ESC Escape
+ \F 0x1C FS File Separator
+
\G 0x1D GS Group Separator
\R 0x1E RS Record Separator
+ \N 0x1F US Unit Separator
+
\( 0x28 ( Opening parenthesis (only with --gs1parens)
\) 0x29 ) Closing parenthesis (only with --gs1parens)
@@ -771,7 +777,7 @@ the sequence backslash caret (“\^”):
Table 3: Extra Escape Sequences
-Currently the only special character recognized is the Function Code 1 character
+Currently the only special character recognised is the Function Code 1 character
FNC1. If your data contains the sequence “\^” then it must be escaped using the
extra escape sequence “\^^”, i.e. by doubling the caret.
@@ -1278,18 +1284,18 @@ An alternative way to specify the scale, which takes the above details into
account, is to specify measurable units using the --scalexdimdp option, which
has the format
- --scalexdimdp=X[,R]
+ --scalexdimdp[=X[,R]]
where X is the X-dimension (in mm by default) and R is the resolution (in dpmm,
-dots per mm, by default). R is optional, and defaults to 12 dpmm, and X may be
-zero, in which case it uses a symbology-specific default. The units may be given
-in inches for X by appending "in", and in dpi (dots per inch) for R by appending
-"dpi". For example
+dots per mm, by default). R is optional, and defaults to 12 dpmm, and X is
+optional or may be zero, in which case it uses a symbology-specific default. The
+units may be given in inches for X by appending "in", and in dpi (dots per inch)
+for R by appending "dpi". For example
zint -d "1234" --scalexdimdp=0.013in,300dpi
-Explicit metric units may also be given by appending "mm" and "dpmm" as
-appropriate, and may be mixed with U.S. units:
+Explicit metric units may also be given (for clarity) by appending "mm" and
+"dpmm" as appropriate, and may be mixed with U.S. units:
zint -d "1234" --scalexdimdp=0.33mm,300dpi
@@ -1306,7 +1312,7 @@ pixels, or 4 pixels rounding to the nearest pixel:
This will result in output of 37.29mm x 25.56mm (WxH) at 12 dpmm. The same
result can be achieved using the --scalexdimdp option with
- zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp=0
+ zint -b EAN13 -d "501234567890" --compliantheight --scalexdimdp
as 0.33mm is the default X-dimension for EAN, and 12 dpmm the default
resolution.
@@ -3190,19 +3196,43 @@ Telepen Alpha was developed in 1972 by SB Electronic Systems Limited and can
encode ASCII text input, up to a maximum of 69 characters. Telepen includes a
hidden modulo-127 check digit, added by Zint.
-[zint -b TELEPEN --compliantheight -d "Z80"]
+[zint -b TELEPEN --compliantheight -d "Z8000"]
+
+Full ASCII + Compressed Numeric Mode, which uses different AIM-defined
+Start/Stop characters, may be enabled by setting --vers=1 (API option_2 = 1). In
+this mode control character DLE (ASCII 16, escape sequence \L) indicates a
+switch from Full ASCII to Compressed Numeric, where each symbol character
+encodes a digit pair:
+
+[zint -b TELEPEN --compliantheight -d "Z\L8000" -esc --vers=1]
+
+However not all barcode readers recognise this mode so check before using.
6.1.6.2 Telepen Numeric
Telepen Numeric allows compression of numeric data into a Telepen symbol. Data
can consist of pairs of numbers or pairs consisting of a numerical digit
followed an X character. For example: 466333 and 466X33 are valid codes whereas
-46X333 is not (the digit pair "X3" is not valid). Up to 136 digits can be
+46X333 is not (the digit pair "X3" is not valid). Up to 138 digits can be
encoded. Telepen Numeric includes a hidden modulo-127 check digit which is added
by Zint.
[zint -b TELEPEN_NUM --compliantheight -d "466X33"]
+Trailing ASCII characters may also be encoded by prefixing them with a DLE
+control character (ASCII 16, escape sequence \L) and appending them to the
+numeric data:
+
+[zint -b TELEPEN_NUM --compliantheight -d "12\LAB" –esc]
+
+This method allows odd numbers to be encoded without a leading zero:
+
+[zint -b TELEPEN_NUM --compliantheight -d "123\L4" –esc]
+
+AIM-defined Start/Stop characters may be enabled by setting --vers=1 (API
+option_2 = 1). This allows barcode readers that recognise them to detect
+Compressed Numeric data automatically.
+
6.1.7 Code 39
6.1.7.1 Standard Code 39 (ISO 16388)
@@ -5054,13 +5084,13 @@ international standards:
- AIM Uniform Symbology Specification Code One (1994)
- ISO/IEC 16022:2024 Information technology - Automatic identification and data
capture techniques - Data Matrix bar code symbology specification
-- ISO/IEC 21471:2020 Information technology - Automatic identification and data
+- ISO/IEC 21471:2025 Information technology - Automatic identification and data
capture techniques - Extended rectangular data matrix (DMRE) bar code
symbology specification
- AIM TSC1705001 (v 4.0 Draft 0.15) - Information technology - Automatic
identification and data capture techniques - Bar code symbology
specification - DotCode (Revised 28th May 2019)
-- ISO/IEC 15420:2009 Information technology - Automatic identification and data
+- ISO/IEC 15420:2025 Information technology - Automatic identification and data
capture techniques - EAN/UPC bar code symbology specification
- AIMD014 (v 1.63) - Information technology, Automatic identification and data
capture techniques - Bar code symbology specification - Grid Matrix (Released
@@ -5084,6 +5114,7 @@ international standards:
- ISO/IEC 23941:2022 Information technology - Automatic identification and data
capture techniques - Rectangular Micro QR Code (rMQR) bar code symbology
specification
+- AIM Europe X-25 - Uniform Symbology Specification Telepen (1991)
- AIMD/TSC15032-43 (v 0.99c) - International Technical Specification - Ultracode
Symbology (Draft) (Released 4th Nov 2015)
@@ -5102,6 +5133,13 @@ company references in particular.
- GS1 General Specifications Release 26.0 (Jan 2026)
- ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling
Standard
+- ANSI/HIBC 1.3-2010 - The Health Industry Bar Code (HIBC) Provider Applications
+ Standard
+- ISO/IEC 15424:2025 Information technology - Automatic identification and data
+ capture techniques - Data carrier identifiers (including symbology
+ identifiers)
+- ISO/IEC 15434:2019 Information technology — Automatic identification and data
+ capture techniques — Syntax for high-capacity ADC media
Annex A. Character Encoding
@@ -5253,7 +5291,7 @@ configured barcode is updated when the "Generate" button is pressed.
Annex D. Man Page ZINT(1)
-% ZINT(1) Version 2.16.0.9 % % April 2026
+% ZINT(1) Version 2.16.0.9 % % May 2026
NAME
@@ -5368,7 +5406,7 @@ OPTIONS
the barcode’s specification, or if --height is not given, default to the
height specified by the specification (if any).
--d, --data=DATA
+-d DATA, --data=DATA
Specify the input DATA to encode. The --esc option may be used to enter
non-printing characters using escape sequences. The DATA should be UTF-8,
@@ -5379,15 +5417,15 @@ OPTIONS
Send output to stdout, which in most cases should be re-directed to a pipe
or a file. Use --filetype to specify output format.
---dmb256=INTEGER
+--dmb256[=INTEGER]
- For Data Matrix symbols, encode the first INTEGER input characters in Base
- 256 mode. 0 means all input.
+ For Data Matrix symbols, encode the first INTEGER (optional, 0 if not given)
+ input characters in Base 256 mode. 0 means all input.
---dmc40=INTEGER
+--dmc40[=INTEGER]
- For Data Matrix symbols, encode the first INTEGER input characters in C40
- mode. 0 means all input.
+ For Data Matrix symbols, encode the first INTEGER (optional, 0 if not given)
+ input characters in C40 mode. 0 means all input.
--dmiso144
@@ -5445,9 +5483,12 @@ OPTIONS
\v (0x0B) VT Vertical Tab
\f (0x0C) FF Form Feed
\r (0x0D) CR Carriage Return
+ \L (0x10) DLE Data Link Escape
\e (0x1B) ESC Escape
+ \F (0x1C) FS File Separator
\G (0x1D) GS Group Separator
\R (0x1E) RS Record Separator
+ \N (0x1F) US Unit Separator
\( (0x28) ( Opening parenthesis (only with
--gs1parens)
\) (0x29) ) Closing parenthesis (only with
@@ -5475,8 +5516,8 @@ OPTIONS
--fast
- Use faster if less optimal encodation or other shortcuts (affects Data
- Matrix, MicroPDF417, PDF417, QRCODE & UPNQR only).
+ Use faster if less optimal encodation or other shortcuts (affects Aztec
+ Code, Data Matrix, MicroPDF417, PDF417, QR Code & UPNQR only).
--fg=COLOUR
@@ -5550,7 +5591,7 @@ OPTIONS
Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1 DataBar
Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417.
--i, --input=FILE
+-i FILE, --input=FILE
Read the input data from FILE. Specify a single hyphen (-) for FILE to read
from stdin.
@@ -5602,7 +5643,7 @@ OPTIONS
Remove the Human Readable Text (HRT).
--o, --output=FILE
+-o FILE, --output=FILE
Send the output to FILE. When not in batch mode, the default is “out.png”
(or “out.gif” if zint built without PNG support). When in batch mode
@@ -5654,22 +5695,23 @@ OPTIONS
See also --scalexdimdp below.
---scalexdimdp=X[,R]
+--scalexdimdp[=X[,R]]
Scale the image according to X-dimension X and resolution R, where X is in
mm and R is in dpmm (dots per mm). X and R may be floating-point. R is
- optional and defaults to 12 dpmm (approximately 300 dpi). X may be zero in
- which case a symbology-specific default is used.
+ optional and defaults to 12 dpmm (approximately 300 dpi). X is optional or
+ may be zero in which case a symbology-specific default is used.
The scaling takes into account the output filetype, and deals with all the
- details mentioned above. Units may be specified for X by appending “in”
- (inch) or “mm”, and for R by appending “dpi” (dots per inch) or “dpmm” -
- e.g. --scalexdimdp=0.013in,300dpi.
+ details mentioned above in --scale. Units may be specified for X by
+ appending “in” (inch) or “mm”, and for R by appending “dpi” (dots per inch)
+ or “dpmm” - e.g. --scalexdimdp=0.013in,300dpi.
---scmvv=INTEGER
+--scmvv[=INTEGER]
For MaxiCode, prefix the Structured Carrier Message (SCM) with
- "[)>\R01\Gvv", where vv is a 2-digit INTEGER.
+ "[)>\R01\Gvv", where vv is an optional 2-digit INTEGER. If INTEGER is
+ omitted it defaults to 96 (ASC MH10/SC 8).
--secure=INTEGER
@@ -5711,7 +5753,8 @@ OPTIONS
number of symbols in the sequence, and ID, which is optional, is the
identifier that all symbols in the sequence share. Structured Append is
supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix,
- MaxiCode, MicroPDF417, PDF417, QR Code and Ultracode.
+ MaxiCode, MicroPDF417, PDF417, QR Code and Ultracode. Code One, DotCode and
+ MaxiCode do not support an ID.
-t, --types
@@ -5870,12 +5913,14 @@ OPTIONS
5, 6 (mod-11 NCR, mod-11 NCR + mod-10)
+10 (hide)
- For a few other symbologies, it specifies other characteristics:
+ For some other symbologies, it specifies other characteristics:
Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel)
PZN 1 (PZN7 instead of default PZN8)
+ Telepen 1 (use AIM-defined Start/Stop)
+ Telepen Numeric 1 (use AIM-defined Start/Stop)
Ultracode 2 (revision 2)
VIN 1 (add international prefix)
@@ -5888,7 +5933,7 @@ OPTIONS
Set the height of vertical whitespace above and below the barcode, where
INTEGER is in integral multiples of the X-dimension.
--w, --whitesp=INTEGER
+-w INTEGER, --whitesp=INTEGER
Set the width of horizontal whitespace either side of the barcode, where
INTEGER is in integral multiples of the X-dimension.
@@ -5987,13 +6032,18 @@ CONFORMING TO
Zint is designed to be compliant with a number of international standards,
including:
-ISO/IEC 24778:2024, ANSI/AIM BC12-1998, EN 798:1996, AIM ISS-X-24 (1995),
-ISO/IEC 15417:2007, EN 12323:2005, ISO/IEC 16388:2023, ANSI/AIM BC6-2000,
-ANSI/AIM BC5-1995, AIM USS Code One (1994), ISO/IEC 16022:2024, ISO/IEC
-21471:2019, ISO/IEC 15420:2009, AIMD014 (v 1.63) (2008), ISO/IEC 24723:2010,
-ISO/IEC 24724:2011, ISO/IEC 20830:2021, ISO/IEC 16390:2007, ISO/IEC 16023:2000,
-ISO/IEC 24728:2006, ISO/IEC 15438:2015, ISO/IEC 18004:2024, ISO/IEC 23941:2022,
-AIM ITS/04-023 (2022)
+ISO/IEC 24778:2024 (Aztec Code), SEMI T1-95 (1996) (BC412), ANSI/AIM BC12-1998
+(Channel Code), EN 798:1996 (Codabar), AIM ISS-X-24 (1995) (Codablock F),
+ISO/IEC 15417:2007 (Code 128), EN 12323:2005 (Code 16K), ISO/IEC 16388:2023
+(Code 39), ANSI/AIM BC6-2000 (Code 49), ANSI/AIM BC5-1995 (Code 93), AIM USS
+Code One (1994), ISO/IEC 16022:2024 (Data Matrix), ISO/IEC 21471:2025 (DMRE),
+AIM TSC1705001 (2019) (DotCode), ISO/IEC 15420:2025 (EAN/UPC), AIMD014 (v 1.63)
+(2008) (Grid Matrix), ISO/IEC 24723:2010 (GS1 Composite), ISO/IEC 24724:2011
+(GS1 DataBar), ISO/IEC 20830:2021 (Han Xin Code), ISO/IEC 16390:2007
+(Interleaved 2 of 5), ISO/IEC 16023:2000 (MaxiCode), ISO/IEC 24728:2006
+(MicroPDF417), ISO/IEC 15438:2015 (PDF417), ISO/IEC 18004:2024 (QR Code),
+ISO/IEC 23941:2022 (rMQR), AIM Europe X-25 (1991) (Telepen), AIMD/TSC15032-43
+(2015) (Ultracode)
COPYRIGHT
diff --git a/docs/zint.1 b/docs/zint.1
index 753ccd58..5f9a8a29 100644
--- a/docs/zint.1
+++ b/docs/zint.1
@@ -1,15 +1,15 @@
.\" Automatically generated by Pandoc 3.9.0.2
.\"
-.TH "ZINT" "1" "April 2026" "Version 2.16.0.9"
+.TH "ZINT" "1" "May 2026" "Version 2.16.0.9"
.SH NAME
\f[CR]zint\f[R] \- encode data as a barcode image
.SH SYNOPSIS
.PP
-\f[CR]zint\f[R] [\f[CR]\-h\f[R] | \f[CR]\-\-help\f[R]]
+\f[B]\f[CB]zint\f[B]\f[R] [\f[CR]\-h\f[R] | \f[CR]\-\-help\f[R]]
.PD 0
.P
.PD
-\f[CR]zint\f[R] [\f[I]options\f[R]]
+\f[B]\f[CB]zint\f[B]\f[R] [\f[I]options\f[R]]
.SH DESCRIPTION
zint takes input data from the command line or a file to encode in a
barcode which is then output to an image file.
@@ -28,29 +28,31 @@ Format (\f[CR]PNG\f[R]), Scalable Vector Graphic (\f[CR]SVG\f[R]), or
Tagged Image File Format (\f[CR]TIF\f[R]).
.SH OPTIONS
.TP
-\f[CR]\-h\f[R], \f[CR]\-\-help\f[R]
+\f[B]\f[CB]\-h\f[B]\f[R], \f[B]\f[CB]\-\-help\f[B]\f[R]
Print usage information summarizing command line options.
.TP
-\f[CR]\-b TYPE\f[R], \f[CR]\-\-barcode=TYPE\f[R]
+\f[B]\f[CB]\-b\f[B]\f[R] \f[I]\f[CI]TYPE\f[I]\f[R], \f[B]\f[CB]\-\-barcode=\f[B]\f[R]\f[I]\f[CI]TYPE\f[I]\f[R]
Set the barcode symbology that will be used to encode the data.
-\f[I]TYPE\f[R] is the number or name of the barcode symbology.
+\f[I]\f[CI]TYPE\f[I]\f[R] is the number or name of the barcode
+symbology.
If not given, the symbology defaults to 20 (Code 128).
To see what types are available, use the \f[CR]\-t\f[R] |
\f[CR]\-\-types\f[R] option.
Type names are case\-insensitive, and non\-alphanumerics are ignored.
.TP
-\f[CR]\-\-addongap=INTEGER\f[R]
+\f[B]\f[CB]\-\-addongap=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
For EAN/UPC symbologies, set the gap between the main data and the
add\-on.
-\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension.
+\f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
+X\-dimension.
The maximum gap that can be set is 12.
The minimum is 7, except for UPC\-A, when the minimum is 9.
.TP
-\f[CR]\-\-azfull\f[R]
+\f[B]\f[CB]\-\-azfull\f[B]\f[R]
For Aztec Code symbols, exclude Compact versions when considering
automatic sizes (i.e.\ consider Full versions only).
.TP
-\f[CR]\-\-batch\f[R]
+\f[B]\f[CB]\-\-batch\f[B]\f[R]
Treat each line of an input file specified with \f[CR]\-i\f[R] |
\f[CR]\-\-input\f[R] as a separate data set and produce a barcode image
for each one.
@@ -58,18 +60,18 @@ The barcode images are outputted by default to numbered filenames
starting with \(lq00001.png\(rq, \(lq00002.png\(rq etc., which can be
changed by using the \f[CR]\-o\f[R] | \f[CR]\-\-output\f[R] option.
.TP
-\f[CR]\-\-bg=COLOUR\f[R]
-Specify a background (paper) colour where \f[I]COLOUR\f[R] is in
-hexadecimal \f[CR]RRGGBB\f[R] or \f[CR]RRGGBBAA\f[R] format or in
+\f[B]\f[CB]\-\-bg=\f[B]\f[R]\f[I]\f[CI]COLOUR\f[I]\f[R]
+Specify a background (paper) colour where \f[I]\f[CI]COLOUR\f[I]\f[R] is
+in hexadecimal \f[CR]RRGGBB\f[R] or \f[CR]RRGGBBAA\f[R] format or in
decimal \f[CR]C,M,Y,K\f[R] percentages format.
.TP
-\f[CR]\-\-binary\f[R]
+\f[B]\f[CB]\-\-binary\f[B]\f[R]
Treat input data as raw 8\-bit binary data instead of the default
UTF\-8.
Automatic code page translation to an ECI page is disabled, and no
validation of the data\(cqs character encoding takes place.
.TP
-\f[CR]\-\-bind\f[R]
+\f[B]\f[CB]\-\-bind\f[B]\f[R]
Add horizontal boundary bars (also known as bearer bars) to the symbol.
The width of the boundary bars is specified by the \f[CR]\-\-border\f[R]
option.
@@ -78,105 +80,108 @@ symbols stacked with multiple \f[CR]\-d\f[R] | \f[CR]\-\-data\f[R]
inputs, in which case the width of the separator bars is specified with
the \f[CR]\-\-separator\f[R] option.
.TP
-\f[CR]\-\-bindtop\f[R]
+\f[B]\f[CB]\-\-bindtop\f[B]\f[R]
Add a horizontal boundary bar to the top of the symbol.
The width of the boundary bar is specified by the \f[CR]\-\-border\f[R]
option.
.TP
-\f[CR]\-\-bold\f[R]
+\f[B]\f[CB]\-\-bold\f[B]\f[R]
Use a bold font for the Human Readable Text (HRT).
.TP
-\f[CR]\-\-border=INTEGER\f[R]
+\f[B]\f[CB]\-\-border=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the width of boundary bars (\f[CR]\-\-bind\f[R] or
\f[CR]\-\-bindtop\f[R]) or box borders (\f[CR]\-\-box\f[R]), where
-\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension.
+\f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
+X\-dimension.
The default is zero.
.TP
-\f[CR]\-\-box\f[R]
+\f[B]\f[CB]\-\-box\f[B]\f[R]
Add a box around the symbol.
The width of the borders is specified by the \f[CR]\-\-border\f[R]
option.
.TP
-\f[CR]\-\-cmyk\f[R]
+\f[B]\f[CB]\-\-cmyk\f[B]\f[R]
Use the CMYK colour space when outputting to Encapsulated PostScript
(EPS) or TIF files.
.TP
-\f[CR]\-\-cols=INTEGER\f[R]
-Set the number of data columns in the symbol to \f[I]INTEGER\f[R].
+\f[B]\f[CB]\-\-cols=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
+Set the number of data columns in the symbol to
+\f[I]\f[CI]INTEGER\f[I]\f[R].
Affects Codablock F, DotCode, GS1 DataBar Expanded Stacked
(DBAR_EXPSTK), MicroPDF417 and PDF417 symbols.
.TP
-\f[CR]\-\-compliantheight\f[R]
+\f[B]\f[CB]\-\-compliantheight\f[B]\f[R]
Warn if the height specified by the \f[CR]\-\-height\f[R] option is not
compliant with the barcode\(cqs specification, or if
\f[CR]\-\-height\f[R] is not given, default to the height specified by
the specification (if any).
.TP
-\f[CR]\-d\f[R], \f[CR]\-\-data=DATA\f[R]
-Specify the input \f[I]DATA\f[R] to encode.
+\f[B]\f[CB]\-d\f[B]\f[R] \f[I]\f[CI]DATA\f[I]\f[R], \f[B]\f[CB]\-\-data=\f[B]\f[R]\f[I]\f[CI]DATA\f[I]\f[R]
+Specify the input \f[I]\f[CI]DATA\f[I]\f[R] to encode.
The \f[CR]\-\-esc\f[R] option may be used to enter non\-printing
characters using escape sequences.
-The \f[I]DATA\f[R] should be UTF\-8, unless the \f[CR]\-\-binary\f[R]
-option is given, in which case it can be anything.
+The \f[I]\f[CI]DATA\f[I]\f[R] should be UTF\-8, unless the
+\f[CR]\-\-binary\f[R] option is given, in which case it can be anything.
.TP
-\f[CR]\-\-direct\f[R]
+\f[B]\f[CB]\-\-direct\f[B]\f[R]
Send output to stdout, which in most cases should be re\-directed to a
pipe or a file.
Use \f[CR]\-\-filetype\f[R] to specify output format.
.TP
-\f[CR]\-\-dmb256=INTEGER\f[R]
-For Data Matrix symbols, encode the first \f[I]INTEGER\f[R] input
-characters in Base 256 mode.
+\f[B]\f[CB]\-\-dmb256[=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]\f[CR]]\f[R]
+For Data Matrix symbols, encode the first \f[I]\f[CI]INTEGER\f[I]\f[R]
+(optional, 0 if not given) input characters in Base 256 mode.
0 means all input.
.TP
-\f[CR]\-\-dmc40=INTEGER\f[R]
-For Data Matrix symbols, encode the first \f[I]INTEGER\f[R] input
-characters in C40 mode.
+\f[B]\f[CB]\-\-dmc40[=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]\f[CR]]\f[R]
+For Data Matrix symbols, encode the first \f[I]\f[CI]INTEGER\f[I]\f[R]
+(optional, 0 if not given) input characters in C40 mode.
0 means all input.
.TP
-\f[CR]\-\-dmiso144\f[R]
+\f[B]\f[CB]\-\-dmiso144\f[B]\f[R]
For Data Matrix symbols, use the standard ISO/IEC codeword placement for
144 x 144 (\f[CR]\-\-vers=24\f[R]) sized symbols, instead of the default
\(lqde facto\(rq placement (which rotates the placement of ECC
codewords).
.TP
-\f[CR]\-\-dmre\f[R]
+\f[B]\f[CB]\-\-dmre\f[B]\f[R]
For Data Matrix symbols, allow Data Matrix Rectangular Extended (DMRE)
sizes when considering automatic sizes.
See also \f[CR]\-\-square\f[R].
.TP
-\f[CR]\-\-dotsize=NUMBER\f[R]
+\f[B]\f[CB]\-\-dotsize=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
Set the radius of the dots in dotty mode (\f[CR]\-\-dotty\f[R]).
-\f[I]NUMBER\f[R] is in X\-dimensions, and may be floating\-point.
+\f[I]\f[CI]NUMBER\f[I]\f[R] is in X\-dimensions, and may be
+floating\-point.
The default is 0.8.
.TP
-\f[CR]\-\-dotty\f[R]
+\f[B]\f[CB]\-\-dotty\f[B]\f[R]
Use dots instead of squares for matrix symbols.
DotCode is always in dotty mode.
.TP
-\f[CR]\-\-dump\f[R]
+\f[B]\f[CB]\-\-dump\f[B]\f[R]
Dump a hexadecimal representation of the symbol\(cqs encodation to
stdout.
The same representation may be outputted to a file by using a
\f[CR].txt\f[R] extension with \f[CR]\-o\f[R] | \f[CR]\-\-output\f[R] or
by specifying \f[CR]\-\-filetype=txt\f[R].
.TP
-\f[CR]\-e\f[R], \f[CR]\-\-ecinos\f[R]
+\f[B]\f[CB]\-e\f[B]\f[R], \f[B]\f[CB]\-\-ecinos\f[B]\f[R]
Display the table of ECIs (Extended Channel Interpretations).
.TP
-\f[CR]\-\-eci=INTEGER\f[R]
-Set the ECI code for the input data to \f[I]INTEGER\f[R].
+\f[B]\f[CB]\-\-eci=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
+Set the ECI code for the input data to \f[I]\f[CI]INTEGER\f[I]\f[R].
See \f[CR]\-e\f[R] | \f[CR]\-\-ecinos\f[R] for a list of the ECIs
available.
ECIs are supported by Aztec Code, Code One, Data Matrix, DotCode, Grid
Matrix, Han Xin Code, MaxiCode, MicroPDF417, PDF417, QR Code, rMQR and
Ultracode.
.TP
-\f[CR]\-\-embedfont\f[R]
+\f[B]\f[CB]\-\-embedfont\f[B]\f[R]
For vector output, embed the font in the file for portability.
Currently only available for SVG output.
.TP
-\f[CR]\-\-esc\f[R]
+\f[B]\f[CB]\-\-esc\f[B]\f[R]
Process escape characters in the input data.
The escape sequences are:
.RS
@@ -191,9 +196,12 @@ The escape sequences are:
\(rsv (0x0B) VT Vertical Tab
\(rsf (0x0C) FF Form Feed
\(rsr (0x0D) CR Carriage Return
+\(rsL (0x10) DLE Data Link Escape
\(rse (0x1B) ESC Escape
+\(rsF (0x1C) FS File Separator
\(rsG (0x1D) GS Group Separator
\(rsR (0x1E) RS Record Separator
+\(rsN (0x1F) US Unit Separator
\(rs( (0x28) ( Opening parenthesis (only with
\-\-gs1parens)
\(rs) (0x29) ) Closing parenthesis (only with
@@ -212,7 +220,7 @@ The escape sequences are:
.EE
.RE
.TP
-\f[CR]\-\-extraesc\f[R]
+\f[B]\f[CB]\-\-extraesc\f[B]\f[R]
As well as processing the normal escape sequences above, process the
special escape sequences beginning with \f[CR]\(rs\(ha\f[R].
For Aztec Code, Code 128 and Data Matrix, process the escape sequence
@@ -224,26 +232,26 @@ For Code 128 only, process the escape sequences \f[CR]\(rs\(haA\f[R],
that allow manual switching of Code Sets.
The sequence \f[CR]\(rs\(ha\(at\f[R] turns off manual switching.
.TP
-\f[CR]\-\-fast\f[R]
-Use faster if less optimal encodation or other shortcuts (affects Data
-Matrix, MicroPDF417, PDF417, QRCODE & UPNQR only).
+\f[B]\f[CB]\-\-fast\f[B]\f[R]
+Use faster if less optimal encodation or other shortcuts (affects Aztec
+Code, Data Matrix, MicroPDF417, PDF417, QR Code & UPNQR only).
.TP
-\f[CR]\-\-fg=COLOUR\f[R]
-Specify a foreground (ink) colour where \f[I]COLOUR\f[R] is in
-hexadecimal \f[CR]RRGGBB\f[R] or \f[CR]RRGGBBAA\f[R] format or in
+\f[B]\f[CB]\-\-fg=\f[B]\f[R]\f[I]\f[CI]COLOUR\f[I]\f[R]
+Specify a foreground (ink) colour where \f[I]\f[CI]COLOUR\f[I]\f[R] is
+in hexadecimal \f[CR]RRGGBB\f[R] or \f[CR]RRGGBBAA\f[R] format or in
decimal \f[CR]C,M,Y,K\f[R] percentages format.
.TP
-\f[CR]\-\-filetype=TYPE\f[R]
-Set the output file type to \f[I]TYPE\f[R], which is one of
+\f[B]\f[CB]\-\-filetype=\f[B]\f[R]\f[I]\f[CI]TYPE\f[I]\f[R]
+Set the output file type to \f[I]\f[CI]TYPE\f[I]\f[R], which is one of
\f[CR]BMP\f[R], \f[CR]EMF\f[R], \f[CR]EPS\f[R], \f[CR]GIF\f[R],
\f[CR]PCX\f[R], \f[CR]PNG\f[R], \f[CR]SVG\f[R], \f[CR]TIF\f[R],
\f[CR]TXT\f[R].
.TP
-\f[CR]\-\-fullmultibyte\f[R]
+\f[B]\f[CB]\-\-fullmultibyte\f[B]\f[R]
Use the multibyte modes of Grid Matrix, Han Xin and QR Code for
non\-ASCII data.
.TP
-\f[CR]\-\-gs1\f[R]
+\f[B]\f[CB]\-\-gs1\f[B]\f[R]
Treat input as GS1 compatible data.
A number of input formats are available.
Application Identifiers (AIs) may be placed in square brackets
@@ -255,18 +263,18 @@ For matrix symbologies, GS1 Digital Link URIs (unverified) may be given.
Further input options are available with \f[CR]\-\-gs1parens\f[R] and
\f[CR]\-\-gs1raw\f[R].
.TP
-\f[CR]\-\-gs1nocheck\f[R]
+\f[B]\f[CB]\-\-gs1nocheck\f[B]\f[R]
Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) but do not
check the validity of the data.
.TP
-\f[CR]\-\-gs1parens\f[R]
+\f[B]\f[CB]\-\-gs1parens\f[B]\f[R]
Treat input as GS1 compatible data (as \f[CR]\-\-gs1\f[R]) but process
parentheses \f[CR]\(dq()\(dq\f[R] as GS1 AI delimiters, rather than
square brackets \f[CR]\(dq[]\(dq\f[R].
If the AI data contains opening parentheses, they must be backslashed
(\f[CR]\(dq\(rs(\(dq\f[R]).
.TP
-\f[CR]\-\-gs1raw\f[R]
+\f[B]\f[CB]\-\-gs1raw\f[B]\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).
@@ -276,55 +284,55 @@ AIs are not delimited by brackets (\f[CR]\(dq[]\(dq\f[R] or
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[B]\f[CB]\-\-gs1strict\f[B]\f[R]
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,
including GS1 Digital Link URIs.
Ignored if \f[CR]\-\-gs1nocheck\f[R] also given.
.TP
-\f[CR]\-\-gssep\f[R]
+\f[B]\f[CB]\-\-gssep\f[B]\f[R]
For Data Matrix in GS1 mode, use \f[CR]GS\f[R] (0x1D) as the GS1 data
separator instead of \f[CR]FNC1\f[R].
.TP
-\f[CR]\-\-guarddescent=NUMBER\f[R]
+\f[B]\f[CB]\-\-guarddescent=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
For EAN/UPC symbols, set the height the guard bars descend below the
-main bars, where \f[I]NUMBER\f[R] is in X\-dimensions.
-\f[I]NUMBER\f[R] may be floating\-point.
+main bars, where \f[I]\f[CI]NUMBER\f[I]\f[R] is in X\-dimensions.
+\f[I]\f[CI]NUMBER\f[I]\f[R] may be floating\-point.
.TP
-\f[CR]\-\-guardwhitespace\f[R]
+\f[B]\f[CB]\-\-guardwhitespace\f[B]\f[R]
For EAN/UPC symbols, add quiet zone indicators \f[CR]\(dq<\(dq\f[R]
and/or \f[CR]\(dq>\(dq\f[R] to HRT where applicable.
.TP
-\f[CR]\-\-height=NUMBER\f[R]
+\f[B]\f[CB]\-\-height=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
Set the height of the symbol in X\-dimensions.
-\f[I]NUMBER\f[R] may be floating\-point.
+\f[I]\f[CI]NUMBER\f[I]\f[R] may be floating\-point.
.TP
-\f[CR]\-\-heightperrow\f[R]
+\f[B]\f[CB]\-\-heightperrow\f[B]\f[R]
Treat height as per\-row.
Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked
(DBAR_EXPSTK), MicroPDF417 and PDF417.
.TP
-\f[CR]\-i\f[R], \f[CR]\-\-input=FILE\f[R]
-Read the input data from \f[I]FILE\f[R].
-Specify a single hyphen (\f[CR]\-\f[R]) for \f[I]FILE\f[R] to read from
-stdin.
+\f[B]\f[CB]\-i\f[B]\f[R] \f[I]\f[CI]FILE\f[I]\f[R], \f[B]\f[CB]\-\-input=\f[B]\f[R]\f[I]\f[CI]FILE\f[I]\f[R]
+Read the input data from \f[I]\f[CI]FILE\f[I]\f[R].
+Specify a single hyphen (\f[CR]\-\f[R]) for \f[I]\f[CI]FILE\f[I]\f[R] to
+read from stdin.
.TP
-\f[CR]\-\-init\f[R]
+\f[B]\f[CB]\-\-init\f[B]\f[R]
Create a Reader Initialisation (Programming) symbol.
.TP
-\f[CR]\-\-mask=INTEGER\f[R]
+\f[B]\f[CB]\-\-mask=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the masking pattern to use for DotCode, Han Xin or QR Code to
-\f[I]INTEGER\f[R], overriding the automatic selection.
+\f[I]\f[CI]INTEGER\f[I]\f[R], overriding the automatic selection.
.TP
-\f[CR]\-\-mirror\f[R]
+\f[B]\f[CB]\-\-mirror\f[B]\f[R]
Use the batch data to determine the filename in batch mode
(\f[CR]\-\-batch\f[R]).
The \f[CR]\-o\f[R] | \f[CR]\-\-output\f[R] option can be used to specify
an output directory (any filename will be ignored).
.TP
-\f[CR]\-\-mode=INTEGER\f[R]
+\f[B]\f[CB]\-\-mode=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
For MaxiCode and GS1 Composite symbols, set the encoding mode to
-\f[I]INTEGER\f[R].
+\f[I]\f[CI]INTEGER\f[I]\f[R].
.RS
.PP
For MaxiCode (SCM is Structured Carrier Message, with 3 fields:
@@ -349,17 +357,17 @@ i.e.\ \f[CR]EAN8_CC\f[R], \f[CR]EAN13_CC\f[R], \f[CR]GS1_128_CC\f[R],
.EE
.RE
.TP
-\f[CR]\-\-nobackground\f[R]
+\f[B]\f[CB]\-\-nobackground\f[B]\f[R]
Remove the background colour (EMF, EPS, GIF, PNG, SVG and TIF only).
.TP
-\f[CR]\-\-noquietzones\f[R]
+\f[B]\f[CB]\-\-noquietzones\f[B]\f[R]
Disable any quiet zones for symbols that define them by default.
.TP
-\f[CR]\-\-notext\f[R]
+\f[B]\f[CB]\-\-notext\f[B]\f[R]
Remove the Human Readable Text (HRT).
.TP
-\f[CR]\-o\f[R], \f[CR]\-\-output=FILE\f[R]
-Send the output to \f[I]FILE\f[R].
+\f[B]\f[CB]\-o\f[B]\f[R] \f[I]\f[CI]FILE\f[I]\f[R], \f[B]\f[CB]\-\-output=\f[B]\f[R]\f[I]\f[CI]FILE\f[I]\f[R]
+Send the output to \f[I]\f[CI]FILE\f[I]\f[R].
When not in batch mode, the default is \(lqout.png\(rq (or
\(lqout.gif\(rq if zint built without PNG support).
When in batch mode (\f[CR]\-\-batch\f[R]), special characters can be
@@ -374,33 +382,34 @@ Any other Insert literally
.EE
.RE
.TP
-\f[CR]\-\-primary=STRING\f[R]
+\f[B]\f[CB]\-\-primary=\f[B]\f[R]\f[I]STRING\f[R]
For MaxiCode, set the content of the primary message.
For GS1 Composite symbols, set the content of the linear symbol.
.TP
-\f[CR]\-\-quietzones\f[R]
+\f[B]\f[CB]\-\-quietzones\f[B]\f[R]
Add compliant quiet zones for symbols that specify them.
This is in addition to any whitespace specified by \f[CR]\-w\f[R] |
\f[CR]\-\-whitesp\f[R] or \f[CR]\-\-vwhitesp\f[R].
.TP
-\f[CR]\-r\f[R], \f[CR]\-\-reverse\f[R]
+\f[B]\f[CB]\-r\f[B]\f[R], \f[B]\f[CB]\-\-reverse\f[B]\f[R]
Reverse the foreground and background colours (white on black).
Known as \(lqreflectance reversal\(rq or \(lqreversed reflectance\(rq.
.TP
-\f[CR]\-\-rotate=INTEGER\f[R]
-Rotate the symbol by \f[I]INTEGER\f[R] degrees, where \f[I]INTEGER\f[R]
-can be 0, 90, 270 or 360.
+\f[B]\f[CB]\-\-rotate=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
+Rotate the symbol by \f[I]\f[CI]INTEGER\f[I]\f[R] degrees, where
+\f[I]\f[CI]INTEGER\f[I]\f[R] can be 0, 90, 270 or 360.
.TP
-\f[CR]\-\-rows=INTEGER\f[R]
-Set the number of rows for Codablock F or PDF417 to \f[I]INTEGER\f[R].
+\f[B]\f[CB]\-\-rows=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
+Set the number of rows for Codablock F or PDF417 to
+\f[I]\f[CI]INTEGER\f[I]\f[R].
It will also set the minimum number of rows for Code 16K or Code 49, and
the maximum number of rows for GS1 DataBar Expanded Stacked
(DBAR_EXPSTK).
.TP
-\f[CR]\-\-scale=NUMBER\f[R]
+\f[B]\f[CB]\-\-scale=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
Adjust the size of the X\-dimension.
-\f[I]NUMBER\f[R] may be floating\-point, and is multiplied by 2 (except
-for MaxiCode) before being applied.
+\f[I]\f[CI]NUMBER\f[I]\f[R] may be floating\-point, and is multiplied by
+2 (except for MaxiCode) before being applied.
The default scale is 1.
.RS
.PP
@@ -415,30 +424,34 @@ less than 1.
See also \f[CR]\-\-scalexdimdp\f[R] below.
.RE
.TP
-\f[CR]\-\-scalexdimdp=X[,R]\f[R]
-Scale the image according to X\-dimension \f[I]X\f[R] and resolution
-\f[I]R\f[R], where \f[I]X\f[R] is in mm and \f[I]R\f[R] is in dpmm (dots
-per mm).
-\f[I]X\f[R] and \f[I]R\f[R] may be floating\-point.
-\f[I]R\f[R] is optional and defaults to 12 dpmm (approximately 300 dpi).
-\f[I]X\f[R] may be zero in which case a symbology\-specific default is
-used.
+\f[B]\f[CB]\-\-scalexdimdp[=\f[B]\f[R]\f[I]\f[CI]X\f[I]\f[R]\f[CR][,\f[R]\f[I]\f[CI]R\f[I]\f[R]\f[CR]]]\f[R]
+Scale the image according to X\-dimension \f[I]\f[CI]X\f[I]\f[R] and
+resolution \f[I]\f[CI]R\f[I]\f[R], where \f[I]\f[CI]X\f[I]\f[R] is in mm
+and \f[I]\f[CI]R\f[I]\f[R] is in dpmm (dots per mm).
+\f[I]\f[CI]X\f[I]\f[R] and \f[I]\f[CI]R\f[I]\f[R] may be
+floating\-point.
+\f[I]\f[CI]R\f[I]\f[R] is optional and defaults to 12 dpmm
+(approximately 300 dpi).
+\f[I]\f[CI]X\f[I]\f[R] is optional or may be zero in which case a
+symbology\-specific default is used.
.RS
.PP
The scaling takes into account the output filetype, and deals with all
-the details mentioned above.
+the details mentioned above in \f[CR]\-\-scale\f[R].
Units may be specified for \f[I]X\f[R] by appending \(lqin\(rq (inch) or
\(lqmm\(rq, and for \f[I]R\f[R] by appending \(lqdpi\(rq (dots per inch)
or \(lqdpmm\(rq \- e.g.\ \f[CR]\-\-scalexdimdp=0.013in,300dpi\f[R].
.RE
.TP
-\f[CR]\-\-scmvv=INTEGER\f[R]
+\f[B]\f[CB]\-\-scmvv[=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]\f[CR]]\f[R]
For MaxiCode, prefix the Structured Carrier Message (SCM) with
-\f[CR]\(dq[)>\(rsR01\(rsGvv\(dq\f[R], where \f[CR]vv\f[R] is a 2\-digit
-\f[I]INTEGER\f[R].
+\f[CR]\(dq[)>\(rsR01\(rsGvv\(dq\f[R], where \f[CR]vv\f[R] is an optional
+2\-digit \f[I]\f[CI]INTEGER\f[I]\f[R].
+If \f[I]\f[CI]INTEGER\f[I]\f[R] is omitted it defaults to 96 (ASC
+MH10/SC 8).
.TP
-\f[CR]\-\-secure=INTEGER\f[R]
-Set the error correction level (ECC) to \f[I]INTEGER\f[R].
+\f[B]\f[CB]\-\-secure=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
+Set the error correction level (ECC) to \f[I]\f[CI]INTEGER\f[I]\f[R].
The meaning is specific to the following matrix symbols (all except
PDF417 are approximate):
.RS
@@ -455,52 +468,56 @@ Ultracode 1 to 6 (0%, 5%, 9%, 17%, 25%, 33%)
.EE
.RE
.TP
-\f[CR]\-\-segN=ECI,DATA\f[R]
-Set the \f[I]ECI\f[R] & \f[I]DATA\f[R] content for segment N, where N is
-1 to 9.
+\f[B]\f[CB]\-\-segN=\f[B]\f[R]\f[I]\f[CI]ECI\f[I]\f[R]\f[CR],\f[R]\f[I]\f[CI]DATA\f[I]\f[R]
+Set the \f[I]\f[CI]ECI\f[I]\f[R] & \f[I]\f[CI]DATA\f[I]\f[R] content for
+segment N, where N is 1 to 9.
\f[CR]\-d\f[R] | \f[CR]\-\-data\f[R] must still be given, and counts as
segment 0, its ECI given by \f[CR]\-\-eci\f[R].
Segments must be consecutive.
.TP
-\f[CR]\-\-separator=INTEGER\f[R]
+\f[B]\f[CB]\-\-separator=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the height of row separator bars for stacked symbologies, where
-\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension.
+\f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
+X\-dimension.
The default is zero.
.TP
-\f[CR]\-\-small\f[R]
+\f[B]\f[CB]\-\-small\f[B]\f[R]
Use a smaller font for Human Readable Text (HRT).
.TP
-\f[CR]\-\-square\f[R]
+\f[B]\f[CB]\-\-square\f[B]\f[R]
For Data Matrix symbols, exclude rectangular sizes when considering
automatic sizes.
See also \f[CR]\-\-dmre\f[R].
.TP
-\f[CR]\-\-structapp=I,C[,ID]\f[R]
-Set Structured Append info, where \f[I]I\f[R] is the 1\-based index,
-\f[I]C\f[R] is the total number of symbols in the sequence, and
-\f[I]ID\f[R], which is optional, is the identifier that all symbols in
-the sequence share.
+\f[B]\f[CB]\-\-structapp=\f[B]\f[R]\f[I]\f[CI]I\f[I]\f[R]\f[CR],\f[R]\f[I]\f[CI]C\f[I]\f[R]\f[CR][,\f[R]\f[I]\f[CI]ID\f[I]\f[R]\f[CR]]\f[R]
+Set Structured Append info, where \f[I]\f[CI]I\f[I]\f[R] is the 1\-based
+index, \f[I]\f[CI]C\f[I]\f[R] is the total number of symbols in the
+sequence, and \f[I]\f[CI]ID\f[I]\f[R], which is optional, is the
+identifier that all symbols in the sequence share.
Structured Append is supported by Aztec Code, Code One, Data Matrix,
DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and
Ultracode.
+Code One, DotCode and MaxiCode do not support an
+\f[I]\f[CI]ID\f[I]\f[R].
.TP
-\f[CR]\-t\f[R], \f[CR]\-\-types\f[R]
+\f[B]\f[CB]\-t\f[B]\f[R], \f[B]\f[CB]\-\-types\f[B]\f[R]
Display the table of barcode types (symbologies).
The numbers or names can be used with \f[CR]\-b\f[R] |
\f[CR]\-\-barcode\f[R].
.TP
-\f[CR]\-\-textgap=NUMBER\f[R]
+\f[B]\f[CB]\-\-textgap=\f[B]\f[R]\f[I]\f[CI]NUMBER\f[I]\f[R]
Adjust the gap between the barcode and the Human Readable Text (HRT).
-\f[I]NUMBER\f[R] is in X\-dimensions, and may be floating\-point.
+\f[I]\f[CI]NUMBER\f[I]\f[R] is in X\-dimensions, and may be
+floating\-point.
Maximum is 10 and minimum is \-5.
The default is 1.
.TP
-\f[CR]\-\-verbose\f[R]
+\f[B]\f[CB]\-\-verbose\f[B]\f[R]
Output debug information to stdout.
.TP
-\f[CR]\-\-vers=INTEGER\f[R]
+\f[B]\f[CB]\-\-vers=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the symbol version (size, check digits, other options) to
-\f[I]INTEGER\f[R].
+\f[I]\f[CI]INTEGER\f[I]\f[R].
The meaning is symbol\-specific.
.RS
.PP
@@ -646,30 +663,34 @@ MSI Plessey 0 to 6 (none to various visible options)
+10 (hide)
.EE
.PP
-For a few other symbologies, it specifies other characteristics:
+For some other symbologies, it specifies other characteristics:
.IP
.EX
Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel)
PZN 1 (PZN7 instead of default PZN8)
+Telepen 1 (use AIM\-defined Start/Stop)
+Telepen Numeric 1 (use AIM\-defined Start/Stop)
Ultracode 2 (revision 2)
VIN 1 (add international prefix)
.EE
.RE
.TP
-\f[CR]\-v\f[R], \f[CR]\-\-version\f[R]
+\f[B]\f[CB]\-v\f[B]\f[R], \f[B]\f[CB]\-\-version\f[B]\f[R]
Display zint version.
.TP
-\f[CR]\-\-vwhitesp=INTEGER\f[R]
+\f[B]\f[CB]\-\-vwhitesp=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the height of vertical whitespace above and below the barcode, where
-\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension.
+\f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
+X\-dimension.
.TP
-\f[CR]\-w\f[R], \f[CR]\-\-whitesp=INTEGER\f[R]
+\f[B]\f[CB]\-w\f[B]\f[R] \f[I]\f[CI]INTEGER\f[I]\f[R], \f[B]\f[CB]\-\-whitesp=\f[B]\f[R]\f[I]\f[CI]INTEGER\f[I]\f[R]
Set the width of horizontal whitespace either side of the barcode, where
-\f[I]INTEGER\f[R] is in integral multiples of the X\-dimension.
+\f[I]\f[CI]INTEGER\f[I]\f[R] is in integral multiples of the
+X\-dimension.
.TP
-\f[CR]\-\-werror\f[R]
+\f[B]\f[CB]\-\-werror\f[B]\f[R]
Convert all warnings into errors.
.SH EXIT STATUS
.TP
@@ -772,14 +793,19 @@ and at
Zint is designed to be compliant with a number of international
standards, including:
.PP
-ISO/IEC 24778:2024, ANSI/AIM BC12\-1998, EN 798:1996, AIM ISS\-X\-24
-(1995), ISO/IEC 15417:2007, EN 12323:2005, ISO/IEC 16388:2023, ANSI/AIM
-BC6\-2000, ANSI/AIM BC5\-1995, AIM USS Code One (1994), ISO/IEC
-16022:2024, ISO/IEC 21471:2019, ISO/IEC 15420:2009, AIMD014 (v 1.63)
-(2008), ISO/IEC 24723:2010, ISO/IEC 24724:2011, ISO/IEC 20830:2021,
-ISO/IEC 16390:2007, ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC
-15438:2015, ISO/IEC 18004:2024, ISO/IEC 23941:2022, AIM ITS/04\-023
-(2022)
+ISO/IEC 24778:2024 (Aztec Code), SEMI T1\-95 (1996) (BC412), ANSI/AIM
+BC12\-1998 (Channel Code), EN 798:1996 (Codabar), AIM ISS\-X\-24 (1995)
+(Codablock F), ISO/IEC 15417:2007 (Code 128), EN 12323:2005 (Code 16K),
+ISO/IEC 16388:2023 (Code 39), ANSI/AIM BC6\-2000 (Code 49), ANSI/AIM
+BC5\-1995 (Code 93), AIM USS Code One (1994), ISO/IEC 16022:2024 (Data
+Matrix), ISO/IEC 21471:2025 (DMRE), AIM TSC1705001 (2019) (DotCode),
+ISO/IEC 15420:2025 (EAN/UPC), AIMD014 (v 1.63) (2008) (Grid Matrix),
+ISO/IEC 24723:2010 (GS1 Composite), ISO/IEC 24724:2011 (GS1 DataBar),
+ISO/IEC 20830:2021 (Han Xin Code), ISO/IEC 16390:2007 (Interleaved 2 of
+5), ISO/IEC 16023:2000 (MaxiCode), ISO/IEC 24728:2006 (MicroPDF417),
+ISO/IEC 15438:2015 (PDF417), ISO/IEC 18004:2024 (QR Code), ISO/IEC
+23941:2022 (rMQR), AIM Europe X\-25 (1991) (Telepen), AIMD/TSC15032\-43
+(2015) (Ultracode)
.SH COPYRIGHT
Copyright © 2026 Robin Stuart.
Released under GNU GPL 3.0 or later.
diff --git a/docs/zint.1.pmd b/docs/zint.1.pmd
index 87d4bf11..dd4abf59 100644
--- a/docs/zint.1.pmd
+++ b/docs/zint.1.pmd
@@ -1,6 +1,6 @@
% ZINT(1) Version 2.16.0.9
%
-% April 2026
+% May 2026
[//]: # ( vim: set ts=4 sw=4 et : )
@@ -10,8 +10,8 @@
# SYNOPSIS
-| `zint` [`-h` | `--help`]
-| `zint` [*options*]
+| **`zint`** [`-h` | `--help`]
+| **`zint`** [*options*]
# DESCRIPTION
@@ -28,138 +28,140 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
# OPTIONS
-`-h`, `--help`
+**`-h`**, **`--help`**
: Print usage information summarizing command line options.
-`-b TYPE`, `--barcode=TYPE`
+**`-b`** *`TYPE`*, **`--barcode=`***`TYPE`*
-: Set the barcode symbology that will be used to encode the data. *TYPE* is the number or name of the barcode
+: Set the barcode symbology that will be used to encode the data. *`TYPE`* is the number or name of the barcode
symbology. If not given, the symbology defaults to 20 (Code 128). To see what types are available, use the `-t` |
`--types` option. Type names are case-insensitive, and non-alphanumerics are ignored.
-`--addongap=INTEGER`
+**`--addongap=`***`INTEGER`*
-: For EAN/UPC symbologies, set the gap between the main data and the add-on. *INTEGER* is in integral multiples of
+: For EAN/UPC symbologies, set the gap between the main data and the add-on. *`INTEGER`* is in integral multiples of
the X-dimension. The maximum gap that can be set is 12. The minimum is 7, except for UPC-A, when the minimum is 9.
-`--azfull`
+**`--azfull`**
: For Aztec Code symbols, exclude Compact versions when considering automatic sizes (i.e. consider Full versions
only).
-`--batch`
+**`--batch`**
: Treat each line of an input file specified with `-i` | `--input` as a separate data set and produce a barcode
image for each one. The barcode images are outputted by default to numbered filenames starting with "00001.png",
"00002.png" etc., which can be changed by using the `-o` | `--output` option.
-`--bg=COLOUR`
+**`--bg=`***`COLOUR`*
-: Specify a background (paper) colour where *COLOUR* is in hexadecimal `RRGGBB` or `RRGGBBAA` format or in decimal
+: Specify a background (paper) colour where *`COLOUR`* is in hexadecimal `RRGGBB` or `RRGGBBAA` format or in decimal
`C,M,Y,K` percentages format.
-`--binary`
+**`--binary`**
: Treat input data as raw 8-bit binary data instead of the default UTF-8. Automatic code page translation to an ECI
page is disabled, and no validation of the data's character encoding takes place.
-`--bind`
+**`--bind`**
: Add horizontal boundary bars (also known as bearer bars) to the symbol. The width of the boundary bars is
specified by the `--border` option. `--bind` can also be used to add row separator bars to symbols stacked with
multiple `-d` | `--data` inputs, in which case the width of the separator bars is specified with the `--separator`
option.
-`--bindtop`
+**`--bindtop`**
: Add a horizontal boundary bar to the top of the symbol. The width of the boundary bar is specified by the
`--border` option.
-`--bold`
+**`--bold`**
: Use a bold font for the Human Readable Text (HRT).
-`--border=INTEGER`
+**`--border=`***`INTEGER`*
-: Set the width of boundary bars (`--bind` or `--bindtop`) or box borders (`--box`), where *INTEGER* is in integral
- multiples of the X-dimension. The default is zero.
+: Set the width of boundary bars (`--bind` or `--bindtop`) or box borders (`--box`), where *`INTEGER`* is in
+ integral multiples of the X-dimension. The default is zero.
-`--box`
+**`--box`**
: Add a box around the symbol. The width of the borders is specified by the `--border` option.
-`--cmyk`
+**`--cmyk`**
: Use the CMYK colour space when outputting to Encapsulated PostScript (EPS) or TIF files.
-`--cols=INTEGER`
+**`--cols=`***`INTEGER`*
-: Set the number of data columns in the symbol to *INTEGER*. Affects Codablock F, DotCode, GS1 DataBar Expanded
+: Set the number of data columns in the symbol to *`INTEGER`*. Affects Codablock F, DotCode, GS1 DataBar Expanded
Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417 symbols.
-`--compliantheight`
+**`--compliantheight`**
: Warn if the height specified by the `--height` option is not compliant with the barcode's specification, or if
`--height` is not given, default to the height specified by the specification (if any).
-`-d`, `--data=DATA`
+**`-d`** *`DATA`*, **`--data=`***`DATA`*
-: Specify the input *DATA* to encode. The `--esc` option may be used to enter non-printing characters using escape
- sequences. The *DATA* should be UTF-8, unless the `--binary` option is given, in which case it can be anything.
+: Specify the input *`DATA`* to encode. The `--esc` option may be used to enter non-printing characters using escape
+ sequences. The *`DATA`* should be UTF-8, unless the `--binary` option is given, in which case it can be anything.
-`--direct`
+**`--direct`**
: Send output to stdout, which in most cases should be re-directed to a pipe or a file. Use `--filetype` to specify
output format.
-`--dmb256=INTEGER`
+**`--dmb256[=`***`INTEGER`*`]`
-: For Data Matrix symbols, encode the first *INTEGER* input characters in Base 256 mode. 0 means all input.
+: For Data Matrix symbols, encode the first *`INTEGER`* (optional, 0 if not given) input characters in Base 256
+ mode. 0 means all input.
-`--dmc40=INTEGER`
+**`--dmc40[=`***`INTEGER`*`]`
-: For Data Matrix symbols, encode the first *INTEGER* input characters in C40 mode. 0 means all input.
+: For Data Matrix symbols, encode the first *`INTEGER`* (optional, 0 if not given) input characters in C40 mode. 0
+ means all input.
-`--dmiso144`
+**`--dmiso144`**
: For Data Matrix symbols, use the standard ISO/IEC codeword placement for 144 x 144 (`--vers=24`) sized symbols,
instead of the default "de facto" placement (which rotates the placement of ECC codewords).
-`--dmre`
+**`--dmre`**
: For Data Matrix symbols, allow Data Matrix Rectangular Extended (DMRE) sizes when considering automatic sizes. See
also `--square`.
-`--dotsize=NUMBER`
+**`--dotsize=`***`NUMBER`*
-: Set the radius of the dots in dotty mode (`--dotty`). *NUMBER* is in X-dimensions, and may be floating-point. The
- default is 0.8.
+: Set the radius of the dots in dotty mode (`--dotty`). *`NUMBER`* is in X-dimensions, and may be floating-point.
+ The default is 0.8.
-`--dotty`
+**`--dotty`**
: Use dots instead of squares for matrix symbols. DotCode is always in dotty mode.
-`--dump`
+**`--dump`**
: Dump a hexadecimal representation of the symbol's encodation to stdout. The same representation may be outputted
to a file by using a `.txt` extension with `-o` | `--output` or by specifying `--filetype=txt`.
-`-e`, `--ecinos`
+**`-e`**, **`--ecinos`**
: Display the table of ECIs (Extended Channel Interpretations).
-`--eci=INTEGER`
+**`--eci=`***`INTEGER`*
-: Set the ECI code for the input data to *INTEGER*. See `-e` | `--ecinos` for a list of the ECIs available. ECIs are
- supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, Han Xin Code, MaxiCode, MicroPDF417, PDF417,
- QR Code, rMQR and Ultracode.
+: Set the ECI code for the input data to *`INTEGER`*. See `-e` | `--ecinos` for a list of the ECIs available. ECIs
+ are supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, Han Xin Code, MaxiCode, MicroPDF417,
+ PDF417, QR Code, rMQR and Ultracode.
-`--embedfont`
+**`--embedfont`**
: For vector output, embed the font in the file for portability. Currently only available for SVG output.
-`--esc`
+**`--esc`**
: Process escape characters in the input data. The escape sequences are:
@@ -172,9 +174,12 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
\v (0x0B) VT Vertical Tab
\f (0x0C) FF Form Feed
\r (0x0D) CR Carriage Return
+ \L (0x10) DLE Data Link Escape
\e (0x1B) ESC Escape
+ \F (0x1C) FS File Separator
\G (0x1D) GS Group Separator
\R (0x1E) RS Record Separator
+ \N (0x1F) US Unit Separator
\( (0x28) ( Opening parenthesis (only with
--gs1parens)
\) (0x29) ) Closing parenthesis (only with
@@ -191,100 +196,101 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
\UNNNNNN (U+NNNNNN) Any 21-bit Unicode character
where NNNNNN is hexadecimal
-`--extraesc`
+**`--extraesc`**
: As well as processing the normal escape sequences above, process the special escape sequences beginning with `\^`.
For Aztec Code, Code 128 and Data Matrix, process the escape sequence `\^1` that inserts an `FNC1` character, and
the escaping sequence `\^^` that encodes a literal `\^`. For Code 128 only, process the escape sequences `\^A`,
`\^B`, `\^C` and `\^@` that allow manual switching of Code Sets. The sequence `\^@` turns off manual switching.
-`--fast`
+**`--fast`**
-: Use faster if less optimal encodation or other shortcuts (affects Data Matrix, MicroPDF417, PDF417, QRCODE & UPNQR
- only).
+: Use faster if less optimal encodation or other shortcuts (affects Aztec Code, Data Matrix, MicroPDF417, PDF417, QR
+ Code & UPNQR only).
-`--fg=COLOUR`
+**`--fg=`***`COLOUR`*
-: Specify a foreground (ink) colour where *COLOUR* is in hexadecimal `RRGGBB` or `RRGGBBAA` format or in decimal
+: Specify a foreground (ink) colour where *`COLOUR`* is in hexadecimal `RRGGBB` or `RRGGBBAA` format or in decimal
`C,M,Y,K` percentages format.
-`--filetype=TYPE`
+**`--filetype=`***`TYPE`*
-: Set the output file type to *TYPE*, which is one of `BMP`, `EMF`, `EPS`, `GIF`, `PCX`, `PNG`, `SVG`, `TIF`, `TXT`.
+: Set the output file type to *`TYPE`*, which is one of `BMP`, `EMF`, `EPS`, `GIF`, `PCX`, `PNG`, `SVG`, `TIF`,
+ `TXT`.
-`--fullmultibyte`
+**`--fullmultibyte`**
: Use the multibyte modes of Grid Matrix, Han Xin and QR Code for non-ASCII data.
-`--gs1`
+**`--gs1`**
: Treat input as GS1 compatible data. A number of input formats are available. Application Identifiers (AIs) may be
placed in square brackets `"[]"`. Alternatively the GS1 Syntax Engine "Unbracketed AI" format may be used, which
starts with a caret (`^`) and uses carets to indicate required `FNC1`s. For matrix symbologies, GS1 Digital Link
URIs (unverified) may be given. Further input options are available with `--gs1parens` and `--gs1raw`.
-`--gs1nocheck`
+**`--gs1nocheck`**
: Treat input as GS1 compatible data (as `--gs1`) but do not check the validity of the data.
-`--gs1parens`
+**`--gs1parens`**
: 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 (`"\("`).
-`--gs1raw`
+**`--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
the GS1 data, including GS1 Digital Link URIs. Ignored if `--gs1nocheck` also given.
-`--gssep`
+**`--gssep`**
: For Data Matrix in GS1 mode, use `GS` (0x1D) as the GS1 data separator instead of `FNC1`.
-`--guarddescent=NUMBER`
+**`--guarddescent=`***`NUMBER`*
-: For EAN/UPC symbols, set the height the guard bars descend below the main bars, where *NUMBER* is in X-dimensions.
- *NUMBER* may be floating-point.
+: For EAN/UPC symbols, set the height the guard bars descend below the main bars, where *`NUMBER`* is in
+ X-dimensions. *`NUMBER`* may be floating-point.
-`--guardwhitespace`
+**`--guardwhitespace`**
: For EAN/UPC symbols, add quiet zone indicators `"<"` and/or `">"` to HRT where applicable.
-`--height=NUMBER`
+**`--height=`***`NUMBER`*
-: Set the height of the symbol in X-dimensions. *NUMBER* may be floating-point.
+: Set the height of the symbol in X-dimensions. *`NUMBER`* may be floating-point.
-`--heightperrow`
+**`--heightperrow`**
: Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK),
MicroPDF417 and PDF417.
-`-i`, `--input=FILE`
+**`-i`** *`FILE`*, **`--input=`***`FILE`*
-: Read the input data from *FILE*. Specify a single hyphen (`-`) for *FILE* to read from stdin.
+: Read the input data from *`FILE`*. Specify a single hyphen (`-`) for *`FILE`* to read from stdin.
-`--init`
+**`--init`**
: Create a Reader Initialisation (Programming) symbol.
-`--mask=INTEGER`
+**`--mask=`***`INTEGER`*
-: Set the masking pattern to use for DotCode, Han Xin or QR Code to *INTEGER*, overriding the automatic selection.
+: Set the masking pattern to use for DotCode, Han Xin or QR Code to *`INTEGER`*, overriding the automatic selection.
-`--mirror`
+**`--mirror`**
: Use the batch data to determine the filename in batch mode (`--batch`). The `-o` | `--output` option can be used
to specify an output directory (any filename will be ignored).
-`--mode=INTEGER`
+**`--mode=`***`INTEGER`*
-: For MaxiCode and GS1 Composite symbols, set the encoding mode to *INTEGER*.
+: For MaxiCode and GS1 Composite symbols, set the encoding mode to *`INTEGER`*.
For MaxiCode (SCM is Structured Carrier Message, with 3 fields: postcode, 3-digit ISO 3166-1 country code, 3-digit
service code):
@@ -301,21 +307,21 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
2 CC-B
3 CC-C (GS1_128_CC only)
-`--nobackground`
+**`--nobackground`**
: Remove the background colour (EMF, EPS, GIF, PNG, SVG and TIF only).
-`--noquietzones`
+**`--noquietzones`**
: Disable any quiet zones for symbols that define them by default.
-`--notext`
+**`--notext`**
: Remove the Human Readable Text (HRT).
-`-o`, `--output=FILE`
+**`-o`** *`FILE`*, **`--output=`***`FILE`*
-: Send the output to *FILE*. When not in batch mode, the default is "out.png" (or "out.gif" if zint built without
+: Send the output to *`FILE`*. When not in batch mode, the default is "out.png" (or "out.gif" if zint built without
PNG support). When in batch mode (`--batch`), special characters can be used to format the output filenames:
~ Insert a number or 0
@@ -323,33 +329,33 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
@ Insert a number or * (+ on Windows)
Any other Insert literally
-`--primary=STRING`
+**`--primary=`***STRING*
: For MaxiCode, set the content of the primary message. For GS1 Composite symbols, set the content of the linear
symbol.
-`--quietzones`
+**`--quietzones`**
: Add compliant quiet zones for symbols that specify them. This is in addition to any whitespace specified by `-w` |
`--whitesp` or `--vwhitesp`.
-`-r`, `--reverse`
+**`-r`**, **`--reverse`**
: Reverse the foreground and background colours (white on black). Known as "reflectance reversal" or "reversed
reflectance".
-`--rotate=INTEGER`
+**`--rotate=`***`INTEGER`*
-: Rotate the symbol by *INTEGER* degrees, where *INTEGER* can be 0, 90, 270 or 360.
+: Rotate the symbol by *`INTEGER`* degrees, where *`INTEGER`* can be 0, 90, 270 or 360.
-`--rows=INTEGER`
+**`--rows=`***`INTEGER`*
-: Set the number of rows for Codablock F or PDF417 to *INTEGER*. It will also set the minimum number of rows for
+: Set the number of rows for Codablock F or PDF417 to *`INTEGER`*. It will also set the minimum number of rows for
Code 16K or Code 49, and the maximum number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK).
-`--scale=NUMBER`
+**`--scale=`***`NUMBER`*
-: Adjust the size of the X-dimension. *NUMBER* may be floating-point, and is multiplied by 2 (except for MaxiCode)
+: Adjust the size of the X-dimension. *`NUMBER`* may be floating-point, and is multiplied by 2 (except for MaxiCode)
before being applied. The default scale is 1.
For MaxiCode, the scale is multiplied by 10 for raster output, by 40 for EMF output, and by 2 otherwise.
@@ -359,23 +365,24 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
See also `--scalexdimdp` below.
-`--scalexdimdp=X[,R]`
+**`--scalexdimdp[=`***`X`*`[,`*`R`*`]]`
-: Scale the image according to X-dimension *X* and resolution *R*, where *X* is in mm and *R* is in dpmm (dots per
- mm). *X* and *R* may be floating-point. *R* is optional and defaults to 12 dpmm (approximately 300 dpi). *X* may
- be zero in which case a symbology-specific default is used.
+: Scale the image according to X-dimension *`X`* and resolution *`R`*, where *`X`* is in mm and *`R`* is in dpmm
+ (dots per mm). *`X`* and *`R`* may be floating-point. *`R`* is optional and defaults to 12 dpmm (approximately 300
+ dpi). *`X`* is optional or may be zero in which case a symbology-specific default is used.
- The scaling takes into account the output filetype, and deals with all the details mentioned above. Units may be
- specified for *X* by appending "in" (inch) or "mm", and for *R* by appending "dpi" (dots per inch) or "dpmm" -
- e.g. `--scalexdimdp=0.013in,300dpi`.
+ The scaling takes into account the output filetype, and deals with all the details mentioned above in `--scale`.
+ Units may be specified for *X* by appending "in" (inch) or "mm", and for *R* by appending "dpi" (dots per inch) or
+ "dpmm" - e.g. `--scalexdimdp=0.013in,300dpi`.
-`--scmvv=INTEGER`
+**`--scmvv[=`***`INTEGER`*`]`
-: For MaxiCode, prefix the Structured Carrier Message (SCM) with `"[)>\R01\Gvv"`, where `vv` is a 2-digit *INTEGER*.
+: For MaxiCode, prefix the Structured Carrier Message (SCM) with `"[)>\R01\Gvv"`, where `vv` is an optional 2-digit
+ *`INTEGER`*. If *`INTEGER`* is omitted it defaults to 96 (ASC MH10/SC 8).
-`--secure=INTEGER`
+**`--secure=`***`INTEGER`*
-: Set the error correction level (ECC) to *INTEGER*. The meaning is specific to the following matrix symbols (all
+: Set the error correction level (ECC) to *`INTEGER`*. The meaning is specific to the following matrix symbols (all
except PDF417 are approximate):
Aztec Code 1 to 4 (10%, 23%, 36%, 50%)
@@ -387,47 +394,47 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
rMQR 2 or 4 (15% or 30%) (M or H)
Ultracode 1 to 6 (0%, 5%, 9%, 17%, 25%, 33%)
-`--segN=ECI,DATA`
+**`--segN=`***`ECI`*`,`*`DATA`*
-: Set the *ECI* & *DATA* content for segment N, where N is 1 to 9. `-d` | `--data` must still be given, and counts
- as segment 0, its ECI given by `--eci`. Segments must be consecutive.
+: Set the *`ECI`* & *`DATA`* content for segment N, where N is 1 to 9. `-d` | `--data` must still be given, and
+ counts as segment 0, its ECI given by `--eci`. Segments must be consecutive.
-`--separator=INTEGER`
+**`--separator=`***`INTEGER`*
-: Set the height of row separator bars for stacked symbologies, where *INTEGER* is in integral multiples of the
+: Set the height of row separator bars for stacked symbologies, where *`INTEGER`* is in integral multiples of the
X-dimension. The default is zero.
-`--small`
+**`--small`**
: Use a smaller font for Human Readable Text (HRT).
-`--square`
+**`--square`**
: For Data Matrix symbols, exclude rectangular sizes when considering automatic sizes. See also `--dmre`.
-`--structapp=I,C[,ID]`
+**`--structapp=`***`I`*`,`*`C`*`[,`*`ID`*`]`
-: Set Structured Append info, where *I* is the 1-based index, *C* is the total number of symbols in the sequence,
- and *ID*, which is optional, is the identifier that all symbols in the sequence share. Structured Append is
- supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR Code and
- Ultracode.
+: Set Structured Append info, where *`I`* is the 1-based index, *`C`* is the total number of symbols in the
+ sequence, and *`ID`*, which is optional, is the identifier that all symbols in the sequence share. Structured
+ Append is supported by Aztec Code, Code One, Data Matrix, DotCode, Grid Matrix, MaxiCode, MicroPDF417, PDF417, QR
+ Code and Ultracode. Code One, DotCode and MaxiCode do not support an *`ID`*.
-`-t`, `--types`
+**`-t`**, **`--types`**
: Display the table of barcode types (symbologies). The numbers or names can be used with `-b` | `--barcode`.
-`--textgap=NUMBER`
+**`--textgap=`***`NUMBER`*
-: Adjust the gap between the barcode and the Human Readable Text (HRT). *NUMBER* is in X-dimensions, and may be
+: Adjust the gap between the barcode and the Human Readable Text (HRT). *`NUMBER`* is in X-dimensions, and may be
floating-point. Maximum is 10 and minimum is -5. The default is 1.
-`--verbose`
+**`--verbose`**
: Output debug information to stdout.
-`--vers=INTEGER`
+**`--vers=`***`INTEGER`*
-: Set the symbol version (size, check digits, other options) to *INTEGER*. The meaning is symbol-specific.
+: Set the symbol version (size, check digits, other options) to *`INTEGER`*. The meaning is symbol-specific.
For most matrix symbols, it specifies size:
@@ -566,30 +573,32 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
5, 6 (mod-11 NCR, mod-11 NCR + mod-10)
+10 (hide)
- For a few other symbologies, it specifies other characteristics:
+ For some other symbologies, it specifies other characteristics:
Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel)
PZN 1 (PZN7 instead of default PZN8)
+ Telepen 1 (use AIM-defined Start/Stop)
+ Telepen Numeric 1 (use AIM-defined Start/Stop)
Ultracode 2 (revision 2)
VIN 1 (add international prefix)
-`-v`, `--version`
+**`-v`**, **`--version`**
: Display zint version.
-`--vwhitesp=INTEGER`
+**`--vwhitesp=`***`INTEGER`*
-: Set the height of vertical whitespace above and below the barcode, where *INTEGER* is in integral multiples of the
- X-dimension.
+: Set the height of vertical whitespace above and below the barcode, where *`INTEGER`* is in integral multiples of
+ the X-dimension.
-`-w`, `--whitesp=INTEGER`
+**`-w`** *`INTEGER`*, **`--whitesp=`***`INTEGER`*
-: Set the width of horizontal whitespace either side of the barcode, where *INTEGER* is in integral multiples of the
- X-dimension.
+: Set the width of horizontal whitespace either side of the barcode, where *`INTEGER`* is in integral multiples of
+ the X-dimension.
-`--werror`
+**`--werror`**
: Convert all warnings into errors.
@@ -684,14 +693,15 @@ and at
Zint is designed to be compliant with a number of international standards, including:
-ISO/IEC 24778:2024, ANSI/AIM BC12-1998, EN 798:1996,
-AIM ISS-X-24 (1995), ISO/IEC 15417:2007, EN 12323:2005,
-ISO/IEC 16388:2023, ANSI/AIM BC6-2000, ANSI/AIM BC5-1995,
-AIM USS Code One (1994), ISO/IEC 16022:2024, ISO/IEC 21471:2019,
-ISO/IEC 15420:2009, AIMD014 (v 1.63) (2008), ISO/IEC 24723:2010,
-ISO/IEC 24724:2011, ISO/IEC 20830:2021, ISO/IEC 16390:2007,
-ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC 15438:2015,
-ISO/IEC 18004:2024, ISO/IEC 23941:2022, AIM ITS/04-023 (2022)
+ISO/IEC 24778:2024 (Aztec Code), SEMI T1-95 (1996) (BC412), ANSI/AIM BC12-1998 (Channel Code),
+EN 798:1996 (Codabar), AIM ISS-X-24 (1995) (Codablock F), ISO/IEC 15417:2007 (Code 128),
+EN 12323:2005 (Code 16K), ISO/IEC 16388:2023 (Code 39), ANSI/AIM BC6-2000 (Code 49),
+ANSI/AIM BC5-1995 (Code 93), AIM USS Code One (1994), ISO/IEC 16022:2024 (Data Matrix),
+ISO/IEC 21471:2025 (DMRE), AIM TSC1705001 (2019) (DotCode), ISO/IEC 15420:2025 (EAN/UPC),
+AIMD014 (v 1.63) (2008) (Grid Matrix), ISO/IEC 24723:2010 (GS1 Composite), ISO/IEC 24724:2011 (GS1 DataBar),
+ISO/IEC 20830:2021 (Han Xin Code), ISO/IEC 16390:2007 (Interleaved 2 of 5), ISO/IEC 16023:2000 (MaxiCode),
+ISO/IEC 24728:2006 (MicroPDF417), ISO/IEC 15438:2015 (PDF417), ISO/IEC 18004:2024 (QR Code),
+ISO/IEC 23941:2022 (rMQR), AIM Europe X-25 USS Telepen (1991), AIMD/TSC15032-43 (2015) (Ultracode)
# COPYRIGHT
diff --git a/docs/zint_images.sh b/docs/zint_images.sh
index 075b2c32..21e77f2f 100755
--- a/docs/zint_images.sh
+++ b/docs/zint_images.sh
@@ -62,8 +62,11 @@ zint -b EAN_2ADDON --compliantheight -d "12" --scale=$SCALE_UPCEAN -o images/ean
zint -b EAN_5ADDON --compliantheight -d "54321" --guardwhitespace --scale=$SCALE_UPCEAN -o images/ean_5addon_gws.svg
zint -b PLESSEY -d "C64" --scale=$SCALE_LINEAR -o images/plessey.svg
zint -b MSI_PLESSEY -d "6502" --vers=2 --scale=$SCALE_LINEAR -o images/msi_plessey.svg
-zint -b TELEPEN --compliantheight -d "Z80" --scale=$SCALE_LINEAR -o images/telepen.svg
+zint -b TELEPEN --compliantheight -d "Z8000" --scale=$SCALE_LINEAR -o images/telepen.svg
+zint -b TELEPEN --compliantheight -d "Z\L8000" --esc --vers=1 --scale=$SCALE_LINEAR -o images/telepen_aim.svg
zint -b TELEPEN_NUM --compliantheight -d "466X33" --scale=$SCALE_LINEAR -o images/telepen_num.svg
+zint -b TELEPEN_NUM --compliantheight -d "12\LAB" --esc --scale=$SCALE_LINEAR -o images/telepen_num_asc.svg
+zint -b TELEPEN_NUM --compliantheight -d "12\L3" --esc --scale=$SCALE_LINEAR -o images/telepen_num_odd.svg
zint -b CODE39 --compliantheight -d "1A" --vers=1 --scale=$SCALE_LINEAR -o images/code39.svg
zint -b EXCODE39 --compliantheight -d "123.45#@fd" --scale=$SCALE_LINEAR -o images/excode39.svg
zint -b CODE93 --compliantheight -d "C93" --scale=$SCALE_LINEAR -o images/code93.svg
diff --git a/frontend/main.c b/frontend/main.c
index 0baf776c..652ada48 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -184,8 +184,8 @@ static void usage(const int no_png, const int have_gs1syntaxengine) {
" --compliantheight Warn if height not compliant, and use standard default\n"
" -d, --data=DATA Set the symbol data content (segment 0)\n", stdout);
fputs( " --direct Send output to stdout\n"
- " --dmb256=INTEGER Start Data Matrix in Base 256 for given length (0 all)\n"
- " --dmc40=INTEGER Start Data Matrix in C40 mode for given length (0 all)\n"
+ " --dmb256[=INTEGER] Start Data Matrix in Base 256 for given length (0 all)\n"
+ " --dmc40[=INTEGER] Start Data Matrix in C40 mode for given length (0 all)\n"
" --dmiso144 Use ISO format for 144x144 Data Matrix symbols\n"
" --dmre Allow Data Matrix Rectangular Extended\n", stdout);
fputs( " --dotsize=NUMBER Set radius of dots in dotty mode\n"
@@ -228,8 +228,8 @@ if (have_gs1syntaxengine) {
" --rotate=INTEGER Rotate symbol by INTEGER (0, 90, 180, 270) degrees\n"
" --rows=INTEGER Set number of rows (Codablock F/PDF417)\n", stdout);
fputs( " --scale=NUMBER Adjust size of X-dimension\n"
- " --scalexdimdp=X[,R] Adjust size to X-dimension X at resolution R\n"
- " --scmvv=INTEGER Prefix SCM with \"[)>\\R01\\Gvv\" (vv is INTEGER) (MaxiCode)\n"
+ " --scalexdimdp[=X[,R]] Adjust size to X-dimension X at resolution R\n"
+ " --scmvv[=INTEGER] Prefix SCM with \"[)>\\R01\\Gvv\" (vv is INTEGER) (MaxiCode)\n"
" --secure=INTEGER Set error correction level (ECC)\n"
" --segN=ECI,DATA Set the ECI & data content for segment N, where N 1 to 9\n", stdout);
fputs( " --separator=INTEGER Set height of row separator bars (stacked symbologies)\n"
@@ -830,7 +830,7 @@ static int validate_scalexdimdp(const char *const arg, float *const p_x_dim_mm,
int units_i; /* For `validate_units()` */
char *units_err; /* For `validate_units()` */
char errbuf_float[ERRBUF_SIZE]; /* For `validate_float()` */
- const char *comma = strchr(arg, ',');
+ const char *comma = arg ? strchr(arg, ',') : NULL;
if (comma) {
if (comma == arg || comma - arg >= ARRAY_SIZE(x_buf)) {
cpy_str(errbuf, ERRBUF_SIZE, comma == arg ? "scalexdimdp X-dim too short" : "scalexdimdp X-dim too long");
@@ -845,11 +845,11 @@ static int validate_scalexdimdp(const char *const arg, float *const p_x_dim_mm,
}
cpy_str(r_buf, ARRAY_SIZE(r_buf), comma);
} else {
- if (!*arg || strlen(arg) >= ARRAY_SIZE(x_buf)) {
+ if (arg && (!*arg || strlen(arg) >= ARRAY_SIZE(x_buf))) {
cpy_str(errbuf, ERRBUF_SIZE, !*arg ? "scalexdimdp X-dim too short" : "scalexdimdp X-dim too long");
return 0;
}
- cpy_str(x_buf, ARRAY_SIZE(x_buf), arg);
+ cpy_str(x_buf, ARRAY_SIZE(x_buf), arg ? arg : "0");
}
if ((units_i = validate_units(x_buf, x_units, ARRAY_SIZE(x_units), &units_err)) < 0) {
cpycat_str(errbuf, ERRBUF_SIZE, "scalexdimdp X-dim unknown units: ", units_err);
@@ -1583,8 +1583,8 @@ int main(int argc, char **argv) {
{"compliantheight", 0, NULL, OPT_COMPLIANTHEIGHT},
{"data", 1, NULL, 'd'},
{"direct", 0, NULL, OPT_DIRECT},
- {"dmb256", 1, NULL, OPT_DMB256},
- {"dmc40", 1, NULL, OPT_DMC40},
+ {"dmb256", 2, NULL, OPT_DMB256},
+ {"dmc40", 2, NULL, OPT_DMC40},
{"dmiso144", 0, NULL, OPT_DMISO144},
{"dmre", 0, NULL, OPT_DMRE},
{"dotsize", 1, NULL, OPT_DOTSIZE},
@@ -1627,8 +1627,8 @@ int main(int argc, char **argv) {
{"rotate", 1, NULL, OPT_ROTATE},
{"rows", 1, NULL, OPT_ROWS},
{"scale", 1, NULL, OPT_SCALE},
- {"scalexdimdp", 1, NULL, OPT_SCALEXDIM},
- {"scmvv", 1, NULL, OPT_SCMVV},
+ {"scalexdimdp", 2, NULL, OPT_SCALEXDIM},
+ {"scmvv", 2, NULL, OPT_SCMVV},
{"secure", 1, NULL, OPT_SECURE},
{"seg1", 1, NULL, OPT_SEG1},
{"seg2", 1, NULL, OPT_SEG2},
@@ -1741,7 +1741,9 @@ int main(int argc, char **argv) {
my_symbol->output_options |= BARCODE_STDOUT;
break;
case OPT_DMB256:
- if (!validate_int(optarg, -1 /*len*/, &val)) {
+ if (!optarg) {
+ val = 0;
+ } else if (!validate_int(optarg, -1 /*len*/, &val)) {
fprintf(stderr, "Error 158: Invalid Data Matrix Base 256 mode length value (digits only)\n");
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
@@ -1756,7 +1758,9 @@ int main(int argc, char **argv) {
}
break;
case OPT_DMC40:
- if (!validate_int(optarg, -1 /*len*/, &val)) {
+ if (!optarg) {
+ val = 0;
+ } else if (!validate_int(optarg, -1 /*len*/, &val)) {
fprintf(stderr, "Error 160: Invalid Data Matrix C40 mode length value (digits only)\n");
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
@@ -2026,7 +2030,9 @@ int main(int argc, char **argv) {
}
break;
case OPT_SCMVV:
- if (!validate_int(optarg, -1 /*len*/, &val)) {
+ if (!optarg) {
+ val = 96; /* ASC MH10/SC 8 */
+ } else if (!validate_int(optarg, -1 /*len*/, &val)) {
fprintf(stderr, "Error 149: Invalid Structured Carrier Message version value (digits only)\n");
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
diff --git a/frontend/tests/test_args.c b/frontend/tests/test_args.c
index b967aba4..97797580 100644
--- a/frontend/tests/test_args.c
+++ b/frontend/tests/test_args.c
@@ -361,6 +361,8 @@ static void test_dump_args(const testCtx *const p_ctx) {
/* 46*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, -1, -1, NULL, -1, -1, 0, -1, "FE 8A FE\n80 28 02\nBE E8 FA\nA0 94 0A\nAE 3E EA\nAE D2 EA\nAE 74 EA\n00 AA 00\n15 B4 80\n0B 48 74\nA2 4A A4\nB5 56 2C\nA8 5A A8\n9F 18 50\n02 07 50\n00 A6 00\nFE 20 EA\n02 C2 EA\nFA C4 EA\n0A 42 0A\nEA 52 FA\nEA 24 02\nEA AA FE" },
/* 47*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, 3, -1, NULL, -1, -1, 0, -1, "FE 16 FE\n80 E2 02\nBE C2 FA\nA0 A0 0A\nAE F6 EA\nAE 98 EA\nAE BA EA\n00 E0 00\n15 83 80\n44 7E AE\n92 9C 78\n25 BF 08\n47 4B 8C\n0D F9 74\n03 E7 50\n00 3A 00\nFE C2 EA\n02 22 EA\nFA DA EA\n0A 22 0A\nEA B2 FA\nEA 9A 02\nEA E8 FE" },
/* 48*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, 4, -1, NULL, -1, -1, 0, -1, "FE 8A FE\n80 28 02\nBE E8 FA\nA0 94 0A\nAE 3E EA\nAE D2 EA\nAE 74 EA\n00 AA 00\n15 B4 80\n0B 48 74\nA2 4A A4\nB5 56 2C\nA8 5A A8\n9F 18 50\n02 07 50\n00 A6 00\nFE 20 EA\n02 C2 EA\nFA C4 EA\n0A 42 0A\nEA 52 FA\nEA 24 02\nEA AA FE" },
+ /* 49*/ { BARCODE_TELEPEN, "ABC\020123", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, NULL, -1, -1, 0, 1, "AB A8 BB B8 E3 B8 AE EA EE BA EA BA E2 22 BA B8 EA 2A" },
+ /* 50*/ { BARCODE_TELEPEN_NUM, "123\020ABC", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, -1, -1, -1, NULL, -1, -1, 0, 1, "AA E8 EA BA E2 22 EE BA BB B8 E3 B8 AE EA BA B8 E8 AA" },
};
int data_size = ARRAY_SIZE(data);
int i;
@@ -1362,6 +1364,57 @@ static void test_too_many_args(const testCtx *const p_ctx) {
testFinish();
}
+static void test_optional_args(const testCtx *const p_ctx) {
+ int debug = p_ctx->debug;
+
+ struct item {
+ int b;
+ const char *data;
+ const char *primary;
+ const char *opt;
+
+ const char *expected;
+ };
+ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
+ struct item data[] = {
+ /* 0*/ { BARCODE_DATAMATRIX, "123", NULL, " --dmb256", "AA A\n88 F\nD0 C\nC7 F\nAF A\nFF 3\nF5 4\nA1 B\nB5 0\nE1 D\nE9 A\nFF F" },
+ /* 1*/ { BARCODE_DATAMATRIX, "123", NULL, " --dmc40", "AA 8\n80 4\nC0 8\n81 C\nB7 0\nAB C\nE1 0\nE5 4\nBC 0\nFF C" },
+ /* 2*/ { BARCODE_EAN13, "123", NULL, " --scalexdimdp", "A3 46 8D 1A 34 6A B9 72 CD B2 15 0A" },
+ /* 3*/ { BARCODE_MAXICODE, "123", "1234567", " --scmvv", "D7 6F BF FC\n55 70 D8 08\nDB 12 A6 78\n55 55 55 50\n00 00 00 08\nAA AA AA A8\n55 55 55 54\n00 00 00 00\nAA AA AA AC\n55 B1 35 58\n00 90 08 0C\nAA C0 52 A8\n54 40 05 50\n01 00 08 00\nAA C0 0A AC\n55 00 01 58\n02 80 08 0C\nAB 80 1E A0\n54 00 05 5C\n03 80 0C 08\nA8 00 02 A4\n55 40 25 58\n00 60 40 08\nAA 60 66 A0\n55 55 5B FC\n00 00 02 30\nAA AA A1 E0\n5E CF C1 E8\nD0 62 E5 84\n20 1B 10 D8\nDB 8E B6 80\n21 96 26 C0\nC3 C9 89 F8" },
+ };
+ int data_size = ARRAY_SIZE(data);
+ int i;
+
+ char cmd[4096];
+ char buf[8192];
+
+ testStart("test_optional_args");
+
+ for (i = 0; i < data_size; i++) {
+
+ if (testContinue(p_ctx, i)) continue;
+
+ strcpy(cmd, "zint --dump");
+ if (debug & ZINT_DEBUG_PRINT) {
+ strcat(cmd, " --verbose");
+ }
+
+ arg_int(cmd, "-b ", data[i].b);
+ if (data[i].primary) {
+ arg_data(cmd, "--primary=", data[i].primary);
+ }
+ arg_data(cmd, "-d ", data[i].data);
+ strcat(cmd, data[i].opt);
+
+ strcat(cmd, " 2>&1");
+
+ assert_nonnull(exec(cmd, buf, sizeof(buf) - 1, debug, i, NULL), "i:%d exec(%s) NULL\n", i, cmd);
+ assert_zero(strcmp(buf, data[i].expected), "i:%d buf (%s) != expected (%s) (%s)\n", i, buf, data[i].expected, cmd);
+ }
+
+ testFinish();
+}
+
int main(int argc, char *argv[]) {
testFunction funcs[] = { /* name, func */
@@ -1378,6 +1431,7 @@ int main(int argc, char *argv[]) {
{ "test_exit_status", test_exit_status },
{ "test_bad_args", test_bad_args },
{ "test_too_many_args", test_too_many_args },
+ { "test_optional_args", test_optional_args },
};
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
diff --git a/frontend_qt/datawindow.cpp b/frontend_qt/datawindow.cpp
index 83d0e287..c61d711d 100644
--- a/frontend_qt/datawindow.cpp
+++ b/frontend_qt/datawindow.cpp
@@ -63,8 +63,8 @@ DataWindow::DataWindow(const QString &input, bool isEscaped, int seg_no) : Valid
QString out;
out.reserve(input.length());
QZINT_SIZETYPE lastPosn = 0;
- QRegularExpression escRE(QSL("\\\\(?:[0EabtnvfreGR\\\\]|d[0-9]{3}|o[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}"
- "|U[0-9A-Fa-f]{6})"));
+ QRegularExpression escRE(QSL("\\\\(?:[0EabtnvfrLeFGRN\\\\]|d[0-9]{3}|o[0-7]{3}|x[0-9A-Fa-f]{2}"
+ "|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{6})"));
QRegularExpressionMatchIterator matchI = escRE.globalMatch(input);
while (matchI.hasNext()) {
QRegularExpressionMatch match = matchI.next();
diff --git a/frontend_qt/frontend_qt.pro b/frontend_qt/frontend_qt.pro
index c3de0091..89ec34cc 100644
--- a/frontend_qt/frontend_qt.pro
+++ b/frontend_qt/frontend_qt.pro
@@ -57,6 +57,8 @@ FORMS += extCLI.ui \
grpPZN.ui \
grpQR.ui \
grpRMQR.ui \
+ grpTelepen.ui \
+ grpTelepenNum.ui \
grpUltra.ui \
grpUPCA.ui \
grpUPCEAN.ui \
diff --git a/frontend_qt/frontend_qt_zintdll.pro b/frontend_qt/frontend_qt_zintdll.pro
index 9dd4e1b3..6ed01d9f 100644
--- a/frontend_qt/frontend_qt_zintdll.pro
+++ b/frontend_qt/frontend_qt_zintdll.pro
@@ -49,6 +49,8 @@ FORMS += extCLI.ui \
grpPZN.ui \
grpQR.ui \
grpRMQR.ui \
+ grpTelepen.ui \
+ grpTelepenNum.ui \
grpUltra.ui \
grpUPCA.ui \
grpUPCEAN.ui \
diff --git a/frontend_qt/grpTelepen.ui b/frontend_qt/grpTelepen.ui
new file mode 100644
index 00000000..5dfeab1d
--- /dev/null
+++ b/frontend_qt/grpTelepen.ui
@@ -0,0 +1,80 @@
+
+
+ grpTelepen
+
+
+
+ 0
+ 0
+ 186
+ 123
+
+
+
+
+ 600
+ 16777215
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Enable &AIM Full ASCII + Compressed Numeric Mode
+
+
+ false
+
+
+ Use different Start/Stop characters that indicate
+the use of Full ASCII + Compressed Numeric Mode
+where DLE (ASCII 16, escape '\L') indicates switch
+to Compressed Numeric Mode
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Note: DLE only indicates switch to Compressed Numeric if AIM enabled.
+
+
+ Qt::PlainText
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+
+
+
+
+
+
diff --git a/frontend_qt/grpTelepenNum.ui b/frontend_qt/grpTelepenNum.ui
new file mode 100644
index 00000000..1d3cacf2
--- /dev/null
+++ b/frontend_qt/grpTelepenNum.ui
@@ -0,0 +1,78 @@
+
+
+ grpTelepenNum
+
+
+
+ 0
+ 0
+ 186
+ 123
+
+
+
+
+ 600
+ 16777215
+
+
+
+ Form
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+ -
+
+
+ Enable &AIM Compressed Numeric Mode (+ Full ASCII)
+
+
+ false
+
+
+ Use different Start/Stop characters that indicate
+the use of Compressed Numeric Mode (+ Full ASCII)
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Note: DLE (ASCII 16, escape '\L') may always be used to indicate switch to Full ASCII.
+
+
+ Qt::PlainText
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+
+
+
+
+
+
diff --git a/frontend_qt/mainWindow.ui b/frontend_qt/mainWindow.ui
index c2db5b4f..7dee2252 100644
--- a/frontend_qt/mainWindow.ui
+++ b/frontend_qt/mainWindow.ui
@@ -1558,9 +1558,12 @@ or import from file
<tr><td>\v </td><td>Vertical Tab (0x0B)</td></tr>
<tr><td>\f </td><td>Form Feed (0x0C)</td></tr>
<tr><td>\r </td><td>Carriage Return (0x0D)</td></tr>
+<tr><td>\L </td><td>Data Link Escape (0x10)</td></tr>
<tr><td>\e </td><td>Escape (0x1B)</td></tr>
+<tr><td>\F </td><td>File Separator (0x1C)</td></tr>
<tr><td>\G </td><td>Group Separator (0x1D)</td></tr>
<tr><td>\R </td><td>Record Separator (0x1E)</td></tr>
+<tr><td>\N </td><td>Unit Separator (0x1F)</td></tr>
<tr><td>\( </td><td>Opening parenthesis (0x28) ("GS1 ()" only) </td></tr>
<tr><td>\) </td><td>Closing parenthesis (0x29) ("GS1 ()" only) </td></tr>
<tr><td>\\ </td><td>Backslash (0x5C)</td></tr>
diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp
index d315a752..818633f4 100644
--- a/frontend_qt/mainwindow.cpp
+++ b/frontend_qt/mainwindow.cpp
@@ -2297,6 +2297,30 @@ void MainWindow::change_options()
connect(get_widget(QSL("chkPlesseyShowChecks")), SIGNAL(toggled(bool)), SLOT(update_preview()));
}
+ } else if (symbology == BARCODE_TELEPEN) {
+ QFile file(QSL(":/grpTelepen.ui"));
+ if (file.open(QIODevice::ReadOnly)) {
+ m_optionWidget = uiload.load(&file);
+ file.close();
+ load_sub_settings(settings, symbology);
+ vLayoutSpecific->addWidget(m_optionWidget);
+ set_smaller_font(QSL("noteTelepenDLE"));
+ grpSpecific->show();
+ connect(get_widget(QSL("chkTelepenAIM")), SIGNAL(toggled(bool)), SLOT(update_preview()));
+ }
+
+ } else if (symbology == BARCODE_TELEPEN_NUM) {
+ QFile file(QSL(":/grpTelepenNum.ui"));
+ if (file.open(QIODevice::ReadOnly)) {
+ m_optionWidget = uiload.load(&file);
+ file.close();
+ load_sub_settings(settings, symbology);
+ vLayoutSpecific->addWidget(m_optionWidget);
+ set_smaller_font(QSL("noteTelepenNumDLE"));
+ grpSpecific->show();
+ connect(get_widget(QSL("chkTelepenNumAIM")), SIGNAL(toggled(bool)), SLOT(update_preview()));
+ }
+
} else if (symbology == BARCODE_ULTRA) {
QFile file(QSL(":/grpUltra.ui"));
if (!file.open(QIODevice::ReadOnly))
@@ -3402,6 +3426,20 @@ void MainWindow::update_preview()
}
break;
+ case BARCODE_TELEPEN:
+ m_bc.bc.setSymbol(BARCODE_TELEPEN);
+ if (get_chk_val(QSL("chkTelepenAIM"))) {
+ m_bc.bc.setOption2(1);
+ }
+ break;
+
+ case BARCODE_TELEPEN_NUM:
+ m_bc.bc.setSymbol(BARCODE_TELEPEN_NUM);
+ if (get_chk_val(QSL("chkTelepenNumAIM"))) {
+ m_bc.bc.setOption2(1);
+ }
+ break;
+
case BARCODE_ULTRA:
m_bc.bc.setSymbol(BARCODE_ULTRA);
if (get_rad_val(QSL("radUltraEcc")))
@@ -4697,6 +4735,14 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
settings.setValue(QSL("studio/bc/plessey/chk_show_checks"), get_chk_val(QSL("chkPlesseyShowChecks")));
break;
+ case BARCODE_TELEPEN:
+ settings.setValue(QSL("studio/bc/telepen/chk_aim"), get_chk_val(QSL("chkTelepenAIM")));
+ break;
+
+ case BARCODE_TELEPEN_NUM:
+ settings.setValue(QSL("studio/bc/telepen_num/chk_aim"), get_chk_val(QSL("chkTelepenNumAIM")));
+ break;
+
case BARCODE_ULTRA:
settings.setValue(QSL("studio/bc/ultra/autoresizing"), get_rad_grp_index(
QStringList() << QSL("radUltraAuto") << QSL("radUltraEcc")));
@@ -5176,6 +5222,14 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
set_chk_from_setting(settings, QSL("studio/bc/plessey/chk_show_checks"), QSL("chkPlesseyShowChecks"));
break;
+ case BARCODE_TELEPEN:
+ set_chk_from_setting(settings, QSL("studio/bc/telepen/chk_aim"), QSL("chkTelepenAIM"));
+ break;
+
+ case BARCODE_TELEPEN_NUM:
+ set_chk_from_setting(settings, QSL("studio/bc/telepen_num/chk_aim"), QSL("chkTelepenNumAIM"));
+ break;
+
case BARCODE_ULTRA:
set_rad_from_setting(settings, QSL("studio/bc/ultra/autoresizing"),
QStringList() << QSL("radUltraAuto") << QSL("radUltraEcc"));
diff --git a/frontend_qt/resources.qrc b/frontend_qt/resources.qrc
index 0cddabc5..f4a493fb 100644
--- a/frontend_qt/resources.qrc
+++ b/frontend_qt/resources.qrc
@@ -31,6 +31,8 @@
grpPZN.ui
grpQR.ui
grpRMQR.ui
+ grpTelepen.ui
+ grpTelepenNum.ui
grpUltra.ui
grpUPCA.ui
grpUPCEAN.ui