- API/CLI/Tcl/GUI: new output option BARCODE_BIND_TOP/--bindtop/

`-bindtop`/"Bind Top"
- DPD: add top boundary (width 3X) by default, using new
  BARCODE_BIND_TOP; "relabel" option; some compliance checks
- GUI: only skip encoded/errored signal processing if active modal
  ExportDialog (wasn't clearing/setting error text bar correctly
  for DataDialog)
- CODE128: debug print checksum
- CODE49/DATAMATRIX/QR/ULTRA: fix uniqueness of errtxt nos
- manual: fuller DPD doc; some spelling typos, formatting
This commit is contained in:
gitlost 2022-11-10 22:13:41 +00:00
parent e515f63fab
commit 2f8681b21a
44 changed files with 3643 additions and 2465 deletions

View File

@ -9,6 +9,10 @@ Version 2.11.1.9 (dev) not released yet
argument
NOTE: previously printed error messages but continued without returning an
error
- DPD now adds top boundary bar by default and returns warnings if input is not
compliant
- Legacy and never-used output option BARCODE_NO_ASCII removed (value now used
by new output option BARCODE_BIND_TOP)
Changes
-------
@ -22,7 +26,11 @@ Changes
- manual/man page/GUI: Code 16k -> Code 16K
- PDF417/MICROPDF417: add optimized encoding, FAST_MODE for previous; formatting
changes
- common.c/h: add `cnt_digits()`, comments in include, minor fiddling
- common.c/h: add `cnt_digits()`; comments in include; minor fiddling
- API/CLI/Tcl/GUI: new output option BARCODE_BIND_TOP / `--bindtop` / "Bind Top"
- DPD: add top boundary (width 3X) by default, using new BARCODE_BIND_TOP;
"relabel" option; some compliance checks
- manual: fuller DPD doc; some spelling typos, formatting
Bugs
----
@ -50,6 +58,8 @@ Bugs
- bwipp_dump.ps: fix 2/4-track processing; update to latest BWIPP
- PDF417/MICROPDF417: use latch not ps shift for padding when spanning
Text segments to avoid affecting 1st char of 2nd segment
- GUI: only skip encoded/errored signal processing if active modal ExportDialog
(wasn't clearing/setting error text bar correctly)
Version 2.11.1 (2022-08-22)

View File

@ -257,16 +257,16 @@ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int lengt
error_number = c25_inter_common(symbol, localstr, 14, 1 /*dont_set_height*/);
ustrcpy(symbol->text, localstr);
if (!((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND))) {
/* If no option has been selected then uses default box option */
symbol->output_options |= BARCODE_BOX;
if (symbol->border_width == 0) { /* Allow override if non-zero */
/* GS1 General Specifications 21.0.1 Sections 5.3.2.4 & 5.3.6 (4.83 / 1.016 ~ 4.75) */
symbol->border_width = 5; /* Note change from previous value 8 */
}
}
if (error_number < ZINT_ERROR) {
if (!(symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP))) {
/* If no option has been selected then uses default box option */
symbol->output_options |= BARCODE_BOX;
if (symbol->border_width == 0) { /* Allow override if non-zero */
/* GS1 General Specifications 21.0.1 Sections 5.3.2.4 & 5.3.6 (4.83 / 1.016 ~ 4.75) */
symbol->border_width = 5; /* Note change from previous value 8 */
}
}
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* GS1 General Specifications 21.0.1 5.12.3.2 table 2, including footnote (**): (note bind/box additional
to symbol->height), same as GS1-128: "in case of further space constraints"

View File

@ -708,6 +708,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len
}
printf(" (%d)\n", bar_characters);
printf("Barspaces: %.*s\n", (int) (d - dest), dest);
printf("Checksum: %d\n", total_sum);
}
#ifdef ZINT_TEST
if (symbol->debug & ZINT_DEBUG_TEST) {
@ -1051,57 +1052,89 @@ INTERNAL int ean14(struct zint_symbol *symbol, unsigned char source[], int lengt
}
/* DPD (Deutscher Paketdienst) Code */
/* Specification at ftp://dpd.at/Datenspezifikationen/EN/gbs_V4.0.2_hauptdokument.pdf
* or https://docplayer.net/33728877-Dpd-parcel-label-specification.html */
/* Specification at https://esolutions.dpd.com/dokumente/DPD_Parcel_Label_Specification_2.4.1_EN.pdf
* and identification tag info (Barcode ID) at https://esolutions.dpd.com/dokumente/DPD_Routing_Database_1.3_EN.pdf */
INTERNAL int dpd(struct zint_symbol *symbol, unsigned char source[], int length) {
int error_number = 0;
int i, p;
unsigned char identifier;
unsigned char ident_tag;
unsigned char local_source_buf[29];
unsigned char *local_source;
const int mod = 36;
const int relabel = symbol->option_2 == 1; /* A "relabel" has no identification tag */
int cd; /* Check digit */
if (length != 28) {
strcpy(symbol->errtxt, "349: DPD input wrong length (28 characters required)");
if ((length != 27 && length != 28) || (length == 28 && relabel)) {
if (relabel) {
strcpy(symbol->errtxt, "830: DPD relabel input wrong length (27 characters required)");
} else {
strcpy(symbol->errtxt, "349: DPD input wrong length (27 or 28 characters required)");
}
return ZINT_ERROR_TOO_LONG;
}
identifier = source[0];
if (length == 27 && !relabel) {
local_source_buf[0] = '%';
ustrcpy(local_source_buf + 1, source);
local_source = local_source_buf;
length++;
} else {
local_source = source;
}
to_upper(source + 1, length - 1);
if (!is_sane(KRSET_F, source + 1, length - 1)) {
strcpy(symbol->errtxt, "300: Invalid character in DPD data (alphanumerics only)");
ident_tag = local_source[0];
to_upper(local_source + !relabel, length - !relabel);
if (!is_sane(KRSET_F, local_source + !relabel, length - !relabel)) {
if (local_source == local_source_buf || relabel) {
strcpy(symbol->errtxt, "300: Invalid character in data (alphanumerics only)");
} else {
strcpy(symbol->errtxt, "299: Invalid character in data (alphanumerics only after first character)");
}
return ZINT_ERROR_INVALID_DATA;
}
if ((identifier < 32) || (identifier > 127)) {
strcpy(symbol->errtxt, "343: Invalid DPD identifier (first character), ASCII values 32 to 127 only");
if ((ident_tag < 32) || (ident_tag > 127)) {
strcpy(symbol->errtxt, "343: Invalid DPD identification tag (first character), ASCII values 32 to 127 only");
return ZINT_ERROR_INVALID_DATA;
}
error_number = code128(symbol, source, length); /* Only returns errors, not warnings */
error_number = code128(symbol, local_source, length); /* Only returns errors, not warnings */
if (error_number < ZINT_ERROR) {
if (!(symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP))) {
/* If no option has been selected then uses default bind top option */
symbol->output_options |= BARCODE_BIND_TOP; /* Note won't extend over quiet zones for DPD */
if (symbol->border_width == 0) { /* Allow override if non-zero */
symbol->border_width = 3; /* From examples, not mentioned in spec */
}
}
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* Specification DPD and primetime Parcel Despatch 4.0.2 Section 5.5.1
/* DPD Parcel Label Specification Version 2.4.1 (19.01.2021) Section 4.6.1.2
25mm / 0.4mm (X max) = 62.5 min, 25mm / 0.375 (X) ~ 66.66 default */
error_number = set_height(symbol, 62.5f, stripf(25.0f / 0.375f), 0.0f, 0 /*no_errtxt*/);
if (relabel) { /* If relabel then half-size */
error_number = set_height(symbol, 31.25f, stripf(12.5f / 0.375f), 0.0f, 0 /*no_errtxt*/);
} else {
error_number = set_height(symbol, 62.5f, stripf(25.0f / 0.375f), 0.0f, 0 /*no_errtxt*/);
}
} else {
(void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/);
(void) set_height(symbol, 0.0f, relabel ? 25.0f : 50.0f, 0.0f, 1 /*no_errtxt*/);
}
cd = mod;
p = 0;
for (i = 1; i < length; i++) {
symbol->text[p] = source[i];
for (i = !relabel; i < length; i++) {
symbol->text[p] = local_source[i];
p++;
cd += posn(KRSET, source[i]);
cd += posn(KRSET, local_source[i]);
if (cd > mod) cd -= mod;
cd *= 2;
if (cd >= (mod + 1)) cd -= mod + 1;
switch (i) {
switch (i + relabel) {
case 4:
case 7:
case 11:
@ -1127,6 +1160,20 @@ INTERNAL int dpd(struct zint_symbol *symbol, unsigned char source[], int length)
p++;
symbol->text[p] = '\0';
if (error_number == 0) {
/* Some compliance checks */
if (!is_sane(NEON_F, local_source + length - 16, 16)) {
if (!is_sane(NEON_F, local_source + length - 3, 3)) { /* 3-digit Country Code (ISO 3166-1) */
strcpy(symbol->errtxt, "831: Destination Country Code (last 3 characters) should be numeric");
} else if (!is_sane(NEON_F, local_source + length - 6, 3)) { /* 3-digit Service Code */
strcpy(symbol->errtxt, "832: Service Code (characters 6-4 from end) should be numeric");
} else { /* Last 10 characters of Tracking No. */
strcpy(symbol->errtxt, "833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric");
}
error_number = ZINT_WARN_NONCOMPLIANT;
}
}
}
return error_number;

View File

@ -255,7 +255,7 @@ INTERNAL int code49(struct zint_symbol *symbol, unsigned char source[], int leng
}
}
} else if (symbol->option_1 >= 1) {
strcpy(symbol->errtxt, "424: Minimum number of rows out of range (2 to 8)");
strcpy(symbol->errtxt, "433: Minimum number of rows out of range (2 to 8)");
return ZINT_ERROR_INVALID_OPTION;
}

View File

@ -1668,7 +1668,7 @@ static int dm_encode_segs(struct zint_symbol *symbol, struct zint_seg segs[], co
const int debug_print = symbol->debug & ZINT_DEBUG_PRINT;
if (segs_length(segs, seg_count) > 3116) { /* Max is 3166 digits */
strcpy(symbol->errtxt, "760: Data too long to fit in symbol");
strcpy(symbol->errtxt, "719: Data too long to fit in symbol");
return ZINT_ERROR_TOO_LONG;
}

View File

@ -354,7 +354,7 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
done = 1;
break;
case BARCODE_DPD:
/* Specification DPD and primetime Parcel Despatch 4.0.2 Section 5.5.1 5mm / 0.4mm (X max) = 12.5 */
/* DPD Parcel Label Specification Version 2.4.1 Section 4.6.1.2, 5mm / 0.4mm (X max) = 12.5 */
*left = *right = 12.5f;
done = 1;
break;
@ -507,7 +507,7 @@ INTERNAL void out_set_whitespace_offsets(const struct zint_symbol *symbol, const
*yoffset = symbol->whitespace_height + qz_top;
*boffset = symbol->whitespace_height + qz_bottom;
if (symbol->output_options & (BARCODE_BOX | BARCODE_BIND)) {
if (symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP)) {
*yoffset += symbol->border_width;
*boffset += symbol->border_width;
}

View File

@ -157,7 +157,7 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
}
/* For Ultracode, have foreground only if have bind/box */
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BIND | BARCODE_BOX))) {
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BIND | BARCODE_BOX | BARCODE_BIND_TOP))) {
/* Check whether can re-use black */
if (fg.red == 0 && fg.green == 0 && fg.blue == 0) {
map['1'] = 7; /* Re-use black */

View File

@ -1565,7 +1565,7 @@ static int qr_prep_data(struct zint_symbol *symbol, struct zint_seg segs[], cons
return error_number;
}
if (segs[i].eci != 20) {
strcpy(symbol->errtxt, "543: Converted to Shift JIS but no ECI specified");
strcpy(symbol->errtxt, "760: Converted to Shift JIS but no ECI specified");
warn_number = ZINT_WARN_NONCOMPLIANT;
}
}
@ -2598,11 +2598,11 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len
/* Get version from user */
if ((symbol->option_2 >= 1) && (symbol->option_2 <= 4)) {
if (symbol->option_2 == 1 && !is_sane(NEON_F, source, length)) {
strcpy(symbol->errtxt, "775: Invalid character in data for Version M1 (digits only)");
strcpy(symbol->errtxt, "758: Invalid character in data for Version M1 (digits only)");
return ZINT_ERROR_INVALID_DATA;
} else if (symbol->option_2 == 2 && !is_sane(QR_ALPHA, source, length)) {
strcpy(symbol->errtxt,
"776: Invalid character in data for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)");
"759: Invalid character in data for Version M2 (digits, A-Z, space and \"$%*+-./:\" only)");
return ZINT_ERROR_INVALID_DATA;
}
if (symbol->option_2 - 1 >= autoversion) {

View File

@ -665,8 +665,9 @@ static void plot_hexagon(unsigned char *scaled_hexagon, const int hex_width, con
static void draw_bind_box(const struct zint_symbol *symbol, unsigned char *pixelbuf,
const int xoffset_si, const int yoffset_si, const int symbol_height_si, const int dot_overspill_si,
const int image_width, const int image_height, const int si) {
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) {
const int is_codablockf = symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF;
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP))) {
const int no_extend = symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF
|| symbol->symbology == BARCODE_DPD;
const int horz_outside = is_fixed_ratio(symbol->symbology);
const int bwidth_si = symbol->border_width * si;
int ybind_top = yoffset_si - bwidth_si;
@ -676,15 +677,19 @@ static void draw_bind_box(const struct zint_symbol *symbol, unsigned char *pixel
ybind_bot = image_height - bwidth_si;
}
/* Horizontal boundary bars */
if ((symbol->output_options & BARCODE_BOX) || !is_codablockf) {
/* Box or not CodaBlockF */
if ((symbol->output_options & BARCODE_BOX) || !no_extend) {
/* Box or not CodaBlockF/DPD */
draw_bar(pixelbuf, 0, image_width, ybind_top, bwidth_si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 0, image_width, ybind_bot, bwidth_si, image_width, image_height, DEFAULT_INK);
if (!(symbol->output_options & BARCODE_BIND_TOP)) { /* Trumps BARCODE_BOX & BARCODE_BIND */
draw_bar(pixelbuf, 0, image_width, ybind_bot, bwidth_si, image_width, image_height, DEFAULT_INK);
}
} else {
/* CodaBlockF bind - does not extend over horizontal whitespace */
/* CodaBlockF/DPD bind - does not extend over horizontal whitespace */
const int width_si = symbol->width * si;
draw_bar(pixelbuf, xoffset_si, width_si, ybind_top, bwidth_si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, xoffset_si, width_si, ybind_bot, bwidth_si, image_width, image_height, DEFAULT_INK);
if (!(symbol->output_options & BARCODE_BIND_TOP)) { /* Trumps BARCODE_BOX & BARCODE_BIND */
draw_bar(pixelbuf, xoffset_si, width_si, ybind_bot, bwidth_si, image_width, image_height, DEFAULT_INK);
}
}
if (symbol->output_options & BARCODE_BOX) {
/* Vertical side bars */
@ -1147,7 +1152,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
if (!hide_text) {
int text_yposn = yoffset_si + symbol_height_si + (int) (text_gap * si); /* Calculated to top of text */
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) {
text_yposn += symbol->border_width * si;
text_yposn += symbol->border_width * si; /* Note not needed for BARCODE_BIND_TOP */
}
if (upceanflag >= 6) { /* UPC-E, EAN-8, UPC-A, EAN-13 */

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

View File

@ -0,0 +1,75 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="472" height="165" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="472" height="165" fill="#FFFFFF" />
<rect x="25.00" y="6.00" width="4.00" height="133.33" />
<rect x="31.00" y="6.00" width="2.00" height="133.33" />
<rect x="37.00" y="6.00" width="2.00" height="133.33" />
<rect x="47.00" y="6.00" width="2.00" height="133.33" />
<rect x="55.00" y="6.00" width="2.00" height="133.33" />
<rect x="61.00" y="6.00" width="4.00" height="133.33" />
<rect x="69.00" y="6.00" width="2.00" height="133.33" />
<rect x="75.00" y="6.00" width="6.00" height="133.33" />
<rect x="83.00" y="6.00" width="4.00" height="133.33" />
<rect x="91.00" y="6.00" width="2.00" height="133.33" />
<rect x="95.00" y="6.00" width="6.00" height="133.33" />
<rect x="103.00" y="6.00" width="8.00" height="133.33" />
<rect x="113.00" y="6.00" width="2.00" height="133.33" />
<rect x="121.00" y="6.00" width="4.00" height="133.33" />
<rect x="129.00" y="6.00" width="2.00" height="133.33" />
<rect x="135.00" y="6.00" width="4.00" height="133.33" />
<rect x="143.00" y="6.00" width="6.00" height="133.33" />
<rect x="153.00" y="6.00" width="2.00" height="133.33" />
<rect x="157.00" y="6.00" width="6.00" height="133.33" />
<rect x="165.00" y="6.00" width="4.00" height="133.33" />
<rect x="173.00" y="6.00" width="2.00" height="133.33" />
<rect x="179.00" y="6.00" width="4.00" height="133.33" />
<rect x="187.00" y="6.00" width="2.00" height="133.33" />
<rect x="193.00" y="6.00" width="2.00" height="133.33" />
<rect x="201.00" y="6.00" width="8.00" height="133.33" />
<rect x="211.00" y="6.00" width="2.00" height="133.33" />
<rect x="219.00" y="6.00" width="2.00" height="133.33" />
<rect x="223.00" y="6.00" width="4.00" height="133.33" />
<rect x="229.00" y="6.00" width="4.00" height="133.33" />
<rect x="237.00" y="6.00" width="4.00" height="133.33" />
<rect x="245.00" y="6.00" width="4.00" height="133.33" />
<rect x="251.00" y="6.00" width="4.00" height="133.33" />
<rect x="259.00" y="6.00" width="4.00" height="133.33" />
<rect x="267.00" y="6.00" width="4.00" height="133.33" />
<rect x="275.00" y="6.00" width="4.00" height="133.33" />
<rect x="283.00" y="6.00" width="4.00" height="133.33" />
<rect x="289.00" y="6.00" width="4.00" height="133.33" />
<rect x="295.00" y="6.00" width="4.00" height="133.33" />
<rect x="303.00" y="6.00" width="4.00" height="133.33" />
<rect x="311.00" y="6.00" width="6.00" height="133.33" />
<rect x="321.00" y="6.00" width="4.00" height="133.33" />
<rect x="327.00" y="6.00" width="2.00" height="133.33" />
<rect x="333.00" y="6.00" width="4.00" height="133.33" />
<rect x="341.00" y="6.00" width="2.00" height="133.33" />
<rect x="349.00" y="6.00" width="2.00" height="133.33" />
<rect x="355.00" y="6.00" width="2.00" height="133.33" />
<rect x="359.00" y="6.00" width="4.00" height="133.33" />
<rect x="367.00" y="6.00" width="6.00" height="133.33" />
<rect x="377.00" y="6.00" width="4.00" height="133.33" />
<rect x="385.00" y="6.00" width="2.00" height="133.33" />
<rect x="389.00" y="6.00" width="2.00" height="133.33" />
<rect x="399.00" y="6.00" width="2.00" height="133.33" />
<rect x="403.00" y="6.00" width="2.00" height="133.33" />
<rect x="407.00" y="6.00" width="8.00" height="133.33" />
<rect x="421.00" y="6.00" width="4.00" height="133.33" />
<rect x="431.00" y="6.00" width="6.00" height="133.33" />
<rect x="439.00" y="6.00" width="2.00" height="133.33" />
<rect x="443.00" y="6.00" width="4.00" height="133.33" />
<rect x="25.00" y="0.00" width="422.00" height="6.00" />
<text x="236.00" y="154.73" text-anchor="middle"
font-family="Helvetica, sans-serif" font-size="14.0" >
0081 827 0998 0000 0200 28 101 276 B
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -185,6 +185,7 @@ static void test_hrt(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
int option_2;
char *data;
int length;
@ -195,17 +196,46 @@ static void test_hrt(const testCtx *const p_ctx) {
*/
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, "1234567890", -1, "1234567890" },
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, "\000ABC\000DEF\000", 9, " ABC DEF " },
/* 2*/ { BARCODE_CODE128B, UNICODE_MODE, "12345\00067890", 11, "12345 67890" },
/* 3*/ { BARCODE_CODE128, UNICODE_MODE, "12345\01167890\037\177", -1, "12345 67890 " },
/* 4*/ { BARCODE_CODE128, UNICODE_MODE, "abcdé", -1, "abcdé" },
/* 5*/ { BARCODE_CODE128, DATA_MODE, "abcd\351", -1, "abcdé" },
/* 6*/ { BARCODE_CODE128, DATA_MODE, "ab\240cd\351", -1, "ab\302\240cdé" }, /* NBSP */
/* 7*/ { BARCODE_CODE128B, UNICODE_MODE, "abcdé", -1, "abcdé" },
/* 8*/ { BARCODE_CODE128B, DATA_MODE, "abcd\351", -1, "abcdé" },
/* 9*/ { BARCODE_HIBC_128, UNICODE_MODE, "1234567890", -1, "*+12345678900*" },
/* 10*/ { BARCODE_HIBC_128, UNICODE_MODE, "a99912345", -1, "*+A999123457*" }, /* Converts to upper */
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, "1234567890", -1, "1234567890" },
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, "\000ABC\000DEF\000", 9, " ABC DEF " },
/* 2*/ { BARCODE_CODE128B, UNICODE_MODE, -1, "12345\00067890", 11, "12345 67890" },
/* 3*/ { BARCODE_CODE128, UNICODE_MODE, -1, "12345\01167890\037\177", -1, "12345 67890 " },
/* 4*/ { BARCODE_CODE128, UNICODE_MODE, -1, "abcdé", -1, "abcdé" },
/* 5*/ { BARCODE_CODE128, DATA_MODE, -1, "abcd\351", -1, "abcdé" },
/* 6*/ { BARCODE_CODE128, DATA_MODE, -1, "ab\240cd\351", -1, "ab\302\240cdé" }, /* NBSP */
/* 7*/ { BARCODE_CODE128B, UNICODE_MODE, -1, "abcdé", -1, "abcdé" },
/* 8*/ { BARCODE_CODE128B, DATA_MODE, -1, "abcd\351", -1, "abcdé" },
/* 9*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "1234567890", -1, "*+12345678900*" },
/* 10*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "a99912345", -1, "*+A999123457*" }, /* Converts to upper */
/* 11*/ { BARCODE_DPD, UNICODE_MODE, -1, "000393206219912345678101040", -1, "0003 932 0621 9912 3456 78 101 040 9" }, /* DPDAPPD 4.0.2 - Illustration 7 */
/* 12*/ { BARCODE_DPD, UNICODE_MODE, -1, "007110601782532948375101276", -1, "0071 106 0178 2532 9483 75 101 276 X" }, /* DPDAPPD 4.0.2 - Illustration 6, figure's HRT seems incorrect */
/* 13*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020028101276", -1, "0081 827 0998 0000 0200 28 101 276 B" }, /* DPDPLS Section 4 */
/* 14*/ { BARCODE_DPD, UNICODE_MODE, -1, "007110601632532948375179276", -1, "0071 106 0163 2532 9483 75 179 276 A" }, /* DPDPLS Section 4.6 */
/* 15*/ { BARCODE_DPD, UNICODE_MODE, -1, "001990009980000020084109203", -1, "0019 900 0998 0000 0200 84 109 203 1" }, /* DPDPLS Section 5.1 */
/* 16*/ { BARCODE_DPD, UNICODE_MODE, 1, "007110601632532948375101276", -1, "0071 106 0163 2532 9483 75 101 276 O" }, /* DPDPLS Section 6.1.2 relabel, figure is actually 8.7.2 with mislabelled HRT */
/* 17*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020029136276", -1, "0081 827 0998 0000 0200 29 136 276 3" }, /* DPDPLS Section 8.1 */
/* 18*/ { BARCODE_DPD, UNICODE_MODE, -1, "001234509980000020031105276", -1, "0012 345 0998 0000 0200 31 105 276 L" }, /* DPDPLS Section 8.2 */
/* 19*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020032154276", -1, "0081 827 0998 0000 0200 32 154 276 J" }, /* DPDPLS Section 8.3 */
/* 20*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020030109276", -1, "0081 827 0998 0000 0200 30 109 276 W" }, /* DPDPLS Section 8.4 */
/* 21*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020033350276", -1, "0081 827 0998 0000 0200 33 350 276 C" }, /* DPDPLS Section 8.5.1 */
/* 22*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020034179276", -1, "0081 827 0998 0000 0200 34 179 276 I" }, /* DPDPLS Section 8.5.2 */
/* 23*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020035225276", -1, "0081 827 0998 0000 0200 35 225 276 H" }, /* DPDPLS Section 8.5.3 */
/* 24*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020036155276", -1, "0081 827 0998 0000 0200 36 155 276 5" }, /* DPDPLS Section 8.5.4 */
/* 25*/ { BARCODE_DPD, UNICODE_MODE, -1, "000280009980000020037155056", -1, "0002 800 0998 0000 0200 37 155 056 6" }, /* DPDPLS Section 8.5.5 */
/* 26*/ { BARCODE_DPD, UNICODE_MODE, -1, "007855009980000020041302840", -1, "0078 550 0998 0000 0200 41 302 840 U" }, /* DPDPLS Section 8.5.6 */
/* 27*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020042102276", -1, "0081 827 0998 0000 0200 42 102 276 R" }, /* DPDPLS Section 8.6.1 */
/* 28*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020043113276", -1, "0081 827 0998 0000 0200 43 113 276 Y" }, /* DPDPLS Section 8.7.1 */
/* 29*/ { BARCODE_DPD, UNICODE_MODE, 1, "006376209980000020044118276", -1, "0063 762 0998 0000 0200 44 118 276 I" }, /* DPDPLS Section 8.7.2 relabel */
/* 30*/ { BARCODE_DPD, UNICODE_MODE, -1, "007160009980000020050294276", -1, "0071 600 0998 0000 0200 50 294 276 C" }, /* DPDPLS Section 8.8 */
/* 31*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020045327276", -1, "0081 827 0998 0000 0200 45 327 276 N" }, /* DPDPLS Section 8.9.1 */
/* 32*/ { BARCODE_DPD, UNICODE_MODE, -1, "006374309980000020047337276", -1, "0063 743 0998 0000 0200 47 337 276 O" }, /* DPDPLS Section 8.9.2 */
/* 33*/ { BARCODE_DPD, UNICODE_MODE, 1, "006374109980978004757332276", -1, "0063 741 0998 0978 0047 57 332 276 M" }, /* DPDPLS Section 8.9.3 relabel, figure's HRT seems incorrect */
/* 34*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020051106276", -1, "0081 827 0998 0000 0200 51 106 276 M" }, /* DPDPLS Section 9.1 */
/* 35*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020052110276", -1, "0081 827 0998 0000 0200 52 110 276 W" }, /* DPDPLS Section 9.2 */
/* 36*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020053161276", -1, "0081 827 0998 0000 0200 53 161 276 O" }, /* DPDPLS Section 9.3 */
/* 37*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020054352276", -1, "0081 827 0998 0000 0200 54 352 276 B" }, /* DPDPLS Section 9.4 */
/* 38*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020055191276", -1, "0081 827 0998 0000 0200 55 191 276 A" }, /* DPDPLS Section 9.5 */
/* 39*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020056237276", -1, "0081 827 0998 0000 0200 56 237 276 K" }, /* DPDPLS Section 9.6 */
/* BARCODE_GS1_128, BARCODE_EAN14, BARCODE_NVE18 hrt tested in test_gs1.c */
};
int data_size = ARRAY_SIZE(data);
@ -221,7 +251,7 @@ static void test_hrt(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_zero(ret, "i:%d ZBarcode_Encode ret %d != 0 %s\n", i, ret, symbol->errtxt);
@ -635,6 +665,7 @@ static void test_dpd_input(const testCtx *const p_ctx) {
int debug = p_ctx->debug;
struct item {
int option_2;
char *data;
int ret;
int expected_width;
@ -642,12 +673,36 @@ static void test_dpd_input(const testCtx *const p_ctx) {
char *comment;
};
struct item data[] = {
/* 0*/ { "123456789012345678901234567", ZINT_ERROR_TOO_LONG, -1, "Error 349: DPD input wrong length (28 characters required)", "" },
/* 1*/ { "12345678901234567890123456789", ZINT_ERROR_TOO_LONG, -1, "Error 349: DPD input wrong length (28 characters required)", "" },
/* 2*/ { "123456789012345678901234567,", ZINT_ERROR_INVALID_DATA, -1, "Error 300: Invalid character in DPD data (alphanumerics only)", "Alphanumerics only in body" },
/* 3*/ { ",234567890123456789012345678", 0, 211, "(19) 104 12 18 99 34 56 78 90 12 34 56 78 90 12 34 56 78 64 106", "Non-alphanumeric DPD Identifier (Barcode ID) allowed" },
/* 4*/ { "\037234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 343: Invalid DPD identifier (first character), ASCII values 32 to 127 only", "Control char <US> as DPD Identifier" },
/* 5*/ { "é234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 343: Invalid DPD identifier (first character), ASCII values 32 to 127 only", "Extended ASCII as DPD Identifier" },
/* 0*/ { -1, "12345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, "Error 349: DPD input wrong length (27 or 28 characters required)", "" },
/* 1*/ { 1, "12345678901234567890123456", ZINT_ERROR_TOO_LONG, -1, "Error 830: DPD relabel input wrong length (27 characters required)", "" },
/* 2*/ { -1, "123456789012345678901234567", 0, 211, "(19) 104 5 17 99 23 45 67 89 1 23 45 67 89 1 23 45 67 51 106", "27 chars ok now, ident tag prefixed" },
/* 3*/ { -1, "%123456789012345678901234567", 0, 211, "(19) 104 5 17 99 23 45 67 89 1 23 45 67 89 1 23 45 67 51 106", "" },
/* 4*/ { 1, "123456789012345678901234567", 0, 200, "(18) 105 12 34 56 78 90 12 34 56 78 90 12 34 56 100 23 102 106", "27 chars also ok (and necessary) for relabel" },
/* 5*/ { -1, "12345678901234567890123456789", ZINT_ERROR_TOO_LONG, -1, "Error 349: DPD input wrong length (27 or 28 characters required)", "" },
/* 6*/ { 1, "1234567890123456789012345678", ZINT_ERROR_TOO_LONG, -1, "Error 830: DPD relabel input wrong length (27 characters required)", "" },
/* 7*/ { -1, "123456789012345678901234567,", ZINT_ERROR_INVALID_DATA, -1, "Error 299: Invalid character in data (alphanumerics only after first character)", "Alphanumerics only in body" },
/* 8*/ { -1, "12345678901234567890123456,", ZINT_ERROR_INVALID_DATA, -1, "Error 300: Invalid character in data (alphanumerics only)", "Alphanumerics only in body" },
/* 9*/ { -1, ",234567890123456789012345678", 0, 211, "(19) 104 12 18 99 34 56 78 90 12 34 56 78 90 12 34 56 78 64 106", "Non-alphanumeric DPD ident tag (Barcode ID) allowed" },
/* 10*/ { -1, "\037234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 343: Invalid DPD identification tag (first character), ASCII values 32 to 127 only", "Control char <US> as DPD ident tag" },
/* 11*/ { -1, "é234567890123456789012345678", ZINT_ERROR_INVALID_DATA, -1, "Error 343: Invalid DPD identification tag (first character), ASCII values 32 to 127 only", "Extended ASCII as DPD ident tag" },
/* 12*/ { -1, "12345678901234567890123456A", ZINT_WARN_NONCOMPLIANT, 222, "Warning 831: Destination Country Code (last 3 characters) should be numeric", "" },
/* 13*/ { -1, "%12345678901234567890123456A", ZINT_WARN_NONCOMPLIANT, 222, "Warning 831: Destination Country Code (last 3 characters) should be numeric", "" },
/* 14*/ { 1, "12345678901234567890123456A", ZINT_WARN_NONCOMPLIANT, 200, "Warning 831: Destination Country Code (last 3 characters) should be numeric", "" },
/* 15*/ { -1, "123456789012345678901234A67", ZINT_WARN_NONCOMPLIANT, 233, "Warning 831: Destination Country Code (last 3 characters) should be numeric", "" },
/* 16*/ { -1, "%123456789012345678901234A67", ZINT_WARN_NONCOMPLIANT, 233, "Warning 831: Destination Country Code (last 3 characters) should be numeric", "" },
/* 17*/ { 1, "123456789012345678901234A67", ZINT_WARN_NONCOMPLIANT, 211, "Warning 831: Destination Country Code (last 3 characters) should be numeric", "" },
/* 18*/ { -1, "12345678901234567890123A567", ZINT_WARN_NONCOMPLIANT, 244, "Warning 832: Service Code (characters 6-4 from end) should be numeric", "" },
/* 19*/ { -1, "%12345678901234567890123A567", ZINT_WARN_NONCOMPLIANT, 244, "Warning 832: Service Code (characters 6-4 from end) should be numeric", "" },
/* 20*/ { 1, "12345678901234567890123A567", ZINT_WARN_NONCOMPLIANT, 222, "Warning 832: Service Code (characters 6-4 from end) should be numeric", "" },
/* 21*/ { -1, "123456789012345678901A34567", ZINT_WARN_NONCOMPLIANT, 244, "Warning 832: Service Code (characters 6-4 from end) should be numeric", "" },
/* 22*/ { -1, "%123456789012345678901A34567", ZINT_WARN_NONCOMPLIANT, 244, "Warning 832: Service Code (characters 6-4 from end) should be numeric", "" },
/* 23*/ { 1, "123456789012345678901A34567", ZINT_WARN_NONCOMPLIANT, 222, "Warning 832: Service Code (characters 6-4 from end) should be numeric", "" },
/* 24*/ { -1, "12345678901234567890A234567", ZINT_WARN_NONCOMPLIANT, 233, "Warning 833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric", "" },
/* 25*/ { -1, "%12345678901234567890A234567", ZINT_WARN_NONCOMPLIANT, 233, "Warning 833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric", "" },
/* 26*/ { 1, "12345678901234567890A234567", ZINT_WARN_NONCOMPLIANT, 211, "Warning 833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric", "" },
/* 27*/ { -1, "12345678901A345678901234567", ZINT_WARN_NONCOMPLIANT, 244, "Warning 833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric", "" },
/* 28*/ { -1, "%12345678901A345678901234567", ZINT_WARN_NONCOMPLIANT, 244, "Warning 833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric", "" },
/* 29*/ { 1, "12345678901A345678901234567", ZINT_WARN_NONCOMPLIANT, 222, "Warning 833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric", "" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -666,14 +721,14 @@ static void test_dpd_input(const testCtx *const p_ctx) {
symbol->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */
length = testUtilSetSymbol(symbol, BARCODE_DPD, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
length = testUtilSetSymbol(symbol, BARCODE_DPD, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
printf(" /*%3d*/ { \"%s\", %s, %d, \"%s\", \"%s\" },\n",
i, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
printf(" /*%3d*/ { %d, \"%s\", %s, %d, \"%s\", \"%s\" },\n",
i, data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->width, symbol->errtxt, data[i].comment);
} else {
if (ret < ZINT_ERROR) {
@ -694,6 +749,7 @@ static void test_encode(const testCtx *const p_ctx) {
struct item {
int symbology;
int input_mode;
int option_2;
char *data;
int ret;
@ -704,143 +760,159 @@ static void test_encode(const testCtx *const p_ctx) {
char *expected;
};
/* BARCODE_GS1_128 examples verified manually against GS1 General Specifications 21.0.1 (GGS) */
/* BARCODE_DPD examples Specification DPD and primetime Parcel Despatch (DPDAPPD) Version 4.0.2 */
/* BARCODE_DPD examples Specification DPD and primetime Parcel Despatch (DPDAPPD) Version 4.0.2, also
DPD Parcel Label Specification (DPDPLS) Version 2.4.1 (19.01.2021) */
struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, "AIM", 0, 1, 68, 1, "ISO/IEC 15417:2007 Figure 1",
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, "AIM", 0, 1, 68, 1, "ISO/IEC 15417:2007 Figure 1",
"11010010000101000110001100010001010111011000101110110001100011101011"
},
/* 1*/ { BARCODE_CODE128B, UNICODE_MODE, "AIM", 0, 1, 68, 1, "128B same",
/* 1*/ { BARCODE_CODE128B, UNICODE_MODE, -1, "AIM", 0, 1, 68, 1, "128B same",
"11010010000101000110001100010001010111011000101110110001100011101011"
},
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, "1234567890", 0, 1, 90, 1, "",
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, -1, "1234567890", 0, 1, 90, 1, "",
"110100111001011001110010001011000111000101101100001010011011110110100111100101100011101011"
},
/* 3*/ { BARCODE_CODE128B, UNICODE_MODE, "1234567890", 0, 1, 145, 1, "",
/* 3*/ { BARCODE_CODE128B, UNICODE_MODE, -1, "1234567890", 0, 1, 145, 1, "",
"1101001000010011100110110011100101100101110011001001110110111001001100111010011101101110111010011001110010110010011101100101000110001100011101011"
},
/* 4*/ { BARCODE_CODE128, DATA_MODE, "\101\102\103\104\105\106\200\200\200\200\200", 0, 1, 178, 1, "",
/* 4*/ { BARCODE_CODE128, DATA_MODE, -1, "\101\102\103\104\105\106\200\200\200\200\200", 0, 1, 178, 1, "",
"1101000010010100011000100010110001000100011010110001000100011010001000110001011101011110111010111101010000110010100001100101000011001010000110010100001100110110110001100011101011"
},
/* 5*/ { BARCODE_GS1_128, GS1_MODE, "[8018]950110153123456781", 0, 1, 167, 1, "GGS Figure 2.5.2-1",
/* 5*/ { BARCODE_GS1_128, GS1_MODE, -1, "[8018]950110153123456781", 0, 1, 167, 1, "GGS Figure 2.5.2-1",
"11010011100111101011101010011110011001110010101111010001100110110011001000100101110011001101100011011101101110101110110001000010110010010111100101111001001100011101011"
},
/* 6*/ { BARCODE_GS1_128, GS1_MODE, "[415]5412345678908[3911]710125", 0, 1, 189, 1, "GGS Figure 2.6.6-1 top",
/* 6*/ { BARCODE_GS1_128, GS1_MODE, -1, "[415]5412345678908[3911]710125", 0, 1, 189, 1, "GGS Figure 2.6.6-1 top",
"110100111001111010111011000100010111010001101100010001011101101110101110110001000010110011011011110100011001001101000100011000100100100110100001100110110011100101100100001001101100011101011"
},
/* 7*/ { BARCODE_GS1_128, GS1_MODE, "[12]010425[8020]ABC123", 0, 1, 189, 1, "GGS Figure 2.6.6-1 bottom",
/* 7*/ { BARCODE_GS1_128, GS1_MODE, -1, "[12]010425[8020]ABC123", 0, 1, 189, 1, "GGS Figure 2.6.6-1 bottom",
"110100111001111010111010110011100110011011001001000110011100101100101001111001100100111010111101110101000110001000101100010001000110100111001101100111001011001011100110010111001100011101011"
},
/* 8*/ { BARCODE_GS1_128, GS1_MODE, "[253]950110153005812345678901", 0, 1, 211, 1, "GGS Figure 2.6.9-1",
/* 8*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]950110153005812345678901", 0, 1, 211, 1, "GGS Figure 2.6.9-1",
"1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001110110001010110011100100010110001110001011011000010100110111101101011110111010011100110101110110001100011101011"
},
/* 9*/ { BARCODE_GS1_128, GS1_MODE, "[253]950110153006567890543210987", 0, 1, 211, 1, "GGS Figure 2.6.9-2",
/* 9*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]950110153006567890543210987", 0, 1, 211, 1, "GGS Figure 2.6.9-2",
"1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001001011000010000101100110110111101000100110010110001110110111001001100100100011110010100101110011001100011101011"
},
/* 10*/ { BARCODE_GS1_128, GS1_MODE, "[253]95011015300657654321", 0, 1, 189, 1, "GGS Figure 2.6.9-3",
/* 10*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]95011015300657654321", 0, 1, 189, 1, "GGS Figure 2.6.9-3",
"110100111001111010111011100101100110100010001100010111011000100100110011011001101110111011011001100100101100001100101000011101011000110001101101011110111010011100110111001001101100011101011"
},
/* 11*/ { BARCODE_GS1_128, GS1_MODE, "[253]9501101530065123456", 0, 1, 167, 1, "GGS Figure 2.6.9-4",
/* 11*/ { BARCODE_GS1_128, GS1_MODE, -1, "[253]9501101530065123456", 0, 1, 167, 1, "GGS Figure 2.6.9-4",
"11010011100111101011101110010110011010001000110001011101100010010011001101100110111011101101100110010010110000101100111001000101100011100010110100011110101100011101011"
},
/* 12*/ { BARCODE_GS1_128, GS1_MODE, "[01]10857674002017[10]1152KMB", 0, 1, 211, 1, "GGS Figure 4.15.1-1",
/* 12*/ { BARCODE_GS1_128, GS1_MODE, -1, "[01]10857674002017[10]1152KMB", 0, 1, 211, 1, "GGS Figure 4.15.1-1",
"1101001110011110101110110011011001100100010010011110010110010100001000011001011011001100110010011101001110011011001000100110001001001101110001010111101110101100011101011101100010001011000100111001101100011101011"
},
/* 13*/ { BARCODE_GS1_128, GS1_MODE, "[01]09501101530003", 0, 1, 134, 1, "GGS Figure 5.1-3",
/* 13*/ { BARCODE_GS1_128, GS1_MODE, -1, "[01]09501101530003", 0, 1, 134, 1, "GGS Figure 5.1-3",
"11010011100111101011101100110110011001001000110001011101100010010011001101100110111011101101100110010010011000100110100001100011101011"
},
/* 14*/ { BARCODE_GS1_128, GS1_MODE, "[00]395123451234567895", 0, 1, 156, 1, "GGS Figure 5.4.2-1",
/* 14*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]395123451234567895", 0, 1, 156, 1, "GGS Figure 5.4.2-1",
"110100111001111010111011011001100110100010001101110100011101101110101110110001011001110010001011000111000101101100001010010111101000101111000101100011101011"
},
/* 15*/ { BARCODE_GS1_128, GS1_MODE, "[00]006141411234567890", 0, 1, 156, 1, "GGS Figure 6.6.5-1. (and Figures 6.6.5-3 bottom, 6.6.5-4 bottom)",
/* 15*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]006141411234567890", 0, 1, 156, 1, "GGS Figure 6.6.5-1. (and Figures 6.6.5-3 bottom, 6.6.5-4 bottom)",
"110100111001111010111011011001100110110011001100100001011000100010110001000101011001110010001011000111000101101100001010011011110110110110110001100011101011"
},
/* 16*/ { BARCODE_GS1_128, GS1_MODE, "[403]402621[401]950110153B01001", 0, 1, 266, 0, "GGS Figure 6.6.5-2 top **NOT SAME**, different encodation for zint, BWIPP & standard, same codeword count",
/* 16*/ { BARCODE_GS1_128, GS1_MODE, -1, "[403]402621[401]950110153B01001", 0, 1, 266, 0, "GGS Figure 6.6.5-2 top **NOT SAME**, different encodation for zint, BWIPP & standard, same codeword count",
"11010011100111101011101100010100010001011000110011001101111000101010111101110100111001101011101111011110101110110001010001100101110011000101110110001001001100110110011011101110101111011101000101100010011101100101110111101100100010011001101100101001111001100011101011"
},
/* 17*/ { BARCODE_GS1_128, GS1_MODE, "[00]395011015300000011", 0, 1, 156, 1, "GGS Figure 6.6.5-2 bottom",
/* 17*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]395011015300000011", 0, 1, 156, 1, "GGS Figure 6.6.5-2 bottom",
"110100111001111010111011011001100110100010001100010111011000100100110011011001101110111011011001100110110011001101100110011000100100100011101101100011101011"
},
/* 18*/ { BARCODE_GS1_128, GS1_MODE, "[420]45458", 0, 1, 90, 1, "GGS Figure 6.6.5-3 top",
/* 18*/ { BARCODE_GS1_128, GS1_MODE, -1, "[420]45458", 0, 1, 90, 1, "GGS Figure 6.6.5-3 top",
"110100111001111010111010110111000100100011001110101100011101100010111100100101100011101011"
},
/* 19*/ { BARCODE_GS1_128, GS1_MODE, "[02]00614141000418[15]210228[10]451214[37]20", 0, 1, 255, 1, "GGS Figure 6.6.5-4 top",
/* 19*/ { BARCODE_GS1_128, GS1_MODE, -1, "[02]00614141000418[15]210228[10]451214[37]20", 0, 1, 255, 1, "GGS Figure 6.6.5-4 top",
"110100111001111010111011001100110110110011001100100001011000100010110001000101101100110010010001100110011100101011100110011011100100110011001101110011010011001000100101110110001011001110010011001110111101011101000110100011001001110100011110101100011101011"
},
/* 20*/ { BARCODE_GS1_128, GS1_MODE, "[420]87109", 0, 1, 90, 1, "GGS Figure 6.6.5-5 top",
/* 20*/ { BARCODE_GS1_128, GS1_MODE, -1, "[420]87109", 0, 1, 90, 1, "GGS Figure 6.6.5-5 top",
"110100111001111010111010110111000100011001001001101000011001001000111001001101100011101011"
},
/* 21*/ { BARCODE_GS1_128, GS1_MODE, "[90]1528", 0, 1, 79, 1, "GGS Figure 6.6.5-5 middle",
/* 21*/ { BARCODE_GS1_128, GS1_MODE, -1, "[90]1528", 0, 1, 79, 1, "GGS Figure 6.6.5-5 middle",
"1101001110011110101110110111101101011100110011100110100111001100101100011101011"
},
/* 22*/ { BARCODE_GS1_128, GS1_MODE, "[00]000521775138957172", 0, 1, 156, 1, "GGS Figure 6.6.5-5 bottom",
/* 22*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]000521775138957172", 0, 1, 156, 1, "GGS Figure 6.6.5-5 bottom",
"110100111001111010111011011001100110110011001000100110011011100100111101110101101110100010001100010101111010001001101000010011000010110011011001100011101011"
},
/* 23*/ { BARCODE_GS1_128, GS1_MODE, "[00]395011010013000129", 0, 1, 156, 1, "GGS Figure 6.6.5-6",
/* 23*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]395011010013000129", 0, 1, 156, 1, "GGS Figure 6.6.5-6",
"110100111001111010111011011001100110100010001100010111011000100100110011011001101100110010011011100110110011001100110110011100110010111101101101100011101011"
},
/* 24*/ { BARCODE_GS1_128, GS1_MODE, "[00]395011010013000129", 0, 1, 156, 1, "GGS Figure 6.6.5-6",
/* 24*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]395011010013000129", 0, 1, 156, 1, "GGS Figure 6.6.5-6",
"110100111001111010111011011001100110100010001100010111011000100100110011011001101100110010011011100110110011001100110110011100110010111101101101100011101011"
},
/* 25*/ { BARCODE_GS1_128, GS1_MODE, "[401]931234518430GR", 0, 1, 167, 1, "GGS Figure 6.6.5-7 top",
/* 25*/ { BARCODE_GS1_128, GS1_MODE, -1, "[401]931234518430GR", 0, 1, 167, 1, "GGS Figure 6.6.5-7 top",
"11010011100111101011101100010100011001011100110110001101110110111010111011000110011100101011000111010111101110100111011001101000100011000101110100110111001100011101011"
},
/* 26*/ { BARCODE_GS1_128, GS1_MODE, "[00]093123450000000012", 0, 1, 156, 1, "GGS Figure 6.6.5-7 bottom",
/* 26*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]093123450000000012", 0, 1, 156, 1, "GGS Figure 6.6.5-7 bottom",
"110100111001111010111011011001100110010010001101100011011101101110101110110001101100110011011001100110110011001101100110010110011100110111010001100011101011"
},
/* 27*/ { BARCODE_GS1_128, GS1_MODE, "[01]95012345678903", 0, 1, 134, 1, "GGS Figure 7.8.5.1-1 1st",
/* 27*/ { BARCODE_GS1_128, GS1_MODE, -1, "[01]95012345678903", 0, 1, 134, 1, "GGS Figure 7.8.5.1-1 1st",
"11010011100111101011101100110110010111101000110011011001110110111010111011000100001011001101101111010010011000110110001101100011101011"
},
/* 28*/ { BARCODE_GS1_128, GS1_MODE, "[3102]000400", 0, 1, 101, 1, "GGS Figure 7.8.5.1-1 2nd",
/* 28*/ { BARCODE_GS1_128, GS1_MODE, -1, "[3102]000400", 0, 1, 101, 1, "GGS Figure 7.8.5.1-1 2nd",
"11010011100111101011101101100011011001100110110110011001001000110011011001100110110111101100011101011"
},
/* 29*/ { BARCODE_GS1_128, GS1_MODE, "[01]95012345678903[3102]000400", 0, 1, 189, 1, "GGS Figure 7.8.5.1-2",
/* 29*/ { BARCODE_GS1_128, GS1_MODE, -1, "[01]95012345678903[3102]000400", 0, 1, 189, 1, "GGS Figure 7.8.5.1-2",
"110100111001111010111011001101100101111010001100110110011101101110101110110001000010110011011011110100100110001101100011011001100110110110011001001000110011011001100100100110001100011101011"
},
/* 30*/ { BARCODE_GS1_128, GS1_MODE, "[8005]000365", 0, 1, 101, 1, "GGS Figure 7.8.5.2-1 1st",
/* 30*/ { BARCODE_GS1_128, GS1_MODE, -1, "[8005]000365", 0, 1, 101, 1, "GGS Figure 7.8.5.2-1 1st",
"11010011100111101011101010011110010001001100110110011001001001100010010110000100100001101100011101011"
},
/* 31*/ { BARCODE_GS1_128, GS1_MODE, "[10]123456", 0, 1, 90, 1, "GGS Figure 7.8.5.2-1 2nd",
/* 31*/ { BARCODE_GS1_128, GS1_MODE, -1, "[10]123456", 0, 1, 90, 1, "GGS Figure 7.8.5.2-1 2nd",
"110100111001111010111011001000100101100111001000101100011100010110110010000101100011101011"
},
/* 32*/ { BARCODE_GS1_128, GS1_MODE, "[8005]000365[10]123456", 0, 1, 156, 1, "GGS Figure 7.8.5.2-2",
/* 32*/ { BARCODE_GS1_128, GS1_MODE, -1, "[8005]000365[10]123456", 0, 1, 156, 1, "GGS Figure 7.8.5.2-2",
"110100111001111010111010100111100100010011001101100110010010011000100101100001111010111011001000100101100111001000101100011100010110101100001001100011101011"
},
/* 33*/ { BARCODE_GS1_128, GS1_MODE, "[403]27653113+99000900090010", 0, 1, 222, 1, "DHL Leitcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
/* 33*/ { BARCODE_GS1_128, GS1_MODE, -1, "[403]27653113+99000900090010", 0, 1, 222, 1, "DHL Leitcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
"110100111001111010111011000101000110001101101100101000011011101110110001001001011110111011001011100110001001001011101111010111011110110110011001100100100011011001100110010010001101100110011001000100110001000101100011101011"
},
/* 34*/ { BARCODE_GS1_128, GS1_MODE, "[00]340433935039756615", 0, 1, 156, 1, "DHL Identcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
/* 34*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]340433935039756615", 0, 1, 156, 1, "DHL Identcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
"110100111001111010111011011001100100010110001001000110010100011000101000111101100010111011010001000110000100101001000011010111001100100111001101100011101011"
},
/* 35*/ { BARCODE_GS1_128, GS1_MODE, "[90]ABCDEfGHI", 0, 1, 167, 0, "Shift A; BWIPP different encodation, same codeword count",
/* 35*/ { BARCODE_GS1_128, GS1_MODE, -1, "[90]ABCDEfGHI", 0, 1, 167, 0, "Shift A; BWIPP different encodation, same codeword count",
"11010010000111101011101110010110010011101100101000110001000101100010001000110101100010001000110100010110000100110100010001100010100011000100010110010011101100011101011"
},
/* 36*/ { BARCODE_GS1_128, GS1_MODE, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", 0, 1, 684, 1, "Max length",
/* 36*/ { BARCODE_GS1_128, GS1_MODE, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", 0, 1, 684, 1, "Max length",
"110100111001111010111011001101100101100111001000101100011100010110110000101001101111011010110011100110110001101101111011010110011100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011110101110111101101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101011001110010001011000100011110101100011101011"
},
/* 37*/ { BARCODE_EAN14, GS1_MODE, "4070071967072", 0, 1, 134, 1, "Verified manually against tec-it",
/* 37*/ { BARCODE_EAN14, GS1_MODE, -1, "4070071967072", 0, 1, 134, 1, "Verified manually against tec-it",
"11010011100111101011101100110110011000101000101100001001001100010011001011100100001011001001100010011001001110110111001001100011101011"
},
/* 38*/ { BARCODE_NVE18, GS1_MODE, "40700000071967072", 0, 1, 156, 1, "Verified manually against tec-it",
/* 38*/ { BARCODE_NVE18, GS1_MODE, -1, "40700000071967072", 0, 1, 156, 1, "Verified manually against tec-it",
"110100111001111010111011011001100110001010001011000010011011001100110110011001001100010011001011100100001011001001100010011001001110110111011101100011101011"
},
/* 39*/ { BARCODE_HIBC_128, UNICODE_MODE, "83278F8G9H0J2G", 0, 1, 211, 1, "ANSI/HIBC 2.6 - 2016 Section 4.1, not same, uses different encoding (eg begins StartA instead of StartB)",
/* 39*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "83278F8G9H0J2G", 0, 1, 211, 1, "ANSI/HIBC 2.6 - 2016 Section 4.1, not same, uses different encoding (eg begins StartA instead of StartB)",
"1101001000011000100100111010011001011101111011000110110110000101001011110111010001100010111010011001101000100011100101100110001010001001110110010110111000110011100101101000100010001001100111101010001100011101011"
},
/* 40*/ { BARCODE_HIBC_128, UNICODE_MODE, "A123BJC5D6E71", 0, 1, 200, 1, "ANSI/HIBC 2.6 - 2016 Figure 1, same",
/* 40*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "A123BJC5D6E71", 0, 1, 200, 1, "ANSI/HIBC 2.6 - 2016 Figure 1, same",
"11010010000110001001001010001100010011100110110011100101100101110010001011000101101110001000100011011011100100101100010001100111010010001101000111011011101001110011011010001000110001101101100011101011"
},
/* 41*/ { BARCODE_HIBC_128, UNICODE_MODE, "$$52001510X3G", 0, 1, 178, 1, "ANSI/HIBC 2.6 - 2016 Figure 5, same",
/* 41*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "$$52001510X3G", 0, 1, 178, 1, "ANSI/HIBC 2.6 - 2016 Figure 5, same",
"1101001000011000100100100100011001001000110010111011110110111000101101100110010111001100110010001001011110111011100010110110010111001101000100010110001000100011110101100011101011"
},
/* 42*/ { BARCODE_DPD, UNICODE_MODE, "%000393206219912345678101040", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustrations 2, 7, 8, same; NOTE: correct HRT given by Illustration 7 only",
/* 42*/ { BARCODE_DPD, UNICODE_MODE, -1, "%000393206219912345678101040", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustrations 2, 7, 8, same; NOTE: correct HRT given by Illustration 7 only",
"1101001000010001001100100111011001011101111011011001100110100010001100011011010011001000110111001001011101111010110011100100010110001110001011011000010100110010001001100100010011000101000101011110001100011101011"
},
/* 43*/ { BARCODE_DPD, UNICODE_MODE, "%007110601782532948375101276", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustration 6 **NOT SAME** HRT incorrect, also uses CodeA and inefficient encoding; verified against tec-it",
/* 43*/ { BARCODE_DPD, UNICODE_MODE, -1, "%007110601782532948375101276", 0, 1, 211, 1, "DPDAPPD 4.0.2 - Illustration 6 **NOT SAME** HRT incorrect, also uses CodeA and inefficient encoding; verified against tec-it",
"1101001000010001001100100111011001011101111010011000100110001001001001100100011001101100110000101001110010110011000110110100010111101011110010011000010010110010001001011001110011001010000100010111101100011101011"
},
/* 44*/ { BARCODE_DPD, UNICODE_MODE, "0123456789012345678901234567", 0, 1, 189, 1, "DPDAPPD 4.0.2 - Illustration 9, same (allowing for literal HRT)",
/* 44*/ { BARCODE_DPD, UNICODE_MODE, -1, "0123456789012345678901234567", 0, 1, 189, 1, "DPDAPPD 4.0.2 - Illustration 9, same (allowing for literal HRT)",
"110100111001100110110011101101110101110110001000010110011011011110110011011001110110111010111011000100001011001101101111011001101100111011011101011101100010000101100101011110001100011101011"
},
/* 45*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020028101276", 0, 1, 211, 1, "DPDPLS Section 4, **NOT SAME**, figure switches to CodeC after 1st char (%), zint after 2nd (0)",
"1101001000010001001100100111011001011101111010001100100110011100101110110010011001001000111101000101101100110011011001100110011001101101100110011100110100110010001001011001110011001010000101011110001100011101011"
},
/* 46*/ { BARCODE_DPD, UNICODE_MODE, -1, "007110601632532948375179276", 0, 1, 211, 1, "DPDPLS Section 4.6, **NOT SAME**, figure StartA & switches as above, zint StartB & switches as above",
"1101001000010001001100100111011001011101111010011000100110001001001001100100011001101100101001100001110010110011000110110100010111101011110010011000010010100111001101010111100011001010000101100010001100011101011"
},
/* 47*/ { BARCODE_DPD, UNICODE_MODE, -1, "001990009980000020084109203", 0, 1, 211, 1, "DPDPLS Section 5.1, **NOT SAME**, figure switches to CodeC after 1st char (%), zint after 2nd (0)",
"1101001000010001001100100111011001011101111011001101100101110111101101100110011001001000111101000101101100110011011001100110011001101101100110010011110100110010001001010111100010010011000100011010001100011101011"
},
/* 48*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020029136276", 0, 1, 211, 1, "DPDPLS Section 6.1, **NOT SAME**, as above",
"1101001000010001001100100111011001011101111010001100100110011100101110110010011001001000111101000101101100110011011001100110011001101101100110011100110010100110111001111000101011001010000100001101001100011101011"
},
/* 49*/ { BARCODE_DPD, UNICODE_MODE, 1, "006376209980000020044118276", 0, 1, 200, 1, "DPDPLS Section 8.7.2 relabel, **NOT SAME**, figure begins StartB then immediate CodeC, zint just StartC",
"11010011100110110011001010011000011001010000110010011101011101111010100111100110110011001101100110011001001110100100011001100010001011001110010111011001001011110111011001110100110111011101100011101011"
},
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -862,14 +934,15 @@ static void test_encode(const testCtx *const p_ctx) {
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (p_ctx->generate) {
printf(" /*%3d*/ { %s, %s, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
printf(" /*%3d*/ { %s, %s, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].option_2,
testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
testUtilModulesPrint(symbol, " ", "\n");
printf(" },\n");
@ -883,11 +956,11 @@ static void test_encode(const testCtx *const p_ctx) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, -1, -1, debug)) {
if (do_bwipp && testUtilCanBwipp(i, symbol, -1, data[i].option_2, -1, debug)) {
if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("i:%d %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
ret = testUtilBwipp(i, symbol, -1, -1, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
ret = testUtilBwipp(i, symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, cmp_buf, sizeof(cmp_buf), NULL);
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(symbol->symbology), ret);
ret = testUtilBwippCmp(symbol, cmp_msg, cmp_buf, data[i].expected);

View File

@ -117,8 +117,8 @@ static void test_input(const testCtx *const p_ctx) {
/* 13*/ { GS1_MODE, -1, "[90]12345[91]AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" },
/* 14*/ { GS1_MODE | GS1PARENS_MODE, -1, "(90)12345(91)AB12345", -1, 0, 4, 70, "(32) 45 48 47 15 4 7 9 28 48 45 9 1 10 11 48 25 5 17 9 48 48 48 48 27 48 48 37 39 26 8 14", "FNC1 NS 9012345 (C18 28) NS FNC1 9 1 A B NS (C28 25) 12345 Pad (4) (C38 27) (Start 0, Alpha)" },
/* 15*/ { UNICODE_MODE, -1, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" },
/* 16*/ { UNICODE_MODE, 1, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 424: Minimum number of rows out of range (2 to 8)", "" },
/* 17*/ { UNICODE_MODE, 9, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 424: Minimum number of rows out of range (2 to 8)", "" },
/* 16*/ { UNICODE_MODE, 1, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 433: Minimum number of rows out of range (2 to 8)", "" },
/* 17*/ { UNICODE_MODE, 9, "1234567890123456789012345678901234567890", -1, ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 433: Minimum number of rows out of range (2 to 8)", "" },
/* 18*/ { UNICODE_MODE, 2, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" },
/* 19*/ { UNICODE_MODE, 3, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" },
/* 20*/ { UNICODE_MODE, 4, "1234567890123456789012345678901234567890", -1, 0, 5, 70, "(40) 5 17 9 29 22 18 5 7 17 9 29 22 18 5 17 19 9 29 22 18 5 17 9 11 29 22 18 48 48 48 48 16", "" },

View File

@ -172,6 +172,7 @@ static void test_print(const testCtx *const p_ctx) {
/* 27*/ { BARCODE_CODE16K, -1, -1, 3, 5, -1, -1, 1.5, 0, 0, { 0, 0, "" }, "", "", "1234567890", "code16k_height1.5_wsp3_vwsp5.gif", "" },
/* 28*/ { BARCODE_DATAMATRIX, -1, -1, -1, -1, -1, -1, 0, 0, 0, { 2, 9, "001002" }, "", "", "1234567890", "datamatrix_seq2of9.gif", "" },
/* 29*/ { BARCODE_ULTRA, -1, -1, 1, -1, -1, 2, 0, 0, 0, { 0, 0, "" }, "", "", "12", "ultra_rev2.gif", "Revision 2" },
/* 30*/ { BARCODE_DPD, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, 0, 0, 0, { 0, 0, "" }, "", "", "008182709980000020028101276", "dpd_compliant.gif", "Now with bind top 3X default" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;

View File

@ -186,20 +186,22 @@ static void test_print(const testCtx *const p_ctx) {
/* 40*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "", "12345", "", 0, "ultra_fgalpha_nobg.png", "" },
/* 41*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12345", "", 0, "ultra_hvwsp1_box1.png", "" },
/* 42*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", "12345", "", 0, "ultra_fgalpha_hvwsp1_box1.png", "" },
/* 43*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", "1", "", 0, "ultra_odd.png", "" },
/* 44*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.5.png", "6 dpmm, 150 dpi" },
/* 45*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" },
/* 46*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4, { 0, 0, "" }, "1111117F", "EEEEEEEE", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" },
/* 47*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_2.1.png", "24 dpmm, 600 dpi" },
/* 48*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_hvwsp1_box2.png", "" },
/* 49*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.png", "" },
/* 50*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", "1234", "", 0, "datamatrix_2.0_bind1_dotty.png", "" },
/* 51*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", "1234", "", 0, "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" },
/* 52*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12345678909", "", 0, "dbar_ltd.png", "" },
/* 53*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5.0, 0, { 0, 0, "" }, "", "", "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.png", "" },
/* 54*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, 0, { 0, 0, "" }, "", "", "12345678901234567890", "", 0, "imail_height7.75.png", "" },
/* 55*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 4, 7, "Z1.txt" }, "", "", "3456", "", 0, "aztec_z1_seq4of7.png", "" },
/* 56*/ { BARCODE_PDF417, -1, -1, BARCODE_NO_QUIET_ZONES, -1, -1, -1, 5, 8, 16, 1.5, { 0, 0, "" }, "", "", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "", ZINT_WARN_NONCOMPLIANT, "pdf417_#204.png", "Ticket #204 Blank line in PDF417" },
/* 43*/ { BARCODE_ULTRA, -1, 1, BARCODE_BIND_TOP, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", "12345", "", 0, "ultra_fgalpha_hvwsp1_bindtop1.png", "" },
/* 44*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", "1", "", 0, "ultra_odd.png", "" },
/* 45*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.5.png", "6 dpmm, 150 dpi" },
/* 46*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" },
/* 47*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4, { 0, 0, "" }, "1111117F", "EEEEEEEE", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" },
/* 48*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_2.1.png", "24 dpmm, 600 dpi" },
/* 49*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_hvwsp1_box2.png", "" },
/* 50*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.png", "" },
/* 51*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", "1234", "", 0, "datamatrix_2.0_bind1_dotty.png", "" },
/* 52*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", "1234", "", 0, "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" },
/* 53*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12345678909", "", 0, "dbar_ltd.png", "" },
/* 54*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5.0, 0, { 0, 0, "" }, "", "", "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.png", "" },
/* 55*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, 0, { 0, 0, "" }, "", "", "12345678901234567890", "", 0, "imail_height7.75.png", "" },
/* 56*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 4, 7, "Z1.txt" }, "", "", "3456", "", 0, "aztec_z1_seq4of7.png", "" },
/* 57*/ { BARCODE_PDF417, -1, -1, BARCODE_NO_QUIET_ZONES, -1, -1, -1, 5, 8, 16, 1.5, { 0, 0, "" }, "", "", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "", ZINT_WARN_NONCOMPLIANT, "pdf417_#204.png", "Ticket #204 Blank line in PDF417" },
/* 58*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "008182709980000020028101276", "", 0, "dpd_compliant.png", "Now with bind top 3X default" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;

View File

@ -300,8 +300,8 @@ static void test_buffer(const testCtx *const p_ctx) {
/*175*/ { BARCODE_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 15, 15, 15, 30, 30 },
/*176*/ { BARCODE_DAFT, -1, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
/*177*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
/*178*/ { BARCODE_DPD, -1, "0123456789012345678901234567", "", 50, 1, 189, 378, 116 },
/*179*/ { BARCODE_DPD, COMPLIANT_HEIGHT, "0123456789012345678901234567", "", 66.5, 1, 189, 378, 149 },
/*178*/ { BARCODE_DPD, -1, "0123456789012345678901234567", "", 50, 1, 189, 378, 128 },
/*179*/ { BARCODE_DPD, COMPLIANT_HEIGHT, "0123456789012345678901234567", "", 66.5, 1, 189, 378, 161 },
/*180*/ { BARCODE_MICROQR, -1, "12345", "", 11, 11, 11, 22, 22 },
/*181*/ { BARCODE_MICROQR, COMPLIANT_HEIGHT, "12345", "", 11, 11, 11, 22, 22 },
/*182*/ { BARCODE_HIBC_128, -1, "1234567890", "", 50, 1, 123, 246, 116 },
@ -1624,8 +1624,8 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
/*191*/ { BARCODE_DAFT, -1, -1, -1, "FADT", 0, 8, 3, 7, 14, 16, 1 /*set*/, 0, 16, 0, 2 },
/*192*/ { BARCODE_DAFT, BARCODE_QUIET_ZONES, -1, -1, "FADT", 0, 8, 3, 7, 14, 16, 1 /*set*/, 0, 16, 0, 2 },
/*193*/ { BARCODE_DAFT, BARCODE_NO_QUIET_ZONES, -1, -1, "FADT", 0, 8, 3, 7, 14, 16, 1 /*set*/, 0, 16, 0, 2 },
/*194*/ { BARCODE_DPD, -1, -1, -1, "1234567890123456789012345678", 0, 50, 1, 189, 378, 116, 1 /*set*/, 0, 100, 0, 4 },
/*195*/ { BARCODE_DPD, BARCODE_QUIET_ZONES, -1, -1, "1234567890123456789012345678", 0, 50, 1, 189, 428, 116, 0 /*set*/, 0, 100, 0, 24 },
/*194*/ { BARCODE_DPD, -1, -1, -1, "1234567890123456789012345678", 0, 50, 1, 189, 378, 128, 1 /*set*/, 0, 100, 0, 4 },
/*195*/ { BARCODE_DPD, BARCODE_QUIET_ZONES, -1, -1, "1234567890123456789012345678", 0, 50, 1, 189, 428, 128, 0 /*set*/, 0, 100, 0, 24 },
/*196*/ { BARCODE_MICROQR, -1, -1, -1, "1234", 0, 11, 11, 11, 22, 22, 1 /*set*/, 0, 14, 0, 2 },
/*197*/ { BARCODE_MICROQR, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 11, 11, 11, 30, 30, 0 /*set*/, 0, 30, 0, 4 },
/*198*/ { BARCODE_HIBC_128, -1, -1, -1, "1234", 0, 50, 1, 90, 180, 116, 1 /*set*/, 0, 100, 0, 4 },
@ -2343,10 +2343,10 @@ static void test_height(const testCtx *const p_ctx) {
/*348*/ { BARCODE_DAFT, -1, 12, "DAFTDAFTDAFTDAFT", "", 0, 12, 3, 31, 62, 24, "" },
/*349*/ { BARCODE_DAFT, -1, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" },
/*350*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" },
/*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 2, "" },
/*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 124, "" },
/*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 124, "" },
/*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 125, "" },
/*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 14, "" },
/*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 136, "" },
/*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 136, "" },
/*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 137, "" },
/*355*/ { BARCODE_MICROQR, -1, 1, "12345", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" },
/*356*/ { BARCODE_HIBC_128, -1, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" },
/*357*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" },

View File

@ -108,6 +108,7 @@ static void test_print(const testCtx *const p_ctx) {
/* 49*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0.4, "", "", 180, "A", "", 0, "telepen_height0.4_rotate_180.svg" },
/* 50*/ { BARCODE_CODE49, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "FF11157F", "", 0, "A", "", 0, "code49_comph_fgalpha.svg" },
/* 51*/ { BARCODE_CODABLOCKF, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 2, 0, "00000033", "FFFFFF66", 0, "1234567890123456789012345678901234", "", 0, "codablockf_comph_sep2_fgbgalpha.svg" },
/* 52*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "008182709980000020028101276", "", 0, "dpd_compliant.svg" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;

View File

@ -253,15 +253,15 @@ static void test_input(const testCtx *const p_ctx) {
/* 54*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "https://url.com", 0, "(6) 282 262 133 216 269 251", "Mode: ccccccc (7)" },
/* 55*/ { UNICODE_MODE, 0, -1, -1, ULTRA_COMPRESSION, { 0, 0, "" }, "{", 0, "(2) 272 123", "Mode: a (1)" },
/* 56*/ { UNICODE_MODE, 0, -1, -1, -1, { 2, 3, "" }, "A", 0, "(2) 257 65", "" },
/* 57*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 1, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 558: Structured Append count out of range (2-8)", "" },
/* 58*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 9, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 558: Structured Append count out of range (2-8)", "" },
/* 59*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 559: Structured Append index out of range (1-3)", "" },
/* 60*/ { UNICODE_MODE, 0, -1, -1, -1, { 4, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 559: Structured Append index out of range (1-3)", "" },
/* 57*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 1, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count out of range (2-8)", "" },
/* 58*/ { UNICODE_MODE, 0, -1, -1, -1, { 1, 9, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 596: Structured Append count out of range (2-8)", "" },
/* 59*/ { UNICODE_MODE, 0, -1, -1, -1, { 0, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index out of range (1-3)", "" },
/* 60*/ { UNICODE_MODE, 0, -1, -1, -1, { 4, 3, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 597: Structured Append index out of range (1-3)", "" },
/* 61*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "0" }, "A", 0, "(2) 257 65", "" },
/* 62*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80088" }, "A", 0, "(2) 257 65", "" },
/* 63*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "123456" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 727: Structured Append ID too long (5 digit maximum)", "" },
/* 64*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "A" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 728: Invalid Structured Append ID (digits only)", "" },
/* 65*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80089" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 729: Structured Append ID '80089' out of range (1-80088)", "" },
/* 63*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "123456" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 593: Structured Append ID too long (5 digit maximum)", "" },
/* 64*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "A" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 594: Invalid Structured Append ID (digits only)", "" },
/* 65*/ { UNICODE_MODE, 0, -1, -1, -1, { 8, 8, "80089" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 595: Structured Append ID '80089' out of range (1-80088)", "" },
/* 66*/ { UNICODE_MODE, 0, -1, 3, -1, { 0, 0, "" }, "A", ZINT_ERROR_INVALID_OPTION, "Error 592: Revision must be 1 or 2", "" },
};
int data_size = ARRAY_SIZE(data);

View File

@ -250,7 +250,7 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
/* 86*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 },
/* 87*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 },
/* 88*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
/* 89*/ { BARCODE_DPD, "0123456789012345678901234567", "", 50, 1, 189, 378, 118.900002 },
/* 89*/ { BARCODE_DPD, "0123456789012345678901234567", "", 50, 1, 189, 378, 130.89999 },
/* 90*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 },
/* 91*/ { BARCODE_HIBC_128, "1234567890", "", 50, 1, 123, 246, 118.900002 },
/* 92*/ { BARCODE_HIBC_39, "1234567890", "", 50, 1, 223, 446, 118.900002 },
@ -1321,8 +1321,8 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
/*190*/ { BARCODE_DAFT, -1, -1, -1, "FADT", 0, 8, 3, 7, 14, 16, 0, 0, 2, 16 },
/*191*/ { BARCODE_DAFT, BARCODE_QUIET_ZONES, -1, -1, "FADT", 0, 8, 3, 7, 14, 16, 0, 0, 2, 16 },
/*192*/ { BARCODE_DAFT, BARCODE_NO_QUIET_ZONES, -1, -1, "FADT", 0, 8, 3, 7, 14, 16, 0, 0, 2, 16 },
/*193*/ { BARCODE_DPD, -1, -1, -1, "1234567890123456789012345678", 0, 50, 1, 189, 378, 118.9, 0, 0, 4, 100 },
/*194*/ { BARCODE_DPD, BARCODE_QUIET_ZONES, -1, -1, "1234567890123456789012345678", 0, 50, 1, 189, 428, 118.9, 25, 0, 4, 100 },
/*193*/ { BARCODE_DPD, -1, -1, -1, "1234567890123456789012345678", 0, 50, 1, 189, 378, 130.89999, 0, 6, 4, 100 },
/*194*/ { BARCODE_DPD, BARCODE_QUIET_ZONES, -1, -1, "1234567890123456789012345678", 0, 50, 1, 189, 428, 130.89999, 25, 6, 4, 100 },
/*195*/ { BARCODE_MICROQR, -1, -1, -1, "1234", 0, 11, 11, 11, 22, 22, 0, 0, 14, 2 },
/*196*/ { BARCODE_MICROQR, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 11, 11, 11, 30, 30, 4, 4, 14, 2 },
/*197*/ { BARCODE_HIBC_128, -1, -1, -1, "1234", 0, 50, 1, 90, 180, 118.9, 0, 0, 4, 100 },
@ -1848,10 +1848,10 @@ static void test_height(const testCtx *const p_ctx) {
/*348*/ { BARCODE_DAFT, -1, 12, "DAFTDAFTDAFTDAFT", "", 0, 12, 3, 31, 62, 24, "" },
/*349*/ { BARCODE_DAFT, -1, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" },
/*350*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" },
/*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 2, "" },
/*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 124, "" },
/*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 124, "" },
/*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 125, "" },
/*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 14, "" },
/*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 136, "" },
/*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 136, "" },
/*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 137, "" },
/*355*/ { BARCODE_MICROQR, -1, 1, "12345", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" },
/*356*/ { BARCODE_HIBC_128, -1, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" },
/*357*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" },

View File

@ -535,7 +535,7 @@ const char *testUtilOutputOptionsName(int output_options) {
int val;
};
static const struct item data[] = {
{ "BARCODE_NO_ASCII", BARCODE_NO_ASCII, 1 },
{ "BARCODE_BIND_TOP", BARCODE_BIND_TOP, 1 },
{ "BARCODE_BIND", BARCODE_BIND, 2 },
{ "BARCODE_BOX", BARCODE_BOX, 4 },
{ "BARCODE_STDOUT", BARCODE_STDOUT, 8 },
@ -2017,7 +2017,7 @@ static const char *testUtilBwippName(int index, const struct zint_symbol *symbol
{ "daft", BARCODE_DAFT, 93, 0, 0, 0, 0, 0, },
{ "", -1, 94, 0, 0, 0, 0, 0, },
{ "", -1, 95, 0, 0, 0, 0, 0, },
{ "", BARCODE_DPD, 96, 0, 0, 0, 0, 0, },
{ "code128", BARCODE_DPD, 96, 0, 1, 0, 0, 0, },
{ "microqrcode", BARCODE_MICROQR, 97, 1, 1, 1, 0, 0, },
{ "hibccode128", BARCODE_HIBC_128, 98, 0, 0, 0, 0, 0, },
{ "hibccode39", BARCODE_HIBC_39, 99, 0, 0, 0, 0, 0, },
@ -2647,6 +2647,12 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
memmove(bwipp_data + 2, bwipp_data, data_len + 1);
memmove(bwipp_data, prefix, 2);
}
} else if (symbology == BARCODE_DPD) {
if (data_len == 27 && option_2 != 1) {
memmove(bwipp_data + 1, bwipp_data, data_len + 1);
bwipp_data[0] = '%';
}
bwipp_opts = bwipp_opts_buf;
} else if (symbology == BARCODE_FIM) {
strcpy(bwipp_data, "fima");
bwipp_data[3] = z_isupper(data[0]) ? data[0] - 'A' + 'a' : data[0];
@ -3610,6 +3616,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
|| symbology == BARCODE_ITF14 || symbology == BARCODE_DPLEIT
|| symbology == BARCODE_DPIDENT;
const int is_upcean = is_extendable(symbology);
const int need_dpd_prefix = (symbology == BARCODE_DPD && expected_len == 27 && symbol->option_2 != 1);
char *reduced = gs1 ? (char *) z_alloca(expected_len + 1) : NULL;
char *escaped = is_escaped ? (char *) z_alloca(expected_len + 1) : NULL;
@ -3621,6 +3628,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
char *upcean = is_upcean ? (char *) z_alloca(expected_len + 1 + 1) : NULL;
char *ean14_nve18 = symbology == BARCODE_EAN14 || symbology == BARCODE_NVE18
? (char *) z_alloca(expected_len + 3 + 1) : NULL;
char *dpd = need_dpd_prefix ? (char *) z_alloca(28 + 1) : NULL;
int ret;
int ret_memcmp;
@ -3882,6 +3890,12 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in
}
expected = ean14_nve18;
expected_len += 3;
} else if (need_dpd_prefix) {
dpd[0] = '%';
memcpy(dpd + 1, expected, expected_len);
expected = dpd;
expected_len++;
}
if (ret_buf) {

View File

@ -945,11 +945,11 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int
int link2 = 2; /* Draft Table 7, Structured Append Group (SAG) with no File Number */
if (symbol->structapp.count < 2 || symbol->structapp.count > 8) {
strcpy(symbol->errtxt, "558: Structured Append count out of range (2-8)");
strcpy(symbol->errtxt, "596: Structured Append count out of range (2-8)");
return ZINT_ERROR_INVALID_OPTION;
}
if (symbol->structapp.index < 1 || symbol->structapp.index > symbol->structapp.count) {
sprintf(symbol->errtxt, "559: Structured Append index out of range (1-%d)", symbol->structapp.count);
sprintf(symbol->errtxt, "597: Structured Append index out of range (1-%d)", symbol->structapp.count);
return ZINT_ERROR_INVALID_OPTION;
}
scr_cw_count = 1;
@ -960,17 +960,17 @@ INTERNAL int ultra(struct zint_symbol *symbol, struct zint_seg segs[], const int
for (id_len = 0; id_len < 32 && symbol->structapp.id[id_len]; id_len++);
if (id_len > 5) { /* 282 * 283 + 282 = 80088 */
strcpy(symbol->errtxt, "727: Structured Append ID too long (5 digit maximum)");
strcpy(symbol->errtxt, "593: Structured Append ID too long (5 digit maximum)");
return ZINT_ERROR_INVALID_OPTION;
}
id = to_int((const unsigned char *) symbol->structapp.id, id_len);
if (id == -1) {
strcpy(symbol->errtxt, "728: Invalid Structured Append ID (digits only)");
strcpy(symbol->errtxt, "594: Invalid Structured Append ID (digits only)");
return ZINT_ERROR_INVALID_OPTION;
}
if (id > 80088) {
sprintf(symbol->errtxt, "729: Structured Append ID '%d' out of range (1-80088)", id);
sprintf(symbol->errtxt, "595: Structured Append ID '%d' out of range (1-80088)", id);
return ZINT_ERROR_INVALID_OPTION;
}
if (id) {

View File

@ -406,6 +406,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
float text_gap; /* Gap between barcode and text */
float guard_descent;
const int is_codablockf = symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF;
const int no_extend = is_codablockf || symbol->symbology == BARCODE_DPD;
float addon_row_height;
float large_bar_height;
@ -730,7 +731,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
text_yposn = yoffset + symbol->height + text_height + text_gap; /* Calculated to bottom of text */
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) {
text_yposn += symbol->border_width;
text_yposn += symbol->border_width; /* Note not needed for BARCODE_BIND_TOP */
}
if (upceanflag >= 6) { /* UPC-E, EAN-8, UPC-A, EAN-13 */
@ -906,7 +907,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
}
/* Bind/box */
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) {
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP))) {
const int horz_outside = is_fixed_ratio(symbol->symbology);
float ybind_top = yoffset - symbol->border_width;
/* Following equivalent to yoffset + symbol->height + dot_overspill except for BARCODE_MAXICODE */
@ -918,21 +919,23 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
/* Top */
rect = vector_plot_create_rect(symbol, 0.0f, ybind_top, vector->width, symbol->border_width);
if (!rect) return ZINT_ERROR_MEMORY;
if (!(symbol->output_options & BARCODE_BOX) && is_codablockf) {
/* CodaBlockF bind - does not extend over horizontal whitespace */
if (!(symbol->output_options & BARCODE_BOX) && no_extend) {
/* CodaBlockF/DPD bind - does not extend over horizontal whitespace */
rect->x = xoffset;
rect->width -= xoffset + roffset;
}
vector_plot_add_rect(symbol, rect, &last_rectangle);
/* Bottom */
rect = vector_plot_create_rect(symbol, 0.0f, ybind_bot, vector->width, symbol->border_width);
if (!rect) return ZINT_ERROR_MEMORY;
if (!(symbol->output_options & BARCODE_BOX) && is_codablockf) {
/* CodaBlockF bind - does not extend over horizontal whitespace */
rect->x = xoffset;
rect->width -= xoffset + roffset;
if (!(symbol->output_options & BARCODE_BIND_TOP)) { /* Trumps BARCODE_BOX & BARCODE_BIND */
rect = vector_plot_create_rect(symbol, 0.0f, ybind_bot, vector->width, symbol->border_width);
if (!rect) return ZINT_ERROR_MEMORY;
if (!(symbol->output_options & BARCODE_BOX) && no_extend) {
/* CodaBlockF/DPD bind - does not extend over horizontal whitespace */
rect->x = xoffset;
rect->width -= xoffset + roffset;
}
vector_plot_add_rect(symbol, rect, &last_rectangle);
}
vector_plot_add_rect(symbol, rect, &last_rectangle);
if (symbol->output_options & BARCODE_BOX) {
const float xbox_right = vector->width - symbol->border_width;
float box_top = yoffset;

View File

@ -266,7 +266,8 @@ extern "C" {
#define BARCODE_LAST 146 /* Max barcode number marker, not barcode */
/* Output options (`symbol->output_options`) */
#define BARCODE_NO_ASCII 0x0001 /* Legacy (no-op) */
#define BARCODE_BIND_TOP 0x0001 /* Boundary bar above the symbol only (not below), does not affect stacking */
/* Note: value was once used by the legacy (never-used) BARCODE_NO_ASCII */
#define BARCODE_BIND 0x0002 /* Boundary bars above & below the symbol and between stacked symbols */
#define BARCODE_BOX 0x0004 /* Box around symbol */
#define BARCODE_STDOUT 0x0008 /* Output to stdout */

View File

@ -217,7 +217,7 @@ namespace Zint {
m_lastError = m_zintSymbol->errtxt;
if (m_error < ZINT_ERROR) {
m_borderType = m_zintSymbol->output_options & (BARCODE_BIND | BARCODE_BOX);
m_borderType = m_zintSymbol->output_options & (BARCODE_BIND | BARCODE_BOX | BARCODE_BIND_TOP);
m_height = m_zintSymbol->height;
m_borderWidth = m_zintSymbol->border_width;
m_whitespace = m_zintSymbol->whitespace_width;
@ -411,6 +411,8 @@ namespace Zint {
m_borderType = BARCODE_BIND;
} else if (borderTypeIndex == 2) {
m_borderType = BARCODE_BOX;
} else if (borderTypeIndex == 3) {
m_borderType = BARCODE_BIND_TOP;
} else {
m_borderType = 0;
}
@ -941,20 +943,28 @@ namespace Zint {
arg_color(cmd, "--bg=", bgColor());
}
bool default_bind = false, default_box = false, default_border = false;
bool default_bind = false, default_bind_top = false, default_box = false, default_border = false;
if (m_symbol == BARCODE_ITF14) {
if ((borderType() & BARCODE_BOX) && borderWidth() == 5) {
default_bind = default_box = default_border = true;
default_box = default_border = true;
}
} else if (m_symbol == BARCODE_CODABLOCKF || m_symbol == BARCODE_CODE16K || m_symbol == BARCODE_CODE49) {
} else if (m_symbol == BARCODE_CODABLOCKF || m_symbol == BARCODE_HIBC_BLOCKF || m_symbol == BARCODE_CODE16K
|| m_symbol == BARCODE_CODE49) {
if ((borderType() & BARCODE_BIND) && borderWidth() == 1) {
default_bind = default_border = true;
}
} else if (m_symbol == BARCODE_DPD) {
if ((borderType() & BARCODE_BIND_TOP) && borderWidth() == 3) {
default_bind_top = default_border = true;
}
}
arg_bool(cmd, "--binary", (inputMode() & 0x07) == DATA_MODE);
if (!default_bind) {
arg_bool(cmd, "--bind", (borderType() & BARCODE_BIND) && !(borderType() & BARCODE_BOX));
arg_bool(cmd, "--bind", borderType() & BARCODE_BIND);
}
if (!default_bind_top) {
arg_bool(cmd, "--bindtop", borderType() & BARCODE_BIND_TOP);
}
arg_bool(cmd, "--bold", fontSetting() & BOLD_TEXT);
if (!default_border) {

View File

@ -145,7 +145,7 @@ private slots:
bc.setCMYK(cmyk);
QCOMPARE(bc.cmyk(), cmyk);
int borderTypes[] = { 0, BARCODE_BIND, BARCODE_BOX };
int borderTypes[] = { 0, BARCODE_BIND, BARCODE_BOX, BARCODE_BIND_TOP };
for (int i = 0; i < ARRAY_SIZE(borderTypes); i++) {
bc.setBorderType(i);
QCOMPARE(bc.borderType(), borderTypes[i]);

5052
backend_tcl/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -480,8 +480,9 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n"
" -bg color: set background color as 6 or 8 hex rrggbbaa\n"
/* cli option --binary internally handled */
" -bind bool: bars above/below the code, size set by -border\n"
" -bindtop bool: bar above the code, size set by -border\n"
" -bold bool: use bold text\n"
" -border integer: width of a border around the symbol. Use with -bind/-box 1\n"
" -border integer: width of a border around the symbol. Use with -bind/-box/-bindtop 1\n"
" -box bool: box around bar code, size set be -border\n"
/* cli option --cmyk not supported as no corresponding output */
" -cols integer: Codablock F, DotCode, PDF417: number of columns\n"
@ -758,7 +759,7 @@ static int Encode(Tcl_Interp *interp, int objc,
/*--------------------------------------------------------------------*/
/* Option list and indexes */
static const char *optionList[] = {
"-addongap", "-barcode", "-bg", "-bind", "-bold", "-border", "-box",
"-addongap", "-barcode", "-bg", "-bind", "-bindtop", "-bold", "-border", "-box",
"-cols", "-compliantheight", "-dmre", "-dotsize", "-dotty",
"-eci", "-fast", "-fg", "-format", "-fullmultibyte",
"-gs1nocheck", "-gs1parens", "-gssep", "-guarddescent",
@ -770,7 +771,7 @@ static int Encode(Tcl_Interp *interp, int objc,
"-to", "-vers", "-vwhitesp", "-werror", "-whitesp",
NULL};
enum iOption {
iAddonGap, iBarcode, iBG, iBind, iBold, iBorder, iBox,
iAddonGap, iBarcode, iBG, iBind, iBindTop, iBold, iBorder, iBox,
iCols, iCompliantHeight, iDMRE, iDotSize, iDotty,
iECI, iFast, iFG, iFormat, iFullMultiByte,
iGS1NoCheck, iGS1Parens, iGSSep, iGuardDescent,
@ -797,6 +798,7 @@ static int Encode(Tcl_Interp *interp, int objc,
/* >> Decode object */
switch (optionIndex) {
case iBind:
case iBindTop:
case iBold:
case iBox:
case iCompliantHeight:
@ -931,6 +933,13 @@ static int Encode(Tcl_Interp *interp, int objc,
my_symbol->output_options &= ~BARCODE_BIND;
}
break;
case iBindTop:
if (intValue) {
my_symbol->output_options |= BARCODE_BIND_TOP;
} else {
my_symbol->output_options &= ~BARCODE_BIND_TOP;
}
break;
case iBold:
if (intValue) {
my_symbol->output_options |= BOLD_TEXT;

View File

@ -1,72 +1,73 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="1013" height="366" version="1.1"
<svg width="1013" height="395" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="1013" height="366" fill="#FFFFFF" />
<rect x="0.00" y="0.00" width="9.60" height="320.00" />
<rect x="14.40" y="0.00" width="4.80" height="320.00" />
<rect x="28.80" y="0.00" width="4.80" height="320.00" />
<rect x="52.80" y="0.00" width="4.80" height="320.00" />
<rect x="72.00" y="0.00" width="4.80" height="320.00" />
<rect x="86.40" y="0.00" width="9.60" height="320.00" />
<rect x="105.60" y="0.00" width="4.80" height="320.00" />
<rect x="120.00" y="0.00" width="14.40" height="320.00" />
<rect x="139.20" y="0.00" width="9.60" height="320.00" />
<rect x="158.40" y="0.00" width="4.80" height="320.00" />
<rect x="168.00" y="0.00" width="14.40" height="320.00" />
<rect x="187.20" y="0.00" width="19.20" height="320.00" />
<rect x="211.20" y="0.00" width="9.60" height="320.00" />
<rect x="225.60" y="0.00" width="9.60" height="320.00" />
<rect x="244.80" y="0.00" width="9.60" height="320.00" />
<rect x="264.00" y="0.00" width="9.60" height="320.00" />
<rect x="278.40" y="0.00" width="4.80" height="320.00" />
<rect x="297.60" y="0.00" width="4.80" height="320.00" />
<rect x="316.80" y="0.00" width="9.60" height="320.00" />
<rect x="340.80" y="0.00" width="9.60" height="320.00" />
<rect x="355.20" y="0.00" width="9.60" height="320.00" />
<rect x="369.60" y="0.00" width="4.80" height="320.00" />
<rect x="384.00" y="0.00" width="9.60" height="320.00" />
<rect x="403.20" y="0.00" width="4.80" height="320.00" />
<rect x="422.40" y="0.00" width="9.60" height="320.00" />
<rect x="436.80" y="0.00" width="14.40" height="320.00" />
<rect x="460.80" y="0.00" width="4.80" height="320.00" />
<rect x="475.20" y="0.00" width="4.80" height="320.00" />
<rect x="484.80" y="0.00" width="14.40" height="320.00" />
<rect x="504.00" y="0.00" width="19.20" height="320.00" />
<rect x="528.00" y="0.00" width="4.80" height="320.00" />
<rect x="537.60" y="0.00" width="9.60" height="320.00" />
<rect x="556.80" y="0.00" width="14.40" height="320.00" />
<rect x="580.80" y="0.00" width="4.80" height="320.00" />
<rect x="600.00" y="0.00" width="4.80" height="320.00" />
<rect x="609.60" y="0.00" width="9.60" height="320.00" />
<rect x="633.60" y="0.00" width="14.40" height="320.00" />
<rect x="662.40" y="0.00" width="4.80" height="320.00" />
<rect x="672.00" y="0.00" width="9.60" height="320.00" />
<rect x="686.40" y="0.00" width="9.60" height="320.00" />
<rect x="715.20" y="0.00" width="4.80" height="320.00" />
<rect x="724.80" y="0.00" width="4.80" height="320.00" />
<rect x="739.20" y="0.00" width="9.60" height="320.00" />
<rect x="758.40" y="0.00" width="4.80" height="320.00" />
<rect x="777.60" y="0.00" width="4.80" height="320.00" />
<rect x="792.00" y="0.00" width="9.60" height="320.00" />
<rect x="811.20" y="0.00" width="4.80" height="320.00" />
<rect x="830.40" y="0.00" width="4.80" height="320.00" />
<rect x="844.80" y="0.00" width="9.60" height="320.00" />
<rect x="868.80" y="0.00" width="4.80" height="320.00" />
<rect x="878.40" y="0.00" width="4.80" height="320.00" />
<rect x="897.60" y="0.00" width="4.80" height="320.00" />
<rect x="907.20" y="0.00" width="4.80" height="320.00" />
<rect x="916.80" y="0.00" width="19.20" height="320.00" />
<rect x="950.40" y="0.00" width="9.60" height="320.00" />
<rect x="974.40" y="0.00" width="14.40" height="320.00" />
<rect x="993.60" y="0.00" width="4.80" height="320.00" />
<rect x="1003.20" y="0.00" width="9.60" height="320.00" />
<text x="506.40" y="356.96" text-anchor="middle"
<rect x="0" y="0" width="1013" height="395" fill="#FFFFFF" />
<rect x="0.00" y="14.40" width="9.60" height="320.00" />
<rect x="14.40" y="14.40" width="4.80" height="320.00" />
<rect x="28.80" y="14.40" width="4.80" height="320.00" />
<rect x="52.80" y="14.40" width="4.80" height="320.00" />
<rect x="72.00" y="14.40" width="4.80" height="320.00" />
<rect x="86.40" y="14.40" width="9.60" height="320.00" />
<rect x="105.60" y="14.40" width="4.80" height="320.00" />
<rect x="120.00" y="14.40" width="14.40" height="320.00" />
<rect x="139.20" y="14.40" width="9.60" height="320.00" />
<rect x="158.40" y="14.40" width="4.80" height="320.00" />
<rect x="168.00" y="14.40" width="14.40" height="320.00" />
<rect x="187.20" y="14.40" width="19.20" height="320.00" />
<rect x="211.20" y="14.40" width="9.60" height="320.00" />
<rect x="225.60" y="14.40" width="9.60" height="320.00" />
<rect x="244.80" y="14.40" width="9.60" height="320.00" />
<rect x="264.00" y="14.40" width="9.60" height="320.00" />
<rect x="278.40" y="14.40" width="4.80" height="320.00" />
<rect x="297.60" y="14.40" width="4.80" height="320.00" />
<rect x="316.80" y="14.40" width="9.60" height="320.00" />
<rect x="340.80" y="14.40" width="9.60" height="320.00" />
<rect x="355.20" y="14.40" width="9.60" height="320.00" />
<rect x="369.60" y="14.40" width="4.80" height="320.00" />
<rect x="384.00" y="14.40" width="9.60" height="320.00" />
<rect x="403.20" y="14.40" width="4.80" height="320.00" />
<rect x="422.40" y="14.40" width="9.60" height="320.00" />
<rect x="436.80" y="14.40" width="14.40" height="320.00" />
<rect x="460.80" y="14.40" width="4.80" height="320.00" />
<rect x="475.20" y="14.40" width="4.80" height="320.00" />
<rect x="484.80" y="14.40" width="14.40" height="320.00" />
<rect x="504.00" y="14.40" width="19.20" height="320.00" />
<rect x="528.00" y="14.40" width="4.80" height="320.00" />
<rect x="537.60" y="14.40" width="9.60" height="320.00" />
<rect x="556.80" y="14.40" width="14.40" height="320.00" />
<rect x="580.80" y="14.40" width="4.80" height="320.00" />
<rect x="600.00" y="14.40" width="4.80" height="320.00" />
<rect x="609.60" y="14.40" width="9.60" height="320.00" />
<rect x="633.60" y="14.40" width="14.40" height="320.00" />
<rect x="662.40" y="14.40" width="4.80" height="320.00" />
<rect x="672.00" y="14.40" width="9.60" height="320.00" />
<rect x="686.40" y="14.40" width="9.60" height="320.00" />
<rect x="715.20" y="14.40" width="4.80" height="320.00" />
<rect x="724.80" y="14.40" width="4.80" height="320.00" />
<rect x="739.20" y="14.40" width="9.60" height="320.00" />
<rect x="758.40" y="14.40" width="4.80" height="320.00" />
<rect x="777.60" y="14.40" width="4.80" height="320.00" />
<rect x="792.00" y="14.40" width="9.60" height="320.00" />
<rect x="811.20" y="14.40" width="4.80" height="320.00" />
<rect x="830.40" y="14.40" width="4.80" height="320.00" />
<rect x="844.80" y="14.40" width="9.60" height="320.00" />
<rect x="868.80" y="14.40" width="4.80" height="320.00" />
<rect x="878.40" y="14.40" width="4.80" height="320.00" />
<rect x="897.60" y="14.40" width="4.80" height="320.00" />
<rect x="907.20" y="14.40" width="4.80" height="320.00" />
<rect x="916.80" y="14.40" width="19.20" height="320.00" />
<rect x="950.40" y="14.40" width="9.60" height="320.00" />
<rect x="974.40" y="14.40" width="14.40" height="320.00" />
<rect x="993.60" y="14.40" width="4.80" height="320.00" />
<rect x="1003.20" y="14.40" width="9.60" height="320.00" />
<rect x="0.00" y="0.00" width="1012.80" height="14.40" />
<text x="506.40" y="371.36" text-anchor="middle"
font-family="Helvetica, sans-serif" font-size="33.6" >
0003 932 0621 9912 3456 78 101 040 9
</text>

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -62,7 +62,8 @@ composite
linear and stacked. Those currently supported are made up of a linear
'primary' message above which is printed a stacked component based on the
PDF417 symbology. These symbols also have a separator which separates the
linear and the stacked components.
linear and the stacked components. The stacked component is most often
referred to as the 2D (two-dimensional) component.
X-dimension
@ -842,7 +843,8 @@ zint --box --border=10 -w 10 -d "This Text"
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 order to create a
quiet zone between the barcode and the sides of the box.
quiet zone between the barcode and the sides of the box. To add a boundary bar
to the top only use `--bindtop`.
For linear symbols, horizontal boundary bars appear tight against the barcode,
inside any vertical whitespace (or text). For matrix symbols, however, where
@ -854,7 +856,7 @@ whitespace.
Codablock-F, Code 16K and Code 49 always have boundary bars, and default to
particular horizontal whitespace values. Special considerations apply to ITF-14
- see [6.1.2.6 ITF-14] for that symbology.
and DPD - see [6.1.2.6 ITF-14] and [6.1.10.7 DPD Code] for those symbologies.
## 4.7 Using Colour
@ -1084,11 +1086,12 @@ may encode it using an ECI-aware symbology and an ECI value from Table
{@tbl:eci_codes} below. The ECI information is added to your code symbol as
prefix data. The symbologies that support ECI are
------------ ------------ ------------ ------------
Aztec Code DotCode MaxiCode QR Code
Code One Grid Matrix MicroPDF417 rMQR
Data Matrix Han Xin Code PDF417 Ultracode
------------ ------------ ------------ ------------
------------ ------------ ------------
Aztec Code Grid Matrix PDF417
Code One Han Xin Code QR Code
Data Matrix MaxiCode rMQR
DotCode MicroPDF417 Ultracode
------------ ------------ ------------
Table: {#tbl:eci_aware_symbologies tag=": ECI-Aware Symbologies"}
@ -1956,8 +1959,10 @@ Value Effect
------------------------- -----------------------------------------------------
0 No options selected.
`BARCODE_BIND_TOP` Boundary bar above the symbol only.[^7]
`BARCODE_BIND` Boundary bars above and below the symbol and between
rows if stacking multiple symbols.[^7]
rows if stacking multiple symbols.[^8]
`BARCODE_BOX` Add a box surrounding the symbol and whitespace.
@ -1982,7 +1987,7 @@ Value Effect
separate colour channels (`OUT_BUFFER` only).
`BARCODE_QUIET_ZONES` Add compliant quiet zones (additional to any
specified whitespace).[^8]
specified whitespace).[^9]
`BARCODE_NO_QUIET_ZONES` Disable quiet zones, notably those with defaults.
@ -1992,10 +1997,13 @@ Value Effect
Table: API `output_options` Values {#tbl:api_output_options tag="$ $"}
[^7]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code
[^7]: The `BARCODE_BIND_TOP` flag is set by default for DPD - see [6.1.10.7 DPD
Code].
[^8]: 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].
[^8]: Codablock-F, Code 16K, Code 49, EAN-2 to EAN-13, ISBN, ITF-14, UPC-A and
[^9]: 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
@ -2335,7 +2343,7 @@ border width of 5. This behaviour can be overridden by using the `--bind` option
(API `output_options |= BARCODE_BIND`). Similarly the border width can be
overridden using `--border` (API `border_width`). If a symbol with no border is
required this can be achieved by explicitly setting the border type to box (or
bind) and leaving the border width 0.
bind or bindtop) and leaving the border width 0.
![`zint -b ITF14 --box --compliantheight -d
"9212320967145"`](images/itf14_border0.svg)
@ -2356,6 +2364,9 @@ Identcode is based on Interleaved Code 2 of 5 and is used by Deutsche Post for
mailing purposes. Identcode requires an 11-digit numerical input and includes a
check digit.
\clearpage
### 6.1.3 UPC (Universal Product Code) (ISO 15420)
#### 6.1.3.1 UPC Version A
@ -2399,7 +2410,7 @@ UPC-E is a zero-compressed version of UPC-A developed for smaller packages. The
code requires a 6-digit article number (digits 0-9). The check digit is
calculated by Zint. EAN-2 and EAN-5 add-on symbols can be added using the +
character as with UPC-A. In addition Zint also supports Number System 1
encoding by entering a 7-digit article number stating with the digit 1. For
encoding by entering a 7-digit article number starting with the digit 1. For
example:
```bash
@ -2466,8 +2477,8 @@ If you are encoding an EAN-8 or EAN-13 symbol and your data already includes
the check digit then you can use symbology `BARCODE_EANX_CHK` (14) which takes
an 8 or 13-digit input and validates the check digit before encoding.
Options to adjust the add-on gap and the descent height of guard bars are the
same as for [6.1.3.2 UPC Version E].
Options to adjust the add-on gap and the guard bar descent height are the same
as for [6.1.3.2 UPC Version E].
#### 6.1.4.2 SBN, ISBN and ISBN-13
@ -2478,7 +2489,7 @@ EAN-13 symbols (also known as Bookland EAN-13) can also be produced from
needs to be present in the input data and will be verified before the symbol is
generated. In addition EAN-2 and EAN-5 add-on symbols can be added using the +
character as with UPC symbols, and there are options to adjust the add-on gap
and the descent height of guard bars - see [6.1.3.2 UPC Version E].
and the guard bar descent height - see [6.1.3.2 UPC Version E].
### 6.1.5 Plessey
@ -2715,11 +2726,39 @@ standards.
#### 6.1.10.7 DPD Code
![`zint -b DPD --compliantheight -d
"%000393206219912345678101040"`](images/dpd.svg)
"000393206219912345678101040"`](images/dpd.svg)
Another variation of Code 128 as used by DPD (Deutscher Paketdienst). Requires
a 28 character alphanumeric input. Zint formats the Human Readable Text as
specified by DPD and adds a modulo-36 check character.
Another variation of Code 128 as used by DPD (Deutscher Paketdienst). Requires a
27 or 28 character input. For 28 character input, the first character is an
identification tag (Barcode ID), which should usually be `"%"` (ASCII 37). If
27 characters are supplied, `"%"` 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:
Destination Post Code Tracking Number Service Code Dest. Country Code
--------------------- ------------------ ------------ --------------------
PPPPPPP TTTTTTTTTTTTTT SSS CCC
(7 alphanumerics) (14 alphanumerics) (3 digits) (3-digit ISO 3166-1)
Table: {#tbl:dpd_input_fields tag=": DPD Input Fields"}
A warning will be generated if the Service Code, the Destination Country Code,
or the last 10 characters of the Tracking Number are non-numeric.
Zint formats the Human Readable Text as specified by DPD, leaving out the
identication tag, and adds a modulo-36 check character to the text (not to the
barcode itself), thus:
`PPPP PPP TTTT TTTT TTTT TT SSS CCC D`
By default a top boundary bar is added, with default width 3X. The width can be
overridden using `--border` (API `border_width`). For a symbol with no top
boundary bar, explicitly set the border type to bindtop (or bind or box) and
leave the border width 0.
A DPD Code can be marked as a "relabel" by specifying `--vers=1` (API
`option_2 = 1`), which omits the identification tag and prints the barcode at
half height. In this case, an input of 27 alphanumeric characters is required.
### 6.1.11 GS1 DataBar (ISO 24724)

View File

@ -252,7 +252,8 @@ composite
linear and stacked. Those currently supported are made up of a linear
primary message above which is printed a stacked component based on the
PDF417 symbology. These symbols also have a separator which separates the
linear and the stacked components.
linear and the stacked components. The stacked component is most often
referred to as the 2D (two-dimensional) component.
X-dimension
@ -957,7 +958,8 @@ The width of the boundary bars or box borders must be specified using the
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 order to create a
quiet zone between the barcode and the sides of the box.
quiet zone between the barcode and the sides of the box. To add a boundary bar
to the top only use --bindtop.
For linear symbols, horizontal boundary bars appear tight against the barcode,
inside any vertical whitespace (or text). For matrix symbols, however, where
@ -967,8 +969,8 @@ whitespace.
[zint -b QRCODE --border=1 --box -d "This Text" --quietzones]
Codablock-F, Code 16K and Code 49 always have boundary bars, and default to
particular horizontal whitespace values. Special considerations apply to
ITF-14 - see 6.1.2.6 ITF-14 for that symbology.
particular horizontal whitespace values. Special considerations apply to ITF-14
and DPD - see 6.1.2.6 ITF-14 and 6.1.10.7 DPD Code for those symbologies.
4.7 Using Colour
@ -1181,11 +1183,12 @@ may encode it using an ECI-aware symbology and an ECI value from Table
: ECI Codes below. The ECI information is added to your code symbol as prefix
data. The symbologies that support ECI are
------------- -------------- ------------- -----------
Aztec Code DotCode MaxiCode QR Code
Code One Grid Matrix MicroPDF417 rMQR
Data Matrix Han Xin Code PDF417 Ultracode
------------- -------------- ------------- -----------
------------- -------------- -----------
Aztec Code Grid Matrix PDF417
Code One Han Xin Code QR Code
Data Matrix MaxiCode rMQR
DotCode MicroPDF417 Ultracode
------------- -------------- -----------
: Table : ECI-Aware Symbologies:
@ -1984,8 +1987,10 @@ together when adjusting this value:
-------------------------- ----------------------------------------------------
0 No options selected.
BARCODE_BIND_TOP Boundary bar above the symbol only.[7]
BARCODE_BIND Boundary bars above and below the symbol and between
rows if stacking multiple symbols.[7]
rows if stacking multiple symbols.[8]
BARCODE_BOX Add a box surrounding the symbol and whitespace.
@ -2010,7 +2015,7 @@ together when adjusting this value:
separate colour channels (OUT_BUFFER only).
BARCODE_QUIET_ZONES Add compliant quiet zones (additional to any
specified whitespace).[8]
specified whitespace).[9]
BARCODE_NO_QUIET_ZONES Disable quiet zones, notably those with defaults.
@ -2328,7 +2333,7 @@ border width of 5. This behaviour can be overridden by using the --bind option
(API output_options |= BARCODE_BIND). Similarly the border width can be
overridden using --border (API border_width). If a symbol with no border is
required this can be achieved by explicitly setting the border type to box (or
bind) and leaving the border width 0.
bind or bindtop) and leaving the border width 0.
[zint -b ITF14 --box --compliantheight -d "9212320967145"]
@ -2387,7 +2392,7 @@ UPC-E is a zero-compressed version of UPC-A developed for smaller packages. The
code requires a 6-digit article number (digits 0-9). The check digit is
calculated by Zint. EAN-2 and EAN-5 add-on symbols can be added using the +
character as with UPC-A. In addition Zint also supports Number System 1 encoding
by entering a 7-digit article number stating with the digit 1. For example:
by entering a 7-digit article number starting with the digit 1. For example:
zint -b UPCE -d 1123456
@ -2443,8 +2448,8 @@ If you are encoding an EAN-8 or EAN-13 symbol and your data already includes the
check digit then you can use symbology BARCODE_EANX_CHK (14) which takes an 8 or
13-digit input and validates the check digit before encoding.
Options to adjust the add-on gap and the descent height of guard bars are the
same as for 6.1.3.2 UPC Version E.
Options to adjust the add-on gap and the guard bar descent height are the same
as for 6.1.3.2 UPC Version E.
6.1.4.2 SBN, ISBN and ISBN-13
@ -2455,7 +2460,7 @@ SBN, 10-digit ISBN or 13-digit ISBN-13 data. The relevant check digit needs to
be present in the input data and will be verified before the symbol is
generated. In addition EAN-2 and EAN-5 add-on symbols can be added using the +
character as with UPC symbols, and there are options to adjust the add-on gap
and the descent height of guard bars - see 6.1.3.2 UPC Version E.
and the guard bar descent height - see 6.1.3.2 UPC Version E.
6.1.5 Plessey
@ -2682,11 +2687,39 @@ a standard Code 128 symbol as required by the Health Industry Barcode standards.
6.1.10.7 DPD Code
[zint -b DPD --compliantheight -d "%000393206219912345678101040"]
[zint -b DPD --compliantheight -d "000393206219912345678101040"]
Another variation of Code 128 as used by DPD (Deutscher Paketdienst). Requires a
28 character alphanumeric input. Zint formats the Human Readable Text as
specified by DPD and adds a modulo-36 check character.
27 or 28 character input. For 28 character input, the first character is an
identification tag (Barcode ID), which should usually be "%" (ASCII 37). If 27
characters are supplied, "%" 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:
Destination Post Code Tracking Number Service Code Dest. Country Code
----------------------- -------------------- -------------- ----------------------
PPPPPPP TTTTTTTTTTTTTT SSS CCC
(7 alphanumerics) (14 alphanumerics) (3 digits) (3-digit ISO 3166-1)
: Table : DPD Input Fields:
A warning will be generated if the Service Code, the Destination Country Code,
or the last 10 characters of the Tracking Number are non-numeric.
Zint formats the Human Readable Text as specified by DPD, leaving out the
identication tag, and adds a modulo-36 check character to the text (not to the
barcode itself), thus:
PPPP PPP TTTT TTTT TTTT TT SSS CCC D
By default a top boundary bar is added, with default width 3X. The width can be
overridden using --border (API border_width). For a symbol with no top boundary
bar, explicitly set the border type to bindtop (or bind or box) and leave the
border width 0.
A DPD Code can be marked as a “relabel” by specifying --vers=1 (API
option_2 = 1), which omits the identification tag and prints the barcode at half
height. In this case, an input of 27 alphanumeric characters is required.
6.1.11 GS1 DataBar (ISO 24724)
@ -4191,12 +4224,17 @@ OPTIONS
--data inputs, in which case the width of the separator bars is specified
with the --separator option.
--bindtop
Add a horizontal boundary bar to the top of the symbol. The width of the
boundary bar is specified by the --border option.
--bold
Use bold text for the Human Readable Text (HRT).
--border=INTEGER
Set the width of boundary bars (--bind) or box borders (--box), where
INTEGER is in integral multiples of the X-dimension. The default is zero.
Set the width of boundary bars (--bind or --bindtop) or box borders (--box),
where INTEGER is in integral multiples of the X-dimension. The default is
zero.
--box
Add a box around the symbol. The width of the borders is specified by the
@ -4532,6 +4570,7 @@ OPTIONS
Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel)
Ultracode 2 (revision 2)
VIN 1 (add international prefix)
@ -4675,8 +4714,10 @@ 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).
[7] The BARCODE_BIND flag is always set for Codablock-F, Code 16K and Code 49.
[7] The BARCODE_BIND_TOP flag is set by default for DPD - see 6.1.10.7 DPD Code.
[8] 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.
[8] Codablock-F, Code 16K, Code 49, EAN-2 to EAN-13, ISBN, ITF-14, UPC-A and
[9] 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

@ -89,13 +89,18 @@ stacked with multiple \f[V]-d\f[R] | \f[V]--data\f[R] inputs, in which
case the width of the separator bars is specified with the
\f[V]--separator\f[R] option.
.TP
\f[V]--bindtop\f[R]
Add a horizontal boundary bar to the top of the symbol.
The width of the boundary bar is specified by the \f[V]--border\f[R]
option.
.TP
\f[V]--bold\f[R]
Use bold text for the Human Readable Text (HRT).
.TP
\f[V]--border=INTEGER\f[R]
Set the width of boundary bars (\f[V]--bind\f[R]) or box borders
(\f[V]--box\f[R]), where \f[I]INTEGER\f[R] is in integral multiples of
the X-dimension.
Set the width of boundary bars (\f[V]--bind\f[R] or \f[V]--bindtop\f[R])
or box borders (\f[V]--box\f[R]), where \f[I]INTEGER\f[R] is in integral
multiples of the X-dimension.
The default is zero.
.TP
\f[V]--box\f[R]
@ -461,6 +466,7 @@ For a few other symbologies, it specifies other characteristics:
\f[C]
Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel)
Ultracode 2 (revision 2)
VIN 1 (add international prefix)
\f[R]

View File

@ -56,12 +56,16 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
multiple `-d` | `--data` inputs, in which case the width of the separator bars is specified with the `--separator`
option.
`--bindtop`
: Add a horizontal boundary bar to the top of the symbol. The width of the boundary bar is specified by the
`--border` option.
`--bold`
: Use bold text for the Human Readable Text (HRT).
`--border=INTEGER`
: Set the width of boundary bars (`--bind`) or box borders (`--box`), where *INTEGER* is in integral multiples of
the X-dimension. The default is zero.
: Set the width of boundary bars (`--bind` or `--bindtop`) or box borders (`--box`), where *INTEGER* is in integral
multiples of the X-dimension. The default is zero.
`--box`
: Add a box around the symbol. The width of the borders is specified by the `--border` option.
@ -367,6 +371,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
Channel Code 3 to 8 (no. of channels)
DAFT 50 to 900 (permille tracker ratio)
DPD 1 (relabel)
Ultracode 2 (revision 2)
VIN 1 (add international prefix)

View File

@ -71,7 +71,7 @@ zint -b GS1_128 --compliantheight -d "[01]98898765432106[3202]012345[15]991231"
zint -b EAN14 --compliantheight -d "9889876543210" --scale=$SCALE_LINEAR -o images/ean14.svg
zint -b NVE18 --compliantheight -d "37612345000001003" --scale=$SCALE_LINEAR -o images/nve18.svg
zint -b HIBC_128 -d "A123BJC5D6E71" --scale=$SCALE_LINEAR -o images/hibc_128.svg
zint -b DPD --compliantheight -d "%000393206219912345678101040" --scale=$SCALE_LINEAR -o images/dpd.svg
zint -b DPD --compliantheight -d "000393206219912345678101040" --scale=$SCALE_LINEAR -o images/dpd.svg
zint -b DBAR_OMN --compliantheight -d "0950110153001" --scale=$SCALE_LINEAR -o images/dbar_omn.svg
zint -b DBAR_OMN -d "0950110153001" --height=13 --scale=$SCALE_LINEAR -o images/dbar_truncated.svg
zint -b DBAR_LTD --compliantheight -d "0950110153001" --scale=$SCALE_LINEAR -o images/dbar_ltd.svg

View File

@ -148,6 +148,7 @@ static void usage(int no_png) {
" --bg=COLOUR Specify a background colour (in hex RGB/RGBA)\n"
" --binary Treat input as raw binary data\n"
" --bind Add boundary bars\n"
" --bindtop Add top boundary bar only\n"
" --bold Use bold text\n"
" --border=NUMBER Set width of border in multiples of X-dimension\n"
" --box Add a box around the symbol\n"
@ -1015,7 +1016,7 @@ int main(int argc, char **argv) {
opterr = 0; /* Disable `getopt_long_only()` printing errors */
while (no_getopt_error) {
enum options {
OPT_ADDONGAP = 128, OPT_BATCH, OPT_BINARY, OPT_BG, OPT_BIND, OPT_BOLD, OPT_BORDER, OPT_BOX,
OPT_ADDONGAP = 128, OPT_BATCH, OPT_BINARY, OPT_BG, OPT_BIND, OPT_BIND_TOP, OPT_BOLD, OPT_BORDER, OPT_BOX,
OPT_CMYK, OPT_COLS, OPT_COMPLIANTHEIGHT, OPT_DIRECT, OPT_DMRE, OPT_DOTSIZE, OPT_DOTTY, OPT_DUMP,
OPT_ECI, OPT_ESC, OPT_FAST, OPT_FG, OPT_FILETYPE, OPT_FONTSIZE, OPT_FULLMULTIBYTE,
OPT_GS1, OPT_GS1NOCHECK, OPT_GS1PARENS, OPT_GSSEP, OPT_GUARDDESCENT,
@ -1034,6 +1035,7 @@ int main(int argc, char **argv) {
{"binary", 0, NULL, OPT_BINARY},
{"bg", 1, 0, OPT_BG},
{"bind", 0, NULL, OPT_BIND},
{"bindtop", 0, NULL, OPT_BIND_TOP},
{"bold", 0, NULL, OPT_BOLD},
{"border", 1, NULL, OPT_BORDER},
{"box", 0, NULL, OPT_BOX},
@ -1137,6 +1139,9 @@ int main(int argc, char **argv) {
case OPT_BIND:
my_symbol->output_options |= BARCODE_BIND;
break;
case OPT_BIND_TOP:
my_symbol->output_options |= BARCODE_BIND_TOP;
break;
case OPT_BOLD:
my_symbol->output_options |= BOLD_TEXT;
break;

View File

@ -234,6 +234,9 @@ static void arg_output_options(char *cmd, int output_options) {
if (output_options & BARCODE_BIND) {
sprintf(cmd + (int) strlen(cmd), "%s--bind", strlen(cmd) ? " " : "");
}
if (output_options & BARCODE_BIND_TOP) {
sprintf(cmd + (int) strlen(cmd), "%s--bindtop", strlen(cmd) ? " " : "");
}
if (output_options & BARCODE_BOX) {
sprintf(cmd + (int) strlen(cmd), "%s--box", strlen(cmd) ? " " : "");
}
@ -307,7 +310,7 @@ static void test_dump_args(const testCtx *const p_ctx) {
/* 5*/ { BARCODE_CODE128, NULL, NULL, "123\n45\n", "7\n",-1, -1, 1, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "Warning 144: Processing first input file 'test_dump_args1.txt' only\nD2 13 9B 39 65 C8 C9 8E B\nD3 97 62 3B 63 AC" },
/* 6*/ { BARCODE_CODE128, "\t", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "D0 90 D2 1A 63 AC" },
/* 7*/ { BARCODE_CODE128, "\\t", NULL, NULL, NULL, ESCAPE_MODE, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "D0 90 D2 1A 63 AC" },
/* 8*/ { BARCODE_CODE128, "123", NULL, NULL, NULL, -1, BARCODE_BIND | BARCODE_BOX | SMALL_TEXT | BOLD_TEXT | CMYK_COLOUR, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "D2 13 9B 39 65 C8 C9 8E B" },
/* 8*/ { BARCODE_CODE128, "123", NULL, NULL, NULL, -1, BARCODE_BIND | BARCODE_BOX | BARCODE_BIND_TOP | SMALL_TEXT | BOLD_TEXT | CMYK_COLOUR, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "D2 13 9B 39 65 C8 C9 8E B" },
/* 9*/ { BARCODE_CODE128, "123", NULL, NULL, NULL, -1, BARCODE_DOTTY_MODE, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "Error 224: Selected symbology cannot be rendered as dots" },
/* 10*/ { BARCODE_CODABLOCKF, "ABCDEF", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "D0 97 BA 86 51 88 B1 11 AC 46 D8 C7 58\nD0 97 BB 12 46 88 C5 1A 3C 55 CC C7 58" },
/* 11*/ { BARCODE_CODABLOCKF, "ABCDEF", NULL, NULL, NULL, -1, -1, 0, 10, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "D0 97 BA 86 51 88 B1 11 AC 44 68 BC 98 EB\nD0 97 BB 12 46 2B BD 7B A3 47 8A 8D 18 EB" },
@ -332,12 +335,12 @@ static void test_dump_args(const testCtx *const p_ctx) {
/* 30*/ { BARCODE_DATAMATRIX, "(9\\x31)12(92)34", NULL, NULL, NULL, GS1_MODE | ESCAPE_MODE | GS1PARENS_MODE, GS1_GS_SEPARATOR, 0, -1, 0, -1, 0, -1, -1, NULL, -1, -1, 0, -1, "AA A8\nF9 DC\nBF 20\nD6 C4\nED 10\nA0 0C\nA7 C0\n96 5C\nBA 70\nBB A4\nE2 18\nDD 14\n9C 40\nFF FC" },
/* 31*/ { BARCODE_EANX_CC, "[91]12", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, "12345678+12", -1, -1, 0, -1, "DB BC D3 9C 44 E9 D2 2C 19 E7 A2 D8 A0 00 00 00\nDB 31 1C 9C C7 29 92 47 D9 E9 40 C8 A0 00 00 00\nDA 3B EB 10 AF 09 9A 18 9D 7D 82 E8 A0 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n20 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n14 68 D1 A6 49 BD 55 C9 D4 22 48 B9 40 59 94 98" },
/* 32*/ { BARCODE_EANX_CC, "[91]12", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, 2, "12345678+12", -1, -1, 0, -1, "D3 A3 E9 DB F5 C9 DB 43 D9 CB 98 D2 20 00 00 00\nD3 25 0F 11 E4 49 D3 51 F1 AC FC D6 20 00 00 00\nD1 33 48 19 39 E9 93 18 49 D8 98 D7 20 00 00 00\nD1 A6 FC DA 1C 49 9B C5 05 E2 84 D7 A0 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n20 00 00 00 00 00 00 00 00 00 00 00 20 00 00 00\n10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00\n14 68 D1 A6 49 BD 55 C9 D4 22 48 B9 40 59 94 98" },
/* 33*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, 1, 0, -1, "Warning 543: Converted to Shift JIS but no ECI specified\nFE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 33*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, 1, 0, -1, "Warning 760: Converted to Shift JIS but no ECI specified\nFE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 34*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, 0, 26, 0, -1, -1, NULL, -1, 1, 0, -1, "FE 5B F8\n82 72 08\nBA DA E8\nBA 52 E8\nBA 2A E8\n82 0A 08\nFE AB F8\n00 D8 00\nEF F6 20\nB5 C2 28\n36 28 88\nFD 42 10\n62 2A C8\n00 95 70\nFE B7 38\n82 FD D8\nBA 97 00\nBA 43 60\nBA C8 C8\n82 C3 68\nFE EA F8" },
/* 35*/ { BARCODE_QRCODE, "\223\137", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, 0, -1, 0, -1, -1, NULL, -1, 1, 0, -1, "FE 2B F8\n82 0A 08\nBA A2 E8\nBA 0A E8\nBA 5A E8\n82 72 08\nFE AB F8\n00 A0 00\nEF AE 20\n75 B5 20\n82 F7 58\nF4 9D C8\n5E 17 28\n00 C2 20\nFE 88 80\n82 82 38\nBA EA A8\nBA 55 50\nBA D7 68\n82 BD D0\nFE B7 78" },
/* 36*/ { BARCODE_QRCODE, "\223\137", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, 0, -1, 1, -1, -1, NULL, -1, 1, 0, -1, "FE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 37*/ { BARCODE_QRCODE, "\\x93\\x5F", NULL, NULL, NULL, DATA_MODE | ESCAPE_MODE, -1, 0, -1, 0, -1, 1, -1, -1, NULL, -1, 1, 0, -1, "FE 2B F8\n82 AA 08\nBA B2 E8\nBA 0A E8\nBA FA E8\n82 E2 08\nFE AB F8\n00 80 00\nD3 3B B0\n60 95 68\n7A B3 A0\n1D 0F 98\nAA D7 30\n00 E6 A8\nFE DA D0\n82 42 20\nBA 0E 38\nBA C7 18\nBA 17 68\n82 B9 40\nFE C5 28" },
/* 38*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, 2, -1, NULL, -1, 1, 0, -1, "Warning 543: Converted to Shift JIS but no ECI specified\nFE 4B F8\n82 92 08\nBA 42 E8\nBA 92 E8\nBA 3A E8\n82 EA 08\nFE AB F8\n00 38 00\nFB CD 50\nA5 89 18\n0B 74 B8\nFC 81 A0\n92 34 B8\n00 DE 48\nFE AB 10\n82 5E 50\nBA C9 20\nBA C9 20\nBA F4 E0\n82 81 A0\nFE B4 E8" },
/* 38*/ { BARCODE_QRCODE, "", NULL, NULL, NULL, -1, -1, 0, -1, 0, -1, 0, 2, -1, NULL, -1, 1, 0, -1, "Warning 760: Converted to Shift JIS but no ECI specified\nFE 4B F8\n82 92 08\nBA 42 E8\nBA 92 E8\nBA 3A E8\n82 EA 08\nFE AB F8\n00 38 00\nFB CD 50\nA5 89 18\n0B 74 B8\nFC 81 A0\n92 34 B8\n00 DE 48\nFE AB 10\n82 5E 50\nBA C9 20\nBA C9 20\nBA F4 E0\n82 81 A0\nFE B4 E8" },
/* 39*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, 0, -1, 1, -1, -1, NULL, -1, -1, 0, -1, "FE 8A FE\n80 28 02\nBE E8 FA\nA0 94 0A\nAE 3E EA\nAE D2 EA\nAE 74 EA\n00 AA 00\n15 B4 80\n0B 48 74\nA2 4A A4\nB5 56 2C\nA8 5A A8\n9F 18 50\n02 07 50\n00 A6 00\nFE 20 EA\n02 C2 EA\nFA C4 EA\n0A 42 0A\nEA 52 FA\nEA 24 02\nEA AA FE" },
/* 40*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, 0, -1, 1, 3, -1, NULL, -1, -1, 0, -1, "FE 16 FE\n80 E2 02\nBE C2 FA\nA0 A0 0A\nAE F6 EA\nAE 98 EA\nAE BA EA\n00 E0 00\n15 83 80\n44 7E AE\n92 9C 78\n25 BF 08\n47 4B 8C\n0D F9 74\n03 E7 50\n00 3A 00\nFE C2 EA\n02 22 EA\nFA DA EA\n0A 22 0A\nEA B2 FA\nEA 9A 02\nEA E8 FE" },
/* 41*/ { BARCODE_HANXIN, "é", NULL, NULL, NULL, DATA_MODE, -1, 0, -1, 0, -1, 1, 4, -1, NULL, -1, -1, 0, -1, "FE 8A FE\n80 28 02\nBE E8 FA\nA0 94 0A\nAE 3E EA\nAE D2 EA\nAE 74 EA\n00 AA 00\n15 B4 80\n0B 48 74\nA2 4A A4\nB5 56 2C\nA8 5A A8\n9F 18 50\n02 07 50\n00 A6 00\nFE 20 EA\n02 C2 EA\nFA C4 EA\n0A 42 0A\nEA 52 FA\nEA 24 02\nEA AA FE" },

View File

@ -18,11 +18,11 @@ else()
qt5_wrap_ui(zint-qt_SRCS mainWindow.ui extCLI.ui extData.ui extSequence.ui extExport.ui)
endif()
# grpAztec.ui grpC39.ui grpCodablockF.ui grpDotCode.ui grpMicroPDF.ui grpRMQR.ui grpVIN.ui
# grpC11.ui grpC49.ui grpCodeOne.ui grpGrid.ui grpMQR.ui grpUltra.ui
# grpC128.ui grpC93.ui grpDAFT.ui grpHX.ui grpMSICheck.ui grpUPCA.ui
# grpC16k.ui grpChannel.ui grpDBExtend.ui grpITF14.ui grpPDF417.ui grpUPCEAN.ui
# grpC25.ui grpCodabar.ui grpDM.ui grpMaxicode.ui grpQR.ui grpUPNQR.ui
# grpAztec.ui grpC39.ui grpCodablockF.ui grpDotCode.ui grpMaxicode.ui grpQR.ui grpUPNQR.ui
# grpC11.ui grpC49.ui grpCodeOne.ui grpDPD.ui grpMicroPDF.ui grpRMQR.ui grpVIN.ui
# grpC128.ui grpC93.ui grpDAFT.ui grpGrid.ui grpMQR.ui grpUltra.ui
# grpC16k.ui grpChannel.ui grpDBExtend.ui grpHX.ui grpMSICheck.ui grpUPCA.ui
# grpC25.ui grpCodabar.ui grpDM.ui grpITF14.ui grpPDF417.ui grpUPCEAN.ui
if(APPLE)
# https://doc.qt.io/qt-5/appicon.html

View File

@ -40,6 +40,7 @@ FORMS += extCLI.ui \
grpDBExtend.ui \
grpDM.ui \
grpDotCode.ui \
grpDPD.ui \
grpGrid.ui \
grpHX.ui \
grpITF14.ui \

View File

@ -32,6 +32,7 @@ FORMS += extCLI.ui \
grpDBExtend.ui \
grpDM.ui \
grpDotCode.ui \
grpDPD.ui \
grpGrid.ui \
grpHX.ui \
grpITF14.ui \

49
frontend_qt/grpDPD.ui Normal file
View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>grpDPD</class>
<widget class="QWidget" name="grpDPD">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>254</width>
<height>131</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="chkDPDRelabel">
<property name="text">
<string>Mark as &amp;Relabel</string>
</property>
<property name="toolTip">
<string>Omit the identification tag and
print at half-height;
Input is 27 characters</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -912,7 +912,7 @@ Extended Channel Interpretation (ECI)</string>
<widget class="QLineEdit" name="txtDataSeg1">
<property name="minimumSize">
<size>
<width>200</width>
<width>150</width>
<height>0</height>
</size>
</property>
@ -1173,7 +1173,7 @@ or import from file</string>
<widget class="QLineEdit" name="txtDataSeg2">
<property name="minimumSize">
<size>
<width>200</width>
<width>150</width>
<height>0</height>
</size>
</property>
@ -1434,7 +1434,7 @@ or import from file</string>
<widget class="QLineEdit" name="txtDataSeg3">
<property name="minimumSize">
<size>
<width>200</width>
<width>150</width>
<height>0</height>
</size>
</property>
@ -1765,6 +1765,11 @@ and use standard height (if any) for default
<string>Box</string>
</property>
</item>
<item>
<property name="text">
<string>Bind Top</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">

View File

@ -1154,7 +1154,9 @@ void MainWindow::structapp_ui_set()
void MainWindow::on_encoded()
{
if (QApplication::activeModalWidget() != nullptr) { // Protect against encode in popup dialog
// Protect against encode in Sequence Export popup dialog
QWidget *activeModalWidget = QApplication::activeModalWidget();
if (activeModalWidget != nullptr && activeModalWidget->objectName() == "ExportDialog") {
return;
}
enableActions();
@ -1173,7 +1175,9 @@ void MainWindow::on_encoded()
void MainWindow::on_errored()
{
if (QApplication::activeModalWidget() != nullptr) { // Protect against error in popup dialog (Sequence Export)
// Protect against error in Sequence Export popup dialog
QWidget *activeModalWidget = QApplication::activeModalWidget();
if (activeModalWidget != nullptr && activeModalWidget->objectName() == "ExportDialog") {
return;
}
enableActions();
@ -1700,6 +1704,17 @@ void MainWindow::change_options()
connect(get_widget(QSL("spnDAFTTrackerRatio")), SIGNAL(valueChanged( double )), SLOT(update_preview()));
}
} else if (symbology == BARCODE_DPD) {
btype->setItemText(0, tr("Default (bind top, 3X width)"));
QFile file(QSL(":/grpDPD.ui"));
if (file.open(QIODevice::ReadOnly)) {
m_optionWidget = uiload.load(&file);
file.close();
load_sub_settings(settings, symbology);
tabMain->insertTab(1, m_optionWidget, tr("DPD Cod&e"));
connect(get_widget(QSL("chkDPDRelabel")), SIGNAL(toggled( bool )), SLOT(update_preview()));
}
} else if (symbology == BARCODE_DATAMATRIX) {
QFile file(QSL(":/grpDM.ui"));
if (!file.open(QIODevice::ReadOnly))
@ -1724,7 +1739,7 @@ void MainWindow::change_options()
connect(get_widget(QSL("spnDMStructAppID2")), SIGNAL(valueChanged( int )), SLOT(update_preview()));
} else if (symbology == BARCODE_ITF14) {
btype->setItemText(0, tr("Default (box, non-zero width)"));
btype->setItemText(0, tr("Default (box, 5X width)"));
QFile file(QSL(":/grpITF14.ui"));
if (file.open(QIODevice::ReadOnly)) {
m_optionWidget = uiload.load(&file);
@ -2602,6 +2617,13 @@ void MainWindow::update_preview()
m_bc.bc.setOption2((int) (get_dspn_val(QSL("spnDAFTTrackerRatio")) * 10));
break;
case BARCODE_DPD:
m_bc.bc.setSymbol(BARCODE_DPD);
if (get_chk_val(QSL("chkDPDRelabel"))) {
m_bc.bc.setOption2(1);
}
break;
case BARCODE_DATAMATRIX:
if (get_rad_val(QSL("radDM200HIBC")))
m_bc.bc.setSymbol(BARCODE_HIBC_DM);
@ -3806,6 +3828,10 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology)
QString::number(get_dspn_val(QSL("spnDAFTTrackerRatio")), 'f', 1 /*precision*/));
break;
case BARCODE_DPD:
settings.setValue(QSL("studio/bc/dpd/chk_relabel"), get_chk_val(QSL("chkDPDRelabel")));
break;
case BARCODE_DATAMATRIX:
case BARCODE_HIBC_DM:
settings.setValue(QSL("studio/bc/datamatrix/size"), get_cmb_index(QSL("cmbDM200Size")));
@ -4195,6 +4221,10 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
set_dspn_from_setting(settings, QSL("studio/bc/daft/tracker_ratio"), QSL("spnDAFTTrackerRatio"), 25.0f);
break;
case BARCODE_DPD:
set_chk_from_setting(settings, QSL("studio/bc/dpd/chk_relabel"), QSL("chkDPDRelabel"));
break;
case BARCODE_DATAMATRIX:
case BARCODE_HIBC_DM:
set_cmb_from_setting(settings, QSL("studio/bc/datamatrix/size"), QSL("cmbDM200Size"));

View File

@ -16,6 +16,7 @@
<file>grpDBExtend.ui</file>
<file>grpDM.ui</file>
<file>grpDotCode.ui</file>
<file>grpDPD.ui</file>
<file>grpGrid.ui</file>
<file>grpHX.ui</file>
<file>grpITF14.ui</file>