UPC/EAN: Add guard_bar descent (guard_descent)

zint.h: Adjust field order to improve alignments; encoded_data 143 -> 144
This commit is contained in:
gitlost 2021-09-22 00:04:15 +01:00
parent 9bae0b86f9
commit 4009c86c5f
18 changed files with 791 additions and 335 deletions

View File

@ -20,6 +20,7 @@ Changes
scale (0.01-100), height (0-500), whitespace_width/height (0-100),
border_width (0-100)
- CLI: allow both e.g. '-height' and '--height' (getopt_long_only())
- UPC/EAN: add guard_descent
Bugs
----

View File

@ -57,6 +57,7 @@ struct zint_symbol *ZBarcode_Create() {
memset(symbol, 0, sizeof(*symbol));
symbol->symbology = BARCODE_CODE128;
symbol->scale = 1.0f;
strcpy(symbol->fgcolour, "000000");
symbol->fgcolor = &symbol->fgcolour[0];
strcpy(symbol->bgcolour, "ffffff");
@ -66,17 +67,17 @@ struct zint_symbol *ZBarcode_Create() {
#else
strcpy(symbol->outfile, "out.png");
#endif
symbol->scale = 1.0f;
symbol->option_1 = -1;
symbol->show_hrt = 1; // Show human readable text
symbol->fontsize = 8;
symbol->input_mode = DATA_MODE;
symbol->bitmap = NULL;
symbol->alphamap = NULL;
symbol->eci = 0; // Default 0 uses ECI 3
symbol->dot_size = 4.0f / 5.0f;
symbol->vector = NULL;
symbol->guard_descent = 5.0f;
symbol->warn_level = WARN_DEFAULT;
symbol->bitmap = NULL;
symbol->alphamap = NULL;
symbol->vector = NULL;
return symbol;
}
@ -1050,23 +1051,26 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
}
if ((symbol->scale < 0.01f) || (symbol->scale > 100.0f)) {
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "227: Scale out of range (0.01-100)");
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "227: Scale out of range (0.01 to 100)");
}
if ((symbol->dot_size < 0.01f) || (symbol->dot_size > 20.0f)) {
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "221: Dot size out of range (0.01-20)");
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "221: Dot size out of range (0.01 to 20)");
}
if ((symbol->height < 0.0f) || (symbol->height > 500.0f)) {
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "765: Height out of range (0-500)");
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "765: Height out of range (0 to 500)");
}
if ((symbol->guard_descent < 0.0f) || (symbol->guard_descent > 50.0f)) {
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "769: Guard bar descent out of range (0 to 50)");
}
if ((symbol->whitespace_width < 0) || (symbol->whitespace_width > 100)) {
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "766: Whitespace width out of range (0-100)");
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "766: Whitespace width out of range (0 to 100)");
}
if ((symbol->whitespace_height < 0) || (symbol->whitespace_height > 100)) {
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "767: Whitespace height out of range (0-100)");
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "767: Whitespace height out of range (0 to 100)");
}
if ((symbol->border_width < 0) || (symbol->border_width > 100)) {
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "768: Border width out of range (0-100)");
return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "768: Border width out of range (0 to 100)");
}
if ((symbol->input_mode & 0x07) > 2) {

View File

@ -124,7 +124,7 @@ static int buffer_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf
}
for (row = 0; row < symbol->bitmap_height; row++) {
int p = row * symbol->bitmap_width;
int pe = p + symbol->bitmap_width;
const int pe = p + symbol->bitmap_width;
bitmap = symbol->bitmap + p * 3;
for (; p < pe; p++, bitmap += 3) {
memcpy(bitmap, map[pixelbuf[p]], 3);
@ -133,9 +133,9 @@ static int buffer_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf
}
} else {
for (row = 0; row < symbol->bitmap_height; row++) {
int r = row * symbol->bitmap_width;
const int r = row * symbol->bitmap_width;
const unsigned char *pb = pixelbuf + r;
const unsigned char *pe = pb + symbol->bitmap_width;
const unsigned char *const pe = pb + symbol->bitmap_width;
bitmap = symbol->bitmap + r * 3;
for (; pb < pe; pb++, bitmap += 3) {
memcpy(bitmap, map[*pb], 3);
@ -448,7 +448,7 @@ static void draw_circle(unsigned char *pixelbuf, const int image_width, const in
}
}
/* Helper for `draw_wp_circle()` to draw horizontal filler lines within disc */
/* Helper for `draw_mp_circle()` to draw horizontal filler lines within disc */
static void draw_mp_circle_lines(unsigned char *pixelbuf, const int image_width, const int image_height,
const int x0, const int y0, const int x, const int y, const int fill) {
int i;
@ -884,7 +884,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
int i, r;
int text_height; /* Font pixel size (so whole integers) */
float text_gap; /* Gap between barcode and text */
float guard_height;
float guard_descent;
int textflags = 0;
int xoffset_si, yoffset_si, roffset_si, boffset_si;
@ -925,21 +925,25 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
textflags = UPCEAN_TEXT | (symbol->output_options & SMALL_TEXT); /* Bold not available for UPC/EAN */
text_height = (UPCEAN_FONT_HEIGHT + 1) / 2;
text_gap = 1.0f;
/* Guard bar height (none for EAN-2 and EAN-5) */
guard_height = upceanflag != 2 && upceanflag != 5 ? 5.0f : 0.0f; /* TODO: use zint_symbol field */
/* Height of guard bar descent (none for EAN-2 and EAN-5) */
guard_descent = upceanflag != 2 && upceanflag != 5 ? symbol->guard_descent : 0.0f;
} else {
textflags = symbol->output_options & (SMALL_TEXT | BOLD_TEXT);
text_height = textflags & SMALL_TEXT ? (SMALL_FONT_HEIGHT + 1) / 2 : (NORMAL_FONT_HEIGHT + 1) / 2;
text_gap = 1.0f;
guard_height = 0.0f;
guard_descent = 0.0f;
}
hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0) || scaler < 1.0f);
if (hide_text) {
textoffset = guard_height;
textoffset = guard_descent;
} else {
textoffset = (text_height > guard_height ? text_height : guard_height) + text_gap;
if (text_height + text_gap > guard_descent) {
textoffset = text_height + text_gap;
} else {
textoffset = guard_descent;
}
}
image_width = symbol->width * si + xoffset_si + roffset_si;
@ -992,7 +996,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
addon_text_yposn = yposn * si;
addon_row_height = row_height - (text_height + text_gap);
if (upceanflag != 12 && upceanflag != 6) { /* UPC-A/E add-ons don't descend */
addon_row_height += guard_height;
addon_row_height += guard_descent;
}
if (addon_row_height < 0.5f) {
addon_row_height = 0.5f;
@ -1017,32 +1021,32 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
if (upceanflag) {
/* Guard bar extension */
int guard_yoffset_si = yoffset_si + symbol_height_si;
int guard_height_si = guard_height * si;
int guard_descent_si = guard_descent * si;
if (upceanflag == 6) { /* UPC-E */
draw_bar(pixelbuf, 0 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 0 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 2 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 2 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 46 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 46 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 48 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 48 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 50 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 50 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
} else if (upceanflag == 8) { /* EAN-8 */
draw_bar(pixelbuf, 0 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 0 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 2 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 2 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 32 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 32 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 34 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 34 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 64 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 64 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 66 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 66 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
} else if (upceanflag == 12) { /* UPC-A */
@ -1059,7 +1063,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
if (latch == 1) {
/* a bar */
draw_bar(pixelbuf, i * si + xoffset_si, block_width * si,
guard_yoffset_si, guard_height_si, image_width, image_height, DEFAULT_INK);
guard_yoffset_si, guard_descent_si, image_width, image_height, DEFAULT_INK);
latch = 0;
} else {
/* a space */
@ -1067,9 +1071,9 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
}
i += block_width;
} while (i < 11 + comp_xoffset);
draw_bar(pixelbuf, 46 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 46 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 48 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 48 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
latch = 1;
i = 85 + comp_xoffset;
@ -1083,7 +1087,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
if (latch == 1) {
/* a bar */
draw_bar(pixelbuf, i * si + xoffset_si, block_width * si,
guard_yoffset_si, guard_height_si, image_width, image_height, DEFAULT_INK);
guard_yoffset_si, guard_descent_si, image_width, image_height, DEFAULT_INK);
latch = 0;
} else {
/* a space */
@ -1093,17 +1097,17 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
} while (i < 96 + comp_xoffset);
} else if (upceanflag == 13) { /* EAN-13 */
draw_bar(pixelbuf, 0 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 0 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 2 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 2 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 46 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 46 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 48 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 48 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 92 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 92 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 94 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_height_si,
draw_bar(pixelbuf, 94 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, guard_descent_si,
image_width, image_height, DEFAULT_INK);
}
}

View File

@ -49,6 +49,7 @@ static void test_checks(int index, int debug) {
int border_width;
float scale;
float dot_size;
float guard_descent;
int warn_level;
int ret;
@ -57,157 +58,159 @@ static void test_checks(int index, int debug) {
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", -1 },
/* 1*/ { BARCODE_CODE128, -1, "1234", -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, 0, "", -1 },
/* 2*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, -1, 0, "", -1 },
/* 3*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 999999 + 1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI mode", -1 },
/* 4*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 0.009, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01-100)", -1 },
/* 5*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 100.01, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01-100)", -1 },
/* 6*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, -1, 20.1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01-20)", -1 },
/* 7*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 0.01, 0.009, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01-20)", -1 },
/* 8*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, -0.1, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 765: Height out of range (0-500)", -1 },
/* 9*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 500.01, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 765: Height out of range (0-500)", -1 },
/* 10*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, -1, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 766: Whitespace width out of range (0-100)", -1 },
/* 11*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 101, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 766: Whitespace width out of range (0-100)", -1 },
/* 12*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 767: Whitespace height out of range (0-100)", -1 },
/* 13*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 101, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 767: Whitespace height out of range (0-100)", -1 },
/* 14*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 768: Border width out of range (0-100)", -1 },
/* 15*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 101, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 768: Border width out of range (0-100)", -1 },
/* 16*/ { BARCODE_CODE128, -1, "1234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode", -1 },
/* 17*/ { BARCODE_GS1_128, -1, "[21]12\0004", 8, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 262: NUL characters not permitted in GS1 mode", -1 },
/* 18*/ { BARCODE_GS1_128, -1, "[21]12é4", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1", -1 },
/* 19*/ { BARCODE_GS1_128, -1, "[21]12\0074", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 251: Control characters are not supported by GS1", -1 },
/* 20*/ { BARCODE_GS1_128, -1, "[21]1234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", -1 },
/* 21*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
/* 22*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/* 23*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, // Not supporting beats invalid ECI
/* 24*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/* 25*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01-20)", BARCODE_CODE128 },
/* 26*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/* 27*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, 0.009, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, // Invalid dot size no longer beats invalid ECI
/* 28*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/* 29*/ { 5, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_C25STANDARD },
/* 30*/ { 5, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_C25STANDARD },
/* 31*/ { 10, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_EANX },
/* 32*/ { 10, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
/* 33*/ { 11, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_EANX },
/* 34*/ { 11, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
/* 35*/ { 12, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_EANX },
/* 36*/ { 12, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
/* 37*/ { 15, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_EANX },
/* 38*/ { 15, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
/* 39*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_UPCA },
/* 40*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
/* 41*/ { 19, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input too short (3 character minimum)", BARCODE_CODABAR },
/* 42*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 207: Codabar 18 not supported", BARCODE_CODABAR },
/* 43*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 207: Codabar 18 not supported", -1 },
/* 44*/ { 26, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_UPCA },
/* 45*/ { 26, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
/* 46*/ { 27, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 208: UPCD1 not supported", 27 },
/* 47*/ { 33, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 },
/* 48*/ { 33, -1, "[10]23", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_GS1_128 },
/* 49*/ { 33, -1, "[10]23", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 },
/* 50*/ { 36, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_UPCA },
/* 51*/ { 36, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
/* 52*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_UPCE },
/* 53*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCE },
/* 54*/ { 41, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 479: Input length is not standard (5, 9 or 11 characters)", BARCODE_POSTNET },
/* 55*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 56*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 57*/ { 42, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 58*/ { 42, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 59*/ { 43, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 60*/ { 43, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 61*/ { 44, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 62*/ { 44, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 63*/ { 45, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 64*/ { 45, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 65*/ { 46, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_PLESSEY },
/* 66*/ { 46, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLESSEY },
/* 67*/ { 48, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_NVE18 },
/* 68*/ { 48, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_NVE18 },
/* 69*/ { 54, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 210: General Parcel Code not supported", BARCODE_CODE128 },
/* 70*/ { 54, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 210: General Parcel Code not supported", -1 },
/* 71*/ { 59, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_CODE128 },
/* 72*/ { 59, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 },
/* 73*/ { 61, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_CODE128 },
/* 74*/ { 61, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 },
/* 75*/ { 62, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_CODE93 },
/* 76*/ { 62, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE93 },
/* 77*/ { 64, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_AUSPOST },
/* 78*/ { 64, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST },
/* 79*/ { 65, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_AUSPOST },
/* 80*/ { 65, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST },
/* 81*/ { 78, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_DBAR_OMN },
/* 82*/ { 78, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_DBAR_OMN },
/* 83*/ { 83, -1, "12345678901", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_PLANET },
/* 84*/ { 83, -1, "12345678901", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLANET },
/* 85*/ { 88, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 },
/* 86*/ { 88, -1, "[10]12", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_GS1_128 },
/* 87*/ { 88, -1, "[10]12", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 },
/* 88*/ { 91, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 212: Symbology out of range", BARCODE_CODE128 },
/* 89*/ { 91, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 212: Symbology out of range", -1 },
/* 90*/ { 94, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 },
/* 91*/ { 94, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 },
/* 92*/ { 95, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 },
/* 93*/ { 95, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 },
/* 94*/ { 100, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_HIBC_128 },
/* 95*/ { 100, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_128 },
/* 96*/ { 101, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_HIBC_39 },
/* 97*/ { 101, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_39 },
/* 98*/ { 103, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_HIBC_DM },
/* 99*/ { 103, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_DM },
/*100*/ { 105, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_HIBC_QR },
/*101*/ { 105, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_QR },
/*102*/ { 107, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_HIBC_PDF },
/*103*/ { 107, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_PDF },
/*104*/ { 109, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_HIBC_MICPDF },
/*105*/ { 109, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_MICPDF },
/*106*/ { 111, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, 0, "", BARCODE_HIBC_BLOCKF },
/*107*/ { 111, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_BLOCKF },
/*108*/ { 113, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 },
/*109*/ { 113, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 },
/*110*/ { 114, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 },
/*111*/ { 114, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 },
/*112*/ { 117, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*113*/ { 117, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*114*/ { 118, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*115*/ { 118, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*116*/ { 119, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*117*/ { 119, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*118*/ { 120, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*119*/ { 120, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*120*/ { 122, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*121*/ { 122, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*122*/ { 123, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*123*/ { 123, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*124*/ { 124, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*125*/ { 124, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*126*/ { 125, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*127*/ { 125, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*128*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*129*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*130*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*131*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*132*/ { 146, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 },
/*133*/ { 146, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 },
/*134*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 },
/*135*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
/*136*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
/*137*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, 0, "", -1 },
/*138*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*139*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
/*140*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 },
/*141*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 },
/*142*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, // Warning in encoder overrides library warnings
/*143*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, // But not errors
/*144*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, 0, "", -1 },
/*145*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*146*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
/*147*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 },
/*148*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 },
/*149*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, // ECI warning trumps all other warnings
/*150*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, // But not errors
/* 0*/ { BARCODE_CODE128, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", -1 },
/* 1*/ { BARCODE_CODE128, -1, "1234", -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 },
/* 2*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 },
/* 3*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 999999 + 1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI mode", -1 },
/* 4*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 0.009, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01 to 100)", -1 },
/* 5*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 100.01, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01 to 100)", -1 },
/* 6*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, -1, 20.1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", -1 },
/* 7*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 0.01, 0.009, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", -1 },
/* 8*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, -0.1, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 765: Height out of range (0 to 500)", -1 },
/* 9*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 500.01, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 765: Height out of range (0 to 500)", -1 },
/* 10*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, -1, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 766: Whitespace width out of range (0 to 100)", -1 },
/* 11*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 101, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 766: Whitespace width out of range (0 to 100)", -1 },
/* 12*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 767: Whitespace height out of range (0 to 100)", -1 },
/* 13*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 101, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 767: Whitespace height out of range (0 to 100)", -1 },
/* 14*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 768: Border width out of range (0 to 100)", -1 },
/* 15*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 101, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 768: Border width out of range (0 to 100)", -1 },
/* 16*/ { BARCODE_CODE128, -1, "1234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode", -1 },
/* 17*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, -0.5, -1, ZINT_ERROR_INVALID_OPTION, "Error 769: Guard bar descent out of range (0 to 50)", -1 },
/* 18*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, 50.1, -1, ZINT_ERROR_INVALID_OPTION, "Error 769: Guard bar descent out of range (0 to 50)", -1 },
/* 19*/ { BARCODE_GS1_128, -1, "[21]12\0004", 8, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 262: NUL characters not permitted in GS1 mode", -1 },
/* 20*/ { BARCODE_GS1_128, -1, "[21]12é4", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1", -1 },
/* 21*/ { BARCODE_GS1_128, -1, "[21]12\0074", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 251: Control characters are not supported by GS1", -1 },
/* 22*/ { BARCODE_GS1_128, -1, "[21]1234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 },
/* 23*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 },
/* 24*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/* 25*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, // Not supporting beats invalid ECI
/* 26*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/* 27*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", BARCODE_CODE128 },
/* 28*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/* 29*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, 0.009, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, // Invalid dot size no longer beats invalid ECI
/* 30*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 },
/* 31*/ { 5, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_C25STANDARD },
/* 32*/ { 5, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_C25STANDARD },
/* 33*/ { 10, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_EANX },
/* 34*/ { 10, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
/* 35*/ { 11, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_EANX },
/* 36*/ { 11, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
/* 37*/ { 12, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_EANX },
/* 38*/ { 12, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
/* 39*/ { 15, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_EANX },
/* 40*/ { 15, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX },
/* 41*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_UPCA },
/* 42*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
/* 43*/ { 19, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input too short (3 character minimum)", BARCODE_CODABAR },
/* 44*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 207: Codabar 18 not supported", BARCODE_CODABAR },
/* 45*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 207: Codabar 18 not supported", -1 },
/* 46*/ { 26, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_UPCA },
/* 47*/ { 26, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
/* 48*/ { 27, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 208: UPCD1 not supported", 27 },
/* 49*/ { 33, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 },
/* 50*/ { 33, -1, "[10]23", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_GS1_128 },
/* 51*/ { 33, -1, "[10]23", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 },
/* 52*/ { 36, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_UPCA },
/* 53*/ { 36, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA },
/* 54*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_UPCE },
/* 55*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCE },
/* 56*/ { 41, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 479: Input length is not standard (5, 9 or 11 characters)", BARCODE_POSTNET },
/* 57*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 58*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 59*/ { 42, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 60*/ { 42, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 61*/ { 43, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 62*/ { 43, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 63*/ { 44, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 64*/ { 44, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 65*/ { 45, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET },
/* 66*/ { 45, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET },
/* 67*/ { 46, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_PLESSEY },
/* 68*/ { 46, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLESSEY },
/* 69*/ { 48, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_NVE18 },
/* 70*/ { 48, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_NVE18 },
/* 71*/ { 54, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 210: General Parcel Code not supported", BARCODE_CODE128 },
/* 72*/ { 54, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 210: General Parcel Code not supported", -1 },
/* 73*/ { 59, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_CODE128 },
/* 74*/ { 59, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 },
/* 75*/ { 61, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_CODE128 },
/* 76*/ { 61, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 },
/* 77*/ { 62, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_CODE93 },
/* 78*/ { 62, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE93 },
/* 79*/ { 64, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_AUSPOST },
/* 80*/ { 64, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST },
/* 81*/ { 65, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_AUSPOST },
/* 82*/ { 65, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST },
/* 83*/ { 78, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_DBAR_OMN },
/* 84*/ { 78, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_DBAR_OMN },
/* 85*/ { 83, -1, "12345678901", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_PLANET },
/* 86*/ { 83, -1, "12345678901", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLANET },
/* 87*/ { 88, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 },
/* 88*/ { 88, -1, "[10]12", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_GS1_128 },
/* 89*/ { 88, -1, "[10]12", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 },
/* 90*/ { 91, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 212: Symbology out of range", BARCODE_CODE128 },
/* 91*/ { 91, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 212: Symbology out of range", -1 },
/* 92*/ { 94, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 },
/* 93*/ { 94, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 },
/* 94*/ { 95, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 },
/* 95*/ { 95, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 },
/* 96*/ { 100, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_128 },
/* 97*/ { 100, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_128 },
/* 98*/ { 101, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_39 },
/* 99*/ { 101, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_39 },
/*100*/ { 103, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_DM },
/*101*/ { 103, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_DM },
/*102*/ { 105, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_QR },
/*103*/ { 105, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_QR },
/*104*/ { 107, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_PDF },
/*105*/ { 107, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_PDF },
/*106*/ { 109, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_MICPDF },
/*107*/ { 109, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_MICPDF },
/*108*/ { 111, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_BLOCKF },
/*109*/ { 111, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_BLOCKF },
/*110*/ { 113, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 },
/*111*/ { 113, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 },
/*112*/ { 114, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 },
/*113*/ { 114, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 },
/*114*/ { 117, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*115*/ { 117, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*116*/ { 118, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*117*/ { 118, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*118*/ { 119, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*119*/ { 119, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*120*/ { 120, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*121*/ { 120, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*122*/ { 122, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*123*/ { 122, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*124*/ { 123, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*125*/ { 123, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*126*/ { 124, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*127*/ { 124, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*128*/ { 125, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*129*/ { 125, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*130*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*131*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*132*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 },
/*133*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 },
/*134*/ { 146, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 },
/*135*/ { 146, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 },
/*136*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 },
/*137*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
/*138*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 },
/*139*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 },
/*140*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*141*/ { BARCODE_QRCODE, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
/*142*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 },
/*143*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 },
/*144*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, // Warning in encoder overrides library warnings
/*145*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, // But not errors
/*146*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 },
/*147*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 },
/*148*/ { BARCODE_AZTEC, -1, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 },
/*149*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 },
/*150*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 },
/*151*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, // ECI warning trumps all other warnings
/*152*/ { BARCODE_AZTEC, 6, "", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, // But not errors
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -241,6 +244,9 @@ static void test_checks(int index, int debug) {
if (data[i].dot_size != -1) {
symbol->dot_size = data[i].dot_size;
}
if (data[i].guard_descent != -1) {
symbol->guard_descent = data[i].guard_descent;
}
if (data[i].warn_level != -1) {
symbol->warn_level = data[i].warn_level;
}

View File

@ -1040,6 +1040,121 @@ static void test_scale(int index, int debug) {
testFinish();
}
static void test_guard_descent(int index, int debug) {
struct item {
int symbology;
float guard_descent;
char *data;
int ret_raster;
float expected_height;
int expected_rows;
int expected_width;
int expected_bitmap_width;
int expected_bitmap_height;
int expected_set;
int expected_set_row;
int expected_set_rows;
int expected_set_col;
int expected_set_len;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 116, 1 /*set*/, 100 /*set_row*/, 100 + 10, 18, 2 },
/* 1*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 116, 0 /*set*/, 100 + 10 /*set_row*/, 100 + 16, 18, 2 },
/* 2*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 134, 116, 0 /*set*/, 100 /*set_row*/, 100 + 16, 18, 2 },
/* 3*/ { BARCODE_UPCE, 1.5, "1234567", 0, 50, 1, 51, 134, 116, 1 /*set*/, 100 /*set_row*/, 100 + 3, 18, 2 },
/* 4*/ { BARCODE_UPCE, 1.5, "1234567", 0, 50, 1, 51, 134, 116, 0 /*set*/, 100 + 3 /*set_row*/, 100 + 16, 18, 2 },
/* 5*/ { BARCODE_UPCE, 6, "1234567", 0, 50, 1, 51, 134, 116, 1 /*set*/, 100 /*set_row*/, 100 + 12, 18, 2 },
/* 6*/ { BARCODE_UPCE, 6, "1234567", 0, 50, 1, 51, 134, 116, 0 /*set*/, 100 + 12 /*set_row*/, 100 + 16, 18, 2 },
/* 7*/ { BARCODE_UPCE, 8, "1234567", 0, 50, 1, 51, 134, 116, 1 /*set*/, 100 /*set_row*/, 100 + 16, 18, 2 },
/* 8*/ { BARCODE_UPCE, 8.5, "1234567", 0, 50, 1, 51, 134, 117, 1 /*set*/, 100 /*set_row*/, 100 + 17, 18, 2 },
/* 9*/ { BARCODE_UPCE, 20, "1234567", 0, 50, 1, 51, 134, 140, 1 /*set*/, 100 /*set_row*/, 100 + 40, 18, 2 },
/* 10*/ { BARCODE_UPCE, -1, "1234567+12", 0, 50, 1, 78, 184, 116, 1 /*set*/, 100 /*set_row*/, 100 + 10, 18, 2 },
/* 11*/ { BARCODE_UPCE, -1, "1234567+12", 0, 50, 1, 78, 184, 116, 0 /*set*/, 100 /*set_row*/, 100 + 16, 134, 2 },
/* 12*/ { BARCODE_UPCE, 9, "1234567+12", 0, 50, 1, 78, 184, 118, 0 /*set*/, 100 /*set_row*/, 100 + 18, 134, 2 },
/* 13*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 226, 116, 1 /*set*/, 100 /*set_row*/, 100 + 10, 206, 2 },
/* 14*/ { BARCODE_UPCA, 0, "12345678901", 0, 50, 1, 95, 226, 116, 0 /*set*/, 100 /*set_row*/, 100 + 10, 206, 2 },
/* 15*/ { BARCODE_UPCA, 2.75, "12345678901", 0, 50, 1, 95, 226, 116, 1 /*set*/, 100 /*set_row*/, 100 + 5, 206, 2 },
/* 16*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116, 1 /*set*/, 100 /*set_row*/, 100 + 10, 206, 2 },
/* 17*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116, 0 /*set*/, 100 /*set_row*/, 100 + 16, 262, 4 },
/* 18*/ { BARCODE_UPCA, 10, "12345678901+12", 0, 50, 1, 124, 276, 120, 0 /*set*/, 100 /*set_row*/, 100 + 20, 262, 4 },
/* 19*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 226, 116, 1 /*set*/, 100 /*set_row*/, 100 + 10, 114, 2 },
/* 20*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 226, 116, 0 /*set*/, 100 + 10 /*set_row*/, 100 + 16, 114, 2 },
/* 21*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 226, 116, 0 /*set*/, 100 /*set_row*/, 100 + 16, 114, 2 },
/* 22*/ { BARCODE_EANX, 2, "123456789012", 0, 50, 1, 95, 226, 116, 1 /*set*/, 100 /*set_row*/, 100 + 4, 114, 2 },
/* 23*/ { BARCODE_EANX, 2, "123456789012", 0, 50, 1, 95, 226, 116, 0 /*set*/, 100 + 4 /*set_row*/, 100 + 16, 114, 2 },
/* 24*/ { BARCODE_EANX, -1, "123456789012+12345", 0, 50, 1, 149, 330, 116, 1 /*set*/, 100 /*set_row*/, 100 + 10, 308, 4 },
/* 25*/ { BARCODE_EANX, -1, "123456789012+12345", 0, 50, 1, 149, 330, 116, 0 /*set*/, 100 + 10 /*set_row*/, 100 + 16, 308, 4 },
/* 26*/ { BARCODE_EANX, 0, "123456789012+12345", 0, 50, 1, 149, 330, 116, 0 /*set*/, 100 /*set_row*/, 100 + 16, 308, 4 },
/* 27*/ { BARCODE_EANX, 18, "123456789012+12345", 0, 50, 1, 149, 330, 136, 1 /*set*/, 100 /*set_row*/, 100 + 36, 308, 4 },
/* 28*/ { BARCODE_ISBNX, -1, "123456789", 0, 50, 1, 95, 226, 116, 1 /*set*/, 100 /*set_row*/, 100 + 10, 206, 2 },
/* 29*/ { BARCODE_ISBNX, -1, "123456789", 0, 50, 1, 95, 226, 116, 0 /*set*/, 100 + 10 /*set_row*/, 100 + 16, 206, 2 },
/* 30*/ { BARCODE_ISBNX, 0, "123456789", 0, 50, 1, 95, 226, 116, 0 /*set*/, 100 /*set_row*/, 100 + 16, 206, 2 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol;
testStart("test_guard_descent");
for (i = 0; i < data_size; i++) {
int row, column;
if (index != -1 && i != index) continue;
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
if (data[i].guard_descent != -1.0f) {
symbol->guard_descent = data[i].guard_descent;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer(symbol, 0);
assert_equal(ret, data[i].ret_raster, "i:%d ZBarcode_Buffer(%d) ret %d != %d (%s)\n", i, data[i].symbology, ret, data[i].ret_raster, symbol->errtxt);
assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); // ZINT_DEBUG_TEST_PRINT 16
assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %.8g != %.8g\n", i, data[i].symbology, symbol->height, data[i].expected_height);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, data[i].symbology, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%d) symbol->width %d != %d\n", i, data[i].symbology, symbol->width, data[i].expected_width);
assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%d) symbol->bitmap_width %d != %d\n", i, data[i].symbology, symbol->bitmap_width, data[i].expected_bitmap_width);
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%d) symbol->bitmap_height %d != %d\n", i, data[i].symbology, symbol->bitmap_height, data[i].expected_bitmap_height);
ret = ZBarcode_Print(symbol, 0);
assert_equal(ret, data[i].ret_raster, "i:%d ZBarcode_Print(%d) ret %d != %d (%s)\n", i, data[i].symbology, ret, data[i].ret_raster, symbol->errtxt);
assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile);
assert_nonzero(symbol->bitmap_height >= data[i].expected_set_rows, "i:%d (%d) symbol->bitmap_height %d < expected_set_rows %d\n",
i, data[i].symbology, symbol->bitmap_height, data[i].expected_set_rows);
assert_nonzero(data[i].expected_set_rows > data[i].expected_set_row, "i:%d (%d) expected_set_rows %d < expected_set_row %d\n",
i, data[i].symbology, data[i].expected_set_rows, data[i].expected_set_row);
for (row = data[i].expected_set_row; row < data[i].expected_set_rows; row++) {
int bits_set = 0;
for (column = data[i].expected_set_col; column < data[i].expected_set_col + data[i].expected_set_len; column++) {
if (is_row_column_black(symbol, row, column)) {
bits_set++;
}
}
if (data[i].expected_set) {
assert_equal(bits_set, data[i].expected_set_len, "i:%d (%d) row %d bits_set %d != expected_set_len %d\n", i, data[i].symbology, row, bits_set, data[i].expected_set_len);
} else {
assert_zero(bits_set, "i:%d (%d) row %d bits_set %d != 0\n", i, data[i].symbology, row, bits_set);
}
}
ZBarcode_Delete(symbol);
}
testFinish();
}
static void test_buffer_plot(int index, int generate, int debug) {
struct item {
@ -1723,10 +1838,12 @@ int main(int argc, char *argv[]) {
{ "test_draw_string_wrap", test_draw_string_wrap, 1, 0, 1 },
{ "test_code128_utf8", test_code128_utf8, 1, 0, 1 },
{ "test_scale", test_scale, 1, 0, 1 },
{ "test_guard_descent", test_guard_descent, 1, 0, 1 },
{ "test_buffer_plot", test_buffer_plot, 1, 1, 1 },
{ "test_height", test_height, 1, 1, 1 },
};
printf("sizeof(zint_symbol) %d\n", (int)sizeof(struct zint_symbol));
testRun(argc, argv, funcs, ARRAY_SIZE(funcs));
testReport();

View File

@ -31,7 +31,7 @@
#include "testcommon.h"
static struct zint_vector_rect *find_rect(struct zint_symbol *symbol, float x, float y, float height, float width) {
static struct zint_vector_rect *find_rect(struct zint_symbol *symbol, float x, float y, float width, float height) {
struct zint_vector_rect *rect;
if (symbol->vector == NULL) {
@ -453,21 +453,21 @@ static void test_row_separator(int index, int debug) {
float expected_height;
int expected_rows;
int expected_width;
int expected_separator_row;
int expected_separator_col;
int expected_separator_x;
int expected_separator_y;
int expected_separator_height;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_CODABLOCKF, -1, -1, -1, "A", 0, 20, 2, 101, 21, 42, 2 },
/* 1*/ { BARCODE_CODABLOCKF, -1, -1, 0, "A", 0, 20, 2, 101, 21, 42, 2 }, // Same as default
/* 2*/ { BARCODE_CODABLOCKF, -1, -1, 1, "A", 0, 20, 2, 101, 21, 42, 2 }, // Same as default
/* 3*/ { BARCODE_CODABLOCKF, -1, -1, 2, "A", 0, 20, 2, 101, 20, 42, 4 },
/* 4*/ { BARCODE_CODABLOCKF, -1, -1, 3, "A", 0, 20, 2, 101, 19, 42, 6 },
/* 5*/ { BARCODE_CODABLOCKF, -1, -1, 4, "A", 0, 20, 2, 101, 18, 42, 8 },
/* 6*/ { BARCODE_CODABLOCKF, -1, -1, 5, "A", 0, 20, 2, 101, 21, 42, 2 }, // > 4 ignored, same as default
/* 7*/ { BARCODE_CODABLOCKF, -1, 1, -1, "A", 0, 5, 1, 46, 0, 20, 2 }, // CODE128 top separator
/* 8*/ { BARCODE_CODABLOCKF, 0, -1, -1, "A", 0, 20, 2, 101, 21, 42, 2 }, // Border width zero, same as default
/* 0*/ { BARCODE_CODABLOCKF, -1, -1, -1, "A", 0, 20, 2, 101, 42, 21, 2 },
/* 1*/ { BARCODE_CODABLOCKF, -1, -1, 0, "A", 0, 20, 2, 101, 42, 21, 2 }, // Same as default
/* 2*/ { BARCODE_CODABLOCKF, -1, -1, 1, "A", 0, 20, 2, 101, 42, 21, 2 }, // Same as default
/* 3*/ { BARCODE_CODABLOCKF, -1, -1, 2, "A", 0, 20, 2, 101, 42, 20, 4 },
/* 4*/ { BARCODE_CODABLOCKF, -1, -1, 3, "A", 0, 20, 2, 101, 42, 19, 6 },
/* 5*/ { BARCODE_CODABLOCKF, -1, -1, 4, "A", 0, 20, 2, 101, 42, 18, 8 },
/* 6*/ { BARCODE_CODABLOCKF, -1, -1, 5, "A", 0, 20, 2, 101, 42, 21, 2 }, // > 4 ignored, same as default
/* 7*/ { BARCODE_CODABLOCKF, -1, 1, -1, "A", 0, 5, 1, 46, 20, 0, 2 }, // CODE128 top separator
/* 8*/ { BARCODE_CODABLOCKF, 0, -1, -1, "A", 0, 20, 2, 101, 42, 21, 2 }, // Border width zero, same as default
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -500,8 +500,8 @@ static void test_row_separator(int index, int debug) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, data[i].symbology, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%d) symbol->width %d != %d\n", i, data[i].symbology, symbol->width, data[i].expected_width);
rect = find_rect(symbol, data[i].expected_separator_col, data[i].expected_separator_row, data[i].expected_separator_height, 0);
assert_nonnull(rect, "i:%d (%d) find_rect(%d, %d, %d) NULL\n", i, data[i].symbology, data[i].expected_separator_col, data[i].expected_separator_row, data[i].expected_separator_height);
rect = find_rect(symbol, data[i].expected_separator_x, data[i].expected_separator_y, 0, data[i].expected_separator_height);
assert_nonnull(rect, "i:%d (%d) find_rect(%d, %d, 0, %d) NULL\n", i, data[i].symbology, data[i].expected_separator_x, data[i].expected_separator_y, data[i].expected_separator_height);
ZBarcode_Delete(symbol);
}
@ -524,15 +524,15 @@ static void test_stacking(int index, int debug) {
int expected_width;
int expected_bitmap_width;
int expected_bitmap_height;
int expected_separator_row;
int expected_separator_col;
int expected_separator_x;
int expected_separator_y;
int expected_separator_height;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, -1, -1, "A", "B", 50, 2, 46, 92, 116, -1, -1, -1 },
/* 1*/ { BARCODE_CODE128, BARCODE_BIND, -1, -1, "A", "B", 50, 2, 46, 92, 116, 49, 0, 2 },
/* 2*/ { BARCODE_CODE128, BARCODE_BIND, -1, 2, "A", "B", 50, 2, 46, 92, 116, 48, 0, 4 },
/* 1*/ { BARCODE_CODE128, BARCODE_BIND, -1, -1, "A", "B", 50, 2, 46, 92, 116, 0, 49, 2 },
/* 2*/ { BARCODE_CODE128, BARCODE_BIND, -1, 2, "A", "B", 50, 2, 46, 92, 116, 0, 48, 4 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -566,7 +566,7 @@ static void test_stacking(int index, int debug) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, data[i].symbology, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%d) symbol->width %d != %d\n", i, data[i].symbology, symbol->width, data[i].expected_width);
if (data[i].expected_separator_row != -1) {
if (data[i].expected_separator_y != -1) {
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) {
sprintf(symbol->outfile, "test_stacking_%d.svg", i);
ZBarcode_Print(symbol, 0);
@ -580,8 +580,8 @@ static void test_stacking(int index, int debug) {
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, data[i].symbology, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%d) symbol->width %d != %d\n", i, data[i].symbology, symbol->width, data[i].expected_width);
rect = find_rect(symbol, data[i].expected_separator_col, data[i].expected_separator_row, data[i].expected_separator_height, 0);
assert_nonnull(rect, "i:%d (%d) find_rect(%d, %d, %d) NULL\n", i, data[i].symbology, data[i].expected_separator_col, data[i].expected_separator_row, data[i].expected_separator_height);
rect = find_rect(symbol, data[i].expected_separator_x, data[i].expected_separator_y, 0, data[i].expected_separator_height);
assert_nonnull(rect, "i:%d (%d) find_rect(%d, %d, 0, %d) NULL\n", i, data[i].symbology, data[i].expected_separator_x, data[i].expected_separator_y, data[i].expected_separator_height);
}
ZBarcode_Delete(symbol);
@ -607,8 +607,8 @@ static void test_output_options(int index, int debug) {
float expected_vector_width;
float expected_vector_height;
int expected_set;
float expected_set_row;
float expected_set_col;
float expected_set_x;
float expected_set_y;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
@ -706,11 +706,11 @@ static void test_output_options(int index, int debug) {
i, testUtilBarcodeName(data[i].symbology), symbol->vector->height, data[i].expected_vector_height);
if (data[i].expected_set != -1) {
rect = find_rect(symbol, data[i].expected_set_row, data[i].expected_set_col, 0, 0);
rect = find_rect(symbol, data[i].expected_set_x, data[i].expected_set_y, 0, 0);
if (data[i].expected_set) {
assert_nonnull(rect, "i:%d (%d) find_rect(%g, %g, 0, 0) NULL\n", i, data[i].symbology, data[i].expected_set_row, data[i].expected_set_col);
assert_nonnull(rect, "i:%d (%d) find_rect(%g, %g, 0, 0) NULL\n", i, data[i].symbology, data[i].expected_set_x, data[i].expected_set_y);
} else {
assert_null(rect, "i:%d (%d) find_rect(%g, %g, 0, 0) not NULL\n", i, data[i].symbology, data[i].expected_set_row, data[i].expected_set_col);
assert_null(rect, "i:%d (%d) find_rect(%g, %g, 0, 0) not NULL\n", i, data[i].symbology, data[i].expected_set_x, data[i].expected_set_y);
}
}
}
@ -847,6 +847,115 @@ static void test_upcean_whitespace_width(int index, int debug) {
testFinish();
}
static void test_guard_descent(int index, int debug) {
struct item {
int symbology;
float guard_descent;
char *data;
int ret;
float expected_height;
int expected_rows;
int expected_width;
float expected_vector_width;
float expected_vector_height;
float expected_set_x;
float expected_set_y;
float expected_set_width;
float expected_set_height;
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 110 },
/* 1*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 100 },
/* 2*/ { BARCODE_UPCE, 3, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 106 },
/* 3*/ { BARCODE_UPCE, 8, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 116 },
/* 4*/ { BARCODE_UPCE, 8.2, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 116.4 },
/* 5*/ { BARCODE_UPCE, 8.25, "1234567", 0, 50, 1, 51, 134, 116.5, 18, 0, 2, 116.5 },
/* 6*/ { BARCODE_UPCE, 8.3, "1234567", 0, 50, 1, 51, 134, 116.6, 18, 0, 2, 116.6 },
/* 7*/ { BARCODE_UPCE, 19.6, "1234567", 0, 50, 1, 51, 134, 139.2, 18, 0, 2, 139.2 },
/* 8*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 118, 0, 2, 110 },
/* 9*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 134, 19, 2, 81 },
/* 10*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 118, 0, 2, 100 },
/* 11*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 134, 19, 2, 81 },
/* 12*/ { BARCODE_UPCE, 4, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 118, 0, 2, 108 },
/* 13*/ { BARCODE_UPCE, 4, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 134, 19, 2, 81 },
/* 14*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 226, 116.4, 188, 0, 4, 110 },
/* 15*/ { BARCODE_UPCA, 0, "12345678901", 0, 50, 1, 95, 226, 116.4, 188, 0, 4, 100 },
/* 16*/ { BARCODE_UPCA, 6, "12345678901", 0, 50, 1, 95, 226, 116.4, 188, 0, 4, 112 },
/* 17*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116.4, 188, 0, 4, 110 },
/* 18*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116.4, 262, 19, 4, 81 },
/* 19*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 276, 116.4, 188, 0, 4, 100 },
/* 20*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 276, 116.4, 262, 19, 4, 81 },
/* 21*/ { BARCODE_UPCA, 9, "12345678901+12", 0, 50, 1, 124, 276, 118, 188, 0, 4, 118 },
/* 22*/ { BARCODE_UPCA, 9, "12345678901+12", 0, 50, 1, 124, 276, 118, 262, 19, 4, 81 },
/* 23*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 110 },
/* 24*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 100 },
/* 25*/ { BARCODE_EANX, 7, "123456789012", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 114 },
/* 26*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276, 116.4, 22, 0, 2, 110 },
/* 27*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276, 116.4, 262, 19, 4, 91 },
/* 28*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 122, 276, 116.4, 22, 0, 2, 100 },
/* 29*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 122, 276, 116.4, 262, 19, 4, 81 },
/* 30*/ { BARCODE_EANX, 8.21, "123456789012+12", 0, 50, 1, 122, 276, 116.42, 22, 0, 2, 116.42 },
/* 31*/ { BARCODE_EANX, 8.21, "123456789012+12", 0, 50, 1, 122, 276, 116.42, 262, 19, 4, 97.42 },
/* 32*/ { BARCODE_ISBNX, -1, "123456789", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 110 },
/* 33*/ { BARCODE_ISBNX, 0, "123456789", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 100 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
struct zint_symbol *symbol;
struct zint_vector_rect *rect;
testStart("test_guard_descent");
for (i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue;
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug);
if (data[i].guard_descent != -1.0f) {
symbol->guard_descent = data[i].guard_descent;
}
ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length);
assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Buffer_Vector(%d) ret %d != %d\n", i, data[i].symbology, ret, data[i].ret);
if (ret < 5) {
assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology);
if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) { // ZINT_DEBUG_TEST_PRINT 16
sprintf(symbol->outfile, "test_guard_descent_%d.svg", i);
ZBarcode_Print(symbol, 0);
}
assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %.8g != %.8g\n", i, data[i].symbology, symbol->height, data[i].expected_height);
assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, data[i].symbology, symbol->rows, data[i].expected_rows);
assert_equal(symbol->width, data[i].expected_width, "i:%d (%d) symbol->width %d != %d\n", i, data[i].symbology, symbol->width, data[i].expected_width);
assert_equal(symbol->vector->width, data[i].expected_vector_width, "i:%d (%s) symbol->vector->width %.8g != %.8g\n",
i, testUtilBarcodeName(data[i].symbology), symbol->vector->width, data[i].expected_vector_width);
assert_equal(symbol->vector->height, data[i].expected_vector_height, "i:%d (%s) symbol->vector->height %.8g != %.8g\n",
i, testUtilBarcodeName(data[i].symbology), symbol->vector->height, data[i].expected_vector_height);
rect = find_rect(symbol, data[i].expected_set_x, data[i].expected_set_y, data[i].expected_set_width, data[i].expected_set_height);
assert_nonnull(rect, "i:%d (%d) find_rect(%g, %g, %g, %g) NULL\n",
i, data[i].symbology, data[i].expected_set_x, data[i].expected_set_y, data[i].expected_set_width, data[i].expected_set_height);
}
ZBarcode_Delete(symbol);
}
testFinish();
}
static void test_height(int index, int generate, int debug) {
struct item {
@ -1338,6 +1447,7 @@ int main(int argc, char *argv[]) {
{ "test_output_options", test_output_options, 1, 0, 1 },
{ "test_noncomposite_string_x", test_noncomposite_string_x, 1, 0, 1 },
{ "test_upcean_whitespace_width", test_upcean_whitespace_width, 1, 0, 1 },
{ "test_guard_descent", test_guard_descent, 1, 0, 1 },
{ "test_height", test_height, 1, 1, 1 },
};

View File

@ -411,7 +411,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
int i, r;
int text_height; /* Font pixel size (so whole integers) */
float text_gap; /* Gap between barcode and text */
float guard_height;
float guard_descent;
int upcae_outside_text_height = 0; /* UPC-A/E outside digits font size */
float digit_ascent_factor = 0.25f; /* Assuming digit ascent roughly 25% less than font size */
@ -464,21 +464,25 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
/* Negative to move close to barcode (less digit ascent, then add 0.5X) */
text_gap = -text_height * digit_ascent_factor + 0.5f;
/* Guard bar height (none for EAN-2 and EAN-5) */
guard_height = upceanflag != 2 && upceanflag != 5 ? 5.0f : 0.0f; /* TODO: use zint_symbol field */
guard_descent = upceanflag != 2 && upceanflag != 5 ? symbol->guard_descent : 0.0f;
} else {
text_height = symbol->output_options & SMALL_TEXT ? 6 : 7;
text_gap = text_height * 0.1f;
guard_height = 0.0f;
guard_descent = 0.0f;
}
hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0));
if (hide_text) {
textoffset = guard_height;
textoffset = guard_descent;
} else {
if (upceanflag) {
/* Add fudge for anti-aliasing of digits */
textoffset = (text_height > guard_height ? text_height : guard_height) + 0.2f + text_gap;
if (text_height + 0.2f + text_gap > guard_descent) {
textoffset = text_height + 0.2f + text_gap;
} else {
textoffset = guard_descent;
}
} else {
textoffset = text_height * 1.25f + text_gap; /* Allow +25% for characters descending below baseline */
}
@ -607,7 +611,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
}
addon_row_height = row_height - (addon_text_yposn - yposn) + text_gap;
if (upceanflag != 12 && upceanflag != 6) { /* UPC-A/E add-ons don't descend */
addon_row_height += guard_height;
addon_row_height += guard_descent;
}
if (addon_row_height < 0.5f) {
addon_row_height = 0.5f;
@ -645,7 +649,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
case 14:
case 15:
case 16:
rect->height += guard_height;
rect->height += guard_descent;
break;
}
i++;
@ -660,7 +664,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
case 11:
case 20:
case 21:
rect->height += guard_height;
rect->height += guard_descent;
break;
}
i++;
@ -679,7 +683,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
case 27:
case 28:
case 29:
rect->height += guard_height;
rect->height += guard_descent;
break;
}
i++;
@ -694,7 +698,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
case 15:
case 28:
case 29:
rect->height += guard_height;
rect->height += guard_descent;
break;
}
i++;

View File

@ -84,7 +84,8 @@ extern "C" {
/* Main symbol structure */
struct zint_symbol {
int symbology; /* Symbol to use (see BARCODE_XXX below) */
float height; /* Height in X-dimensions (ignored for fixed-width barcodes) */
float height; /* Barcode height in X-dimensions (ignored for fixed-width barcodes) */
float scale; /* Scale factor when printing barcode. Default 1 */
int whitespace_width; /* Width in X-dimensions of whitespace to left & right of barcode */
int whitespace_height; /* Height in X-dimensions of whitespace above & below the barcode */
int border_width; /* Size of border in X-dimensions */
@ -94,7 +95,7 @@ extern "C" {
char *fgcolor; /* Pointer to fgcolour (alternate spelling) */
char *bgcolor; /* Pointer to bgcolour (alternate spelling) */
char outfile[256]; /* Name of file to output to, NUL-terminated. Default "out.png" ("out.gif" if NO_PNG) */
float scale; /* Scale factor when printing barcode */
char primary[128]; /* Primary message data (MaxiCode, Composite), NUL-terminated */
int option_1; /* Symbol-specific options (see "../docs/manual.txt") */
int option_2; /* Symbol-specific options */
int option_3; /* Symbol-specific options */
@ -102,11 +103,14 @@ extern "C" {
int fontsize; /* Unused */
int input_mode; /* Encoding of input data (see DATA_MODE etc below). Default DATA_MODE */
int eci; /* Extended Channel Interpretation. Default 0 (none) */
float dot_size; /* Size of dots used in BARCODE_DOTTY_MODE */
float guard_descent; /* Height in X-dimensions that UPC/EAN guard bars descend. Default 5 */
int warn_level; /* Affects error/warning value returned by Zint API (see WARN_XXX below) */
int debug; /* Debugging flags */
unsigned char text[128]; /* Human Readable Text (if any), UTF-8, NUL-terminated (output only) */
int rows; /* Number of rows used by the symbol (output only) */
int width; /* Width of the generated symbol (output only) */
char primary[128]; /* Primary message data (MaxiCode, Composite), NUL-terminated */
unsigned char encoded_data[200][143]; /* Encoded data (output only). Allows for rows of 1144 modules */
unsigned char encoded_data[200][144]; /* Encoded data (output only). Allows for rows of 1152 modules */
float row_height[200]; /* Heights of rows (output only). Allows for 200 row DotCode */
char errtxt[100]; /* Error message if an error or warning occurs, NUL-terminated (output only) */
unsigned char *bitmap; /* Stored bitmap image (raster output only) */
@ -114,10 +118,7 @@ extern "C" {
int bitmap_height; /* Height of bitmap image (raster output only) */
unsigned char *alphamap; /* Array of alpha values used (raster output only) */
unsigned int bitmap_byte_length; /* Size of BMP bitmap data (raster output only) */
float dot_size; /* Size of dots used in BARCODE_DOTTY_MODE */
struct zint_vector *vector; /* Pointer to vector header (vector output only) */
int debug; /* Debugging flags */
int warn_level; /* Affects error/warning value returned by Zint API (see WARN_XXX below) */
};
/* Symbologies (`symbol->symbology`) */

View File

@ -37,27 +37,26 @@ namespace Zint {
static const int fontSizeError = 14; /* Point size */
QZint::QZint() {
m_zintSymbol = NULL;
m_symbol = BARCODE_CODE128;
m_height = 0.0f;
m_borderType = 0;
m_borderWidth = 0;
m_fontSetting = 0;
m_option_1 = -1;
m_option_2 = 0;
m_option_3 = 0;
m_fgColor = Qt::black;
m_bgColor = Qt::white;
m_cmyk = false;
m_zintSymbol = NULL;
m_error = 0;
m_input_mode = UNICODE_MODE;
m_scale = 1.0f;
m_option_3 = 0;
m_show_hrt = 1;
m_eci = 0;
m_dotty = false;
m_dot_size = 4.0f / 5.0f;
target_size_horiz = 0;
target_size_vert = 0;
m_option_2 = 0;
m_guardDescent = 5.0f;
m_whitespace = 0;
m_vwhitespace = 0;
m_gs1parens = false;
@ -66,6 +65,9 @@ namespace Zint {
m_reader_init = false;
m_rotate_angle = 0;
m_debug = false;
target_size_horiz = 0; /* Legacy */
target_size_vert = 0; /* Legacy */
}
QZint::~QZint() {
@ -86,15 +88,16 @@ namespace Zint {
m_zintSymbol->whitespace_height = m_vwhitespace;
m_zintSymbol->border_width = m_borderWidth;
m_zintSymbol->option_1 = m_option_1;
m_zintSymbol->input_mode = m_input_mode;
m_zintSymbol->option_2 = m_option_2;
m_zintSymbol->option_3 = m_option_3;
m_zintSymbol->input_mode = m_input_mode;
if (m_dotty) {
m_zintSymbol->output_options |= BARCODE_DOTTY_MODE;
}
m_zintSymbol->dot_size = m_dot_size;
m_zintSymbol->guard_descent = m_guardDescent;
m_zintSymbol->show_hrt = m_show_hrt ? 1 : 0;
m_zintSymbol->eci = m_eci;
m_zintSymbol->option_3 = m_option_3;
m_zintSymbol->scale = m_scale;
if (m_gs1parens) {
m_zintSymbol->input_mode |= GS1PARENS_MODE;
@ -183,6 +186,14 @@ namespace Zint {
m_height = height;
}
int QZint::option1() const {
return m_option_1;
}
void QZint::setOption1(int option_1) {
m_option_1 = option_1;
}
int QZint::option2() const {
return m_option_2;
}
@ -219,6 +230,14 @@ namespace Zint {
m_dot_size = dot_size;
}
float QZint::guardDescent() const {
return m_guardDescent;
}
void QZint::setGuardDescent(float guardDescent) {
m_guardDescent = guardDescent;
}
QColor QZint::fgColor() const {
return m_fgColor;
}
@ -271,14 +290,6 @@ namespace Zint {
m_vwhitespace = vwhitespace;
}
int QZint::option1() const {
return m_option_1;
}
void QZint::setOption1(int option_1) {
m_option_1 = option_1;
}
void QZint::setFontSetting(int fontSettingIndex) {
if (fontSettingIndex == 1) {
m_fontSetting = BOLD_TEXT;
@ -295,11 +306,6 @@ namespace Zint {
m_show_hrt = show;
}
void QZint::setTargetSize(int width, int height) {
target_size_horiz = width;
target_size_vert = height;
}
void QZint::setGSSep(bool gssep) {
m_gssep = gssep;
}
@ -358,6 +364,10 @@ namespace Zint {
void QZint::setPdf417CodeWords(int /*pdf417CodeWords*/) {}
int QZint::pdf417CodeWords() const { return 0; }
void QZint::setHideText(bool hide) { setShowText(!hide); }
void QZint::setTargetSize(int width, int height) {
target_size_horiz = width;
target_size_vert = height;
}
bool QZint::hasHRT(int symbology) const {
return ZBarcode_Cap(symbology ? symbology : m_symbol, ZINT_CAP_HRT);

View File

@ -52,6 +52,9 @@ public:
float height() const;
void setHeight(float height);
int option1() const;
void setOption1(int option_1);
int option2() const;
void setOption2(int option);
@ -66,6 +69,9 @@ public:
void setDotSize(float dot_size);
float guardDescent() const;
void setGuardDescent(float guardDescent);
QColor fgColor() const;
void setFgColor(const QColor& fgColor);
@ -80,9 +86,6 @@ public:
int borderWidth() const;
void setBorderWidth(int boderWidth);
int option1() const;
void setOption1(int option_1);
void setWhitespace(int whitespace);
void setVWhitespace(int vwhitespace);
@ -91,8 +94,6 @@ public:
void setShowText(bool show);
void setTargetSize(int width, int height);
void setGSSep(bool gssep);
int rotateAngle() const;
@ -116,6 +117,7 @@ public:
void setPdf417CodeWords(int pdf417CodeWords); /* no op */
int pdf417CodeWords() const;
void setHideText(bool hide); /* setShowText(!hide) */
void setTargetSize(int width, int height);
/* Test capabilities - ZBarcode_Cap() */
bool hasHRT(int symbology = 0) const;
@ -156,8 +158,9 @@ private:
int m_borderType;
int m_borderWidth;
int m_fontSetting;
int m_option_2;
int m_option_1;
int m_option_2;
int m_option_3;
int m_input_mode;
QColor m_fgColor;
QColor m_bgColor;
@ -168,19 +171,20 @@ private:
int m_vwhitespace;
zint_symbol * m_zintSymbol;
float m_scale;
int m_option_3;
bool m_show_hrt;
int m_eci;
int m_rotate_angle;
bool m_dotty;
float m_dot_size;
int target_size_horiz;
int target_size_vert;
float m_guardDescent;
bool m_gs1parens;
bool m_gs1nocheck;
bool m_gssep;
bool m_reader_init;
bool m_debug;
int target_size_horiz; /* Legacy */
int target_size_vert; /* Legacy */
};
}

View File

@ -122,6 +122,9 @@
- Removed -wzpl, added -gs1nocheck
- Made -format position independent
- Tabs -> spaces
2021-09-21 GL
- Added -guarddescent option
- iHeight check int -> double
*/
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
@ -461,6 +464,7 @@ static char help_message[] = "zint tcl(stub,obj) dll\n"
" -gs1nocheck bool: for gs1, do not check validity of data (allows non-standard symbols)\n"
" -gs1parens bool: for gs1, AIs enclosed in parentheses instead of square brackets\n"
" -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n"
" -guarddescent double: Height of guard bar descent in modules (UPC/EAN only)\n"
" -height double: Symbol height in modules\n"
/* cli option --input not supported */
" -init bool: Create reader initialisation symbol (Code 128, Data Matrix)\n"
@ -705,8 +709,8 @@ static int Encode(Tcl_Interp *interp, int objc,
char *optionList[] = {
"-addongap", "-barcode", "-bg", "-bind", "-bold", "-border", "-box",
"-cols", "-dmre", "-dotsize", "-dotty", "-eci", "-fg", "-format",
"-fullmultibyte", "-gs1nocheck", "-gs1parens", "-gssep", "-height",
"-init", "-mask", "-mode",
"-fullmultibyte", "-gs1nocheck", "-gs1parens", "-gssep", "-guarddescent",
"-height", "-init", "-mask", "-mode",
"-nobackground", "-notext", "-primary", "-reverse", "-rotate",
"-rows", "-scale", "-scmvv", "-secure", "-separator", "-smalltext",
"-square", "-to", "-vers", "-vwhitesp", "-werror", "-whitesp",
@ -714,8 +718,8 @@ static int Encode(Tcl_Interp *interp, int objc,
enum iOption {
iAddonGap, iBarcode, iBG, iBind, iBold, iBorder, iBox,
iCols, iDMRE, iDotSize, iDotty, iECI, iFG, iFormat,
iFullMultiByte, iGS1NoCheck, iGS1Parens, iGSSep, iHeight,
iInit, iMask, iMode,
iFullMultiByte, iGS1NoCheck, iGS1Parens, iGSSep, iGuardDescent,
iHeight, iInit, iMask, iMode,
iNoBackground, iNoText, iPrimary, iReverse, iRotate,
iRows, iScale, iSCMvv, iSecure, iSeparator, iSmallText,
iSquare, iTo, iVers, iVWhiteSp, iWError, iWhiteSp
@ -768,6 +772,8 @@ static int Encode(Tcl_Interp *interp, int objc,
fError = 1;
}
break;
case iHeight:
case iGuardDescent:
case iDotSize:
case iScale:
/* >> Float */
@ -780,7 +786,6 @@ static int Encode(Tcl_Interp *interp, int objc,
case iAddonGap:
case iBorder:
case iCols:
case iHeight:
case iMask:
case iMode:
case iRotate:
@ -965,6 +970,15 @@ static int Encode(Tcl_Interp *interp, int objc,
my_symbol->border_width = intValue;
}
break;
case iGuardDescent:
if ((float)doubleValue < 0.0f || (float)doubleValue > 50.0f) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("Guard bar descent out of range", -1));
fError = 1;
} else {
my_symbol->guard_descent = (float)doubleValue;
}
break;
case iHeight:
if ((float)doubleValue < 0.5f || (float)doubleValue > 1000.0f) {
Tcl_SetObjResult(interp,

View File

@ -1055,6 +1055,8 @@ symbology | integer | Symbol to use (see section | BARCODE_CODE128
height | float | Symbol height, excluding | Symbol
| | fixed width-to-height | dependent
| | symbols. [1] |
scale | float | Scale factor for adjusting | 1.0
| | size of image. |
whitespace_width | integer | Horizontal whitespace width.| 0
whitespace_height | integer | Vertical whitespace height. | 0
border_width | integer | Border width. | 0
@ -1083,8 +1085,9 @@ outfile | character | Contains the name of the | "out.png"
| | .svg, .tif or .txt |
| | followed by a terminat- |
| | ing \0. |
scale | float | Scale factor for adjusting | 1.0
| | size of image. |
primary | character | Primary message data for | "" (empty)
| string | more complex symbols, |
| | with a terminating \0. |
option_1 | integer | Symbol specific options. | -1
option_2 | integer | Symbol specific options. | 0
option_3 | integer | Symbol specific options. | 0
@ -1093,17 +1096,18 @@ input_mode | integer | Set encoding of input data | DATA_MODE
| | (see section 5.10) |
eci | integer | Extended Channel Interpre- | 0 (none)
| | tation code. |
dot_size | float | Size of dots used in dotty | 4.0 / 5.0
| | mode. |
guard_descent | float | Height of guard bar descent | 5.0
| | (UPC/EAN only). |
warn_level | integer | Affects error/warning value | WARN_DEFAULT
| | returned by Zint API. |
text | unsigned | Human Readable Text, which | "" (empty)
| character | usually consists of in- |
| string | put data plus one more |
| | check digit. Uses UTF-8 |
| | formatting, with a |
| | terminating \0. |
primary | character | Primary message data for | "" (empty)
| string | more complex symbols, |
| | with a terminating \0. |
dot_size | float | Size of dots used in dotty | 4.0 / 5.0
| | mode. |
rows | integer | Number of rows used by the | (output only)
| | the symbol. |
width | integer | Width of the generated sym- | (output only)
@ -1133,8 +1137,6 @@ bitmap_byte_length| integer | Size of BMP bitmap data. | (output only)
vector | pointer to | Pointer to vector header | (output only)
| vector | containing pointers to |
| structure | vector elements. |
warn_level | integer | Affects error/warning value | WARN_DEFAULT
| | returned by Zint API. |
--------------------------------------------------------------------------------
[1] This value is ignored for Aztec (including HIBC and Aztec Rune), Code One,
@ -1637,7 +1639,9 @@ before encoding.
You can adjust the gap between the main symbol and an add-on in multiples of
the X-dimension by setting --addongap= (option_2) to a value between 9 (default)
and 12.
and 12. The height in X-dimensions that the guard bars descend below the main
bars can be adjusted by setting --guarddescent= (field guard_descent in the
symbol structure) to a value between 0 and 20 (default 5).
6.1.3.2 UPC Version E
---------------------
@ -1662,7 +1666,9 @@ before encoding.
You can adjust the gap between the main symbol and an add-on in multiples of
the X-dimension by setting --addongap= (option_2) to a value between 7 (default)
and 12.
and 12. The height in X-dimensions that the guard bars descend below the main
bars can be adjusted by setting --guarddescent= (field guard_descent in the
symbol structure) to a value between 0 and 20 (default 5).
6.1.4 European Article Number (EN 797)
--------------------------------------
@ -1697,7 +1703,9 @@ the check digit then you can use symbology BARCODE_EANX_CHK (14) which takes an
You can adjust the gap between the main symbol and an add-on in multiples of
the X-dimension by setting --addongap= (option_2) to a value between 7 (default)
and 12.
and 12. The height in X-dimensions that the guard bars descend below the main
bars can be adjusted by setting --guarddescent= (field guard_descent in the
symbol structure) to a value between 0 and 20 (default 5).
6.1.4.2 SBN, ISBN and ISBN-13
-----------------------------
@ -1706,7 +1714,9 @@ 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 +
symbol as with UPC symbols, and the gap set with --addongap= (option_2) to
between 7 (default) and 12.
between 7 (default) and 12. The height that the guard bars descend can be
adjusted by setting --guarddescent= (field guard_descent in the symbol
structure) to a value between 0 and 20 (default 5).
6.1.5 Plessey
-------------

View File

@ -143,6 +143,7 @@ static void usage(void) {
" --gs1nocheck Do not check validity of GS1 data\n"
" --gs1parens Process parentheses \"()\" as GS1 AI delimiters, not \"[]\"\n"
" --gssep Use separator GS for GS1 (Data Matrix)\n"
" --guarddescent=NUMBER Set height of guard bar descent in X-dims (UPC/EAN)\n"
" -h, --help Display help message\n"
" --height=NUMBER Set height of symbol in multiples of X-dimension\n"
" -i, --input=FILE Read input data from FILE\n"
@ -800,7 +801,7 @@ int main(int argc, char **argv) {
OPT_ADDONGAP = 128, OPT_BATCH, OPT_BINARY, OPT_BG, OPT_BIND, OPT_BOLD, OPT_BORDER,
OPT_BOX, OPT_CMYK, OPT_COLS, OPT_DIRECT, OPT_DMRE, OPT_DOTSIZE, OPT_DOTTY, OPT_DUMP,
OPT_ECI, OPT_ESC, OPT_FG, OPT_FILETYPE, OPT_FONTSIZE, OPT_FULLMULTIBYTE,
OPT_GS1, OPT_GS1NOCHECK, OPT_GS1PARENS, OPT_GSSEP,
OPT_GS1, OPT_GS1NOCHECK, OPT_GS1PARENS, OPT_GSSEP, OPT_GUARDDESCENT,
OPT_HEIGHT, OPT_INIT, OPT_MIRROR, OPT_MASK, OPT_MODE,
OPT_NOBACKGROUND, OPT_NOTEXT, OPT_PRIMARY, OPT_ROTATE, OPT_ROWS, OPT_SCALE,
OPT_SCMVV, OPT_SECURE, OPT_SEPARATOR, OPT_SMALL, OPT_SQUARE, OPT_VERBOSE, OPT_VERS,
@ -836,6 +837,7 @@ int main(int argc, char **argv) {
{"gs1nocheck", 0, NULL, OPT_GS1NOCHECK},
{"gs1parens", 0, NULL, OPT_GS1PARENS},
{"gssep", 0, NULL, OPT_GSSEP},
{"guarddescent", 1, NULL, OPT_GUARDDESCENT},
{"height", 1, NULL, OPT_HEIGHT},
{"help", 0, NULL, 'h'},
{"init", 0, NULL, OPT_INIT},
@ -1014,6 +1016,15 @@ int main(int argc, char **argv) {
case OPT_GSSEP:
my_symbol->output_options |= GS1_GS_SEPARATOR;
break;
case OPT_GUARDDESCENT:
float_opt = (float) atof(optarg);
if (float_opt >= 0.0f && float_opt <= 50.0f) {
my_symbol->guard_descent = float_opt;
} else {
fprintf(stderr, "Warning 155: Guard bar descent '%g' out of range (0 to 50), ignoring\n", float_opt);
fflush(stderr);
}
break;
case OPT_HEIGHT:
float_opt = (float) atof(optarg);
if (float_opt >= 0.5f && float_opt <= 1000.0f) {

View File

@ -614,7 +614,8 @@ static void test_checks(int index, int debug) {
double dotsize;
int eci;
char *filetype;
int height;
double height;
double guard_descent;
int mask;
int mode;
int rotate;
@ -631,40 +632,42 @@ static void test_checks(int index, int debug) {
};
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = {
/* 0*/ { -2, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 139: Invalid add-on gap value (digits only)" },
/* 1*/ { 6, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 140: Add-on gap out of range (7 to 12), ignoring" },
/* 2*/ { 13, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 140: Add-on gap out of range (7 to 12), ignoring" },
/* 3*/ { -1, -2, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 107: Invalid border width value (digits only)" },
/* 4*/ { -1, 1001, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 108: Border width out of range (0 to 1000), ignoring" },
/* 5*/ { -1, -1, -1, 0.009, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 106: Invalid dot radius value (less than 0.01), ignoring" },
/* 6*/ { -1, -1, -2, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 131: Invalid columns value (digits only)" },
/* 7*/ { -1, -1, 201, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 111: Number of columns out of range (1 to 200), ignoring" },
/* 8*/ { -1, -1, -1, -1, -2, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 138: Invalid ECI value (digits only)" },
/* 9*/ { -1, -1, -1, -1, 1000000, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 118: ECI code out of range (0 to 999999), ignoring" },
/* 10*/ { -1, -1, -1, -1, -1, "jpg", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 142: File type 'jpg' not supported, ignoring" },
/* 11*/ { -1, -1, -1, -1, -1, NULL, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '-2' out of range (0.5 to 1000), ignoring" },
/* 12*/ { -1, -1, -1, -1, -1, NULL, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '0' out of range (0.5 to 1000), ignoring" },
/* 13*/ { -1, -1, -1, -1, -1, NULL, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 148: Invalid mask value (digits only)" },
/* 14*/ { -1, -1, -1, -1, -1, NULL, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 147: Mask value out of range (0 to 7), ignoring" },
/* 15*/ { -1, -1, -1, -1, -1, NULL, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 116: Mode value out of range (0 to 6), ignoring" },
/* 16*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, "Error 117: Invalid rotation value (digits only)" },
/* 17*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 137: Invalid rotation parameter (0, 90, 180 or 270 only), ignoring" },
/* 18*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, "Error 132: Invalid rows value (digits only)" },
/* 19*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, "Warning 112: Number of rows out of range (1 to 44), ignoring" },
/* 20*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, "Warning 105: Invalid scale value (less than 0.01), ignoring" },
/* 21*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, 0.49, -1, -1, -1, -1, -1, -1, "Warning 146: Scaling less than 0.5 will be set to 0.5 for 'gif' output" },
/* 22*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, "Error 149: Invalid Structured Carrier Message version value (digits only)" },
/* 23*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, "Warning 150: Structured Carrier Message version out of range (0 to 99), ignoring" },
/* 24*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, "Error 134: Invalid ECC value (digits only)" },
/* 25*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, "Warning 114: ECC level out of range (0 to 8), ignoring" },
/* 26*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, "Error 128: Invalid separator value (digits only)" },
/* 27*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, "Warning 127: Separator value out of range (0 to 4), ignoring" },
/* 28*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, "Error 133: Invalid version value (digits only)" },
/* 29*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, -1, -1, "Warning 113: Version value out of range (1 to 84), ignoring" },
/* 30*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, "Error 153: Invalid vertical whitespace value '-2' (digits only)" },
/* 31*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1001, -1, "Warning 154: Vertical whitespace value out of range (0 to 1000), ignoring" },
/* 32*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, "Error 120: Invalid horizontal whitespace value '-2' (digits only)" },
/* 33*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1001, "Warning 121: Horizontal whitespace value out of range (0 to 1000), ignoring" },
/* 0*/ { -2, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 139: Invalid add-on gap value (digits only)" },
/* 1*/ { 6, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 140: Add-on gap out of range (7 to 12), ignoring" },
/* 2*/ { 13, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 140: Add-on gap out of range (7 to 12), ignoring" },
/* 3*/ { -1, -2, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 107: Invalid border width value (digits only)" },
/* 4*/ { -1, 1001, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 108: Border width out of range (0 to 1000), ignoring" },
/* 5*/ { -1, -1, -1, 0.009, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 106: Invalid dot radius value (less than 0.01), ignoring" },
/* 6*/ { -1, -1, -2, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 131: Invalid columns value (digits only)" },
/* 7*/ { -1, -1, 201, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 111: Number of columns out of range (1 to 200), ignoring" },
/* 8*/ { -1, -1, -1, -1, -2, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 138: Invalid ECI value (digits only)" },
/* 9*/ { -1, -1, -1, -1, 1000000, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 118: ECI code out of range (0 to 999999), ignoring" },
/* 10*/ { -1, -1, -1, -1, -1, "jpg", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 142: File type 'jpg' not supported, ignoring" },
/* 11*/ { -1, -1, -1, -1, -1, NULL, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '-2' out of range (0.5 to 1000), ignoring" },
/* 12*/ { -1, -1, -1, -1, -1, NULL, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '0' out of range (0.5 to 1000), ignoring" },
/* 13*/ { -1, -1, -1, -1, -1, NULL, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 155: Guard bar descent '-2' out of range (0 to 50), ignoring" },
/* 14*/ { -1, -1, -1, -1, -1, NULL, -1, 50.1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 155: Guard bar descent '50.1' out of range (0 to 50), ignoring" },
/* 15*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 148: Invalid mask value (digits only)" },
/* 16*/ { -1, -1, -1, -1, -1, NULL, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 147: Mask value out of range (0 to 7), ignoring" },
/* 17*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 116: Mode value out of range (0 to 6), ignoring" },
/* 18*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, "Error 117: Invalid rotation value (digits only)" },
/* 19*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 137: Invalid rotation parameter (0, 90, 180 or 270 only), ignoring" },
/* 20*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, "Error 132: Invalid rows value (digits only)" },
/* 21*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, "Warning 112: Number of rows out of range (1 to 44), ignoring" },
/* 22*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, "Warning 105: Invalid scale value (less than 0.01), ignoring" },
/* 23*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, 0.49, -1, -1, -1, -1, -1, -1, "Warning 146: Scaling less than 0.5 will be set to 0.5 for 'gif' output" },
/* 24*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, "Error 149: Invalid Structured Carrier Message version value (digits only)" },
/* 25*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, "Warning 150: Structured Carrier Message version out of range (0 to 99), ignoring" },
/* 26*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, "Error 134: Invalid ECC value (digits only)" },
/* 27*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, "Warning 114: ECC level out of range (0 to 8), ignoring" },
/* 28*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, "Error 128: Invalid separator value (digits only)" },
/* 29*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, "Warning 127: Separator value out of range (0 to 4), ignoring" },
/* 30*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, "Error 133: Invalid version value (digits only)" },
/* 31*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, -1, -1, "Warning 113: Version value out of range (1 to 84), ignoring" },
/* 32*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, "Error 153: Invalid vertical whitespace value '-2' (digits only)" },
/* 33*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1001, -1, "Warning 154: Vertical whitespace value out of range (0 to 1000), ignoring" },
/* 34*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, "Error 120: Invalid horizontal whitespace value '-2' (digits only)" },
/* 35*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1001, "Warning 121: Horizontal whitespace value out of range (0 to 1000), ignoring" },
};
int data_size = ARRAY_SIZE(data);
int i;
@ -690,7 +693,8 @@ static void test_checks(int index, int debug) {
arg_double(cmd, "--dotsize=", data[i].dotsize);
arg_int(cmd, "--eci=", data[i].eci);
arg_data(cmd, "--filetype=", data[i].filetype);
arg_int(cmd, "--height=", data[i].height);
arg_double(cmd, "--height=", data[i].height);
arg_double(cmd, "--guarddescent=", data[i].guard_descent);
arg_int(cmd, "--mask=", data[i].mask);
arg_int(cmd, "--mode=", data[i].mode);
arg_int(cmd, "--rotate=", data[i].rotate);

View File

@ -21,12 +21,17 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblUPCAAddonGap">
<property name="text">
<string>A&amp;dd-on Gap:</string>
</property>
<property name="toolTip">
<string>Horizontal space in X-dimensions between
main symbol and add-on (if any)
(ignored if disabled)</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
@ -35,8 +40,13 @@
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QComboBox" name="cmbUPCAAddonGap">
<property name="toolTip">
<string>Horizontal space in X-dimensions between
main symbol and add-on (if any)
(ignored if disabled)</string>
</property>
<item>
<property name="text">
<string>9 X (default)</string>
@ -59,6 +69,59 @@
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblUPCAGuardDescent">
<property name="toolTip">
<string>Height in X-dimensions that the guard bars
descend below the main bars
Default 5
(ignored if disabled)</string>
</property>
<property name="text">
<string>G&amp;uard Height:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>spnUPCAGuardDescent</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="spnUPCAGuardDescent">
<property name="toolTip">
<string>Height in X-dimensions that the guard bars
descend below the main bars
Default 5
(ignored if disabled)</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string> X</string>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>20.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -21,12 +21,17 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblUPCEANAddonGap">
<property name="text">
<string>A&amp;dd-on Gap:</string>
</property>
<property name="toolTip">
<string>Horizontal space in X-dimensions between
main symbol and add-on (if any)
(ignored if disabled)</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
@ -35,8 +40,13 @@
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="QComboBox" name="cmbUPCEANAddonGap">
<property name="toolTip">
<string>Horizontal space in X-dimensions between
main symbol and add-on (if any)
(ignored if disabled)</string>
</property>
<item>
<property name="text">
<string>7 X (default)</string>
@ -69,6 +79,59 @@
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblUPCEANGuardDescent">
<property name="toolTip">
<string>Height in X-dimensions that the guard bars
descend below the main bars
Default 5
(ignored if disabled)</string>
</property>
<property name="text">
<string>G&amp;uard Bar Descent:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>spnUPCEANGuardDescent</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="spnUPCEANGuardDescent">
<property name="toolTip">
<string>Height in X-dimensions that the guard bars
descend below the main bars
Default 5
(ignored if disabled)</string>
</property>
<property name="prefix">
<string/>
</property>
<property name="suffix">
<string> X</string>
</property>
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>20.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>5.000000000000000</double>
</property>
<property name="accelerated">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -976,6 +976,7 @@ void MainWindow::change_options()
cmbFontSetting->setCurrentIndex(0);
}
connect(m_optionWidget->findChild<QObject*>("cmbUPCAAddonGap"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("spnUPCAGuardDescent"), SIGNAL(valueChanged( double )), SLOT(update_preview()));
} else if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK || symbology == BARCODE_EANX_CC
|| symbology == BARCODE_UPCE || symbology == BARCODE_UPCE_CHK || symbology == BARCODE_UPCE_CC
@ -997,6 +998,7 @@ void MainWindow::change_options()
cmbFontSetting->setCurrentIndex(0);
}
connect(m_optionWidget->findChild<QObject*>("cmbUPCEANAddonGap"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("spnUPCEANGuardDescent"), SIGNAL(valueChanged( double )), SLOT(update_preview()));
} else if (symbology == BARCODE_VIN) {
QFile file(":/grpVIN.ui");
@ -1127,18 +1129,33 @@ void MainWindow::combobox_item_enabled(QComboBox *comboBox, int index, bool enab
void MainWindow::upcean_addon_gap(QComboBox *comboBox, QLabel *label, int base)
{
const QRegularExpression addonRE("^[0-9X]+[+][0-9]+$");
int item_val;
if (txtData->text().contains(addonRE)) {
comboBox->setEnabled(true);
label->setEnabled(true);
item_val = comboBox->currentIndex();
bool enabled = txtData->text().contains(addonRE);
if (comboBox) {
comboBox->setEnabled(enabled);
}
if (label) {
label->setEnabled(enabled);
}
if (enabled && comboBox) {
int item_val = comboBox->currentIndex();
if (item_val) {
m_bc.bc.setOption2(item_val + base);
}
} else {
comboBox->setEnabled(false);
label->setEnabled(false);
}
}
void MainWindow::upcean_guard_descent(QDoubleSpinBox *spnBox, QLabel *label)
{
bool enabled = txtData->text().length() > 5;
if (spnBox) {
spnBox->setEnabled(enabled);
}
if (label) {
label->setEnabled(enabled);
}
if (enabled && spnBox) {
m_bc.bc.setGuardDescent(get_doublespinbox_val("spnUPCEANGuardDescent"));
}
}
@ -1230,11 +1247,13 @@ void MainWindow::update_preview()
else
m_bc.bc.setSymbol(BARCODE_EANX);
upcean_addon_gap(m_optionWidget->findChild<QComboBox*>("cmbUPCEANAddonGap"), m_optionWidget->findChild<QLabel*>("lblUPCEANAddonGap"), 7 /*base*/);
upcean_guard_descent(m_optionWidget->findChild<QDoubleSpinBox*>("spnUPCEANGuardDescent"), m_optionWidget->findChild<QLabel*>("lblUPCEANGuardDescent"));
break;
case BARCODE_ISBNX:
m_bc.bc.setSymbol(symbology);
upcean_addon_gap(m_optionWidget->findChild<QComboBox*>("cmbUPCEANAddonGap"), m_optionWidget->findChild<QLabel*>("lblUPCEANAddonGap"), 7 /*base*/);
upcean_guard_descent(m_optionWidget->findChild<QDoubleSpinBox*>("spnUPCEANGuardDescent"), m_optionWidget->findChild<QLabel*>("lblUPCEANGuardDescent"));
break;
case BARCODE_UPCA:
@ -1243,6 +1262,7 @@ void MainWindow::update_preview()
else
m_bc.bc.setSymbol(BARCODE_UPCA);
upcean_addon_gap(m_optionWidget->findChild<QComboBox*>("cmbUPCAAddonGap"), m_optionWidget->findChild<QLabel*>("lblUPCAAddonGap"), 9 /*base*/);
upcean_guard_descent(m_optionWidget->findChild<QDoubleSpinBox*>("spnUPCAGuardDescent"), m_optionWidget->findChild<QLabel*>("lblUPCAGuardDescent"));
break;
case BARCODE_UPCE:
@ -1251,6 +1271,7 @@ void MainWindow::update_preview()
else
m_bc.bc.setSymbol(BARCODE_UPCE);
upcean_addon_gap(m_optionWidget->findChild<QComboBox*>("cmbUPCEANAddonGap"), m_optionWidget->findChild<QLabel*>("lblUPCEANAddonGap"), 7 /*base*/);
upcean_guard_descent(m_optionWidget->findChild<QDoubleSpinBox*>("spnUPCEANGuardDescent"), m_optionWidget->findChild<QLabel*>("lblUPCEANGuardDescent"));
break;
case BARCODE_DBAR_OMN:
@ -2189,22 +2210,26 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) {
case BARCODE_UPCA_CHK:
case BARCODE_UPCA_CC:
settings.setValue("studio/bc/upca/addongap", get_combobox_index("cmbUPCAAddonGap"));
settings.setValue("studio/bc/upca/guard_descent", QString::number(get_doublespinbox_val("spnUPCAGuardDescent"), 'f', 3 /*precision*/));
break;
case BARCODE_EANX:
case BARCODE_EANX_CHK:
case BARCODE_EANX_CC:
settings.setValue("studio/bc/eanx/addongap", get_combobox_index("cmbUPCEANAddonGap"));
settings.setValue("studio/bc/eanx/guard_descent", QString::number(get_doublespinbox_val("spnUPCEANGuardDescent"), 'f', 3 /*precision*/));
break;
case BARCODE_UPCE:
case BARCODE_UPCE_CHK:
case BARCODE_UPCE_CC:
settings.setValue("studio/bc/upce/addongap", get_combobox_index("cmbUPCEANAddonGap"));
settings.setValue("studio/bc/upce/guard_descent", QString::number(get_doublespinbox_val("spnUPCEANGuardDescent"), 'f', 3 /*precision*/));
break;
case BARCODE_ISBNX:
settings.setValue("studio/bc/isnbx/addongap", get_combobox_index("cmbUPCEANAddonGap"));
settings.setValue("studio/bc/isnbx/guard_descent", QString::number(get_doublespinbox_val("spnUPCEANGuardDescent"), 'f', 3 /*precision*/));
break;
case BARCODE_VIN:
@ -2448,22 +2473,26 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) {
case BARCODE_UPCA_CHK:
case BARCODE_UPCA_CC:
set_combobox_from_setting(settings, "studio/bc/upca/addongap", "cmbUPCAAddonGap");
set_doublespinbox_from_setting(settings, "studio/bc/upca/guard_descent", "spnUPCAGuardDescent", 5.0f);
break;
case BARCODE_EANX:
case BARCODE_EANX_CHK:
case BARCODE_EANX_CC:
set_combobox_from_setting(settings, "studio/bc/eanx/addongap", "cmbUPCEANAddonGap");
set_doublespinbox_from_setting(settings, "studio/bc/eanx/guard_descent", "spnUPCEANGuardDescent", 5.0f);
break;
case BARCODE_UPCE:
case BARCODE_UPCE_CHK:
case BARCODE_UPCE_CC:
set_combobox_from_setting(settings, "studio/bc/upce/addongap", "cmbUPCEANAddonGap");
set_doublespinbox_from_setting(settings, "studio/bc/upce/guard_descent", "spnUPCEANGuardDescent", 5.0f);
break;
case BARCODE_ISBNX:
set_combobox_from_setting(settings, "studio/bc/isbnx/addongap", "cmbUPCEANAddonGap");
set_doublespinbox_from_setting(settings, "studio/bc/isbnx/guard_descent", "spnUPCEANGuardDescent", 5.0f);
break;
case BARCODE_VIN:

View File

@ -56,6 +56,7 @@ protected:
void resizeEvent(QResizeEvent *event);
void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled);
void upcean_addon_gap(QComboBox *comboBox, QLabel *label, int base);
void upcean_guard_descent(QDoubleSpinBox *spnBox, QLabel *label);
void set_gs1_mode(bool gs1_mode);
void set_smaller_font(QLabel *note);