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

DATAMATRIX: add manual FNC1 support

CODE128: error on unrecognized extra escape sequences instead of
  just passing them thru;
  fix possible shifting before manual FNC1 in 2nd position
  after single alpha (otherwise won't be recognized as AIM)
  fix not removing manual FNC1 in 1st/2nd position from content
  segs (as implied by symbology identifier)
CLI: warn if both "--dmre" and "--square" given (as "--square"
  overwrites "--dmre")
common: new routines `z_isalpha()`, `z_extra_escapes()` and
  `z_ct_set_seg_extra_escapes_eci()`
library: new helper `supports_extra_escape_mode()`;
  fix some error_number dups
BWIPP: update to latest, and allow for removal of DBAR_LTD_CC RHS
  quiet zones & extra row when have add-on in EAN/UPC composites
test suite: fix BWIPP escaping
manual/man/tcl: update for DATAMATRIX manual FNC1 support
Windows: resource scripts: make more consistent (libzint, CLI, GUI)
win32/README: update with MSVC 2026
This commit is contained in:
gitlost
2026-04-18 22:55:52 +01:00
parent f9a493522f
commit 7b076717f2
30 changed files with 1650 additions and 869 deletions
+9 -4
View File
@@ -1,16 +1,18 @@
Version 2.16.0.9 (dev) not released yet (2026-03-30)
Version 2.16.0.9 (dev) not released yet (2026-04-18)
====================================================
**Incompatible changes**
------------------------
- Code 128 now errors on unrecognized 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)
- Improved Aztec encodation algorithm (may cause symbol size change)
- New Qt Backend method `save_as_memfile()` to save file to memory
- New Qt Backend methods `gs1Raw()` and `setGS1Raw()` for new `GS1RAW_MODE`
option for processing GS1 input
- CLI now warns if both "--dmre" and "--square" are given (previously silently
ignored "--dmre")
- CLI now warns if both "--dmre" and "--square" are given
(previously silently ignored "--dmre")
Changes
-------
@@ -32,11 +34,14 @@ Changes
- 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
- DATAMATRIX: add manual FNC1 support
Bugs
----
- CODE128: fix not handling FNC1 at end of data when in manual switching mode
or any FNC1 after manual C mode selected and no other non-C data
or any FNC1 after manual C mode selected and no other non-C data;
fix possible shifting before manual FNC1 in 2nd position after single alpha;
fix not removing manual FNC1 in 1st/2nd position from content segs
- CLI: fix "--scalexdimdp" X-dim inch units being divided instead of multiplied
on conversion to mm
- DOTCODE: fix not emitting FNC1 (signalling not GS1) if input is just 2 digits
+1 -1
View File
@@ -1,5 +1,5 @@
# Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu >
# Copyright (C) 2009-2025 Robin Stuart <rstuart114@gmail.com>
# Copyright (C) 2009-2026 Robin Stuart <rstuart114@gmail.com>
# vim: set ts=4 sw=4 et :
cmake_minimum_required(VERSION 3.10)
+68 -30
View File
@@ -226,7 +226,7 @@ static int c128_cost(const unsigned char source[], const int length, const int i
https://github.com/bwipp/postscriptbarcode/pull/278 */
static int c128_set_values(const unsigned char source[], const int length, const int start_idx,
const char priority[C128_STATES], const char fncs[C128_MAX], const char manuals[C128_MAX],
int values[C128_VALUES_MAX], int *p_final_cset) {
int values[C128_VALUES_MAX], int *p_first_cset, int *p_final_cset) {
short (*costs)[C128_STATES] = (short (*)[C128_STATES]) z_alloca(sizeof(*costs) * length);
char (*modes)[C128_STATES] = (char (*)[C128_STATES]) z_alloca(sizeof(*modes) * length);
@@ -243,6 +243,18 @@ static int c128_set_values(const unsigned char source[], const int length, const
return costs[0][0];
}
if (p_first_cset) {
*p_first_cset = modes[0][0];
}
/* Make sure FNC1 in 2nd position after single alpha does not switch modes before FNC1 */
if (length > 1 && !fncs[0] && fncs[1] && z_isalpha(source[0])) {
const int mode = modes[0][0];
if (mode == (mode & 0x0F) && mode != modes[1][mode]) {
modes[1][mode] = mode;
}
}
/* Output codewords into `values` */
for (i = 0; i < length; i++) {
const unsigned char ch = source[i];
@@ -377,6 +389,7 @@ INTERNAL int zint_code128(struct zint_symbol *symbol, unsigned char source[], in
char priority[C128_STATES];
int values[C128_VALUES_MAX] = {0};
int glyph_count;
int first_cset;
unsigned char src_buf[C128_MAX + 1];
unsigned char *src = source;
const int ab_only = symbol->symbology == BARCODE_CODE128AB;
@@ -397,23 +410,27 @@ INTERNAL int zint_code128(struct zint_symbol *symbol, unsigned char source[], in
char manual = 0;
int j = 0;
for (i = 0; i < length; i++) {
if (source[i] == '\\' && i + 2 < length && source[i + 1] == '^'
&& ((source[i + 2] >= '@' && source[i + 2] <= 'C') || source[i + 2] == '1'
|| source[i + 2] == '^')) {
if (source[i + 2] == '^') { /* Escape sequence '\^^' */
manuals[j] = manual;
src_buf[j++] = source[i++];
manuals[j] = manual;
src_buf[j++] = source[i++];
/* Drop second '^' */
} else if (source[i + 2] == '1') { /* FNC1 */
i += 2;
fncs[j] = have_fnc1 = 1;
manuals[j] = manual;
src_buf[j++] = '\x1D'; /* Manual FNC1 dummy */
} else { /* Manual mode A/B/C/@ */
i += 2;
manual = source[i] == 'C' ? C128_C0 : source[i] - '@'; /* Assuming A0 = 1, B0 = 2 */
if (source[i] == '\\' && i + 2 < length && source[i + 1] == '^') {
const unsigned char ch = source[i + 2];
if ((ch >= '@' && ch <= 'C') || ch == '1' || ch == '^') {
if (ch == '^') { /* Escape sequence '\^^' */
manuals[j] = manual;
src_buf[j++] = source[i++];
manuals[j] = manual;
src_buf[j++] = source[i++];
/* Drop second '^' */
} else if (ch == '1') { /* FNC1 */
i += 2;
fncs[j] = have_fnc1 = 1;
manuals[j] = manual;
src_buf[j++] = '\x1D'; /* Manual FNC1 dummy */
} else { /* Manual mode A/B/C/@ */
i += 2;
manual = ch == 'C' ? C128_C0 : ch - '@'; /* Assuming A0 = 1, B0 = 2 */
}
} else {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 348, "Unrecognized extra escape \"\\^%c\"",
!z_isascii(ch) || z_iscntrl(ch) ? '?' : ch);
}
} else {
manuals[j] = manual;
@@ -468,7 +485,8 @@ INTERNAL int zint_code128(struct zint_symbol *symbol, unsigned char source[], in
}
c128_set_priority(priority, have_a, have_b, have_c, have_extended);
glyph_count = c128_set_values(src, length, start_idx, priority, fncs, manuals, values, NULL /*p_final_cset*/);
glyph_count = c128_set_values(src, length, start_idx, priority, fncs, manuals, values, &first_cset,
NULL /*p_final_cset*/);
if (symbol->debug & ZINT_DEBUG_PRINT) {
printf("Data (%d): %.*s", length, length >= 100 ? 1 : length >= 10 ? 2 : 3, " ");
@@ -487,6 +505,36 @@ INTERNAL int zint_code128(struct zint_symbol *symbol, unsigned char source[], in
/* ISO/IEC 15417:2007 leaves dimensions/height as application specification */
/* Do content segs before HRT to deal with manual FNC1s in 1st position & 2nd position */
if (content_segs) {
if (have_fnc1) {
int mv_idx = 0;
assert(length > 0);
/* Remove manual FNC1 in 1st position */
if (fncs[0]) {
mv_idx = 1;
/* Remove manual FNC1 in 2nd position, alphabetic */
} else if (length > 1 && fncs[1] && z_isalpha(src[0])) {
mv_idx = 2;
/* Remove manual FNC1 in 2nd position, 2 digits */
} else if (first_cset == C128_C0 && length > 2 && fncs[2] && z_isdigit(src[0]) && z_isdigit(src[1])) {
mv_idx = 3;
}
if (mv_idx) {
memmove(src + (mv_idx - 1), src + mv_idx, length - mv_idx);
memmove(fncs + (mv_idx - 1), fncs + mv_idx, length - mv_idx);
length--;
}
}
if ((symbol->input_mode & 0x07) == DATA_MODE) {
if (z_ct_cpy(symbol, src, length)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy()` only fails with OOM */
}
} else if (z_ct_cpy_iso8859_1(symbol, src, length)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy_iso8859_1()` only fails with OOM */
}
}
/* HRT */
if (have_fnc1) {
/* Remove any manual FNC1 dummies ('\x1D') */
@@ -500,16 +548,6 @@ INTERNAL int zint_code128(struct zint_symbol *symbol, unsigned char source[], in
}
error_number = z_hrt_cpy_iso8859_1(symbol, src, length); /* Returns warning only */
if (content_segs) {
if ((symbol->input_mode & 0x07) == DATA_MODE) {
if (z_ct_cpy(symbol, src, length)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy()` only fails with OOM */
}
} else if (z_ct_cpy_iso8859_1(symbol, src, length)) {
return ZINT_ERROR_MEMORY; /* `z_ct_cpy_iso8859_1()` only fails with OOM */
}
}
return error_number;
}
@@ -553,7 +591,7 @@ INTERNAL int zint_gs1_128_cc(struct zint_symbol *symbol, unsigned char source[],
c128_set_priority(priority, 0 /*have_a*/, 1 /*have_b*/, 1 /*have_c*/, 0 /*have_extended*/);
glyph_count = c128_set_values(reduced, reduced_length, 1 /*start_idx*/, priority, fncs, manuals, values,
&final_cset);
NULL /*p_first_cset*/, &final_cset);
if (symbol->debug & ZINT_DEBUG_PRINT) {
printf("Data (%d): %.*s", reduced_length, reduced_length >= 100 ? 1 : reduced_length >= 10 ? 2 : 3, " ");
+79 -2
View File
@@ -776,6 +776,41 @@ INTERNAL int z_utf8_to_unicode(struct zint_symbol *symbol, const unsigned char s
return 0;
}
/* Process `source` for manual FNC1 extra escape sequences, placing result in `dest` with result length in `p_len`,
and setting `fncs` with found FNC1s. `dest` & `fncs` must be at least `length` in size. `eci` is checked to be
ASCII-compatible (UTF-8 & single-byte ECIs, excl. Binary 899). On error sets `errtxt` & returns error no. */
INTERNAL int z_extra_escapes(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int eci, unsigned char dest[], char *fncs, int *p_len) {
int i, j = 0;
if (eci == 20 || eci == 25 || eci >= 28) {
return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 716, "Extra escape mode requires ASCII-compatible ECI");
}
for (i = 0; i < length; i++) {
if (source[i] == '\\' && i + 2 < length && source[i + 1] == '^') {
const unsigned char ch = source[i + 2];
if (ch == '1' || ch == '^') {
if (ch == '^') { /* Escape sequence '\^^' */
dest[j++] = source[i++];
dest[j++] = source[i++];
/* Drop second '^' */
} else { /* ch == '1' FNC1 */
i += 2;
fncs[j] = 1;
dest[j++] = '\x1D'; /* Manual FNC1 dummy */
}
} else {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 717, "Unrecognized extra escape \"\\^%c\"",
!z_isascii(ch) || z_iscntrl(ch) ? '?' : ch);
}
} else {
dest[j++] = source[i];
}
}
*p_len = j;
return 0;
}
/* Treats source as ISO/IEC 8859-1 and copies into `symbol->text`, converting to UTF-8. Control chars (incl. DEL) and
non-ISO/IEC 8859-1 (0x80-9F) are replaced with spaces. Returns warning if truncated, else 0 */
INTERNAL int z_hrt_cpy_iso8859_1(struct zint_symbol *symbol, const unsigned char source[], const int length) {
@@ -988,10 +1023,52 @@ INTERNAL int z_ct_cpy_segs(struct zint_symbol *symbol, const struct zint_seg seg
return 0;
}
/* Update the ECI of content seg `seg_idx` to `eci`, to reflect (feedback) the actual ECI used */
INTERNAL void z_ct_set_seg_eci(struct zint_symbol *symbol, const int seg_idx, const int eci) {
/* Process content seg `seg_idx` buffer for manual FNC1 extra escape sequences (which must exist),
and update its ECI to `eci`, if set, to reflect (feedback) the actual ECI used */
INTERNAL void z_ct_set_seg_extra_escapes_eci(struct zint_symbol *symbol, const int seg_idx, const int eci) {
int i, j = 0;
unsigned char *source;
int length;
const int no_fnc1_position_check = seg_idx != 0 || eci != 0;
assert(symbol->content_segs);
assert(seg_idx >= 0 && seg_idx < symbol->content_seg_count);
assert(symbol->content_segs[seg_idx].source);
source = symbol->content_segs[seg_idx].source;
length = symbol->content_segs[seg_idx].length;
for (i = 0; i < length; i++) {
if (source[i] == '\\' && i + 2 < length && source[i + 1] == '^'
&& (source[i + 2] == '1' || source[i + 2] == '^')) {
if (source[i + 2] == '^') { /* Escape sequence '\^^' */
source[j++] = source[i++];
source[j++] = source[i++];
/* Drop second '^' */
} else { /* source[i + 2] == '1' FNC1 */
/* Do not emit <GS> if FNC1 in 1st/2nd position */
if (no_fnc1_position_check || j > 2 || (j == 1 && !z_isalpha(source[0]))
|| (j == 2 && (!z_isdigit(source[0]) || !z_isdigit(source[1]))) ) {
source[j++] = '\x1D'; /* GS */
}
i += 2;
}
} else {
source[j++] = source[i];
}
}
assert(j > 0 && j < length);
symbol->content_segs[seg_idx].length = j;
if (eci) {
symbol->content_segs[seg_idx].eci = eci;
}
}
/* Update the ECI of content seg `seg_idx` to `eci`, to reflect (feedback) the actual ECI used */
INTERNAL void z_ct_set_seg_eci(struct zint_symbol *symbol, const int seg_idx, const int eci) {
assert(seg_idx >= 0 && seg_idx < symbol->content_seg_count);
assert(eci);
assert(symbol->content_segs);
symbol->content_segs[seg_idx].eci = eci;
}
+12
View File
@@ -140,6 +140,7 @@ typedef unsigned __int64 uint64_t;
#define z_isdigit(ch) ((ch) <= '9' && (ch) >= '0')
#define z_isupper(ch) ((ch) >= 'A' && (ch) <= 'Z')
#define z_islower(ch) ((ch) >= 'a' && (ch) <= 'z')
#define z_isalpha(ch) (z_isupper(ch) || z_islower(ch))
#define z_isascii(ch) (!((ch) & ~0x7F))
#define z_iscntrl(ch) (!((ch) & ~0x1F) || (ch) == 127)
@@ -307,6 +308,13 @@ INTERNAL int z_utf8_to_unicode(struct zint_symbol *symbol, const unsigned char s
int *length, const int disallow_4byte);
/* Process `source` for manual FNC1 extra escape sequences, placing result in `dest` with result length in `p_len`,
and setting `fncs` with found FNC1s. `dest` & `fncs` must be at least `length` in size. `eci` is checked to be
ASCII-compatible (UTF-8 & single-byte ECIs, excl. Binary 899). On error sets `errtxt` & returns error no. */
INTERNAL int z_extra_escapes(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int eci, unsigned char dest[], char *fncs, int *p_len);
/* Treats source as ISO/IEC 8859-1 and copies into `symbol->text`, converting to UTF-8. Control chars (incl. DEL) and
non-ISO/IEC 8859-1 (0x80-9F) are replaced with spaces. Returns warning if truncated, else 0 */
INTERNAL int z_hrt_cpy_iso8859_1(struct zint_symbol *symbol, const unsigned char source[], const int length);
@@ -346,6 +354,10 @@ INTERNAL void z_ct_free_segs(struct zint_symbol *symbol);
If seg eci not set, content seg eci set to 3. On error sets `errxtxt`, returning BARCODE_ERROR_MEMORY */
INTERNAL int z_ct_cpy_segs(struct zint_symbol *symbol, const struct zint_seg segs[], const int seg_count);
/* Process content seg `seg_idx` buffer for manual FNC1 extra escape sequences (which must exist),
and update its ECI to `eci`, if set, to reflect (feedback) the actual ECI used */
INTERNAL void z_ct_set_seg_extra_escapes_eci(struct zint_symbol *symbol, const int seg_idx, const int eci);
/* Update the ECI of content seg `seg_idx` to `eci`, to reflect (feedback) the actual ECI used */
INTERNAL void z_ct_set_seg_eci(struct zint_symbol *symbol, const int seg_idx, const int eci);
+100 -82
View File
@@ -282,7 +282,7 @@ static int dm_text_sp_cnt(const unsigned char source[], const int position, cons
/* 'look ahead test' from Annex J */
static int dm_look_ahead_test(const unsigned char source[], const int length, const int position,
const int current_mode, const int mode_arg, const int gs1, const int debug_print) {
const int current_mode, const int mode_arg, const char *fncs, const int debug_print) {
int ascii_count, c40_count, text_count, x12_count, edf_count, b256_count;
int ascii_rnded, c40_rnded, text_rnded, x12_rnded, edf_rnded, b256_rnded;
int cnt_1;
@@ -316,11 +316,11 @@ static int dm_look_ahead_test(const unsigned char source[], const int length, co
}
for (sp = position; sp < length; sp++) {
const unsigned char c = source[sp];
const int is_extended = c & 0x80;
const unsigned char ch = source[sp];
const int is_extended = ch & 0x80;
/* ASCII ... step (l) */
if (z_isdigit(c)) {
if (z_isdigit(ch)) {
ascii_count += DM_MULT_1_DIV_2; /* (l)(1) */
} else {
if (is_extended) {
@@ -331,7 +331,7 @@ static int dm_look_ahead_test(const unsigned char source[], const int length, co
}
/* C40 ... step (m) */
if (dm_isc40(c)) {
if (dm_isc40(ch)) {
c40_count += DM_MULT_2_DIV_3; /* (m)(1) */
} else {
if (is_extended) {
@@ -342,7 +342,7 @@ static int dm_look_ahead_test(const unsigned char source[], const int length, co
}
/* TEXT ... step (n) */
if (dm_istext(c)) {
if (dm_istext(ch)) {
text_count += DM_MULT_2_DIV_3; /* (n)(1) */
} else {
if (is_extended) {
@@ -353,7 +353,7 @@ static int dm_look_ahead_test(const unsigned char source[], const int length, co
}
/* X12 ... step (o) */
if (dm_isX12(c)) {
if (dm_isX12(ch)) {
x12_count += DM_MULT_2_DIV_3; /* (o)(1) */
} else {
if (is_extended) {
@@ -364,7 +364,7 @@ static int dm_look_ahead_test(const unsigned char source[], const int length, co
}
/* EDIFACT ... step (p) */
if (dm_isedifact(c)) {
if (dm_isedifact(ch)) {
edf_count += DM_MULT_3_DIV_4; /* (p)(1) */
} else {
if (is_extended) {
@@ -375,7 +375,7 @@ static int dm_look_ahead_test(const unsigned char source[], const int length, co
}
/* Base 256 ... step (q) */
if (gs1 == 1 && c == '\x1D') {
if (fncs[sp] && ch == '\x1D') {
/* FNC1 separator */
b256_count += DM_MULT_4; /* (q)(1) */
} else {
@@ -615,10 +615,10 @@ static int dm_codewords_remaining(struct zint_symbol *symbol, const int tp, cons
}
/* Number of C40/TEXT elements needed to encode `input` */
static int dm_c40text_cnt(const int current_mode, const int gs1, unsigned char input) {
static int dm_c40text_cnt(const int current_mode, const char fnc, unsigned char input) {
int cnt;
if (gs1 && input == '\x1D') {
if (fnc && input == '\x1D') {
return 2;
}
cnt = 1;
@@ -933,7 +933,7 @@ static void dm_addEdge(struct zint_symbol *symbol, const unsigned char *source,
/* Add edges for the various modes at a vertex */
static void dm_addEdges(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int last_seg, struct dm_edge *edges, const int from, struct dm_edge *previous, const int gs1) {
const int last_seg, struct dm_edge *edges, const int from, struct dm_edge *previous, const char *fncs) {
int i, pos;
assert(from < length); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
@@ -965,7 +965,7 @@ static void dm_addEdges(struct zint_symbol *symbol, const unsigned char source[]
dm_addEdge(symbol, source, length, last_seg, edges, DM_X12, from, 3, previous, 0);
}
if (gs1 != 1 || source[from] != '\x1D') {
if (!fncs[from] || source[from] != '\x1D') {
dm_addEdge(symbol, source, length, last_seg, edges, DM_BASE256, from, 1, previous, 0);
}
}
@@ -981,7 +981,7 @@ static void dm_addEdges(struct zint_symbol *symbol, const unsigned char source[]
/* Calculate optimized encoding modes */
static int dm_define_modes(struct zint_symbol *symbol, char modes[], const unsigned char source[], const int length,
const int last_seg, const int gs1, const int debug_print) {
const int last_seg, const char *fncs, const int debug_print) {
int i, j, v_i;
int minimalJ, minimalSize;
@@ -995,7 +995,7 @@ static int dm_define_modes(struct zint_symbol *symbol, char modes[], const unsig
}
assert((length + 1) * DM_NUM_MODES < USHRT_MAX); /* Guaranteed by input length limit */
dm_addEdges(symbol, source, length, last_seg, edges, 0, NULL, gs1);
dm_addEdges(symbol, source, length, last_seg, edges, 0, NULL, fncs);
DM_TRACE_Edges("DEBUG Initial situation\n", source, length, edges, 0);
@@ -1003,7 +1003,7 @@ static int dm_define_modes(struct zint_symbol *symbol, char modes[], const unsig
v_i = i * DM_NUM_MODES;
for (j = 0; j < DM_NUM_MODES; j++) {
if (edges[v_i + j].mode) {
dm_addEdges(symbol, source, length, last_seg, edges, i, edges + v_i + j, gs1);
dm_addEdges(symbol, source, length, last_seg, edges, i, edges + v_i + j, fncs);
}
}
DM_TRACE_Edges("DEBUG situation after adding edges to vertices at position %d\n", source, length, edges, i);
@@ -1060,7 +1060,7 @@ static int dm_define_modes(struct zint_symbol *symbol, char modes[], const unsig
/* Do default minimal encodation */
static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int last_seg, int *p_sp, unsigned char target[], int *p_tp, int process_buffer[8], int *p_process_p,
int *p_b256_start, int *p_current_mode, const int gs1, const int debug_print) {
int *p_b256_start, int *p_current_mode, const char *fncs, const int debug_print) {
int sp = *p_sp;
int tp = *p_tp;
int process_p = *p_process_p;
@@ -1070,7 +1070,7 @@ static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[
assert(length <= 10921); /* Can only handle (10921 + 1) * 6 = 65532 < 65536 (2*16) due to sizeof(previous) */
if (!dm_define_modes(symbol, modes, source, length, last_seg, gs1, debug_print)) {
if (!dm_define_modes(symbol, modes, source, length, last_seg, fncs, debug_print)) {
return z_errtxt(ZINT_ERROR_MEMORY, symbol, 728, "Insufficient memory for mode buffers");
}
@@ -1129,14 +1129,9 @@ static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[
target[tp++] = (source[sp] - 128) + 1;
if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1);
} else {
if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) {
target[tp++] = 29 + 1; /* GS */
if (debug_print) fputs("GS ", stdout);
} else {
target[tp++] = 232; /* FNC1 */
if (debug_print) fputs("FN1 ", stdout);
}
if (fncs[sp] && source[sp] == '\x1D') {
target[tp++] = 232; /* FNC1 */
if (debug_print) fputs("FN1 ", stdout);
} else {
target[tp++] = source[sp] + 1;
if (debug_print) printf("A%02X ", target[tp - 1] - 1);
@@ -1164,14 +1159,9 @@ static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[
shift_set = ct_shift[source[sp] - 128];
value = ct_value[source[sp] - 128];
} else {
if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) {
shift_set = ct_shift[29];
value = ct_value[29]; /* GS */
} else {
shift_set = 2;
value = 27; /* FNC1 */
}
if (fncs[sp] && source[sp] == '\x1D') {
shift_set = 2;
value = 27; /* FNC1 */
} else {
shift_set = ct_shift[source[sp]];
value = ct_value[source[sp]];
@@ -1247,7 +1237,7 @@ static int dm_minimalenc(struct zint_symbol *symbol, const unsigned char source[
/* Encode using algorithm based on ISO/IEC 21471:2020 Annex J (was ISO/IEC 21471:2006 Annex P) */
static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], const int length, int *p_sp,
unsigned char target[], int *p_tp, int process_buffer[8], int *p_process_p, int *p_b256_start,
int *p_current_mode, const int gs1, const int b256_end, const int c40_end, const int debug_print) {
int *p_current_mode, const char *fncs, const int b256_end, const int c40_end, const int debug_print) {
int sp = *p_sp;
int tp = *p_tp;
int process_p = *p_process_p;
@@ -1284,7 +1274,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
if (debug_print) printf("N%02d ", target[tp - 1] - 130);
sp += 2;
} else {
next_mode = dm_look_ahead_test(source, length, sp, current_mode, 0, gs1, debug_print);
next_mode = dm_look_ahead_test(source, length, sp, current_mode, 0, fncs, debug_print);
if (next_mode != DM_ASCII) {
tp = dm_switch_mode(next_mode, target, tp, p_b256_start, debug_print);
@@ -1295,14 +1285,9 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
target[tp++] = (source[sp] - 128) + 1;
if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1);
} else {
if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) {
target[tp++] = 29 + 1; /* GS */
if (debug_print) fputs("GS ", stdout);
} else {
target[tp++] = 232; /* FNC1 */
if (debug_print) fputs("FN1 ", stdout);
}
if (fncs[sp] && source[sp] == '\x1D') {
target[tp++] = 232; /* FNC1 */
if (debug_print) fputs("FN1 ", stdout);
} else {
target[tp++] = source[sp] + 1;
if (debug_print) printf("A%02X ", target[tp - 1] - 1);
@@ -1317,7 +1302,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
next_mode = current_mode;
if (process_p == 0 && not_first && (sp >= c40_end)) { /* `c40_end` only set if `current_mode` DM_C40 */
next_mode = dm_look_ahead_test(source, length, sp, current_mode, process_p, gs1, debug_print);
next_mode = dm_look_ahead_test(source, length, sp, current_mode, process_p, fncs, debug_print);
}
if (next_mode != current_mode) {
@@ -1342,14 +1327,9 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
shift_set = ct_shift[source[sp] - 128];
value = ct_value[source[sp] - 128];
} else {
if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) {
shift_set = ct_shift[29];
value = ct_value[29]; /* GS */
} else {
shift_set = 2;
value = 27; /* FNC1 */
}
if (fncs[sp] && source[sp] == '\x1D') {
shift_set = 2;
value = 27; /* FNC1 */
} else {
shift_set = ct_shift[source[sp]];
value = ct_value[source[sp]];
@@ -1376,7 +1356,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
} else {
next_mode = DM_X12;
if (process_p == 0 && not_first) {
next_mode = dm_look_ahead_test(source, length, sp, current_mode, process_p, gs1, debug_print);
next_mode = dm_look_ahead_test(source, length, sp, current_mode, process_p, fncs, debug_print);
}
}
@@ -1417,7 +1397,7 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
if (process_p == 3) {
/* Note different than spec Step (f)(2), which suggests checking when 0, but this seems to
work better in many cases as the switch to ASCII is "free" */
next_mode = dm_look_ahead_test(source, length, sp, current_mode, process_p, gs1, debug_print);
next_mode = dm_look_ahead_test(source, length, sp, current_mode, process_p, fncs, debug_print);
}
}
@@ -1446,12 +1426,12 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
/* step (g) Base 256 encodation */
} else if (current_mode == DM_BASE256) {
if (gs1 == 1 && source[sp] == '\x1D') {
if (fncs[sp] && source[sp] == '\x1D') {
next_mode = DM_ASCII;
} else {
next_mode = DM_BASE256;
if (not_first && sp >= b256_end) {
next_mode = dm_look_ahead_test(source, length, sp, current_mode, tp - (*p_b256_start + 1), gs1,
next_mode = dm_look_ahead_test(source, length, sp, current_mode, tp - (*p_b256_start + 1), fncs,
debug_print);
}
}
@@ -1490,8 +1470,8 @@ static int dm_isoenc(struct zint_symbol *symbol, const unsigned char source[], c
/* Encodes data using ASCII, C40, Text, X12, EDIFACT or Base 256 modes as appropriate
Supports encoding FNC1 in supporting systems */
static int dm_encode(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int eci, const int last_seg, const int gs1, const int b256_end, const int c40_end,
static int dm_encode(struct zint_symbol *symbol, const unsigned char source[], int length,
const int eci, const int last_seg, const char *fncs, const int b256_end, const int c40_end,
unsigned char target[], int *p_tp) {
int sp = 0;
int tp = *p_tp;
@@ -1520,13 +1500,14 @@ static int dm_encode(struct zint_symbol *symbol, const unsigned char source[], c
if (debug_print) printf("ECI %d ", eci + 1);
}
/* If FAST_MODE or MAILMARK_2D, do Annex J-based encodation */
if ((symbol->input_mode & FAST_MODE) || b256_end || c40_end) {
error_number = dm_isoenc(symbol, source, length, &sp, target, &tp, process_buffer, &process_p,
&b256_start, &current_mode, gs1, b256_end, c40_end, debug_print);
&b256_start, &current_mode, fncs, b256_end, c40_end, debug_print);
} else { /* Do default minimal encodation */
error_number = dm_minimalenc(symbol, source, length, last_seg, &sp, target, &tp, process_buffer, &process_p,
&b256_start, &current_mode, gs1, debug_print);
&b256_start, &current_mode, fncs, debug_print);
}
if (error_number) {
assert(error_number >= ZINT_ERROR);
@@ -1571,7 +1552,7 @@ static int dm_encode(struct zint_symbol *symbol, const unsigned char source[], c
/* Backtrack to last complete triplet (same technique as BWIPP) */
while (sp > 0 && process_p % 3) {
sp--;
cnt = dm_c40text_cnt(current_mode, gs1, source[sp]);
cnt = dm_c40text_cnt(current_mode, fncs[sp], source[sp]);
total_cnt += cnt;
process_p -= cnt;
}
@@ -1588,14 +1569,9 @@ static int dm_encode(struct zint_symbol *symbol, const unsigned char source[], c
target[tp++] = 235; /* FNC4 */
target[tp++] = (source[sp] - 128) + 1;
if (debug_print) printf("FN4 A%02X ", target[tp - 1] - 1);
} else if (gs1 && source[sp] == '\x1D') {
if (gs1 == 2) {
target[tp++] = 29 + 1; /* GS */
if (debug_print) fputs("GS ", stdout);
} else {
target[tp++] = 232; /* FNC1 */
if (debug_print) fputs("FN1 ", stdout);
}
} else if (fncs[sp] && source[sp] == '\x1D') {
target[tp++] = 232; /* FNC1 */
if (debug_print) fputs("FN1 ", stdout);
} else {
target[tp++] = source[sp] + 1;
if (debug_print) printf("A%02X ", target[tp - 1] - 1);
@@ -1670,10 +1646,10 @@ static int dm_encode(struct zint_symbol *symbol, const unsigned char source[], c
}
#ifdef ZINT_TEST /* Wrapper for direct testing */
INTERNAL int zint_test_dm_encode(struct zint_symbol *symbol, const unsigned char source[], const int length,
const int eci, const int last_seg, const int gs1, const int b256_end, const int c40_end,
INTERNAL int zint_test_dm_encode(struct zint_symbol *symbol, const unsigned char source[], int length,
const int eci, const int last_seg, const char *fncs, const int b256_end, const int c40_end,
unsigned char target[], int *p_tp) {
return dm_encode(symbol, source, length, eci, last_seg, gs1, b256_end, c40_end, target, p_tp);
return dm_encode(symbol, source, length, eci, last_seg, fncs, b256_end, c40_end, target, p_tp);
}
#endif
@@ -1685,10 +1661,12 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
int i;
int tp = 0;
int in_macro = 0;
int have_extra_escapes = 0;
int tot_length = 0, b256_have_fnc1 = 0;
const struct zint_seg *last_seg = &segs[seg_count - 1];
/* gs1 flag values: 0: no GS1, 1: GS1 with FNC1 serparator, 2: GS separator */
const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE ? 1 + !!(symbol->output_options & GS1_GS_SEPARATOR) : 0;
const int extra_escape_mode = symbol->input_mode & EXTRA_ESCAPE_MODE;
const int mailmark = symbol->symbology == BARCODE_MAILMARK_2D;
const int have_c40 = (symbol->option_3 & DM_C40_START) && symbol->option_1 >= 0;
const int have_b256 = (symbol->option_3 & DM_B256_START) && symbol->option_1 >= 0;
@@ -1757,6 +1735,14 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
target[tp++] = id2;
}
if (extra_escape_mode && (symbol->symbology != BARCODE_DATAMATRIX || gs1)) {
if (symbol->symbology != BARCODE_DATAMATRIX) {
return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 843,
"Can only use extra escape mode with non-variant Data Matrix");
}
return z_errtxt(ZINT_ERROR_INVALID_OPTION, symbol, 844, "Cannot use extra escape mode in GS1 mode");
}
if (gs1) {
target[tp++] = 232;
if (debug_print) fputs("FN1 ", stdout);
@@ -1799,6 +1785,8 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
for (i = 0; i < seg_count; i++) {
const unsigned char *source;
unsigned char *src_buf;
char *fncs;
int length;
int src_inc = 0, len_dec = 0;
int b256_end = 0, c40_end = 0;
@@ -1813,6 +1801,29 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
source = segs[i].source + src_inc;
length = segs[i].length - len_dec;
src_buf = (unsigned char *) z_alloca(length + 1);
fncs = (char *) z_alloca(length);
if (gs1) {
memset(fncs, gs1 == 1, length);
} else {
memset(fncs, 0, length);
if (extra_escape_mode) {
int len;
if ((error_number = z_extra_escapes(symbol, source, length, segs[i].eci, src_buf, fncs, &len))) {
return error_number;
}
if (len != length) {
assert(len < length);
length = len;
assert(length > 0);
src_buf[length] = '\0';
source = src_buf;
have_extra_escapes = 1;
}
}
}
if (mailmark) {
assert(seg_count == 1);
assert(length >= 45);
@@ -1834,6 +1845,7 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
if (b256_have_fnc1) {
b256_end = 0;
} else {
int b256_len;
if (symbol->option_1 == 0) {
b256_end = length;
} else if (symbol->option_1 < tot_length) {
@@ -1841,21 +1853,27 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
} else {
b256_end = symbol->option_1 - tot_length < length ? symbol->option_1 - tot_length : length;
}
if (gs1 == 1) {
/* Stop at first FNC1 */
const int b256_len = b256_end;
for (b256_end = 0; b256_end < b256_len && source[b256_end] != '\x1D'; b256_end++);
b256_have_fnc1 = b256_end != b256_len;
/* Stop at first FNC1 */
b256_len = b256_end;
for (b256_end = 0; b256_end < b256_len; b256_end++) {
if (fncs[b256_end] && source[b256_end] == '\x1D') {
break;
}
}
b256_have_fnc1 = b256_end != b256_len;
}
}
if ((error_number = dm_encode(symbol, source, length, segs[i].eci, i + 1 == seg_count, gs1, b256_end, c40_end,
target, &tp))) {
if ((error_number = dm_encode(symbol, source, length, segs[i].eci, i + 1 == seg_count, fncs, b256_end,
c40_end, target, &tp))) {
assert(error_number >= ZINT_ERROR);
return error_number;
}
if (content_segs && segs[i].eci) {
z_ct_set_seg_eci(symbol, i, segs[i].eci);
if (content_segs) {
if (have_extra_escapes) {
z_ct_set_seg_extra_escapes_eci(symbol, i, segs[i].eci);
} else if (segs[i].eci) {
z_ct_set_seg_eci(symbol, i, segs[i].eci);
}
}
tot_length += length;
}
+23 -11
View File
@@ -366,6 +366,12 @@ static int supports_non_iso8859_1(const int symbology) {
return 0;
}
/* Returns 1 if `symbol` can process EXTRA_ESCAPE_MODE */
static int supports_extra_escape_mode(const struct zint_symbol *const symbol) {
return symbol->symbology == BARCODE_CODE128
|| (symbol->symbology == BARCODE_DATAMATRIX && (symbol->input_mode & 0x07) != GS1_MODE);
}
/* Returns 1 if symbology supports HRT */
static int has_hrt(const int symbology) {
@@ -720,7 +726,8 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char *
int val;
int i;
unsigned int unicode;
const int extra_escape_mode = (symbol->input_mode & EXTRA_ESCAPE_MODE) && symbol->symbology == BARCODE_CODE128;
const int extra_escape_mode = symbol->input_mode & EXTRA_ESCAPE_MODE;
const int can_extra_escape = supports_extra_escape_mode(symbol);
const int escape_parens = (symbol->input_mode & GS1PARENS_MODE)
&& ((symbol->input_mode & 0x07) == GS1_MODE || check_force_gs1(symbol->symbology));
@@ -748,10 +755,14 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char *
if (escaped_string) escaped_string[out_posn] = vals[z_posn(escs, ch)];
in_posn += 2;
break;
case '^': /* CODE128 specific */
if (!extra_escape_mode) {
return z_errtxt(ZINT_ERROR_INVALID_DATA, symbol, 798,
"Escape '\\^' only valid for Code 128 in extra escape mode");
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");
}
/* Pass thru unaltered */
if (escaped_string) {
@@ -814,7 +825,7 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char *
}
/* 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, 246,
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);
}
@@ -849,7 +860,8 @@ static int escape_char_process(struct zint_symbol *symbol, const unsigned char *
break;
default:
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 234,
"Unrecognised escape character '\\%c' in input", ch);
"Unrecognised escape character '\\%c' in input",
!z_isascii(ch) || z_iscntrl(ch) ? '?' : ch);
break;
}
} else {
@@ -991,7 +1003,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
}
escape_mode = (symbol->input_mode & ESCAPE_MODE)
|| ((symbol->input_mode & EXTRA_ESCAPE_MODE) && symbol->symbology == BARCODE_CODE128);
|| ((symbol->input_mode & EXTRA_ESCAPE_MODE) && supports_extra_escape_mode(symbol));
content_segs = symbol->output_options & BARCODE_CONTENT_SEGS;
local_segs = (struct zint_seg *) z_alloca(sizeof(struct zint_seg) * (seg_count > 0 ? seg_count : 1));
@@ -1074,7 +1086,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
}
if (total_len > ZINT_MAX_DATA_LEN) {
return error_tag(ZINT_ERROR_TOO_LONG, symbol, 243, "Input too long");
return error_tag(ZINT_ERROR_TOO_LONG, symbol, 214, "Input too long");
}
/* Reconcile symbol ECI and first segment ECI if both set */
@@ -1191,7 +1203,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
if ((symbol->input_mode & 0x07) == UNICODE_MODE) {
for (i = 0; i < seg_count; i++) {
if (!z_is_valid_utf8(local_segs[i].source, local_segs[i].length)) {
return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 245, "Invalid UTF-8 in input");
return error_tag(ZINT_ERROR_INVALID_DATA, symbol, 215, "Invalid UTF-8 in input");
}
}
/* Only strip BOM on first segment */
@@ -1245,7 +1257,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
return error_tag(ZINT_ERROR_INVALID_OPTION, symbol, 210, "Selected symbology does not support GS1 mode");
}
} else if (content_segs && supports_non_iso8859_1(symbol->symbology)) {
/* Copy these as-is. The content seg `eci` will need to be updated individually */
/* Copy these as-is. The content seg `eci` (& maybe `source`) will need to be updated individually */
if (z_ct_cpy_segs(symbol, local_segs, seg_count)) {
return error_tag(ZINT_ERROR_MEMORY, symbol, -1, NULL); /* `z_ct_cpy_segs()` only fails with OOM */
}
+5 -8
View File
@@ -5,11 +5,7 @@
#define VER_FILEVERSION 2,16,0,9
#define VER_FILEVERSION_STR "2.16.0.9\0"
#ifdef GCC_WINDRES
VS_VERSION_INFO VERSIONINFO
#else
VS_VERSION_INFO VERSIONINFO
#endif
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_FILEVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
@@ -24,13 +20,14 @@ FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
//language ID = U.S. English, char set = Windows, Multilingual
BLOCK "040904B0"
//language ID = U.S. English, char set = Windows, Unicode
BEGIN
VALUE "CompanyName", "Zint\0"
VALUE "FileDescription", "libzint barcode library\0"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "zint.dll\0"
VALUE "LegalCopyright", "Copyright © 2025 Robin Stuart & BogDan Vatra\0"
VALUE "LegalCopyright", "Copyright © 2026 Robin Stuart & BogDan Vatra\0"
VALUE "OriginalFilename", "zint.dll\0"
VALUE "ProductName", "libzint\0"
VALUE "ProductVersion", VER_FILEVERSION_STR
@@ -40,6 +37,6 @@ BEGIN
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1250
VALUE "Translation", 0x0409, 1200
END
END
+120 -83
View File
@@ -204,83 +204,113 @@ static void test_hrt(const testCtx *const p_ctx) {
int expected_length;
const char *expected_content;
int expected_content_length;
int bwipp_cmp;
int zxingcpp_cmp;
const char *comment;
};
/*
é U+00E9 (\351, 233), UTF-8 C3A9, CodeB-only extended ASCII
*/
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "1234567890", -1, "1234567890", -1, "", -1, 1 },
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "1234567890", -1, "1234567890", -1, "1234567890", -1, 1 },
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "\000ABC\000DEF\000", 9, " ABC DEF ", -1, "", -1, 1 },
/* 3*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "\000ABC\000DEF\000", 9, " ABC DEF ", -1, "\000ABC\000DEF\000", 9, 1 }, /* No replacements */
/* 4*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, -1, "12345\00067890", 11, "12345 67890", -1, "", -1, 1 },
/* 5*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "12345\00067890", 11, "12345 67890", -1, "12345\00067890", 11, 1 },
/* 6*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "12345\01167890\037\177", -1, "12345 67890 ", -1, "", -1, 1 },
/* 7*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "12345\01167890\037\177", -1, "12345 67890 ", -1, "12345\01167890\037\177", -1, 1 },
/* 8*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "abcdé", -1, "abcdé", -1, "", -1, 1 },
/* 9*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "abcdé", -1, "abcdé", -1, "abcdé", -1, 1 }, /* Now UTF-8, not converted */
/* 10*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "abcdé\302\240", -1, "abcdé\302\240", -1, "", -1, 1 }, /* \302\240 (U+A0) NBSP */
/* 11*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "abcdé\302\240", -1, "abcdé\302\240", -1, "abcdé\302\240", -1, 1 },
/* 12*/ { BARCODE_CODE128, DATA_MODE, -1, -1, "abcd\351", -1, "abcdé", -1, "", -1, 899 },
/* 13*/ { BARCODE_CODE128, DATA_MODE, -1, BARCODE_CONTENT_SEGS, "abcd\351", -1, "abcdé", -1, "abcd\351", -1, 899 },
/* 14*/ { BARCODE_CODE128, DATA_MODE, -1, -1, "ab\240cd\351", -1, "ab\302\240cdé", -1, "", -1, 899 }, /* \240 (U+A0) NBSP */
/* 15*/ { BARCODE_CODE128, DATA_MODE, -1, BARCODE_CONTENT_SEGS, "ab\240cd\351", -1, "ab\302\240cdé", -1, "ab\240cd\351", -1, 899 },
/* 16*/ { BARCODE_CODE128, DATA_MODE, -1, -1, "ab\200cd\351", -1, "ab cdé", -1, "", -1, 899 }, /* \200 (U+80) non-ISO/IEC 8859-1 */
/* 17*/ { BARCODE_CODE128, DATA_MODE, -1, BARCODE_CONTENT_SEGS, "ab\200cd\351", -1, "ab cdé", -1, "ab\200cd\351", -1, 899 },
/* 18*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C123456789012345678", -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, "", -1, 1 }, /* Max length 198 + 19 special escapes = 99 + 19*3 = 255 */
/* 19*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C123456789012345678", -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, 1 },
/* 20*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, -1, "abcdé", -1, "abcdé", -1, "", -1, 1 },
/* 21*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "abcdé", -1, "abcdé", -1, "abcdé", -1, 1 },
/* 22*/ { BARCODE_CODE128AB, DATA_MODE, -1, -1, "abcd\351", -1, "abcdé", -1, "", -1, 899 },
/* 23*/ { BARCODE_CODE128AB, DATA_MODE, -1, BARCODE_CONTENT_SEGS, "abcd\351", -1, "abcdé", -1, "abcd\351", -1, 899 },
/* 24*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, -1, "1234567890", -1, "*+12345678900*", -1, "", -1, 1 },
/* 25*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "1234567890", -1, "*+12345678900*", -1, "+12345678900", -1, 1 },
/* 26*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, -1, "a99912345", -1, "*+A999123457*", -1, "", -1, 1 }, /* Converts to upper */
/* 27*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "a99912345", -1, "*+A999123457*", -1, "+A999123457", -1, 1 },
/* 28*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "000393206219912345678101040", -1, "0003 932 0621 9912 3456 78 101 040 9", -1, "", -1, 1 }, /* DPDAPPD 4.0.2 - Illustration 7 */
/* 29*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "000393206219912345678101040", -1, "0003 932 0621 9912 3456 78 101 040 9", -1, "%000393206219912345678101040", -1, 1 }, /* Includes '%', no spaces, no check digit */
/* 30*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "007110601782532948375101276", -1, "0071 106 0178 2532 9483 75 101 276 X", -1, "", -1, 1 }, /* DPDAPPD 4.0.2 - Illustration 6, figure's HRT seems incorrect */
/* 31*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "007110601782532948375101276", -1, "0071 106 0178 2532 9483 75 101 276 X", -1, "%007110601782532948375101276", -1, 1 },
/* 32*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020028101276", -1, "0081 827 0998 0000 0200 28 101 276 B", -1, "", -1, 1 }, /* DPDPLS Section 4 */
/* 33*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "008182709980000020028101276", -1, "0081 827 0998 0000 0200 28 101 276 B", -1, "%008182709980000020028101276", -1, 1 },
/* 34*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "007110601632532948375179276", -1, "0071 106 0163 2532 9483 75 179 276 A", -1, "", -1, 1 }, /* DPDPLS Section 4.6 */
/* 35*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "007110601632532948375179276", -1, "0071 106 0163 2532 9483 75 179 276 A", -1, "%007110601632532948375179276", -1, 1 },
/* 36*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "001990009980000020084109203", -1, "0019 900 0998 0000 0200 84 109 203 1", -1, "", -1, 1 }, /* DPDPLS Section 5.1 */
/* 37*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "001990009980000020084109203", -1, "0019 900 0998 0000 0200 84 109 203 1", -1, "%001990009980000020084109203", -1, 1 },
/* 38*/ { BARCODE_DPD, UNICODE_MODE, 1, -1, "007110601632532948375101276", -1, "0071 106 0163 2532 9483 75 101 276 O", -1, "", -1, 1 }, /* DPDPLS Section 6.1.2 relabel, figure is actually 8.7.2 with mislabelled HRT */
/* 39*/ { BARCODE_DPD, UNICODE_MODE, 1, BARCODE_CONTENT_SEGS, "007110601632532948375101276", -1, "0071 106 0163 2532 9483 75 101 276 O", -1, "007110601632532948375101276", -1, 1 }, /* No '%' */
/* 40*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020029136276", -1, "0081 827 0998 0000 0200 29 136 276 3", -1, "", -1, 1 }, /* DPDPLS Section 8.1 */
/* 41*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "001234509980000020031105276", -1, "0012 345 0998 0000 0200 31 105 276 L", -1, "", -1, 1 }, /* DPDPLS Section 8.2 */
/* 42*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020032154276", -1, "0081 827 0998 0000 0200 32 154 276 J", -1, "", -1, 1 }, /* DPDPLS Section 8.3 */
/* 43*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020030109276", -1, "0081 827 0998 0000 0200 30 109 276 W", -1, "", -1, 1 }, /* DPDPLS Section 8.4 */
/* 44*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020033350276", -1, "0081 827 0998 0000 0200 33 350 276 C", -1, "", -1, 1 }, /* DPDPLS Section 8.5.1 */
/* 45*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020034179276", -1, "0081 827 0998 0000 0200 34 179 276 I", -1, "", -1, 1 }, /* DPDPLS Section 8.5.2 */
/* 46*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020035225276", -1, "0081 827 0998 0000 0200 35 225 276 H", -1, "", -1, 1 }, /* DPDPLS Section 8.5.3 */
/* 47*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020036155276", -1, "0081 827 0998 0000 0200 36 155 276 5", -1, "", -1, 1 }, /* DPDPLS Section 8.5.4 */
/* 48*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "000280009980000020037155056", -1, "0002 800 0998 0000 0200 37 155 056 6", -1, "", -1, 1 }, /* DPDPLS Section 8.5.5 */
/* 49*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "007855009980000020041302840", -1, "0078 550 0998 0000 0200 41 302 840 U", -1, "", -1, 1 }, /* DPDPLS Section 8.5.6 */
/* 50*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020042102276", -1, "0081 827 0998 0000 0200 42 102 276 R", -1, "", -1, 1 }, /* DPDPLS Section 8.6.1 */
/* 51*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020043113276", -1, "0081 827 0998 0000 0200 43 113 276 Y", -1, "", -1, 1 }, /* DPDPLS Section 8.7.1 */
/* 52*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "008182709980000020043113276", -1, "0081 827 0998 0000 0200 43 113 276 Y", -1, "%008182709980000020043113276", -1, 1 },
/* 53*/ { BARCODE_DPD, UNICODE_MODE, 1, -1, "006376209980000020044118276", -1, "0063 762 0998 0000 0200 44 118 276 I", -1, "", -1, 1 }, /* DPDPLS Section 8.7.2 relabel */
/* 54*/ { BARCODE_DPD, UNICODE_MODE, 1, BARCODE_CONTENT_SEGS, "006376209980000020044118276", -1, "0063 762 0998 0000 0200 44 118 276 I", -1, "006376209980000020044118276", -1, 1 },
/* 55*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "007160009980000020050294276", -1, "0071 600 0998 0000 0200 50 294 276 C", -1, "", -1, 1 }, /* DPDPLS Section 8.8 */
/* 56*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020045327276", -1, "0081 827 0998 0000 0200 45 327 276 N", -1, "", -1, 1 }, /* DPDPLS Section 8.9.1 */
/* 57*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "006374309980000020047337276", -1, "0063 743 0998 0000 0200 47 337 276 O", -1, "", -1, 1 }, /* DPDPLS Section 8.9.2 */
/* 58*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "006374309980000020047337276", -1, "0063 743 0998 0000 0200 47 337 276 O", -1, "%006374309980000020047337276", -1, 1 },
/* 59*/ { BARCODE_DPD, UNICODE_MODE, 1, -1, "006374109980978004757332276", -1, "0063 741 0998 0978 0047 57 332 276 M", -1, "", -1, 1 }, /* DPDPLS Section 8.9.3 relabel, figure's HRT seems incorrect */
/* 60*/ { BARCODE_DPD, UNICODE_MODE, 1, BARCODE_CONTENT_SEGS, "006374109980978004757332276", -1, "0063 741 0998 0978 0047 57 332 276 M", -1, "006374109980978004757332276", -1, 1 },
/* 61*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020051106276", -1, "0081 827 0998 0000 0200 51 106 276 M", -1, "", -1, 1 }, /* DPDPLS Section 9.1 */
/* 62*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020052110276", -1, "0081 827 0998 0000 0200 52 110 276 W", -1, "", -1, 1 }, /* DPDPLS Section 9.2 */
/* 63*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020053161276", -1, "0081 827 0998 0000 0200 53 161 276 O", -1, "", -1, 1 }, /* DPDPLS Section 9.3 */
/* 64*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020054352276", -1, "0081 827 0998 0000 0200 54 352 276 B", -1, "", -1, 1 }, /* DPDPLS Section 9.4 */
/* 65*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020055191276", -1, "0081 827 0998 0000 0200 55 191 276 A", -1, "", -1, 1 }, /* DPDPLS Section 9.5 */
/* 66*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020056237276", -1, "0081 827 0998 0000 0200 56 237 276 K", -1, "", -1, 1 }, /* DPDPLS Section 9.6 */
/* 67*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "008182709980000020056237276", -1, "0081 827 0998 0000 0200 56 237 276 K", -1, "%008182709980000020056237276", -1, 1 },
/* 68*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, -1, "EE876543216CA", -1, "EE 876 543 216 CA", -1, "", -1, 1 }, /* UPU S10 Annex A */
/* 69*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "EE876543216CA", -1, "EE 876 543 216 CA", -1, "EE876543216CA", -1, 1 }, /* No spaces */
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "1234567890", -1, "1234567890", -1, "", -1, 1, 1, "" },
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "1234567890", -1, "1234567890", -1, "1234567890", -1, 1, 1, "" },
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "\000ABC\000DEF\000", 9, " ABC DEF ", -1, "", -1, 1, 1, "" },
/* 3*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "\000ABC\000DEF\000", 9, " ABC DEF ", -1, "\000ABC\000DEF\000", 9, 1, 1, "No replacements" },
/* 4*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, -1, "12345\00067890", 11, "12345 67890", -1, "", -1, 1, 1, "" },
/* 5*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "12345\00067890", 11, "12345 67890", -1, "12345\00067890", 11, 1, 1, "" },
/* 6*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "12345\01167890\037\177", -1, "12345 67890 ", -1, "", -1, 1, 1, "" },
/* 7*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "12345\01167890\037\177", -1, "12345 67890 ", -1, "12345\01167890\037\177", -1, 1, 1, "" },
/* 8*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "abcdé", -1, "abcdé", -1, "", -1, 1, 1, "" },
/* 9*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "abcdé", -1, "abcdé", -1, "abcdé", -1, 1, 1, "Now UTF-8, not converted" },
/* 10*/ { BARCODE_CODE128, UNICODE_MODE, -1, -1, "abcdé\302\240", -1, "abcdé\302\240", -1, "", -1, 1, 1, "\302\240 (U+A0) NBSP" },
/* 11*/ { BARCODE_CODE128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "abcdé\302\240", -1, "abcdé\302\240", -1, "abcdé\302\240", -1, 1, 1, "" },
/* 12*/ { BARCODE_CODE128, DATA_MODE, -1, -1, "abcd\351", -1, "abcdé", -1, "", -1, 1, 899, "" },
/* 13*/ { BARCODE_CODE128, DATA_MODE, -1, BARCODE_CONTENT_SEGS, "abcd\351", -1, "abcdé", -1, "abcd\351", -1, 1, 899, "" },
/* 14*/ { BARCODE_CODE128, DATA_MODE, -1, -1, "ab\240cd\351", -1, "ab\302\240cdé", -1, "", -1, 1, 899, "\240 (U+A0) NBSP" },
/* 15*/ { BARCODE_CODE128, DATA_MODE, -1, BARCODE_CONTENT_SEGS, "ab\240cd\351", -1, "ab\302\240cdé", -1, "ab\240cd\351", -1, 1, 899, "" },
/* 16*/ { BARCODE_CODE128, DATA_MODE, -1, -1, "ab\200cd\351", -1, "ab cdé", -1, "", -1, 1, 899, "\200 (U+80) non-ISO/IEC 8859-1" },
/* 17*/ { BARCODE_CODE128, DATA_MODE, -1, BARCODE_CONTENT_SEGS, "ab\200cd\351", -1, "ab cdé", -1, "ab\200cd\351", -1, 1, 899, "" },
/* 18*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C123456789012345678", -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, "", -1, 1, 1, "Max length 198 + 19 special escapes = 99 + 19*3 = 255" },
/* 19*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C123456789012345678", -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, 1, 1, "" },
/* 20*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "\\^10412345", -1, "0412345", -1, "", -1, 1, 1, "" },
/* 21*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "\\^10412345", -1, "0412345", -1, "0412345", -1, 1, 1, "" },
/* 22*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "\\^1\\^1041234\\^15", -1, "0412345", -1, "", -1, 0, 1, "BWIPP: different encodation (same no. of codewords) - see below (forced mode)" },
/* 23*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "\\^1\\^1041234\\^15", -1, "0412345", -1, "\035041234\0355", -1, 0, 1, "BWIPP - see below (forced mode)" },
/* 24*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "\\^1\\^1041234\\^B\\^15", -1, "0412345", -1, "", -1, 1, 1, "" },
/* 25*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "\\^1\\^1041234\\^B\\^15", -1, "0412345", -1, "\035041234\0355", -1, 1, 1, "" },
/* 26*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "A\\^1123456", -1, "A123456", -1, "", -1, 1, 1, "" },
/* 27*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "A\\^1123456", -1, "A123456", -1, "A123456", -1, 1, 1, "" },
/* 28*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "A\\^1123456\\^1", -1, "A123456", -1, "", -1, 1, 1, "" },
/* 29*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "A\\^1123456\\^1", -1, "A123456", -1, "A123456\035", -1, 1, 1, "" },
/* 30*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "?\\^1123456\\^1", -1, "?123456", -1, "", -1, 0, 1, "BWIPP: different encodation (same no. of codewords) - see below (forced mode)" },
/* 31*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "?\\^1123456\\^1", -1, "?123456", -1, "?\035123456\035", -1, 0, 1, "BWIPP - see below (forced mode)" },
/* 32*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "?\\^B\\^1\\^@123456\\^1", -1, "?123456", -1, "", -1, 1, 1, "" },
/* 33*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "?\\^B\\^1\\^@123456\\^1", -1, "?123456", -1, "?\035123456\035", -1, 1, 1, "" },
/* 34*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "12\\^1123456", -1, "12123456", -1, "", -1, 1, 1, "" },
/* 35*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "12\\^1123456", -1, "12123456", -1, "12123456", -1, 1, 1, "" },
/* 36*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "12\\^1\\^1123456", -1, "12123456", -1, "", -1, 1, 1, "" },
/* 37*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "12\\^1\\^1123456", -1, "12123456", -1, "12\035123456", -1, 1, 1, "" },
/* 38*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "\\^C12\\^1\\^1123456", -1, "12123456", -1, "", -1, 1, 1, "" },
/* 39*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "\\^C12\\^1\\^1123456", -1, "12123456", -1, "12\035123456", -1, 1, 1, "" },
/* 40*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "1A\\^1123456", -1, "1A123456", -1, "", -1, 0, 1, "BWIPP: different encodation (same no. of codewords)" },
/* 41*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "1A\\^1123456", -1, "1A123456", -1, "1A\035123456", -1, 0, 1, "BWIPP: as above" },
/* 42*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "\\^1\\^1", -1, "", -1, "", -1, 0, 1, "BWIPP: different encodation (same no. of codewords) - see below (forced mode)" },
/* 43*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "\\^1\\^1", -1, "", -1, "\035", -1, 0, 1, "BWIPP - see below (forced mode)" },
/* 44*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "\\^B\\^1\\^1", -1, "", -1, "", -1, 1, 1, "" },
/* 45*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "\\^B\\^1\\^1", -1, "", -1, "\035", -1, 1, 1, "" },
/* 46*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, -1, "\\^1\\^1\\^1", -1, "", -1, "", -1, 0, 1, "BWIPP: different encodation (same no. of codewords)" },
/* 47*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, BARCODE_CONTENT_SEGS, "\\^1\\^1\\^1", -1, "", -1, "\035\035", -1, 0, 1, "BWIPP: as above" },
/* 48*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, -1, "abcdé", -1, "abcdé", -1, "", -1, 1, 1, "" },
/* 49*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "abcdé", -1, "abcdé", -1, "abcdé", -1, 1, 1, "" },
/* 50*/ { BARCODE_CODE128AB, DATA_MODE, -1, -1, "abcd\351", -1, "abcdé", -1, "", -1, 1, 899, "" },
/* 51*/ { BARCODE_CODE128AB, DATA_MODE, -1, BARCODE_CONTENT_SEGS, "abcd\351", -1, "abcdé", -1, "abcd\351", -1, 1, 899, "" },
/* 52*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, -1, "1234567890", -1, "*+12345678900*", -1, "", -1, 1, 1, "" },
/* 53*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "1234567890", -1, "*+12345678900*", -1, "+12345678900", -1, 1, 1, "" },
/* 54*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, -1, "a99912345", -1, "*+A999123457*", -1, "", -1, 1, 1, "Converts to upper" },
/* 55*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "a99912345", -1, "*+A999123457*", -1, "+A999123457", -1, 1, 1, "" },
/* 56*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "000393206219912345678101040", -1, "0003 932 0621 9912 3456 78 101 040 9", -1, "", -1, 1, 1, "DPDAPPD 4.0.2 - Illustration 7" },
/* 57*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "000393206219912345678101040", -1, "0003 932 0621 9912 3456 78 101 040 9", -1, "%000393206219912345678101040", -1, 1, 1, "Includes '%', no spaces, no check digit" },
/* 58*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "007110601782532948375101276", -1, "0071 106 0178 2532 9483 75 101 276 X", -1, "", -1, 1, 1, "DPDAPPD 4.0.2 - Illustration 6, figure's HRT seems incorrect" },
/* 59*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "007110601782532948375101276", -1, "0071 106 0178 2532 9483 75 101 276 X", -1, "%007110601782532948375101276", -1, 1, 1, "" },
/* 60*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020028101276", -1, "0081 827 0998 0000 0200 28 101 276 B", -1, "", -1, 1, 1, "DPDPLS Section 4" },
/* 61*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "008182709980000020028101276", -1, "0081 827 0998 0000 0200 28 101 276 B", -1, "%008182709980000020028101276", -1, 1, 1, "" },
/* 62*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "007110601632532948375179276", -1, "0071 106 0163 2532 9483 75 179 276 A", -1, "", -1, 1, 1, "DPDPLS Section 4.6" },
/* 63*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "007110601632532948375179276", -1, "0071 106 0163 2532 9483 75 179 276 A", -1, "%007110601632532948375179276", -1, 1, 1, "" },
/* 64*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "001990009980000020084109203", -1, "0019 900 0998 0000 0200 84 109 203 1", -1, "", -1, 1, 1, "DPDPLS Section 5.1" },
/* 65*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "001990009980000020084109203", -1, "0019 900 0998 0000 0200 84 109 203 1", -1, "%001990009980000020084109203", -1, 1, 1, "" },
/* 66*/ { BARCODE_DPD, UNICODE_MODE, 1, -1, "007110601632532948375101276", -1, "0071 106 0163 2532 9483 75 101 276 O", -1, "", -1, 1, 1, "DPDPLS Section 6.1.2 relabel, figure is actually 8.7.2 with mislabelled HRT" },
/* 67*/ { BARCODE_DPD, UNICODE_MODE, 1, BARCODE_CONTENT_SEGS, "007110601632532948375101276", -1, "0071 106 0163 2532 9483 75 101 276 O", -1, "007110601632532948375101276", -1, 1, 1, "No '%'" },
/* 68*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020029136276", -1, "0081 827 0998 0000 0200 29 136 276 3", -1, "", -1, 1, 1, "DPDPLS Section 8.1" },
/* 69*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "001234509980000020031105276", -1, "0012 345 0998 0000 0200 31 105 276 L", -1, "", -1, 1, 1, "DPDPLS Section 8.2" },
/* 70*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020032154276", -1, "0081 827 0998 0000 0200 32 154 276 J", -1, "", -1, 1, 1, "DPDPLS Section 8.3" },
/* 71*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020030109276", -1, "0081 827 0998 0000 0200 30 109 276 W", -1, "", -1, 1, 1, "DPDPLS Section 8.4" },
/* 72*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020033350276", -1, "0081 827 0998 0000 0200 33 350 276 C", -1, "", -1, 1, 1, "DPDPLS Section 8.5.1" },
/* 73*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020034179276", -1, "0081 827 0998 0000 0200 34 179 276 I", -1, "", -1, 1, 1, "DPDPLS Section 8.5.2" },
/* 74*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020035225276", -1, "0081 827 0998 0000 0200 35 225 276 H", -1, "", -1, 1, 1, "DPDPLS Section 8.5.3" },
/* 75*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020036155276", -1, "0081 827 0998 0000 0200 36 155 276 5", -1, "", -1, 1, 1, "DPDPLS Section 8.5.4" },
/* 76*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "000280009980000020037155056", -1, "0002 800 0998 0000 0200 37 155 056 6", -1, "", -1, 1, 1, "DPDPLS Section 8.5.5" },
/* 77*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "007855009980000020041302840", -1, "0078 550 0998 0000 0200 41 302 840 U", -1, "", -1, 1, 1, "DPDPLS Section 8.5.6" },
/* 78*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020042102276", -1, "0081 827 0998 0000 0200 42 102 276 R", -1, "", -1, 1, 1, "DPDPLS Section 8.6.1" },
/* 79*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020043113276", -1, "0081 827 0998 0000 0200 43 113 276 Y", -1, "", -1, 1, 1, "DPDPLS Section 8.7.1" },
/* 80*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "008182709980000020043113276", -1, "0081 827 0998 0000 0200 43 113 276 Y", -1, "%008182709980000020043113276", -1, 1, 1, "" },
/* 81*/ { BARCODE_DPD, UNICODE_MODE, 1, -1, "006376209980000020044118276", -1, "0063 762 0998 0000 0200 44 118 276 I", -1, "", -1, 1, 1, "DPDPLS Section 8.7.2 relabel" },
/* 82*/ { BARCODE_DPD, UNICODE_MODE, 1, BARCODE_CONTENT_SEGS, "006376209980000020044118276", -1, "0063 762 0998 0000 0200 44 118 276 I", -1, "006376209980000020044118276", -1, 1, 1, "" },
/* 83*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "007160009980000020050294276", -1, "0071 600 0998 0000 0200 50 294 276 C", -1, "", -1, 1, 1, "DPDPLS Section 8.8" },
/* 84*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020045327276", -1, "0081 827 0998 0000 0200 45 327 276 N", -1, "", -1, 1, 1, "DPDPLS Section 8.9.1" },
/* 85*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "006374309980000020047337276", -1, "0063 743 0998 0000 0200 47 337 276 O", -1, "", -1, 1, 1, "DPDPLS Section 8.9.2" },
/* 86*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "006374309980000020047337276", -1, "0063 743 0998 0000 0200 47 337 276 O", -1, "%006374309980000020047337276", -1, 1, 1, "" },
/* 87*/ { BARCODE_DPD, UNICODE_MODE, 1, -1, "006374109980978004757332276", -1, "0063 741 0998 0978 0047 57 332 276 M", -1, "", -1, 1, 1, "DPDPLS Section 8.9.3 relabel, figure's HRT seems incorrect" },
/* 88*/ { BARCODE_DPD, UNICODE_MODE, 1, BARCODE_CONTENT_SEGS, "006374109980978004757332276", -1, "0063 741 0998 0978 0047 57 332 276 M", -1, "006374109980978004757332276", -1, 1, 1, "" },
/* 89*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020051106276", -1, "0081 827 0998 0000 0200 51 106 276 M", -1, "", -1, 1, 1, "DPDPLS Section 9.1" },
/* 90*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020052110276", -1, "0081 827 0998 0000 0200 52 110 276 W", -1, "", -1, 1, 1, "DPDPLS Section 9.2" },
/* 91*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020053161276", -1, "0081 827 0998 0000 0200 53 161 276 O", -1, "", -1, 1, 1, "DPDPLS Section 9.3" },
/* 92*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020054352276", -1, "0081 827 0998 0000 0200 54 352 276 B", -1, "", -1, 1, 1, "DPDPLS Section 9.4" },
/* 93*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020055191276", -1, "0081 827 0998 0000 0200 55 191 276 A", -1, "", -1, 1, 1, "DPDPLS Section 9.5" },
/* 94*/ { BARCODE_DPD, UNICODE_MODE, -1, -1, "008182709980000020056237276", -1, "0081 827 0998 0000 0200 56 237 276 K", -1, "", -1, 1, 1, "DPDPLS Section 9.6" },
/* 95*/ { BARCODE_DPD, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "008182709980000020056237276", -1, "0081 827 0998 0000 0200 56 237 276 K", -1, "%008182709980000020056237276", -1, 1, 1, "" },
/* 96*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, -1, "EE876543216CA", -1, "EE 876 543 216 CA", -1, "", -1, 1, 1, "UPU S10 Annex A" },
/* 97*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, BARCODE_CONTENT_SEGS, "EE876543216CA", -1, "EE 876 543 216 CA", -1, "EE876543216CA", -1, 1, 1, "No spaces" },
/* BARCODE_GS1_128, BARCODE_EAN14, BARCODE_NVE18 hrt tested in test_gs1.c */
};
const int data_size = ARRAY_SIZE(data);
@@ -319,9 +349,9 @@ static void test_hrt(const testCtx *const p_ctx) {
ret = ZBarcode_Encode(symbol, TCU(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",
assert_equal(symbol->text_length, expected_length, "i:%d text_length %d != expected_length %d (%s, %s)\n",
i, symbol->text_length, expected_length, symbol->text, data[i].expected);
assert_zero(memcmp(symbol->text, data[i].expected, expected_length), "i:%d text memcmp(%s, %s, %d) != 0\n",
i, symbol->text, data[i].expected, expected_length);
if (ret < ZINT_ERROR) {
@@ -329,10 +359,11 @@ static void test_hrt(const testCtx *const p_ctx) {
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,
symbol->content_segs[0].length, symbol->content_segs[0].source, data[i].expected_content);
assert_zero(memcmp(symbol->content_segs[0].source, data[i].expected_content, expected_content_length),
"i:%d memcmp(%.*s, %s, %d) != 0\n",
"i:%d content_segs memcmp(%.*s, %s, %d) != 0\n",
i, symbol->content_segs[0].length, symbol->content_segs[0].source,
data[i].expected_content, expected_content_length);
} else {
@@ -340,7 +371,12 @@ static void test_hrt(const testCtx *const p_ctx) {
}
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
if (data[i].symbology == BARCODE_HIBC_128
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible (%s)\n",
i, testUtilBarcodeName(symbol->symbology), data[i].comment);
}
} else if (data[i].symbology == BARCODE_HIBC_128
&& z_not_sane(IS_NUM_F | IS_UPR_F | IS_SPC_F | IS_PLS_F | IS_MNS_F | IS_SIL_F, ZCUCP(data[i].data), length)) {
if (debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d %s not BWIPP compatible (%s)\n",
@@ -363,6 +399,7 @@ static void test_hrt(const testCtx *const p_ctx) {
if (do_zxingcpp && testUtilCanZXingCPP(i, symbol, data[i].data, length, debug)) {
int cmp_len, ret_len;
char modules_dump[4096];
assert_nonzero(data[i].zxingcpp_cmp, "i:%d data[i].zxingcpp_cmp == 0", i);
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, data[i].zxingcpp_cmp, cmp_buf,
@@ -512,8 +549,8 @@ static void test_input(const testCtx *const p_ctx) {
/* 2*/ { UNICODE_MODE, "AIM1234", -1, 0, 101, 1, 1, "(9) 104 33 41 45 99 12 34 87 106", "Example from Annex A.1, check char value 87" },
/* 3*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "123456789", -1, 0, 101, 1, 1, "(9) 105 12 34 56 78 100 25 79 106", "Ticket #204 ZPL example" },
/* 4*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B12345\\^C6789", -1, 0, 123, 0, 1, "(11) 104 17 18 19 20 21 99 67 89 11 106", "Ticket #204 ZPL example; BWIPP as above" },
/* 5*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B12345\\^D6789", -1, 0, 167, 0, 1, "(15) 104 17 18 19 20 21 60 62 36 22 23 24 25 1 106", "Unrecognized extra escape passed thru; BWIPP different encodation" },
/* 6*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B12345\\^D6789", -1, 0, 167, 0, 1, "(15) 104 17 18 19 20 21 60 62 36 22 23 24 25 1 106", "Unrecognized extra escape passed thru; BWIPP different encodation" },
/* 5*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B12345\\^D6789", -1, ZINT_ERROR_INVALID_DATA, 0, 1, 1, "Error 348: Unrecognized extra escape \"\\^D\"", "" },
/* 6*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^B12345\\^\0016789", -1, ZINT_ERROR_INVALID_DATA, 0, 1, 1, "Error 348: Unrecognized extra escape \"\\^?\"", "" },
/* 7*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^A\\^B\\^C", -1, ZINT_ERROR_INVALID_DATA, 0, 1, 1, "Error 842: No input data", "" },
/* 8*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^A\\^^B\\^C", -1, 0, 68, 0, 1, "(6) 103 60 62 34 80 106", "BWIPP different encodation" },
/* 9*/ { UNICODE_MODE | EXTRA_ESCAPE_MODE, "\\^A\\^B\\^^C", -1, 0, 68, 1, 1, "(6) 104 60 62 35 84 106", "" },
@@ -649,10 +686,10 @@ static void test_input(const testCtx *const p_ctx) {
/*139*/ { UNICODE_MODE, "12é12é", -1, 0, 123, 0, 1, "(11) 105 12 100 100 73 17 18 100 73 17 106", "StartC 12 CodeB FNC4 é 1 2 FNC4 é; BWIPP different encodation (StartB)" },
/*140*/ { UNICODE_MODE, "1234é123456é", -1, 0, 167, 1, 1, "(15) 105 12 34 100 100 73 99 12 34 56 100 100 73 15 106", "StartC 12 34 CodeB FNC4 é CodeC 12 34 56 CodeB FNC4 é" },
/*141*/ { DATA_MODE, "\256^a\357\033\270\017,\274u$B\305\311\006\011]\273\025u\315\2638\263\333", -1, 0, 453, 1, 899, "(41) 104 100 14 62 65 100 79 101 91 101 24 79 12 101 28 98 85 4 34 101 37 101 41 70 73 61", "" },
/*142*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^C\\^1", -1, 0, 46, 0, 0, "(4) 105 102 1 106", "StartC FNC1; From fuzz 2026-01-12; BWIPP see below; zxing-cpp empty text" },
/*143*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^A\\^1", -1, 0, 46, 0, 0, "(4) 103 102 102 106", "StartA FNC1; From fuzz 2026-01-12; BWIPP see below; zxing-cpp empty text" },
/*144*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^B\\^1", -1, 0, 46, 1, 0, "(4) 104 102 0 106", "StartB FNC1; From fuzz 2026-01-12; zxing-cpp empty text" },
/*145*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^1", -1, 0, 46, 0, 0, "(4) 105 102 1 106", "StartC FNC1; BWIPP see above; zxing-cpp empty text" },
/*142*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^C\\^1", -1, 0, 46, 0, 1, "(4) 105 102 1 106", "StartC FNC1; From fuzz 2026-01-12; BWIPP see below" },
/*143*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^A\\^1", -1, 0, 46, 0, 1, "(4) 103 102 102 106", "StartA FNC1; From fuzz 2026-01-12; BWIPP see below" },
/*144*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^B\\^1", -1, 0, 46, 1, 1, "(4) 104 102 0 106", "StartB FNC1; From fuzz 2026-01-12" },
/*145*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^1", -1, 0, 46, 0, 1, "(4) 105 102 1 106", "StartC FNC1; BWIPP see above" },
/*146*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^C\\^1A", -1, 0, 68, 0, 3, "(6) 105 102 100 33 94 106", "StartC CodeB FNC1 A; BWIPP see below" },
/*147*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^A\\^1A", -1, 0, 57, 0, 3, "(5) 103 102 33 65 106", "StartA FNC1 A; BWIPP see below" },
/*148*/ { DATA_MODE | EXTRA_ESCAPE_MODE, "\\^B\\^1A", -1, 0, 57, 1, 3, "(5) 104 102 33 66 106", "StartB FNC1 A" },
+147 -7
View File
@@ -155,8 +155,7 @@ static void test_to_upper(const testCtx *const p_ctx) {
buf[length] = '\0';
z_to_upper(buf, length);
assert_zero(strcmp((const char *) buf, data[i].expected), "i:%d strcmp(%s, %s) != 0\n",
i, buf, data[i].expected);
assert_zero(strcmp(ZCCP(buf), data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, buf, data[i].expected);
}
testFinish();
@@ -764,6 +763,70 @@ static void test_utf8_to_unicode(const testCtx *const p_ctx) {
testFinish();
}
static void test_extra_escapes(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
int eci;
const char *data;
int length;
int ret;
const char *expected;
const char expected_fncs[32];
const char *comment;
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
/* 0*/ { 0, "", -1, 0, "", {0}, "" },
/* 1*/ { 3, "ABC", -1, 0, "ABC", {0}, "" },
/* 2*/ { 4, "\\^1ABC", -1, 0, "\035ABC", {1}, "" },
/* 3*/ { 26, "\\^1\\^1A\\^1BC\\^1", -1, 0, "\035\035A\035BC\035", {1,1,0,1,0,0,1}, "" },
/* 4*/ { 27, "\\^^\\^1A\\^1BC\\^^1", -1, 0, "\\^\035A\035BC\\^1", {0,0,1,0,1}, "" },
/* 5*/ { 20, "ABC", -1, ZINT_ERROR_INVALID_OPTION, "", {0}, "" },
/* 6*/ { 25, "ABC", -1, ZINT_ERROR_INVALID_OPTION, "", {0}, "" },
/* 7*/ { 28, "ABC", -1, ZINT_ERROR_INVALID_OPTION, "", {0}, "" },
/* 8*/ { 29, "ABC", -1, ZINT_ERROR_INVALID_OPTION, "", {0}, "" },
/* 9*/ { 899, "ABC", -1, ZINT_ERROR_INVALID_OPTION, "", {0}, "" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol s_symbol;
struct zint_symbol *symbol = &s_symbol;
int expected_length;
testStart(p_ctx->func_name);
symbol->debug = debug;
for (i = 0; i < data_size; i++) {
int len = 0;
unsigned char dest[32] = {0};
char fncs[32] = {0};
if (testContinue(p_ctx, i)) continue;
memset(symbol, 0, sizeof(*symbol));
length = data[i].length == -1 ? (int) strlen(data[i].data) : data[i].length;
expected_length = (int) strlen(data[i].expected);
assert_nonzero(expected_length < (int) sizeof(dest), "i:%d expected_length %d >= sizeof(dest) %d\n",
i, expected_length, (int) sizeof(dest));
ret = z_extra_escapes(symbol, ZCUCP(data[i].data), length, data[i].eci, dest, fncs, &len);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret);
if (ret < ZINT_ERROR) {
assert_equal(len, expected_length, "i:%d len %d != expected_length %d (%s)\n",
i, len, expected_length, dest);
assert_zero(strcmp(ZCCP(dest), data[i].expected), "i:%d dest (%s) != expected (%s)\n",
i, dest, data[i].expected);
assert_zero(memcmp(fncs, data[i].expected_fncs, expected_length), "i:%d fncs != expected_fncs\n", i);
}
}
testFinish();
}
/* Note transferred from "test_code128.c" */
static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
@@ -1033,7 +1096,7 @@ static void test_hrt_printf_nochk(const testCtx *const p_ctx) {
assert_zero(1, "i:%d, bad num_args\n", i);
}
assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(\"%s\", \"%s\") != 0\n",
assert_zero(strcmp(ZCCP(symbol->text), data[i].expected), "i:%d strcmp(\"%s\", \"%s\") != 0\n",
i, symbol->text, data[i].expected);
}
@@ -1084,7 +1147,7 @@ static void test_hrt_conv_gs1_brackets_nochk(const testCtx *const p_ctx) {
z_hrt_conv_gs1_brackets_nochk(symbol, TCU(data[i].data), length);
assert_zero(strcmp((const char *) symbol->text, data[i].expected), "i:%d strcmp(\"%s\", \"%s\") != 0\n",
assert_zero(strcmp(ZCCP(symbol->text), data[i].expected), "i:%d strcmp(\"%s\", \"%s\") != 0\n",
i, symbol->text, data[i].expected);
}
@@ -1223,7 +1286,7 @@ static void test_ct_cpy(const testCtx *const p_ctx) {
i, symbol->content_segs[0].length, expected_length);
assert_zero(memcmp(symbol->content_segs[0].source, data[i].expected, expected_length),
"i:%d content_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
testUtilEscape((const char *) symbol->content_segs[0].source, symbol->content_segs[0].length,
testUtilEscape(ZCCP(symbol->content_segs[0].source), symbol->content_segs[0].length,
escaped, sizeof(escaped)),
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
expected_length);
@@ -1237,6 +1300,81 @@ static void test_ct_cpy(const testCtx *const p_ctx) {
testFinish();
}
static void test_ct_set_seg_extra_escapes_eci(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
int seg_idx;
int seg_count;
int eci;
struct zint_seg segs[3];
struct zint_seg expected_content_segs[3];
};
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
static const struct item data[] = {
/* 0*/ { 0, 1, 3, { { TU("\\^1A"), 0, 0 } }, { { TU("\035A"), 2, 3 } } },
/* 1*/ { 0, 1, 0, { { TU("\\^1A"), 0, 0 } }, { { TU("A"), 1, 3 } } },
/* 2*/ { 0, 1, 4, { { TU("A\\^1"), 0, 0 } }, { { TU("A\035"), 2, 4 } } },
/* 3*/ { 0, 1, 0, { { TU("A\\^1"), 0, 0 } }, { { TU("A"), 1, 3 } } },
/* 4*/ { 0, 1, 0, { { TU("a\\^1"), 0, 0 } }, { { TU("a"), 1, 3 } } },
/* 5*/ { 0, 1, 0, { { TU("12\\^1"), 0, 0 } }, { { TU("12"), 2, 3 } } },
/* 6*/ { 0, 1, 0, { { TU("?\\^1"), 0, 0 } }, { { TU("?\035"), 2, 3 } } },
/* 7*/ { 0, 1, 0, { { TU("1A\\^1"), 0, 0 } }, { { TU("1A\035"), 3, 3 } } },
/* 8*/ { 0, 1, 0, { { TU("\\^1\\^^1A\\^1"), 0, 0 } }, { { TU("\\^1A\035"), 5, 3 } } },
/* 9*/ { 0, 1, 5, { { TU("\\^1\\^^1A\\^1"), 0, 0 } }, { { TU("\035\\^1A\035"), 6, 5 } } },
/* 10*/ { 1, 2, 27, { { TU("\\^^A"), 0, 0 }, { TU("\\^1A\\^^1\\^1B\\^"), 0, 0 } }, { { TU("\\^^A"), 0, 0 }, { TU("\035A\\^1\035B\\^"), 9, 27 } } },
/* 11*/ { 1, 2, 0, { { TU("\\^^A"), 0, 0 }, { TU("\\^1A\\^^1\\^1B\\^"), 0, 0 } }, { { TU("\\^^A"), 0, 0 }, { TU("\035A\\^1\035B\\^"), 9, 3 } } },
};
const int data_size = ARRAY_SIZE(data);
int i, ret;
struct zint_symbol s_symbol = {0};
struct zint_symbol *symbol = &s_symbol;
char escaped[4096];
char escaped2[4096];
testStart(p_ctx->func_name);
symbol->debug = debug;
for (i = 0; i < data_size; i++) {
int expected_length;
unsigned char *expected_source;
int expected_eci = data[i].eci ? data[i].eci : 3;
int seg_idx = data[i].seg_idx;
if (testContinue(p_ctx, i)) continue;
ret = z_ct_cpy_segs(symbol, data[i].segs, data[i].seg_count);
assert_zero(ret, "i:%d z_ct_cpy_segs %d != 0\n", i, ret);
assert_nonnull(symbol->content_segs, "i:%d content_segs NULL\n", i);
z_ct_set_seg_extra_escapes_eci(symbol, seg_idx, data[i].eci);
assert_nonnull(symbol->content_segs[seg_idx].source, "i:%d content_segs[%d].source NULL\n", i, seg_idx);
expected_length = data[i].expected_content_segs[seg_idx].length;
expected_source = data[i].expected_content_segs[seg_idx].source;
assert_equal(symbol->content_segs[seg_idx].length, expected_length,
"i:%d content_segs[%d].length %d != expected_length %d\n",
i, seg_idx, symbol->content_segs[seg_idx].length, expected_length);
assert_zero(memcmp(symbol->content_segs[seg_idx].source, expected_source, expected_length),
"i:%d content_segs[%d].source memcmp(%s, %s, %d) != 0\n", i, seg_idx,
testUtilEscape(ZCCP(symbol->content_segs[seg_idx].source), symbol->content_segs[seg_idx].length,
escaped, sizeof(escaped)),
testUtilEscape(ZCCP(expected_source), expected_length, escaped2, sizeof(escaped2)),
expected_length);
assert_equal(symbol->content_segs[seg_idx].eci, expected_eci, "i:%d content_segs[%d].eci %d != expected_eci %d\n",
i, seg_idx, symbol->content_segs[seg_idx].eci, expected_eci);
ZBarcode_Clear(symbol);
}
testFinish();
}
static void test_ct_cpy_iso8859_1(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
@@ -1287,7 +1425,7 @@ static void test_ct_cpy_iso8859_1(const testCtx *const p_ctx) {
i, symbol->content_segs[0].length, expected_length);
assert_zero(memcmp(symbol->content_segs[0].source, data[i].expected, expected_length),
"i:%d content_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
testUtilEscape((const char *) symbol->content_segs[0].source, symbol->content_segs[0].length,
testUtilEscape(ZCCP(symbol->content_segs[0].source), symbol->content_segs[0].length,
escaped, sizeof(escaped)),
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
expected_length);
@@ -1355,7 +1493,7 @@ static void test_ct_printf_256(const testCtx *const p_ctx) {
i, symbol->content_segs[0].length, expected_length);
assert_zero(memcmp(symbol->content_segs[0].source, data[i].expected, expected_length),
"i:%d content_segs[0].source memcmp(%s, %s, %d) != 0\n", i,
testUtilEscape((const char *) symbol->content_segs[0].source, symbol->content_segs[0].length,
testUtilEscape(ZCCP(symbol->content_segs[0].source), symbol->content_segs[0].length,
escaped, sizeof(escaped)),
testUtilEscape(data[i].expected, expected_length, escaped2, sizeof(escaped2)),
expected_length);
@@ -1489,12 +1627,14 @@ int main(int argc, char *argv[]) {
{ "test_cnt_digits", test_cnt_digits },
{ "test_is_valid_utf8", test_is_valid_utf8 },
{ "test_utf8_to_unicode", test_utf8_to_unicode },
{ "test_extra_escapes", test_extra_escapes },
{ "test_hrt_cpy_iso8859_1", test_hrt_cpy_iso8859_1 },
{ "test_hrt_cpy_nochk", test_hrt_cpy_nochk },
{ "test_hrt_cpy_cat_nochk", test_hrt_cpy_cat_nochk },
{ "test_hrt_printf_nochk", test_hrt_printf_nochk },
{ "test_hrt_conv_gs1_brackets_nochk", test_hrt_conv_gs1_brackets_nochk },
{ "test_ct_cpy_segs", test_ct_cpy_segs },
{ "test_ct_set_seg_extra_escapes_eci", test_ct_set_seg_extra_escapes_eci },
{ "test_ct_cpy", test_ct_cpy },
{ "test_ct_cpy_iso8859_1", test_ct_cpy_iso8859_1 },
{ "test_ct_printf_256", test_ct_printf_256 },
File diff suppressed because it is too large Load Diff
+30 -15
View File
@@ -191,10 +191,10 @@ static void test_checks(const testCtx *const p_ctx) {
/*127*/ { 150, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/*128*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
/*129*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/*130*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
/*131*/ { BARCODE_CODE128, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
/*132*/ { BARCODE_MAXICODE, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
/*133*/ { BARCODE_MAXICODE, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input", -1 },
/*130*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 215: Invalid UTF-8 in input", -1 },
/*131*/ { BARCODE_CODE128, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 215: Invalid UTF-8 in input", -1 },
/*132*/ { BARCODE_MAXICODE, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 215: Invalid UTF-8 in input", -1 },
/*133*/ { BARCODE_MAXICODE, -1, "\\o200", -1, UNICODE_MODE | ESCAPE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 215: Invalid UTF-8 in input", -1 },
/*134*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) data position 14: Bad checksum '4', expected '1'", -1 },
/*135*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) data position 14: Bad checksum '4', expected '1'", -1 },
/*136*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 },
@@ -306,10 +306,10 @@ static void test_checks_segs(const testCtx *const p_ctx) {
/* 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 245: Invalid UTF-8 in input" },
/* 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 243: Input too long" },
/* 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" },
};
const int data_size = ARRAY_SIZE(data);
int i, ret;
@@ -731,9 +731,9 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
/* 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 246: 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 246: 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 246: Value of escape sequence '\\udfff' in input out of range", 0, "Surrogate" },
/* 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, "" },
@@ -755,7 +755,7 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
/* 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 246: Value of escape sequence '\\U110000' in input out of range", 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, "" },
@@ -764,11 +764,25 @@ static void test_escape_char_process(const testCtx *const p_ctx) {
/* 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_DATAMATRIX, DATA_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid for Code 128 in extra escape mode", 0, "" },
/* 81*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "" },
/* 82*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^", "", 0, 57, "(5) 104 60 62 82 106", 0, "Partial special escape '\\^' at end allowed" },
/* 83*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^D1", "", 0, 79, "(7) 104 60 62 36 17 52 106", 0, "Unknown special escapes passed straight thu" },
/* 84*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\w", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\w' in input", 0, "" },
/* 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, DATA_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, "" },
/* 82*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in extra escape mode", 0, "" },
/* 83*/ { BARCODE_DATAMATRIX, GS1_MODE, -1, "\\^11", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in extra escape mode", 0, "" },
/* 84*/ { BARCODE_DATAMATRIX, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^11", "", 0, 10, "E8 32 81 98 94 7B 7F 6D", 0, "" },
/* 85*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 717: Unrecognized extra escape \"\\^A\"", 0, "" },
/* 86*/ { 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" },
/* 87*/ { BARCODE_DATAMATRIX, UNICODE_MODE | EXTRA_ESCAPE_MODE, 18, "A\\^1B", "", 0, 12, "F1 13 42 E8 43 C3 1B 02 5A 6B 37 CC", 0, "" },
/* 88*/ { 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, "" },
/* 89*/ { 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, "" },
/* 90*/ { 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, "" },
/* 91*/ { 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, "" },
/* 92*/ { 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, "" },
/* 93*/ { 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, "" },
/* 94*/ { BARCODE_CODE128, DATA_MODE, -1, "\\^A1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 798: Escape '\\^' only valid in extra escape mode", 0, "" },
/* 95*/ { BARCODE_CODE128, DATA_MODE | EXTRA_ESCAPE_MODE, -1, "\\^A1", "", 0, 46, "(4) 103 17 17 106", 0, "" },
/* 96*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^", "", 0, 57, "(5) 104 60 62 82 106", 0, "Partial special escape '\\^' at end allowed" },
/* 97*/ { BARCODE_CODE128, EXTRA_ESCAPE_MODE, -1, "\\^D1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 348: Unrecognized extra escape \"\\^D\"", 0, "" },
/* 98*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\w", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\w' in input", 0, "" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
@@ -891,6 +905,7 @@ static void test_escape_char_process_test(const testCtx *const p_ctx) {
/* 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 },
/* 5*/ { BARCODE_DATAMATRIX, EXTRA_ESCAPE_MODE, "\\^1\\^^\\^1", 0, "\\^1\\^^\\^1", 9 },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
+106 -54
View File
@@ -2665,29 +2665,77 @@ static char *testUtilBwippCvtGS1Data(char *bwipp_data, const int bwipp_data_size
return bwipp_data;
}
/* Copied from "library.c" */
/* Returns 1 if `symbol` can process EXTRA_ESCAPE_MODE */
static int supports_extra_escape_mode(const struct zint_symbol *const symbol) {
return symbol->symbology == BARCODE_CODE128
|| (symbol->symbology == BARCODE_DATAMATRIX && (symbol->input_mode & 0x07) != GS1_MODE);
}
#define z_isxdigit(c) (z_isdigit(c) || ((c) >= 'A' && (c) <= 'F') || ((c) >= 'a' && (c) <= 'f'))
#define z_isodigit(c) ((c) <= '7' && (c) >= '0')
/* Convert data to Ghostscript format for passing to bwipp_dump.ps */
static char *testUtilBwippEscape(char *bwipp_data, const int bwipp_data_size, const char *data, const int length,
const int zint_escape_mode, const int eci, int *parse, int *parsefnc) {
static char *testUtilBwippEscape(const struct zint_symbol *const symbol, char *bwipp_data, const int bwipp_data_size,
const char *data, const int length, const int eci, int *parse, int *parsefnc) {
const int is_extra_escaped = (symbol->input_mode & EXTRA_ESCAPE_MODE) && supports_extra_escape_mode(symbol);
const int is_escaped = (symbol->input_mode & ESCAPE_MODE) || is_extra_escaped;
const int is_c128 = symbol->symbology == BARCODE_CODE128;
char *b = bwipp_data;
char *be = b + bwipp_data_size;
unsigned char *d = (unsigned char *) data;
unsigned char *de = (unsigned char *) data + length;
int have_done_single_caret = 0; /* Flag to help debug escaping of carets */
if (eci && !*parsefnc) {
if (eci) {
sprintf(bwipp_data, "^ECI%06d", eci);
*parsefnc = 1;
b = bwipp_data + 10;
}
while (b < be && d < de) {
/* Deal with extra escape sequences first */
if (is_extra_escaped && *d == '\\' && d + 1 < de && d[1] == '^'
&& (d + 2 == de || ((d[2] == '1' || d[2] == '^' || (is_c128 && d[2] >= '@' && d[2] <= 'C'))))) {
if (d + 2 == de || d[2] == '^') {
/* Literal "\^^" */
if (*parsefnc) {
if (b + 6 >= be) {
fprintf(stderr, "testUtilBwippEscape: extra escape double caret bwipp_data buffer full (%d)\n",
bwipp_data_size);
return NULL;
}
strcpy(b, "^092^^");
b += 6;
*parse = 1;
} else {
if (b + 8 >= be) {
fprintf(stderr, "testUtilBwippEscape: extra escape 094 caret bwipp_data buffer full (%d)\n",
bwipp_data_size);
return NULL;
}
strcpy(b, "^092^094");
b += 8;
*parse = 1;
}
} else if (d[2] == '1') {
if (b + 5 >= be) {
fprintf(stderr, "testUtilBwippEscape: extra escape FNC1 bwipp_data buffer full (%d)\n",
bwipp_data_size);
return NULL;
}
strcpy(b, "^FNC1");
b += 5;
*parsefnc = 1;
} else {
assert(d + 2 < de && is_c128 && d[2] >= '@' && d[2] <= 'C');
}
d += 2 + (d + 2 != de);
/* Have to escape double quote otherwise Ghostscript gives "Unterminated quote in @-file" for some reason */
/* Escape single quote also to avoid having to do proper shell escaping TODO: proper shell escaping */
if (*d < 0x20 || *d >= 0x7F || (*d == '^' && !*parsefnc) || *d == '"' || *d == '\''
|| *d == '(' || (*d == '\\' && !zint_escape_mode)) {
} else if (*d < 0x20 || *d >= 0x7F || (*d == '^' && !*parsefnc) || *d == '"' || *d == '\''
|| *d == '(' || (*d == '\\' && !is_escaped)) {
if (b + 4 >= be) {
fprintf(stderr, "testUtilBwippEscape: double quote bwipp_data buffer full (%d)\n", bwipp_data_size);
return NULL;
@@ -2710,7 +2758,7 @@ static char *testUtilBwippEscape(char *bwipp_data, const int bwipp_data_size, co
/* `parsefnc` changed while escaping (see FNC1 processing below) - may cause test to fail */
fprintf(stderr, "testUtilBwippEscape: WARNING: already escaped caret singularly\n");
}
} else if (zint_escape_mode && *d == '\\' && d + 1 < de) {
} else if (is_escaped && *d == '\\' && d + 1 < de) {
int val;
switch (*++d) {
case '0': val = 0x00; /* Null */ break;
@@ -2883,6 +2931,7 @@ static char *testUtilBwippUtf8Convert(const int index, const int symbology, cons
/* Create bwipp_dump.ps command and run */
int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int option_2, int option_3,
const char *data, int length, const char *primary, char *buffer, int buffer_size, int *p_parsefnc) {
static const char fn[] = "testUtilBwipp";
static const char cmd_fmt[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%s'"
" backend/tests/tools/bwipp_dump.ps";
static const char cmd_opts_fmt[] = "gs -dNOPAUSE -dBATCH -dNODISPLAY -q -sb=%s -sd='%s' -so='%s'"
@@ -2924,10 +2973,11 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
FILE *fp = NULL;
int cnt;
int exit_status;
char *b = buffer;
char *be = buffer + buffer_size;
int r, h;
int r;
int parse = 0, parsefnc = p_parsefnc ? *p_parsefnc : 0;
const int upcean = (ZBarcode_Cap(symbology, ZINT_CAP_EANUPC) & ZINT_CAP_EANUPC) == ZINT_CAP_EANUPC;
@@ -2944,8 +2994,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
bwipp_barcode = testUtilBwippName(index, symbol, option_1, option_2, option_3, 0, &linear_row_height, &gs1_cvt);
if (!bwipp_barcode) {
fprintf(stderr, "i:%d testUtilBwipp: no mapping for %s, option_1 %d, option_2 %d, option_3 %d\n",
index, testUtilBarcodeName(symbology), option_1, option_2, option_3);
fprintf(stderr, "i:%d %s:%d no mapping for %s, option_1 %d, option_2 %d, option_3 %d\n",
index, fn, __LINE__, testUtilBarcodeName(symbology), option_1, option_2, option_3);
return -1;
}
@@ -2956,8 +3006,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
bwipp_row_height[r] = symbol->row_height[r] ? symbol->row_height[r] : linear_row_height;
}
if ((symbol->debug & ZINT_DEBUG_TEST_PRINT) && !(symbol->debug & ZINT_DEBUG_TEST_LESS_NOISY)) {
fprintf(stderr, "bwipp_row_height[%d] %d, symbol->row_height[%d] %g\n",
r, bwipp_row_height[r], r, symbol->row_height[r]);
fprintf(stderr, "i:%d %s:%d bwipp_row_height[%d] %d, symbol->row_height[%d] %g\n",
index, fn, __LINE__, r, bwipp_row_height[r], r, symbol->row_height[r]);
}
}
@@ -2966,14 +3016,15 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
if ((symbol->input_mode & 0x07) == UNICODE_MODE && zint_is_eci_convertible(eci)
&& (data = testUtilBwippUtf8Convert(index, symbology, 1 /*try_sjis*/, &eci, (const unsigned char *) data,
&data_len, (unsigned char *) converted)) == NULL) {
fprintf(stderr, "i:%d testUtilBwipp: failed to convert UTF-8 data for %s\n",
index, testUtilBarcodeName(symbology));
fprintf(stderr, "i:%d %s:%d failed to convert UTF-8 data for %s\n",
index, fn, __LINE__, testUtilBarcodeName(symbology));
return -1;
}
if (z_is_composite(symbology)) {
if (!primary) {
fprintf(stderr, "i:%d testUtilBwipp: no primary data given %s\n", index, testUtilBarcodeName(symbology));
fprintf(stderr, "i:%d %s:%d no primary data given %s\n",
index, fn, __LINE__, testUtilBarcodeName(symbology));
return -1;
}
if (*primary != obracket && !upcean) {
@@ -3072,10 +3123,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
}
#endif
} else {
const int is_extra_escaped = (symbol->input_mode & EXTRA_ESCAPE_MODE)
&& symbol->symbology == BARCODE_CODE128;
const int is_escaped = (symbol->input_mode & ESCAPE_MODE) || is_extra_escaped;
if (testUtilBwippEscape(bwipp_data, bwipp_data_size, data, data_len, is_escaped, eci, &parse, &parsefnc)
if (testUtilBwippEscape(symbol, bwipp_data, bwipp_data_size, data, data_len, eci, &parse, &parsefnc)
== NULL) {
return -1;
}
@@ -3560,9 +3608,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
}
if ((option_1 != -1 || option_2 != -1 || option_3 != -1) && !bwipp_opts) {
fprintf(stderr,
"i:%d testUtilBwipp: no BWIPP options set option_1 %d, option_2 %d, option_3 %d for symbology %s\n",
index, option_1, option_2, option_3, testUtilBarcodeName(symbology));
fprintf(stderr, "i:%d %s:%d no BWIPP options set option_1 %d, option_2 %d, option_3 %d for symbology %s\n",
index, fn, __LINE__, option_1, option_2, option_3, testUtilBarcodeName(symbology));
return -1;
}
@@ -3607,7 +3654,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj) - 1);
}
if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39
|| symbology == BARCODE_CODABAR || symbology == BARCODE_PHARMA || symbology == BARCODE_PZN
|| symbology == BARCODE_CODABAR || symbology == BARCODE_PZN
|| symbology == BARCODE_CODE32 || symbology == BARCODE_VIN) {
/* Ratio 3 width bar/space -> 2 width */
char adj[] = " -sr=0.6";
@@ -3664,12 +3711,12 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
}
if (symbol->debug & ZINT_DEBUG_TEST_PRINT) {
printf("i:%d testUtilBwipp: cmd %s\n", index, cmd);
printf("i:%d %s cmd %s\n", index, fn, cmd);
}
fp = testutil_popen(cmd, "r");
if (!fp) {
fprintf(stderr, "i:%d testUtilBwipp: failed to run '%s'\n", index, cmd);
fprintf(stderr, "i:%d %s:%d failed to run '%s'\n", index, fn, __LINE__, cmd);
return -1;
}
@@ -3679,45 +3726,38 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
} else {
for (r = 0; r < symbol->rows; r++) {
if (b + symbol->width > be) {
fprintf(stderr, "i:%d testUtilBwipp: row %d, width %d, row width iteration overrun (%s)\n",
index, r, symbol->width, cmd);
testutil_pclose(fp);
fprintf(stderr, "i:%d %s:%d row %d, width %d, row width iteration overrun (%s)\n",
index, fn, __LINE__, r, symbol->width, cmd);
(void) testutil_pclose(fp);
return -1;
}
cnt = (int) fread(b, 1, symbol->width, fp);
if (cnt != symbol->width) {
fprintf(stderr,
"i:%d testUtilBwipp: failed to read row %d of %d, symbol->width %d bytes, cnt %d (%s)\n",
index, r + 1, symbol->rows, symbol->width, cnt, cmd);
testutil_pclose(fp);
fprintf(stderr, "i:%d %s:%d failed to read row %d of %d, symbol->width %d bytes, cnt %d (%s)\n",
index, fn, __LINE__, r + 1, symbol->rows, symbol->width, cnt, cmd);
(void) testutil_pclose(fp);
return -1;
}
b += cnt;
for (h = bwipp_row_height[r]; h > 1; h--) { /* Ignore row copies if any */
cnt = (int) fread(b, 1, symbol->width, fp);
if (cnt != symbol->width) {
fprintf(stderr,
"i:%d testUtilBwipp: failed to read/ignore symbol->width %d bytes, cnt %d, h %d"
", bwipp_row_height[%d] %d, symbol->row_height[%d] %g (%s)\n",
index, symbol->width, cnt, h, r, bwipp_row_height[r], r, symbol->row_height[r], cmd);
testutil_pclose(fp);
return -1;
}
if (h * 2 == bwipp_row_height[r]) { /* Hack to use middle row (avoids add-on text offsets) */
memcpy(b - cnt, b, cnt);
}
}
}
}
*b = '\0';
if (fgetc(fp) != EOF) {
fprintf(stderr, "i:%d testUtilBwipp: failed to read full stream (%s)\n", index, cmd);
testutil_pclose(fp);
fprintf(stderr, "i:%d %s:%d failed to read full stream (%s)\n", index, fn, __LINE__, cmd);
(void) testutil_pclose(fp);
return -1;
}
testutil_pclose(fp);
if ((exit_status = testutil_pclose(fp))) {
#ifndef _WIN32
if (WIFEXITED(exit_status)) {
exit_status = WEXITSTATUS(exit_status);
}
#endif
fprintf(stderr, "i:%d %s:%d pclose returned exit status %d (%s)\n", index, fn, __LINE__, exit_status, cmd);
return -1;
}
return 0;
}
@@ -3797,7 +3837,7 @@ int testUtilBwippSegs(int index, struct zint_symbol *symbol, int option_1, int o
total_len = (int) (d - data);
if (unicode_mode) {
symbol->input_mode = DATA_MODE;
symbol->input_mode = DATA_MODE | (symbol->input_mode & ~0x07);
}
symbol->eci = 0;
@@ -4147,6 +4187,7 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
FILE *fp = NULL;
int cnt;
int exit_status;
buffer[0] = '\0';
@@ -4192,17 +4233,25 @@ int testUtilZXingCPP(int index, struct zint_symbol *symbol, const char *source,
if (cnt == buffer_size) {
fprintf(stderr, "i:%d testUtilZXingCPP: buffer too small, %d bytes, cnt %d (%s)\n",
index, buffer_size, cnt, cmd);
testutil_pclose(fp);
(void) testutil_pclose(fp);
return -1;
}
if (fgetc(fp) != EOF) {
fprintf(stderr, "i:%d testUtilZXingCPP: failed to read full stream (%s)\n", index, cmd);
testutil_pclose(fp);
(void) testutil_pclose(fp);
return -1;
}
testutil_pclose(fp);
if ((exit_status = testutil_pclose(fp))) {
#ifndef _WIN32
if (WIFEXITED(exit_status)) {
exit_status = WEXITSTATUS(exit_status);
}
#endif
fprintf(stderr, "i:%d testUtilZXingCPP: pclose returned exit status %d (%s)\n", index, exit_status, cmd);
return -1;
}
if ((data_mode && zxingcpp_cmp > 1 && (zxingcpp_cmp == 899 || zint_is_eci_convertible(zxingcpp_cmp)))
|| symbol->eci >= 899) {
@@ -4311,7 +4360,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
const int is_dbar_nonexp = symbology == BARCODE_DBAR_OMN || symbology == BARCODE_DBAR_LTD
|| symbology == BARCODE_DBAR_OMNSTK || symbology == BARCODE_DBAR_STK;
const int gs1 = (symbol->input_mode & 0x07) == GS1_MODE || is_gs1_128_dbar_exp;
const int is_extra_escaped = (symbol->input_mode & EXTRA_ESCAPE_MODE) && symbol->symbology == BARCODE_CODE128;
const int is_extra_escaped = (symbol->input_mode & EXTRA_ESCAPE_MODE) && supports_extra_escape_mode(symbol);
const int is_escaped = (symbol->input_mode & ESCAPE_MODE) || is_extra_escaped;
const int is_hibc = symbology >= BARCODE_HIBC_128 && symbology <= BARCODE_HIBC_AZTEC;
const int have_ccheckdigit = symbol->option_2 == 1 || symbol->option_2 == 2; /* Good for C25, CODE39, CODABAR */
@@ -4360,6 +4409,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
/* Remove any Code 128 special escapes */
int j = 0;
int have_manual_ab = 0;
int have_position_fnc1 = 0;
for (i = 0; i < expected_len; i++) {
if (escaped[i] == '\\' && i + 2 < expected_len && escaped[i + 1] == '^'
&& ((escaped[i + 2] >= '@' && escaped[i + 2] <= 'C') || escaped[i + 2] == '1'
@@ -4372,11 +4422,13 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
/* FNC1 in 1st position treated as GS1 and in 2nd position AIM, neither transmitted -
need to skip AIM (single alphabetic or Code Set C double digit)
TODO: guessing about whether in Code Set C for double digit */
if (j > 2 || (j == 1 && !(z_isupper(escaped[0]) || z_islower(escaped[0])))
if (symbol->eci || have_position_fnc1 || j > 2 || (j == 1 && !z_isalpha(escaped[0]))
|| (j == 2 && !(z_isdigit(escaped[0]) && z_isdigit(escaped[1])
&& !have_manual_ab))) {
/* Probably not AIM */
escaped[j++] = 29; /* GS */
} else {
have_position_fnc1 = 1;
}
}
} else {
@@ -98,6 +98,32 @@ ret /pixs known {
pixs 0 tmppixs 0 j getinterval putinterval
} if
b (databarlimitedcomposite) eq {
% Add RHS 5-space quiet zone
/cpypixs pixs length array def
cpypixs 0 pixs 0 pixs length getinterval putinterval
/pixw pixs length pixx idiv def
/pixs [
0 pixx cpypixs length 1 sub {
/i exch def
cpypixs i pixx getinterval aload pop 0 0 0 0 0
} for
] def
/pixx pixx 5 add def
} if
b (ean13composite) eq b (ean8composite) eq or b (upcacomposite) eq or b (upcecomposite) eq or {
d (|) search {
/linear exch def
pop pop
linear ( ) search { % Have add-on?
pop pop pop
% Remove last row from pixs array which just contains add-on overhang
/pixs [ pixs 0 pixs length pixx sub getinterval aload pop ] def
} { pop } ifelse
} { pop } ifelse
} if
/xs systemdict /xs known { systemdict /xs get cvi } { 0 } ifelse def
/xe systemdict /xe known { systemdict /xe get cvi } { 0 } ifelse def
Binary file not shown.
+1 -1
View File
@@ -324,7 +324,7 @@ extern "C" {
#define FAST_MODE 0x0080 /* Use faster if less optimal encodation or other shortcuts if available */
/* (affects AZTEC, DATAMATRIX, MICROPDF417, PDF417, QRCODE & UPNQR only) */
#define EXTRA_ESCAPE_MODE 0x0100 /* Process special symbology-specific escape sequences as well as others */
/* Note: currently Code 128 only */
/* Note: currently Code 128 and Data Matrix only */
#define GS1SYNTAXENGINE_MODE 0x0200 /* Use the GS1 Syntax Engine (if available) to strictly validate GS1 input */
#define GS1RAW_MODE 0x0400 /* Process GS1 data literally (no AI delimiters), parsing GSs as FNC1s */
+1 -1
View File
@@ -577,7 +577,7 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n"
" -eci choice: ECI to use\n"
/* cli option --embedfont not supported (vector output only) */
" -esc bool: process escape sequences in input data\n"
" -extraesc bool: process symbology-specific escape sequences (Code 128 only)\n"
" -extraesc bool: process symbology-specific escape sequences (Code 128 and Data Matrix only)\n"
" -fast bool: use fast encodation (Aztec, Data Matrix, MicroPDF417, PDF417, QR, UPNQR)\n"
" -fg color: set foreground color as 6 or 8 hex rrggbbaa\n"
/* replaces cli options --binary and --gs1 */
+218 -144
View File
@@ -334,7 +334,7 @@
<h1 class="title">Zint Barcode Generator and Zint Barcode Studio User
Manual</h1>
<p class="author">Version 2.16.0.9</p>
<p class="date">March 2026</p>
<p class="date">April 2026</p>
</header>
<nav id="TOC" role="doc-toc">
<ul>
@@ -1491,10 +1491,58 @@ is hexadecimal (000000-10FFFF)</td>
</tr>
</tbody>
</table>
<p>(Special escape sequences are available for Code 128 only to manually
switch Code Sets and insert special <code>FNC1</code> characters - see
<a href="#standard-code-128-iso-15417">6.1.10.1 Standard Code 128 (ISO
15417)</a> for details.)</p>
<p>Extra escape sequences are available for certain symbologies using
the <code>--extraesc</code> option that allows the insertion of special
characters or, in the case of Code 128 only, to manually switch Code
Sets. Extra escapes begin with the sequence backslash caret
(“<code>\^</code>”):</p>
<table id="tbl:extra_escapes">
<caption><span class="table-label">Table 3:</span> Extra Escape
Sequences</caption>
<colgroup>
<col style="width: 27%" />
<col style="width: 41%" />
<col style="width: 31%" />
</colgroup>
<thead>
<tr>
<th style="text-align: left;">Extra Escape Sequence</th>
<th style="text-align: left;">Interpretation</th>
<th>Available for Symbology</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;"><code>\^1</code></td>
<td style="text-align: left;">Insert <code>FNC1</code> character</td>
<td>Code128, Data Matrix</td>
</tr>
<tr>
<td style="text-align: left;"><code>\^^</code></td>
<td style="text-align: left;">Literal <code>\^</code></td>
<td>Code128, Data Matrix</td>
</tr>
<tr>
<td style="text-align: left;"><code>\^A</code>, <code>\^B</code>,
<code>\^C</code></td>
<td style="text-align: left;">Select Code Set A, B or C
respectively</td>
<td>Code128 only</td>
</tr>
<tr>
<td style="text-align: left;"><code>\^@</code></td>
<td style="text-align: left;">Exit manual Code Set selection and resume
automatic Code Set selection</td>
<td>Code128 only</td>
</tr>
</tbody>
</table>
<p>Currently the only special character recognized is the Function Code
1 character <code>FNC1</code>. If your data contains the sequence
<code>\^</code>” then it must be escaped using the extra escape
sequence “<code>\^^</code>”, i.e. by doubling the caret.</p>
<p>See <a href="#standard-code-128-iso-15417">6.1.10.1 Standard Code 128
(ISO 15417)</a> for the details on manually switching Code Sets.</p>
<p>Input data can be read directly from file using the <code>-i</code>
or <code>--input</code> switch as shown below. The input file is assumed
to be UTF-8 formatted unless an alternative mode is selected. This
@@ -1521,7 +1569,7 @@ types:</p>
class="sourceCode bash"><code class="sourceCode bash"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-o</span> there.eps <span class="at">-d</span> <span class="st">&quot;This Text&quot;</span></span></code></pre></div>
<p>The currently supported output file formats are:</p>
<table id="tbl:output_file_formats">
<caption><span class="table-label">Table 3:</span> Output File
<caption><span class="table-label">Table 4:</span> Output File
Formats</caption>
<thead>
<tr>
@@ -1588,7 +1636,7 @@ class="sourceCode bash"><code class="sourceCode bash"><span id="cb22-1"><a href=
<p>Names are treated case-insensitively by the CLI, and the
<code>BARCODE_</code> prefix and any underscores are optional.</p>
<table id="tbl:barcode_types">
<caption><span class="table-label">Table 4:</span> Barcode Types
<caption><span class="table-label">Table 5:</span> Barcode Types
(Symbologies)</caption>
<colgroup>
<col style="width: 11%" />
@@ -2334,7 +2382,7 @@ X-dimension of 0.2 (or for MaxiCode EMF output, 4). The maximum scale
for both raster and vector is 200.</p>
<p>To summarize the more intricate details:</p>
<table id="tbl:scaling_multipliers" style="width:92%;">
<caption><span class="table-label">Table 5:</span> Scaling Multipliers
<caption><span class="table-label">Table 6:</span> Scaling Multipliers
and Minima</caption>
<colgroup>
<col style="width: 15%" />
@@ -2491,7 +2539,7 @@ Chinese (Hanzi) characters which are also converted from UTF-8.</p>
default character set is GB 2312 (Chinese); and UPNQR, whose default
character set is Latin-2 (ISO/IEC 8859-2 plus ASCII).</p>
<table id="tbl:default_character_sets">
<caption><span class="table-label">Table 6:</span> Default Character
<caption><span class="table-label">Table 7:</span> Default Character
Sets</caption>
<thead>
<tr>
@@ -2626,11 +2674,11 @@ behaviour.</p>
<p>If your data contains characters that are not in the default
character set, you may encode it using an ECI-aware symbology and an ECI
value from <span class="cross-ref-group"><a href="#tbl:eci_codes"
class="cross-ref">Table 8: ECI Codes</a></span> below. The ECI
class="cross-ref">Table 9: ECI Codes</a></span> below. The ECI
information is added to your code symbol as prefix data. The symbologies
that support ECI are:</p>
<table id="tbl:eci_aware_symbologies">
<caption><span class="table-label">Table 7:</span> ECI-Aware
<caption><span class="table-label">Table 8:</span> ECI-Aware
Symbologies</caption>
<tbody>
<tr>
@@ -2661,7 +2709,7 @@ followed by the value in the column <code>"ECI Code"</code> in the table
below. The input data should be UTF-8 formatted. Zint automatically
translates the data into the target encoding.</p>
<table id="tbl:eci_codes">
<caption><span class="table-label">Table 8:</span> ECI Codes</caption>
<caption><span class="table-label">Table 9:</span> ECI Codes</caption>
<thead>
<tr>
<th>ECI Code</th>
@@ -2809,7 +2857,7 @@ role="doc-noteref"><sup>9</sup></a></td>
symbol (unless the data contains non-default character set characters).
In this case, the default character set applies (see <span
class="cross-ref-group"><a href="#tbl:default_character_sets"
class="cross-ref">Table 6: Default Character Sets</a></span> above).</p>
class="cross-ref">Table 7: Default Character Sets</a></span> above).</p>
<p>If no ECI is specified or a value of 0 is given, and the data does
contain characters other than in the default character set, then Zint
will automatically insert the appropriate single-byte ECI if possible
@@ -2892,7 +2940,7 @@ alt="zint -b QRCODE --binary -d &quot;\xE2\x82\xAC\xE5\xB8\xB8&quot; --esc" />
Options</h3>
<p>The following symbologies accept GS1 data:</p>
<table>
<caption><span class="table-label">Table 9:</span> GS1-Enabled
<caption><span class="table-label">Table 10:</span> GS1-Enabled
Symbologies</caption>
<thead>
<tr>
@@ -3084,7 +3132,7 @@ you that there is a problem.</p>
behaviour specify the <code>-o</code> option using special characters in
the output filename as shown in the table below:</p>
<table id="tbl:batch_filename_formatting">
<caption><span class="table-label">Table 10:</span> Batch Filename
<caption><span class="table-label">Table 11:</span> Batch Filename
Formatting</caption>
<thead>
<tr>
@@ -3117,7 +3165,7 @@ Formatting</caption>
class="sourceCode bash"><code class="sourceCode bash"><span id="cb55-1"><a href="#cb55-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> EAN13 <span class="at">--batch</span> <span class="at">-i</span> ean13nos.txt <span class="at">-o</span> <span class="st">&quot;file~~~.svg&quot;</span></span></code></pre></div>
<p>The following table shows some examples to clarify this method:</p>
<table id="tbl:batch_filename_examples">
<caption><span class="table-label">Table 11:</span> Batch Filename
<caption><span class="table-label">Table 12:</span> Batch Filename
Examples</caption>
<thead>
<tr>
@@ -3156,7 +3204,7 @@ Examples</caption>
<p>The special characters can span directories also, which is useful
when creating a large number of barcodes:</p>
<table id="tbl:batch_dir_examples">
<caption><span class="table-label">Table 12:</span> Batch Directory
<caption><span class="table-label">Table 13:</span> Batch Directory
Examples</caption>
<thead>
<tr>
@@ -3192,7 +3240,7 @@ required. For example:</p>
class="sourceCode bash"><code class="sourceCode bash"><span id="cb56-1"><a href="#cb56-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> MICROPDF417 <span class="at">--direct</span> <span class="at">--filetype</span><span class="op">=</span>pcx <span class="at">-d</span> <span class="st">&quot;Data to encode&quot;</span></span></code></pre></div>
<p>This command will output the symbol as a PCX file to stdout. For the
supported output file formats see <span class="cross-ref-group"><a
href="#tbl:output_file_formats" class="cross-ref">Table 3: Output File
href="#tbl:output_file_formats" class="cross-ref">Table 4: Output File
Formats</a></span>.</p>
<hr />
<p>CAUTION: Outputting binary files to the command shell without
@@ -3236,7 +3284,7 @@ alt="zint -b CODEONE -d &quot;123456789012345678&quot; --dotty --vers=9" />
input data, the <code>--seg1</code> to <code>--seg9</code> options can
be used. Each option is of the form <code>--segN=ECI,data</code> where
<code>ECI</code> is the ECI code (see <span class="cross-ref-group"><a
href="#tbl:eci_codes" class="cross-ref">Table 8: ECI Codes</a></span>)
href="#tbl:eci_codes" class="cross-ref">Table 9: ECI Codes</a></span>)
and <code>data</code> is the data to which this applies. This is in
addition to the ECI and data specified using the <code>--eci</code> and
<code>-d</code> options which must still be present and which in effect
@@ -3248,7 +3296,7 @@ ECI 7 (Cyrillic), and segment 2 with ECI 20 (Shift JIS). Segments must
be consecutive.</p>
<p>Naturally the symbology must be ECI-aware (see <span
class="cross-ref-group"><a href="#tbl:eci_aware_symbologies"
class="cross-ref">Table 7: ECI-Aware Symbologies</a></span>).</p>
class="cross-ref">Table 8: ECI-Aware Symbologies</a></span>).</p>
<figure>
<img src="images/aztec_segs.svg" class="i2d"
alt="zint -b AZTEC --eci=9 -d &quot;Κείμενο&quot; --seg1=7,&quot;Текст&quot; --seg2=20,&quot;文章&quot;" />
@@ -3569,7 +3617,7 @@ is by altering the contents of the <code>zint_symbol</code> structure
between the creation and encoding stages. The <code>zint_symbol</code>
structure consists of the following members:</p>
<table id="tbl:api_structure_zint_symbol">
<caption><span class="table-label">Table 13:</span> API Structure
<caption><span class="table-label">Table 14:</span> API Structure
<code>zint_symbol</code></caption>
<colgroup>
<col style="width: 26%" />
@@ -3913,7 +3961,7 @@ back to the calling application. In addition the <code>errtxt</code>
member is set to a message detailing the nature of the error. The errors
generated by Zint are:</p>
<table id="tbl:api_warnings_errors">
<caption><span class="table-label">Table 14:</span> API Warning and
<caption><span class="table-label">Table 15:</span> API Warning and
Error Return Values</caption>
<colgroup>
<col style="width: 39%" />
@@ -4054,7 +4102,7 @@ below:</p>
<h2 id="specifying-a-symbology">5.9 Specifying a Symbology</h2>
<p>Symbologies can be specified by number or by name as listed in <span
class="cross-ref-group"><a href="#tbl:barcode_types"
class="cross-ref">Table 4: Barcode Types (Symbologies)</a></span>. For
class="cross-ref">Table 5: Barcode Types (Symbologies)</a></span>. For
example</p>
<div class="sourceCode" id="cb74"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb74-1"><a href="#cb74-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-&gt;</span>symbology <span class="op">=</span> BARCODE_LOGMARS<span class="op">;</span></span></code></pre></div>
<h2 id="adjusting-output-options">5.10 Adjusting Output Options</h2>
@@ -4064,7 +4112,7 @@ table below simply <code>OR</code> them together when adjusting this
value:</p>
<div class="sourceCode" id="cb75"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb75-1"><a href="#cb75-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-&gt;</span>output_options <span class="op">|=</span> BARCODE_BIND <span class="op">|</span> READER_INIT<span class="op">;</span></span></code></pre></div>
<table id="tbl:api_output_options">
<caption><span class="table-label">Table 15:</span> API
<caption><span class="table-label">Table 16:</span> API
<code>output_options</code> Values</caption>
<colgroup>
<col style="width: 34%" />
@@ -4184,7 +4232,7 @@ href="#feedback">5.16 Feedback</a>).</td>
<p>The way in which the input data is encoded can be set using the
<code>input_mode</code> member:</p>
<table id="tbl:api_input_mode">
<caption><span class="table-label">Table 16:</span> API
<caption><span class="table-label">Table 17:</span> API
<code>input_mode</code> Values</caption>
<colgroup>
<col style="width: 30%" />
@@ -4249,7 +4297,7 @@ other shortcuts if available (affects <code>AZTEC</code>,
<tr>
<td style="text-align: left;"><code>EXTRA_ESCAPE_MODE</code></td>
<td style="text-align: left;">Process special symbology-specific escape
sequences (<code>CODE128</code> only).</td>
sequences (<code>CODE128</code> and <code>DATAMATRIX</code> only).</td>
</tr>
<tr>
<td style="text-align: left;"><code>GS1SYNTAXENGINE_MODE</code></td>
@@ -4282,10 +4330,10 @@ optional. So, for example, you can set</p>
<p>is not valid.</p>
<p>Permissible escape sequences (<code>ESCAPE_MODE</code>) are listed in
<span class="cross-ref-group"><a href="#tbl:escape_sequences"
class="cross-ref">Table 2: Escape Sequences</a></span>, and the special
Code 128-only <code>EXTRA_ESCAPE_MODE</code> escape sequences are given
in <a href="#standard-code-128-iso-15417">6.1.10.1 Standard Code 128
(ISO 15417)</a>.</p>
class="cross-ref">Table 2: Escape Sequences</a></span>, and the extra
escape sequences (<code>EXTRA_ESCAPE_MODE</code>) are listed in <span
class="cross-ref-group"><a href="#tbl:extra_escapes"
class="cross-ref">Table 3: Extra Escape Sequences</a></span>.</p>
<p>The GS1 options <code>GS1PARENS_MODE</code> (CLI
<code>--gs1parens</code>) , <code>GS1NOCHECK_MODE</code> (CLI
<code>--gs1nocheck</code>), <code>GS1SYNTAXENGINE_MODE</code> (CLI
@@ -4333,7 +4381,7 @@ contains. The <code>zint_seg</code> structure is of the form:</p>
<span id="cb80-5"><a href="#cb80-5" aria-hidden="true" tabindex="-1"></a> <span class="dt">int</span> eci<span class="op">;</span> <span class="co">/* Extended Channel Interpretation */</span></span>
<span id="cb80-6"><a href="#cb80-6" aria-hidden="true" tabindex="-1"></a><span class="op">};</span></span></code></pre></div>
<p>The symbology must support ECIs (see <span class="cross-ref-group"><a
href="#tbl:eci_aware_symbologies" class="cross-ref">Table 7: ECI-Aware
href="#tbl:eci_aware_symbologies" class="cross-ref">Table 8: ECI-Aware
Symbologies</a></span>). For example:</p>
<div class="sourceCode" id="cb81"><pre class="sourceCode c"><code class="sourceCode c"><span id="cb81-1"><a href="#cb81-1" aria-hidden="true" tabindex="-1"></a><span class="pp">#include </span><span class="im">&lt;zint.h&gt;</span></span>
<span id="cb81-2"><a href="#cb81-2" aria-hidden="true" tabindex="-1"></a><span class="dt">int</span> main<span class="op">(</span><span class="dt">int</span> argc<span class="op">,</span> <span class="dt">char</span> <span class="op">**</span>argv<span class="op">)</span></span>
@@ -4423,7 +4471,7 @@ symbology. This can be determined using another additional function:</p>
<p>by <code>OR</code>-ing the flags below in the <code>cap_flag</code>
argument and checking the return to see which are set.</p>
<table id="tbl:api_cap">
<caption><span class="table-label">Table 17:</span> API Capability
<caption><span class="table-label">Table 18:</span> API Capability
Flags</caption>
<colgroup>
<col style="width: 35%" />
@@ -4541,7 +4589,7 @@ class="footnote-ref" id="fnref19" role="doc-noteref"><sup>19</sup></a>
return the actual ECC percentage used in <code>option_1</code> as
<code>P &lt;&lt; 8</code>, where P is the integer percentage, the low
byte containing the values given in <span class="cross-ref-group"><a
href="#tbl:aztec_eccs" class="cross-ref">Table 40: Aztec Code Error
href="#tbl:aztec_eccs" class="cross-ref">Table 41: Aztec Code Error
Correction Modes</a></span> (with the addition of <code>0</code> meaning
less than 5% + 3 codewords and <code>-1</code> meaning minimum 3
codewords). Micro PDF417 also will return the ECC percentage in
@@ -4692,8 +4740,8 @@ alt="zint -b C25INTER --compliantheight -d &quot;9212320967&quot;" />
<p>No check digit is added by default, but can be set the same as for <a
href="#standard-code-2-of-5">6.1.2.1 Standard Code 2 of 5</a>.</p>
<h4 id="code-2-of-5-data-logic">6.1.2.5 Code 2 of 5 Data Logic</h4>
<p>Data Logic does not include a check digit by default and can encode
numeric input (digits 0-9) up to a maximum of 113 digits.</p>
<p>Data Logic can encode numeric input (digits 0-9) up to a maximum of
113 digits.</p>
<figure>
<img src="images/c25logic.svg" class="lin"
alt="zint -b C25LOGIC -d &quot;9212320967&quot;" />
@@ -5003,7 +5051,7 @@ alt="zint -b MSI_PLESSEY -d &quot;6502&quot; --vers=2" />
setting <code>--vers</code> (API <code>option_2</code>), shown in the
table below:</p>
<table id="tbl:msi_plessey_check_digits">
<caption><span class="table-label">Table 18:</span> MSI Plessey Check
<caption><span class="table-label">Table 19:</span> MSI Plessey Check
Digit Options</caption>
<thead>
<tr>
@@ -5048,9 +5096,9 @@ Digit Options</caption>
digits.</p>
<h3 id="telepen">6.1.6 Telepen</h3>
<h4 id="telepen-alpha">6.1.6.1 Telepen Alpha</h4>
<p>Telepen Alpha was developed 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.</p>
<p>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.</p>
<figure>
<img src="images/telepen.svg" class="lin"
alt="zint -b TELEPEN --compliantheight -d &quot;Z80&quot;" />
@@ -5230,29 +5278,34 @@ Zint supports the encoding of ISO/IEC 8859-1 (non-English) characters in
Code 128 symbols. The ISO/IEC 8859-1 character set is shown in Annex <a
href="#a.2-latin-alphabet-no.-1-isoiec-8859-1">A.2 Latin Alphabet No. 1
(ISO/IEC 8859-1)</a>.</p>
<p>Manual switching of Code Sets is possible using the
<p>Manual insertion of <code>FNC1</code> is possible using the
<code>--extraesc</code> option (API
<code>input_mode |= EXTRA_ESCAPE_MODE</code>), which apart from
processing normal escape sequences also processes the Code 128-specific
escapes <code>\^A</code>, <code>\^B</code>, <code>\^C</code> and
processing normal escape sequences also processes the extra escape
sequences given in <span class="cross-ref-group"><a
href="#tbl:extra_escapes" class="cross-ref">Table 3: Extra Escape
Sequences</a></span>. For instance</p>
<div class="sourceCode" id="cb106"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb106-1"><a href="#cb106-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> CODE128 <span class="at">-d</span> <span class="st">&quot;A\^1BC\^1DEF&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
<p>encodes the data <code>"A&lt;FNC1&gt;BC&lt;FNC1&gt;DEF"</code>, where
<code>&lt;FNC1&gt;</code> represents the <code>FNC1</code>
character.</p>
<p>If the data contains an extra escape sequence, it can be escaped by
doubling the caret (<code>^</code>). For instance</p>
<div class="sourceCode" id="cb107"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb107-1"><a href="#cb107-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> CODE128 <span class="at">-d</span> <span class="st">&quot;A\^1BC\^^1DEF&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
<p>will encode the data <code>"A&lt;FNC1&gt;BC\^1DEF"</code>.</p>
<p>Manual switching of Code Sets is possible using the Code 128-specific
extra escapes <code>\^A</code>, <code>\^B</code>, <code>\^C</code> and
<code>\^@</code> (the latter turns off manual Code Set selection). For
instance the following will force switching to Code Set B for the data
<code>"5678"</code> (normally Code Set C would be used throughout):</p>
<div class="sourceCode" id="cb106"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb106-1"><a href="#cb106-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> CODE128 <span class="at">-d</span> <span class="st">&quot;1234\^B5678&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
<div class="sourceCode" id="cb108"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb108-1"><a href="#cb108-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> CODE128 <span class="at">-d</span> <span class="st">&quot;1234\^B5678&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
<p>The manually selected Code Set will apply until the next Code Set
escape sequence or until a <code>\^@</code>, with the exception that
data that cannot be represented in that Code Set will be switched as
appropriate. If the data contains an extra escape sequence, it can be
escaped by doubling the caret (<code>^</code>). For instance</p>
<div class="sourceCode" id="cb107"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb107-1"><a href="#cb107-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> CODE128 <span class="at">-d</span> <span class="st">&quot;\^AABC\^^BDEF&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
<p>will encode the data <code>"ABC\^BDEF"</code> in Code Set A.</p>
<p>There is also the extra escape <code>\^1</code>, which will encode a
special Function Code 1 character (<code>FNC1</code>) anywhere you
choose in the data, for instance</p>
<div class="sourceCode" id="cb108"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb108-1"><a href="#cb108-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> CODE128 <span class="at">-d</span> <span class="st">&quot;A\^1BC\^1DEF&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
appropriate.</p>
<p>Zint can encode a maximum of 102 symbol characters, which allows for
e.g. 202 all-numeric or 101 all-uppercase characters. Sizes above 120
digits (60 alphanumerics) are not recommended.</p>
@@ -5342,7 +5395,7 @@ usually be <code>"%"</code> (ASCII 37). If 27 characters are supplied,
“relabel”, see below). The rest of the 27-character input must be
alphanumeric, and is of the form:</p>
<table id="tbl:dpd_input_fields">
<caption><span class="table-label">Table 19:</span> DPD Input
<caption><span class="table-label">Table 20:</span> DPD Input
Fields</caption>
<colgroup>
<col style="width: 26%" />
@@ -5490,7 +5543,7 @@ alt="zint -b CHANNEL -d &quot;453678&quot; --compliantheight" />
<p>The maximum values permitted depend on the number of channels used as
shown in the table below:</p>
<table id="tbl:channel_maxima">
<caption><span class="table-label">Table 20:</span> Channel Value
<caption><span class="table-label">Table 21:</span> Channel Value
Ranges</caption>
<thead>
<tr>
@@ -5780,7 +5833,7 @@ pattern. The type of linear component to be used is determined using the
<code>symbology</code>) as with other encoding methods. Valid values are
shown below.</p>
<table id="tbl:composite_symbologies">
<caption><span class="table-label">Table 21:</span> GS1 Composite
<caption><span class="table-label">Table 22:</span> GS1 Composite
Symbology Values</caption>
<colgroup>
<col style="width: 11%" />
@@ -6035,7 +6088,7 @@ input data. Reed-Solomon error correction data is generated by Zint.
Encoding behaviour is determined by the length of the input data
according to the formula shown in the following table.</p>
<table id="tbl:auspost_input_formats" style="width:86%;">
<caption><span class="table-label">Table 22:</span> Australia Post Input
<caption><span class="table-label">Table 23:</span> Australia Post Input
Formats</caption>
<colgroup>
<col style="width: 13%" />
@@ -6157,7 +6210,7 @@ alt="zint -b MAILMARK_4S --compliantheight -d &quot;21B2254800659JW5O9QA6Y&quot;
respectively. The rules for the input data are complex, as summarized in
the following table.</p>
<table id="tbl:mailmark_4s_input_fields">
<caption><span class="table-label">Table 23:</span> Royal Mail 4-State
<caption><span class="table-label">Table 24:</span> Royal Mail 4-State
Mailmark Input Fields</caption>
<colgroup>
<col style="width: 11%" />
@@ -6191,7 +6244,7 @@ Mailmark Input Fields</caption>
<p>The 6 Destination+DPS (Destination Post Code plus Delivery Point
Suffix) patterns are:</p>
<table id="tbl:mailmark_4s_destination_dps">
<caption><span class="table-label">Table 24:</span> Royal Mail 4-State
<caption><span class="table-label">Table 25:</span> Royal Mail 4-State
Mailmark Destination+DPS Patterns</caption>
<tbody>
<tr>
@@ -6291,7 +6344,7 @@ ID (<code>BARCODE_HIBC_DM</code>) can be used to encode Health Industry
Barcode (HIBC) data. Note that only ECC 200 symbols are supported, the
older standards (ECC 000 to 140) have now been removed from Zint.</p>
<table id="tbl:datamatrix_sizes">
<caption><span class="table-label">Table 25:</span> Data Matrix
<caption><span class="table-label">Table 26:</span> Data Matrix
Sizes</caption>
<thead>
<tr>
@@ -6416,7 +6469,7 @@ symbols (versions 1-24) at the command line by using the option
<p>Data Matrix Rectangular Extension (ISO/IEC 21471) codes may be
generated with the following values as before:</p>
<table id="tbl:dmre_sizes">
<caption><span class="table-label">Table 26:</span> DMRE Sizes</caption>
<caption><span class="table-label">Table 27:</span> DMRE Sizes</caption>
<thead>
<tr>
<th>Input</th>
@@ -6498,6 +6551,22 @@ option <code>--dmre</code> (API <code>option_3 = DM_DMRE</code>).</p>
<code>GS</code> (Group Separator, ASCII 29) as separator. Use the option
<code>--gssep</code> to change to <code>GS</code> (API
<code>output_options |= GS1_GS_SEPARATOR</code>).</p>
<p>Manual insertion of <code>FNC1</code> is possible using the
<code>--extraesc</code> option (API
<code>input_mode |= EXTRA_ESCAPE_MODE</code>), which apart from
processing normal escape sequences also processes the extra escape
sequences given in <span class="cross-ref-group"><a
href="#tbl:extra_escapes" class="cross-ref">Table 3: Extra Escape
Sequences</a></span>. For instance</p>
<div class="sourceCode" id="cb118"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb118-1"><a href="#cb118-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> DATAMATRIX <span class="at">-d</span> <span class="st">&quot;A\^1BC\^1DEF&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
<p>encodes the data <code>"A&lt;FNC1&gt;BC&lt;FNC1&gt;DEF"</code>, where
<code>&lt;FNC1&gt;</code> represents the <code>FNC1</code> character. If
the data contains an extra escape sequence, it can be escaped by
doubling the caret (<code>^</code>), i.e. <code>"\^^"</code> encodes
<code>"\^"</code>. Note that if using ECIs with manual FNC1s then the
ECIs must be ASCII compatible.<a href="#fn24" class="footnote-ref"
id="fnref24" role="doc-noteref"><sup>24</sup></a></p>
<p>By default Zint uses a “de facto” codeword placement for symbols of
size 144 x 144 (version 24). To override this and use the now clarified
ISO/IEC standard placement, use option <code>--dmiso144</code> (API
@@ -6536,7 +6605,7 @@ href="#royal-mail-4-state-mailmark">6.5.4 Royal Mail 4-State
Mailmark</a>, and offers space for customer data following an initial
pre-formatted 45 character section, as summarized below.</p>
<table id="tbl:mailmark_2d_input_fields">
<caption><span class="table-label">Table 27:</span> Royal Mail 2D
<caption><span class="table-label">Table 28:</span> Royal Mail 2D
Mailmark Input Fields</caption>
<thead>
<tr>
@@ -6609,7 +6678,7 @@ alphabetic limitation (<code>'L'</code> versus <code>'A'</code>) does
not apply, only the initial “outward” part is required (the rest can be
blank), and the whole field can be blank:</p>
<table id="tbl:mailmark_2d_destination_dps">
<caption><span class="table-label">Table 28:</span> Royal Mail 2D
<caption><span class="table-label">Table 29:</span> Royal Mail 2D
Mailmark Destination+DPS Patterns</caption>
<tbody>
<tr>
@@ -6636,7 +6705,7 @@ Mailmark Destination+DPS Patterns</caption>
except without the DPS (<code>'NA'</code>), and the trailing “inward”
part cannot be blank (although the whole field can be):</p>
<table id="tbl:mailmark_2d_rts">
<caption><span class="table-label">Table 29:</span> Royal Mail 2D
<caption><span class="table-label">Table 30:</span> Royal Mail 2D
Mailmark RTS Patterns</caption>
<tbody>
<tr>
@@ -6652,7 +6721,7 @@ Mailmark RTS Patterns</caption>
<p>Three sizes are defined, one rectangular, with varying maximum
amounts of optional customer data:</p>
<table id="tbl:mailmark_2d_sizes">
<caption><span class="table-label">Table 30:</span> Royal Mail 2D
<caption><span class="table-label">Table 31:</span> Royal Mail 2D
Mailmark Sizes</caption>
<thead>
<tr>
@@ -6707,7 +6776,7 @@ alt="zint -b QRCODE -d &quot;QR Code Symbol&quot; --mask=5" />
<code>--secure</code> option (API <code>option_1</code>) as shown in the
following table.</p>
<table id="tbl:qrcode_eccs">
<caption><span class="table-label">Table 31:</span> QR Code ECC
<caption><span class="table-label">Table 32:</span> QR Code ECC
Levels</caption>
<thead>
<tr>
@@ -6749,7 +6818,7 @@ Levels</caption>
version required (1-40). The size of symbol generated is shown in the
table below.</p>
<table id="tbl:qrcode_sizes">
<caption><span class="table-label">Table 32:</span> QR Code
<caption><span class="table-label">Table 33:</span> QR Code
Sizes</caption>
<thead>
<tr>
@@ -6926,8 +6995,8 @@ be manually specified by using the <code>--mask</code> switch with
values 0-7, or in the API by setting
<code>option_3 = (N + 1) &lt;&lt; 8</code> where N is 0-7. To use with
<code>ZINT_FULL_MULTIBYTE</code> set</p>
<div class="sourceCode" id="cb118"><pre
class="sourceCode c"><code class="sourceCode c"><span id="cb118-1"><a href="#cb118-1" aria-hidden="true" tabindex="-1"></a>option_3 <span class="op">=</span> ZINT_FULL_MULTIBYTE <span class="op">|</span> <span class="op">(</span>N <span class="op">+</span> <span class="dv">1</span><span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">8</span></span></code></pre></div>
<div class="sourceCode" id="cb119"><pre
class="sourceCode c"><code class="sourceCode c"><span id="cb119-1"><a href="#cb119-1" aria-hidden="true" tabindex="-1"></a>option_3 <span class="op">=</span> ZINT_FULL_MULTIBYTE <span class="op">|</span> <span class="op">(</span>N <span class="op">+</span> <span class="dv">1</span><span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">8</span></span></code></pre></div>
<p>The <code>--fast</code> option (API
<code>input_mode |= FAST_MODE</code>) may be used when leaving Zint to
automatically select a mask to reduce the number of masks to try to four
@@ -6955,7 +7024,7 @@ alt="zint -b MICROQR -d &quot;01234567&quot;" />
table below. Note that versions M1 and M2 have restrictions on what
characters can be encoded.</p>
<table id="tbl:micrqr_sizes" style="width:93%;">
<caption><span class="table-label">Table 33:</span> Micro QR Code
<caption><span class="table-label">Table 34:</span> Micro QR Code
Sizes</caption>
<colgroup>
<col style="width: 11%" />
@@ -7006,7 +7075,7 @@ codewords can be adjusted using the <code>--secure</code> option (API
<code>option_1</code>); however ECC level H is not available for any
version, and ECC level Q is only available for version M4:</p>
<table id="tbl:micrqr_eccs" style="width:99%;">
<caption><span class="table-label">Table 34:</span> Micro QR ECC
<caption><span class="table-label">Table 35:</span> Micro QR ECC
Levels</caption>
<colgroup>
<col style="width: 12%" />
@@ -7059,8 +7128,8 @@ be manually specified by using the <code>--mask</code> switch with
values 0-3, or in the API by setting
<code>option_3 = (N + 1) &lt;&lt; 8</code> where N is 0-3. To use with
<code>ZINT_FULL_MULTIBYTE</code> set</p>
<div class="sourceCode" id="cb119"><pre
class="sourceCode c"><code class="sourceCode c"><span id="cb119-1"><a href="#cb119-1" aria-hidden="true" tabindex="-1"></a>option_3 <span class="op">=</span> ZINT_FULL_MULTIBYTE <span class="op">|</span> <span class="op">(</span>N <span class="op">+</span> <span class="dv">1</span><span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">8</span></span></code></pre></div>
<div class="sourceCode" id="cb120"><pre
class="sourceCode c"><code class="sourceCode c"><span id="cb120-1"><a href="#cb120-1" aria-hidden="true" tabindex="-1"></a>option_3 <span class="op">=</span> ZINT_FULL_MULTIBYTE <span class="op">|</span> <span class="op">(</span>N <span class="op">+</span> <span class="dv">1</span><span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">8</span></span></code></pre></div>
<h3 id="rectangular-micro-qr-code-rmqr-iso-23941">6.6.5 Rectangular
Micro QR Code (rMQR) (ISO 23941)</h3>
<p>A rectangular version of QR Code, rMQR supports encoding of GS1 data,
@@ -7077,7 +7146,7 @@ alt="zint -b RMQR -d &quot;0123456&quot;" />
<code>--secure</code> option (API <code>option_1</code>), however only
ECC levels M and H are valid for this type of symbol.</p>
<table id="tbl:rmqr_eccs">
<caption><span class="table-label">Table 35:</span> rMQR ECC
<caption><span class="table-label">Table 36:</span> rMQR ECC
Levels</caption>
<thead>
<tr>
@@ -7107,7 +7176,7 @@ Levels</caption>
table below. Input values between 33 and 38 fix the height of the symbol
while allowing Zint to determine the minimum symbol width.</p>
<table id="tbl:rmqr_sizes">
<caption><span class="table-label">Table 36:</span> rMQR Sizes</caption>
<caption><span class="table-label">Table 37:</span> rMQR Sizes</caption>
<colgroup>
<col style="width: 9%" />
<col style="width: 12%" />
@@ -7325,8 +7394,8 @@ or if your data is already Latin-2 formatted use the
<code>input_mode = DATA_MODE</code>).</p>
<p>The following example creates a symbol from data saved as a Latin-2
file:</p>
<div class="sourceCode" id="cb120"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb120-1"><a href="#cb120-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-o</span> upnqr.png <span class="at">-b</span> UPNQR <span class="at">--scale</span><span class="op">=</span>3 <span class="at">--binary</span> <span class="at">-i</span> upn.txt</span></code></pre></div>
<div class="sourceCode" id="cb121"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb121-1"><a href="#cb121-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-o</span> upnqr.png <span class="at">-b</span> UPNQR <span class="at">--scale</span><span class="op">=</span>3 <span class="at">--binary</span> <span class="at">-i</span> upn.txt</span></code></pre></div>
<p>A mask may be manually specified and the <code>--fast</code> option
used as with <a href="#qr-code-iso-18004">6.6.3 QR Code (ISO
18004)</a>.</p>
@@ -7348,7 +7417,7 @@ secondary message usually consists of address data in a data structure.
The format of the primary message required by Zint is given in the
following table.</p>
<table id="tbl:maxicode_scm">
<caption><span class="table-label">Table 37:</span> MaxiCode Structured
<caption><span class="table-label">Table 38:</span> MaxiCode Structured
Carrier Message Format</caption>
<colgroup>
<col style="width: 16%" />
@@ -7384,9 +7453,9 @@ your parcel courier.</td>
<p>The primary message can be set at the command prompt using the
<code>--primary</code> switch (API <code>primary</code>). The secondary
message uses the normal data entry method. For example:</p>
<div class="sourceCode" id="cb121"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb121-1"><a href="#cb121-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-o</span> test.eps <span class="at">-b</span> MAXICODE <span class="at">--primary</span><span class="op">=</span><span class="st">&quot;999999999840012&quot;</span> <span class="dt">\</span></span>
<span id="cb121-2"><a href="#cb121-2" aria-hidden="true" tabindex="-1"></a> <span class="at">-d</span> <span class="st">&quot;Secondary Message Here&quot;</span></span></code></pre></div>
<div class="sourceCode" id="cb122"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb122-1"><a href="#cb122-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-o</span> test.eps <span class="at">-b</span> MAXICODE <span class="at">--primary</span><span class="op">=</span><span class="st">&quot;999999999840012&quot;</span> <span class="dt">\</span></span>
<span id="cb122-2"><a href="#cb122-2" aria-hidden="true" tabindex="-1"></a> <span class="at">-d</span> <span class="st">&quot;Secondary Message Here&quot;</span></span></code></pre></div>
<p>When using the API the primary message must be placed in the
<code>primary</code> string. The secondary is entered in the same way as
described in <a href="#encoding-and-saving-to-file">5.2 Encoding and
@@ -7399,9 +7468,9 @@ to be prefixed by the ISO/IEC 15434 Format <code>"01"</code>
<code>vv</code> is a 2-digit version, by using the <code>--scmvv</code>
switch (API <code>option_2 = vv + 1</code>). For example to use the
common version <code>"96"</code> (ASC MH10/SC 8):</p>
<div class="sourceCode" id="cb122"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb122-1"><a href="#cb122-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> MAXICODE <span class="at">--primary</span><span class="op">=</span><span class="st">&quot;152382802840001&quot;</span> <span class="at">--scmvv</span><span class="op">=</span>96 <span class="at">--esc</span> <span class="at">-d</span> <span class="dt">\</span></span>
<span id="cb122-2"><a href="#cb122-2" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;1Z00004951\GUPSN\G06X610\G159\G1234567\G1/1\G\GY\G1 MAIN ST\GNY\GNY\R\E&quot;</span></span></code></pre></div>
<div class="sourceCode" id="cb123"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb123-1"><a href="#cb123-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> MAXICODE <span class="at">--primary</span><span class="op">=</span><span class="st">&quot;152382802840001&quot;</span> <span class="at">--scmvv</span><span class="op">=</span>96 <span class="at">--esc</span> <span class="at">-d</span> <span class="dt">\</span></span>
<span id="cb123-2"><a href="#cb123-2" aria-hidden="true" tabindex="-1"></a> <span class="st">&quot;1Z00004951\GUPSN\G06X610\G159\G1234567\G1/1\G\GY\G1 MAIN ST\GNY\GNY\R\E&quot;</span></span></code></pre></div>
<p>will prefix <code>"[)&gt;\R01\G96"</code> to the secondary message.
(<code>\R</code>, <code>\G</code> and <code>\E</code> are the escape
sequences for Record Separator, Group Separator and End of Transmission
@@ -7411,8 +7480,8 @@ Sequences</a></span>.)</p>
<p>Modes 4 to 6 can be accessed using the <code>--mode</code> switch
(API <code>option_1</code>). Modes 4 to 6 do not have a primary message.
For example:</p>
<div class="sourceCode" id="cb123"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb123-1"><a href="#cb123-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-o</span> test.eps <span class="at">-b</span> MAXICODE <span class="at">--mode</span><span class="op">=</span>4 <span class="at">-d</span> <span class="st">&quot;A MaxiCode Message in Mode 4&quot;</span></span></code></pre></div>
<div class="sourceCode" id="cb124"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb124-1"><a href="#cb124-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-o</span> test.eps <span class="at">-b</span> MAXICODE <span class="at">--mode</span><span class="op">=</span>4 <span class="at">-d</span> <span class="st">&quot;A MaxiCode Message in Mode 4&quot;</span></span></code></pre></div>
<p>Mode 6 is reserved for the maintenance of scanner hardware and should
not be used to encode user data.</p>
<p>This symbology uses Latin-1 character encoding by default but also
@@ -7421,7 +7490,7 @@ can be placed in a MaxiCode symbol depends on the type of characters
used in the text.</p>
<p>Example maximum data lengths are given in the table below:</p>
<table id="tbl:maxicode_data_length_maxima" style="width:100%;">
<caption><span class="table-label">Table 38:</span> MaxiCode Data Length
<caption><span class="table-label">Table 39:</span> MaxiCode Data Length
Maxima</caption>
<colgroup>
<col style="width: 9%" />
@@ -7505,7 +7574,7 @@ symbols, meaning they have a smaller bullseye pattern at the centre of
the symbol.</li>
</ol>
<table id="tbl:aztec_sizes">
<caption><span class="table-label">Table 39:</span> Aztec Code
<caption><span class="table-label">Table 40:</span> Aztec Code
Sizes</caption>
<thead>
<tr>
@@ -7653,7 +7722,7 @@ by setting the <code>--secure</code> option (API <code>option_1</code>)
to a value from the following table.</li>
</ol>
<table id="tbl:aztec_eccs">
<caption><span class="table-label">Table 40:</span> Aztec Code Error
<caption><span class="table-label">Table 41:</span> Aztec Code Error
Correction Modes</caption>
<thead>
<tr>
@@ -7726,7 +7795,7 @@ are roughly square (versions A through to H) and variable-width versions
(versions S and T). These can be selected by using <code>--vers</code>
(API <code>option_2</code>) as shown in the table below:</p>
<table id="tbl:codeone_sizes">
<caption><span class="table-label">Table 41:</span> Code One
<caption><span class="table-label">Table 42:</span> Code One
Sizes</caption>
<colgroup>
<col style="width: 10%" />
@@ -7848,7 +7917,7 @@ specified using the <code>--vers</code> option (API
specified by using the <code>--secure</code> option (API
<code>option_1</code>), according to the following tables.</p>
<table id="tbl:gridmatrix_sizes">
<caption><span class="table-label">Table 42:</span> Grid Matrix
<caption><span class="table-label">Table 43:</span> Grid Matrix
Sizes</caption>
<thead>
<tr>
@@ -7912,7 +7981,7 @@ Sizes</caption>
</tbody>
</table>
<table id="tbl:gridmatrix_eccs">
<caption><span class="table-label">Table 43:</span> Grid Matrix Error
<caption><span class="table-label">Table 44:</span> Grid Matrix Error
Correction Modes</caption>
<thead>
<tr>
@@ -7996,7 +8065,7 @@ alt="zint -b HANXIN -d &quot;Hanxin Code symbol&quot;" />
option (API <code>option_2</code>) to a value between 1 and 84 according
to the following table.</p>
<table id="tbl:hanxin_sizes">
<caption><span class="table-label">Table 44:</span> Han Xin
<caption><span class="table-label">Table 45:</span> Han Xin
Sizes</caption>
<thead>
<tr>
@@ -8300,7 +8369,7 @@ most capacious of all the barcodes supported by Zint.</p>
Xin Code which can be set by using the <code>--secure</code> option (API
<code>option_1</code>) to a value from the following table.</p>
<table id="tbl:hanxin_eccs">
<caption><span class="table-label">Table 45:</span> Han Xin Error
<caption><span class="table-label">Table 46:</span> Han Xin Error
Correction Modes</caption>
<thead>
<tr>
@@ -8337,8 +8406,8 @@ be manually specified by using the <code>--mask</code> switch with
values 0-3, or in the API by setting
<code>option_3 = (N + 1) &lt;&lt; 8</code> where N is 0-3. To use with
<code>ZINT_FULL_MULTIBYTE</code> set</p>
<div class="sourceCode" id="cb124"><pre
class="sourceCode c"><code class="sourceCode c"><span id="cb124-1"><a href="#cb124-1" aria-hidden="true" tabindex="-1"></a>option_3 <span class="op">=</span> ZINT_FULL_MULTIBYTE <span class="op">|</span> <span class="op">(</span>N <span class="op">+</span> <span class="dv">1</span><span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">8</span></span></code></pre></div>
<div class="sourceCode" id="cb125"><pre
class="sourceCode c"><code class="sourceCode c"><span id="cb125-1"><a href="#cb125-1" aria-hidden="true" tabindex="-1"></a>option_3 <span class="op">=</span> ZINT_FULL_MULTIBYTE <span class="op">|</span> <span class="op">(</span>N <span class="op">+</span> <span class="dv">1</span><span class="op">)</span> <span class="op">&lt;&lt;</span> <span class="dv">8</span></span></code></pre></div>
<h3 id="ultracode">6.6.14 Ultracode</h3>
<p>This symbology uses a grid of coloured elements to encode data. ECI
and GS1 modes are supported.</p>
@@ -8352,7 +8421,7 @@ alt="zint -b ULTRA -d &quot;HEIMASÍÐA KENNARAHÁSKÓLA ÍSLANDS&quot;" />
<code>--secure</code> option (API <code>option_1</code>) to a value as
shown in the following table.</p>
<table id="tbl:ultra_eccs">
<caption><span class="table-label">Table 46:</span> Ultracode Error
<caption><span class="table-label">Table 47:</span> Ultracode Error
Correction Values</caption>
<thead>
<tr>
@@ -8396,8 +8465,8 @@ Correction Values</caption>
</table>
<p>Zint does not currently implement data compression by default, but
this can be initiated through the API by setting</p>
<div class="sourceCode" id="cb125"><pre
class="sourceCode c"><code class="sourceCode c"><span id="cb125-1"><a href="#cb125-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-&gt;</span>option_3 <span class="op">=</span> ULTRA_COMPRESSION<span class="op">;</span></span></code></pre></div>
<div class="sourceCode" id="cb126"><pre
class="sourceCode c"><code class="sourceCode c"><span id="cb126-1"><a href="#cb126-1" aria-hidden="true" tabindex="-1"></a>symbol<span class="op">-&gt;</span>option_3 <span class="op">=</span> ULTRA_COMPRESSION<span class="op">;</span></span></code></pre></div>
<p>With compression, up to 504 digits, 375 alphanumerics or 252 bytes
can be encoded.</p>
<p>Revision 2 of Ultracode (2023) may be specified using
@@ -8426,7 +8495,7 @@ alt="zint -b FIM --compliantheight -d &quot;C&quot;" />
<p>There are only 5 valid symbols which can be generated using the
characters A-E as shown in the table below.</p>
<table id="tbl:fim_characters">
<caption><span class="table-label">Table 47:</span> Valid FIM
<caption><span class="table-label">Table 48:</span> Valid FIM
Characters</caption>
<thead>
<tr>
@@ -8639,7 +8708,7 @@ Latin Alphabet No. 1 (ISO/IEC 8859-1)</a>.</p>
<p>The ubiquitous ASCII standard is well known to most computer users.
Its reproduced here for reference.</p>
<table id="tbl:ascii">
<caption><span class="table-label">Table 48:</span> ASCII</caption>
<caption><span class="table-label">Table 49:</span> ASCII</caption>
<thead>
<tr>
<th>Hex</th>
@@ -8838,11 +8907,11 @@ Its reproduced here for reference.</p>
European languages like French, German, Italian and Spanish. This
extension is the default encoding of many barcodes (see <span
class="cross-ref-group"><a href="#tbl:default_character_sets"
class="cross-ref">Table 6: Default Character Sets</a></span>) when a
class="cross-ref">Table 7: Default Character Sets</a></span>) when a
codepoint above hex 9F is encoded. Note that codepoints hex 80 to 9F are
not defined.</p>
<table id="tbl:iso_iec_8869_1">
<caption><span class="table-label">Table 49:</span> ISO/IEC
<caption><span class="table-label">Table 50:</span> ISO/IEC
8859-1</caption>
<thead>
<tr>
@@ -9048,28 +9117,28 @@ properties that correspond to the <code>zint_symbol</code> structure
method <code>render()</code> which takes a Qt <code>QPainter</code> to
paint with, and a <code>QRectF</code> rectangular area specifying where
to paint into:</p>
<div class="sourceCode" id="cb126"><pre
class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb126-1"><a href="#cb126-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* Encode and display barcode in `paintRect` using `painter`.</span></span>
<span id="cb126-2"><a href="#cb126-2" aria-hidden="true" tabindex="-1"></a><span class="co"> Note: legacy argument `mode` is not used */</span></span>
<span id="cb126-3"><a href="#cb126-3" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> render<span class="op">(</span><span class="ex">QPainter</span><span class="op">&amp;</span> painter<span class="op">,</span> <span class="at">const</span> <span class="ex">QRectF</span><span class="op">&amp;</span> paintRect<span class="op">,</span></span>
<span id="cb126-4"><a href="#cb126-4" aria-hidden="true" tabindex="-1"></a> AspectRatioMode mode <span class="op">=</span> IgnoreAspectRatio<span class="op">);</span></span></code></pre></div>
<div class="sourceCode" id="cb127"><pre
class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb127-1"><a href="#cb127-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* Encode and display barcode in `paintRect` using `painter`.</span></span>
<span id="cb127-2"><a href="#cb127-2" aria-hidden="true" tabindex="-1"></a><span class="co"> Note: legacy argument `mode` is not used */</span></span>
<span id="cb127-3"><a href="#cb127-3" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> render<span class="op">(</span><span class="ex">QPainter</span><span class="op">&amp;</span> painter<span class="op">,</span> <span class="at">const</span> <span class="ex">QRectF</span><span class="op">&amp;</span> paintRect<span class="op">,</span></span>
<span id="cb127-4"><a href="#cb127-4" aria-hidden="true" tabindex="-1"></a> AspectRatioMode mode <span class="op">=</span> IgnoreAspectRatio<span class="op">);</span></span></code></pre></div>
<p><code>render()</code> will emit one of two Qt signals -
<code>encoded</code> on successful encoding and drawing, or
<code>errored</code> on failure. The client can connect and act
appropriately, for instance:</p>
<div class="sourceCode" id="cb127"><pre
class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb127-1"><a href="#cb127-1" aria-hidden="true" tabindex="-1"></a><span class="fu">connect</span><span class="op">(</span>qzint<span class="op">,</span> <span class="ex">SIGNAL</span><span class="op">(</span>encoded<span class="op">()),</span> <span class="ex">SLOT</span><span class="op">(</span>on_encoded<span class="op">()));</span></span>
<span id="cb127-2"><a href="#cb127-2" aria-hidden="true" tabindex="-1"></a><span class="fu">connect</span><span class="op">(</span>qzint<span class="op">,</span> <span class="ex">SIGNAL</span><span class="op">(</span>errored<span class="op">()),</span> <span class="ex">SLOT</span><span class="op">(</span>on_errored<span class="op">()));</span></span></code></pre></div>
<div class="sourceCode" id="cb128"><pre
class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb128-1"><a href="#cb128-1" aria-hidden="true" tabindex="-1"></a><span class="fu">connect</span><span class="op">(</span>qzint<span class="op">,</span> <span class="ex">SIGNAL</span><span class="op">(</span>encoded<span class="op">()),</span> <span class="ex">SLOT</span><span class="op">(</span>on_encoded<span class="op">()));</span></span>
<span id="cb128-2"><a href="#cb128-2" aria-hidden="true" tabindex="-1"></a><span class="fu">connect</span><span class="op">(</span>qzint<span class="op">,</span> <span class="ex">SIGNAL</span><span class="op">(</span>errored<span class="op">()),</span> <span class="ex">SLOT</span><span class="op">(</span>on_errored<span class="op">()));</span></span></code></pre></div>
<p>where <code>qzint</code> is an instance of <code>Zint::QZint</code>
and <code>on_encoded()</code> and <code>on_error()</code> are Qt slot
methods provided by the caller. On error, the error value and message
can be retrieved by the methods <code>getError()</code> and
<code>lastError()</code> respectively.</p>
<p>The other main method is <code>save_to_file()</code>:</p>
<div class="sourceCode" id="cb128"><pre
class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb128-1"><a href="#cb128-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* Encode and print barcode to file `filename`.</span></span>
<span id="cb128-2"><a href="#cb128-2" aria-hidden="true" tabindex="-1"></a><span class="co"> Only sets `getError()` on error, not on warning */</span></span>
<span id="cb128-3"><a href="#cb128-3" aria-hidden="true" tabindex="-1"></a><span class="dt">bool</span> save_to_file<span class="op">(</span><span class="at">const</span> <span class="ex">QString</span><span class="op">&amp;</span> filename<span class="op">);</span> <span class="co">// `ZBarcode_Print()`</span></span></code></pre></div>
<div class="sourceCode" id="cb129"><pre
class="sourceCode cpp"><code class="sourceCode cpp"><span id="cb129-1"><a href="#cb129-1" aria-hidden="true" tabindex="-1"></a><span class="co">/* Encode and print barcode to file `filename`.</span></span>
<span id="cb129-2"><a href="#cb129-2" aria-hidden="true" tabindex="-1"></a><span class="co"> Only sets `getError()` on error, not on warning */</span></span>
<span id="cb129-3"><a href="#cb129-3" aria-hidden="true" tabindex="-1"></a><span class="dt">bool</span> save_to_file<span class="op">(</span><span class="at">const</span> <span class="ex">QString</span><span class="op">&amp;</span> filename<span class="op">);</span> <span class="co">// `ZBarcode_Print()`</span></span></code></pre></div>
<p>which takes a <code>filename</code> to output to. It too will emit an
<code>errored</code> signal on failure, returning <code>false</code>
(but nothing on success, which just returns <code>true</code>). Note
@@ -9084,12 +9153,12 @@ symbology capabilities, and utility methods such as
<h1 id="annex-c.-tcl-backend-binding">Annex C. Tcl Backend Binding</h1>
<p>A Tcl binding is available in the <code>"backend_tcl</code>
sub-directory. To make on Unix:</p>
<div class="sourceCode" id="cb129"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb129-1"><a href="#cb129-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> backend_tcl</span>
<span id="cb129-2"><a href="#cb129-2" aria-hidden="true" tabindex="-1"></a><span class="fu">autoconf</span></span>
<span id="cb129-3"><a href="#cb129-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./configure</span></span>
<span id="cb129-4"><a href="#cb129-4" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span>
<span id="cb129-5"><a href="#cb129-5" aria-hidden="true" tabindex="-1"></a><span class="fu">sudo</span> make install</span></code></pre></div>
<div class="sourceCode" id="cb130"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb130-1"><a href="#cb130-1" aria-hidden="true" tabindex="-1"></a><span class="bu">cd</span> backend_tcl</span>
<span id="cb130-2"><a href="#cb130-2" aria-hidden="true" tabindex="-1"></a><span class="fu">autoconf</span></span>
<span id="cb130-3"><a href="#cb130-3" aria-hidden="true" tabindex="-1"></a><span class="ex">./configure</span></span>
<span id="cb130-4"><a href="#cb130-4" aria-hidden="true" tabindex="-1"></a><span class="fu">make</span></span>
<span id="cb130-5"><a href="#cb130-5" aria-hidden="true" tabindex="-1"></a><span class="fu">sudo</span> make install</span></code></pre></div>
<p>For Windows, a Microsoft Visual C++ project file is available at
<code>"backend_tcl\zint_tcl.vcxproj"</code>. Note that this assumes that
Tcl/Tk is available in <code>"C:\Tcl"</code> and that the libraries are
@@ -9100,21 +9169,21 @@ to match your setup. There is also a Visual Studio makefile available at
<code>"backend_tcl\win\README.txt"</code>.</p>
<p>Once built and installed, invoke the Tcl/Tk CLI
<code>"wish"</code>:</p>
<div class="sourceCode" id="cb130"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb130-1"><a href="#cb130-1" aria-hidden="true" tabindex="-1"></a><span class="ex">wish</span></span></code></pre></div>
<div class="sourceCode" id="cb131"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb131-1"><a href="#cb131-1" aria-hidden="true" tabindex="-1"></a><span class="ex">wish</span></span></code></pre></div>
<p>and ignoring the Tk window click back to the command prompt
<code>"%"</code> and type:</p>
<div class="sourceCode" id="cb131"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb131-1"><a href="#cb131-1" aria-hidden="true" tabindex="-1"></a><span class="ex">package</span> require zint</span>
<span id="cb131-2"><a href="#cb131-2" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> help</span></code></pre></div>
<div class="sourceCode" id="cb132"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb132-1"><a href="#cb132-1" aria-hidden="true" tabindex="-1"></a><span class="ex">package</span> require zint</span>
<span id="cb132-2"><a href="#cb132-2" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> help</span></code></pre></div>
<p>which will show the usage message, with options very similar to the
Zint CLI. (One notable difference is that boolean options such as
<code>-bold</code> take a <code>1</code> or <code>0</code> as an
argument.)</p>
<p>A demonstration Tcl/Tk program which is also useful in itself is
available at <code>"backend_tcl/demo/demo.tcl"</code>. To run type:</p>
<div class="sourceCode" id="cb132"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb132-1"><a href="#cb132-1" aria-hidden="true" tabindex="-1"></a><span class="ex">wish</span> demo/demo.tcl</span></code></pre></div>
<div class="sourceCode" id="cb133"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb133-1"><a href="#cb133-1" aria-hidden="true" tabindex="-1"></a><span class="ex">wish</span> demo/demo.tcl</span></code></pre></div>
<p>which will display the following window.</p>
<figure>
<img src="images/tcl_demo.png" class="pop"
@@ -9347,14 +9416,14 @@ are:</p>
</dd>
<dt><code>--extraesc</code></dt>
<dd>
<p>For Code 128 only, as well as processing the normal escape sequences
above, process the special escape sequences <code>\^A</code>,
<code>\^B</code>, <code>\^C</code> and <code>\^@</code> that allow
manual switching of Code Sets, and the special escape sequence
<code>\^1</code> that inserts an <code>FNC1</code> character. The
sequence <code>\@</code> turns off manual switching. The sequence
<code>\^^</code> can be used to encode data that contains special escape
sequences.</p>
<p>As well as processing the normal escape sequences above, process the
special escape sequences beginning with <code>\^</code>. For Code 128
and Data Matrix, process the escape sequence <code>\^1</code> that
inserts an <code>FNC1</code> character, and the escaping sequence
<code>\^^</code> that encodes a literal <code>\^</code>. For Code 128
only, process the escape sequences <code>\^A</code>, <code>\^B</code>,
<code>\^C</code> and <code>\^@</code> that allow manual switching of
Code Sets. The sequence <code>\^@</code> turns off manual switching.</p>
</dd>
<dt><code>--fast</code></dt>
<dd>
@@ -9867,17 +9936,17 @@ Error counterpart of warning if <code>--werror</code> given
<h2 id="examples">EXAMPLES</h2>
<p>Create “out.png” (or “out.gif” if zint built without PNG support) in
the current directory, as a Code 128 symbol.</p>
<div class="sourceCode" id="cb141"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb141-1"><a href="#cb141-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-d</span> <span class="st">&#39;This Text&#39;</span></span></code></pre></div>
<p>Create “qr.svg” in the current directory, as a QR Code symbol.</p>
<div class="sourceCode" id="cb142"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb142-1"><a href="#cb142-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> QRCode <span class="at">-d</span> <span class="st">&#39;This Text&#39;</span> <span class="at">-o</span> <span class="st">&#39;qr.svg&#39;</span></span></code></pre></div>
class="sourceCode bash"><code class="sourceCode bash"><span id="cb142-1"><a href="#cb142-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-d</span> <span class="st">&#39;This Text&#39;</span></span></code></pre></div>
<p>Create “qr.svg” in the current directory, as a QR Code symbol.</p>
<div class="sourceCode" id="cb143"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb143-1"><a href="#cb143-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> QRCode <span class="at">-d</span> <span class="st">&#39;This Text&#39;</span> <span class="at">-o</span> <span class="st">&#39;qr.svg&#39;</span></span></code></pre></div>
<p>Use batch mode to read from an input file “ean13nos.txt” containing a
list of 13-digit GTINs, each on a separate line, to create a series of
EAN-13 barcodes, formatting the output filenames to “ean001.gif”,
“ean002.gif” etc. using the special character “~”.</p>
<div class="sourceCode" id="cb143"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb143-1"><a href="#cb143-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> EAN13 <span class="at">--batch</span> <span class="at">-i</span> <span class="st">&#39;ean13nos.txt&#39;</span> <span class="at">-o</span> <span class="st">&#39;ean~~~.gif&#39;</span></span></code></pre></div>
<div class="sourceCode" id="cb144"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb144-1"><a href="#cb144-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> EAN13 <span class="at">--batch</span> <span class="at">-i</span> <span class="st">&#39;ean13nos.txt&#39;</span> <span class="at">-o</span> <span class="st">&#39;ean~~~.gif&#39;</span></span></code></pre></div>
<h2 id="bugs">BUGS</h2>
<p>Please send bug reports to
https://sourceforge.net/p/zint/tickets/.</p>
@@ -9925,7 +9994,7 @@ file format BMP!<a href="#fnref3" class="footnote-back"
role="doc-backlink">↩︎</a></p></li>
<li id="fn4"><p>The symbology names marked with an asterisk
(<code>*</code>) in <span class="cross-ref-group"><a
href="#tbl:barcode_types" class="cross-ref">Table 4: Barcode Types
href="#tbl:barcode_types" class="cross-ref">Table 5: Barcode Types
(Symbologies)</a></span> above used different names in previous versions
of Zint. These names are now deprecated but are still recognised by
Zint. Those marked with a dagger (<code></code>) are replacements for
@@ -10022,6 +10091,11 @@ href="#fnref22" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
Film Database at <a
href="https://thebigfilmdatabase.merinorus.com">https://thebigfilmdatabase.merinorus.com</a>.<a
href="#fnref23" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn24"><p>ASCII-compatible ECIs are ECIs 3 to 18 and 21 to 27
(see <span class="cross-ref-group"><a href="#tbl:eci_codes"
class="cross-ref">Table 9: ECI Codes</a></span>). Note in particular
that ECI 899, 8-bit binary, is not considered ASCII-compatible.<a
href="#fnref24" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>
</body>
+79 -32
View File
@@ -1,6 +1,6 @@
% Zint Barcode Generator and Zint Barcode Studio User Manual
% Version 2.16.0.9
% March 2026
% April 2026
[//]: # ( vim: set ts=4 sw=4 et : )
@@ -594,9 +594,35 @@ Table: Escape Sequences {#tbl:escape_sequences}
codeset from U+0000 to U+D7FF and U+E000 to U+FFFF (i.e. excluding surrogates).
Not to be confused with the Windows Bitmap file format BMP!
(Special escape sequences are available for Code 128 only to manually switch
Code Sets and insert special `FNC1` characters - see [6.1.10.1 Standard Code 128
(ISO 15417)] for details.)
Extra escape sequences are available for certain symbologies using the
`--extraesc` option that allows the insertion of special characters or, in the
case of Code 128 only, to manually switch Code Sets. Extra escapes begin with
the sequence backslash caret ("`\^`"):
----------------------------------------------------------------------------
Extra Escape Interpretation Available for Symbology
Sequence
----------------- ------------------------------ -----------------------
`\^1` Insert `FNC1` character Code128, Data Matrix
`\^^` Literal `\^` Code128, Data Matrix
`\^A`, `\^B`, `\^C` Select Code Set A, B or C Code128 only
respectively
`\^@` Exit manual Code Set selection Code128 only
and resume automatic Code Set
selection
---------------------------------------------------------------------------
Table: Extra Escape Sequences {#tbl:extra_escapes}
Currently the only special character recognized 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.
See [6.1.10.1 Standard Code 128 (ISO 15417)] for the details on manually
switching Code Sets.
Input data can be read directly from file using the `-i` or `--input` switch as
shown below. The input file is assumed to be UTF-8 formatted unless an
@@ -2526,7 +2552,7 @@ Value Effect
`MICROPDF417`, `PDF417`, `QRCODE` and `UPNQR` only).
`EXTRA_ESCAPE_MODE` Process special symbology-specific escape sequences
(`CODE128` only).
(`CODE128` and `DATAMATRIX` only).
`GS1SYNTAXENGINE_MODE` Use the GS1 Syntax Engine (if available) to strictly
validate GS1 input.
@@ -2565,8 +2591,8 @@ symbol->input_mode = DATA_MODE | GS1_MODE;
is not valid.
Permissible escape sequences (`ESCAPE_MODE`) are listed in
[#tbl:escape_sequences], and the special Code 128-only `EXTRA_ESCAPE_MODE`
escape sequences are given in [6.1.10.1 Standard Code 128 (ISO 15417)].
[#tbl:escape_sequences], and the extra escape sequences (`EXTRA_ESCAPE_MODE`)
are listed in [#tbl:extra_escapes].
The GS1 options `GS1PARENS_MODE` (CLI `--gs1parens`) , `GS1NOCHECK_MODE` (CLI
`--gs1nocheck`), `GS1SYNTAXENGINE_MODE` (CLI `--gs1strict`) and `GS1RAW_MODE`
@@ -2981,8 +3007,7 @@ Standard Code 2 of 5].
#### 6.1.2.5 Code 2 of 5 Data Logic
Data Logic does not include a check digit by default and can encode numeric
input (digits 0-9) up to a maximum of 113 digits.
Data Logic can encode numeric input (digits 0-9) up to a maximum of 113 digits.
![`zint -b C25LOGIC -d "9212320967"`](images/c25logic.svg){.lin}
@@ -3293,8 +3318,8 @@ hidden modulo-10 check digits.
#### 6.1.6.1 Telepen Alpha
Telepen Alpha was developed by SB Electronic Systems Limited and can encode
ASCII text input, up to a maximum of 69 characters. Telepen includes a
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"`](images/telepen.svg){.lin}
@@ -3442,12 +3467,31 @@ supports the encoding of ISO/IEC 8859-1 (non-English) characters in Code 128
symbols. The ISO/IEC 8859-1 character set is shown in Annex [A.2 Latin Alphabet
No. 1 (ISO/IEC 8859-1)].
Manual switching of Code Sets is possible using the `--extraesc` option (API
Manual insertion of `FNC1` is possible using the `--extraesc` option (API
`input_mode |= EXTRA_ESCAPE_MODE`), which apart from processing normal escape
sequences also processes the Code 128-specific escapes `\^A`, `\^B`, `\^C` and
`\^@` (the latter turns off manual Code Set selection). For instance the
following will force switching to Code Set B for the data `"5678"` (normally
Code Set C would be used throughout):
sequences also processes the extra escape sequences given in
[#tbl:extra_escapes]. For instance
```bash
zint -b CODE128 -d "A\^1BC\^1DEF" --extraesc
```
encodes the data `"A<FNC1>BC<FNC1>DEF"`, where `<FNC1>` represents the `FNC1`
character.
If the data contains an extra escape sequence, it can be escaped by doubling the
caret (`^`). For instance
```bash
zint -b CODE128 -d "A\^1BC\^^1DEF" --extraesc
```
will encode the data `"A<FNC1>BC\^1DEF"`.
Manual switching of Code Sets is possible using the Code 128-specific extra
escapes `\^A`, `\^B`, `\^C` and `\^@` (the latter turns off manual Code Set
selection). For instance the following will force switching to Code Set B for
the data `"5678"` (normally Code Set C would be used throughout):
```bash
zint -b CODE128 -d "1234\^B5678" --extraesc
@@ -3455,22 +3499,7 @@ zint -b CODE128 -d "1234\^B5678" --extraesc
The manually selected Code Set will apply until the next Code Set escape
sequence or until a `\^@`, with the exception that data that cannot be
represented in that Code Set will be switched as appropriate. If the data
contains an extra escape sequence, it can be escaped by doubling the caret
(`^`). For instance
```bash
zint -b CODE128 -d "\^AABC\^^BDEF" --extraesc
```
will encode the data `"ABC\^BDEF"` in Code Set A.
There is also the extra escape `\^1`, which will encode a special Function Code
1 character (`FNC1`) anywhere you choose in the data, for instance
```bash
zint -b CODE128 -d "A\^1BC\^1DEF" --extraesc
```
represented in that Code Set will be switched as appropriate.
Zint can encode a maximum of 102 symbol characters, which allows for e.g. 202
all-numeric or 101 all-uppercase characters. Sizes above 120 digits (60
@@ -4338,6 +4367,20 @@ GS1 data may be encoded using `FNC1` (default) or `GS` (Group Separator, ASCII
29) as separator. Use the option `--gssep` to change to `GS` (API
`output_options |= GS1_GS_SEPARATOR`).
Manual insertion of `FNC1` is possible using the `--extraesc` option (API
`input_mode |= EXTRA_ESCAPE_MODE`), which apart from processing normal escape
sequences also processes the extra escape sequences given in
[#tbl:extra_escapes]. For instance
```bash
zint -b DATAMATRIX -d "A\^1BC\^1DEF" --extraesc
```
encodes the data `"A<FNC1>BC<FNC1>DEF"`, where `<FNC1>` represents the `FNC1`
character. If the data contains an extra escape sequence, it can be escaped by
doubling the caret (`^`), i.e. `"\^^"` encodes `"\^"`. Note that if using ECIs
with manual FNC1s then the ECIs must be ASCII compatible.[^24]
By default Zint uses a "de facto" codeword placement for symbols of size 144 x
144 (version 24). To override this and use the now clarified ISO/IEC standard
placement, use option `--dmiso144` (API `option_3 |= DM_ISO_144`).
@@ -4360,6 +4403,10 @@ be given as `"123234"`. Note that both `ID1` and `ID2` must be non-zero, so e.g.
`"123000"` or `"000123"` would be invalid IDs. If an ID is not given it defaults
to `"001001"`.
[^24]: ASCII-compatible ECIs are ECIs 3 to 18 and 21 to 27 (see
[#tbl:eci_codes]). Note in particular that ECI 899, 8-bit binary, is not
considered ASCII-compatible.
### 6.6.2 Royal Mail 2D Mailmark (CMDM) (Data Matrix)
![`zint -b MAILMARK_2D -d "JGB 01Z999999900000001EC1A1AA1A0SN35TQ"
+138 -91
View File
@@ -1,6 +1,6 @@
Zint Barcode Generator and Zint Barcode Studio User Manual
Version 2.16.0.9
March 2026
April 2026
*******************************************************************************
* For reference the following is a text-only version of the Zint manual, *
@@ -746,9 +746,35 @@ sequences are shown in the table below.
Table 2: Escape Sequences
(Special escape sequences are available for Code 128 only to manually switch
Code Sets and insert special FNC1 characters - see 6.1.10.1 Standard Code 128
(ISO 15417) for details.)
Extra escape sequences are available for certain symbologies using the
--extraesc option that allows the insertion of special characters or, in the
case of Code 128 only, to manually switch Code Sets. Extra escapes begin with
the sequence backslash caret (“\^”):
----------------------------------------------------------------------------
Extra Escape Interpretation Available for Symbology
Sequence
-------------------- ------------------------------- -----------------------
\^1 Insert FNC1 character Code128, Data Matrix
\^^ Literal \^ Code128, Data Matrix
\^A, \^B, \^C Select Code Set A, B or C Code128 only
respectively
\^@ Exit manual Code Set selection Code128 only
and resume automatic Code Set
selection
----------------------------------------------------------------------------
Table 3: Extra Escape Sequences
Currently the only special character recognized 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.
See 6.1.10.1 Standard Code 128 (ISO 15417) for the details on manually switching
Code Sets.
Input data can be read directly from file using the -i or --input switch as
shown below. The input file is assumed to be UTF-8 formatted unless an
@@ -789,7 +815,7 @@ The currently supported output file formats are:
tif Tagged Image File Format
txt Text file (see 4.19 Other Options)
Table 3: Output File Formats
Table 4: Output File Formats
The filename can contain directories and sub-directories also, which will be
created if they dont already exist:
@@ -1039,7 +1065,7 @@ underscores are optional.
component
-----------------------------------------------------------------------------
Table 4: Barcode Types (Symbologies)
Table 5: Barcode Types (Symbologies)
4.4 Adjusting Height
@@ -1242,7 +1268,7 @@ To summarize the more intricate details:
Yes EMF 40 0.1 N/A
-------------------------------------------------------------------
Table 5: Scaling Multipliers and Minima
Table 6: Scaling Multipliers and Minima
4.9.1 Scaling by X-dimension and Resolution
@@ -1361,7 +1387,7 @@ Latin-2 (ISO/IEC 8859-2 plus ASCII).
UPNQR Latin-2 N/A
All others ASCII N/A
Table 6: Default Character Sets
Table 7: Default Character Sets
If Zint encounters characters which can not be encoded using the default
character encoding then it will take advantage of the ECI (Extended Channel
@@ -1396,7 +1422,7 @@ behaviour.
4.11.2 Input Modes and ECI
If your data contains characters that are not in the default character set, you
may encode it using an ECI-aware symbology and an ECI value from Table 8: ECI
may encode it using an ECI-aware symbology and an ECI value from Table 9: ECI
Codes below. The ECI information is added to your code symbol as prefix data.
The symbologies that support ECI are:
@@ -1405,7 +1431,7 @@ The symbologies that support ECI are:
Code One DotCode Han Xin Code MicroPDF417 QR Code Ultracode
------------ ------------- -------------- ------------- --------- -----------
Table 7: ECI-Aware Symbologies
Table 8: ECI-Aware Symbologies
Be aware that not all barcode readers support ECI mode, so this can sometimes
lead to unreadable barcodes. If you are using characters beyond those supported
@@ -1452,11 +1478,11 @@ formatted. Zint automatically translates the data into the target encoding.
170 ISO/IEC 646 Invariant[8]
899 8-bit binary data[9]
Table 8: ECI Codes
Table 9: ECI Codes
An ECI value of 0 does not encode any ECI information in the code symbol (unless
the data contains non-default character set characters). In this case, the
default character set applies (see Table 6: Default Character Sets above).
default character set applies (see Table 7: Default Character Sets above).
If no ECI is specified or a value of 0 is given, and the data does contain
characters other than in the default character set, then Zint will automatically
@@ -1551,7 +1577,7 @@ The following symbologies accept GS1 data:
Ultracode No No No
UPC-A, UPC-E Yes (01) Yes Yes
Table 9: GS1-Enabled Symbologies
Table 10: GS1-Enabled Symbologies
4.11.3.1 GS1 Data Entry
@@ -1648,7 +1674,7 @@ characters in the output filename as shown in the table below:
@ Insert a number or * (or + on Windows)
Any other Insert literally
Table 10: Batch Filename Formatting
Table 11: Batch Filename Formatting
For instance
@@ -1664,7 +1690,7 @@ The following table shows some examples to clarify this method:
-o "my~~bar~.eps" "my00bar1.eps", "my00bar2.eps", "my00bar3.eps"
-o "t###est.png" "t 1est.png", "t 2est.png", "t 3est.png"
Table 11: Batch Filename Examples
Table 12: Batch Filename Examples
The special characters can span directories also, which is useful when creating
a large number of barcodes:
@@ -1674,7 +1700,7 @@ a large number of barcodes:
-o "dir~/file~~~.svg" "dir0/file001.svg", "dir0/file002.svg", …
"dir0/file999.svg", "dir1/file000.svg", …
Table 12: Batch Directory Examples
Table 13: Batch Directory Examples
For an alternative method of naming output files see the --mirror option in 4.14
Automatic Filenames below.
@@ -1690,7 +1716,7 @@ suffix of the file type required. For example:
zint -b MICROPDF417 --direct --filetype=pcx -d "Data to encode"
This command will output the symbol as a PCX file to stdout. For the supported
output file formats see Table 3: Output File Formats.
output file formats see Table 4: Output File Formats.
--------------------------------------------------------------------------------
@@ -1733,7 +1759,7 @@ The default and minimum scale for raster output in dotty mode is 1.
If you need to specify different ECIs for different sections of the input data,
the --seg1 to --seg9 options can be used. Each option is of the form
--segN=ECI,data where ECI is the ECI code (see Table 8: ECI Codes) and data is
--segN=ECI,data where ECI is the ECI code (see Table 9: ECI Codes) and data is
the data to which this applies. This is in addition to the ECI and data
specified using the --eci and -d options which must still be present and which
in effect constitute segment 0. For instance
@@ -1743,7 +1769,7 @@ in effect constitute segment 0. For instance
specifies 3 segments: segment 0 with ECI 9 (Greek), segment 1 with ECI 7
(Cyrillic), and segment 2 with ECI 20 (Shift JIS). Segments must be consecutive.
Naturally the symbology must be ECI-aware (see Table 7: ECI-Aware Symbologies).
Naturally the symbology must be ECI-aware (see Table 8: ECI-Aware Symbologies).
[zint -b AZTEC --eci=9 -d "Κείμενο" --seg1=7,"Текст" --seg2=20,"文章"]
@@ -2241,7 +2267,7 @@ the following members:
floats
------------------------------------------------------------------------------
Table 13: API Structure zint_symbol
Table 14: API Structure zint_symbol
To alter these values use the syntax shown in the example below. This code has
the same result as the previous example except the output is now taller and
@@ -2340,7 +2366,7 @@ the nature of the error. The errors generated by Zint are:
ZINT_WARN_HRT_TRUNCATED occurs.
------------------------------------------------------------------------------
Table 14: API Warning and Error Return Values
Table 15: API Warning and Error Return Values
To catch errors use an integer variable as shown in the code below:
@@ -2377,7 +2403,7 @@ To treat all warnings as errors, set symbol->warn_level to WARN_FAIL_ALL.
5.9 Specifying a Symbology
Symbologies can be specified by number or by name as listed in Table 4: Barcode
Symbologies can be specified by number or by name as listed in Table 5: Barcode
Types (Symbologies). For example
symbol->symbology = BARCODE_LOGMARS;
@@ -2445,7 +2471,7 @@ together when adjusting this value:
symbol->contentsegs (see 5.16 Feedback).
------------------------------------------------------------------------------
Table 15: API output_options Values
Table 16: API output_options Values
5.11 Setting the Input Mode
@@ -2483,7 +2509,7 @@ member:
MICROPDF417, PDF417, QRCODE and UPNQR only).
EXTRA_ESCAPE_MODE Process special symbology-specific escape sequences
(CODE128 only).
(CODE128 and DATAMATRIX only).
GS1SYNTAXENGINE_MODE Use the GS1 Syntax Engine (if available) to strictly
validate GS1 input.
@@ -2492,7 +2518,7 @@ member:
Group Separators (GS, ASCII 29) as FNC1s.
------------------------------------------------------------------------------
Table 16: API input_mode Values
Table 17: API input_mode Values
The default mode is DATA_MODE (CLI option --binary). (Note that this differs
from the default for the CLI and GUI, which is UNICODE_MODE.)
@@ -2515,8 +2541,8 @@ whereas
is not valid.
Permissible escape sequences (ESCAPE_MODE) are listed in Table 2: Escape
Sequences, and the special Code 128-only EXTRA_ESCAPE_MODE escape sequences are
given in 6.1.10.1 Standard Code 128 (ISO 15417).
Sequences, and the extra escape sequences (EXTRA_ESCAPE_MODE) are listed in
Table 3: Extra Escape Sequences.
The GS1 options GS1PARENS_MODE (CLI --gs1parens) , GS1NOCHECK_MODE (CLI
--gs1nocheck), GS1SYNTAXENGINE_MODE (CLI --gs1strict) and GS1RAW_MODE (CLI
@@ -2561,7 +2587,7 @@ number of elements it contains. The zint_seg structure is of the form:
int eci; /* Extended Channel Interpretation */
};
The symbology must support ECIs (see Table 7: ECI-Aware Symbologies). For
The symbology must support ECIs (see Table 8: ECI-Aware Symbologies). For
example:
#include <zint.h>
@@ -2710,7 +2736,7 @@ see which are set.
linear symbologies.
------------------------------------------------------------------------------
Table 17: API Capability Flags
Table 18: API Capability Flags
For example:
@@ -2737,7 +2763,7 @@ were overridden by Zint.
In particular for symbologies that have masks,[19] option_3 will contain the
mask used as (N + 1) << 8, N being the mask. Also Aztec Code will return the
actual ECC percentage used in option_1 as P << 8, where P is the integer
percentage, the low byte containing the values given in Table 40: Aztec Code
percentage, the low byte containing the values given in Table 41: Aztec Code
Error Correction Modes (with the addition of 0 meaning less than 5% + 3
codewords and -1 meaning minimum 3 codewords). Micro PDF417 also will return the
ECC percentage in option_1 as P << 8.
@@ -2883,8 +2909,7 @@ Standard Code 2 of 5.
6.1.2.5 Code 2 of 5 Data Logic
Data Logic does not include a check digit by default and can encode numeric
input (digits 0-9) up to a maximum of 113 digits.
Data Logic can encode numeric input (digits 0-9) up to a maximum of 113 digits.
[zint -b C25LOGIC -d "9212320967"]
@@ -3148,7 +3173,7 @@ MSI Plessey has a range of check digit options that are selectable by setting
5 Modulo-11 (NCR)
6 Modulo-11 (NCR) & Modulo-10
Table 18: MSI Plessey Check Digit Options
Table 19: MSI Plessey Check Digit Options
To not show the check digit or digits in the Human Readable Text, add 10 to the
--vers value. For example --vers=12 (API option_2 = 12) will add two hidden
@@ -3158,9 +3183,9 @@ modulo-10 check digits.
6.1.6.1 Telepen Alpha
Telepen Alpha was developed 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.
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"]
@@ -3301,28 +3326,33 @@ supports the encoding of ISO/IEC 8859-1 (non-English) characters in Code 128
symbols. The ISO/IEC 8859-1 character set is shown in Annex A.2 Latin Alphabet
No. 1 (ISO/IEC 8859-1).
Manual switching of Code Sets is possible using the --extraesc option (API
Manual insertion of FNC1 is possible using the --extraesc option (API
input_mode |= EXTRA_ESCAPE_MODE), which apart from processing normal escape
sequences also processes the Code 128-specific escapes \^A, \^B, \^C and \^@
(the latter turns off manual Code Set selection). For instance the following
will force switching to Code Set B for the data "5678" (normally Code Set C
would be used throughout):
sequences also processes the extra escape sequences given in Table 3: Extra
Escape Sequences. For instance
zint -b CODE128 -d "A\^1BC\^1DEF" --extraesc
encodes the data "A<FNC1>BC<FNC1>DEF", where <FNC1> represents the FNC1
character.
If the data contains an extra escape sequence, it can be escaped by doubling the
caret (^). For instance
zint -b CODE128 -d "A\^1BC\^^1DEF" --extraesc
will encode the data "A<FNC1>BC\^1DEF".
Manual switching of Code Sets is possible using the Code 128-specific extra
escapes \^A, \^B, \^C and \^@ (the latter turns off manual Code Set selection).
For instance the following will force switching to Code Set B for the data
"5678" (normally Code Set C would be used throughout):
zint -b CODE128 -d "1234\^B5678" --extraesc
The manually selected Code Set will apply until the next Code Set escape
sequence or until a \^@, with the exception that data that cannot be represented
in that Code Set will be switched as appropriate. If the data contains an extra
escape sequence, it can be escaped by doubling the caret (^). For instance
zint -b CODE128 -d "\^AABC\^^BDEF" --extraesc
will encode the data "ABC\^BDEF" in Code Set A.
There is also the extra escape \^1, which will encode a special Function Code 1
character (FNC1) anywhere you choose in the data, for instance
zint -b CODE128 -d "A\^1BC\^1DEF" --extraesc
in that Code Set will be switched as appropriate.
Zint can encode a maximum of 102 symbol characters, which allows for e.g. 202
all-numeric or 101 all-uppercase characters. Sizes above 120 digits (60
@@ -3406,7 +3436,7 @@ alphanumeric, and is of the form:
-----------------------------------------------------------------------
Table 19: DPD Input Fields
Table 20: DPD Input Fields
A warning will be generated if the Service Code, the Destination Country Code,
or the last 10 characters of the Tracking Number are non-numeric.
@@ -3524,7 +3554,7 @@ the table below:
7 000000 576688
8 0000000 7742862
Table 20: Channel Value Ranges
Table 21: Channel Value Ranges
6.1.14 BC412 (SEMI T1-95)
@@ -3770,7 +3800,7 @@ encoding methods. Valid values are shown below.
component
----------------------------------------------------------------------------
Table 21: GS1 Composite Symbology Values
Table 22: GS1 Composite Symbology Values
The data to be encoded in the linear component of a composite symbol should be
entered into a primary string with the data for the 2D component being entered
@@ -3936,7 +3966,7 @@ following table.
23 99999999999999999999999 67-bar 62 N
---------------------------------------------------------------
Table 22: Australia Post Input Formats
Table 23: Australia Post Input Formats
6.5.1.2 Reply Paid Barcode
@@ -3997,7 +4027,7 @@ rules for the input data are complex, as summarized in the following table.
------------------------------------------------------------------------------
Table 23: Royal Mail 4-State Mailmark Input Fields
Table 24: Royal Mail 4-State Mailmark Input Fields
The 6 Destination+DPS (Destination Post Code plus Delivery Point Suffix)
@@ -4007,7 +4037,7 @@ patterns are:
ANNLLNLSS AANNLLNLS ANNNLLNLS AANNNLLNL ANANLLNLS AANANLLNL
----------- ----------- ----------- ----------- ----------- -----------
Table 24: Royal Mail 4-State Mailmark Destination+DPS Patterns
Table 25: Royal Mail 4-State Mailmark Destination+DPS Patterns
where 'A' stands for full alphabetic (A-Z), 'L' for limited alphabetic (A-Z less
@@ -4103,7 +4133,7 @@ Note that only ECC 200 symbols are supported, the older standards (ECC 000 to
9 26 x 26 19 88 x 88 29 16 x 36
10 32 x 32 20 96 x 96 30 16 x 48
Table 25: Data Matrix Sizes
Table 26: Data Matrix Sizes
The largest version 24 (144 x 144) can encode 3116 digits, around 2335
alphanumeric characters, or 1555 bytes of data.
@@ -4127,7 +4157,7 @@ the following values as before:
38 12 x 88 47 26 x 48
39 16 x 64 48 26 x 64
Table 26: DMRE Sizes
Table 27: DMRE Sizes
DMRE symbol sizes may be activated in automatic size mode using the option
--dmre (API option_3 = DM_DMRE).
@@ -4136,6 +4166,18 @@ GS1 data may be encoded using FNC1 (default) or GS (Group Separator, ASCII 29)
as separator. Use the option --gssep to change to GS (API
output_options |= GS1_GS_SEPARATOR).
Manual insertion of FNC1 is possible using the --extraesc option (API
input_mode |= EXTRA_ESCAPE_MODE), which apart from processing normal escape
sequences also processes the extra escape sequences given in Table 3: Extra
Escape Sequences. For instance
zint -b DATAMATRIX -d "A\^1BC\^1DEF" --extraesc
encodes the data "A<FNC1>BC<FNC1>DEF", where <FNC1> represents the FNC1
character. If the data contains an extra escape sequence, it can be escaped by
doubling the caret (^), i.e. "\^^" encodes "\^". Note that if using ECIs with
manual FNC1s then the ECIs must be ASCII compatible.[24]
By default Zint uses a “de facto” codeword placement for symbols of size 144 x
144 (version 24). To override this and use the now clarified ISO/IEC standard
placement, use option --dmiso144 (API option_3 |= DM_ISO_144).
@@ -4179,7 +4221,7 @@ section, as summarized below.
Reserved 6 Spaces
Customer Data 6, 45 or 29 Anything (Latin-1)
Table 27: Royal Mail 2D Mailmark Input Fields
Table 28: Royal Mail 2D Mailmark Input Fields
The 12 Destination+DPS (Destination Post Code plus Delivery Point Suffix)
@@ -4192,7 +4234,7 @@ required (the rest can be blank), and the whole field can be blank:
ANSSSSSSS AANSSSSSS ANNSSSSSS AANNSSSSS ANASSSSSS AANASSSSS
----------- ----------- ----------- ----------- ----------- -----------
Table 28: Royal Mail 2D Mailmark Destination+DPS Patterns
Table 29: Royal Mail 2D Mailmark Destination+DPS Patterns
where 'A' is alphabetic (A-Z), 'N' numeric (0-9), and 'S' space.
@@ -4205,7 +4247,7 @@ the whole field can be):
ANNAASS AANNAAS ANNNAAS AANNNAA ANANAAS AANANAA
--------- --------- --------- --------- --------- ---------
Table 29: Royal Mail 2D Mailmark RTS Patterns
Table 30: Royal Mail 2D Mailmark RTS Patterns
Three sizes are defined, one rectangular, with varying maximum amounts of
optional customer data:
@@ -4216,7 +4258,7 @@ optional customer data:
Type 9 32 x 32 45 characters 10
Type 29 16 x 48 29 characters 30
Table 30: Royal Mail 2D Mailmark Sizes
Table 31: Royal Mail 2D Mailmark Sizes
Zint will automatically select a size based on the amount of customer data, or
it can be specified using the --vers option (API option_2), which takes the Zint
@@ -4244,7 +4286,7 @@ option_1) as shown in the following table.
3 Q Approx 55% of symbol Approx 25%
4 H Approx 65% of symbol Approx 30%
Table 31: QR Code ECC Levels
Table 32: QR Code ECC Levels
The size of the symbol can be specified by setting the --vers option (API
option_2) to the QR Code version required (1-40). The size of symbol generated
@@ -4267,7 +4309,7 @@ is shown in the table below.
13 69 x 69 27 125 x 125
14 73 x 73 28 129 x 129
Table 32: QR Code Sizes
Table 33: QR Code Sizes
The maximum capacity of a QR Code symbol (version 40) is 7089 numeric digits,
4296 alphanumeric characters or 2953 bytes of data. QR Code symbols can also be
@@ -4327,7 +4369,7 @@ restrictions on what characters can be encoded.
4 M4 17 x 17 Latin-1 and Shift JIS
------------------------------------------------------------------
Table 33: Micro QR Code Sizes
Table 34: Micro QR Code Sizes
Version M4 can encode up to 35 digits, 21 alphanumerics, 15 bytes or 9 Kanji
characters.
@@ -4347,7 +4389,7 @@ not available for any version, and ECC level Q is only available for version M4:
3 Q Approx 55% of symbol Approx 25% M4
----------------------------------------------------------------------
Table 34: Micro QR ECC Levels
Table 35: Micro QR ECC Levels
The defaults for symbol size and ECC level depend on the input and whether
either of them is specified.
@@ -4379,7 +4421,7 @@ option_1), however only ECC levels M and H are valid for this type of symbol.
2 M Approx 37% of symbol Approx 15%
4 H Approx 65% of symbol Approx 30%
Table 35: rMQR ECC Levels
Table 36: rMQR ECC Levels
The preferred symbol sizes can be selected using the --vers option (API
option_2) as shown in the table below. Input values between 33 and 38 fix the
@@ -4427,7 +4469,7 @@ height of the symbol while allowing Zint to determine the minimum symbol width.
19 R13x59 13 x 59 38 R17xW 17 x automatic width
------------------------------------------------------------------------------
Table 36: rMQR Sizes
Table 37: rMQR Sizes
The largest version R17x139 (32) can encode up to 361 digits, 219 alphanumerics,
150 bytes, or 92 Kanji characters.
@@ -4485,7 +4527,7 @@ Zint is given in the following table.
13 - 15 Three-digit service code. This depends on your parcel courier.
----------------------------------------------------------------------------
Table 37: MaxiCode Structured Carrier Message Format
Table 38: MaxiCode Structured Carrier Message Format
The primary message can be set at the command prompt using the --primary switch
(API primary). The secondary message uses the normal data entry method. For
@@ -4540,7 +4582,7 @@ Example maximum data lengths are given in the table below:
6 93 138 50
------------------------------------------------------------------------
Table 38: MaxiCode Data Length Maxima
Table 39: MaxiCode Data Length Maxima
* - secondary only
@@ -4586,7 +4628,7 @@ symbol. Two options, mutually exclusive, are available to change this behaviour:
11 45 x 45 23 95 x 95 35 147 x 147
12 49 x 49 24 101 x 101 36 151 x 151
Table 39: Aztec Code Sizes
Table 40: Aztec Code Sizes
Note that in symbols which have a specified size the amount of error correction
is dependent on the length of the data input and Zint will allow error
@@ -4604,7 +4646,7 @@ recommended, and anything less than 5% + 3 codewords will result in a warning).
3 >=36% + 3 codewords
4 >=50% + 3 codewords
Table 40: Aztec Code Error Correction Modes
Table 41: Aztec Code Error Correction Modes
It is not possible to select both symbol size and error correction capacity for
the same symbol. If both options are selected then the error correction capacity
@@ -4672,7 +4714,7 @@ below:
10 T 16 x automatic width 90 55
------------------------------------------------------------------------
Table 41: Code One Sizes
Table 42: Code One Sizes
Version S symbols can only encode numeric data. The width of version S and
version T symbols is determined by the length of the input data.
@@ -4710,7 +4752,7 @@ using the --secure option (API option_1), according to the following tables.
6 78 x 78 13 162 x 162
7 90 x 90
Table 42: Grid Matrix Sizes
Table 43: Grid Matrix Sizes
Mode Error Correction Capacity
------ ---------------------------
@@ -4720,7 +4762,7 @@ using the --secure option (API option_1), according to the following tables.
4 Approximately 40%
5 Approximately 50%
Table 43: Grid Matrix Error Correction Modes
Table 44: Grid Matrix Error Correction Modes
Non-ASCII data density may be maximized by using the --fullmultibyte switch (API
option_3 = ZINT_FULL_MULTIBYTE), but check that your barcode reader supports
@@ -4798,7 +4840,7 @@ to a value between 1 and 84 according to the following table.
27 75 x 75 55 131 x 131 83 187 x 187
28 77 x 77 56 133 x 133 84 189 x 189
Table 44: Han Xin Sizes
Table 45: Han Xin Sizes
The largest version (84) can encode 7827 digits, 4350 ASCII characters, up to
2175 Chinese characters, or 3261 bytes, making it the most capacious of all the
@@ -4815,7 +4857,7 @@ following table.
3 Approx 23%
4 Approx 30%
Table 45: Han Xin Error Correction Modes
Table 46: Han Xin Error Correction Modes
Non-ASCII data density may be maximized by using the --fullmultibyte switch (API
option_3 = ZINT_FULL_MULTIBYTE), but check that your barcode reader supports
@@ -4847,7 +4889,7 @@ option_1) to a value as shown in the following table.
5 EC4 Approx 25%
6 EC5 Approx 33%
Table 46: Ultracode Error Correction Values
Table 47: Ultracode Error Correction Values
Zint does not currently implement data compression by default, but this can be
initiated through the API by setting
@@ -4893,7 +4935,7 @@ as shown in the table below.
D Used for Information Based Indicia (IBI) postage.
E Used for customized mail with a USPS Intelligent Mail barcode.
Table 47: Valid FIM Characters
Table 48: Valid FIM Characters
6.7.2 Flattermarken
@@ -5081,13 +5123,13 @@ reproduced here for reference.
E SO RS . > N ^ n ~
F SI US / ? O _ o DEL
Table 48: ASCII
Table 49: ASCII
A.2 Latin Alphabet No. 1 (ISO/IEC 8859-1)
ISO/IEC 8859-1 defines additional characters common in western European
languages like French, German, Italian and Spanish. This extension is the
default encoding of many barcodes (see Table 6: Default Character Sets) when a
default encoding of many barcodes (see Table 7: Default Character Sets) when a
codepoint above hex 9F is encoded. Note that codepoints hex 80 to 9F are not
defined.
@@ -5110,7 +5152,7 @@ defined.
E ® ¾ Î Þ î þ
F ¯ ¿ Ï ß ï ÿ
Table 49: ISO/IEC 8859-1
Table 50: ISO/IEC 8859-1
Annex B. Qt Backend QZint
@@ -5200,7 +5242,7 @@ configured barcode is updated when the "Generate" button is pressed.
Annex D. Man Page ZINT(1)
% ZINT(1) Version 2.16.0.9 % % March 2026
% ZINT(1) Version 2.16.0.9 % % April 2026
NAME
@@ -5413,11 +5455,12 @@ OPTIONS
--extraesc
For Code 128 only, as well as processing the normal escape sequences above,
process the special escape sequences \^A, \^B, \^C and \^@ that allow manual
switching of Code Sets, and the special escape sequence \^1 that inserts an
FNC1 character. The sequence \@ turns off manual switching. The sequence \^^
can be used to encode data that contains special escape sequences.
As well as processing the normal escape sequences above, process the special
escape sequences beginning with \^. For 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
@@ -5956,7 +5999,7 @@ see “GS1 Barcode Syntax Engine” at https://github.com/gs1/gs1-syntax-engine.
codeset from U+0000 to U+D7FF and U+E000 to U+FFFF (i.e. excluding surrogates).
Not to be confused with the Windows Bitmap file format BMP!
[4] The symbology names marked with an asterisk (*) in Table 4: Barcode Types
[4] The symbology names marked with an asterisk (*) in Table 5: Barcode Types
(Symbologies) above used different names in previous versions of Zint. These
names are now deprecated but are still recognised by Zint. Those marked with a
dagger (†) are replacements for BARCODE_EANX (13), BARCODE_EANX_CHK (14) and
@@ -6032,3 +6075,7 @@ recognised.
[23] The DX number may be looked up in The (Modified) Big Film Database at
https://thebigfilmdatabase.merinorus.com.
[24] ASCII-compatible ECIs are ECIs 3 to 18 and 21 to 27 (see Table 9: ECI
Codes). Note in particular that ECI 899, 8-bit binary, is not considered
ASCII-compatible.
+10 -8
View File
@@ -1,6 +1,6 @@
.\" Automatically generated by Pandoc 3.9.0.2
.\"
.TH "ZINT" "1" "March 2026" "Version 2.16.0.9"
.TH "ZINT" "1" "April 2026" "Version 2.16.0.9"
.SH NAME
\f[CR]zint\f[R] \- encode data as a barcode image
.SH SYNOPSIS
@@ -213,14 +213,16 @@ The escape sequences are:
.RE
.TP
\f[CR]\-\-extraesc\f[R]
For Code 128 only, as well as processing the normal escape sequences
above, process the special escape sequences \f[CR]\(rs\(haA\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 Code 128 and Data Matrix, process the escape sequence
\f[CR]\(rs\(ha1\f[R] that inserts an \f[CR]FNC1\f[R] character, and the
escaping sequence \f[CR]\(rs\(ha\(ha\f[R] that encodes a literal
\f[CR]\(rs\(ha\f[R].
For Code 128 only, process the escape sequences \f[CR]\(rs\(haA\f[R],
\f[CR]\(rs\(haB\f[R], \f[CR]\(rs\(haC\f[R] and \f[CR]\(rs\(ha\(at\f[R]
that allow manual switching of Code Sets, and the special escape
sequence \f[CR]\(rs\(ha1\f[R] that inserts an \f[CR]FNC1\f[R] character.
The sequence \f[CR]\(rs\(at\f[R] turns off manual switching.
The sequence \f[CR]\(rs\(ha\(ha\f[R] can be used to encode data that
contains special escape sequences.
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
+5 -5
View File
@@ -1,6 +1,6 @@
% ZINT(1) Version 2.16.0.9
%
% March 2026
% April 2026
[//]: # ( vim: set ts=4 sw=4 et : )
@@ -193,10 +193,10 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--extraesc`
: For Code 128 only, as well as processing the normal escape sequences above, process the special escape sequences
`\^A`, `\^B`, `\^C` and `\^@` that allow manual switching of Code Sets, and the special escape sequence `\^1` that
inserts an `FNC1` character. The sequence `\@` turns off manual switching. The sequence `\^^` can be used to
encode data that contains special escape sequences.
: As well as processing the normal escape sequences above, process the special escape sequences beginning with `\^`.
For 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`
+1 -1
View File
@@ -195,7 +195,7 @@ static void usage(const int no_png, const int have_gs1syntaxengine) {
" --eci=INTEGER Set the ECI code for the data (segment 0)\n", stdout);
fputs( " --embedfont Embed font in vector output (SVG only)\n"
" --esc Process escape sequences in input data\n"
" --extraesc Process symbology-specific escape sequences (Code 128)\n"
" --extraesc Process extra symbology-specific escape sequences\n"
" --fast Use faster encodation or other shortcuts if available\n"
" --fg=COLOUR Specify a foreground colour (as RGB(A) or \"C,M,Y,K\")\n", stdout);
printf(" --filetype=TYPE Set output file type BMP/EMF/EPS/GIF/PCX%s/SVG/TIF/TXT\n", no_png_type);
+12 -11
View File
@@ -349,17 +349,18 @@ static void test_dump_args(const testCtx *const p_ctx) {
/* 34*/ { BARCODE_DATAMATRIX, "abc", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "AA A\n8B F\nD4 C\nC2 7\n9E C\nCF 3\n8E 8\nBB F\n86 2\n95 D\nCB A\nFF F" },
/* 35*/ { BARCODE_DATAMATRIX, "abc", NULL, NULL, NULL, -1, -1, 0, -1, -1, 1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "AA A\n8C F\n9E 4\nC5 7\nA9 6\n9F F\n97 0\nFA 9\nAA C\nDD D\nD2 2\nFF F" },
/* 36*/ { BARCODE_DATAMATRIX, "abc", NULL, NULL, NULL, -1, -1, 0, -1, 0, 1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "Warning 161: previous '--dmb256' overwritten by '--dmc40'\nAA A\n8C F\n9E 4\nC5 7\nA9 6\n9F F\n97 0\nFA 9\nAA C\nDD D\nD2 2\nFF F" },
/* 37*/ { BARCODE_EANX_CC, "[91]12", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, "12345678+12", -1, -1, 0, -1, "DB BC D3 9C 44 E9 D2 2C 19 E7 A2 D8 A0 00 00 00\nDB 31 1C 9C C7 29 92 47 D9 E9 40 C8 A0 00 00 00\nDA 3B EB 10 AF 09 9A 18 9D 7D 82 E8 A0 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n20 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n14 68 D1 A6 49 BD 55 C9 D4 22 48 B9 40 59 94 98" },
/* 38*/ { BARCODE_EANX_CC, "[91]12", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, -1, 0, -1, 2, "12345678+12", -1, -1, 0, -1, "D3 A3 E9 DB F5 C9 DB 43 D9 CB 98 D2 20 00 00 00\nD3 25 0F 11 E4 49 D3 51 F1 AC FC D6 20 00 00 00\nD1 33 48 19 39 E9 93 18 49 D8 98 D7 20 00 00 00\nD1 A6 FC DA 1C 49 9B C5 05 E2 84 D7 A0 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n20 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n14 68 D1 A6 49 BD 55 C9 D4 22 48 B9 40 59 94 98" },
/* 39*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, NULL, -1, 1, 0, -1, "Warning 760: Converted to Shift JIS but no ECI specified\nFE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 40*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, 26, 0, -1, -1, NULL, -1, 1, 0, -1, "FE 5B F8\n82 72 08\nBA DA E8\nBA 52 E8\nBA 2A E8\n82 0A 08\nFE AB F8\n00 D8 00\nEF F6 20\nB5 C2 28\n36 28 88\nFD 42 10\n62 2A C8\n00 95 70\nFE B7 38\n82 FD D8\nBA 97 00\nBA 43 60\nBA C8 C8\n82 C3 68\nFE EA F8" },
/* 41*/ { BARCODE_QRCODE, "\223\137", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, NULL, -1, 1, 0, -1, "FE 2B F8\n82 0A 08\nBA A2 E8\nBA 0A E8\nBA 5A E8\n82 72 08\nFE AB F8\n00 A0 00\nEF AE 20\n75 B5 20\n82 F7 58\nF4 9D C8\n5E 17 28\n00 C2 20\nFE 88 80\n82 82 38\nBA EA A8\nBA 55 50\nBA D7 68\n82 BD D0\nFE B7 78" },
/* 42*/ { BARCODE_QRCODE, "\223\137", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, -1, -1, NULL, -1, 1, 0, -1, "FE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 43*/ { BARCODE_QRCODE, "\\x93\\x5F", NULL, NULL, NULL, DATA_MODE | ESCAPE_MODE, -1, 0, -1, -1, -1, 0, -1, 1, -1, -1, NULL, -1, 1, 0, -1, "FE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 44*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, -1, 0, 2, -1, NULL, -1, 1, 0, -1, "Warning 760: Converted to Shift JIS but no ECI specified\nFE 4B F8\n82 92 08\nBA 42 E8\nBA 92 E8\nBA 3A E8\n82 EA 08\nFE AB F8\n00 38 00\nFB CD 50\nA5 89 18\n0B 74 B8\nFC 81 A0\n92 34 B8\n00 DE 48\nFE AB 10\n82 5E 50\nBA C9 20\nBA C9 20\nBA F4 E0\n82 81 A0\nFE B4 E8" },
/* 45*/ { 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" },
/* 46*/ { 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" },
/* 47*/ { 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" },
/* 37*/ { BARCODE_DATAMATRIX, "A\\^1BC\\^^1DEF", NULL, NULL, NULL, EXTRA_ESCAPE_MODE, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "AA AA AA AA\nE0 B9 88 59\nD0 08 A3 14\n8D 9D DD DB\n8E 3E E5 E8\nDF 3B A5 A1\nB6 20 A6 02\nFF FF FF FF" },
/* 38*/ { BARCODE_EANX_CC, "[91]12", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, "12345678+12", -1, -1, 0, -1, "DB BC D3 9C 44 E9 D2 2C 19 E7 A2 D8 A0 00 00 00\nDB 31 1C 9C C7 29 92 47 D9 E9 40 C8 A0 00 00 00\nDA 3B EB 10 AF 09 9A 18 9D 7D 82 E8 A0 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n20 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n14 68 D1 A6 49 BD 55 C9 D4 22 48 B9 40 59 94 98" },
/* 39*/ { BARCODE_EANX_CC, "[91]12", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, -1, 0, -1, 2, "12345678+12", -1, -1, 0, -1, "D3 A3 E9 DB F5 C9 DB 43 D9 CB 98 D2 20 00 00 00\nD3 25 0F 11 E4 49 D3 51 F1 AC FC D6 20 00 00 00\nD1 33 48 19 39 E9 93 18 49 D8 98 D7 20 00 00 00\nD1 A6 FC DA 1C 49 9B C5 05 E2 84 D7 A0 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n20 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n14 68 D1 A6 49 BD 55 C9 D4 22 48 B9 40 59 94 98" },
/* 40*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, NULL, -1, 1, 0, -1, "Warning 760: Converted to Shift JIS but no ECI specified\nFE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 41*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, 26, 0, -1, -1, NULL, -1, 1, 0, -1, "FE 5B F8\n82 72 08\nBA DA E8\nBA 52 E8\nBA 2A E8\n82 0A 08\nFE AB F8\n00 D8 00\nEF F6 20\nB5 C2 28\n36 28 88\nFD 42 10\n62 2A C8\n00 95 70\nFE B7 38\n82 FD D8\nBA 97 00\nBA 43 60\nBA C8 C8\n82 C3 68\nFE EA F8" },
/* 42*/ { BARCODE_QRCODE, "\223\137", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, NULL, -1, 1, 0, -1, "FE 2B F8\n82 0A 08\nBA A2 E8\nBA 0A E8\nBA 5A E8\n82 72 08\nFE AB F8\n00 A0 00\nEF AE 20\n75 B5 20\n82 F7 58\nF4 9D C8\n5E 17 28\n00 C2 20\nFE 88 80\n82 82 38\nBA EA A8\nBA 55 50\nBA D7 68\n82 BD D0\nFE B7 78" },
/* 43*/ { BARCODE_QRCODE, "\223\137", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, -1, -1, 0, -1, 1, -1, -1, NULL, -1, 1, 0, -1, "FE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 44*/ { BARCODE_QRCODE, "\\x93\\x5F", NULL, NULL, NULL, DATA_MODE | ESCAPE_MODE, -1, 0, -1, -1, -1, 0, -1, 1, -1, -1, NULL, -1, 1, 0, -1, "FE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 45*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, -1, -1, 0, -1, 0, 2, -1, NULL, -1, 1, 0, -1, "Warning 760: Converted to Shift JIS but no ECI specified\nFE 4B F8\n82 92 08\nBA 42 E8\nBA 92 E8\nBA 3A E8\n82 EA 08\nFE AB F8\n00 38 00\nFB CD 50\nA5 89 18\n0B 74 B8\nFC 81 A0\n92 34 B8\n00 DE 48\nFE AB 10\n82 5E 50\nBA C9 20\nBA C9 20\nBA F4 E0\n82 81 A0\nFE B4 E8" },
/* 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" },
};
int data_size = ARRAY_SIZE(data);
int i;
+6 -9
View File
@@ -5,11 +5,7 @@
#define VER_FILEVERSION 2,16,0,9
#define VER_FILEVERSION_STR "2.16.0.9\0"
#ifdef GCC_WINDRES
VS_VERSION_INFO VERSIONINFO
#else
VS_VERSION_INFO VERSIONINFO
#endif
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_FILEVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
@@ -24,23 +20,24 @@ FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
//language ID = U.S. English, char set = Windows, Multilingual
BLOCK "040904B0"
//language ID = U.S. English, char set = Windows, Unicode
BEGIN
VALUE "CompanyName", "Zint\0"
VALUE "FileDescription", "zint barcode generator\0"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "zint.exe\0"
VALUE "LegalCopyright", "Copyright © 2025 Robin Stuart & BogDan Vatra\0"
VALUE "LegalCopyright", "Copyright © 2026 Robin Stuart & BogDan Vatra\0"
VALUE "OriginalFilename", "zint.exe\0"
VALUE "ProductName", "zint\0"
VALUE "ProductVersion", VER_FILEVERSION_STR
VALUE "License", "GNU General Public License version 3\0"
VALUE "License", "GPL-3.0-or-later\0"
VALUE "WWW", "https://www.sourceforge.net/projects/zint\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1250
VALUE "Translation", 0x0409, 1200
END
END
100 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "zint_black.ico"
+3 -2
View File
@@ -48,12 +48,13 @@
<item row="1" column="0" colspan="2">
<widget class="QRadioButton" name="radC128ExtraEsc">
<property name="text">
<string>&amp;Manual Code Sets and FNC1s (Extra Escape Mode)</string>
<string>&amp;Manual Code Sets and FNC1s (Extra Escape)</string>
</property>
<property name="toolTip">
<string>Process special escape sequences &quot;\^A&quot;, &quot;\^B&quot;, &quot;\^C&quot; and
&quot;\^@&quot; allowing manual Code Set selection and special
escape sequence &quot;\^1&quot; allowing manual FNC1s</string>
escape sequence &quot;\^1&quot; allowing manual FNC1s
(literal &quot;\^&quot; may be escaped with &quot;\^^&quot;)</string>
</property>
</widget>
</item>
+12
View File
@@ -389,6 +389,18 @@ the data with a slash &quot;/&quot;</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QRadioButton" name="radDMExtraEsc">
<property name="text">
<string>Manual FN&amp;C1s (Extra Escape)</string>
</property>
<property name="toolTip">
<string>Process special escape sequence &quot;\^1&quot;
allowing manual FNC1s
(literal &quot;\^&quot; may be escaped with &quot;\^^&quot;)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
+8 -2
View File
@@ -2026,6 +2026,7 @@ void MainWindow::change_options()
dm_startmode_ui_set();
tabMain->insertTab(1, m_optionWidget, tr("D&ata Matrix"));
connect(get_widget(QSL("radDMStand")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radDMExtraEsc")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radDMGS1")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("radDMHIBC")), SIGNAL(toggled(bool)), SLOT(update_preview()));
connect(get_widget(QSL("cmbDMSize")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview()));
@@ -3113,6 +3114,11 @@ void MainWindow::update_preview()
checkBox->setEnabled(false);
}
if (get_rad_val(QSL("radDMExtraEsc"))) {
m_bc.bc.setSymbol(BARCODE_DATAMATRIX);
m_bc.bc.setInputMode(m_bc.bc.inputMode() | EXTRA_ESCAPE_MODE);
}
m_bc.bc.setOption2(get_cmb_index(QSL("cmbDMSize")));
if (get_cmb_index(QSL("cmbDMSize")) == 0) {
@@ -4546,7 +4552,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
case BARCODE_HIBC_DM:
settings.setValue(QSL("studio/bc/datamatrix/size"), get_cmb_index(QSL("cmbDMSize")));
settings.setValue(QSL("studio/bc/datamatrix/encoding_mode"), get_rad_grp_index(
QStringList() << QSL("radDMStand") << QSL("radDMGS1") << QSL("radDMHIBC")));
QStringList() << QSL("radDMStand") << QSL("radDMGS1") << QSL("radDMHIBC") << QSL("radDMExtraEsc")));
settings.setValue(QSL("studio/bc/datamatrix/chk_suppress_rect"), get_chk_val(QSL("chkDMRectangle")));
settings.setValue(QSL("studio/bc/datamatrix/chk_allow_dmre"), get_chk_val(QSL("chkDMRE")));
settings.setValue(QSL("studio/bc/datamatrix/chk_gs_sep"), get_chk_val(QSL("chkDMGSSep")));
@@ -5024,7 +5030,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
case BARCODE_HIBC_DM:
set_cmb_from_setting(settings, QSL("studio/bc/datamatrix/size"), QSL("cmbDMSize"));
set_rad_from_setting(settings, QSL("studio/bc/datamatrix/encoding_mode"),
QStringList() << QSL("radDMStand") << QSL("radDMGS1") << QSL("radDMHIBC"));
QStringList() << QSL("radDMStand") << QSL("radDMGS1") << QSL("radDMHIBC") << QSL("radDMExtraEsc"));
set_chk_from_setting(settings, QSL("studio/bc/datamatrix/chk_suppress_rect"), QSL("chkDMRectangle"));
set_chk_from_setting(settings, QSL("studio/bc/datamatrix/chk_allow_dmre"), QSL("chkDMRE"));
set_chk_from_setting(settings, QSL("studio/bc/datamatrix/chk_gs_sep"), QSL("chkDMGSSep"));
+11 -14
View File
@@ -5,11 +5,7 @@
#define VER_FILEVERSION 2,16,0,9
#define VER_FILEVERSION_STR "2.16.0.9\0"
#ifdef GCC_WINDRES
VS_VERSION_INFO VERSIONINFO
#else
VS_VERSION_INFO VERSIONINFO
#endif
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_FILEVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
@@ -24,23 +20,24 @@ FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "000904b0"
BLOCK "040904B0"
//language ID = U.S. English, char set = Windows, Unicode
BEGIN
VALUE "CompanyName", "Robin Stuart & BogDan Vatra"
VALUE "FileDescription", "qtZint barcode generator"
VALUE "CompanyName", "Zint\0"
VALUE "FileDescription", "qtZint barcode generator\0"
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", "qtZint"
VALUE "LegalCopyright", "Copyright © 2025 Robin Stuart & BogDan Vatra"
VALUE "License", "GNU General Public License version 3"
VALUE "OriginalFilename", "qtZint"
VALUE "ProductName", "Zint Barcode Studio"
VALUE "InternalName", "qtZint\0"
VALUE "LegalCopyright", "Copyright © 2026 Robin Stuart & BogDan Vatra\0"
VALUE "OriginalFilename", "qtZint\0"
VALUE "ProductName", "Zint Barcode Studio\0"
VALUE "ProductVersion", VER_FILEVERSION_STR
VALUE "WWW", "https://www.zint.org.uk"
VALUE "License", "GPL-3.0-or-later\0"
VALUE "WWW", "https://www.zint.org.uk\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x9, 1200
VALUE "Translation", 0x0409, 1200
END
END
100 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "zint-qt.ico"
+6 -5
View File
@@ -1,4 +1,4 @@
% win32/README 2025-12-09
% win32/README 2026-04-18
Visual Studio 2022
------------------
@@ -129,8 +129,8 @@ Studio 2015, see "frontend_qt\HOWTO_BUILD_STANDALONE_MSVS2015.txt"
CMake and Visual Studio
-----------------------
Zint can also be built using CMake with Visual Studio 2022, 2019, 2017 or 2015.
The following example uses Visual Studio 2019 to build for x86/Win32:
Zint can also be built using CMake with Visual Studio 2026, 2022, 2019, 2017 or
2015. The following example uses Visual Studio 2019 to build for x86/Win32:
As above, follow the steps to build zlib, lpng and gs1encoders.
@@ -157,12 +157,13 @@ You should be able to run zint CLI and Zint Studio:
Note that the program name for Zint Studio when built using CMake is not
"qtZint.exe" but "zint-qt.exe".
For MSVC 2015 32-bit, MSVC 2017 32-bit and MSVC 2022 32-bit, the zint cmake
equivalents are (include the library locations as above):
For MSVC 2015 32-bit, MSVC 2017 32-bit, MSVC 2022 32-bit and MSVC 2026 32-bit,
the zint cmake equivalents are (include the library locations as above):
cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE=Release -B build^
cmake -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=Release -B build^
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=Release -B build^
cmake -G "Visual Studio 18 2026" -A Win32 -DCMAKE_BUILD_TYPE=Release -B build^
To build as 64-bit, open an "x64 Native Tools" Command Prompt and follow the
same instructions, using "MSVC 2019 64-bit" (or "MSVC 2022 64-bit") as the Qt