- library: check symbol->primary for escape sequences also

- GUI: error message GS1_MODE -> GS1 mode
- GUI: sequence window: fix initial clear button status
- GUI: make acceptable for macOS; add iconset for macOS, install
- manual: update macOS Homebrew install info; add README.macos
- GUI: export window: add no. of sequences to results label
This commit is contained in:
gitlost 2022-06-16 16:47:34 +01:00
parent a232dec4ff
commit 15b8024712
27 changed files with 530 additions and 290 deletions

View file

@ -14,6 +14,9 @@ Changes
button, independently movable picker (NULL parent), preview colour changes,
preview Data Window changes, add clear data (del) buttons, add zap button
and Factory Reset menu option, various other fixes
- GUI: make acceptable for macOS; add iconset for macOS, install
- manual: update macOS Homebrew install info; add README.macos
- GUI: export window: add no. of sequences to results label
Bugs
----
@ -21,6 +24,9 @@ Bugs
- libzint: fix some confusing error messages introduced by segment stuff
- GUI: remove unnecessary tabMain min size (better layout rendering on
Windows/Fedora)
- library: check symbol->primary for escape sequences also
- GUI: error message GS1_MODE -> GS1 mode
- GUI: sequence window: fix initial clear button status
Version 2.11.0 (2022-05-24)

59
README.macos Normal file
View file

@ -0,0 +1,59 @@
% Tested on macOS 12.4 Monterey VirtualBox (thanks to https://github.com/myspaghetti/macos-virtualbox)
1. Prerequisites for building zint and zint-qt
==============================================
Start a terminal.
First if not already installed, install the developer command line tools
xcode-select --install
This can take a (very) long time. Once done, check for updates by selecting "System Preferences" > "Software Update",
and clicking "Advanced" and "OK" (with all the checkboxes set) to trigger the check. If updates are found, install.
This can also take a long time.
With the latest versions of the command line tools, "/usr/include" no longer has the standard C include files. Set
SDKROOT to overcome this (https://stackoverflow.com/a/60002595/664741)
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
Install Homebrew (unless already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install CMake, libpng and Qt5 (git, make, cc & c++ should already be available with command line tools)
brew install cmake
brew install libpng
brew install qt5
Add the Qt5 bin directory to the PATH
export PATH='/usr/local/opt/qt@5/bin':"$PATH"
Clone the latest zint source
git clone https://git.code.sf.net/p/zint/code zint
2. Build
========
The rest is standard CMake
cd zint
mkdir build
cd build
cmake ..
make
sudo make install
This installs into "/usr/local". You can then move the GUI "/usr/local/bin/zint-qt.app" into the main "/Applications"
folder if you wish.
3. CMake options
================
See "README.linux".

View file

@ -1,8 +1,7 @@
/* composite.c - Handles GS1 Composite Symbols */
/*
libzint - the open source barcode library
Copyright (C) 2008 - 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -29,7 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: BSD-3-Clause */
/* The functions "getBit", "init928" and "encode928" are copyright BSI and are
released with permission under the following terms:
@ -1253,20 +1252,21 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour
return 0;
}
static int linear_dummy_run(int input_mode, unsigned char *source, const int length, char *errtxt) {
struct zint_symbol *dummy;
/* Calculate the width of the linear part (primary) */
static int linear_dummy_run(int input_mode, unsigned char *source, const int length, const int debug, char *errtxt) {
struct zint_symbol dummy = {0};
int error_number;
int linear_width;
dummy = ZBarcode_Create();
dummy->symbology = BARCODE_GS1_128_CC;
dummy->input_mode = input_mode;
error_number = gs1_128_cc(dummy, source, length, 3 /*cc_mode*/, 0 /*cc_rows*/);
linear_width = dummy->width;
if (error_number >= ZINT_ERROR) {
strcpy(errtxt, dummy->errtxt);
dummy.symbology = BARCODE_GS1_128_CC;
dummy.option_1 = -1;
dummy.input_mode = input_mode;
dummy.debug = debug;
error_number = gs1_128_cc(&dummy, source, length, 3 /*cc_mode*/, 0 /*cc_rows*/);
linear_width = dummy.width;
if (error_number >= ZINT_ERROR || (debug & ZINT_DEBUG_TEST)) {
strcpy(errtxt, dummy.errtxt);
}
ZBarcode_Delete(dummy);
if (error_number >= ZINT_ERROR) {
return 0;
@ -1317,7 +1317,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
if (symbol->symbology == BARCODE_GS1_128_CC) {
/* Do a test run of encoding the linear component to establish its width */
linear_width = linear_dummy_run(symbol->input_mode, (unsigned char *) symbol->primary, pri_len,
symbol->errtxt);
symbol->debug, symbol->errtxt);
if (linear_width == 0) {
if (strlen(symbol->errtxt) + strlen(in_linear_comp) < sizeof(symbol->errtxt)) {
strcat(symbol->errtxt, in_linear_comp);
@ -1636,3 +1636,5 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
return error_number ? error_number : warn_number;
}
/* vim: set ts=4 sw=4 et : */

View file

@ -1,5 +1,4 @@
/* dotcode.c - Handles DotCode */
/*
libzint - the open source barcode library
Copyright (C) 2017-2022 Robin Stuart <rstuart114@gmail.com>
@ -29,6 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Attempts to encode DotCode according to (AIMD013) ISS DotCode Rev. 4.0, DRAFT 0.15, TSC Pre-PR #5,
@ -1271,6 +1271,9 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i
}
}
/* TODO: GS1 General Specifications 22.0 section 5.8.2 says Structured Append and ECIs not supported
for GS1 DotCode so should check and return ZINT_WARN_NONCOMPLIANT if either true */
data_length = dc_encode_message_segs(symbol, segs, seg_count, codeword_array, &binary_finish, structapp_array,
&structapp_size);

View file

@ -1,8 +1,7 @@
/* font.h - Font for PNG images */
/*
libzint - the open source barcode library
Copyright (C) 2008 - 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -29,10 +28,10 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: BSD-3-Clause */
#ifndef FONT_H
#define FONT_H
#ifndef Z_FONT_H
#define Z_FONT_H
typedef const unsigned short font_item;
@ -487,4 +486,5 @@ static font_item upcean_small_font[] = {
/*39*/ 0x3C, 0x7E, 0xE7, 0xC3, 0xC3, 0xC3, 0xE3, 0x7E, 0x1E, 0x0C, 0x18, 0x30, 0x60, /* 9 */
};
#endif /* FONT_H */
/* vim: set ts=4 sw=4 et : */
#endif /* Z_FONT_H */

View file

@ -685,7 +685,8 @@ static int esc_base(struct zint_symbol *symbol, unsigned char *input_string, int
}
/* Helper to parse escape sequences */
static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string, int *length) {
static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_string, int *p_length) {
const int length = *p_length;
int in_posn, out_posn;
int ch;
int val;
@ -693,9 +694,9 @@ static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_
unsigned long unicode;
#ifndef _MSC_VER
unsigned char escaped_string[*length + 1];
unsigned char escaped_string[length + 1];
#else
unsigned char *escaped_string = (unsigned char *) _alloca(*length + 1);
unsigned char *escaped_string = (unsigned char *) _alloca(length + 1);
#endif
in_posn = 0;
@ -703,7 +704,7 @@ static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_
do {
if (input_string[in_posn] == '\\') {
if (in_posn + 1 >= *length) {
if (in_posn + 1 >= length) {
strcpy(symbol->errtxt, "236: Incomplete escape character in input data");
return ZINT_ERROR_INVALID_DATA;
}
@ -749,7 +750,7 @@ static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_
case 'd':
case 'o': /* Undocumented (as not very useful for most people) */
case 'x':
if ((val = esc_base(symbol, input_string, *length, in_posn + 2, ch)) == -1) {
if ((val = esc_base(symbol, input_string, length, in_posn + 2, ch)) == -1) {
return ZINT_ERROR_INVALID_DATA;
}
escaped_string[out_posn] = val;
@ -760,7 +761,7 @@ static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_
break;
case 'u':
case 'U':
if (in_posn + 6 > *length || (ch == 'U' && in_posn + 8 > *length)) {
if (in_posn + 6 > length || (ch == 'U' && in_posn + 8 > length)) {
sprintf(symbol->errtxt, "209: Incomplete '\\%c' escape sequence in input data", ch);
return ZINT_ERROR_INVALID_DATA;
}
@ -810,11 +811,11 @@ static int escape_char_process(struct zint_symbol *symbol, unsigned char *input_
in_posn++;
}
out_posn++;
} while (in_posn < *length);
} while (in_posn < length);
memcpy(input_string, escaped_string, out_posn);
input_string[out_posn] = '\0';
*length = out_posn;
*p_length = out_posn;
return 0;
}
@ -1095,7 +1096,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
if (seg_count > 1) {
/* Note: GS1_MODE not currently supported when using multiple segments */
if ((symbol->input_mode & 0x07) == GS1_MODE) {
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "776: GS1_MODE not supported for multiple segments");
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "776: GS1 mode not supported for multiple segments");
}
}
@ -1128,6 +1129,13 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[
return error_tag(symbol, error_number, NULL);
}
}
if (symbol->primary[0]) {
int primary_len = (int) strlen(symbol->primary);
error_number = escape_char_process(symbol, (unsigned char *) symbol->primary, &primary_len);
if (error_number != 0) { /* Only returns errors, not warnings */
return error_tag(symbol, error_number, NULL);
}
}
}
if ((symbol->input_mode & 0x07) == UNICODE_MODE) {

View file

@ -28,6 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
#include <math.h>
#ifdef _MSC_VER
@ -1452,7 +1453,7 @@ static int qr_calc_binlen(const int version, char mode[], const unsigned int dda
currentMode = ' '; // Null
if (eci != 0) { // RMQR and MICROQR do not support ECI
if (eci != 0) { /* Not applicable to MICROQR */
count += 4;
if (eci <= 127) {
count += 8;
@ -1536,7 +1537,7 @@ static int qr_calc_binlen_segs(const int version, char mode[], const unsigned in
count += 4 + 8 + 8;
}
if (gs1 == 1) { /* Not applicable to MICROQR */
if (gs1) { /* Not applicable to MICROQR */
if (version < RMQR_VERSION) {
count += 4;
} else {
@ -1672,6 +1673,9 @@ INTERNAL int qrcode(struct zint_symbol *symbol, struct zint_seg segs[], const in
p_structapp = &symbol->structapp;
}
/* TODO: GS1 General Specifications 22.0 section 5.7.3 says Structured Append and ECIs not supported
for GS1 QR Code so should check and return ZINT_WARN_NONCOMPLIANT if either true */
est_binlen = qr_calc_binlen_segs(40, mode, ddata, local_segs, seg_count, p_structapp, 0 /*mode_preset*/, gs1,
debug_print);
@ -2839,7 +2843,7 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt
}
break;
case GS1_MODE: /* Should never happen as checked before being called */
strcpy(symbol->errtxt, "571: UPNQR does not support GS-1 encoding"); /* Not reached */
strcpy(symbol->errtxt, "571: UPNQR does not support GS1 data"); /* Not reached */
return ZINT_ERROR_INVALID_OPTION;
break;
case UNICODE_MODE:

View file

@ -1,8 +1,7 @@
/* rss.c - GS1 DataBar (formerly Reduced Space Symbology) */
/*
libzint - the open source barcode library
Copyright (C) 2008-2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -29,7 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: BSD-3-Clause */
/* The functions "rss_combins" and "getRSSwidths" are copyright BSI and are
released with permission under the following terms:
@ -158,18 +157,15 @@ static void getRSSwidths(int widths[], int val, int n, const int elements, const
}
/* Set GTIN-14 human readable text */
static void dbar_set_gtin14_hrt(struct zint_symbol *symbol, const unsigned char *source, const int src_len) {
int i;
static void dbar_set_gtin14_hrt(struct zint_symbol *symbol, const unsigned char *source, const int length) {
unsigned char *hrt = symbol->text + 4;
const int leading_zeroes = 13 - length;
ustrcpy(symbol->text, "(01)");
for (i = 0; i < 12; i++) {
hrt[i] = '0';
if (leading_zeroes) {
memset(hrt, '0', leading_zeroes);
}
for (i = 0; i < src_len; i++) {
hrt[12 - i] = source[src_len - i - 1];
}
memcpy(hrt + leading_zeroes, source, length);
hrt[13] = gs1_check_digit(hrt, 13);
hrt[14] = '\0';
}
@ -290,7 +286,7 @@ INTERNAL int dbar_omnstk_set_height(struct zint_symbol *symbol, const int first_
}
/* GS1 DataBar Omnidirectional/Truncated/Stacked, allowing for composite if `cc_rows` set */
INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int src_len, const int cc_rows) {
INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows) {
int error_number = 0, i;
large_int accum;
uint64_t left_pair, right_pair;
@ -302,22 +298,22 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
separator_row = 0;
if (src_len > 14) { /* Allow check digit to be specified (will be verified and ignored) */
if (length > 14) { /* Allow check digit to be specified (will be verified and ignored) */
strcpy(symbol->errtxt, "380: Input too long (14 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
if (!is_sane(NEON_F, source, src_len)) {
if (!is_sane(NEON_F, source, length)) {
strcpy(symbol->errtxt, "381: Invalid character in data (digits only)");
return ZINT_ERROR_INVALID_DATA;
}
if (src_len == 14) { /* Verify check digit */
if (length == 14) { /* Verify check digit */
if (gs1_check_digit(source, 13) != source[13]) {
sprintf(symbol->errtxt, "388: Invalid check digit '%c', expecting '%c'",
source[13], gs1_check_digit(source, 13));
return ZINT_ERROR_INVALID_CHECK;
}
src_len--; /* Ignore */
length--; /* Ignore */
}
/* make some room for a separator row for composite symbols */
@ -331,7 +327,7 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
break;
}
large_load_str_u64(&accum, source, src_len);
large_load_str_u64(&accum, source, length);
if (cc_rows) {
/* Add symbol linkage flag */
@ -490,7 +486,7 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
symbol->rows = symbol->rows + 1;
/* Set human readable text */
dbar_set_gtin14_hrt(symbol, source, src_len);
dbar_set_gtin14_hrt(symbol, source, length);
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* Minimum height is 13X for truncated symbol ISO/IEC 24724:2011 5.3.1
@ -621,12 +617,12 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
}
/* GS1 DataBar Omnidirectional/Truncated/Stacked */
INTERNAL int dbar_omn(struct zint_symbol *symbol, unsigned char source[], int src_len) {
return dbar_omn_cc(symbol, source, src_len, 0 /*cc_rows*/);
INTERNAL int dbar_omn(struct zint_symbol *symbol, unsigned char source[], int length) {
return dbar_omn_cc(symbol, source, length, 0 /*cc_rows*/);
}
/* GS1 DataBar Limited, allowing for composite if `cc_rows` set */
INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int src_len, const int cc_rows) {
INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows) {
int error_number = 0, i;
large_int accum;
uint64_t left_character, right_character;
@ -639,25 +635,25 @@ INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int
separator_row = 0;
if (src_len > 14) { /* Allow check digit to be specified (will be verified and ignored) */
if (length > 14) { /* Allow check digit to be specified (will be verified and ignored) */
strcpy(symbol->errtxt, "382: Input too long (14 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
if (!is_sane(NEON_F, source, src_len)) {
if (!is_sane(NEON_F, source, length)) {
strcpy(symbol->errtxt, "383: Invalid character in data (digits only)");
return ZINT_ERROR_INVALID_DATA;
}
if (src_len == 14) { /* Verify check digit */
if (length == 14) { /* Verify check digit */
if (gs1_check_digit(source, 13) != source[13]) {
sprintf(symbol->errtxt, "389: Invalid check digit '%c', expecting '%c'",
source[13], gs1_check_digit(source, 13));
return ZINT_ERROR_INVALID_CHECK;
}
src_len--; /* Ignore */
length--; /* Ignore */
}
if (src_len == 13) {
if (length == 13) {
if ((source[0] != '0') && (source[0] != '1')) {
strcpy(symbol->errtxt, "384: Input out of range (0 to 1999999999999)");
return ZINT_ERROR_INVALID_DATA;
@ -671,7 +667,7 @@ INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int
symbol->rows += 1;
}
large_load_str_u64(&accum, source, src_len);
large_load_str_u64(&accum, source, length);
if (cc_rows) {
/* Add symbol linkage flag */
@ -795,7 +791,7 @@ INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int
}
/* Set human readable text */
dbar_set_gtin14_hrt(symbol, source, src_len);
dbar_set_gtin14_hrt(symbol, source, length);
/* ISO/IEC 24724:2011 6.2 10X minimum height, use as default also */
if (symbol->symbology == BARCODE_DBAR_LTD_CC) {
@ -812,8 +808,8 @@ INTERNAL int dbar_ltd_cc(struct zint_symbol *symbol, unsigned char source[], int
}
/* GS1 DataBar Limited */
INTERNAL int dbar_ltd(struct zint_symbol *symbol, unsigned char source[], int src_len) {
return dbar_ltd_cc(symbol, source, src_len, 0 /*cc_rows*/);
INTERNAL int dbar_ltd(struct zint_symbol *symbol, unsigned char source[], int length) {
return dbar_ltd_cc(symbol, source, length, 0 /*cc_rows*/);
}
/* Check and convert date to DataBar date value */
@ -1259,8 +1255,23 @@ static void dbar_exp_separator(struct zint_symbol *symbol, int width, const int
}
}
/* Set HRT for DataBar Expanded */
static void dbar_exp_hrt(struct zint_symbol *symbol, unsigned char source[], const int length) {
int i;
for (i = 0; i <= length; i++) { /* Include terminating NUL */
if (source[i] == '[') {
symbol->text[i] = '(';
} else if (source[i] == ']') {
symbol->text[i] = ')';
} else {
symbol->text[i] = source[i];
}
}
}
/* GS1 DataBar Expanded, setting linkage for composite if `cc_rows` set */
INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int src_len, const int cc_rows) {
INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows) {
int error_number, warn_number = 0;
int i, j, k, p, codeblocks, data_chars, vs, group, v_odd, v_even;
int latch;
@ -1268,7 +1279,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int
int check_char, c_odd, c_even, elements[235], pattern_width, reader, writer;
int separator_row;
/* Allow for 8 bits + 5-bit latch per char + 200 bits overhead/padding */
unsigned int bin_len = 13 * src_len + 200 + 1;
unsigned int bin_len = 13 * length + 200 + 1;
int widths[4];
int bp = 0;
int cols_per_row = 0;
@ -1276,16 +1287,16 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int
int stack_rows = 1;
const int debug_print = (symbol->debug & ZINT_DEBUG_PRINT);
#ifndef _MSC_VER
unsigned char reduced[src_len + 1];
unsigned char reduced[length + 1];
char binary_string[bin_len];
#else
unsigned char *reduced = (unsigned char *) _alloca(src_len + 1);
unsigned char *reduced = (unsigned char *) _alloca(length + 1);
char *binary_string = (char *) _alloca(bin_len);
#endif
separator_row = 0;
error_number = gs1_verify(symbol, source, src_len, reduced);
error_number = gs1_verify(symbol, source, length, reduced);
if (error_number >= ZINT_ERROR) {
return error_number;
}
@ -1466,16 +1477,7 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int
}
symbol->rows = symbol->rows + 1;
/* Add human readable text */
for (i = 0; i <= src_len; i++) {
if (source[i] == '[') {
symbol->text[i] = '(';
} else if (source[i] == ']') {
symbol->text[i] = ')';
} else {
symbol->text[i] = source[i];
}
}
dbar_exp_hrt(symbol, source, length);
} else {
int current_row, current_block, left_to_right;
@ -1621,6 +1623,8 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int
}
/* GS1 DataBar Expanded */
INTERNAL int dbar_exp(struct zint_symbol *symbol, unsigned char source[], int src_len) {
return dbar_exp_cc(symbol, source, src_len, 0 /*cc_rows*/);
INTERNAL int dbar_exp(struct zint_symbol *symbol, unsigned char source[], int length) {
return dbar_exp_cc(symbol, source, length, 0 /*cc_rows*/);
}
/* vim: set ts=4 sw=4 et : */

View file

@ -43,7 +43,7 @@
# elif defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wformat" /* Unfortunately doesn't seem to be way to only avoid non-ISO warnings */
# endif
#elif defined(_MSC_VER) || __WORDSIZE == 32
#elif defined(_MSC_VER) || defined(__APPLE__) || __WORDSIZE == 32
# define LX_FMT "ll"
#else
# define LX_FMT "l"

View file

@ -295,7 +295,7 @@ static void test_checks_segs(int index, int debug) {
/* 6*/ { BARCODE_CODE128, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 775: Symbology does not support multiple segments" },
/* 7*/ { 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" },
/* 8*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 1 } }, 2, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI code 1" },
/* 9*/ { 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" },
/* 9*/ { 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" },
/* 10*/ { 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 data" },
/* 11*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 3 }, { TU("B"), 0, 4 } }, 2, -1, -1, -1, 0, "" },
/* 12*/ { BARCODE_AZTEC, -1, { { TU("A"), 0, 0 }, { TU("B"), 0, 4 } }, 2, -1, 3, -1, 0, "" },
@ -458,6 +458,7 @@ static void test_escape_char_process(int index, int generate, int debug) {
int input_mode;
int eci;
char *data;
char *composite;
int ret;
int expected_width;
char *expected;
@ -465,90 +466,95 @@ static void test_escape_char_process(int index, int generate, int debug) {
char *comment;
};
struct item data[] = {
/* 0*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 26, "01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F EB 02 5D 81 21 0D 92 2E 3D FD B6 9A 37 2A CD 61 FB 95", 0, "" },
/* 1*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 101, "(45) 67 62 43 40 44 47 48 29 6A 67 62 0B 49 4A 4B 4C 18 6A 67 62 0C 4D 5B 5D 5E 62 6A 67", 0, "" },
/* 2*/ { BARCODE_CODE16K, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 70, "(20) 14 64 68 71 72 73 74 75 76 77 91 93 94 101 65 60 103 103 45 61", 0, "" },
/* 3*/ { BARCODE_DOTCODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 28, "65 40 44 47 48 49 4A 4B 4C 4D 5B 5D 5E 6E 41 3C 6A", 0, "" },
/* 4*/ { BARCODE_GRIDMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 30, "30 1A 00 02 01 61 00 48 28 16 0C 06 46 63 51 74 05 38 00", 0, "" },
/* 5*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 20 E8 F4 0A E0 00", 0, "" },
/* 6*/ { BARCODE_MAXICODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 30, "(144) 04 3E 3E 00 04 07 08 09 0A 0B 03 3D 2C 24 19 1E 23 1B 18 0E 0C 0D 1E 21 3C 1E 3C 31", 0, "" },
/* 7*/ { BARCODE_PDF417, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 120, "(24) 16 901 0 23 655 318 98 18 461 639 893 122 129 92 900 900 872 438 359 646 522 773 831", 0, "" },
/* 8*/ { BARCODE_ULTRA, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", 0, 20, "(15) 257 0 4 7 8 9 10 11 12 13 27 29 30 129 92", 0, "" },
/* 9*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", 0, 18, "(32) 01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F E7 32 45 DB 70 5D E3 16 7B 2B 44 60 E1 55 F7 08", 0, "" },
/* 10*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 30 E8 F4 0C 0C 0A E0 00 00 00", 0, "" },
/* 11*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\c", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input data", 0, "" },
/* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input data", 0, "" },
/* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input data", 0, "" },
/* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input data", 0, "" },
/* 15*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character for '\\x' escape sequence in input data (hexadecimal only)", 0, "" },
/* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" },
/* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" },
/* 18*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" },
/* 19*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12a", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character for '\\d' escape sequence in input data (decimal only)", 0, "" },
/* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" },
/* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o1", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" },
/* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o12", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" },
/* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o128", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character for '\\o' escape sequence in input data (octal only)", 0, "" },
/* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xA01\\xFF", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 0, "" },
/* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1601\\d255", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 26*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o2401\\o377", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 27*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00A01\\u00FF", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 28*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000A01\\U0000FF", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 29*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xc3\\xbF", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 0, "" },
/* 30*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d195\\d191", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 31*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o303\\o277", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 32*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00fF", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 33*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000fF", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 34*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\xc3\\xbF", 0, 10, "EB 80 81 47 1E 45 FC 93", 0, "" },
/* 35*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\d195\\d191", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 36*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\o303\\o277", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 37*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00fF", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 38*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000fF", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 39*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 40*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 41*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 42*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 43*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 44*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Invalid character for '\\u' escape sequence in input data (hexadecimal only)", 0, "" },
/* 45*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\u' escape sequence in input data", 0, "Reversed BOM" },
/* 46*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\u' escape sequence in input data", 0, "Surrogate" },
/* 47*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\u' escape sequence in input data", 0, "Surrogate" },
/* 48*/ { 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" },
/* 49*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\u20AC", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 50*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\U0020AC", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 51*/ { BARCODE_DATAMATRIX, DATA_MODE, 17, "\\xA4", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 52*/ { BARCODE_DATAMATRIX, DATA_MODE, 28, "\\xB1\\x60", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 0, "Zint manual 4.10 Ex2" },
/* 53*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\u5E38", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
/* 54*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\U005E38", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
/* 55*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u007F", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
/* 56*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U00007F", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
/* 57*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 58*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UF", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 59*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 60*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UFG", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 61*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 62*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00FG", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 63*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ufffe", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Reversed BOM" },
/* 64*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ud800", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Surrogate" },
/* 65*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Udfff", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Surrogate" },
/* 66*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U000F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 67*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000F", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 68*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U110000", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\U' escape sequence in input data", 0, "" },
/* 69*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 25, "\\U10FFFF", 0, 14, "F1 1A 01 01 EB 80 EB 80 3F C0 9C 0B 4B B8 DA B7 B6 1A", 0, "" },
/* 70*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 26, "\\U10FFFF", 0, 14, "F1 1B 01 E7 EC 71 D7 6C 20 D6 B3 63 E2 18 B6 4C 7D 3E", 0, "" },
/* 71*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 32, "\\U10FFFF", 0, 32, "F1 21 01 EB 05 32 EB 25 3A 81 7E 98 9B 50 AC 1C E0 4E 51 BA 23", 0, "" },
/* 72*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 33, "\\U10FFFF", 0, 14, "F1 22 01 01 EB 80 EB 80 A3 E5 BE FB 1A 08 94 2E C3 74", 0, "" },
/* 73*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 34, "\\U10FFFF", 0, 16, "F1 23 01 01 01 01 01 01 EB 80 EB 80 F6 F1 5D 2A D1 0A BF BC B8 22 65 0C", 0, "" },
/* 74*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 35, "\\U10FFFF", 0, 16, "F1 24 01 01 01 01 EB 80 EB 80 01 01 7F 58 28 41 7F 63 0E EB A7 D8 D0 1F", 0, "" },
/* 0*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 26, "01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F EB 02 5D 81 21 0D 92 2E 3D FD B6 9A 37 2A CD 61 FB 95", 0, "" },
/* 1*/ { BARCODE_CODABLOCKF, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 101, "(45) 67 62 43 40 44 47 48 29 6A 67 62 0B 49 4A 4B 4C 18 6A 67 62 0C 4D 5B 5D 5E 62 6A 67", 0, "" },
/* 2*/ { BARCODE_CODE16K, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 70, "(20) 14 64 68 71 72 73 74 75 76 77 91 93 94 101 65 60 103 103 45 61", 0, "" },
/* 3*/ { BARCODE_DOTCODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 28, "65 40 44 47 48 49 4A 4B 4C 4D 5B 5D 5E 6E 41 3C 6A", 0, "" },
/* 4*/ { BARCODE_GRIDMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 30, "30 1A 00 02 01 61 00 48 28 16 0C 06 46 63 51 74 05 38 00", 0, "" },
/* 5*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 20 E8 F4 0A E0 00", 0, "" },
/* 6*/ { BARCODE_MAXICODE, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 30, "(144) 04 3E 3E 00 04 07 08 09 0A 0B 03 3D 2C 24 19 1E 23 1B 18 0E 0C 0D 1E 21 3C 1E 3C 31", 0, "" },
/* 7*/ { BARCODE_PDF417, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 120, "(24) 16 901 0 23 655 318 98 18 461 639 893 122 129 92 900 900 872 438 359 646 522 773 831", 0, "" },
/* 8*/ { BARCODE_ULTRA, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\\\", "", 0, 20, "(15) 257 0 4 7 8 9 10 11 12 13 27 29 30 129 92", 0, "" },
/* 9*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", "", 0, 18, "(32) 01 05 08 09 0A 0B 0C 0D 0E 1C 1E 1F E7 32 45 DB 70 5D E3 16 7B 2B 44 60 E1 55 F7 08", 0, "" },
/* 10*/ { BARCODE_HANXIN, DATA_MODE, -1, "\\0\\E\\a\\b\\t\\n\\v\\f\\r\\e\\G\\R\\x81\\d129\\o201\\\\", "", 0, 23, "2F 80 10 72 09 28 B3 0D 6F F3 00 30 E8 F4 0C 0C 0A E0 00 00 00", 0, "" },
/* 11*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\c", "", ZINT_ERROR_INVALID_DATA, 0, "Error 234: Unrecognised escape character '\\c' in input data", 0, "" },
/* 12*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\", "", ZINT_ERROR_INVALID_DATA, 0, "Error 236: Incomplete escape character in input data", 0, "" },
/* 13*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input data", 0, "" },
/* 14*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\x' escape sequence in input data", 0, "" },
/* 15*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\x1g", "", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character for '\\x' escape sequence in input data (hexadecimal only)", 0, "" },
/* 16*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" },
/* 17*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" },
/* 18*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\d' escape sequence in input data", 0, "" },
/* 19*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d12a", "", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character for '\\d' escape sequence in input data (decimal only)", 0, "" },
/* 20*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" },
/* 21*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o1", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" },
/* 22*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o12", "", ZINT_ERROR_INVALID_DATA, 0, "Error 232: Incomplete '\\o' escape sequence in input data", 0, "" },
/* 23*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o128", "", ZINT_ERROR_INVALID_DATA, 0, "Error 233: Invalid character for '\\o' escape sequence in input data (octal only)", 0, "" },
/* 24*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xA01\\xFF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 0, "" },
/* 25*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d1601\\d255", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 26*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o2401\\o377", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 27*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00A01\\u00FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 28*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000A01\\U0000FF", "", 0, 12, "EB 21 32 EB 80 D8 49 44 DC 7D 9E 3B", 1, "" },
/* 29*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\xc3\\xbF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 0, "" },
/* 30*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\d195\\d191", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 31*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\o303\\o277", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 32*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 33*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000fF", "", 0, 12, "EB 44 EB 40 81 30 87 17 C5 68 5C 91", 1, "" },
/* 34*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\xc3\\xbF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 0, "" },
/* 35*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\d195\\d191", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 36*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\o303\\o277", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 37*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u00fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 38*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U0000fF", "", 0, 10, "EB 80 81 47 1E 45 FC 93", 1, "" },
/* 39*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 40*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 41*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 42*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\uFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 43*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\u' escape sequence in input data", 0, "" },
/* 44*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\u00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 211: Invalid character for '\\u' escape sequence in input data (hexadecimal only)", 0, "" },
/* 45*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\u' escape sequence in input data", 0, "Reversed BOM" },
/* 46*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\u' escape sequence in input data", 0, "Surrogate" },
/* 47*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\u' escape sequence in input data", 0, "Surrogate" },
/* 48*/ { 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" },
/* 49*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\u20AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 50*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 17, "\\U0020AC", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 51*/ { BARCODE_DATAMATRIX, DATA_MODE, 17, "\\xA4", "", 0, 12, "F1 12 EB 25 81 4A 0A 8C 31 AC E3 2E", 1, "" },
/* 52*/ { BARCODE_DATAMATRIX, DATA_MODE, 28, "\\xB1\\x60", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 0, "Zint manual 4.10 Ex2" },
/* 53*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\u5E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
/* 54*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 28, "\\U005E38", "", 0, 12, "F1 1D EB 32 61 D9 1C 0C C2 46 C3 B2", 1, "" },
/* 55*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\u007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
/* 56*/ { BARCODE_DATAMATRIX, UNICODE_MODE, -1, "\\U00007F", "", 0, 10, "80 81 46 73 64 88 6A 84", 0, "" },
/* 57*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 58*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UF", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 59*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 60*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\UFG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 61*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 62*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U00FG", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 63*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ufffe", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Reversed BOM" },
/* 64*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Ud800", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Surrogate" },
/* 65*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\Udfff", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "Surrogate" },
/* 66*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 67*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U0000F", "", ZINT_ERROR_INVALID_DATA, 0, "Error 209: Incomplete '\\U' escape sequence in input data", 0, "" },
/* 68*/ { BARCODE_DATAMATRIX, DATA_MODE, -1, "\\U110000", "", ZINT_ERROR_INVALID_DATA, 0, "Error 246: Invalid value for '\\U' escape sequence in input data", 0, "" },
/* 69*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 25, "\\U10FFFF", "", 0, 14, "F1 1A 01 01 EB 80 EB 80 3F C0 9C 0B 4B B8 DA B7 B6 1A", 0, "" },
/* 70*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 26, "\\U10FFFF", "", 0, 14, "F1 1B 01 E7 EC 71 D7 6C 20 D6 B3 63 E2 18 B6 4C 7D 3E", 0, "" },
/* 71*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 32, "\\U10FFFF", "", 0, 32, "F1 21 01 EB 05 32 EB 25 3A 81 7E 98 9B 50 AC 1C E0 4E 51 BA 23", 0, "" },
/* 72*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 33, "\\U10FFFF", "", 0, 14, "F1 22 01 01 EB 80 EB 80 A3 E5 BE FB 1A 08 94 2E C3 74", 0, "" },
/* 73*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 34, "\\U10FFFF", "", 0, 16, "F1 23 01 01 01 01 01 01 EB 80 EB 80 F6 F1 5D 2A D1 0A BF BC B8 22 65 0C", 0, "" },
/* 74*/ { BARCODE_DATAMATRIX, UNICODE_MODE, 35, "\\U10FFFF", "", 0, 16, "F1 24 01 01 01 01 EB 80 EB 80 01 01 7F 58 28 41 7F 63 0E EB A7 D8 D0 1F", 0, "" },
/* 75*/ { BARCODE_GS1_128_CC, GS1_MODE, -1, "[20]10", "[10]A", 0, 99, "(7) 105 102 20 10 100 59 106", 0, "" },
/* 76*/ { BARCODE_GS1_128_CC, GS1_MODE | ESCAPE_MODE, -1, "[2\\x30]1\\d048", "[\\x310]\\x41", 0, 99, "(7) 105 102 20 10 100 59 106", 1, "" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol;
char escaped[1024];
char escaped_composite[1024];
struct zint_symbol previous_symbol;
char *input_filename = "test_escape.txt";
char *text;
testStart("test_escape_char_process");
for (i = 0; i < data_size; i++) {
@ -559,17 +565,25 @@ static void test_escape_char_process(int index, int generate, int debug) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
symbol->debug = ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt
if (is_composite(data[i].symbology)) {
text = data[i].composite;
strcpy(symbol->primary, data[i].data);
} else {
text = data[i].data;
}
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode | ESCAPE_MODE, data[i].eci, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
debug |= ZINT_DEBUG_TEST; // Needed to get codeword dump in errtxt
ret = ZBarcode_Encode(symbol, TU(data[i].data), length);
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode | ESCAPE_MODE, data[i].eci, -1 /*option_1*/, -1, -1, -1 /*output_options*/, text, -1, debug);
ret = ZBarcode_Encode(symbol, TU(text), length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (generate) {
printf(" /*%3d*/ { %s, %s, %d, \"%s\", %s, %d, \"%s\", %d, \"%s\" },\n",
printf(" /*%3d*/ { %s, %s, %d, \"%s\", \"%s\", %s, %d, \"%s\", %d, \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].eci,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilEscape(data[i].composite, strlen(data[i].composite), escaped_composite, sizeof(escaped_composite)),
testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].compare_previous, data[i].comment);
} else {
assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected);
@ -583,7 +597,7 @@ static void test_escape_char_process(int index, int generate, int debug) {
}
memcpy(&previous_symbol, symbol, sizeof(previous_symbol));
if (ret < 5) {
if (ret < ZINT_ERROR && !data[i].composite[0]) {
// Test from input file
FILE *fp;
struct zint_symbol *symbol2;

View file

@ -136,7 +136,7 @@ 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=$(HIGHLIGHT_THEME) -V colorlinks -V geometry:margin=20mm -V papersize=a4 --dpi=300
--highlight-style=$(HIGHLIGHT_THEME) -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
MAN_PAGE_OPTS = -s -t man

View file

@ -185,20 +185,24 @@ To build Zint on Windows from source, see `"win32/README"`.
## 2.3 Apple macOS
Zint can be installed using Homebrew. To install Homebrew input the following
line into the macOS terminal
The latest Zint CLI and `libzint` can be installed using Homebrew.[^1] To
install Homebrew input the following line into the macOS terminal
```bash
/usr/bin/ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
/bin/bash -c "$(curl -fsSL \
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```
Once Homebrew is installed use the following command to install Zint.
Once Homebrew is installed use the following command to install the Zint.
```bash
brew install zint
```
To build from source see `"README.macos"` in the project root directory.
[^1]: See the Homebrew website [https://brew.sh](https://brew.sh).
## 2.4 Zint Tcl Backend
The Tcl backend in the `"backend_tcl"` sub-directory may be built using the
@ -463,7 +467,7 @@ Sequence Equivalent
`\xNN` 0xNN Any 8-bit character where NN is hexadecimal
`\uNNNN` Any 16-bit Unicode BMP[^1] character where
`\uNNNN` Any 16-bit Unicode BMP[^2] character where
NNNN is hexadecimal
`\UNNNNNN` Any 20-bit Unicode character where NNNNNN
@ -472,7 +476,7 @@ Sequence Equivalent
Table: {#tbl:escape_sequences tag=": Escape Sequences"}
[^1]: In Unicode contexts, BMP stands for Basic Multilingual Plane, the plane 0
[^2]: In Unicode contexts, BMP stands for Basic Multilingual Plane, the plane 0
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!
@ -526,7 +530,7 @@ Names are treated case-insensitively by the CLI, and the `BARCODE_` prefix and
any underscores are optional.
--------------------------------------------------------------------------------
Numeric Name[^2] Barcode Name
Numeric Name[^3] Barcode Name
Value
------- ------------------------ ---------------------------------------------
1 `BARCODE_CODE11` Code 11
@ -730,7 +734,7 @@ Value
Table: {#tbl:barcode_types tag=": Barcode Types (Symbologies)"}
[^2]: The symbologies marked with an asterisk (`*`) in Table
[^3]: The symbologies marked with an asterisk (`*`) in Table
{@tbl:barcode_types} above used different names in Zint before version 2.9.0.
For example, symbology 29 used the name `BARCODE_RSS14`. These names are now
deprecated but are still recognised by Zint and will continue to be supported in
@ -1022,7 +1026,7 @@ Grid Matrix GB 2312 (includes ASCII) N/A
Han Xin Latin-1 GB 18030 (includes ASCII)
MaxiCode Latin-1 None
MicroPDF417 Latin-1 None
Micro QR Code Latin-1 Shift JIS (includes ASCII[^3])
Micro QR Code Latin-1 Shift JIS (includes ASCII[^4])
PDF417 Latin-1 None
QR Code Latin-1 Shift JIS (see above)
rMQR Latin-1 Shift JIS (see above)
@ -1032,7 +1036,7 @@ All others ASCII N/A
Table: {#tbl:default_character_sets tag=": Default Character Sets"}
[^3]: Shift JIS (JIS X 0201 Roman) re-maps two ASCII characters: backslash (`\`)
[^4]: Shift JIS (JIS X 0201 Roman) re-maps two ASCII characters: backslash (`\`)
to the yen sign (¥), and tilde (`~`) to overline (U+203E).
If Zint encounters characters which can not be encoded using the default
@ -1126,12 +1130,12 @@ ECI Code Character Encoding Scheme (ISO/IEC 8859 schemes include ASCII)
33 UTF-16LE (Low order byte first)
34 UTF-32BE (High order bytes first)
35 UTF-32LE (Low order bytes first)
170 ISO/IEC 646 Invariant[^4]
170 ISO/IEC 646 Invariant[^5]
899 8-bit binary data
Table: {#tbl:eci_codes tag=": ECI Codes"}
[^4]: ISO/IEC 646 Invariant is a subset of ASCII with 12 characters undefined:
[^5]: ISO/IEC 646 Invariant is a subset of ASCII with 12 characters undefined:
`#`, `$`, `@`, `[`, `\`, `]`, `^`, `` ` ``, `{`, `|`, `}`, `~`.
An ECI value of 0 does not encode any ECI information in the code symbol (unless
@ -1657,7 +1661,7 @@ Variable Name Type Meaning Default Value
`height` float Symbol height, excluding Symbol dependent
fixed width-to-height
symbols.[^5]
symbols.[^6]
`scale` float Scale factor for adjusting 1.0
size of image.
@ -1783,7 +1787,7 @@ Variable Name Type Meaning Default Value
Table: API Structure `zint_symbol` {#tbl:api_structure_zint_symbol tag="$ $"}
[^5]: The `height` value is ignored for Aztec (including HIBC and Aztec Rune),
[^6]: The `height` value is ignored for Aztec (including HIBC and Aztec Rune),
Code One, Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode,
QR Code (including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which
have a fixed width-to-height ratio (or, in the case of Code One, a fixed
@ -1948,7 +1952,7 @@ Value Effect
0 No options selected.
`BARCODE_BIND` Boundary bars above and below the symbol and between
rows if stacking multiple symbols.[^6]
rows if stacking multiple symbols.[^7]
`BARCODE_BOX` Add a box surrounding the symbol and whitespace.
@ -1973,7 +1977,7 @@ Value Effect
separate colour channels (`OUT_BUFFER` only).
`BARCODE_QUIET_ZONES` Add compliant quiet zones (additional to any
specified whitespace).[^7]
specified whitespace).[^8]
`BARCODE_NO_QUIET_ZONES` Disable quiet zones, notably those with defaults.
@ -1983,10 +1987,10 @@ Value Effect
Table: API `output_options` Values {#tbl:api_output_options tag="$ $"}
[^6]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code
[^7]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code
49. Special considerations apply to ITF-14 - see [6.1.2.6 ITF-14].
[^7]: Codablock-F, Code 16K, Code 49, EAN-2 to EAN-13, ISBN, ITF-14, UPC-A and
[^8]: Codablock-F, Code 16K, Code 49, EAN-2 to EAN-13, ISBN, ITF-14, UPC-A and
UPC-E have compliant quiet zones added by default.
\clearpage
@ -4124,8 +4128,8 @@ company references in particular.
This section is intended as a quick reference to the character sets used by
Zint. All symbologies use standard ASCII input as shown in section A.1, but
some support extended characters as shown in the subsequent [A.2 Latin Alphabet
No. 1 (ISO/IEC 8859-1)].
some support extended characters as shown in the subsequent section [A.2 Latin
Alphabet No. 1 (ISO/IEC 8859-1)].
## A.1 ASCII Standard

View file

@ -360,16 +360,18 @@ To build Zint on Windows from source, see "win32/README".
2.3 Apple macOS
Zint can be installed using Homebrew. To install Homebrew input the following
line into the macOS terminal
The latest Zint CLI and libzint can be installed using Homebrew.[1] To install
Homebrew input the following line into the macOS terminal
/usr/bin/ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
/bin/bash -c "$(curl -fsSL \
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once Homebrew is installed use the following command to install Zint.
Once Homebrew is installed use the following command to install the Zint.
brew install zint
To build from source see "README.macos" in the project root directory.
2.4 Zint Tcl Backend
The Tcl backend in the "backend_tcl" sub-directory may be built using the
@ -615,7 +617,7 @@ sequences are shown in the table below.
\xNN 0xNN Any 8-bit character where NN is hexadecimal
\uNNNN Any 16-bit Unicode BMP[1] character where
\uNNNN Any 16-bit Unicode BMP[2] character where
NNNN is hexadecimal
\UNNNNNN Any 20-bit Unicode character where NNNNNN
@ -664,7 +666,7 @@ Names are treated case-insensitively by the CLI, and the BARCODE_ prefix and any
underscores are optional.
--------------------------------------------------------------------------------
Numeric Name[2] Barcode Name
Numeric Name[3] Barcode Name
Value
--------- ------------------------- --------------------------------------------
1 BARCODE_CODE11 Code 11
@ -1122,7 +1124,7 @@ Latin-2 (ISO/IEC 8859-2 plus ASCII).
Han Xin Latin-1 GB 18030 (includes ASCII)
MaxiCode Latin-1 None
MicroPDF417 Latin-1 None
Micro QR Code Latin-1 Shift JIS (includes ASCII[3])
Micro QR Code Latin-1 Shift JIS (includes ASCII[4])
PDF417 Latin-1 None
QR Code Latin-1 Shift JIS (see above)
rMQR Latin-1 Shift JIS (see above)
@ -1223,7 +1225,7 @@ formatted. Zint automatically translates the data into the target encoding.
33 UTF-16LE (Low order byte first)
34 UTF-32BE (High order bytes first)
35 UTF-32LE (Low order bytes first)
170 ISO/IEC 646 Invariant[4]
170 ISO/IEC 646 Invariant[5]
899 8-bit binary data
: Table : ECI Codes:
@ -1703,7 +1705,7 @@ encoding stages. The zint_symbol structure consists of the following variables:
height float Symbol height, excluding Symbol dependent
fixed width-to-height
symbols.[5]
symbols.[6]
scale float Scale factor for adjusting 1.0
size of image.
@ -1976,7 +1978,7 @@ together when adjusting this value:
0 No options selected.
BARCODE_BIND Boundary bars above and below the symbol and between
rows if stacking multiple symbols.[6]
rows if stacking multiple symbols.[7]
BARCODE_BOX Add a box surrounding the symbol and whitespace.
@ -2001,7 +2003,7 @@ together when adjusting this value:
separate colour channels (OUT_BUFFER only).
BARCODE_QUIET_ZONES Add compliant quiet zones (additional to any
specified whitespace).[7]
specified whitespace).[8]
BARCODE_NO_QUIET_ZONES Disable quiet zones, notably those with defaults.
@ -4026,8 +4028,8 @@ Annex A. Character Encoding
This section is intended as a quick reference to the character sets used by
Zint. All symbologies use standard ASCII input as shown in section A.1, but some
support extended characters as shown in the subsequent A.2 Latin Alphabet No. 1
(ISO/IEC 8859-1).
support extended characters as shown in the subsequent section A.2 Latin
Alphabet No. 1 (ISO/IEC 8859-1).
A.1 ASCII Standard
@ -4368,7 +4370,7 @@ OPTIONS
--quietzones
Add compliant quiet zones for symbols that specify one. This is in addition
Add compliant quiet zones for symbols that specify them. This is in addition
to any whitespace specified by -w | --whitesp or --vwhitesp.
-r, --reverse
@ -4607,30 +4609,32 @@ AUTHOR
Robin Stuart robin@zint.org.uk
[1] In Unicode contexts, BMP stands for Basic Multilingual Plane, the plane 0
[1] See the Homebrew website https://brew.sh.
[2] In Unicode contexts, BMP stands for Basic Multilingual Plane, the plane 0
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!
[2] The symbologies marked with an asterisk (*) in Table
[3] The symbologies marked with an asterisk (*) in Table
: Barcode Types (Symbologies) above used different names in Zint before version
2.9.0. For example, symbology 29 used the name BARCODE_RSS14. These names are
now deprecated but are still recognised by Zint and will continue to be
supported in future versions.
[3] Shift JIS (JIS X 0201 Roman) re-maps two ASCII characters: backslash (\) to
[4] Shift JIS (JIS X 0201 Roman) re-maps two ASCII characters: backslash (\) to
the yen sign (¥), and tilde (~) to overline (U+203E).
[4] ISO/IEC 646 Invariant is a subset of ASCII with 12 characters undefined: #,
[5] ISO/IEC 646 Invariant is a subset of ASCII with 12 characters undefined: #,
$, @, [, \, ], ^, `, {, |, }, ~.
[5] The height value is ignored for Aztec (including HIBC and Aztec Rune), Code
[6] The height value is ignored for Aztec (including HIBC and Aztec Rune), Code
One, Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode, QR
Code (including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which
have a fixed width-to-height ratio (or, in the case of Code One, a fixed
height).
[6] The BARCODE_BIND flag is always set for Codablock-F, Code 16K and Code 49.
[7] The BARCODE_BIND flag is always set for Codablock-F, Code 16K and Code 49.
Special considerations apply to ITF-14 - see 6.1.2.6 ITF-14.
[7] Codablock-F, Code 16K, Code 49, EAN-2 to EAN-13, ISBN, ITF-14, UPC-A and
[8] Codablock-F, Code 16K, Code 49, EAN-2 to EAN-13, ISBN, ITF-14, UPC-A and
UPC-E have compliant quiet zones added by default.

View file

@ -317,7 +317,7 @@ For MaxiCode, set the content of the primary message.
For GS1 Composite symbols, set the content of the linear symbol.
.TP
\f[V]--quietzones\f[R]
Add compliant quiet zones for symbols that specify one.
Add compliant quiet zones for symbols that specify them.
This is in addition to any whitespace specified by \f[V]-w\f[R] |
\f[V]--whitesp\f[R] or \f[V]--vwhitesp\f[R].
.TP

View file

@ -254,7 +254,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
`--quietzones`
: Add compliant quiet zones for symbols that specify one. This is in addition to any whitespace specified by `-w` |
: Add compliant quiet zones for symbols that specify them. This is in addition to any whitespace specified by `-w` |
`--whitesp` or `--vwhitesp`.
`-r`, `--reverse`

View file

@ -55,7 +55,7 @@ static void types(void) {
" 7 C25IND Industrial 2 of 5 80 DBAR_OMNSTK GS1 DataBar Stack Omni\n"
" 8 CODE39 Code 39 81 DBAR_EXPSTK GS1 DataBar Exp Stack\n"
" 9 EXCODE39 Extended Code 39 82 PLANET USPS PLANET\n"
"13 EANX EAN 84 MICROPDF417 MicroPDF417\n"
"13 EANX EAN-2 to EAN-13 84 MICROPDF417 MicroPDF417\n"
"14 EANX_CHK EAN + Check Digit 85 USPS_IMAIL USPS Intelligent Mail\n"
"16 GS1_128 GS1-128 86 PLESSEY UK Plessey\n"
"18 CODABAR Codabar 87 TELEPEN_NUM Telepen Numeric\n"
@ -939,7 +939,7 @@ typedef struct { char *arg; int opt; } arg_opt;
int main(int argc, char **argv) {
struct zint_symbol *my_symbol;
struct zint_seg segs[10] = {0};
struct zint_seg segs[10] = {{0}};
int error_number = 0;
int warn_number = 0;
int rotate_angle = 0;

View file

@ -1,3 +1,5 @@
#! /bin/bash
# Create zint test output
mkdir test_sh_out
cd test_sh_out
echo testing Code 11

View file

@ -1,5 +1,6 @@
# Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu >
# Copyright (C) 2009-2021 Robin Stuart <rstuart114@gmail.com>
# Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
# vim: set ts=4 sw=4 et :
project(zint-qt)
@ -23,7 +24,23 @@ endif()
# grpC16k.ui grpChannel.ui grpDBExtend.ui grpITF14.ui grpMSICheck.ui grpUPCA.ui
# grpC25.ui grpCodabar.ui grpDM.ui grpLOGMARS.ui grpPDF417.ui grpUPCEAN.ui
add_executable(${PROJECT_NAME} ${zint-qt_SRCS} resources.qrc)
if(APPLE)
# https://doc.qt.io/qt-5/appicon.html
set(MACOSX_BUNDLE_ICON_FILE zint-qt.icns)
set(APP_ICON_MACOSX "${CMAKE_CURRENT_SOURCE_DIR}/zint-qt.icns")
set_source_files_properties(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${zint-qt_SRCS} resources.qrc ${APP_ICON_MACOSX})
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME "Zint Barcode Studio"
MACOSX_BUNDLE_BUNDLE_VERSION ${ZINT_VERSION}
MACOSX_BUNDLE_COPYRIGHT "Copyright © 2006-2022 Robin Stuart and others"
MACOSX_BUNDLE_GUI_IDENTIFIER "uk.org.zint.zint-qt"
MACOSX_BUNDLE_INFO_STRING "A free barcode generator"
MACOSX_BUNDLE_SHORT_VERSION_STRING ${ZINT_VERSION})
else()
add_executable(${PROJECT_NAME} ${zint-qt_SRCS} resources.qrc)
endif()
if(WIN32)
target_sources(${PROJECT_NAME} PRIVATE res/qtZint.rc)

View file

@ -1,6 +1,6 @@
/*
Zint Barcode Generator - the open source barcode generator
Copyright (C) 2009 - 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,7 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: GPL-3.0-or-later */
//#include <QDebug>
#include <QUiLoader>
@ -30,7 +30,7 @@
// Shorthand
#define QSL QStringLiteral
ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data) : m_bc(bc), m_output_data(output_data)
ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data) : m_bc(bc), m_output_data(output_data), m_lines(0)
{
setupUi(this);
QSettings settings;
@ -54,6 +54,14 @@ ExportWindow::ExportWindow(BarcodeItem *bc, const QString& output_data) : m_bc(b
connect(btnCancel, SIGNAL( clicked( bool )), SLOT(close()));
connect(btnOK, SIGNAL( clicked( bool )), SLOT(process()));
connect(btnDestPath, SIGNAL( clicked( bool )), SLOT(get_directory()));
m_dataList = m_output_data.split('\n');
m_lines = m_dataList.size();
if (m_lines && m_dataList[m_lines - 1].isEmpty()) {
m_lines--;
}
/*: %1 is number of sequences */
lblFeedback->setText(tr("Export Results (%1):").arg(m_lines));
}
ExportWindow::~ExportWindow()
@ -102,18 +110,12 @@ void ExportWindow::process()
txtFeedback->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
QStringList dataList = m_output_data.split('\n');
int lines = dataList.size();
if (lines && dataList[lines - 1].isEmpty()) {
lines--;
}
QString biggest;
bool needUrlEscape = false;
const int fileNameIdx = cmbFileName->currentIndex();
if (fileNameIdx == 1) {
biggest = QString::number(lines + 1);
biggest = QString::number(m_lines + 1);
} else {
needUrlEscape = m_output_data.contains(urlRE);
}
@ -145,8 +147,8 @@ void ExportWindow::process()
QStringList Feedback;
int successCount = 0, errorCount = 0;
for (int i = 0; i < lines; i++) {
const QString &dataString = dataList[i];
for (int i = 0; i < m_lines; i++) {
const QString &dataString = m_dataList[i];
QString fileName;
switch (fileNameIdx) {
case 0: /* Same as Data (URL Escaped) */
@ -227,3 +229,5 @@ void ExportWindow::process()
}
txtFeedback->moveCursor(QTextCursor::End, QTextCursor::MoveAnchor);
}
/* vim: set ts=4 sw=4 et : */

View file

@ -1,6 +1,6 @@
/*
Zint Barcode Generator - the open source barcode generator
Copyright (C) 2009-2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2022 Robin Stuart <rstuart114@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -16,10 +16,10 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef EXPORTWINDOW_H
#define EXPORTWINDOW_H
#ifndef Z_EXPORTWINDOW_H
#define Z_EXPORTWINDOW_H
#include "ui_extExport.h"
#include "barcodeitem.h"
@ -39,6 +39,9 @@ private slots:
protected:
BarcodeItem *m_bc;
QString m_output_data;
QStringList m_dataList;
int m_lines;
};
/* vim: set ts=4 sw=4 et : */
#endif

15
frontend_qt/mac_icons.sh Executable file
View file

@ -0,0 +1,15 @@
#! /bin/bash
# Create icon set for macOS, requires "brew install librsvg"
mkdir MyIcon.iconset
rsvg-convert -h 16 -d 72 -p 72 images/scalable/zint-qt.svg > MyIcon.iconset/icon_16x16.png
rsvg-convert -h 32 -d 144 -p 144 images/scalable/zint-qt.svg > MyIcon.iconset/icon_16x16@2x.png
rsvg-convert -h 32 -d 72 -p 72 images/scalable/zint-qt.svg > MyIcon.iconset/icon_32x32.png
rsvg-convert -h 64 -d 144 -p 144 images/scalable/zint-qt.svg > MyIcon.iconset/icon_32x32@2x.png
rsvg-convert -h 128 -d 72 -p 72 images/scalable/zint-qt.svg > MyIcon.iconset/icon_128x128.png
rsvg-convert -h 256 -d 144 -p 144 images/scalable/zint-qt.svg > MyIcon.iconset/icon_128x128@2x.png
rsvg-convert -h 256 -d 72 -p 72 images/scalable/zint-qt.svg > MyIcon.iconset/icon_256x256.png
rsvg-convert -h 512 -d 144 -p 144 images/scalable/zint-qt.svg > MyIcon.iconset/icon_256x256@2x.png
rsvg-convert -h 512 -d 72 -p 72 images/scalable/zint-qt.svg > MyIcon.iconset/icon_512x512.png
rsvg-convert -h 1024 -d 144 -p 144 images/scalable/zint-qt.svg > MyIcon.iconset/icon_512x512@2x.png
iconutil -c icns MyIcon.iconset
# rm -R MyIcon.iconset

View file

@ -27,13 +27,10 @@
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayoutMain">
<layout class="QVBoxLayout" name="vLayoutMain">
<item>
<widget class="QGraphicsView" name="view">
<property name="minimumSize">
@ -78,14 +75,14 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="hLayoutMain">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_6">
<layout class="QVBoxLayout" name="vLayoutSymbology">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<layout class="QHBoxLayout" name="hLayoutSymbology">
<item>
<widget class="QLabel" name="lblSymbology">
<property name="toolTip">
@ -141,9 +138,6 @@
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="currentIndex">
<number>0</number>
</property>
@ -151,7 +145,7 @@
<attribute name="title">
<string>&amp;Data</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayoutTabData">
<layout class="QVBoxLayout" name="vLayoutTabData">
<item>
<widget class="QGroupBox" name="grpData">
<property name="sizePolicy">
@ -166,9 +160,9 @@
<property name="title">
<string>Data to Enc&amp;ode</string>
</property>
<layout class="QVBoxLayout" name="verticalLayoutData">
<layout class="QVBoxLayout" name="vLayoutData">
<item>
<layout class="QHBoxLayout" name="horizontalLayoutData">
<layout class="QHBoxLayout" name="hLayoutData">
<item>
<widget class="QLineEdit" name="txtData">
<property name="toolTip">
@ -215,7 +209,7 @@ or import from file</string>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="eciLayout">
<layout class="QHBoxLayout" name="hLayoutECI">
<item>
<widget class="QLabel" name="lblECI">
<property name="maximumSize">
@ -427,7 +421,7 @@ or import from file</string>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_eciLayout">
<spacer name="hSpacer_hLayoutECI">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -520,9 +514,9 @@ for this symbology to defaults</string>
<property name="title">
<string>GS1 Composite</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="vLayoutComposite">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="hLayoutComposite">
<item>
<widget class="QCheckBox" name="chkComposite">
<property name="toolTip">
@ -534,7 +528,7 @@ for this symbology to defaults</string>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<spacer name="hSpacer_hLayoutComposite">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -601,12 +595,12 @@ for this symbology to defaults</string>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="vertLayoutComponentData">
<layout class="QVBoxLayout" name="vLayoutComponentData">
<property name="sizeConstraint">
<enum>QLayout::SetMinimumSize</enum>
</property>
<item>
<layout class="QHBoxLayout" name="horzLayoutComponentDataLabel">
<layout class="QHBoxLayout" name="hLayoutComponentDataLabel">
<item>
<widget class="QLabel" name="lblComposite">
<property name="enabled">
@ -703,9 +697,9 @@ Extended Channel Interpretation (ECI)</string>
<property name="title">
<string>Additional ECI/Data Segments</string>
</property>
<layout class="QVBoxLayout" name="verticalLayoutSegs">
<layout class="QVBoxLayout" name="vLayoutSegs">
<item>
<layout class="QHBoxLayout" name="horizontalLayoutSeg1">
<layout class="QHBoxLayout" name="hlLayoutSeg1">
<item>
<widget class="QLabel" name="lblSeg1">
<property name="enabled">
@ -966,7 +960,7 @@ or import from file</string>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutSeg2">
<layout class="QHBoxLayout" name="hLayoutSeg2">
<item>
<widget class="QLabel" name="lblSeg2">
<property name="enabled">
@ -1227,7 +1221,7 @@ or import from file</string>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutSeg3">
<layout class="QHBoxLayout" name="hLayoutSeg3">
<item>
<widget class="QLabel" name="lblSeg3">
<property name="enabled">
@ -1491,7 +1485,7 @@ or import from file</string>
</widget>
</item>
<item>
<spacer name="vertSpacerData">
<spacer name="vSpacerData">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -1504,9 +1498,9 @@ or import from file</string>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="chksLayout">
<layout class="QHBoxLayout" name="hLayoutChks">
<item>
<spacer name="horizontalSpacer_chksLayout">
<spacer name="hSpacer_hLayoutChks">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -1606,11 +1600,11 @@ as delimiters for GS1 Application Identifiers
<attribute name="title">
<string>A&amp;ppearance</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<layout class="QVBoxLayout" name="vLayoutAppearance">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayoutAutoHeight">
<layout class="QHBoxLayout" name="hLayoutAutoHeight">
<item>
<widget class="QCheckBox" name="chkAutoHeight">
<property name="toolTip">
@ -1698,7 +1692,7 @@ and use standard height (if any) for default
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="lblBorderWidth">
<property name="toolTip">
<string>Width of boundary bars or border in X-dimensions</string>
</property>
@ -1733,7 +1727,7 @@ and use standard height (if any) for default
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_9">
<widget class="QLabel" name="lblBorderType">
<property name="toolTip">
<string>Add border or box</string>
</property>

View file

@ -139,6 +139,53 @@ static const struct bstyle_item bstyle_items[] = {
{ QSL("VIN (Vehicle Identification Number)"), BARCODE_VIN },
};
#ifdef Q_OS_MACOS
/* Helper to make widgets look ok on macOS */
void MainWindow::mac_hack(QWidget *win)
{
if (!win) {
return;
}
QList<QWidget *> widgets = win->findChildren<QWidget *>();
for (int i = 0, cnt = widgets.size(); i < cnt; i++) {
widgets[i]->setAttribute(Qt::WA_MacNormalSize);
}
QList<QGroupBox *> grps = win->findChildren<QGroupBox *>();
for (int i = 0, cnt = grps.size(); i < cnt; i++) {
// TODO: top of groupbox too near to previous element - how to fix??
grps[i]->setAlignment(Qt::AlignHCenter); // Poor man's workaround for above
}
}
/* Helper to make data tab vertical layouts look ok on macOS */
void MainWindow::mac_hack_vLayouts(QWidget *win)
{
QList<QVBoxLayout *> vlayouts = win->findChildren<QVBoxLayout *>();
for (int i = 0, cnt = vlayouts.size(); i < cnt; i++) {
if (vlayouts[i]->objectName() == "vLayoutData" || vlayouts[i]->objectName() == "vLayoutComposite"
|| vlayouts[i]->objectName() == "vLayoutSegs") {
vlayouts[i]->setSpacing(0);
// If set spacing on QVBoxLayout then it seems its QHBoxLayout children inherit this so undo
QList<QHBoxLayout *> hlayouts = vlayouts[i]->findChildren<QHBoxLayout *>();
for (int j = 0, cnt = hlayouts.size(); j < cnt; j++) {
hlayouts[j]->setSpacing(8);
}
}
}
}
/* Helper to make status bars look ok on macOS */
void MainWindow::mac_hack_statusBars(QWidget *win, const char* name)
{
QList<QStatusBar *> sbars = name ? win->findChildren<QStatusBar *>(name) : win->findChildren<QStatusBar *>();
QColor bgColor = QGuiApplication::palette().window().color();
QString sbarSS = QSL("QStatusBar {background-color:") + bgColor.name() + QSL(";}");
for (int i = 0, cnt = sbars.size(); i < cnt; i++) {
sbars[i]->setStyleSheet(sbarSS);
}
}
#endif
MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
: QWidget(parent, fl), m_optionWidget(nullptr), m_symbology(0),
m_menu(nullptr),
@ -162,7 +209,23 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
setupUi(this);
view->setScene(scene);
restoreGeometry(settings.value(QSL("studio/window_geometry")).toByteArray());
QVariant saved_geometry = settings.value(QSL("studio/window_geometry"));
#ifdef Q_OS_MACOS
QApplication::setDesktopSettingsAware(false); // Makes group boxes use standard font (may do other stuff)
// Standard width 360 too narrow
if (saved_geometry.isNull()) {
// Seems this is necessary on macOS to get a reasonable initial height
setMinimumSize(QSize(460, (int) (QApplication::primaryScreen->availableSize().height() * 0.9f)));
} else {
setMinimumSize(QSize(460, 0));
}
mac_hack(this);
mac_hack_vLayouts(this);
mac_hack_statusBars(this, "statusBar");
#endif
restoreGeometry(saved_geometry.toByteArray());
m_fgcolor_geometry = settings.value(QSL("studio/fgcolor_geometry")).toByteArray();
m_bgcolor_geometry = settings.value(QSL("studio/bgcolor_geometry")).toByteArray();
@ -605,7 +668,7 @@ void MainWindow::factory_reset()
QMessageBox msgBox(QMessageBox::Question, tr("Factory Reset"),
tr("This will clear all saved data and reset all settings for all symbologies to defaults."),
QMessageBox::Yes | QMessageBox::No, this);
msgBox.setInformativeText(tr("Do you want to continue?"));
msgBox.setInformativeText(tr("Do you wish to continue?"));
msgBox.setDefaultButton(QMessageBox::Yes);
if (msgBox.exec() == QMessageBox::No) {
return;
@ -637,29 +700,41 @@ void MainWindow::about()
QMessageBox::about(this, tr("About Zint"),
/*: %1 is Zint version, %2 is Qt version */
tr("<h2>Zint Barcode Studio %1</h2>"
"<p>A free barcode generator</p>"
"<p>Instruction manual is available at the project homepage:<br>"
"<a href=\"http://www.zint.org.uk\">http://www.zint.org.uk</a>.</p>"
"<p>Copyright &copy; 2006-2022 Robin Stuart and others.<br>"
"Qt backend by BogDan Vatra.<br>"
"Released under GNU GPL 3.0 or later.</p>"
"<p>Qt version %2</p>"
"<p>\"QR Code\" is a Registered Trademark of Denso Corp.<br>"
"\"Telepen\" is a Registered Trademark of SB Electronics.<br>"
"\"Mailmark\" is a Registered Trademark of Royal Mail.</p>"
"<p>With thanks to Harald Oehlmann, Norbert Szab&oacute;, Robert Elliott, Milton Neal, "
"Git Lost, Alonso Schaich, Andre Maute and many others at Sourceforge.</p>"
"<p><table border=1><tr><td><small>Currently supported standards include:<br>"
"ISO/IEC 24778:2008, ANSI/AIM BC12-1998, EN 798:1996,<br>"
"AIM ISS-X-24 (1995), ISO/IEC 15417:2007, EN 12323:2005,<br>"
"ISO/IEC 16388:2007, ANSI/AIM BC6-2000, ANSI/AIM BC5-1995,<br>"
"AIM USS Code One (1994), ISO/IEC 16022:2006, ISO/IEC 21471:2019,<br>"
"ISO/IEC 15420:2009, AIMD014 (v 1.63) (2008), ISO/IEC 24723:2010,<br>"
"ISO/IEC 24724:2011, ISO/IEC 20830:2021, ISO/IEC 16390:2007,<br>"
"ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC 15438:2015,<br>"
"ISO/IEC 18004:2015, ISO/IEC 23941:2022, AIM ITS/04-023 (2022)"
"</small></td></tr></table></p>").arg(zint_version).arg(QT_VERSION_STR));
tr(
#ifdef Q_OS_MACOS
"<style>h2, p { font-size:11px; font-weight:normal; } td { font-size:8px; font-weight:normal; }</style>"
#endif
"<h2>Zint Barcode Studio %1</h2>"
"<p>A free barcode generator</p>"
"<p>Instruction manual is available at the project homepage:<br>"
"<a href=\"http://www.zint.org.uk\">http://www.zint.org.uk</a>.</p>"
"<p>Copyright &copy; 2006-2022 Robin Stuart and others.<br>"
"Qt backend by BogDan Vatra.<br>"
"Released under GNU GPL 3.0 or later.</p>"
"<p>Qt version %2</p>"
"<p>\"QR Code\" is a Registered Trademark of Denso Corp.<br>"
"\"Telepen\" is a Registered Trademark of SB Electronics.<br>"
"\"Mailmark\" is a Registered Trademark of Royal Mail.</p>"
"<p>With thanks to Harald Oehlmann, Norbert Szab&oacute;, Robert Elliott, Milton Neal, "
"Git Lost, Alonso Schaich, Andre Maute and many others at Sourceforge.</p>"
"<p><table border=1><tr><td>"
#ifndef Q_OS_MACOS
"<small>"
#endif
"Currently supported standards include:<br>"
"ISO/IEC 24778:2008, ANSI/AIM BC12-1998, EN 798:1996,<br>"
"AIM ISS-X-24 (1995), ISO/IEC 15417:2007, EN 12323:2005,<br>"
"ISO/IEC 16388:2007, ANSI/AIM BC6-2000, ANSI/AIM BC5-1995,<br>"
"AIM USS Code One (1994), ISO/IEC 16022:2006, ISO/IEC 21471:2019,<br>"
"ISO/IEC 15420:2009, AIMD014 (v 1.63) (2008), ISO/IEC 24723:2010,<br>"
"ISO/IEC 24724:2011, ISO/IEC 20830:2021, ISO/IEC 16390:2007,<br>"
"ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC 15438:2015,<br>"
"ISO/IEC 18004:2015, ISO/IEC 23941:2022, AIM ITS/04-023 (2022)"
#ifndef Q_OS_MACOS
"</small>"
#endif
"</td></tr></table></p>"
).arg(zint_version).arg(QT_VERSION_STR));
}
void MainWindow::help()
@ -741,6 +816,11 @@ void MainWindow::open_data_dialog_seg(const int seg_no)
QString originalText = seg_textbox->text();
bool originalChkEscape = chkEscape->isChecked();
DataWindow dlg(originalText, originalChkEscape, seg_no);
#ifdef Q_OS_MACOS
mac_hack_statusBars(&dlg);
#endif
connect(&dlg, SIGNAL(dataChanged(const QString&, bool, int)), this,
SLOT(on_dataChanged(const QString&, bool, int)));
(void) dlg.exec();
@ -840,6 +920,10 @@ void MainWindow::open_cli_dialog()
CLIWindow dlg(&m_bc, chkAutoHeight->isEnabled() && chkAutoHeight->isChecked(),
m_spnHeightPerRow && m_spnHeightPerRow->isEnabled() ? m_spnHeightPerRow->value() : 0.0);
#ifdef Q_OS_MACOS
mac_hack_statusBars(&dlg);
#endif
(void) dlg.exec();
}
@ -1909,9 +1993,14 @@ void MainWindow::change_options()
connect(get_widget(QSL("chkVINImportChar")), SIGNAL(toggled( bool )), SLOT(update_preview()));
} else {
m_optionWidget = nullptr;
load_sub_settings(settings, symbology);
}
#ifdef Q_OS_MACOS
mac_hack(m_optionWidget);
#endif
switch (symbology) {
case BARCODE_CODE128:
case BARCODE_EANX:

View file

@ -15,8 +15,8 @@
***************************************************************************/
/* SPDX-License-Identifier: GPL-3.0-or-later */
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#ifndef Z_MAINWINDOW_H
#define Z_MAINWINDOW_H
#include <QtGui>
#include <QGraphicsItem>
@ -42,6 +42,12 @@ public:
static QString get_zint_version(void);
#ifdef Q_OS_MACOS
static void mac_hack(QWidget *win);
static void mac_hack_vLayouts(QWidget *win);
static void mac_hack_statusBars(QWidget *win, const char *name = nullptr);
#endif
public slots:
void update_preview();
void change_options();
@ -125,9 +131,9 @@ protected:
QString getColorStr(const QColor color, bool alpha_always = false);
void setColorTxtBtn(const QColor color, QLineEdit *txt, QPushButton* btn);
void resizeEvent(QResizeEvent *event);
bool event(QEvent *event) override;
bool eventFilter(QObject *watched, QEvent *event);
virtual void resizeEvent(QResizeEvent *event) override;
virtual bool event(QEvent *event) override;
virtual bool eventFilter(QObject *watched, QEvent *event) override;
void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled);
void upcean_addon_gap(const QString &comboBoxName, const QString &labelName, int base);

View file

@ -52,7 +52,7 @@ SequenceWindow::SequenceWindow(BarcodeItem *bc) : m_bc(bc)
QIcon clearIcon(QSL(":res/delete.svg"));
btnSeqClose->setIcon(closeIcon);
btnSeqClear->setIcon(clearIcon);
btnSeqClear->setEnabled(!txtSeqPreview->toPlainText().isEmpty());
check_generate();
connect(btnSeqClose, SIGNAL( clicked( bool )), SLOT(close()));
connect(btnSeqClear, SIGNAL( clicked( bool )), SLOT(clear_preview()));

BIN
frontend_qt/zint-qt.icns Normal file

Binary file not shown.

View file

@ -392,6 +392,8 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring)
}
else
nonoption_flags_len = 0;
#else
(void)argc; (void)argv;
#endif
return optstring;