From a3cca33f32baa6743221778c30ef3118832e6fcf Mon Sep 17 00:00:00 2001
From: gitlost
Date: Wed, 8 Oct 2025 12:21:29 +0100
Subject: [PATCH] general: suppress clang-tidy-21/22 warnings; some code
fiddling on affected files manual: use new lua filter "lua-crossrefs.lua"
hacked from https://github.com/rnwst/pandoc-lua-crossrefs as replacement
for tablenos which broke with pandoc 2.8.2 (get nicer output anyway); fix
"excode39.svg" data $ -> # to avoid shell processing; document
`ZBarcode_HaveGS1SyntaxEngine()`
---
README.clang-tidy | 11 +-
backend/auspost.c | 46 +-
backend/code1.c | 11 +-
backend/composite.c | 2 +
backend/dmatrix.c | 8 +
backend/eci.c | 10 +-
backend/gridmtx.c | 56 +-
backend/gs1.c | 2 +
backend/pdf417.c | 2 +
backend/plessey.c | 7 +-
backend/ps.c | 5 +-
backend/qr.c | 4 +
backend/raster.c | 2 +
backend/rss.c | 2 +
backend/svg.c | 3 +
backend/tests/testcommon.c | 7 +-
backend/tif.c | 1 +
backend/ultra.c | 4 +
docs/Makefile | 28 +-
docs/README | 43 +-
docs/images/excode39.svg | 10 +-
docs/inc_header_pdf.tex | 42 +-
docs/lua-crossrefs/COPYING | 339 ++++++
docs/lua-crossrefs/lua-crossrefs.lua | 271 +++++
docs/manual.html | 1456 ++++++++++++--------------
docs/manual.pmd | 176 ++--
docs/manual.txt | 169 +--
docs/zint.1 | 4 +-
docs/zint.1.pmd | 2 +-
docs/zint_images.sh | 2 +-
30 files changed, 1645 insertions(+), 1080 deletions(-)
create mode 100644 docs/lua-crossrefs/COPYING
create mode 100644 docs/lua-crossrefs/lua-crossrefs.lua
diff --git a/README.clang-tidy b/README.clang-tidy
index 96c6779a..e1186ea3 100644
--- a/README.clang-tidy
+++ b/README.clang-tidy
@@ -1,22 +1,23 @@
-% README.clang-tidy 2025-02-15
-% Current as of latest clang-tidy-20 from Ubuntu 24.04 apt package
+% README.clang-tidy 2025-10-08
+% Current as of latest clang-tidy-22 via
+% wget https://apt.llvm.org/llvm.sh; chmod +x llvm.sh; sudo ./llvm.sh 22 all
Requires cmake in "build" sub-directory with -DCMAKE_EXPORT_COMPILE_COMMANDS=ON (for "build/compile_commands.json")
and -DCMAKE_BUILD_TYPE=Debug (so `assert()`s defined), and then make (for Qt generated includes).
In project root directory (warning, slow):
-clang-tidy-20 backend/*.c frontend/*.c backend_qt/*.cpp frontend_qt/*.cpp -p build/compile_commands.json
+clang-tidy-22 backend/*.c frontend/*.c backend_qt/*.cpp frontend_qt/*.cpp -p build/compile_commands.json
For "backend_tcl", which has no "compile_commands.json", specify the tcl include directory and package define, e.g.
-clang-tidy-20 backend_tcl/*.c -- -I/usr/include/tcl8.6 -DPACKAGE_VERSION='"2.14.0"'
+clang-tidy-22 backend_tcl/*.c -- -I/usr/include/tcl8.6 -DPACKAGE_VERSION='"2.15.0"'
Options are in ".clang-tidy" (in the project root directory). The excluded check is
`clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling` (for `sprintf()`).
The test suite (cmake given -DZINT_TEST=ON) can also be analysed with additional checks disabled:
-clang-tidy-20 backend/tests/*.c frontend/tests/*.c backend_qt/tests/*.cpp \
+clang-tidy-22 backend/tests/*.c frontend/tests/*.c backend_qt/tests/*.cpp \
-checks='-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-optin.performance.Padding' \
-p build/compile_commands.json
diff --git a/backend/auspost.c b/backend/auspost.c
index c5afba9d..91c1c6f4 100644
--- a/backend/auspost.c
+++ b/backend/auspost.c
@@ -30,8 +30,8 @@
*/
/* SPDX-License-Identifier: BSD-3-Clause */
-static const char GDSET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #";
-#define GDSET_F (IS_NUM_F | IS_UPR_F | IS_LWR_F | IS_SPC_F | IS_HSH_F)
+static const char AusGDSET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #";
+#define AUS_GDSET_F (IS_NUM_F | IS_UPR_F | IS_LWR_F | IS_SPC_F | IS_HSH_F)
static const char AusNTable[10][2] = {
{'0','0'}, {'0','1'}, {'0','2'}, {'1','0'}, {'1','1'}, {'1','2'}, {'2','0'}, {'2','1'}, {'2','2'}, {'3','0'}
@@ -65,25 +65,27 @@ static const char AusBarTable[64][3] = {
{'3','3','0'}, {'3','3','1'}, {'3','3','2'}, {'3','3','3'}
};
+#include
#include
#include "common.h"
#include "reedsol.h"
-static char aus_convert_pattern(char data, int shift) {
+static unsigned char aus_convert_pattern(const char data, const int shift) {
return (data - '0') << shift;
}
/* Adds Reed-Solomon error correction to auspost */
-static char *aus_rs_error(char data_pattern[], char *d) {
- int reader, length, triple_writer = 0;
+static char *aus_rs_error(const char data_pattern[], char *d) {
+ const int length = d - data_pattern;
+ int reader, triple_writer;
unsigned char triple[31];
unsigned char result[5];
rs_t rs;
- for (reader = 2, length = d - data_pattern; reader < length; reader += 3, triple_writer++) {
+ for (reader = 2, triple_writer = 0; reader < length; reader += 3, triple_writer++) {
triple[triple_writer] = aus_convert_pattern(data_pattern[reader], 4)
- + aus_convert_pattern(data_pattern[reader + 1], 2)
- + aus_convert_pattern(data_pattern[reader + 2], 0);
+ | aus_convert_pattern(data_pattern[reader + 1], 2)
+ | aus_convert_pattern(data_pattern[reader + 2], 0);
}
zint_rs_init_gf(&rs, 0x43);
@@ -97,6 +99,7 @@ static char *aus_rs_error(char data_pattern[], char *d) {
return d;
}
+/* In "postal.c" */
INTERNAL int zint_daft_set_height(struct zint_symbol *symbol, const float min_height, const float max_height);
/* Handles Australia Posts's 4 State Codes */
@@ -119,11 +122,14 @@ INTERNAL int zint_auspost(struct zint_symbol *symbol, unsigned char source[], in
char data_pattern[200];
char *d = data_pattern;
unsigned char fcc[2] = {0}; /* Suppress clang-tidy warning clang-analyzer-core.UndefinedBinaryOperatorResult */
- unsigned char dpid[9];
unsigned char local_source[30];
int zeroes = 0;
const int raw_text = symbol->output_options & BARCODE_RAW_TEXT;
+ /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+ assert(symbol->symbology == BARCODE_AUSPOST || symbol->symbology == BARCODE_AUSREPLY
+ || symbol->symbology == BARCODE_AUSROUTE || symbol->symbology == BARCODE_AUSREDIRECT);
+
/* Do all of the length checking first to avoid stack smashing */
if (symbol->symbology == BARCODE_AUSPOST) {
if (length != 8 && length != 13 && length != 16 && length != 18 && length != 23) {
@@ -134,8 +140,8 @@ INTERNAL int zint_auspost(struct zint_symbol *symbol, unsigned char source[], in
return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 403, "Input length %d too long (maximum 8)", length);
}
- /* Check input immediately to catch nuls */
- if ((i = z_not_sane(GDSET_F, source, length))) {
+ /* Check input immediately to catch invalid chars */
+ if ((i = z_not_sane(AUS_GDSET_F, source, length))) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 404,
"Invalid character at position %d in input (alphanumerics, space and \"#\" only)", i);
}
@@ -187,9 +193,9 @@ INTERNAL int zint_auspost(struct zint_symbol *symbol, unsigned char source[], in
memcpy(local_source + zeroes, source, length);
length += zeroes;
+
/* Verify that the first 8 characters are numbers */
- memcpy(dpid, local_source, 8);
- if ((i = z_not_sane(NEON_F, dpid, 8))) {
+ if ((i = z_not_sane(NEON_F, local_source, 8))) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 405,
"Invalid character at position %d in DPID (first 8 characters) (digits only)", i);
}
@@ -205,16 +211,16 @@ INTERNAL int zint_auspost(struct zint_symbol *symbol, unsigned char source[], in
/* Delivery Point Identifier (DPID) */
for (reader = 0; reader < 8; reader++, d += 2) {
- memcpy(d, AusNTable[dpid[reader] - '0'], 2);
+ memcpy(d, AusNTable[local_source[reader] - '0'], 2);
}
/* Customer Information */
if (length > 8) {
- if ((length == 13) || (length == 18)) {
+ if (length == 13 || length == 18) {
for (reader = 8; reader < length; reader++, d += 3) {
- memcpy(d, AusCTable[z_posn(GDSET, local_source[reader])], 3);
+ memcpy(d, AusCTable[z_posn(AusGDSET, local_source[reader])], 3);
}
- } else if ((length == 16) || (length == 23)) {
+ } else if (length == 16 || length == 23) {
for (reader = 8; reader < length; reader++, d += 2) {
memcpy(d, AusNTable[local_source[reader] - '0'], 2);
}
@@ -244,11 +250,11 @@ INTERNAL int zint_auspost(struct zint_symbol *symbol, unsigned char source[], in
writer = 0;
h = d - data_pattern;
for (loopey = 0; loopey < h; loopey++) {
- if ((data_pattern[loopey] == '1') || (data_pattern[loopey] == '0')) {
+ if (data_pattern[loopey] == '1' || data_pattern[loopey] == '0') {
z_set_module(symbol, 0, writer);
}
z_set_module(symbol, 1, writer);
- if ((data_pattern[loopey] == '2') || (data_pattern[loopey] == '0')) {
+ if (data_pattern[loopey] == '2' || data_pattern[loopey] == '0') {
z_set_module(symbol, 2, writer);
}
writer += 2;
@@ -272,7 +278,7 @@ INTERNAL int zint_auspost(struct zint_symbol *symbol, unsigned char source[], in
symbol->row_height[1] = 2.0f;
error_number = zint_daft_set_height(symbol, 0.0f, 0.0f);
}
- symbol->rows = 3;
+ symbol->rows = 3; /* Not stackable */
symbol->width = writer - 1;
if (raw_text && z_rt_cpy_cat(symbol, fcc, 2, '\xFF' /*separator (none)*/, local_source, length)) {
diff --git a/backend/code1.c b/backend/code1.c
index c38fd177..e4e9c378 100644
--- a/backend/code1.c
+++ b/backend/code1.c
@@ -204,7 +204,7 @@ static int c1_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 int is_extended = !z_isascii(c);
/* Step L */
if (z_isdigit(c)) {
@@ -456,7 +456,7 @@ static int c1_c40text_cnt(const int current_mode, const int gs1, unsigned char i
return 2;
}
cnt = 1;
- if (input & 0x80) {
+ if (!z_isascii(input)) {
cnt += 2;
input -= 128;
}
@@ -646,7 +646,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
if (next_mode == C1_ASCII) {
if (debug_print) printf("ASC(%d) ", source[sp]);
- if (source[sp] & 0x80) {
+ if (!z_isascii(source[sp])) {
/* Step B7 */
target[tp++] = 235; /* FNC4 (Upper Shift) */
target[tp++] = (source[sp] - 128) + 1;
@@ -700,9 +700,10 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
}
if (debug_print) fputs(current_mode == C1_C40 ? "C40 " : "TEXT ", stdout);
- if (source[sp] & 0x80) {
+ if (!z_isascii(source[sp])) {
cte_buffer[cte_p++] = 1; /* Shift 2 */
cte_buffer[cte_p++] = 30; /* FNC4 (Upper Shift) */
+ assert(source[sp] >= 128); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
if (ct_shift[source[sp] - 128]) {
cte_buffer[cte_p++] = ct_shift[source[sp] - 128] - 1;
}
@@ -900,7 +901,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], int len
if (z_is_twodigits(source, length, sp)) {
target[tp++] = z_to_int(source + sp, 2) + 130;
sp++;
- } else if (source[sp] & 0x80) {
+ } else if (!z_isascii(source[sp])) {
target[tp++] = 235; /* FNC4 (Upper Shift) */
target[tp++] = (source[sp] - 128) + 1;
} else if (gs1 && source[sp] == '\x1D') {
diff --git a/backend/composite.c b/backend/composite.c
index 2fc2f76a..c082b60f 100644
--- a/backend/composite.c
+++ b/backend/composite.c
@@ -572,6 +572,8 @@ static void cc_c(struct zint_symbol *symbol, const char source[], const int cc_w
chainemc[mclength++] = mccorrection[i];
}
+ assert(cc_width > 0); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
/* 818 - The CW string is finished */
symbol->rows = mclength / cc_width;
c1 = (symbol->rows - 1) / 3;
diff --git a/backend/dmatrix.c b/backend/dmatrix.c
index a760fe1b..0c88b0ef 100644
--- a/backend/dmatrix.c
+++ b/backend/dmatrix.c
@@ -549,6 +549,7 @@ static int dm_edi_buffer_xfer(int process_buffer[8], int process_p, unsigned cha
memmove(process_buffer, process_buffer + process_e, sizeof(int) * process_p);
if (empty) {
if (process_p == 3) {
+ assert(i < 6); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
target[tp++] = (unsigned char) (process_buffer[i] << 2 | (process_buffer[i + 1] & 0x30) >> 4);
target[tp++] = (unsigned char) ((process_buffer[i + 1] & 0x0F) << 4
| (process_buffer[i + 2] & 0x3C) >> 2);
@@ -558,6 +559,7 @@ static int dm_edi_buffer_xfer(int process_buffer[8], int process_p, unsigned cha
target[tp - 3], target[tp - 2], target[tp - 1]);
}
} else if (process_p == 2) {
+ assert(i < 7); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
target[tp++] = (unsigned char) (process_buffer[i] << 2 | (process_buffer[i + 1] & 0x30) >> 4);
target[tp++] = (unsigned char) ((process_buffer[i + 1] & 0x0F) << 4);
if (debug_print) {
@@ -565,6 +567,7 @@ static int dm_edi_buffer_xfer(int process_buffer[8], int process_p, unsigned cha
target[tp - 1]);
}
} else {
+ assert(i < 8); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
target[tp++] = (unsigned char) (process_buffer[i] << 2);
if (debug_print) printf("[%d (%d)] ", process_buffer[i], target[tp - 1]);
}
@@ -932,6 +935,8 @@ static void dm_addEdges(struct zint_symbol *symbol, const unsigned char source[]
const int last_seg, struct dm_edge *edges, const int from, struct dm_edge *previous, const int gs1) {
int i, pos;
+ assert(from < length); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
/* Not possible to unlatch a full EDF edge to something else */
if (previous == NULL || previous->endMode != DM_EDIFACT) {
@@ -1880,6 +1885,8 @@ static int dm_ecc200(struct zint_symbol *symbol, struct zint_seg segs[], const i
datablock = dm_matrixdatablock[symbolsize];
rsblock = dm_matrixrsblock[symbolsize];
+ assert(H > 1 && W > 1); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
taillength = bytes - binlen;
if (taillength != 0) {
@@ -1898,6 +1905,7 @@ static int dm_ecc200(struct zint_symbol *symbol, struct zint_seg segs[], const i
dm_ecc(binary, bytes, datablock, rsblock, skew);
if (debug_print) {
printf("ECC (%d): ", rsblock * (bytes / datablock));
+ assert(bytes > 0); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
for (i = bytes; i < bytes + rsblock * (bytes / datablock); i++) printf("%d ", binary[i]);
fputc('\n', stdout);
}
diff --git a/backend/eci.c b/backend/eci.c
index 12372d11..65d7fd9e 100644
--- a/backend/eci.c
+++ b/backend/eci.c
@@ -151,6 +151,10 @@ static int u_ascii_inv(const unsigned int u, unsigned char *dest) {
return 0;
}
+/* `NOLINT`s required due to disconnect between `z_decode_utf8()` decoding lengths and `zint_get_eci_length()` */
+
+/* NOLINTBEGIN(clang-analyzer-security.ArrayBound) clang-tidy-21 false positive */
+
/* ECI 25 UTF-16 Big Endian (ISO/IEC 10646) - assumes valid Unicode */
static int u_utf16be(const unsigned int u, unsigned char *dest) {
unsigned int u2, v;
@@ -205,6 +209,8 @@ static int u_utf32le(const unsigned int u, unsigned char *dest) {
return 4;
}
+/* NOLINTEND(clang-analyzer-security.ArrayBound) */
+
/* ECI 899 Binary, included for libzueci compatibility - assumes valid Unicode */
static int u_binary(const unsigned int u, unsigned char *dest) {
if (u <= 0xFF) {
@@ -634,6 +640,7 @@ static int u_gb18030(const unsigned int u, unsigned char *dest) {
unsigned int d1, d2;
int ret = u_gb18030_int(u, &d1, &d2);
if (ret) {
+ /* NOLINTBEGIN(clang-analyzer-security.ArrayBound) clang-tidy-21 false positive */
if (ret == 1) {
dest[0] = (unsigned char) d1;
} else {
@@ -644,6 +651,7 @@ static int u_gb18030(const unsigned int u, unsigned char *dest) {
dest[3] = (unsigned char) d2;
}
}
+ /* NOLINTEND(clang-analyzer-security.ArrayBound) */
}
return ret;
}
@@ -794,7 +802,7 @@ INTERNAL int zint_utf8_to_eci(const int eci, const unsigned char source[], unsig
}
out_posn += incr;
}
- dest[out_posn] = '\0';
+ dest[out_posn] = '\0'; /* NOLINT(clang-analyzer-security.ArrayBound) clang-tidy-21 false positive */
*p_length = out_posn;
return 0;
diff --git a/backend/gridmtx.c b/backend/gridmtx.c
index 5304168e..1836de30 100644
--- a/backend/gridmtx.c
+++ b/backend/gridmtx.c
@@ -33,6 +33,7 @@
/* This file implements Grid Matrix as specified in
AIM Global Document Number AIMD014 Rev. 1.63 Revised 9 Dec 2008 */
+#include
#include
#include "common.h"
#include "reedsol.h"
@@ -297,7 +298,7 @@ static void gm_add_byte_count(char binary[], const int byte_count_posn, const in
}
/* Add a control character to the data stream */
-static int gm_add_shift_char(char binary[], int bp, int shifty, const int debug_print) {
+static int gm_add_shift_char(char binary[], int bp, const int shifty, const int debug_print) {
int i;
int glyph = 0;
@@ -321,7 +322,7 @@ static int gm_add_shift_char(char binary[], int bp, int shifty, const int debug_
return bp;
}
-static int gm_encode(unsigned int ddata[], const int length, char binary[], const int eci, int *p_bp,
+static int gm_encode(const unsigned int ddata[], const int length, char binary[], const int eci, int *p_bp,
const int debug_print) {
/* Create a binary stream representation of the input data.
7 sets are defined - Chinese characters, Numerals, Lower case letters, Upper case letters,
@@ -733,10 +734,11 @@ static int gm_encode(unsigned int ddata[], const int length, char binary[], cons
return 0;
}
-static int gm_encode_segs(unsigned int ddata[], const struct zint_seg segs[], const int seg_count, char binary[],
- const int reader, const struct zint_structapp *p_structapp, int *p_bin_len, const int debug_print) {
+static int gm_encode_segs(const unsigned int ddata[], const struct zint_seg segs[], const int seg_count,
+ char binary[], const int reader, const struct zint_structapp *p_structapp, int *p_bin_len,
+ const int debug_print) {
int i;
- unsigned int *dd = ddata;
+ const unsigned int *dd = ddata;
int bp = 0;
int p;
@@ -863,11 +865,10 @@ static void gm_add_ecc(const char binary[], const int data_posn, const int layer
}
}
-static void gm_place_macromodule(char grid[], int x, int y, int word1, int word2, int size) {
- int i, j;
-
- i = (x * 6) + 1;
- j = (y * 6) + 1;
+static void gm_place_macromodule(char grid[], const int x, const int y, const int word1, const int word2,
+ const int size) {
+ const int i = (x * 6) + 1;
+ const int j = (y * 6) + 1;
if (word2 & 0x40) {
grid[(j * size) + i + 2] = '1';
@@ -913,10 +914,10 @@ static void gm_place_macromodule(char grid[], int x, int y, int word1, int word2
}
}
-static void gm_place_data_in_grid(unsigned char word[], char grid[], int modules, int size) {
- int x, y, macromodule, offset;
+static void gm_place_data_in_grid(const unsigned char word[], char grid[], const int modules, const int size) {
+ int x, y, macromodule;
+ const int offset = 13 - ((modules - 1) / 2);
- offset = 13 - ((modules - 1) / 2);
for (y = 0; y < modules; y++) {
for (x = 0; x < modules; x++) {
macromodule = gm_macro_matrix[((y + offset) * 27) + (x + offset)];
@@ -926,8 +927,9 @@ static void gm_place_data_in_grid(unsigned char word[], char grid[], int modules
}
/* Place the layer ID into each macromodule */
-static void gm_place_layer_id(char *grid, int size, int layers, int modules, int ecc_level) {
+static void gm_place_layer_id(char *grid, const int size, const int layers, const int ecc_level) {
int i, j, layer, start, stop;
+ const int modules = 1 + (layers << 1);
int *layerid = (int *) z_alloca(sizeof(int) * (layers + 1));
int *id = (int *) z_alloca(sizeof(int) * (modules * modules));
@@ -947,8 +949,8 @@ static void gm_place_layer_id(char *grid, int size, int layers, int modules, int
}
/* Calculate which value goes in each macromodule */
- start = modules / 2;
- stop = modules / 2;
+ start = modules >> 1;
+ stop = modules >> 1;
for (layer = 0; layer <= layers; layer++) {
for (i = start; i <= stop; i++) {
id[(start * modules) + i] = layerid[layer];
@@ -1174,24 +1176,24 @@ INTERNAL int zint_gridmatrix(struct zint_symbol *symbol, struct zint_seg segs[],
memset(grid, '0', size_squared);
gm_place_data_in_grid(word, grid, modules, size);
- gm_place_layer_id(grid, size, layers, modules, ecc_level);
+ gm_place_layer_id(grid, size, layers, ecc_level);
/* Add macromodule frames */
for (x = 0; x < modules; x++) {
- int dark = 1 - (x & 1);
+ const int x_offset = x * 6;
+ int dark = !(x & 1);
for (y = 0; y < modules; y++) {
- if (dark == 1) {
+ if (dark) {
+ const int y_offset = y * 6 * size;
for (i = 0; i < 5; i++) {
- grid[((y * 6) * size) + (x * 6) + i] = '1';
- grid[(((y * 6) + 5) * size) + (x * 6) + i] = '1';
- grid[(((y * 6) + i) * size) + (x * 6)] = '1';
- grid[(((y * 6) + i) * size) + (x * 6) + 5] = '1';
+ grid[y_offset + x_offset + i] = '1';
+ grid[y_offset + 5 * size + x_offset + i] = '1';
+ grid[y_offset + i * size + x_offset] = '1';
+ grid[y_offset + i * size + x_offset + 5] = '1';
}
- grid[(((y * 6) + 5) * size) + (x * 6) + 5] = '1';
- dark = 0;
- } else {
- dark = 1;
+ grid[y_offset + 5 * size + x_offset + 5] = '1';
}
+ dark = !dark;
}
}
diff --git a/backend/gs1.c b/backend/gs1.c
index f2aab7ff..4ff12513 100644
--- a/backend/gs1.c
+++ b/backend/gs1.c
@@ -1640,6 +1640,7 @@ static int gs1se_verify(struct zint_symbol *symbol, const unsigned char source[]
char msgBuf[120];
gs1_encoder_init_status_t status = GS1_ENCODERS_INIT_SUCCESS;
gs1_encoder_init_opts_t opts = {
+ /* NOLINTNEXTLINE(clang-analyzer-optin.core.EnumCastOutOfRange) suppress clang-tidy-21 warning OR-ing enums */
sizeof(gs1_encoder_init_opts_t), gs1_encoder_iNO_SYNDICT | gs1_encoder_iQUIET, &status, msgBuf, sizeof(msgBuf)
};
gs1_encoder *ctx;
@@ -1847,6 +1848,7 @@ INTERNAL int zint_gs1_verify(struct zint_symbol *symbol, const unsigned char sou
}
}
if (i != length) {
+ assert(length > 0); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
local_source = local_source_buf;
/* Replace with control-char placeholders */
for (i = 0, j = 0; i < length; i++) {
diff --git a/backend/pdf417.c b/backend/pdf417.c
index 33e17d4f..06666d7a 100644
--- a/backend/pdf417.c
+++ b/backend/pdf417.c
@@ -1395,6 +1395,8 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int
if (debug_print) printf("\nSymbol size:\n%d columns x %d rows\n", cols, rows);
+ assert(cols > 0); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
/* 818 - The CW string is finished */
c1 = (rows - 1) / 3;
c2 = ecc * 3 + (rows - 1) % 3;
diff --git a/backend/plessey.c b/backend/plessey.c
index 0d4023be..7fb51d3b 100644
--- a/backend/plessey.c
+++ b/backend/plessey.c
@@ -30,10 +30,11 @@
*/
/* SPDX-License-Identifier: BSD-3-Clause */
+#include
#include
#include "common.h"
-#define SSET_F (IS_NUM_F | IS_UHX_F) /* SSET "0123456789ABCDEF" */
+#define PLESS_SSET_F (IS_NUM_F | IS_UHX_F) /* SSET "0123456789ABCDEF" */
static const char PlessTable[16][8] = {
{'1','3','1','3','1','3','1','3'}, {'3','1','1','3','1','3','1','3'}, {'1','3','3','1','1','3','1','3'},
@@ -67,7 +68,7 @@ INTERNAL int zint_plessey(struct zint_symbol *symbol, unsigned char source[], in
if (length > 67) { /* 16 + 67 * 16 + 4 * 8 + 19 = 1139 */
return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 370, "Input length %d too long (maximum 67)", length);
}
- if ((i = z_not_sane(SSET_F, source, length))) {
+ if ((i = z_not_sane(PLESS_SSET_F, source, length))) {
return z_errtxtf(ZINT_ERROR_INVALID_DATA, symbol, 371,
"Invalid character at position %d in input (digits and \"ABCDEF\" only)", i);
}
@@ -334,6 +335,8 @@ INTERNAL int zint_msi_plessey(struct zint_symbol *symbol, unsigned char source[]
int no_checktext = 0;
const int raw_text = symbol->output_options & BARCODE_RAW_TEXT;
+ assert(length > 0); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
if (length > 92) { /* 3 (Start) + 92 * 12 + 3 * 12 + 4 (Stop) = 1147 */
return z_errtxtf(ZINT_ERROR_TOO_LONG, symbol, 372, "Input length %d too long (maximum 92)", length);
}
diff --git a/backend/ps.c b/backend/ps.c
index bf264006..b597f8bb 100644
--- a/backend/ps.c
+++ b/backend/ps.c
@@ -76,6 +76,8 @@ static void ps_convert(const unsigned char *string, unsigned char *ps_string) {
const unsigned char *s;
unsigned char *p = ps_string;
+ /* `NOLINT` required due to disconnect between `symbol->text` and vector `string`s which are always <= */
+ /* NOLINTBEGIN(clang-analyzer-security.ArrayBound) clang-tidy-21 false positive */
for (s = string; *s; s++) {
switch (*s) {
case '(':
@@ -95,10 +97,10 @@ static void ps_convert(const unsigned char *string, unsigned char *ps_string) {
*p++ = *s;
}
break;
-
}
}
*p = '\0';
+ /* NOLINTEND(clang-analyzer-security.ArrayBound) */
}
#ifdef ZINT_TEST /* Wrapper for direct testing */
@@ -344,6 +346,7 @@ INTERNAL int zint_ps_plot(struct zint_symbol *symbol) {
for (i = 0; i <= 8; i++) {
for (rect = symbol->vector->rectangles; rect; rect = rect->next) {
if ((i == 0 && rect->colour == -1) || rect->colour == i) {
+ assert(u_i < rect_cnt); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
ultra_rects[u_i++] = rect;
}
}
diff --git a/backend/qr.c b/backend/qr.c
index 15f0148a..80a51de0 100644
--- a/backend/qr.c
+++ b/backend/qr.c
@@ -1829,6 +1829,8 @@ INTERNAL int zint_qrcode(struct zint_symbol *symbol, struct zint_seg segs[], con
size = qr_sizes[version - 1];
size_squared = size * size;
+ assert(size >= 21); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
grid = (unsigned char *) z_alloca(size_squared);
memset(grid, 0, size_squared);
@@ -2736,6 +2738,8 @@ INTERNAL int zint_rmqr(struct zint_symbol *symbol, struct zint_seg segs[], const
h_size = rmqr_width[version];
v_size = rmqr_height[version];
+ assert(h_size >= 27 && v_size >= 7); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
grid = (unsigned char *) z_alloca(h_size * v_size);
memset(grid, 0, h_size * v_size);
diff --git a/backend/raster.c b/backend/raster.c
index edbd3bd0..20df2b7e 100644
--- a/backend/raster.c
+++ b/backend/raster.c
@@ -998,6 +998,8 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
main_width = symbol->width;
+ assert(symbol->rows >= 1); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
if (z_is_composite(symbol->symbology)) {
while (!z_module_is_set(symbol, symbol->rows - 1, comp_xoffset)) {
comp_xoffset++;
diff --git a/backend/rss.c b/backend/rss.c
index bf4e1b87..fac6f1f8 100644
--- a/backend/rss.c
+++ b/backend/rss.c
@@ -288,6 +288,8 @@ INTERNAL int zint_dbar_omnstk_set_height(struct zint_symbol *symbol, const int f
const int second_row = first_row + 2; /* 2 row separator */
int i;
+ assert(first_row >= 0); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
for (i = 0; i < symbol->rows; i++) {
if (i != first_row && i != second_row) {
fixed_height += symbol->row_height[i];
diff --git a/backend/svg.c b/backend/svg.c
index e20a8502..4a36228f 100644
--- a/backend/svg.c
+++ b/backend/svg.c
@@ -59,6 +59,8 @@ static void svg_pick_colour(const int colour, char colour_code[7]) {
/* Convert text to use HTML entity codes */
static void svg_make_html_friendly(const unsigned char *string, char *html_version) {
+ /* `NOLINT` required due to disconnect between `symbol->text` and vector `string`s which are always <= */
+ /* NOLINTBEGIN(clang-analyzer-security.ArrayBound) clang-tidy-21 false positive */
for (; *string; string++) {
switch (*string) {
case '>':
@@ -93,6 +95,7 @@ static void svg_make_html_friendly(const unsigned char *string, char *html_versi
}
*html_version = '\0';
+ /* NOLINTEND(clang-analyzer-security.ArrayBound) */
}
/* Helper to output floating point attribute */
diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c
index df58382a..ae44b4df 100644
--- a/backend/tests/testcommon.c
+++ b/backend/tests/testcommon.c
@@ -1437,6 +1437,9 @@ int testUtilDataPath(char *buffer, int buffer_size, const char *subdir, const ch
int i;
#endif
+ assert(buffer); /* Suppress clang-tidy-21 clang-analyzer-core.NonNullParamChecker */
+
+ /* Apparently `getenv()` & `getcwd()` "taint" stuff (external attack vectors) hence later NOLINTs */
if ((cmake_src_dir = getenv("CMAKE_CURRENT_SOURCE_DIR")) != NULL) {
len = (int) strlen(cmake_src_dir);
if (len <= 0 || len >= buffer_size) {
@@ -1500,7 +1503,7 @@ int testUtilDataPath(char *buffer, int buffer_size, const char *subdir, const ch
}
if (subdir_len) {
- if (*subdir != '/' && buffer[len - 1] != '/') {
+ if (*subdir != '/' && buffer[len - 1] != '/') { /* NOLINT(clang-analyzer-security.ArrayBound) - see above */
if (len + 1 >= buffer_size) {
fprintf(stderr, "testUtilDataPath: subdir len (%d) + 1 >= buffer_size (%d)\n", len, buffer_size);
return 0;
@@ -1518,7 +1521,7 @@ int testUtilDataPath(char *buffer, int buffer_size, const char *subdir, const ch
}
if (filename_len) {
- if (*filename != '/' && buffer[len - 1] != '/') {
+ if (*filename != '/' && buffer[len - 1] != '/') { /* NOLINT(clang-analyzer-security.ArrayBound) - see above */
if (len + 1 >= buffer_size) {
fprintf(stderr, "testUtilDataPath: filename len (%d) + 1 >= buffer_size (%d)\n", len, buffer_size);
return 0;
diff --git a/backend/tif.c b/backend/tif.c
index ef1fd998..f71cfb1a 100644
--- a/backend/tif.c
+++ b/backend/tif.c
@@ -278,6 +278,7 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char
bytes_per_strip = rows_per_strip * ((symbol->bitmap_width + pixels_per_sample - 1) / pixels_per_sample)
* samples_per_pixel;
+ assert(bytes_per_strip >= 0); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
strip_offset = (uint32_t *) z_alloca(sizeof(uint32_t) * strip_count);
strip_bytes = (uint32_t *) z_alloca(sizeof(uint32_t) * strip_count);
diff --git a/backend/ultra.c b/backend/ultra.c
index 3d876f0d..3a460fcf 100644
--- a/backend/ultra.c
+++ b/backend/ultra.c
@@ -32,6 +32,7 @@
/* This version was developed using AIMD/TSC15032-43 v0.99c Edit 60, dated 4th Nov 2015 */
+#include
#include
#include "common.h"
@@ -637,6 +638,8 @@ static int ult_generate_codewords(struct zint_symbol *symbol, const unsigned cha
char *mode = (char *) z_alloca(length + 1);
int *cw_fragment = (int *) z_alloca(sizeof(int) * (length * 2 + 1));
+ assert(length > 0); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
+
/* Check for 06 Macro Sequence and crop accordingly */
if (length >= 9
&& source[0] == '[' && source[1] == ')' && source[2] == '>' && source[3] == '\x1e'
@@ -694,6 +697,7 @@ static int ult_generate_codewords(struct zint_symbol *symbol, const unsigned cha
}
input_locn += ascii_encoded;
} else if (mode[input_locn] == 'c') {
+ assert(c43_encoded >= 0); /* Suppress clang-tidy-21 clang-analyzer-security.ArrayBound */
for (i = 0; i < c43_encoded; i++) {
mode[input_locn + i] = 'c';
}
diff --git a/docs/Makefile b/docs/Makefile
index 7ee8dc50..304a5099 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -2,7 +2,7 @@
# Copyright (C) 2022-2025
# vim: set ts=4 sw=4 noet :
#
-# Requires a recent version of pandoc, plus pandoc-tablenos, xelatex and various other packages - see "README"
+# Requires pandoc 3.8.2, plus xelatex and various other packages - see "README"
# .svg images generated by "zint_images.sh"
SOURCE = manual.pmd
@@ -16,6 +16,8 @@ INCLUDES_TXT = inc_header_txt.tex
INC_TXT = --include-in-header $(INCLUDES_TXT)
SOURCE_MAN_PAGE = zint.1.pmd
OUT_MAN_PAGE = zint.1
+LUA_FILTER = lua-crossrefs/lua-crossrefs.lua
+INFRASTRUCTURE = Makefile $(LUA_FILTER)
IMAGES = \
images/zint.png \
images/zint-qt.png \
@@ -148,15 +150,18 @@ IMAGES = \
MAIN_FONT = mainfont="TeX Gyre Pagella"
MONO_FONT = monofont="Liberation Mono"
CJK_FONT = CJKmainfont="WenQuanYi Micro Hei Mono"
-PDF_OPTS = --pdf-engine=xelatex --filter pandoc-tablenos -M tablenos-warning-level=0 \
- --highlight-style=haddock -V colorlinks -V geometry:margin=20mm -V papersize=a4 -V csquotes=true --dpi=300
+PDF_OPTS = --pdf-engine=xelatex \
+ --lua-filter=$(LUA_FILTER) \
+ --syntax-highlighting=haddock -V colorlinks -V geometry:margin=20mm -V papersize=a4 \
+ -V csquotes=true --dpi=300
TEX_MAN_PAGE = zint.1.tex
-TXT_OPTS = --filter pandoc-tablenos -M tablenos-warning-level=0 --columns 80 --eol=lf -t plain
+TXT_OPTS = --lua-filter=$(LUA_FILTER) \
+ --columns 80 --eol=lf -t plain
MAN_PAGE_OPTS = -s -t man
all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN_PAGE) $(OUT_HTML)
-$(OUT_PDF) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile
+$(OUT_PDF) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) $(INFRASTRUCTURE)
pandoc $(SOURCE_MAN_PAGE) -f markdown \
$(PDF_OPTS) \
-o $(TEX_MAN_PAGE)
@@ -167,7 +172,7 @@ $(OUT_PDF) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PD
--include-after-body $(TEX_MAN_PAGE) \
-o $(OUT_PDF)
-$(OUT_TXT) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INCLUDES_TXT) Makefile
+$(OUT_TXT) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INCLUDES_TXT) $(INFRASTRUCTURE)
pandoc $(SOURCE) $(SOURCE_MAN_PAGE) -f markdown $(INC_TXT) --toc --toc-depth=4 \
-V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \
$(TXT_OPTS) \
@@ -179,19 +184,19 @@ $(OUT_TXT) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INCLUDES_TXT) Makefile
-e 's/ *$$//' \
-e '/^\[.*\]$$/{N;N;s/\[\(.*\)\]\n\n\1/[\1]/;p;d}' \
-e 's/ *{#tbl:[^}]*}//' \
- -e 's/: Table\xC2\xA0: \([^:]*\):/Table : \1/' \
+ -e 's/^ : Table/ Table/' \
$(OUT_TXT)
# Wrap
sed -i '/.\{81\}/{s/.\{80\}/&\n/}' $(OUT_TXT)
-$(OUT_MAN_PAGE) : $(SOURCE_MAN_PAGE) Makefile
+$(OUT_MAN_PAGE) : $(SOURCE_MAN_PAGE) $(INFRASTRUCTURE)
pandoc $(SOURCE_MAN_PAGE) -f markdown \
$(MAN_PAGE_OPTS) \
-o $(OUT_MAN_PAGE)
# For debugging
-manual.tex : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile
+manual.tex : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) $(INFRASTRUCTURE)
pandoc $(SOURCE_MAN_PAGE) -f markdown \
$(PDF_OPTS) \
-o $(TEX_MAN_PAGE)
@@ -204,13 +209,14 @@ manual.tex : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PD
# HTML one-page (uses modified "templates/styles.html", unchanged "templates/default.html")
-HTML_OPTS = --filter pandoc-tablenos -M tablenos-warning-level=0 --highlight-style=haddock \
+HTML_OPTS = --lua-filter=$(LUA_FILTER) \
+ --syntax-highlighting=haddock \
--template=templates/default.html --eol=lf -s -t html
INC_BEFORE_BODY_HTML = inc_before_body_html.html
INC_HTML = --include-before-body $(INC_BEFORE_BODY_HTML)
TEMPLATES_HTML = templates/default.html templates/styles.html
-$(OUT_HTML) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_BEFORE_BODY_HTML) $(TEMPLATES_HTML) Makefile
+$(OUT_HTML) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_BEFORE_BODY_HTML) $(TEMPLATES_HTML) $(INFRASTRUCTURE)
pandoc $(SOURCE) $(SOURCE_MAN_PAGE) -f markdown+link_attributes $(INC_HTML) --toc --toc-depth=4 \
-V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \
$(HTML_OPTS) \
diff --git a/docs/README b/docs/README
index bfa9f267..142f4ff3 100644
--- a/docs/README
+++ b/docs/README
@@ -1,41 +1,22 @@
-% docs/README 2025-09-16
+% docs/README 2025-10-08
-For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" using a recent version of pandoc
+For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" using pandoc 3.8.2.
On Ubuntu/Debian (tested on Ubuntu 22.04 and Ubuntu 24.04)
- wget https://github.com/jgm/pandoc/releases/download/3.8/pandoc-3.8-1-amd64.deb
- sudo dpkg -i pandoc-3.8-1-amd64.deb
-For Ubuntu 22.04 (python < 3.12)
- sudo apt install python3-pip
- pip install pandoc-tablenos --user
-Else for Ubuntu 24.04 (one way around "externally-managed-environment" error, PEP 668)
- sudo apt install python3-full
- python3 -m venv ~/py_envs
- source ~/py_envs/bin/activate
- pip install pandoc-tablenos
-Then
- export PATH=~/.local/bin:"$PATH"
- # Temporary fix for version regex - see https://github.com/tomduck/pandoc-xnos/pull/29
- python -m pip install --force-reinstall \
- git+https://github.com/tomduck/pandoc-xnos@284474574f51888be75603e7d1df667a0890504d#egg=pandoc-xnos
+ wget https://github.com/jgm/pandoc/releases/download/3.8.2/pandoc-3.8.2-1-amd64.deb
+ sudo dpkg -i pandoc-3.8.2-1-amd64.deb
sudo apt install librsvg2-bin
sudo apt install texlive-xetex
sudo apt install texlive-lang-cjk
sudo apt install fonts-wqy-microhei
make
-On Fedora (tested on Fedora Linux 38 (Workstation Edition) and Fedora Linux 40 (Workstation Edition))
+On Fedora (tested on Fedora Linux 38 (Workstation Edition) and Fedora Linux 42 (Workstation Edition))
- wget https://github.com/jgm/pandoc/releases/download/3.8/pandoc-3.8-linux-amd64.tar.gz
- tar xf pandoc-3.8-linux-amd64.tar.gz
- sudo mv -i pandoc-3.8/bin/pandoc /usr/local/bin
- sudo dnf install python3-pip
- pip install pandoc-tablenos --user
- export PATH=~/.local/bin:"$PATH"
- # Temporary fix for version regex - see https://github.com/tomduck/pandoc-xnos/pull/29
- python -m pip install --force-reinstall \
- git+https://github.com/tomduck/pandoc-xnos@284474574f51888be75603e7d1df667a0890504d#egg=pandoc-xnos
+ wget https://github.com/jgm/pandoc/releases/download/3.8.2/pandoc-3.8.2-linux-amd64.tar.gz
+ tar xf pandoc-3.8.2-linux-amd64.tar.gz
+ sudo mv -i pandoc-3.8.2/bin/pandoc /usr/local/bin
sudo dnf install librsvg2-tools.x86_64
sudo dnf install texlive-xetex
sudo dnf install texlive-ctex.noarch
@@ -51,3 +32,11 @@ On Fedora (tested on Fedora Linux 38 (Workstation Edition) and Fedora Linux 40 (
On Windows
Not compatible.
+
+On BSD
+
+ TODO
+
+On macOS
+
+ TODO
diff --git a/docs/images/excode39.svg b/docs/images/excode39.svg
index ee3fe941..25987689 100644
--- a/docs/images/excode39.svg
+++ b/docs/images/excode39.svg
@@ -1,12 +1,12 @@
-
Below is a brief guide to Zint Barcode Studio.
3.1 Main Window and Data Tab
-
-Zint Barcode Studio on startup - main
-window with Data tab
+Figure 1: Zint Barcode
+Studio on startup - main window with Data tab
This is the main window of Zint Barcode Studio. The top of the window
shows a preview of the barcode that the current settings would create.
@@ -1055,17 +1055,17 @@ clicking the "Menu" button, along with
options are also available in a context menu by right-clicking the
preview.
-
-Zint Barcode Studio main menu (left) and
-context menu (right)
+Figure 2: Zint Barcode
+Studio main menu (left) and context menu (right)
3.2 GS1 Composite Groupbox
-
-Zint Barcode Studio encoding GS1
-Composite data
+Figure 3: Zint Barcode
+Studio encoding GS1 Composite data
In the middle of the Data tab is an area for creating composite
symbologies which appears when the currently selected symbology is
@@ -1077,10 +1077,10 @@ href="#gs1-composite-symbols-iso-24723">6.3 GS1 Composite Symbols (ISO
For symbologies that support ECIs (Extended Channel Interpretations)
the middle of the Data tab is an area for entering additional data
@@ -1090,10 +1090,10 @@ href="#multiple-segments">4.16 Multiple Segments for details.
3.4 Symbology-specific
Groupbox
-
-Zint Barcode Studio showing Code 2 of 5
-Interleaved settings
+Figure 5: Zint Barcode
+Studio showing Code 2 of 5 Interleaved settings
Many symbologies have extra options to change the content, format and
appearance of the symbol generated. For those with few additional
@@ -1106,10 +1106,10 @@ Interleaved Code 2 of 5 (ISO 16390)).
ECIs) have a second Symbology-specific tab, shown next.
The Appearance tab can be used to adjust the dimensions and other
properties of the symbol.
@@ -1149,9 +1149,10 @@ the Set Printing Scale Dialog - see 4.9 Adjusting Image Size
(X-dimension) for further details.
-
-Adjusting the Print Size
+Figure 8: Adjusting the
+Print Size
The foreground and background colours can be set either using the
text boxes which accept "RRGGBBAA" hexadecimal values and
@@ -1160,9 +1161,10 @@ foreground eye and background eye buttons which invoke a colour picker.
(Note that to change the colours visually, the luminance slider, the
long narrow column on the right, must be adjusted.) The color picker
@@ -1174,9 +1176,10 @@ for the other using the swap button next to it.
Clicking on the ellipsis "..." button next to the
"Data to Encode" text box in the Data tab opens a larger
@@ -1194,10 +1197,10 @@ both Windows and Unix. (For details on escape sequences, see 4.1 Inputting Data.)
3.8 Sequence Dialog
-
-Creating a sequence of barcode
-symbols
+Figure 11: Creating a
+sequence of barcode symbols
Clicking on the sequence button (labelled "1234..") in
the Data tab opens the Sequence Dialog. This allows you to create
@@ -1208,10 +1211,9 @@ a file. Zint will generate a separate barcode image for each line of
text in the right hand panel. The format field determines the format of
the automatically generated sequence where characters have the meanings
as given below:
-
-
-
Table : Sequence Format Characters
+
+
Table 1: Sequence Format
+Characters
Character
@@ -1237,16 +1239,15 @@ data-tag=": Sequence Format Characters">
-
Once you’re happy with the Sequence Data, click the
"Export..." button to bring up the Export Dialog, discussed
next.
3.9 Export Dialog
-
-Setting filenames for an exported
-sequence of barcode symbols
+Figure 12: Setting
+filenames for an exported sequence of barcode symbols
The Export Dialog invoked by pressing the "Export..."
button in the Sequence Dialog sets the parameters for exporting the
@@ -1256,9 +1257,10 @@ that the symbology, colour and other formatting information are taken
from the main window.
The CLI Equivalent Dialog can be invoked from the main menu or the
context menu and displays the CLI command that will reproduce the
@@ -1315,9 +1317,9 @@ as shown in 4.11 Input Modes below.
backslash (\) as an escape character in combination with
the --esc switch. Permissible sequences are shown in the
table below.
-
-
-
Table : Escape Sequences
+
+
Table 2: Escape
+Sequences
@@ -1463,7 +1465,6 @@ is hexadecimal (000000-10FFFF)
The currently supported output file formats are shown in the
-following table.
-
-
-
Table : Output File Formats
+
The currently supported output file formats are:
+
+
Table 3: Output File
+Formats
Extension
@@ -1543,7 +1543,6 @@ href="#other-options">4.19 Other Options)
-
The filename can contain directories and sub-directories also, which
will be created if they don’t already exist:
zint-b DATAMATRIX -o datamatrix.png -d"Data to encode"
Names are treated case-insensitively by the CLI, and the
BARCODE_ prefix and any underscores are optional.
-
-
-
Table : Barcode Types (Symbologies)
+
+
Table 4: Barcode Types
+(Symbologies)
@@ -2109,7 +2108,6 @@ component
-
4.4 Adjusting Height
The height of a symbol (except those with a fixed width-to-height
ratio) can be adjusted using the --height switch. For
@@ -2139,10 +2137,10 @@ there are. For instance
gives a box with a width 10 times the X-dimension of the symbol. Note
that when specifying a box, horizontal whitespace is usually required in
@@ -2203,10 +2201,10 @@ barcode, inside any vertical whitespace (or text). For matrix symbols,
however, where they are decorative rather than functional, boundary bars
appear outside any whitespace.
Codablock-F, Code 16K and Code 49 always have boundary bars, and
default to particular horizontal whitespace values. Special
@@ -2237,10 +2235,10 @@ command
Zint also supports RGBA colour information for those output file
formats which support alpha channels (currently only GIF, PCX, PNG, SVG
@@ -2249,10 +2247,10 @@ not both) in a "RRGGBBAA" format. For example:
will produce a semi-transparent green foreground with a standard
(white) background. Note that transparency is treated differently by
@@ -2275,10 +2273,10 @@ values from 0 to 100. RGB values may still be used, in which case they
will be converted formulaically to CMYK approximations.
The symbol can be rotated through four orientations using the
--rotate option followed by the angle of rotation, valid
@@ -2309,10 +2307,9 @@ output, text will not be printed for scales less than 1.
X-dimension of 0.2 (or for MaxiCode EMF output, 4). The maximum scale
for both raster and vector is 200.
To summarize the more intricate details:
-
-
-
Table : Scaling Multipliers and Minima
+
+
Table 5: Scaling Multipliers
+and Minima
@@ -2367,7 +2364,6 @@ data-tag=": Scaling Multipliers and Minima">
-
4.9.1 Scaling by
X-dimension and Resolution
An alternative way to specify the scale, which takes the above
@@ -2430,10 +2426,10 @@ smaller font can be substituted using the --small option.
The --bold and --small options can be used
together if required, but only for vector output.
The gap between the barcode and the text can be adjusted using the
--textgap option, where the gap is given in X-dimensions,
@@ -2441,20 +2437,20 @@ and may be negative (minimum -5.0X, maximum 10.0X). The default gap is
1X. Note that a very small gap may cause accented texts to overlap with
the barcode:
For SVG output, the font preferred by Zint (monospaced “OCR-B” for
EAN/UPC, “Arimo” - a proportional sans-serif font metrically compatible
with “Arial” - for all others) can be embedded in the file for
portability using the --embedfont option:
4.11.1 Unicode, Data, and GS1
@@ -2468,10 +2464,9 @@ Chinese (Hanzi) characters which are also converted from UTF-8.
There are two exceptions to the Latin-1 default: Grid Matrix, whose
default character set is GB 2312 (Chinese); and UPNQR, whose default
character set is Latin-2 (ISO/IEC 8859-2 plus ASCII).
If Zint encounters characters which can not be encoded using the
default character encoding then it will take advantage of the ECI
(Extended Channel Interpretations) mechanism to encode the data if the
@@ -2614,13 +2608,13 @@ 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 : ECI Codes below. The ECI
+value from Table 8: ECI Codes below. The ECI
information is added to your code symbol as prefix data. The symbologies
that support ECI are
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 by the default character set then you should
@@ -2654,9 +2647,8 @@ barcode reader.
followed by the value in the column "ECI Code" in the table
below. The input data should be UTF-8 formatted. Zint automatically
translates the data into the target encoding.
-
-
-
Table : ECI Codes
+
+
Table 8: ECI Codes
ECI Code
@@ -2799,12 +2791,11 @@ role="doc-noteref">8
-
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 : 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 insert the appropriate single-byte ECI if possible
@@ -2837,10 +2828,10 @@ class="sourceCode bash">
Data can be batch processed by reading from a text file and producing
@@ -2901,10 +2892,9 @@ you that there is a problem.
00001.png, 00002.png etc. To change this
behaviour specify the -o option using special characters in
the output filename as shown in the table below:
-
CAUTION: Outputting binary files to the command shell without
catching that data in a pipe can have unpredictable results. Use with
@@ -3049,32 +3035,34 @@ maximum is 20. The default size is 0.8.
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 :
-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
+ECI is the ECI code (see Table 8: 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
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.
-
-zint -b DATAMATRIX -d "2nd of 3" --structapp="2,3,5006"
+Figure 28:
+zint -b DATAMATRIX -d "2nd of 3" --structapp="2,3,5006"
where I is the index (position) of the symbol in the
Structured Append sequence, C is the count or total number
@@ -3387,10 +3375,9 @@ program, of course, these options can be altered. The way this is done
is by altering the contents of the zint_symbol structure
between the creation and encoding stages. The zint_symbol
structure consists of the following members:
-
-
-
Table : API
-Structure zint_symbol
+
+
Table 12: API Structure
+zint_symbol
@@ -3706,7 +3693,6 @@ in Memory (memfile).
-
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 plotted in green.
@@ -3733,11 +3719,9 @@ href="#using-colour">4.7 Using Colour.
back to the calling application. In addition the errtxt
member is set to a message detailing the nature of the error. The errors
generated by Zint are:
-
-
-
Table : API Warning and Error Return Values
-
+
+
Table 13: API Warning and
+Error Return Values
@@ -3844,7 +3828,6 @@ occurs.
-
To catch errors use an integer variable as shown in the code
below:
#include <zint.h>
@@ -3876,9 +3859,10 @@ below:
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 shown in the
-Table : Barcode Types (Symbologies).
-For example
@@ -3888,10 +3872,9 @@ aspects of the output file. To select more than one option from the
table below simply OR them together when adjusting this
value:
GS1NOCHECK_MODE (CLI --gs1nocheck) is for
use with legacy systems that have data that does not conform to the
current GS1 standard. Printable ASCII input is still checked for, as is
@@ -4162,9 +4143,9 @@ contains. The zint_seg structure is of the form:
must be NUL-terminated */int eci;/* Extended Channel Interpretation */};
-
by OR-ing the flags below in the cap_flag
argument and checking the return to see which are set.
-
-
-
Table : API Capability Flags
+
+
Table 16: API Capability
+Flags
@@ -4345,7 +4326,6 @@ symbologies.
-
For example:
unsignedint cap;cap = ZBarcode_Cap(BARCODE_PDF417, ZINT_CAP_HRT | ZINT_CAP_ECI);
@@ -4371,11 +4351,12 @@ class="footnote-ref" id="fnref16" role="doc-noteref">16(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 :
-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.
+byte containing the values given in Table 39: 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.
Detailed feedback on the data encoded may be requested by specifying
the BARCODE_RAW_TEXT option in the
output_options member, which will populate the
@@ -4425,12 +4406,18 @@ to do the conversion. The final destination length, returned in
less, source must be NUL-terminated. The destination buffer
is not NUL-terminated. The obsolete ECIs 0, 1 and 2 are supported.
5.18 Zint Version
-
Whether the Zint library linked to was built with PNG support may be
-determined with:
+
Whether the Zint library linked to was built without PNG support may
+be determined with:
int ZBarcode_NoPng();
-
which returns 1 if no PNG support is available, else zero.
+
which returns 1 if PNG support is not available,
+else zero.
+
Similarly, but with opposite sense, whether the Zint library linked
+to was built with GS1 Syntax Engine support may be determined with:
+
int ZBarcode_HaveGS1SyntaxEngine();
+
which returns 1 if GS1 Syntax Engine support is
+available, else zero.
Lastly, the version of the Zint library linked to is returned by:
-
int ZBarcode_Version();
+
int ZBarcode_Version();
The version parts are separated by hundreds. For instance, version
"2.9.1" is returned as "20901".
6. Types of Symbology
@@ -4440,10 +4427,10 @@ the term barcode. They consist of a number of bars and a number of
spaces of differing widths.
Developed by Intermec in 1977 for Bell Labs as a high-density barcode
to track small telephone components, Code 11 can encode data consisting
@@ -4459,10 +4446,10 @@ standards alter from one source to another so you should take care to
ensure that you have the right barcode type before using them.
Also known as Code 2 of 5 Matrix, and used in industrial applications
and photo development, Standard Code 2 of 5 will encode numeric input
@@ -4473,10 +4460,10 @@ Human Readable Text, set --vers=2 (API
option_2 = 2).
Used by the International Air Transport Agency (IATA) for baggage
handling, this barcode will encode numeric input (digits 0-9) up to a
@@ -4485,10 +4472,10 @@ the same as for 6.1.2.1 Standard Code 2
of 5.
Industrial Code 2 of 5 can encode numeric input (digits 0-9) up to a
maximum of 79 digits. No check digit is added by default, but can be set
@@ -4497,10 +4484,10 @@ of 5.
A high-density barcode that encodes pairs of numbers, and so can only
encode an even number of digits (0-9). If an odd number of digits is
@@ -4510,10 +4497,10 @@ set the same as for 6.1.2.1 Standard
Code 2 of 5.
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. Check digit
@@ -4521,10 +4508,10 @@ options are the same as for 6.1.2.1
Standard Code 2 of 5.
ITF-14, also known as UPC Shipping Container Symbol or Case Code, is
based on Interleaved Code 2 of 5 and is designed to encode a GTIN-14. It
@@ -4541,27 +4528,27 @@ can be overridden using --border (API
can be achieved by explicitly setting the border type to box (or bind or
bindtop) and leaving the border width 0.
Leitcode is based on Interleaved Code 2 of 5 and is used by Deutsche
Post for routing purposes. Leitcode requires a 13-digit numerical input
to which Zint adds a check digit.
Identcode is based on Interleaved Code 2 of 5 and is used by Deutsche
Post for identification purposes. Identcode requires an 11-digit
@@ -4570,10 +4557,10 @@ numerical input to which Zint adds a check digit.
UPC-A is used in the United States for retail applications, and
encodes a GTIN-12, a 12-digit Global Trade Item Number that includes a
@@ -4588,35 +4575,35 @@ zero-filled.
data separated from the main data by a + character or a
space. For example, to draw a UPC-A symbol with the data “72527270270”
and 5-digit add-on data “12345” use the command:
-
zint-b UPCA -d"72527270270+12345"
+
zint-b UPCA -d"72527270270+12345"
or using the API:
-
my_symbol->symbology = BARCODE_UPCA;
-/* Using '+' */
-error = ZBarcode_Encode_and_Print(my_symbol,"72527270270+12345",0,0);
-/* Or a space */
-error = ZBarcode_Encode_and_Print(my_symbol,"72527270270 12345",0,0);
+
my_symbol->symbology = BARCODE_UPCA;
+/* Using '+' */
+error = ZBarcode_Encode_and_Print(my_symbol,"72527270270+12345",0,0);
+/* Or a space */
+error = ZBarcode_Encode_and_Print(my_symbol,"72527270270 12345",0,0);
A quiet zone indicator can be added to the HRT by setting
--guardwhitespace (API
output_options |= EANUPC_GUARD_WHITESPACE). For UPC, this
is only relevant when there is an add-on:
You can adjust the gap between the main symbol and an add-on in
integral multiples of the X-dimension by setting --addongap
@@ -4627,10 +4614,10 @@ can be adjusted by setting --guarddescent (API
5.0).
UPC-E is a zero-compressed version of UPC-A developed for smaller
packages, which takes up to 7 digits as input. A standard GS1 check
@@ -4646,13 +4633,13 @@ a + character or a space as a separator, and a quiet zone
indicator can be added when there is an add-on by setting
--guardwhitespace (API
output_options |= EANUPC_GUARD_WHITESPACE):
You can adjust the gap between the main symbol and an add-on in
integral multiples of the X-dimension by setting --addongap
@@ -4669,10 +4656,10 @@ extension of UPC, used in retail across Europe and internationally. It
defines the symbologies EAN-13, EAN-8 and ISBN (a subset of EAN-13).
EAN-13 encodes a GTIN-13, a 13-digit Global Trade Item Number that
includes a standard GS1 check digit. Input up to 12 digits may be given,
@@ -4681,36 +4668,36 @@ supplied in which case Zint will validate the check digit. Input less
than 12 digits will be zero-filled.
A 2-digit or 5-digit add-on can be added by using a ‘+’ or space
character as with UPC symbols. For example:
-
zint-b EAN13 -d"451234567890+21"
+
zint-b EAN13 -d"451234567890+21"
will encode an EAN-13 symbol with a 2-digit add-on. As before these
results can be achieved using the API:
Options to add quiet zone indicators and to adjust the add-on gap and
the guard bar descent height are the same as for 6.1.3.2 UPC Version E. For instance:
EAN-13 symbols (also known as Bookland EAN-13) can also be produced
from 9-digit SBN, 10-digit ISBN or 13-digit ISBN-13 data. The relevant
@@ -4752,10 +4739,10 @@ before the symbol is generated.
As with EAN-13, a quiet zone indicator can be added using
--guardwhitespace:
2-digit and 5-digit add-on symbols can be added using a
+ or space character, and there are options to adjust the
@@ -4764,37 +4751,38 @@ href="#upc-version-e">6.1.3.2 UPC Version E.
As a convenience, 2-digit and 5-digit add-ons may be generated as
standalone symbols using the symbologies BARCODE_EAN_2ADDON
(11) and BARCODE_EAN_5ADDON (12), and as with the main
EAN/UPC symbols a quiet zone indicator can be added using
---guardwhitespace. For instance
-
zint-b EAN_5ADDON -d'54321'--guardwhitespace
+
zint-b EAN_5ADDON -d'54321'--guardwhitespace
will generate a standalone 5-digit add-on with quiet zone guards, or
using the API:
Also known as Plessey Code, this symbology was developed by the
Plessey Company Ltd. in the UK. The symbol can encode data consisting of
@@ -4804,21 +4792,19 @@ shown in the Human Readable Text by setting --vers=1 (API
option_2 |= 1).
Based on Plessey and developed by MSI Data Corporation, MSI Plessey
can encode numeric (digits 0-9) input of up to 92 digits. It has a range
of check digit options that are selectable by setting
--vers (API option_2), shown in the table
below:
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 modulo-10 check
@@ -4864,20 +4849,20 @@ digits.
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 Numeric allows compression of numeric data into a Telepen
symbol. Data can consist of pairs of numbers or pairs consisting of a
@@ -4889,10 +4874,10 @@ a hidden modulo-127 check digit which is added by Zint.
Standard Code 39 was introduced in 1975 by Intermec. Input data can
be up to 86 characters in length and can include the characters 0-9,
@@ -4906,10 +4891,10 @@ Human Readable Text, set --vers=2 (API
option_2 = 2).
Also known as Code 39e and Code39+, this symbology expands on
Standard Code 39 to provide support for the full 7-bit ASCII character
@@ -4918,10 +4903,10 @@ href="#standard-code-39-iso-16388">6.1.7.1 Standard Code 39 (ISO
16388).
A variation of Extended Code 39, Code 93 also supports full ASCII
text, accepting up to 123 characters. Two check characters are added by
@@ -4930,10 +4915,10 @@ Readable Text, but may be shown by setting --vers=1 (API
option_2 = 1).
PZN is a Code 39 based symbology used by the pharmaceutical industry
in Germany. PZN encodes a 7-digit number to which Zint will add a
@@ -4946,10 +4931,10 @@ digits. As with PZN8, a modulo-11 check digit will be added or if 7
digits supplied the check digit validated.
LOGMARS (Logistics Applications of Automated Marking and Reading
Symbols) is a variation of the Code 39 symbology used by the U.S.
@@ -4959,10 +4944,10 @@ href="#standard-code-39-iso-16388">6.1.7.1 Standard Code 39 (ISO
restricted to a maximum of 30 characters.
A variation of Code 39 used by the Italian Ministry of Health
(“Ministero della Sanità”) for encoding identifiers on pharmaceutical
@@ -4970,10 +4955,10 @@ products. This symbology requires a numeric input up to 8 digits in
length. A check digit is added by Zint.
This variant adds a leading '+' character and a trailing
modulo-49 check digit to a standard Code 39 symbol as required by the
@@ -4981,10 +4966,10 @@ Health Industry Barcode standards.
A variation of Code 39 that for vehicle identification numbers used
in North America (first character '1' to '5')
@@ -4995,10 +4980,10 @@ be added by setting --vers=1 (API
option_2 = 1).
Also known as Rationalized Codabar, Code 27, 2 of 7 Code, NW-7
(Japan), USD-4 and Monarch, this symbology was developed in 1972 from
@@ -5015,10 +5000,10 @@ character appear in the Human Readable Text, set --vers=2
(API option_2 = 2).
Developed by Laetus, Pharmacode One-Track is used for the
identification of pharmaceuticals. The symbology is able to encode whole
@@ -5027,10 +5012,10 @@ numbers between 3 and 131070.
One of the most ubiquitous one-dimensional barcode symbologies, Code
128 was developed in 1981 by Computer Identics. This symbology supports
@@ -5050,31 +5035,31 @@ 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
+
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
+
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 chose
in the data, for instance
-
zint-b CODE128 -d"A\^1BC\^1DEF"--extraesc
+
zint-b CODE128 -d"A\^1BC\^1DEF"--extraesc
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.
6.1.10.2
Code 128 Suppress Code Set C (Code Sets A and B only)
It is sometimes advantageous to stop Code 128 from using Code Set C
which compresses numerical data. The BARCODE_CODE128AB
for this variant (nor for any other).
A variation of Code 128 previously known as UCC/EAN-128, this
symbology is defined by the GS1 General Specifications. Application
@@ -5107,17 +5092,17 @@ correct encoding. GS1-128 does not support extended ASCII (ISO/IEC
8859-1) characters. Check digits for GTIN data AI (01) are not generated
and need to be included in the input data. The following is an example
of a valid GS1-128 input:
A shorter version of GS1-128 which encodes GTIN-14 data only, EAN-14
takes a 13-digit input, which will be prefixed with leading zeroes if
@@ -5127,10 +5112,10 @@ The GS1 check digit (if not given) and HRT-only AI "(01)"
are added by Zint.
A variation of Code 128 the ‘Nummer der Versandeinheit’ standard,
also known as SSCC-18 (Serial Shipping Container Code), includes both a
@@ -5141,20 +5126,20 @@ digit is included, in which case the check digit will be verified. Check
digit(s) and HRT-only AI "(00)" are added by Zint.
This option adds a leading '+' character and a trailing
modulo-49 check digit to a standard Code 128 symbol as required by the
Health Industry Barcode standards.
Another variation of Code 128 as used by DPD (Deutscher Paketdienst).
Requires a 27 or 28 character input. For 28 character input, the first
@@ -5163,9 +5148,9 @@ character is an identification tag (Barcode ID), which should usually be
"%" will be prefixed by Zint (except if marked as a
“relabel”, see below). The rest of the 27-character input must be
alphanumeric, and is of the form:
-
-
-
Table : DPD Input Fields
+
+
Table 18: DPD Input
+Fields
@@ -5189,7 +5174,6 @@ alphanumeric, and is of the form:
-
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.
@@ -5208,10 +5192,10 @@ identification tag and prints the barcode at half height. In this case,
an input of 27 alphanumeric characters is required.
Previously known as RSS-14 this standard encodes a 13-digit item
code. A check digit and HRT-only Application Identifier of
@@ -5249,17 +5233,17 @@ greater. To produce a GS1 DataBar Truncated symbol set the symbol height
to a value between 13 and 32. Truncated symbols may not be scannable by
omnidirectional scanners.
Previously known as RSS Limited this standard encodes a 13-digit item
code and can be used in the same way as GS1 DataBar Omnidirectional
@@ -5271,10 +5255,10 @@ may be given in which case the check digit will be verified. Input less
than 13 digits will be zero-filled.
Previously known as RSS Expanded this is a variable length symbology
capable of encoding data from a number of AIs in a single symbol. AIs
@@ -5289,23 +5273,23 @@ digit as this is not calculated by Zint when this symbology is encoded.
Data for fixed-length AIs must be entered at the appropriate length. The
maximum capacity is 74 numerics or 41 alphanumerics. The following is an
example of a valid GS1 DataBar Expanded input:
A highly compressed symbol for numeric data. The number of channels
in the symbol can be between 3 and 8 and this can be specified by
@@ -5315,9 +5299,9 @@ input data: e.g. a three character input string generates a 4 channel
code by default.
The maximum values permitted depend on the number of channels used as
shown in the table below:
Designed by IBM for marking silicon wafers, each BC412 character is
represented by 4 bars of a single size, interleaved with 4 spaces of
@@ -5379,22 +5362,22 @@ position. Lowercase input is automatically made uppercase.
primarily in the vehicle industry, is to simply stack one-dimensional
codes on top of each other. This can be achieved at the command prompt
by giving more than one set of input data. For example
-
zint-d"This"-d"That"
+
zint-d"This"-d"That"
will draw two Code 128 symbols, one on top of the other. The same
result can be achieved using the API by executing the
ZBarcode_Encode() function more than once on a symbol. For
example:
Note that the Human Readable Text will be that of the last data, so
it’s best to use the option --notext (API
@@ -5405,23 +5388,23 @@ specifying --bind (API
separator bars in integral multiples of the X-dimension (minimum and
default 1, maximum 4) can be set by --separator (API
option_3):
A more sophisticated method is to use some type of line indexing
which indicates to the barcode reader which order the stacked symbols
should be read in. This is demonstrated by the symbologies below.
6.2.2 Codablock-F
-
-zint -b CODABLOCKF -d "CODABLOCK F Symbology" --rows=3
+Figure 84:
+zint -b CODABLOCKF -d "CODABLOCK F Symbology" --rows=3
This is a stacked symbology based on Code 128 which can encode
Latin-1 data up to a maximum length of 2726 symbol characters, meaning
@@ -5439,10 +5422,10 @@ used to encode Health Industry Barcode (HIBC) data which adds a leading
data.
Code 16K, invented by Ted Williams for LaserLight Systems in 1988,
uses a Code 128 based system which can stack up to 16 fixed-width rows
@@ -5454,10 +5437,10 @@ use can be set using the --rows option (API
option_1), with values from 2 to 16.
Heavily used in the parcel industry, the PDF417 symbology can encode
a large amount of data into a small space. Zint supports encoding up to
@@ -5493,20 +5476,20 @@ triplets are 0-filled, for instance "1234" becomes
"123004". If an ID is not given, no ID is encoded.
Previously known as Truncated PDF417, Compact PDF417 omits some
per-row overhead to produce a narrower but less robust symbol. Options
are the same as for PDF417 above.
A variation of the PDF417 standard, MicroPDF417 is intended for
applications where symbol size needs to be kept to a minimum. 34
@@ -5525,10 +5508,10 @@ Structured Append the same as PDF417, for which see details.
This creates an EAN-13 linear component with the data
"331234567890" and a 2D CC-A (see below) component with the data
"(99)1234-abcd". The same results can be achieved using the
API as shown below:
This system uses a variation of MicroPDF417 which is optimised to fit
into a small space. The size of the 2D component and the amount of error
@@ -5730,10 +5711,10 @@ numeric digits or an alphanumeric string of shorter length. To select
CC-A use --mode=1 (API option_1 = 1).
This system uses MicroPDF417 to encode the 2D component. The size of
the 2D component and the amount of error correction is determined by the
@@ -5743,10 +5724,10 @@ string of shorter length. To select CC-B use --mode=2 (API
option_1 = 2).
This system uses PDF417 and can only be used in conjunction with a
GS1-128 linear component. CC-C can encode up to 2361 numeric digits or
@@ -5755,10 +5736,10 @@ an alphanumeric string of shorter length. To select CC-C use
Used by the United States Postal Service until 2009, the POSTNET
barcode was used for encoding zip-codes on mail items. POSTNET uses
@@ -5782,10 +5763,10 @@ lengths as used by USPS were PostNet6 (5-digit ZIP input),
will be issued if the input length is not one of these.
Used by the United States Postal Service until 2009, the PLANET
(Postal Alpha Numeric Encoding Technique) barcode was used for encoding
@@ -5797,10 +5778,10 @@ of up to 38 digits in length, standard lengths used by USPS were
length is not one of these.
Based on POSTNET, the CEPNet symbol is used by Correios, the
Brazilian postal service, to encode CEP (Código de Endereçamento Postal)
@@ -5808,10 +5789,10 @@ numbers on mail items. Input should consist of eight digits with the
check digit being automatically added by Zint.
Introduced by Kodak in the 1980s, the DX (Digital Index) barcode is
printed on the bottom edge of 35mm film to aid in the reordering and
@@ -5842,10 +5823,10 @@ used: "S" or "X" means frame number 62,
Symbols
Australia Post Standard Customer Barcode, Customer Barcode 2 and
Customer Barcode 3 are 37-bar, 52-bar and 67-bar specifications
@@ -5856,10 +5837,9 @@ by Zint and should not be included in the 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.
-
-
-
Table : Australia Post Input Formats
+
+
Table 21: Australia Post Input
+Formats
@@ -5914,40 +5894,39 @@ data-tag=": Australia Post Input Formats">
This symbology is used by Royal Dutch TPG Post (Netherlands) for
Postal code and automatic mail sorting. Data input can consist of
@@ -5956,10 +5935,10 @@ check digit is included.
The RM4SCC standard is used by the Royal Mail in the UK to encode
postcode and customer data on mail items. Data input can consist of
@@ -5969,10 +5948,10 @@ Piccadilly Circus in London. Check digit data is generated by Zint.
Developed in 2014 as a replacement for RM4SCC this 4-state symbol
includes Reed- Solomon error correction. Input is a pre-formatted
@@ -5980,11 +5959,9 @@ alphanumeric string of 22 (for Barcode C) or 26 (for Barcode L)
characters, producing a symbol with 66 or 78 bars respectively. The
rules for the input data are complex, as summarized in the following
table.
-
-
-
Table : Royal Mail 4-State Mailmark Input Fields
-
+
+
Table 22: Royal Mail 4-State
+Mailmark Input Fields
@@ -6014,14 +5991,11 @@ data-tag=": Royal Mail 4-State Mailmark Input Fields">
-
The 6 Destination+DPS (Destination Post Code plus Delivery Point
Suffix) patterns are:
-
-
-
Table : Royal Mail 4-State Mailmark Destination+DPS
-Patterns:
+
+
Table 23: Royal Mail 4-State
+Mailmark Destination+DPS Patterns
ANNLLNLSS
@@ -6033,7 +6007,6 @@ Patterns:
-
where 'A' stands for full alphabetic (A-Z),
'L' for limited alphabetic (A-Z less
'CIKMOV'), 'N' for numeric (0-9), and
@@ -6046,10 +6019,10 @@ href="#royal-mail-2d-mailmark-cmdm-data-matrix">6.6.2 Royal Mail 2D
Mailmark (CMDM) (Data Matrix).
Also known as the OneCode barcode and used in the U.S. by the United
States Postal Service (USPS), the Intelligent Mail system replaced the
@@ -6067,20 +6040,20 @@ the following inputs are valid data entries:
This is a method for creating 4-state codes where the data encoding
is provided by an external program. Input data should consist of the
@@ -6092,20 +6065,20 @@ size to full height can be given in thousandths (permille) using the
--vers option (API option_2). The default
value is 250 (25%).
Also known as Semacode this symbology was developed in 1989 by Acuity
CiMatrix in partnership with the U.S. DoD and NASA. The symbol can
@@ -6118,9 +6091,9 @@ table below. A separate symbology ID (BARCODE_HIBC_DM) 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.
-
-
-
Table : Data Matrix Sizes
+
+
Table 24: Data Matrix
+Sizes
Input
@@ -6236,7 +6209,6 @@ now been removed from Zint.
-
The largest version 24 (144 x 144) can encode 3116 digits, around
2335 alphanumeric characters, or 1555 bytes of data.
When using automatic symbol sizes you can force Zint to use square
@@ -6244,9 +6216,8 @@ symbols (versions 1-24) at the command line by using the option
--square (API option_3 = DM_SQUARE).
Data Matrix Rectangular Extension (ISO/IEC 21471) codes may be
generated with the following values as before:
-
-
-
Table : DMRE Sizes
+
+
Table 25: DMRE Sizes
Input
@@ -6322,7 +6293,6 @@ generated with the following values as before:
-
DMRE symbol sizes may be activated in automatic size mode using the
option --dmre (API option_3 = DM_DMRE).
GS1 data may be encoded using FNC1 (default) or
@@ -6350,21 +6320,19 @@ defaults to "001001".
This variant of Data Matrix, also known as “Complex Mail Data Mark”
(CMDM), was introduced by Royal Mail along with 6.5.4 Royal Mail 4-State
Mailmark, and offers space for customer data following an initial
pre-formatted 45 character section, as summarized below.
-
-
-
Table : Royal Mail 2D Mailmark Input Fields
-
+
+
Table 26: Royal Mail 2D
+Mailmark Input Fields
Field Name
@@ -6430,17 +6398,14 @@ data-tag=": Royal Mail 2D Mailmark Input Fields">
-
The 12 Destination+DPS (Destination Post Code plus Delivery Point
Suffix) patterns are similar to those for the 4-state except that the
alphabetic limitation ('L' versus 'A') does
not apply, only the initial “outward” part is required (the rest can be
blank), and the whole field can be blank:
-
-
-
Table : Royal Mail 2D Mailmark Destination+DPS
-Patterns:
+
+
Table 27: Royal Mail 2D
+Mailmark Destination+DPS Patterns
ANNAANASS
@@ -6460,17 +6425,14 @@ Patterns:
-
where 'A' is alphabetic (A-Z), 'N' numeric
(0-9), and 'S' space.
The 6 RTS (Return to Sender) Post Code patterns are similar to above
except without the DPS ('NA'), and the trailing “inward”
part cannot be blank (although the whole field can be):
-
-
-
Table : Royal Mail 2D Mailmark RTS Patterns
-
+
+
Table 28: Royal Mail 2D
+Mailmark RTS Patterns
ANNAASS
@@ -6482,13 +6444,11 @@ data-tag=": Royal Mail 2D Mailmark RTS Patterns">
-
Three sizes are defined, one rectangular, with varying maximum
amounts of optional customer data:
-
-
-
Table : Royal Mail 2D Mailmark Sizes
+
+
Table 29: Royal Mail 2D
+Mailmark Sizes
Name
@@ -6518,7 +6478,6 @@ data-tag=": 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 version number (one more
@@ -6532,18 +6491,18 @@ by using the option --square (API
supported.
Also known as Quick Response Code this symbology was developed by
Denso. Four levels of error correction are available using the
--secure option (API option_1) as shown in the
following table.
-
-
-
Table : QR Code ECC Levels
+
+
Table 30: QR Code ECC
+Levels
Input
@@ -6579,14 +6538,13 @@ following table.
-
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 is shown in the
table below.
-
-
-
Table : QR Code Sizes
+
+
Table 31: QR Code
+Sizes
Input
@@ -6742,7 +6700,6 @@ table below.
-
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 used to encode GS1 data. QR Code symbols can by
@@ -6763,8 +6720,8 @@ be manually specified by using the --mask switch with
values 0-7, or in the API by setting
option_3 = (N + 1) << 8 where N is 0-7. To use with
ZINT_FULL_MULTIBYTE set
-
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
+
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
The --fast option (API
input_mode |= FAST_MODE) may be used when leaving Zint to
automatically select a mask to reduce the number of masks to try to four
@@ -6778,10 +6735,10 @@ option (see 4.17 Structured Append)
sequence. Currently this calculation must be done outside of Zint.
A miniature version of the QR Code symbol for short messages, Micro
QR Code symbols can encode either Latin-1 characters or Shift JIS
@@ -6791,10 +6748,9 @@ preferred symbol size can be selected by using the --vers
option (API option_2), as shown in the table below. Note
that versions M1 and M2 have restrictions on what characters can be
encoded.
-
-
-
Table : Micro QR Code Sizes
+
+
Table 32: Micro QR Code
+Sizes
@@ -6837,17 +6793,15 @@ characters "$%*+-./:"
-
Version M4 can encode up to 35 digits, 21 alphanumerics, 15 bytes or
9 Kanji characters.
Except for version M1, which is always ECC level L, the amount of ECC
codewords can be adjusted using the --secure option (API
option_1); however ECC level H is not available for any
version, and ECC level Q is only available for version M4:
-
-
-
Table : Micro QR ECC Levels
+
+
Table 33: Micro QR ECC
+Levels
@@ -6888,7 +6842,6 @@ data-tag=": Micro QR ECC Levels">
-
The defaults for symbol size and ECC level depend on the input and
whether either of them is specified.
For barcode readers that support it, non-ASCII data density may be
@@ -6900,15 +6853,15 @@ be manually specified by using the --mask switch with
values 0-3, or in the API by setting
option_3 = (N + 1) << 8 where N is 0-3. To use with
ZINT_FULL_MULTIBYTE set
-
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
+
option_3 = ZINT_FULL_MULTIBYTE |(N +1)<<8
6.6.5 Rectangular
Micro QR Code (rMQR) (ISO 23941)
A rectangular version of QR Code, rMQR supports encoding of GS1 data,
and either Latin-1 characters or Shift JIS characters, and other
@@ -6917,9 +6870,9 @@ be entered as UTF-8 with conversion being handled by Zint. The amount of
ECC codewords can be adjusted using the --secure option
(API option_1), however only ECC levels M and H are valid
for this type of symbol.
-
-
-
Table : rMQR ECC Levels
+
+
Table 34: rMQR ECC
+Levels
Input
@@ -6943,14 +6896,12 @@ for this type of symbol.
-
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 height of the symbol
while allowing Zint to determine the minimum symbol width.
-
-
-
Table : rMQR Sizes
+
+
Table 35: rMQR Sizes
@@ -7145,7 +7096,6 @@ while allowing Zint to determine the minimum symbol width.
-
The largest version R17x139 (32) can encode up to 361 digits, 219
alphanumerics, 150 bytes, or 92 Kanji characters.
For barcode readers that support it, non-ASCII data density may be
@@ -7154,10 +7104,10 @@ by setting option_3 = ZINT_FULL_MULTIBYTE.
A variation of QR Code used by Združenje Bank Slovenije (Bank
Association of Slovenia). The size, error correction level and ECI are
@@ -7168,16 +7118,16 @@ Latin-2 formatted use the --binary switch (API
input_mode = DATA_MODE).
The following example creates a symbol from data saved as a Latin-2
file:
Developed by UPS the MaxiCode symbology employs a grid of hexagons
surrounding a bullseye finder pattern. This symbology is designed for
@@ -7188,11 +7138,9 @@ of a Structured Carrier Message which includes various data about the
package being sent and the 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.
Table 36: MaxiCode Structured
+Carrier Message Format
@@ -7224,13 +7172,12 @@ your parcel courier.
-
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 example:
zint-b 57 --primary="152382802840001"--scmvv=96 --esc-d\
-"1Z00004951\GUPSN\G06X610\G159\G1234567\G1/1\G\GY\G1 MAIN ST\GNY\GNY\R\E"
+
zint-b 57 --primary="152382802840001"--scmvv=96 --esc-d\
+"1Z00004951\GUPSN\G06X610\G159\G1234567\G1/1\G\GY\G1 MAIN ST\GNY\GNY\R\E"
will prefix "[)>\R01\G96" to the secondary message.
(\R, \G and \E are the escape
sequences for Record Separator, Group Separator and End of Transmission
-respectively - see Table : Escape
-Sequences.)
Mode 6 is reserved for the maintenance of scanner hardware and should
not be used to encode user data.
This symbology uses Latin-1 character encoding by default but also
@@ -7263,10 +7211,9 @@ supports the ECI encoding mechanism. The maximum length of text which
can be placed in a MaxiCode symbol depends on the type of characters
used in the text.
Example maximum data lengths are given in the table below:
Invented by Andrew Longacre at Welch Allyn Inc in 1995 the Aztec Code
symbol is a matrix symbol with a distinctive bullseye finder pattern.
@@ -7345,9 +7291,9 @@ option (API option_2) to a value between 1 and 36 according
to the following table. The symbols marked with an asterisk
(*) in the table below are ‘compact’ symbols, meaning they
have a smaller bullseye pattern at the centre of the symbol.
-
-
-
Table : Aztec Code Sizes
+
+
Table 38: Aztec Code
+Sizes
Input
@@ -7483,18 +7429,15 @@ have a smaller bullseye pattern at the centre of the symbol.
-
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 correction capacities as low as 3 codewords.
Alternatively the amount of error correction data can be specified by
setting the --secure option (API option_1) to
a value from the following table.
It is not possible to select both symbol size and error correction
capacity for the same symbol. If both options are selected then the
error correction capacity selection will be ignored.
@@ -7537,10 +7479,10 @@ href="#structured-append">4.17 Structured Append) (API
given, no ID is encoded.
A truncated version of compact Aztec Code for encoding whole integers
between 0 and 255, as defined in ISO/IEC 24778 Annex A. Includes
@@ -7548,10 +7490,10 @@ Reed-Solomon error correction. It does not support Structured
Append.
A matrix symbology developed by Ted Williams in 1992 which encodes
data in a way similar to Data Matrix, Code One is able to encode the
@@ -7560,9 +7502,9 @@ There are two types of Code One symbol - fixed-ratio symbols which are
roughly square (versions A through to H) and variable-width versions
(versions S and T). These can be selected by using --vers
(API option_2) as shown in the table below:
-
-
-
Table : Code One Sizes
+
+
Table 40: Code One
+Sizes
@@ -7652,7 +7594,6 @@ roughly square (versions A through to H) and variable-width versions
-
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.
@@ -7664,10 +7605,10 @@ Structured Append is not supported with GS1 data nor for Version S
symbols.
Grid Matrix groups modules in a chequerboard pattern, and by default
supports the GB 2312 standard set, which includes Hanzi, ASCII and a
@@ -7683,9 +7624,9 @@ specified using the --vers option (API
option_2), and the error correction capacity can be
specified by using the --secure option (API
option_1), according to the following tables.
-
-
-
Table : Grid Matrix Sizes
+
+
Table 41: Grid Matrix
+Sizes
Input
@@ -7747,12 +7688,9 @@ specified by using the --secure option (API
Non-ASCII data density may be maximized by using the
--fullmultibyte switch (API
option_3 = ZINT_FULL_MULTIBYTE), but check that your
@@ -7794,10 +7731,10 @@ Structured Append) (API structapp). The ID ranges from
0 (default) to 255.
DotCode uses a grid of dots in a rectangular formation to encode
characters up to a maximum of approximately 1220 characters (or 2940
@@ -7822,10 +7759,10 @@ href="#structured-append">4.17 Structured Append) (API
structapp). It does not support specifying an ID.
Also known as Chinese Sensible Code, Han Xin is capable of encoding
characters in either the Latin-1 character set or the GB 18030 character
@@ -7835,9 +7772,9 @@ Support for the encoding of GS1 data has not yet been implemented.
The size of the symbol can be specified using the --vers
option (API option_2) to a value between 1 and 84 according
to the following table.
-
-
-
Table : Han Xin Sizes
+
+
Table 43: Han Xin
+Sizes
Input
@@ -8133,16 +8070,15 @@ to the following table.
-
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 barcodes supported by Zint.
There are four levels of error correction capacity available for Han
Xin Code which can be set by using the --secure option (API
option_1) to a value from the following table.
-
-
-
Table : Han Xin Error Correction Modes
+
+
Table 44: Han Xin Error
+Correction Modes
Mode
@@ -8168,7 +8104,6 @@ Xin Code which can be set by using the --secure option (API
-
Non-ASCII data density may be maximized by using the
--fullmultibyte switch (API
option_3 = ZINT_FULL_MULTIBYTE), but check that your
@@ -8179,24 +8114,22 @@ be manually specified by using the --mask switch with
values 0-3, or in the API by setting
option_3 = (N + 1) << 8 where N is 0-3. To use with
ZINT_FULL_MULTIBYTE set
This symbology uses a grid of coloured elements to encode data. ECI
and GS1 modes are supported. The amount of error correction can be set
using the --secure option (API option_1) to a
value as shown in the following table.
Zint does not currently implement data compression by default, but
this can be initiated through the API by setting
-
symbol->option_3 = ULTRA_COMPRESSION;
+
symbol->option_3 = ULTRA_COMPRESSION;
With compression, up to 504 digits, 375 alphanumerics or 252 bytes
can be encoded.
Revision 2 of Ultracode (2023) may be specified using
@@ -8260,18 +8192,18 @@ Markings
6.7.1 Facing Identification Mark
(FIM)
-
-zint -b FIM --compliantheight -d "C"
+Figure 125:
+zint -b FIM --compliantheight -d "C"
Used by the United States Postal Service (USPS), the FIM symbology is
used to assist automated mail processing. There are only 5 valid symbols
which can be generated using the characters A-E as shown in the table
below.
Used for the recognition of page sequences in print-shops, the
Flattermarken is not a true barcode symbol and requires precise
@@ -8483,9 +8414,8 @@ Latin Alphabet No. 1 (ISO/IEC 8859-1).
A.1 ASCII Standard
The ubiquitous ASCII standard is well known to most computer users.
It’s reproduced here for reference.
-
-
-
Table : ASCII
+
+
Table 47: ASCII
Hex
@@ -8678,18 +8608,18 @@ It’s reproduced here for reference.
-
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 : Default Character Sets) when a
+extension is the default encoding of many barcodes (see Table 6: Default Character Sets) when a
codepoint above hex 9F is encoded. Note that codepoints hex 80 to 9F are
not defined.
-
-
-
Table : ISO/IEC 8859-1
+
+
Table 48: ISO/IEC
+8859-1
Hex
@@ -8882,7 +8812,6 @@ not defined.
-
Annex B. Qt Backend QZint
Used internally by Zint Barcode Studio to display the preview, the Qt
Backend QZint renders a barcode by drawing the vector
@@ -8895,28 +8824,28 @@ properties that correspond to the zint_symbol structure
method render() which takes a Qt QPainter to
paint with, and a QRectF rectangular area specifying where
to paint into:
-
/* Encode and display barcode in `paintRect` using `painter`.
- Note: legacy argument `mode` is not used */
-void render(QPainter& painter,constQRectF& paintRect,
- AspectRatioMode mode = IgnoreAspectRatio);
+
/* Encode and display barcode in `paintRect` using `painter`.
+ Note: legacy argument `mode` is not used */
+void render(QPainter& painter,constQRectF& paintRect,
+ AspectRatioMode mode = IgnoreAspectRatio);
render() will emit one of two Qt signals -
encoded on successful encoding and drawing, or
errored on failure. The client can connect and act
appropriately, for instance:
where qzint is an instance of Zint::QZint
and on_encoded() and on_error() are Qt slot
methods provided by the caller. On error, the error value and message
can be retrieved by the methods getError() and
lastError() respectively.
The other main method is save_to_file():
-
/* Encode and print barcode to file `filename`.
- Only sets `getError()` on error, not on warning */
-bool save_to_file(constQString& filename);// `ZBarcode_Print()`
+
/* Encode and print barcode to file `filename`.
+ Only sets `getError()` on error, not on warning */
+bool save_to_file(constQString& filename);// `ZBarcode_Print()`
which takes a filename to output to. It too will emit an
errored signal on failure, returning false
(but nothing on success, which just returns true). Note
@@ -8931,12 +8860,12 @@ symbology capabilities, and utility methods such as
Annex C. Tcl Backend Binding
A Tcl binding is available in the "backend_tcl”
sub-directory. To make on Unix:
-
cd backend_tcl
-autoconf
-./configure
-make
-sudo make install
+
cd backend_tcl
+autoconf
+./configure
+make
+sudo make install
For Windows, a Microsoft Visual C++ project file is available at
"backend_tcl\zint_tcl.vcxproj". Note that this assumes that
Tcl/Tk is available in "C:\Tcl" and that the libraries are
@@ -8947,27 +8876,27 @@ to match your setup. There is also a Visual Studio makefile available at
"backend_tcl\win\README.txt".
Once built and installed, invoke the Tcl/Tk CLI
"wish":
-
wish
+
wish
and ignoring the Tk window click back to the command prompt
"%" and type:
-
package require zint
-zint help
+
package require zint
+zint help
which will show the usage message, with options very similar to the
Zint CLI. (One notable difference is that boolean options such as
-bold take a 1 or 0 as an
argument.)
A demonstration Tcl/Tk program which is also useful in itself is
available at "backend_tcl/demo/demo.tcl". To run type:
-
wish demo/demo.tcl
+
wish demo/demo.tcl
which will display the following window.
-
-Tcl/Tk demonstration program
-window
+Figure 127: Tcl/Tk
+demonstration program window
You can select the symbology, enter the data to encode, and set
options (which are the same as those given in the usage message). The
@@ -9686,17 +9615,17 @@ Error counterpart of warning if --werror given
EXAMPLES
Create “out.png” (or “out.gif” if zint built without PNG support) in
the current directory, as a Code 128 symbol.
-
zint-d'This Text'
-
Create “qr.svg” in the current directory, as a QR Code symbol.
zint-b QRCode -d'This Text'-o'qr.svg'
+class="sourceCode bash">zint-d'This Text'
+
Create “qr.svg” in the current directory, as a QR Code symbol.
+
zint-b QRCode -d'This Text'-o'qr.svg'
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 “~”.