diff --git a/ChangeLog b/ChangeLog index 850b2ac8..22d1ebc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,7 +16,7 @@ Version 2.12.0.9 (dev) not released yet - For Windows, filenames are now assumed to be UTF-8 encoded. Affects `outfile` in `zint_symbol` and all API filename arguments - Never-used `fontsize` member removed from `zint_symbol` -- Buffer length of member `text` (HRT) in `zint_symbol` extended 128 -> 160 +- Buffer length of member `text` (HRT) in `zint_symbol` extended 128 -> 200 (client buffers may need checking/extending) - Font of text of SVG vector output now "OCRB, monospace" (EAN/UPC) or "Arimo, Arial, sans-serif" (all others) @@ -27,6 +27,7 @@ Version 2.12.0.9 (dev) not released yet - Unlikely-to-be-used `bitmap_byte_length` member removed from `zint_symbol` (was only set on BMP output to length of BMP pixel array) - EXCODE39 now defaults to displaying check digit in Human Readable Text (HRT) +- GS1_128 now warns if data > 48 (GS1 General Specifications max) Changes ------- @@ -66,8 +67,7 @@ Changes - GUI: use "OCRB" font for EAN/UPC and "Arimo" for all others (was "Helvetica" for both); add preview background colour option (default light grey) so as whitespace will show up in contrast (access via preview context menu) -- CODE128/common: move `c128_hrt_cpy_iso8859_1()` to `hrt_cpy_iso8859_1()` and - add `ZINT_WARN_HRT_TRUNCATED` warning (for future use) +- CODE128/common: add `ZINT_WARN_HRT_TRUNCATED` warning - QRCODE: better assert(), removing a NOLINT (2 left) - CLI: add some more barcode synonyms for DBAR - CMake: don't include png.c unless ZINT_USE_PNG (avoids clang warning) @@ -80,7 +80,12 @@ Changes - CODE39/EXCODE39/LOGMARS: new hidden check digit option - GUI: move some symbology-specific options into Data Tab so separate tab unnecessary +- DATAMATRIX: add `DM_ISO_144` (--dmiso144) option for ISO placement of ECC + codewords instead of default "de facto" - manual: add annexes on Qt and Tcl backends +- CODE128: increase no. symbol chars max 60 -> 99 +- frontend: truncate overlong `--primary` instead of ignoring +- man page: list size detail for matrix symbols (`--vers`) Bugs ---- @@ -103,6 +108,7 @@ Bugs shifting - GUI: fix not enabling font combo "Small Bold (vector only)" by default - CODEONE: fix S/T quiet zone 1X bottom (props BWIPP issue #245 doc) +- EAN-2/EAN-5: fix `BARCODE_BIND_TOP/BIND/BOX` output Version 2.12.0 (2022-12-12) diff --git a/backend/2of5.c b/backend/2of5.c index 49324e39..4a8fc458 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -232,7 +232,7 @@ INTERNAL int c25inter(struct zint_symbol *symbol, unsigned char source[], int le /* Interleaved 2-of-5 (ITF-14) */ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int length) { - int i, error_number, warn_number = 0, zeroes; + int i, error_number, zeroes; unsigned char localstr[16] = {0}; if (length > 13) { @@ -272,13 +272,13 @@ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int lengt /* GS1 General Specifications 21.0.1 5.12.3.2 table 2, including footnote (**): (note bind/box additional to symbol->height), same as GS1-128: "in case of further space constraints" height 5.8mm / 1.016mm (X max) ~ 5.7; default 31.75mm / 0.495mm ~ 64.14 */ - warn_number = set_height(symbol, stripf(5.8f / 1.016f), stripf(31.75f / 0.495f), 0.0f, 0 /*no_errtxt*/); + error_number = set_height(symbol, stripf(5.8f / 1.016f), stripf(31.75f / 0.495f), 0.0f, 0 /*no_errtxt*/); } else { (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); } } - return error_number ? error_number : warn_number; + return error_number; } /* Deutsche Post Leitcode */ diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index 277164c4..7ab2b365 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -70,8 +70,10 @@ endif() if(ZINT_USE_PNG AND PNG_FOUND) zint_target_link_libraries(PNG::PNG) + message(STATUS "Using PNG") else() zint_target_compile_definitions(PRIVATE ZINT_NO_PNG) + message(STATUS "Not using PNG") endif() if(ZINT_TEST) diff --git a/backend/bmp.c b/backend/bmp.c index 28855061..8f0093d1 100644 --- a/backend/bmp.c +++ b/backend/bmp.c @@ -53,29 +53,25 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix FILE *bmp_file; bitmap_file_header_t file_header; bitmap_info_header_t info_header; - color_ref_t bg_color_ref; - color_ref_t fg_color_ref; - color_ref_t ultra_color_ref[8]; + color_ref_t bg; + color_ref_t fg; + color_ref_t palette[8]; int ultra_fg_index = 9; unsigned char map[128]; const int output_to_stdout = symbol->output_options & BARCODE_STDOUT; /* Suppress gcc -fanalyzer warning */ - (void) out_colour_get_rgb(symbol->fgcolour, &fg_color_ref.red, &fg_color_ref.green, &fg_color_ref.blue, - NULL /*alpha*/); - fg_color_ref.reserved = 0x00; + (void) out_colour_get_rgb(symbol->fgcolour, &fg.red, &fg.green, &fg.blue, NULL /*alpha*/); + fg.reserved = 0x00; - (void) out_colour_get_rgb(symbol->bgcolour, &bg_color_ref.red, &bg_color_ref.green, &bg_color_ref.blue, - NULL /*alpha*/); - bg_color_ref.reserved = 0x00; + (void) out_colour_get_rgb(symbol->bgcolour, &bg.red, &bg.green, &bg.blue, NULL /*alpha*/); + bg.reserved = 0x00; if (symbol->symbology == BARCODE_ULTRA) { - static const int ultra_chars[8] = { 'C', 'B', 'M', 'R', 'Y', 'G', 'K', 'W' }; + static const unsigned char ultra_chars[8] = { 'C', 'B', 'M', 'R', 'Y', 'G', 'K', 'W' }; for (i = 0; i < 8; i++) { - ultra_color_ref[i].red = colour_to_red(i + 1); - ultra_color_ref[i].green = colour_to_green(i + 1); - ultra_color_ref[i].blue = colour_to_blue(i + 1); - ultra_color_ref[i].reserved = 0x00; - if (memcmp(&ultra_color_ref[i], &fg_color_ref, sizeof(fg_color_ref)) == 0) { + out_colour_char_to_rgb(ultra_chars[i], &palette[i].red, &palette[i].green, &palette[i].blue); + palette[i].reserved = 0x00; + if (memcmp(&palette[i], &fg, sizeof(fg)) == 0) { ultra_fg_index = i + 1; } map[ultra_chars[i]] = i + 1; @@ -106,14 +102,14 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix bitmap = bitmap_file_start + data_offset; /* Pixel Plotting */ - if (symbol->symbology == BARCODE_ULTRA) { + if (bits_per_pixel == 4) { for (row = 0; row < symbol->bitmap_height; row++) { const unsigned char *pb = pixelbuf + (symbol->bitmap_width * (symbol->bitmap_height - row - 1)); for (column = 0; column < symbol->bitmap_width; column++) { bitmap[(column >> 1) + (row * row_size)] |= map[pb[column]] << (!(column & 1) << 2); } } - } else { + } else { /* bits_per_pixel == 1 */ for (row = 0; row < symbol->bitmap_height; row++) { const unsigned char *pb = pixelbuf + (symbol->bitmap_width * (symbol->bitmap_height - row - 1)); for (column = 0; column < symbol->bitmap_width; column++) { @@ -144,21 +140,22 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix memcpy(bitmap_file_start, &file_header, sizeof(bitmap_file_header_t)); bmp_posn += sizeof(bitmap_file_header_t); memcpy(bmp_posn, &info_header, sizeof(bitmap_info_header_t)); - bmp_posn += sizeof(bitmap_info_header_t); - memcpy(bmp_posn, &bg_color_ref, sizeof(color_ref_t)); - if (symbol->symbology == BARCODE_ULTRA) { + + memcpy(bmp_posn, &bg, sizeof(color_ref_t)); + bmp_posn += sizeof(color_ref_t); + if (bits_per_pixel == 4) { for (i = 0; i < 8; i++) { + memcpy(bmp_posn, &palette[i], sizeof(color_ref_t)); bmp_posn += sizeof(color_ref_t); - memcpy(bmp_posn, &ultra_color_ref[i], sizeof(color_ref_t)); } if (ultra_fg_index == 9) { - bmp_posn += sizeof(color_ref_t); - memcpy(bmp_posn, &fg_color_ref, sizeof(color_ref_t)); + memcpy(bmp_posn, &fg, sizeof(color_ref_t)); + /* bmp_posn += sizeof(color_ref_t); */ /* Not needed as long as last */ } } else { - bmp_posn += sizeof(color_ref_t); - memcpy(bmp_posn, &fg_color_ref, sizeof(color_ref_t)); + memcpy(bmp_posn, &fg, sizeof(color_ref_t)); + /* bmp_posn += sizeof(color_ref_t); */ /* Not needed as long as last */ } /* Open output file in binary mode */ diff --git a/backend/codablock.c b/backend/codablock.c index 5c0857cf..f71c8b6c 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -555,7 +555,7 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int /* option1: rows <= 0: automatic, 1..44 */ rows = symbol->option_1; if (rows == 1) { - error_number = code128(symbol, source, length); /* Only returns errors, not warnings */ + error_number = code128(symbol, source, length); if (error_number < ZINT_ERROR) { symbol->output_options |= BARCODE_BIND; if (symbol->border_width == 0) { /* Allow override if non-zero */ @@ -565,7 +565,11 @@ INTERNAL int codablockf(struct zint_symbol *symbol, unsigned char source[], int if (symbol->output_options & COMPLIANT_HEIGHT) { /* AIM ISS-X-24 Section 4.6.1 minimum row height 8X (for compatibility with CODABLOCKF, not specced for CODE128) */ - error_number = set_height(symbol, 8.0f, 10.0f, 0.0f, 0 /*no_errtxt*/); + if (error_number == 0) { + error_number = set_height(symbol, 8.0f, 10.0f, 0.0f, 0 /*no_errtxt*/); + } else { + (void) set_height(symbol, 8.0f, 10.0f, 0.0f, 1 /*no_errtxt*/); + } } else { (void) set_height(symbol, 0.0f, 5.0f, 0.0f, 1 /*no_errtxt*/); } diff --git a/backend/code128.c b/backend/code128.c index 9104b72c..f4cc3284 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -37,6 +37,8 @@ #include "code128.h" #include "gs1.h" +#define C128_SYMBOL_MAX 99 + static const char KRSET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; #define KRSET_F (IS_NUM_F | IS_UPR_F) @@ -343,7 +345,7 @@ INTERNAL void c128_put_in_set(int list[2][C128_MAX], const int indexliste, char /* Handle Code 128, 128B and HIBC 128 */ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int length) { int i, j, k, values[C128_MAX] = {0}, bar_characters = 0, read, total_sum; - int error_number = 0, indexchaine, indexliste, f_state = 0; + int error_number, indexchaine, indexliste, f_state = 0; unsigned char src_buf[C128_MAX + 1]; unsigned char *src = source; char manual_set[C128_MAX] = {0}; @@ -555,8 +557,8 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len glyph_count += 2; } } - if (glyph_count > 120) { /* 60 * 2 */ - strcpy(symbol->errtxt, "341: Input too long (60 symbol character maximum)"); + if (glyph_count > C128_SYMBOL_MAX * 2) { + sprintf(symbol->errtxt, "341: Input too long (%d symbol character maximum)", C128_SYMBOL_MAX); return ZINT_ERROR_TOO_LONG; } @@ -709,7 +711,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len for (i = 1; i < bar_characters; i++, d += 6) { memcpy(d, C128Table[values[i]], 6); - total_sum += values[i] * i; /* Note can't overflow as 106 * 60 * 60 = 381600 */ + total_sum += values[i] * i; /* Note can't overflow as 106 * C128_SYMBOL_MAX * C128_SYMBOL_MAX = 1038906 */ } total_sum %= 103; memcpy(d, C128Table[total_sum], 6); @@ -740,7 +742,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len /* ISO/IEC 15417:2007 leaves dimensions/height as application specification */ - (void) hrt_cpy_iso8859_1(symbol, src, length); /* Truncation can't happen */ + error_number = hrt_cpy_iso8859_1(symbol, src, length); return error_number; } @@ -749,7 +751,7 @@ INTERNAL int code128(struct zint_symbol *symbol, unsigned char source[], int len INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_mode, const int cc_rows) { int i, values[C128_MAX] = {0}, bar_characters = 0, read, total_sum; - int error_number, warn_number = 0, indexchaine, indexliste; + int error_number, indexchaine, indexliste; int list[2][C128_MAX] = {{0}}; char set[C128_MAX] = {0}, mode, last_set; int glyph_count = 0; /* Codeword estimate times 2 */ @@ -831,8 +833,8 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int glyph_count += 2; } } - if (glyph_count > 120) { /* 60 * 2 */ - strcpy(symbol->errtxt, "344: Input too long (60 symbol character maximum)"); + if (glyph_count > C128_SYMBOL_MAX * 2) { + sprintf(symbol->errtxt, "344: Input too long (%d symbol character maximum)", C128_SYMBOL_MAX); return ZINT_ERROR_TOO_LONG; } @@ -939,7 +941,7 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int for (i = 1; i < bar_characters; i++, d += 6) { memcpy(d, C128Table[values[i]], 6); - total_sum += values[i] * i; /* Note can't overflow as 106 * 60 * 60 = 381600 */ + total_sum += values[i] * i; /* Note can't overflow as 106 * C128_SYMBOL_MAX * C128_SYMBOL_MAX = 1038906 */ } total_sum %= 103; memcpy(d, C128Table[total_sum], 6); @@ -976,6 +978,13 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int } } + if (reduced_length > 48) { /* GS1 General Specifications 5.4.4.3 */ + if (error_number == 0) { /* Don't overwrite any `gs1_verify()` warning */ + strcpy(symbol->errtxt, "843: GS1-128 input too long (48 character maximum)"); + error_number = ZINT_WARN_NONCOMPLIANT; + } + } + if (symbol->output_options & COMPLIANT_HEIGHT) { /* GS1 General Specifications 21.0.1 5.12.3.2 table 2, including footnote (**): same as ITF-14: "in case of further space constraints" height 5.8mm / 1.016mm (X max) ~ 5.7; @@ -986,7 +995,11 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int /* Pass back via temporary linear structure */ symbol->height = symbol->height ? min_height : default_height; } else { - warn_number = set_height(symbol, min_height, default_height, 0.0f, 0 /*no_errtxt*/); + if (error_number == 0) { /* Don't overwrite any `gs1_verify()` warning */ + error_number = set_height(symbol, min_height, default_height, 0.0f, 0 /*no_errtxt*/); + } else { + (void) set_height(symbol, min_height, default_height, 0.0f, 1 /*no_errtxt*/); + } } } else { const float height = 50.0f; @@ -997,7 +1010,7 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int } } - for (i = 0; i < length; i++) { + for (i = 0; i < length && i < (int) sizeof(symbol->text); i++) { if (source[i] == '[') { symbol->text[i] = '('; } else if (source[i] == ']') { @@ -1006,8 +1019,15 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int symbol->text[i] = source[i]; } } + if (i == sizeof(symbol->text)) { + /* Trumps all other warnings */ + strcpy(symbol->errtxt, "844: Human Readable Text truncated"); + error_number = ZINT_WARN_HRT_TRUNCATED; + i--; + } + symbol->text[i] = '\0'; - return error_number ? error_number : warn_number; + return error_number; } /* Handle EAN-128 (Now known as GS1-128) */ @@ -1119,84 +1139,80 @@ INTERNAL int dpd(struct zint_symbol *symbol, unsigned char source[], int length) return ZINT_ERROR_INVALID_DATA; } - error_number = code128(symbol, local_source, length); /* Only returns errors, not warnings */ + (void) code128(symbol, local_source, length); /* Only error returned is for large text which can't happen */ - if (error_number < ZINT_ERROR) { - if (!(symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP))) { - /* If no option has been selected then uses default bind top option */ - symbol->output_options |= BARCODE_BIND_TOP; /* Note won't extend over quiet zones for DPD */ - if (symbol->border_width == 0) { /* Allow override if non-zero */ - symbol->border_width = 3; /* From examples, not mentioned in spec */ - } + if (!(symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP))) { + /* If no option has been selected then uses default bind top option */ + symbol->output_options |= BARCODE_BIND_TOP; /* Note won't extend over quiet zones for DPD */ + if (symbol->border_width == 0) { /* Allow override if non-zero */ + symbol->border_width = 3; /* From examples, not mentioned in spec */ } + } - if (symbol->output_options & COMPLIANT_HEIGHT) { - /* DPD Parcel Label Specification Version 2.4.1 (19.01.2021) Section 4.6.1.2 - 25mm / 0.4mm (X max) = 62.5 min, 25mm / 0.375 (X) ~ 66.66 default */ - if (relabel) { /* If relabel then half-size */ - error_number = set_height(symbol, 31.25f, stripf(12.5f / 0.375f), 0.0f, 0 /*no_errtxt*/); - } else { - error_number = set_height(symbol, 62.5f, stripf(25.0f / 0.375f), 0.0f, 0 /*no_errtxt*/); - } + if (symbol->output_options & COMPLIANT_HEIGHT) { + /* DPD Parcel Label Specification Version 2.4.1 (19.01.2021) Section 4.6.1.2 + 25mm / 0.4mm (X max) = 62.5 min, 25mm / 0.375 (X) ~ 66.66 default */ + if (relabel) { /* If relabel then half-size */ + error_number = set_height(symbol, 31.25f, stripf(12.5f / 0.375f), 0.0f, 0 /*no_errtxt*/); } else { - (void) set_height(symbol, 0.0f, relabel ? 25.0f : 50.0f, 0.0f, 1 /*no_errtxt*/); + error_number = set_height(symbol, 62.5f, stripf(25.0f / 0.375f), 0.0f, 0 /*no_errtxt*/); } + } else { + (void) set_height(symbol, 0.0f, relabel ? 25.0f : 50.0f, 0.0f, 1 /*no_errtxt*/); + } - cd = mod; + cd = mod; - p = 0; - for (i = !relabel; i < length; i++) { - symbol->text[p] = local_source[i]; - p++; - - cd += posn(KRSET, local_source[i]); - if (cd > mod) cd -= mod; - cd *= 2; - if (cd >= (mod + 1)) cd -= mod + 1; - - switch (i + relabel) { - case 4: - case 7: - case 11: - case 15: - case 19: - case 21: - case 24: - case 27: - symbol->text[p] = ' '; - p++; - break; - } - } - - cd = mod + 1 - cd; - if (cd == mod) cd = 0; - - if (cd < 10) { - symbol->text[p] = cd + '0'; - } else { - symbol->text[p] = (cd - 10) + 'A'; - } + p = 0; + for (i = !relabel; i < length; i++) { + symbol->text[p] = local_source[i]; p++; - symbol->text[p] = '\0'; + cd += posn(KRSET, local_source[i]); + if (cd > mod) cd -= mod; + cd *= 2; + if (cd >= (mod + 1)) cd -= mod + 1; - if (error_number == 0) { - /* Some compliance checks */ - if (!is_sane(NEON_F, local_source + length - 16, 16)) { - if (!is_sane(NEON_F, local_source + length - 3, 3)) { /* 3-digit Country Code (ISO 3166-1) */ - strcpy(symbol->errtxt, "831: Destination Country Code (last 3 characters) should be numeric"); - } else if (!is_sane(NEON_F, local_source + length - 6, 3)) { /* 3-digit Service Code */ - strcpy(symbol->errtxt, "832: Service Code (characters 6-4 from end) should be numeric"); - } else { /* Last 10 characters of Tracking No. */ - strcpy(symbol->errtxt, - "833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric"); - } - error_number = ZINT_WARN_NONCOMPLIANT; - } + switch (i + relabel) { + case 4: + case 7: + case 11: + case 15: + case 19: + case 21: + case 24: + case 27: + symbol->text[p] = ' '; + p++; + break; } } + cd = mod + 1 - cd; + if (cd == mod) cd = 0; + + if (cd < 10) { + symbol->text[p] = cd + '0'; + } else { + symbol->text[p] = (cd - 10) + 'A'; + } + p++; + + symbol->text[p] = '\0'; + + /* Some compliance checks */ + if (!is_sane(NEON_F, local_source + length - 16, 16)) { + if (!is_sane(NEON_F, local_source + length - 3, 3)) { /* 3-digit Country Code (ISO 3166-1) */ + strcpy(symbol->errtxt, "831: Destination Country Code (last 3 characters) should be numeric"); + } else if (!is_sane(NEON_F, local_source + length - 6, 3)) { /* 3-digit Service Code */ + strcpy(symbol->errtxt, "832: Service Code (characters 6-4 from end) should be numeric"); + } else { /* Last 10 characters of Tracking No. */ + strcpy(symbol->errtxt, + "833: Last 10 characters of Tracking Number (characters 16-7 from end) should be numeric"); + } + error_number = ZINT_WARN_NONCOMPLIANT; + } + return error_number; } @@ -1208,7 +1224,7 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len unsigned char have_check_digit = '\0'; int check_digit; static const char weights[8] = { 8, 6, 4, 2, 3, 5, 9, 7 }; - int error_number = 0, warn_number = 0; + int error_number = 0; if (length != 12 && length != 13) { strcpy(symbol->errtxt, "834: Input must be 12 or 13 characters long"); @@ -1270,7 +1286,7 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len error_number = ZINT_WARN_NONCOMPLIANT; } - (void) code128(symbol, local_source, 13); /* Only error returned is TOO_LONG which can't happen */ + (void) code128(symbol, local_source, 13); /* Only error returned is for large text which can't happen */ j = 0; for (i = 0; i < 13; i++) { @@ -1289,12 +1305,17 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len min_height = min_height_min; } /* Using 50 as default as none recommended */ - warn_number = set_height(symbol, min_height, min_height > 50.0f ? min_height : 50.0f, 0.0f, 0 /*no_errtxt*/); + if (error_number == 0) { + error_number = set_height(symbol, min_height, min_height > 50.0f ? min_height : 50.0f, 0.0f, + 0 /*no_errtxt*/); + } else { + (void) set_height(symbol, min_height, min_height > 50.0f ? min_height : 50.0f, 0.0f, 1 /*no_errtxt*/); + } } else { (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); } - return error_number ? error_number : warn_number; + return error_number; } /* vim: set ts=4 sw=4 et : */ diff --git a/backend/code128.h b/backend/code128.h index aebcfe54..4b1c573c 100644 --- a/backend/code128.h +++ b/backend/code128.h @@ -36,7 +36,8 @@ extern "C" { #endif /* __cplusplus */ -#define C128_MAX 160 +/* Allow for a reasonable number of special Code Set escapes and for GS1 AI delimiters */ +#define C128_MAX 256 #define C128_LATCHA 'A' #define C128_LATCHB 'B' diff --git a/backend/common.c b/backend/common.c index a3054a74..9a8fee60 100644 --- a/backend/common.c +++ b/backend/common.c @@ -269,8 +269,8 @@ INTERNAL int is_stackable(const int symbology) { return 0; } -/* Whether `symbology` can have add-on (EAN-2 and EAN-5) */ -INTERNAL int is_extendable(const int symbology) { +/* Whether `symbology` is EAN/UPC */ +INTERNAL int is_upcean(const int symbology) { switch (symbology) { case BARCODE_EANX: @@ -592,54 +592,6 @@ INTERNAL void segs_cpy(const struct zint_symbol *symbol, const struct zint_seg s } } -/* Returns red component if any of ultra colour indexing "0CBMRYGKW" */ -INTERNAL int colour_to_red(const int colour) { - int return_val = 0; - - switch (colour) { - case 8: /* White */ - case 3: /* Magenta */ - case 4: /* Red */ - case 5: /* Yellow */ - return_val = 255; - break; - } - - return return_val; -} - -/* Returns green component if any of ultra colour indexing "0CBMRYGKW" */ -INTERNAL int colour_to_green(const int colour) { - int return_val = 0; - - switch (colour) { - case 8: /* White */ - case 1: /* Cyan */ - case 5: /* Yellow */ - case 6: /* Green */ - return_val = 255; - break; - } - - return return_val; -} - -/* Returns blue component if any of ultra colour indexing "0CBMRYGKW" */ -INTERNAL int colour_to_blue(const int colour) { - int return_val = 0; - - switch (colour) { - case 8: /* White */ - case 1: /* Cyan */ - case 2: /* Blue */ - case 3: /* Magenta */ - return_val = 255; - break; - } - - return return_val; -} - #ifdef ZINT_TEST /* Dumps hex-formatted codewords in symbol->errtxt (for use in testing) */ INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigned char *codewords, const int length) { diff --git a/backend/common.h b/backend/common.h index decc77b5..12043c4f 100644 --- a/backend/common.h +++ b/backend/common.h @@ -218,8 +218,8 @@ INTERNAL void expand(struct zint_symbol *symbol, const char data[], const int le /* Whether `symbology` can have row binding */ INTERNAL int is_stackable(const int symbology); -/* Whether `symbology` can have add-on (EAN-2 and EAN-5) */ -INTERNAL int is_extendable(const int symbology); +/* Whether `symbology` is EAN/UPC */ +INTERNAL int is_upcean(const int symbology); /* Whether `symbology` can have composite 2D component data */ INTERNAL int is_composite(const int symbology); @@ -272,16 +272,6 @@ INTERNAL void segs_cpy(const struct zint_symbol *symbol, const struct zint_seg s struct zint_seg local_segs[]); -/* Returns red component if any of ultra colour indexing "0CBMRYGKW" */ -INTERNAL int colour_to_red(const int colour); - -/* Returns green component if any of ultra colour indexing "0CBMRYGKW" */ -INTERNAL int colour_to_green(const int colour); - -/* Returns blue component if any of ultra colour indexing "0CBMRYGKW" */ -INTERNAL int colour_to_blue(const int colour); - - #ifdef ZINT_TEST /* Dumps hex-formatted codewords in symbol->errtxt (for use in testing) */ INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigned char *codewords, const int length); diff --git a/backend/composite.c b/backend/composite.c index 5220d60d..2646ac59 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -1249,7 +1249,7 @@ static int linear_dummy_run(int input_mode, unsigned char *source, const int len static const char in_linear_comp[] = " in linear component"; INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int length) { - int error_number, warn_number = 0, cc_mode, cc_width = 0, ecc_level = 0; + int error_number, cc_mode, cc_width = 0, ecc_level = 0; int j, i, k; /* Allow for 8 bits + 5-bit latch per char + 1000 bits overhead/padding */ const unsigned int bs = 13 * length + 1000 + 1; @@ -1581,10 +1581,19 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l if (symbol->output_options & COMPLIANT_HEIGHT) { if (symbol->symbology == BARCODE_DBAR_STK_CC) { /* Databar Stacked needs special treatment due to asymmetric rows */ - warn_number = dbar_omnstk_set_height(symbol, symbol->rows - linear->rows + 1 /*first_row*/); + error_number = dbar_omnstk_set_height(symbol, symbol->rows - linear->rows + 1 /*first_row*/); + } else if (symbol->symbology == BARCODE_DBAR_EXP_CC || symbol->symbology == BARCODE_DBAR_EXPSTK_CC) { + /* If symbol->height given then min row height was returned, else default height */ + if (error_number == 0) { /* Avoid overwriting any `gs1_verify()` warning */ + error_number = set_height(symbol, symbol->height ? linear->height : 0.0f, + symbol->height ? 0.0f : linear->height, 0.0f, 0 /*no_errtxt*/); + } else { + (void) set_height(symbol, symbol->height ? linear->height : 0.0f, + symbol->height ? 0.0f : linear->height, 0.0f, 1 /*no_errtxt*/); + } } else { /* If symbol->height given then min row height was returned, else default height */ - warn_number = set_height(symbol, symbol->height ? linear->height : 0.0f, + error_number = set_height(symbol, symbol->height ? linear->height : 0.0f, symbol->height ? 0.0f : linear->height, 0.0f, 0 /*no_errtxt*/); } } else { @@ -1600,7 +1609,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l ZBarcode_Delete(linear); - return error_number ? error_number : warn_number; + return error_number; } /* vim: set ts=4 sw=4 et : */ diff --git a/backend/emf.c b/backend/emf.c index 94ae47ae..384ea42f 100644 --- a/backend/emf.c +++ b/backend/emf.c @@ -46,7 +46,7 @@ #include "emf.h" /* Multiply truncating to 3 decimal places (avoids rounding differences on various platforms) */ -#define mul3dpf(m, arg) stripf(roundf((m) * (arg) * 1000.0) / 1000.0f) +#define mul3dpf(m, arg) stripf(roundf((m) * (arg) * 1000.0f) / 1000.0f) static int emf_count_rectangles(const struct zint_symbol *symbol) { int rectangles = 0; @@ -367,6 +367,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { recordcount++; if (symbol->symbology == BARCODE_ULTRA) { + static const char ultra_chars[] = "0CBMRYGKW"; for (i = 0; i < 9; i++) { emr_createbrushindirect_colour[i].type = 0x00000027; /* EMR_CREATEBRUSHINDIRECT */ emr_createbrushindirect_colour[i].size = 24; @@ -377,9 +378,10 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { emr_createbrushindirect_colour[i].log_brush.color.green = fggrn; emr_createbrushindirect_colour[i].log_brush.color.blue = fgblu; } else { - emr_createbrushindirect_colour[i].log_brush.color.red = colour_to_red(i); - emr_createbrushindirect_colour[i].log_brush.color.green = colour_to_green(i); - emr_createbrushindirect_colour[i].log_brush.color.blue = colour_to_blue(i); + out_colour_char_to_rgb(ultra_chars[i], + &emr_createbrushindirect_colour[i].log_brush.color.red, + &emr_createbrushindirect_colour[i].log_brush.color.green, + &emr_createbrushindirect_colour[i].log_brush.color.blue); } emr_createbrushindirect_colour[i].log_brush.color.reserved = 0; emr_createbrushindirect_colour[i].log_brush.brush_hatch = 0x0006; /* HS_SOLIDCLR */ @@ -479,7 +481,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { causes various different rendering issues for LibreOffice Draw and Inkscape, so using following hack */ if (previous_diameter != circ->diameter + circ->width) { /* Drawing MaxiCode bullseye using overlayed discs */ previous_diameter = circ->diameter + circ->width; - radius = mul3dpf(0.5, previous_diameter); + radius = mul3dpf(0.5f, previous_diameter); } circle[this_circle].type = 0x0000002a; /* EMR_ELLIPSE */ circle[this_circle].size = 24; @@ -518,9 +520,9 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { if (previous_diameter != hex->diameter) { previous_diameter = hex->diameter; - radius = mul3dpf(0.5, previous_diameter); - half_radius = mul3dpf(0.25, previous_diameter); - half_sqrt3_radius = mul3dpf(0.43301270189221932338, previous_diameter); + radius = mul3dpf(0.5f, previous_diameter); + half_radius = mul3dpf(0.25f, previous_diameter); + half_sqrt3_radius = mul3dpf(0.43301270189221932338f, previous_diameter); } /* Note rotation done via world transform */ @@ -549,7 +551,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { /* Create font records, alignment records and text color */ if (symbol->vector->strings) { - bold = (symbol->output_options & BOLD_TEXT) && !is_extendable(symbol->symbology); + bold = (symbol->output_options & BOLD_TEXT) && !is_upcean(symbol->symbology); memset(&emr_extcreatefontindirectw, 0, sizeof(emr_extcreatefontindirectw)); emr_extcreatefontindirectw.type = 0x00000052; /* EMR_EXTCREATEFONTINDIRECTW */ emr_extcreatefontindirectw.size = 104; diff --git a/backend/gif.c b/backend/gif.c index e6b52a19..64dbcd8c 100644 --- a/backend/gif.c +++ b/backend/gif.c @@ -376,33 +376,12 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf) case '1': /* standard foreground */ RGBCur[0] = RGBfg[0]; RGBCur[1] = RGBfg[1]; RGBCur[2] = RGBfg[2]; break; - case 'W': /* white */ - RGBCur[0] = 255; RGBCur[1] = 255; RGBCur[2] = 255; + default: /* Colour or error case */ + if (!out_colour_char_to_rgb(pixelColour, &RGBCur[0], &RGBCur[1], &RGBCur[2])) { + strcpy(symbol->errtxt, "612: unknown pixel colour"); + return ZINT_ERROR_INVALID_DATA; + } break; - case 'C': /* cyan */ - RGBCur[0] = 0; RGBCur[1] = 255; RGBCur[2] = 255; - break; - case 'B': /* blue */ - RGBCur[0] = 0; RGBCur[1] = 0; RGBCur[2] = 255; - break; - case 'M': /* magenta */ - RGBCur[0] = 255; RGBCur[1] = 0; RGBCur[2] = 255; - break; - case 'R': /* red */ - RGBCur[0] = 255; RGBCur[1] = 0; RGBCur[2] = 0; - break; - case 'Y': /* yellow */ - RGBCur[0] = 255; RGBCur[1] = 255; RGBCur[2] = 0; - break; - case 'G': /* green */ - RGBCur[0] = 0; RGBCur[1] = 255; RGBCur[2] = 0; - break; - case 'K': /* black */ - RGBCur[0] = 0; RGBCur[1] = 0; RGBCur[2] = 0; - break; - default: /* error case - return */ - strcpy(symbol->errtxt, "612: unknown pixel colour"); - return ZINT_ERROR_INVALID_DATA; } /* Search, if RGB value is already present */ fFound = 0; diff --git a/backend/imail.c b/backend/imail.c index 01b5a8b6..4dd2e7a5 100644 --- a/backend/imail.c +++ b/backend/imail.c @@ -33,7 +33,6 @@ /* The function "USPS_MSB_Math_CRC11GenerateFrameCheckSequence" is Copyright (C) 2006 United States Postal Service */ -#include #include "common.h" #include "large.h" @@ -266,11 +265,9 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int return ZINT_ERROR_INVALID_DATA; } - strcpy(zip, ""); - strcpy(tracker, ""); - /* separate the tracking code from the routing code */ + tracker[0] = zip[0] = '\0'; read = 0; j = 0; for (i = 0; i < length; i++) { @@ -407,7 +404,7 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int } } - strcpy(data_pattern, ""); + data_pattern[0] = '\0'; temp[1] = '\0'; for (i = 0; i < 65; i++) { j = 0; diff --git a/backend/library.c b/backend/library.c index 1181f4c9..9960a455 100644 --- a/backend/library.c +++ b/backend/library.c @@ -73,6 +73,7 @@ struct zint_symbol *ZBarcode_Create(void) { symbol->input_mode = DATA_MODE; symbol->eci = 0; /* Default 0 uses ECI 3 */ symbol->dot_size = 4.0f / 5.0f; + symbol->text_gap = 1.0f; symbol->guard_descent = 5.0f; symbol->warn_level = WARN_DEFAULT; symbol->bitmap = NULL; @@ -1100,8 +1101,8 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ 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->text_gap < 0.0f) || (symbol->text_gap > 10.0f)) { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "219: Text gap out of range (0 to 10)"); + if ((symbol->text_gap < -5.0f) || (symbol->text_gap > 10.0f)) { + return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "219: Text gap out of range (-5 to 10)"); } if ((symbol->whitespace_width < 0) || (symbol->whitespace_width > 100)) { return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "766: Whitespace width out of range (0 to 100)"); @@ -1786,8 +1787,8 @@ unsigned int ZBarcode_Cap(int symbol_id, unsigned int cap_flag) { if ((cap_flag & ZINT_CAP_STACKABLE) && is_stackable(symbol_id)) { result |= ZINT_CAP_STACKABLE; } - if ((cap_flag & ZINT_CAP_EXTENDABLE) && is_extendable(symbol_id)) { - result |= ZINT_CAP_EXTENDABLE; + if ((cap_flag & ZINT_CAP_EANUPC) && is_upcean(symbol_id)) { + result |= ZINT_CAP_EANUPC; } if ((cap_flag & ZINT_CAP_COMPOSITE) && is_composite(symbol_id)) { result |= ZINT_CAP_COMPOSITE; diff --git a/backend/output.c b/backend/output.c index d30712d2..665dcf56 100644 --- a/backend/output.c +++ b/backend/output.c @@ -189,6 +189,38 @@ INTERNAL int out_colour_get_cmyk(const char *colour, int *cyan, int *magenta, in return 1 + have_alpha; } +/* Convert internal colour chars "WCBMRYGK" to RGB */ +INTERNAL int out_colour_char_to_rgb(const char ch, unsigned char *red, unsigned char *green, unsigned char *blue) { + static const char chars[] = "WCBMRYGK"; + static const unsigned char colours[8][3] = { + { 0xff, 0xff, 0xff, }, /* White */ + { 0, 0xff, 0xff, }, /* Cyan */ + { 0, 0, 0xff, }, /* Blue */ + { 0xff, 0, 0xff, }, /* Magenta */ + { 0xff, 0, 0, }, /* Red */ + { 0xff, 0xff, 0, }, /* Yellow */ + { 0, 0xff, 0, }, /* Green */ + { 0, 0, 0, }, /* Black */ + }; + int i = posn(chars, ch); + int ret = i != -1; + + if (i == -1) { + i = 7; /* Black (zeroize) */ + } + if (red) { + *red = colours[i][0]; + } + if (green) { + *green = colours[i][1]; + } + if (blue) { + *blue = colours[i][2]; + } + + return ret; +} + /* Return minimum quiet zones for each symbology */ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text, const int comp_xoffset, float *left, float *right, float *top, float *bottom) { @@ -654,50 +686,60 @@ INTERNAL int out_quiet_zones_test(const struct zint_symbol *symbol, const int hi } #endif -/* Set left (x), top (y), right and bottom offsets for whitespace */ +/* Set left (x), top (y), right and bottom offsets for whitespace, also right quiet zone */ INTERNAL void out_set_whitespace_offsets(const struct zint_symbol *symbol, const int hide_text, - const int comp_xoffset, float *xoffset, float *yoffset, float *roffset, float *boffset, - const float scaler, int *xoffset_si, int *yoffset_si, int *roffset_si, int *boffset_si) { + const int comp_xoffset, float *p_xoffset, float *p_yoffset, float *p_roffset, float *p_boffset, + float *p_qz_right, const float scaler, int *p_xoffset_si, int *p_yoffset_si, int *p_roffset_si, + int *p_boffset_si, int *p_qz_right_si) { float qz_left, qz_right, qz_top, qz_bottom; out_quiet_zones(symbol, hide_text, comp_xoffset, &qz_left, &qz_right, &qz_top, &qz_bottom); - *xoffset = symbol->whitespace_width + qz_left; - *roffset = symbol->whitespace_width + qz_right; + *p_xoffset = symbol->whitespace_width + qz_left; + *p_roffset = symbol->whitespace_width + qz_right; if (symbol->output_options & BARCODE_BOX) { - *xoffset += symbol->border_width; - *roffset += symbol->border_width; + *p_xoffset += symbol->border_width; + *p_roffset += symbol->border_width; } - *yoffset = symbol->whitespace_height + qz_top; - *boffset = symbol->whitespace_height + qz_bottom; + *p_yoffset = symbol->whitespace_height + qz_top; + *p_boffset = symbol->whitespace_height + qz_bottom; if (symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP)) { - *yoffset += symbol->border_width; - *boffset += symbol->border_width; + *p_yoffset += symbol->border_width; + if (symbol->output_options & (BARCODE_BOX | BARCODE_BIND)) { + *p_boffset += symbol->border_width; + } + } + + if (p_qz_right) { + *p_qz_right = qz_right; } if (scaler) { - if (xoffset_si) { - *xoffset_si = (int) (*xoffset * scaler); + if (p_xoffset_si) { + *p_xoffset_si = (int) (*p_xoffset * scaler); } - if (yoffset_si) { - *yoffset_si = (int) (*yoffset * scaler); + if (p_yoffset_si) { + *p_yoffset_si = (int) (*p_yoffset * scaler); } - if (roffset_si) { - *roffset_si = (int) (*roffset * scaler); + if (p_roffset_si) { + *p_roffset_si = (int) (*p_roffset * scaler); } - if (boffset_si) { - *boffset_si = (int) (*boffset * scaler); + if (p_boffset_si) { + *p_boffset_si = (int) (*p_boffset * scaler); + } + if (p_qz_right_si) { + *p_qz_right_si = (int) (qz_right * scaler); } } } /* Set composite offset and main width excluding add-on (for start of add-on calc) and add-on text, returning - UPC/EAN type */ + EAN/UPC type */ INTERNAL int out_process_upcean(const struct zint_symbol *symbol, const int comp_xoffset, int *p_main_width, - unsigned char addon[6], int *p_addon_gap) { + unsigned char addon[6], int *p_addon_len, int *p_addon_gap) { int main_width; /* Width of main linear symbol, excluding add-on */ - int upceanflag; /* UPC/EAN type flag */ + int upceanflag; /* EAN/UPC type flag */ int i, j, latch; const int text_length = (int) ustrlen(symbol->text); @@ -715,6 +757,7 @@ INTERNAL int out_process_upcean(const struct zint_symbol *symbol, const int comp } addon[j] = '\0'; if (latch) { + *p_addon_len = (int) ustrlen(addon); if (symbol->symbology == BARCODE_UPCA || symbol->symbology == BARCODE_UPCA_CHK || symbol->symbology == BARCODE_UPCA_CC) { *p_addon_gap = symbol->option_2 >= 9 && symbol->option_2 <= 12 ? symbol->option_2 : 9; @@ -836,66 +879,6 @@ INTERNAL float out_large_bar_height(struct zint_symbol *symbol, const int si, in return large_bar_height; } -/* Split UPC/EAN add-on text into various constituents */ -INTERNAL void out_upcean_split_text(const int upceanflag, const unsigned char text[], unsigned char textparts[4][7]) { - int i; - - if (upceanflag == 6) { /* UPC-E */ - textparts[0][0] = text[0]; - textparts[0][1] = '\0'; - - for (i = 0; i < 6; i++) { - textparts[1][i] = text[i + 1]; - } - textparts[1][6] = '\0'; - - textparts[2][0] = text[7]; - textparts[2][1] = '\0'; - - } else if (upceanflag == 8) { /* EAN-8 */ - for (i = 0; i < 4; i++) { - textparts[0][i] = text[i]; - } - textparts[0][4] = '\0'; - - for (i = 0; i < 4; i++) { - textparts[1][i] = text[i + 4]; - } - textparts[1][4] = '\0'; - - } else if (upceanflag == 12) { /* UPC-A */ - textparts[0][0] = text[0]; - textparts[0][1] = '\0'; - - for (i = 0; i < 5; i++) { - textparts[1][i] = text[i + 1]; - } - textparts[1][5] = '\0'; - - for (i = 0; i < 5; i++) { - textparts[2][i] = text[i + 6]; - } - textparts[2][5] = '\0'; - - textparts[3][0] = text[11]; - textparts[3][1] = '\0'; - - } else if (upceanflag == 13) { /* EAN-13 */ - textparts[0][0] = text[0]; - textparts[0][1] = '\0'; - - for (i = 0; i < 6; i++) { - textparts[1][i] = text[i + 1]; - } - textparts[1][6] = '\0'; - - for (i = 0; i < 6; i++) { - textparts[2][i] = text[i + 7]; - } - textparts[2][6] = '\0'; - } -} - #ifdef _WIN32 /* Convert UTF-8 to Windows wide chars. Ticket #288, props Marcel */ #define utf8_to_wide(u, w, r) \ diff --git a/backend/output.h b/backend/output.h index a6cd1b19..03080b43 100644 --- a/backend/output.h +++ b/backend/output.h @@ -49,15 +49,19 @@ INTERNAL int out_colour_get_rgb(const char *colour, unsigned char *red, unsigned INTERNAL int out_colour_get_cmyk(const char *colour, int *cyan, int *magenta, int *yellow, int *black, unsigned char *rgb_alpha); -/* Set left (x), top (y), right and bottom offsets for whitespace */ +/* Convert internal colour chars "WCBMRYGK" to RGB */ +INTERNAL int out_colour_char_to_rgb(const char ch, unsigned char *red, unsigned char *green, unsigned char *blue); + +/* Set left (x), top (y), right and bottom offsets for whitespace, also right quiet zone */ INTERNAL void out_set_whitespace_offsets(const struct zint_symbol *symbol, const int hide_text, - const int comp_xoffset, float *xoffset, float *yoffset, float *roffset, float *boffset, - const float scaler, int *xoffset_si, int *yoffset_si, int *roffset_si, int *boffset_si); + const int comp_xoffset, float *p_xoffset, float *p_yoffset, float *p_roffset, float *p_boffset, + float *p_qz_right, const float scaler, int *p_xoffset_si, int *p_yoffset_si, int *p_roffset_si, + int *p_boffset_si, int *p_qz_right_si); /* Set composite offset and main width excluding add-on (for start of add-on calc) and add-on text, returning - UPC/EAN type */ + EAN/UPC type */ INTERNAL int out_process_upcean(const struct zint_symbol *symbol, const int comp_xoffset, int *p_main_width, - unsigned char addon[6], int *p_addon_gap); + unsigned char addon[6], int *p_addon_len, int *p_addon_gap); /* Calculate large bar height i.e. linear bars with zero row height that respond to the symbol height. If scaler `si` non-zero (raster), then large_bar_height if non-zero or else row heights will be rounded @@ -65,9 +69,6 @@ INTERNAL int out_process_upcean(const struct zint_symbol *symbol, const int comp INTERNAL float out_large_bar_height(struct zint_symbol *symbol, const int si, int *row_heights_si, int *symbol_height_si); -/* Split UPC/EAN add-on text into various constituents */ -INTERNAL void out_upcean_split_text(const int upceanflag, const unsigned char text[], unsigned char textparts[4][7]); - /* Create output file, creating sub-directories if necessary. Returns `fopen()` FILE pointer */ INTERNAL FILE *out_fopen(const char filename[256], const char *mode); diff --git a/backend/pcx.c b/backend/pcx.c index 6c73a1f5..8a286e95 100644 --- a/backend/pcx.c +++ b/backend/pcx.c @@ -111,69 +111,24 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix const unsigned char ch = pb[column]; switch (colour) { case 0: - switch (ch) { - case 'W': /* White */ - case 'M': /* Magenta */ - case 'R': /* Red */ - case 'Y': /* Yellow */ - rle_row[column] = 255; - break; - case 'C': /* Cyan */ - case 'B': /* Blue */ - case 'G': /* Green */ - case 'K': /* Black */ - rle_row[column] = 0; - break; - case '1': - rle_row[column] = fgred; - break; - default: - rle_row[column] = bgred; - break; + if (ch == '0' || ch == '1') { + rle_row[column] = ch != '0' ? fgred : bgred; + } else { + out_colour_char_to_rgb(ch, &rle_row[column], NULL, NULL); } break; case 1: - switch (ch) { - case 'W': /* White */ - case 'C': /* Cyan */ - case 'Y': /* Yellow */ - case 'G': /* Green */ - rle_row[column] = 255; - break; - case 'B': /* Blue */ - case 'M': /* Magenta */ - case 'R': /* Red */ - case 'K': /* Black */ - rle_row[column] = 0; - break; - case '1': - rle_row[column] = fggrn; - break; - default: - rle_row[column] = bggrn; - break; + if (ch == '0' || ch == '1') { + rle_row[column] = ch != '0' ? fggrn : bggrn; + } else { + out_colour_char_to_rgb(ch, NULL, &rle_row[column], NULL); } break; case 2: - switch (ch) { - case 'W': /* White */ - case 'C': /* Cyan */ - case 'B': /* Blue */ - case 'M': /* Magenta */ - rle_row[column] = 255; - break; - case 'R': /* Red */ - case 'Y': /* Yellow */ - case 'G': /* Green */ - case 'K': /* Black */ - rle_row[column] = 0; - break; - case '1': - rle_row[column] = fgblu; - break; - default: - rle_row[column] = bgblu; - break; + if (ch == '0' || ch == '1') { + rle_row[column] = ch != '0' ? fgblu : bgblu; + } else { + out_colour_char_to_rgb(ch, NULL, NULL, &rle_row[column]); } break; case 3: diff --git a/backend/png.c b/backend/png.c index 950e2931..f028a72e 100644 --- a/backend/png.c +++ b/backend/png.c @@ -105,7 +105,7 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix png_color palette[32]; int num_palette; unsigned char trans_alpha[32]; - int num_trans; + int num_trans = 0; int bit_depth; int compression_strategy; const unsigned char *pb; @@ -117,22 +117,11 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix (void) out_colour_get_rgb(symbol->fgcolour, &fg.red, &fg.green, &fg.blue, &fg_alpha); (void) out_colour_get_rgb(symbol->bgcolour, &bg.red, &bg.green, &bg.blue, &bg_alpha); - num_trans = 0; if (symbol->symbology == BARCODE_ULTRA) { - static const int ultra_chars[8] = { 'W', 'C', 'B', 'M', 'R', 'Y', 'G', 'K' }; - static const png_color ultra_colours[8] = { - { 0xff, 0xff, 0xff, }, /* White */ - { 0, 0xff, 0xff, }, /* Cyan */ - { 0, 0, 0xff, }, /* Blue */ - { 0xff, 0, 0xff, }, /* Magenta */ - { 0xff, 0, 0, }, /* Red */ - { 0xff, 0xff, 0, }, /* Yellow */ - { 0, 0xff, 0, }, /* Green */ - { 0, 0, 0, }, /* Black */ - }; + static const unsigned char ultra_chars[8] = { 'W', 'C', 'B', 'M', 'R', 'Y', 'G', 'K' }; for (i = 0; i < 8; i++) { map[ultra_chars[i]] = i; - palette[i] = ultra_colours[i]; + out_colour_char_to_rgb(ultra_chars[i], &palette[i].red, &palette[i].green, &palette[i].blue); if (fg_alpha != 0xff) { trans_alpha[i] = fg_alpha; } @@ -170,10 +159,11 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix palette[num_palette++] = bg; } else { /* Alpha and no foreground alpha - add to front & move white to end */ + png_color white = palette[0]; /* Take copy */ map['0'] = 0; palette[0] = bg; map['W'] = num_palette; - palette[num_palette++] = ultra_colours[0]; + palette[num_palette++] = white; } if (bg_alpha != 0xff) { trans_alpha[num_trans++] = bg_alpha; diff --git a/backend/postal.c b/backend/postal.c index 5ca6dc61..51ef1b67 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -593,7 +593,7 @@ INTERNAL int daft(struct zint_symbol *symbol, unsigned char source[], int length symbol->height = 8.0f; } symbol->row_height[1] = stripf(symbol->height * t_ratio); - symbol->row_height[0] = stripf((symbol->height - symbol->row_height[1]) / 2.0); + symbol->row_height[0] = stripf((symbol->height - symbol->row_height[1]) / 2.0f); } else { symbol->row_height[0] = 3.0f; symbol->row_height[1] = 2.0f; diff --git a/backend/ps.c b/backend/ps.c index 48a16822..8e9ac42d 100644 --- a/backend/ps.c +++ b/backend/ps.c @@ -83,14 +83,14 @@ static void ps_convert(const unsigned char *string, unsigned char *ps_string) { *p++ = '\\'; *p++ = *s; break; - case 0xC2: /* See `to_iso8859_1()` in raster.c */ - *p++ = *++s; + case 0xC2: + *p++ = *++s; /* C2 80-BF -> 80-BF */ break; case 0xC3: - *p++ = *++s + 64; + *p++ = *++s + 0x40; /* C3 80-BF -> C0-FF */ break; default: - if (*s < 0x80) { + if (*s < 0x80) { /* ASCII - all other Unicode points > U+00FF ignored */ *p++ = *s; } break; @@ -189,7 +189,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) { int ps_len = 0; int iso_latin1 = 0; int have_circles_with_width = 0, have_circles_without_width = 0; - const int extendable = is_extendable(symbol->symbology); + const int upcean = is_upcean(symbol->symbology); const int output_to_stdout = symbol->output_options & BARCODE_STDOUT; const int is_rgb = (symbol->output_options & CMYK_COLOUR) == 0; @@ -400,9 +400,9 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) { float hy = symbol->vector->height - hex->y; if (previous_diameter != hex->diameter) { previous_diameter = hex->diameter; - out_putsf("", 4, (float) (0.5 * previous_diameter) /*radius*/, feps); - out_putsf(" ", 4, (float) (0.43301270189221932338 * previous_diameter) /*half_sqrt3_radius*/, feps); - out_putsf(" ", 4, (float) (0.25 * previous_diameter) /*half_radius*/, feps); + out_putsf("", 4, 0.5f * previous_diameter /*radius*/, feps); + out_putsf(" ", 4, 0.43301270189221932338f * previous_diameter /*half_sqrt3_radius*/, feps); + out_putsf(" ", 4, 0.25f * previous_diameter /*half_radius*/, feps); fputc('\n', feps); } if (hex->next) { @@ -420,7 +420,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) { for (circle = symbol->vector->circles; circle; circle = circle->next) { if (previous_diameter != circle->diameter - circle->width) { previous_diameter = circle->diameter - circle->width; - radius = (float) (0.5 * previous_diameter); + radius = 0.5f * previous_diameter; } if (circle->colour) { /* Legacy - no longer used */ /* A 'white' circle */ @@ -458,7 +458,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) { const char *font; unsigned char *ps_string = (unsigned char *) z_alloca(ps_len + 1); - if ((symbol->output_options & BOLD_TEXT) && !extendable) { + if ((symbol->output_options & BOLD_TEXT) && !upcean) { font = "Helvetica-Bold"; } else { font = "Helvetica"; @@ -479,7 +479,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) { if (string->fsize != previous_fsize) { fprintf(feps, "/%s findfont", font); /* Compensate for Helvetica being smaller than Zint's OCR-B */ - out_putsf( " ", 2, extendable ? string->fsize * 1.07f : string->fsize, feps); + out_putsf( " ", 2, upcean ? string->fsize * 1.07f : string->fsize, feps); fputs(" scalefont setfont\n", feps); previous_fsize = string->fsize; } diff --git a/backend/qr.c b/backend/qr.c index bc70c1aa..2c9834bf 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -1014,12 +1014,11 @@ static void qr_populate_grid(unsigned char *grid, const int h_size, const int v_ } #ifdef ZINTLOG - -static int append_log(char log) { +static int append_log(unsigned char log) { FILE *file; file = fopen("zintlog.txt", "a+"); - fprintf(file, "%c", log); + fprintf(file, "%02X", log); (void) fclose(file); return 0; } @@ -1028,8 +1027,7 @@ static int write_log(char log[]) { FILE *file; file = fopen("zintlog.txt", "a+"); - fprintf(file, log); /*writes*/ - fprintf(file, "\r\n"); /*writes*/ + fprintf(file, "%s\n", log); /*writes*/ (void) fclose(file); return 0; } @@ -1055,14 +1053,11 @@ static int qr_evaluate(unsigned char *local, const int size) { #ifdef ZINTLOG /* bitmask output */ for (y = 0; y < size; y++) { - strcpy(str, ""); for (x = 0; x < size; x++) { - state = local[(y * size) + x]; - append_log(state); + append_log(local[(y * size) + x]); } write_log(""); } - write_log(""); #endif /* Test 1: Adjacent modules in row/column in same colour */ @@ -1297,6 +1292,9 @@ static int qr_apply_bitmask(unsigned char *grid, const int size, const int ecc_l int size_squared = size * size; unsigned char *mask = (unsigned char *) z_alloca(size_squared); unsigned char *local = (unsigned char *) z_alloca(size_squared); +#ifdef ZINTLOG + char str[15]; +#endif /* Perform data masking */ memset(mask, 0, size_squared); @@ -1382,8 +1380,7 @@ static int qr_apply_bitmask(unsigned char *grid, const int size, const int ecc_l } #ifdef ZINTLOG - char str[15]; - sprintf(str, "%d", best_val); + sprintf(str, "%d", best_pattern); write_log("chose pattern:"); write_log(str); #endif diff --git a/backend/raster.c b/backend/raster.c index 192fe533..9c1f0681 100644 --- a/backend/raster.c +++ b/backend/raster.c @@ -47,7 +47,11 @@ #define DEFAULT_INK '1' /* Black */ #define DEFAULT_PAPER '0' /* White */ -#define UPCEAN_TEXT 1 /* Helper flag for `draw_string()`/`draw_letter()` to indicate dealing with UPC/EAN */ +/* Flags for `draw_string()`/`draw_letter()` */ +#define ZFONT_HALIGN_CENTRE 0 +#define ZFONT_HALIGN_LEFT 1 +#define ZFONT_HALIGN_RIGHT 2 +#define ZFONT_UPCEAN_TEXT 4 /* Helper flag to indicate dealing with EAN/UPC */ #ifndef ZINT_NO_PNG INTERNAL int png_pixel_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf); @@ -260,7 +264,7 @@ static void draw_pt(unsigned char *buf, const int buf_width, const int buf_heigh /* Draw the first line of a bar, to be completed by `copy_bar_line()`; more performant than multiple `draw_bar()`s */ static void draw_bar_line(unsigned char *pixelbuf, const int xpos, const int xlen, const int ypos, - const int image_width, const char fill) { + const int image_width, const int fill) { unsigned char *pb = pixelbuf + ((size_t) image_width * ypos) + xpos; memset(pb, fill, xlen); @@ -282,7 +286,7 @@ static void copy_bar_line(unsigned char *pixelbuf, const int xpos, const int xle /* Draw a rectangle */ static void draw_bar(unsigned char *pixelbuf, const int xpos, const int xlen, const int ypos, const int ylen, - const int image_width, const int image_height, const char fill) { + const int image_width, const int image_height, const int fill) { int y; const int ye = ypos + ylen > image_height ? image_height : ypos + ylen; /* Defensive, should never happen */ unsigned char *pb = pixelbuf + ((size_t) image_width * ypos) + xpos; @@ -306,7 +310,7 @@ static void draw_letter(unsigned char *pixelbuf, const unsigned char letter, int int font_y; int half_si; int odd_si; - unsigned char *linePtr, *maxPtr; + unsigned char *linePtr; int x_start = 0; if (letter < 33) { @@ -330,7 +334,7 @@ static void draw_letter(unsigned char *pixelbuf, const unsigned char letter, int glyph_no = letter - 33; } - if (textflags & UPCEAN_TEXT) { /* Needs to be before SMALL_TEXT check */ + if (textflags & ZFONT_UPCEAN_TEXT) { /* Needs to be before SMALL_TEXT check */ /* No bold for UPCEAN */ if (textflags & SMALL_TEXT) { font_table = upcean_small_font; @@ -375,8 +379,8 @@ static void draw_letter(unsigned char *pixelbuf, const unsigned char letter, int unsigned char *pixelPtr = linePtr; /* Avoid warning */ for (y_si = 0; y_si < half_si; y_si++) { int extra_dot = 0; + unsigned char *const maxPtr = linePtr + image_width - xposn; pixelPtr = linePtr; - maxPtr = linePtr + image_width - xposn; for (x = x_start; x < max_x && pixelPtr < maxPtr; x++) { unsigned set = font_table[font_y + y] & (glyph_mask >> x); for (x_si = 0; x_si < half_si && pixelPtr < maxPtr; x_si++) { @@ -409,12 +413,13 @@ static void draw_letter(unsigned char *pixelbuf, const unsigned char letter, int } /* Plot a string into the pixel buffer */ -static void draw_string(unsigned char *pixbuf, const unsigned char input_string[], const int xposn, const int yposn, - const int textflags, const int image_width, const int image_height, const int si) { - int i, string_length, string_left_hand, letter_width, letter_gap; - int half_si = si / 2, odd_si = si & 1, x_incr; +static void draw_string(unsigned char *pixelbuf, const unsigned char input_string[], int length, const int xposn, + const int yposn, const int textflags, const int image_width, const int image_height, const int si) { + int i, string_left_hand, letter_width, letter_gap; + const int half_si = si / 2, odd_si = si & 1; + int x_incr; - if (textflags & UPCEAN_TEXT) { /* Needs to be before SMALL_TEXT check */ + if (textflags & ZFONT_UPCEAN_TEXT) { /* Needs to be before SMALL_TEXT check */ /* No bold for UPCEAN */ letter_width = textflags & SMALL_TEXT ? UPCEAN_SMALL_FONT_WIDTH : UPCEAN_FONT_WIDTH; letter_gap = 4; @@ -431,18 +436,26 @@ static void draw_string(unsigned char *pixbuf, const unsigned char input_string[ } letter_width += letter_gap; - string_length = (int) ustrlen(input_string); - - string_left_hand = xposn - ((letter_width * string_length - letter_gap) * half_si) / 2; - if (odd_si) { - string_left_hand -= (letter_width * string_length - letter_gap) / 4; + if (length == -1) { + length = (int) ustrlen(input_string); } - for (i = 0; i < string_length; i++) { + + if (textflags & ZFONT_HALIGN_LEFT) { + string_left_hand = xposn; + } else if (textflags & ZFONT_HALIGN_RIGHT) { + string_left_hand = xposn - ((letter_width * length - letter_gap) * half_si); + } else { + string_left_hand = xposn - (int) roundf(((letter_width * length - letter_gap) * half_si) / 2.0f); + } + if (odd_si) { + string_left_hand -= (letter_width * length - letter_gap) / 4; + } + for (i = 0; i < length; i++) { x_incr = i * letter_width * half_si; if (odd_si) { x_incr += i * letter_width / 2; } - draw_letter(pixbuf, input_string[i], string_left_hand + x_incr, yposn, textflags, image_width, image_height, + draw_letter(pixelbuf, input_string[i], string_left_hand + x_incr, yposn, textflags, image_width, image_height, si); } } @@ -647,7 +660,8 @@ static void plot_hexagon(unsigned char *scaled_hexagon, const int hex_width, con /* Draw binding or box */ static void draw_bind_box(const struct zint_symbol *symbol, unsigned char *pixelbuf, const int xoffset_si, const int yoffset_si, const int symbol_height_si, const int dot_overspill_si, - const int image_width, const int image_height, const int si) { + const int upceanflag, const int textoffset_si, const int image_width, const int image_height, + const int si) { if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP))) { const int no_extend = symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF || symbol->symbology == BARCODE_DPD; @@ -658,6 +672,9 @@ static void draw_bind_box(const struct zint_symbol *symbol, unsigned char *pixel if (horz_outside) { ybind_top = 0; ybind_bot = image_height - bwidth_si; + } else if (upceanflag == 2 || upceanflag == 5) { + ybind_top += textoffset_si; + ybind_bot += textoffset_si; } /* Horizontal boundary bars */ if ((symbol->output_options & BARCODE_BOX) || !no_extend) { @@ -683,6 +700,8 @@ static void draw_bind_box(const struct zint_symbol *symbol, unsigned char *pixel if (horz_outside) { box_top = bwidth_si; box_height = image_height - bwidth_si * 2; + } else if (upceanflag == 2 || upceanflag == 5) { + box_top += textoffset_si; } draw_bar(pixelbuf, 0, bwidth_si, box_top, box_height, image_width, image_height, DEFAULT_INK); draw_bar(pixelbuf, xbox_right, bwidth_si, box_top, box_height, image_width, image_height, DEFAULT_INK); @@ -714,7 +733,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang scaler *= 10.0f; out_set_whitespace_offsets(symbol, 0 /*hide_text*/, 0 /*comp_xoffset*/, &xoffset, &yoffset, &roffset, &boffset, - scaler, &xoffset_si, &yoffset_si, &roffset_si, &boffset_si); + NULL /*qz_right*/, scaler, &xoffset_si, &yoffset_si, &roffset_si, &boffset_si, NULL /*qz_right_si*/); hex_width = (int) roundf(scaler); /* Short diameter, X in ISO/IEC 16023:2000 Figure 8 (same as W) */ hex_height = (int) roundf(scaler * two_div_sqrt3); /* Long diameter, V in Figure 8 */ @@ -772,7 +791,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang xoffset_si, yoffset_si); draw_bind_box(symbol, pixelbuf, xoffset_si, yoffset_si, hex_image_height, 0 /*dot_overspill_si*/, - image_width, image_height, (int) scaler); + 0 /*upceanflag*/, 0 /*textoffset_si*/, image_width, image_height, (int) scaler); error_number = save_raster_image_to_file(symbol, image_height, image_width, pixelbuf, rotate_angle, file_type); free(scaled_hexagon); @@ -812,7 +831,7 @@ static int plot_raster_dotty(struct zint_symbol *symbol, const int rotate_angle, dot_radius_si = (int) dot_radius_s; out_set_whitespace_offsets(symbol, 0 /*hide_text*/, 0 /*comp_xoffset*/, &xoffset, &yoffset, &roffset, &boffset, - scaler, &xoffset_si, &yoffset_si, &roffset_si, &boffset_si); + NULL /*qz_right*/, scaler, &xoffset_si, &yoffset_si, &roffset_si, &boffset_si, NULL /*qz_right_si*/); /* TODO: Revisit this overspill stuff, it's hacky */ if (symbol->dot_size < 1.0f) { @@ -850,7 +869,7 @@ static int plot_raster_dotty(struct zint_symbol *symbol, const int rotate_angle, } draw_bind_box(symbol, scaled_pixelbuf, xoffset_si, yoffset_si, symbol_height_si, dot_overspill_si, - scale_width, scale_height, (int) scaler); + 0 /*upceanflag*/, 0 /*textoffset_si*/, scale_width, scale_height, (int) scaler); error_number = save_raster_image_to_file(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle, file_type); @@ -905,26 +924,25 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl int main_width; int comp_xoffset = 0; unsigned char addon[6]; + int addon_len = 0; int addon_gap = 0; float addon_text_yposn = 0.0f; float xoffset, yoffset, roffset, boffset; float textoffset; int upceanflag = 0; int addon_latch = 0; - unsigned char textparts[4][7]; int hide_text; int i, r; int block_width = 0; int font_height; /* Font pixel size (so whole integers) */ - float text_gap; /* Gap between barcode and text */ float guard_descent; const int upcean_guard_whitespace = !(symbol->output_options & BARCODE_NO_QUIET_ZONES) && (symbol->output_options & EANUPC_GUARD_WHITESPACE); const int is_codablockf = symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF; int textflags = 0; - int xoffset_si, yoffset_si, roffset_si, boffset_si; - int comp_xoffset_si; + int xoffset_si, yoffset_si, roffset_si, boffset_si, qz_right_si; + int xoffset_comp_si; int row_heights_si[200]; int symbol_height_si; int image_width, image_height; @@ -955,28 +973,28 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl comp_xoffset++; } } - if (is_extendable(symbol->symbology)) { - upceanflag = out_process_upcean(symbol, comp_xoffset, &main_width, addon, &addon_gap); + if (is_upcean(symbol->symbology)) { + upceanflag = out_process_upcean(symbol, comp_xoffset, &main_width, addon, &addon_len, &addon_gap); } hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0) || scaler < 1.0f); - out_set_whitespace_offsets(symbol, hide_text, comp_xoffset, &xoffset, &yoffset, &roffset, &boffset, si, - &xoffset_si, &yoffset_si, &roffset_si, &boffset_si); + out_set_whitespace_offsets(symbol, hide_text, comp_xoffset, &xoffset, &yoffset, &roffset, &boffset, + NULL /*qz_right*/, si, &xoffset_si, &yoffset_si, &roffset_si, &boffset_si, &qz_right_si); - comp_xoffset_si = xoffset_si + comp_xoffset * si; + xoffset_comp_si = xoffset_si + comp_xoffset * si; + + image_width = symbol->width * si + xoffset_si + roffset_si; /* Note font sizes halved as in pixels */ if (upceanflag) { - textflags = UPCEAN_TEXT | (symbol->output_options & SMALL_TEXT); /* Bold not available for UPC/EAN */ + textflags = ZFONT_UPCEAN_TEXT | (symbol->output_options & SMALL_TEXT); /* Bold not available for EAN/UPC */ font_height = (UPCEAN_FONT_HEIGHT + 1) / 2; - text_gap = symbol->text_gap ? symbol->text_gap : 1.0f; /* Height of guard bar descent (none for EAN-2 and EAN-5) */ guard_descent = upceanflag >= 6 ? symbol->guard_descent : 0.0f; } else { textflags = symbol->output_options & (SMALL_TEXT | BOLD_TEXT); font_height = textflags & SMALL_TEXT ? (SMALL_FONT_HEIGHT + 1) / 2 : (NORMAL_FONT_HEIGHT + 1) / 2; - text_gap = symbol->text_gap ? symbol->text_gap : 1.0f; guard_descent = 0.0f; } @@ -984,17 +1002,16 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl textoffset = guard_descent; } else { if (upceanflag) { - textoffset = font_height + text_gap; + textoffset = font_height + symbol->text_gap; if (textoffset < guard_descent) { textoffset = guard_descent; } } else { - textoffset = font_height + text_gap; + textoffset = font_height + symbol->text_gap; } } - image_width = symbol->width * si + xoffset_si + roffset_si; - image_height = symbol_height_si + textoffset * si + yoffset_si + boffset_si; + image_height = symbol_height_si + (int) ceilf(textoffset * si) + yoffset_si + boffset_si; assert(image_width && image_height); if (!(pixelbuf = (unsigned char *) malloc((size_t) image_width * image_height))) { @@ -1035,12 +1052,12 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl && module_is_set(symbol, r, i + block_width) == fill; block_width++); if ((r == (symbol->rows - 1)) && (i > main_width) && (addon_latch == 0)) { int addon_row_height_si; - const int text_offset_si = (font_height + text_gap) * si; + const int addon_row_adj_si = (int) ceilf((font_height + symbol->text_gap) * si); copy_bar_line(pixelbuf, xoffset_si, main_width * si, yposn_si, row_height_si, image_width, image_height); addon_text_yposn = yposn_si; - yposn_si += text_offset_si; - addon_row_height_si = row_height_si - text_offset_si; + yposn_si += addon_row_adj_si; + addon_row_height_si = row_height_si - addon_row_adj_si; if (upceanflag != 12 && upceanflag != 6) { /* UPC-A/E add-ons don't descend */ addon_row_height_si += guard_descent * si; } @@ -1069,10 +1086,13 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl } else { if (upceanflag && !hide_text) { /* EAN-2, EAN-5 (standalone add-ons) */ - yposn_si += (int) (font_height + text_gap) * si; + yposn_si += (int) ceilf((font_height + symbol->text_gap) * si); } for (r = 0; r < symbol->rows; r++) { - const int row_height_si = row_heights_si[r]; + int row_height_si = row_heights_si[r]; + if (upceanflag && !hide_text) { /* EAN-2, EAN-5 (standalone add-ons) */ + row_height_si += textoffset * si - (yposn_si - yoffset_si); + } for (i = 0; i < symbol->width; i += block_width) { const int fill = module_is_set(symbol, r, i); @@ -1096,19 +1116,19 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl const int guard_descent_si = guard_descent * si; if (upceanflag == 6) { /* UPC-E */ - draw_bar_line(pixelbuf, 0 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 2 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 46 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 48 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 50 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 0 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 2 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 46 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 48 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 50 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); } else if (upceanflag == 8) { /* EAN-8 */ - draw_bar_line(pixelbuf, 0 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 2 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 32 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 34 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 64 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 66 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 0 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 2 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 32 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 34 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 64 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 66 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); } else if (upceanflag == 12) { /* UPC-A */ for (i = 0 + comp_xoffset; i < 11 + comp_xoffset; i += block_width) { @@ -1121,8 +1141,8 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl DEFAULT_INK); } } - draw_bar_line(pixelbuf, 46 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 48 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 46 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 48 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); for (i = 85 + comp_xoffset; i < 96 + comp_xoffset; i += block_width) { const int fill = module_is_set(symbol, symbol->rows - 1, i); for (block_width = 1; (i + block_width < symbol->width) @@ -1135,150 +1155,154 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl } } else { /* EAN-13 */ - draw_bar_line(pixelbuf, 0 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 2 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 46 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 48 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 92 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); - draw_bar_line(pixelbuf, 94 * si + comp_xoffset_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 0 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 2 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 46 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 48 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 92 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); + draw_bar_line(pixelbuf, 94 * si + xoffset_comp_si, 1 * si, guard_yoffset_si, image_width, DEFAULT_INK); } - copy_bar_line(pixelbuf, comp_xoffset_si, image_width - comp_xoffset_si - roffset_si, guard_yoffset_si, + copy_bar_line(pixelbuf, xoffset_comp_si, image_width - xoffset_comp_si - roffset_si, guard_yoffset_si, guard_descent_si, image_width, image_height); } /* Add the text */ if (!hide_text) { - int text_yposn = yoffset_si + symbol_height_si + (int) (text_gap * si); /* Calculated to top of text */ - if (upceanflag == 2 || upceanflag == 5) { /* EAN-2/5 */ - text_yposn = yoffset_si; - } - if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) { - text_yposn += symbol->border_width * si; /* Note not needed for BARCODE_BIND_TOP */ - } if (upceanflag >= 6) { /* UPC-E, EAN-8, UPC-A, EAN-13 */ - const int addon_len = (int) ustrlen(addon); /* Note font sizes halved as in pixels */ - - /* Halved again to get middle position that draw_string() expects */ - const int upcea_width_adj = (UPCEAN_SMALL_FONT_WIDTH + 3) / 4; const int upcea_height_adj = ((UPCEAN_FONT_HEIGHT - UPCEAN_SMALL_FONT_HEIGHT) * si + 1) / 2; - /* Halved again to get middle position that draw_string() expects */ - const int ean_width_adj = (UPCEAN_FONT_WIDTH + 3) / 4; - out_upcean_split_text(upceanflag, symbol->text, textparts); + int text_yposn = yoffset_si + symbol_height_si + (int) (symbol->text_gap * si); + if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) { + text_yposn += symbol->border_width * si; /* Note not needed for BARCODE_BIND_TOP */ + } if (upceanflag == 6) { /* UPC-E */ - int text_xposn = -(5 + upcea_width_adj) * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[0], text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, - image_width, image_height, si); - text_xposn = 24 * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[1], text_xposn, text_yposn, textflags, image_width, image_height, si); - text_xposn = (51 + 3 + upcea_width_adj) * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[2], text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, - image_width, image_height, si); + int text_xposn = -5 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text, 1, text_xposn, text_yposn + upcea_height_adj, + textflags | SMALL_TEXT | ZFONT_HALIGN_RIGHT, image_width, image_height, si); + text_xposn = 24 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text + 1, 6, text_xposn, text_yposn, textflags, image_width, + image_height, si); + text_xposn = (51 + 3) * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text + 7, 1, text_xposn, text_yposn + upcea_height_adj, + textflags | SMALL_TEXT | ZFONT_HALIGN_LEFT, image_width, image_height, si); if (addon_len) { - text_xposn = ((addon_len == 2 ? 61 : 75) + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, + text_xposn = ((addon_len == 2 ? 61 : 75) + addon_gap) * si + xoffset_comp_si; + draw_string(pixelbuf, addon, addon_len, text_xposn, addon_text_yposn, textflags, image_width, image_height, si); if (upcean_guard_whitespace) { - text_xposn = (int) (((addon_len == 2 ? 70 : 97) + 1.5f + upcea_width_adj + addon_gap) * si) - + comp_xoffset_si; - draw_string(pixelbuf, (const unsigned char *) ">", text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); + text_xposn = symbol->width * si + qz_right_si + xoffset_si; + draw_string(pixelbuf, (const unsigned char *) ">", 1, text_xposn, addon_text_yposn, + textflags | ZFONT_HALIGN_RIGHT, image_width, image_height, si); } } } else if (upceanflag == 8) { /* EAN-8 */ int text_xposn; if (upcean_guard_whitespace) { - text_xposn = -(ean_width_adj + 2) * si + comp_xoffset_si; - draw_string(pixelbuf, (const unsigned char *) "<", text_xposn, text_yposn, textflags, - image_width, image_height, si); + text_xposn = -7 * si + xoffset_comp_si; + draw_string(pixelbuf, (const unsigned char *) "<", 1, text_xposn, text_yposn, + textflags | ZFONT_HALIGN_LEFT, image_width, image_height, si); } - text_xposn = 17 * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[0], text_xposn, text_yposn, textflags, image_width, image_height, si); - text_xposn = 50 * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[1], text_xposn, text_yposn, textflags, image_width, image_height, si); + text_xposn = 17 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text, 4, text_xposn, text_yposn, textflags, image_width, image_height, + si); + text_xposn = 50 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text + 4, 4, text_xposn, text_yposn, textflags, image_width, + image_height, si); if (addon_len) { - text_xposn = ((addon_len == 2 ? 77 : 91) + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, + text_xposn = ((addon_len == 2 ? 77 : 91) + addon_gap) * si + xoffset_comp_si; + draw_string(pixelbuf, addon, addon_len, text_xposn, addon_text_yposn, textflags, image_width, image_height, si); if (upcean_guard_whitespace) { - text_xposn = (int) (((addon_len == 2 ? 86 : 113) + 0.5f + ean_width_adj + addon_gap) * si) - + comp_xoffset_si; - draw_string(pixelbuf, (const unsigned char *) ">", text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); + text_xposn = symbol->width * si + qz_right_si + xoffset_si; + draw_string(pixelbuf, (const unsigned char *) ">", 1, text_xposn, addon_text_yposn, + textflags | ZFONT_HALIGN_RIGHT, image_width, image_height, si); } } else if (upcean_guard_whitespace) { - text_xposn = (int) ((68 + 0.5f + ean_width_adj) * si) + comp_xoffset_si; - draw_string(pixelbuf, (const unsigned char *) ">", text_xposn, text_yposn, textflags, - image_width, image_height, si); + text_xposn = symbol->width * si + qz_right_si + xoffset_si; + draw_string(pixelbuf, (const unsigned char *) ">", 1, text_xposn, text_yposn, + textflags | ZFONT_HALIGN_RIGHT, image_width, image_height, si); } } else if (upceanflag == 12) { /* UPC-A */ - int text_xposn = (-(5 + upcea_width_adj)) * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[0], text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, - image_width, image_height, si); - text_xposn = 27 * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[1], text_xposn, text_yposn, textflags, image_width, image_height, si); - text_xposn = 67 * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[2], text_xposn, text_yposn, textflags, image_width, image_height, si); - text_xposn = (95 + 5 + upcea_width_adj) * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[3], text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, - image_width, image_height, si); + int text_xposn = -5 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text, 1, text_xposn, text_yposn + upcea_height_adj, + textflags | SMALL_TEXT | ZFONT_HALIGN_RIGHT, image_width, image_height, si); + text_xposn = 28 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text + 1, 5, text_xposn, text_yposn, textflags, image_width, + image_height, si); + text_xposn = 67 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text + 6, 5, text_xposn, text_yposn, textflags, image_width, + image_height, si); + text_xposn = (95 + 5) * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text + 11, 1, text_xposn, text_yposn + upcea_height_adj, + textflags | SMALL_TEXT | ZFONT_HALIGN_LEFT, image_width, image_height, si); if (addon_len) { - text_xposn = ((addon_len == 2 ? 105 : 119) + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, + text_xposn = ((addon_len == 2 ? 105 : 119) + addon_gap) * si + xoffset_comp_si; + draw_string(pixelbuf, addon, addon_len, text_xposn, addon_text_yposn, textflags, image_width, image_height, si); if (upcean_guard_whitespace) { - text_xposn = (int) (((addon_len == 2 ? 114 : 141) + 0.5f + ean_width_adj + addon_gap) * si) - + comp_xoffset_si; - draw_string(pixelbuf, (const unsigned char *) ">", text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); + text_xposn = symbol->width * si + qz_right_si + xoffset_si; + draw_string(pixelbuf, (const unsigned char *) ">", 1, text_xposn, addon_text_yposn, + textflags | ZFONT_HALIGN_RIGHT, image_width, image_height, si); } } } else { /* EAN-13 */ - int text_xposn = (-(5 + ean_width_adj)) * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[0], text_xposn, text_yposn, textflags, image_width, image_height, si); - text_xposn = 24 * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[1], text_xposn, text_yposn, textflags, image_width, image_height, si); - text_xposn = 71 * si + comp_xoffset_si; - draw_string(pixelbuf, textparts[2], text_xposn, text_yposn, textflags, image_width, image_height, si); + int text_xposn = -5 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text, 1, text_xposn, text_yposn, textflags | ZFONT_HALIGN_RIGHT, + image_width, image_height, si); + text_xposn = 24 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text + 1, 6, text_xposn, text_yposn, textflags, image_width, + image_height, si); + text_xposn = 71 * si + xoffset_comp_si; + draw_string(pixelbuf, symbol->text + 7, 6, text_xposn, text_yposn, textflags, image_width, + image_height, si); if (addon_len) { - text_xposn = ((addon_len == 2 ? 105 : 119) + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, + text_xposn = ((addon_len == 2 ? 105 : 119) + addon_gap) * si + xoffset_comp_si; + draw_string(pixelbuf, addon, addon_len, text_xposn, addon_text_yposn, textflags, image_width, image_height, si); if (upcean_guard_whitespace) { - text_xposn = (int) (((addon_len == 2 ? 114 : 141) + 0.5f + ean_width_adj + addon_gap) * si) - + comp_xoffset_si; - draw_string(pixelbuf, (const unsigned char *) ">", text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); + text_xposn = symbol->width * si + qz_right_si + xoffset_si; + draw_string(pixelbuf, (const unsigned char *) ">", 1, text_xposn, addon_text_yposn, + textflags | ZFONT_HALIGN_RIGHT, image_width, image_height, si); } } else if (upcean_guard_whitespace) { - text_xposn = (int) ((96 + 0.5f + ean_width_adj) * si) + comp_xoffset_si; - draw_string(pixelbuf, (const unsigned char *) ">", text_xposn, text_yposn, textflags, - image_width, image_height, si); + text_xposn = symbol->width * si + qz_right_si + xoffset_si; + draw_string(pixelbuf, (const unsigned char *) ">", 1, text_xposn, text_yposn, + textflags | ZFONT_HALIGN_RIGHT, image_width, image_height, si); } } + } else if (upceanflag) { /* EAN-2, EAN-5 (standalone add-ons) */ + int text_xposn = (int) ((main_width / 2.0f) * si) + xoffset_si; + int text_yposn = yoffset_si; + if (symbol->border_width > 0 + && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP))) { + text_yposn -= symbol->border_width * si; + } + /* Put the human readable text at the top */ + draw_string(pixelbuf, symbol->text, -1, text_xposn, text_yposn, textflags, image_width, image_height, si); + if (upcean_guard_whitespace) { + text_xposn = symbol->width * si + qz_right_si + xoffset_comp_si; + draw_string(pixelbuf, (const unsigned char *) ">", 1, text_xposn, text_yposn, + textflags | ZFONT_HALIGN_RIGHT, image_width, image_height, si); + } } else { - int text_xposn = (main_width / 2) * si + xoffset_si; /* Suppress clang-analyzer-core.CallAndMessage warning */ unsigned char local_text[sizeof(symbol->text)] = {0}; - to_iso8859_1(symbol->text, local_text); - /* Put the human readable text at the bottom (or top if EAN-2/5) */ - draw_string(pixelbuf, local_text, text_xposn, text_yposn, textflags, image_width, image_height, si); - /* EAN-2/5 */ - if (upceanflag && upcean_guard_whitespace) { - const int ean_width_adj = (UPCEAN_FONT_WIDTH + 3) / 4; - const int addon_len = (int) ustrlen(symbol->text); - text_xposn = (int) (((addon_len == 2 ? 19 : 46) + 0.5f + ean_width_adj) * si) + xoffset_si; - draw_string(pixelbuf, (const unsigned char *) ">", text_xposn, text_yposn, textflags, - image_width, image_height, si); + int text_xposn = (int) ((main_width / 2.0f) * si) + xoffset_si; + int text_yposn = yoffset_si + symbol_height_si + (int) (symbol->text_gap * si); + if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) { + text_yposn += symbol->border_width * si; /* Note not needed for BARCODE_BIND_TOP */ } + to_iso8859_1(symbol->text, local_text); + /* Put the human readable text at the bottom */ + draw_string(pixelbuf, local_text, -1, text_xposn, text_yposn, textflags, image_width, image_height, si); } } @@ -1306,7 +1330,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl } draw_bind_box(symbol, pixelbuf, xoffset_si, yoffset_si, symbol_height_si, 0 /*dot_overspill_si*/, - image_width, image_height, si); + upceanflag, (int) (textoffset * si), image_width, image_height, si); if (!half_int_scaling) { size_t prev_image_row; @@ -1317,7 +1341,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl /* Apply scale options by creating another pixel buffer */ if (!(scaled_pixelbuf = (unsigned char *) malloc((size_t) scale_width * scale_height))) { free(pixelbuf); - strcpy(symbol->errtxt, "659: Insufficient memory for pixel buffer"); + strcpy(symbol->errtxt, "659: Insufficient memory for scaled pixel buffer"); return ZINT_ERROR_MEMORY; } memset(scaled_pixelbuf, DEFAULT_PAPER, (size_t) scale_width * scale_height); diff --git a/backend/rss.c b/backend/rss.c index 8c34cbdb..4c54d2c1 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -1260,7 +1260,7 @@ static void dbar_exp_hrt(struct zint_symbol *symbol, unsigned char source[], con /* GS1 DataBar Expanded, setting linkage for composite if `cc_rows` set */ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows) { - int error_number, warn_number = 0; + int error_number, warn_number; int i, j, k, p, codeblocks, data_chars, vs, group, v_odd, v_even; int latch; int char_widths[21][8], checksum, check_widths[8], c_group; @@ -1592,17 +1592,17 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int symbol->height = symbol->height ? 34.0f : 34.0f * stack_rows; /* Pass back min row or default height */ } else { if (symbol->output_options & COMPLIANT_HEIGHT) { - if (warn_number) { - (void) set_height(symbol, 34.0f, 34.0f * stack_rows, 0.0f, 0 /*no_errtxt*/); - } else { + if (warn_number == 0) { warn_number = set_height(symbol, 34.0f, 34.0f * stack_rows, 0.0f, 0 /*no_errtxt*/); + } else { + (void) set_height(symbol, 34.0f, 34.0f * stack_rows, 0.0f, 1 /*no_errtxt*/); } } else { (void) set_height(symbol, 0.0f, 34.0f * stack_rows, 0.0f, 1 /*no_errtxt*/); } } - return error_number ? error_number : warn_number; + return warn_number; } /* GS1 DataBar Expanded */ diff --git a/backend/svg.c b/backend/svg.c index e3b1c47e..ebd396f7 100644 --- a/backend/svg.c +++ b/backend/svg.c @@ -112,8 +112,8 @@ static void svg_put_opacity_close(const unsigned char alpha, const float val, co } INTERNAL int svg_plot(struct zint_symbol *symbol) { - static const char normal_font_family[] = "Arimo, Arial, sans-serif"; - static const char upcean_font_family[] = "OCRB, monospace"; + static const char normal_font_family[] = "Arimo"; + static const char upcean_font_family[] = "OCRB"; FILE *fsvg; int error_number = 0; float previous_diameter; @@ -134,7 +134,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { char colour_code[7]; int len, html_len; - const int extendable = is_extendable(symbol->symbology); + const int upcean = is_upcean(symbol->symbology); const int output_to_stdout = symbol->output_options & BARCODE_STDOUT; char *html_string; @@ -193,7 +193,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { fputs(" Zint Generated Symbol\n", fsvg); if ((symbol->output_options & EMBED_VECTOR_FONT) && symbol->vector->strings) { fprintf(fsvg, " \n", - extendable ? "OCRB" : "Arimo", extendable ? upcean_woff2 : normal_woff2); + upcean ? "OCRB" : "Arimo", upcean ? upcean_woff2 : normal_woff2); } fprintf(fsvg, " \n", fgcolour_string); @@ -241,9 +241,9 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { while (hex) { if (previous_diameter != hex->diameter) { previous_diameter = hex->diameter; - radius = (float) (0.5 * previous_diameter); - half_radius = (float) (0.25 * previous_diameter); - half_sqrt3_radius = (float) (0.43301270189221932338 * previous_diameter); + radius = 0.5f * previous_diameter; + half_radius = 0.25f * previous_diameter; + half_sqrt3_radius = 0.43301270189221932338f * previous_diameter; } if ((hex->rotation == 0) || (hex->rotation == 180)) { out_putsf("M", 2, hex->x, fsvg); @@ -284,7 +284,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { while (circle) { if (previous_diameter != circle->diameter) { previous_diameter = circle->diameter; - radius = (float) (0.5 * previous_diameter); + radius = 0.5f * previous_diameter; } fputs(" x, fsvg); @@ -312,7 +312,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { circle = circle->next; } - bold = (symbol->output_options & BOLD_TEXT) && !extendable; + bold = (symbol->output_options & BOLD_TEXT) && !upcean; string = symbol->vector->strings; while (string) { const char *const halign = string->halign == 2 ? "end" : string->halign == 1 ? "start" : "middle"; @@ -320,7 +320,11 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { svg_put_fattrib(" x=\"", 2, string->x, fsvg); svg_put_fattrib(" y=\"", 2, string->y, fsvg); fprintf(fsvg, " text-anchor=\"%s\"", halign); - fprintf(fsvg, " font-family=\"%s\"", extendable ? upcean_font_family : normal_font_family); + if (upcean) { + fprintf(fsvg, " font-family=\"%s, monospace\"", upcean_font_family); + } else { + fprintf(fsvg, " font-family=\"%s, Arial, sans-serif\"", normal_font_family); + } svg_put_fattrib(" font-size=\"", 1, string->fsize, fsvg); if (bold) { fputs(" font-weight=\"bold\"", fsvg); diff --git a/backend/tests/data/gif/dpd_compliant.gif b/backend/tests/data/gif/dpd_compliant.gif index c269549d..1cacc7ed 100644 Binary files a/backend/tests/data/gif/dpd_compliant.gif and b/backend/tests/data/gif/dpd_compliant.gif differ diff --git a/backend/tests/data/gif/itf14_height0.5_1.1.gif b/backend/tests/data/gif/itf14_height0.5_1.1.gif index 3696cac9..396bae1e 100644 Binary files a/backend/tests/data/gif/itf14_height0.5_1.1.gif and b/backend/tests/data/gif/itf14_height0.5_1.1.gif differ diff --git a/backend/tests/data/gif/itf14_height61.8_bind4_wsp24_3.gif b/backend/tests/data/gif/itf14_height61.8_bind4_wsp24_3.gif index 91154bdf..a443cd3e 100644 Binary files a/backend/tests/data/gif/itf14_height61.8_bind4_wsp24_3.gif and b/backend/tests/data/gif/itf14_height61.8_bind4_wsp24_3.gif differ diff --git a/backend/tests/data/pcx/code11_fgbgtrans.pcx b/backend/tests/data/pcx/code11_fgbgtrans.pcx index 38674d8c..67b53a87 100644 Binary files a/backend/tests/data/pcx/code11_fgbgtrans.pcx and b/backend/tests/data/pcx/code11_fgbgtrans.pcx differ diff --git a/backend/tests/data/png/code128_egrave_bold.png b/backend/tests/data/png/code128_egrave_bold.png index 53fe08d4..71925a04 100644 Binary files a/backend/tests/data/png/code128_egrave_bold.png and b/backend/tests/data/png/code128_egrave_bold.png differ diff --git a/backend/tests/data/png/code128_egrave_bold_box3.png b/backend/tests/data/png/code128_egrave_bold_box3.png index ac9fb05d..ee6949ef 100644 Binary files a/backend/tests/data/png/code128_egrave_bold_box3.png and b/backend/tests/data/png/code128_egrave_bold_box3.png differ diff --git a/backend/tests/data/png/code128_egrave_bold_hvwsp2_box2.png b/backend/tests/data/png/code128_egrave_bold_hvwsp2_box2.png index 2149dbb4..0c6382e4 100644 Binary files a/backend/tests/data/png/code128_egrave_bold_hvwsp2_box2.png and b/backend/tests/data/png/code128_egrave_bold_hvwsp2_box2.png differ diff --git a/backend/tests/data/png/code39_small.png b/backend/tests/data/png/code39_small.png index 45d9813f..772f35c9 100644 Binary files a/backend/tests/data/png/code39_small.png and b/backend/tests/data/png/code39_small.png differ diff --git a/backend/tests/data/png/dbar_ltd.png b/backend/tests/data/png/dbar_ltd.png index 0f2b2a76..4aaa7310 100644 Binary files a/backend/tests/data/png/dbar_ltd.png and b/backend/tests/data/png/dbar_ltd.png differ diff --git a/backend/tests/data/png/dpd_compliant.png b/backend/tests/data/png/dpd_compliant.png index 16ef4964..3c919106 100644 Binary files a/backend/tests/data/png/dpd_compliant.png and b/backend/tests/data/png/dpd_compliant.png differ diff --git a/backend/tests/data/png/ean13_2addon_ggs_5.2.2.5.1-2.png b/backend/tests/data/png/ean13_2addon_ggs_5.2.2.5.1-2.png index 3d8a4377..dd3ec1e9 100644 Binary files a/backend/tests/data/png/ean13_2addon_ggs_5.2.2.5.1-2.png and b/backend/tests/data/png/ean13_2addon_ggs_5.2.2.5.1-2.png differ diff --git a/backend/tests/data/png/ean13_2addon_ggs_5.2.2.5.1-2_gws.png b/backend/tests/data/png/ean13_2addon_ggs_5.2.2.5.1-2_gws.png index e2f9c3c5..68c37a59 100644 Binary files a/backend/tests/data/png/ean13_2addon_ggs_5.2.2.5.1-2_gws.png and b/backend/tests/data/png/ean13_2addon_ggs_5.2.2.5.1-2_gws.png differ diff --git a/backend/tests/data/png/ean13_5addon_ggs_5.2.2.5.2-2.png b/backend/tests/data/png/ean13_5addon_ggs_5.2.2.5.2-2.png index 878d837f..d201c0ad 100644 Binary files a/backend/tests/data/png/ean13_5addon_ggs_5.2.2.5.2-2.png and b/backend/tests/data/png/ean13_5addon_ggs_5.2.2.5.2-2.png differ diff --git a/backend/tests/data/png/ean13_5addon_ggs_5.2.2.5.2-2_gws.png b/backend/tests/data/png/ean13_5addon_ggs_5.2.2.5.2-2_gws.png index 1cf66fd8..d18716ef 100644 Binary files a/backend/tests/data/png/ean13_5addon_ggs_5.2.2.5.2-2_gws.png and b/backend/tests/data/png/ean13_5addon_ggs_5.2.2.5.2-2_gws.png differ diff --git a/backend/tests/data/png/ean13_cc_2addon_cca_4x4.png b/backend/tests/data/png/ean13_cc_2addon_cca_4x4.png index 053015a7..a41a9ffb 100644 Binary files a/backend/tests/data/png/ean13_cc_2addon_cca_4x4.png and b/backend/tests/data/png/ean13_cc_2addon_cca_4x4.png differ diff --git a/backend/tests/data/png/ean13_cc_2addon_cca_4x4_gws.png b/backend/tests/data/png/ean13_cc_2addon_cca_4x4_gws.png index 301cf7ea..da079812 100644 Binary files a/backend/tests/data/png/ean13_cc_2addon_cca_4x4_gws.png and b/backend/tests/data/png/ean13_cc_2addon_cca_4x4_gws.png differ diff --git a/backend/tests/data/png/ean13_cc_5addon_ccb_3x4.png b/backend/tests/data/png/ean13_cc_5addon_ccb_3x4.png index 134ccabb..68e108aa 100644 Binary files a/backend/tests/data/png/ean13_cc_5addon_ccb_3x4.png and b/backend/tests/data/png/ean13_cc_5addon_ccb_3x4.png differ diff --git a/backend/tests/data/png/ean13_cc_5addon_ccb_3x4_gws.png b/backend/tests/data/png/ean13_cc_5addon_ccb_3x4_gws.png index 13de53ea..a539bf98 100644 Binary files a/backend/tests/data/png/ean13_cc_5addon_ccb_3x4_gws.png and b/backend/tests/data/png/ean13_cc_5addon_ccb_3x4_gws.png differ diff --git a/backend/tests/data/png/ean13_cc_cca_5x4.png b/backend/tests/data/png/ean13_cc_cca_5x4.png index 6979fe29..4b540986 100644 Binary files a/backend/tests/data/png/ean13_cc_cca_5x4.png and b/backend/tests/data/png/ean13_cc_cca_5x4.png differ diff --git a/backend/tests/data/png/ean13_cc_cca_5x4_gws.png b/backend/tests/data/png/ean13_cc_cca_5x4_gws.png index 5baea87d..75a604e3 100644 Binary files a/backend/tests/data/png/ean13_cc_cca_5x4_gws.png and b/backend/tests/data/png/ean13_cc_cca_5x4_gws.png differ diff --git a/backend/tests/data/png/ean13_ggs_5.2.2.1-1.png b/backend/tests/data/png/ean13_ggs_5.2.2.1-1.png index e199d482..f9335ec6 100644 Binary files a/backend/tests/data/png/ean13_ggs_5.2.2.1-1.png and b/backend/tests/data/png/ean13_ggs_5.2.2.1-1.png differ diff --git a/backend/tests/data/png/ean13_ggs_5.2.2.1-1_gws.png b/backend/tests/data/png/ean13_ggs_5.2.2.1-1_gws.png index dfa0c5ba..5edb720f 100644 Binary files a/backend/tests/data/png/ean13_ggs_5.2.2.1-1_gws.png and b/backend/tests/data/png/ean13_ggs_5.2.2.1-1_gws.png differ diff --git a/backend/tests/data/png/ean2_box1.png b/backend/tests/data/png/ean2_box1.png new file mode 100644 index 00000000..08e27c6d Binary files /dev/null and b/backend/tests/data/png/ean2_box1.png differ diff --git a/backend/tests/data/png/ean5_bind2.png b/backend/tests/data/png/ean5_bind2.png new file mode 100644 index 00000000..5449192a Binary files /dev/null and b/backend/tests/data/png/ean5_bind2.png differ diff --git a/backend/tests/data/png/ean8_5addon.png b/backend/tests/data/png/ean8_5addon.png index 3175a8f2..5453beac 100644 Binary files a/backend/tests/data/png/ean8_5addon.png and b/backend/tests/data/png/ean8_5addon.png differ diff --git a/backend/tests/data/png/ean8_5addon_gws.png b/backend/tests/data/png/ean8_5addon_gws.png index 341c9ad1..04a3cdb7 100644 Binary files a/backend/tests/data/png/ean8_5addon_gws.png and b/backend/tests/data/png/ean8_5addon_gws.png differ diff --git a/backend/tests/data/png/ean8_cc_5addon_ccb_8x3.png b/backend/tests/data/png/ean8_cc_5addon_ccb_8x3.png index 6c8d8f2c..7218b52d 100644 Binary files a/backend/tests/data/png/ean8_cc_5addon_ccb_8x3.png and b/backend/tests/data/png/ean8_cc_5addon_ccb_8x3.png differ diff --git a/backend/tests/data/png/ean8_cc_5addon_ccb_8x3_gws.png b/backend/tests/data/png/ean8_cc_5addon_ccb_8x3_gws.png index 93b9745c..d42212b3 100644 Binary files a/backend/tests/data/png/ean8_cc_5addon_ccb_8x3_gws.png and b/backend/tests/data/png/ean8_cc_5addon_ccb_8x3_gws.png differ diff --git a/backend/tests/data/png/ultra_fgalpha_hvwsp1_bindtop1.png b/backend/tests/data/png/ultra_fgalpha_hvwsp1_bindtop1.png index 2b0b07b3..76993026 100644 Binary files a/backend/tests/data/png/ultra_fgalpha_hvwsp1_bindtop1.png and b/backend/tests/data/png/ultra_fgalpha_hvwsp1_bindtop1.png differ diff --git a/backend/tests/data/png/upca_2addon_ggs_5.2.6.6-5.png b/backend/tests/data/png/upca_2addon_ggs_5.2.6.6-5.png index 6d4637ac..470e7c8e 100644 Binary files a/backend/tests/data/png/upca_2addon_ggs_5.2.6.6-5.png and b/backend/tests/data/png/upca_2addon_ggs_5.2.6.6-5.png differ diff --git a/backend/tests/data/png/upca_2addon_ggs_5.2.6.6-5_gws.png b/backend/tests/data/png/upca_2addon_ggs_5.2.6.6-5_gws.png index 4a5f978b..cf9c8d55 100644 Binary files a/backend/tests/data/png/upca_2addon_ggs_5.2.6.6-5_gws.png and b/backend/tests/data/png/upca_2addon_ggs_5.2.6.6-5_gws.png differ diff --git a/backend/tests/data/png/upca_5addon.png b/backend/tests/data/png/upca_5addon.png index 4727c528..76b4e836 100644 Binary files a/backend/tests/data/png/upca_5addon.png and b/backend/tests/data/png/upca_5addon.png differ diff --git a/backend/tests/data/png/upca_5addon_bind3.png b/backend/tests/data/png/upca_5addon_bind3.png index b6b976ff..76d9f8dc 100644 Binary files a/backend/tests/data/png/upca_5addon_bind3.png and b/backend/tests/data/png/upca_5addon_bind3.png differ diff --git a/backend/tests/data/png/upca_5addon_gws.png b/backend/tests/data/png/upca_5addon_gws.png index 1fec4fa6..024ff1c2 100644 Binary files a/backend/tests/data/png/upca_5addon_gws.png and b/backend/tests/data/png/upca_5addon_gws.png differ diff --git a/backend/tests/data/png/upca_cc_2addon_cca_3x4.png b/backend/tests/data/png/upca_cc_2addon_cca_3x4.png index 9ac85d77..2cde13bb 100644 Binary files a/backend/tests/data/png/upca_cc_2addon_cca_3x4.png and b/backend/tests/data/png/upca_cc_2addon_cca_3x4.png differ diff --git a/backend/tests/data/png/upca_cc_2addon_cca_3x4_gws.png b/backend/tests/data/png/upca_cc_2addon_cca_3x4_gws.png index 83c9b2df..9c94f855 100644 Binary files a/backend/tests/data/png/upca_cc_2addon_cca_3x4_gws.png and b/backend/tests/data/png/upca_cc_2addon_cca_3x4_gws.png differ diff --git a/backend/tests/data/png/upca_cc_5addon_ccb_4x4.png b/backend/tests/data/png/upca_cc_5addon_ccb_4x4.png index e29f97d7..ec9c175e 100644 Binary files a/backend/tests/data/png/upca_cc_5addon_ccb_4x4.png and b/backend/tests/data/png/upca_cc_5addon_ccb_4x4.png differ diff --git a/backend/tests/data/png/upca_cc_5addon_ccb_4x4_bind3.png b/backend/tests/data/png/upca_cc_5addon_ccb_4x4_bind3.png index 867a9df9..bd67e2fb 100644 Binary files a/backend/tests/data/png/upca_cc_5addon_ccb_4x4_bind3.png and b/backend/tests/data/png/upca_cc_5addon_ccb_4x4_bind3.png differ diff --git a/backend/tests/data/png/upce_5addon.png b/backend/tests/data/png/upce_5addon.png index a136d3d7..a43ee44b 100644 Binary files a/backend/tests/data/png/upce_5addon.png and b/backend/tests/data/png/upce_5addon.png differ diff --git a/backend/tests/data/png/upce_5addon_small_gws.png b/backend/tests/data/png/upce_5addon_small_gws.png index e8acd60a..8736c345 100644 Binary files a/backend/tests/data/png/upce_5addon_small_gws.png and b/backend/tests/data/png/upce_5addon_small_gws.png differ diff --git a/backend/tests/data/png/upce_cc_5addon_ccb_8x2.png b/backend/tests/data/png/upce_cc_5addon_ccb_8x2.png index f72a1310..aba27385 100644 Binary files a/backend/tests/data/png/upce_cc_5addon_ccb_8x2.png and b/backend/tests/data/png/upce_cc_5addon_ccb_8x2.png differ diff --git a/backend/tests/data/png/upce_cc_5addon_ccb_8x2_gws.png b/backend/tests/data/png/upce_cc_5addon_ccb_8x2_gws.png index b560b99f..7e8e5a17 100644 Binary files a/backend/tests/data/png/upce_cc_5addon_ccb_8x2_gws.png and b/backend/tests/data/png/upce_cc_5addon_ccb_8x2_gws.png differ diff --git a/backend/tests/data/print/bmp/code128_aim.bmp b/backend/tests/data/print/bmp/code128_aim.bmp index 60469426..54af89bd 100644 Binary files a/backend/tests/data/print/bmp/code128_aim.bmp and b/backend/tests/data/print/bmp/code128_aim.bmp differ diff --git a/backend/tests/data/print/gif/code128_aim.gif b/backend/tests/data/print/gif/code128_aim.gif index d51ac5a7..c7e7f7b4 100644 Binary files a/backend/tests/data/print/gif/code128_aim.gif and b/backend/tests/data/print/gif/code128_aim.gif differ diff --git a/backend/tests/data/print/pcx/code128_aim.pcx b/backend/tests/data/print/pcx/code128_aim.pcx index 899c3d35..99df00f8 100644 Binary files a/backend/tests/data/print/pcx/code128_aim.pcx and b/backend/tests/data/print/pcx/code128_aim.pcx differ diff --git a/backend/tests/data/print/png/code128_aim.png b/backend/tests/data/print/png/code128_aim.png index 252dcade..e59669ac 100644 Binary files a/backend/tests/data/print/png/code128_aim.png and b/backend/tests/data/print/png/code128_aim.png differ diff --git a/backend/tests/data/print/tif/code128_aim.tif b/backend/tests/data/print/tif/code128_aim.tif index 5cc663a5..a8f640a4 100644 Binary files a/backend/tests/data/print/tif/code128_aim.tif and b/backend/tests/data/print/tif/code128_aim.tif differ diff --git a/backend/tests/data/svg/dpd_compliant.svg b/backend/tests/data/svg/dpd_compliant.svg index 3f469a00..d9088fad 100644 --- a/backend/tests/data/svg/dpd_compliant.svg +++ b/backend/tests/data/svg/dpd_compliant.svg @@ -1,11 +1,11 @@ - + Zint Generated Symbol - + - + 0081 827 0998 0000 0200 28 101 276 B diff --git a/backend/tests/data/svg/ean2_box1.svg b/backend/tests/data/svg/ean2_box1.svg new file mode 100644 index 00000000..8c27a140 --- /dev/null +++ b/backend/tests/data/svg/ean2_box1.svg @@ -0,0 +1,12 @@ + + + + Zint Generated Symbol + + + + + 12 + + + diff --git a/backend/tests/data/svg/ean5_bind2.svg b/backend/tests/data/svg/ean5_bind2.svg new file mode 100644 index 00000000..d59570e1 --- /dev/null +++ b/backend/tests/data/svg/ean5_bind2.svg @@ -0,0 +1,12 @@ + + + + Zint Generated Symbol + + + + + 12345 + + + diff --git a/backend/tests/data/tif/code128_bgalpha.tif b/backend/tests/data/tif/code128_bgalpha.tif index 43f69622..f995a98b 100644 Binary files a/backend/tests/data/tif/code128_bgalpha.tif and b/backend/tests/data/tif/code128_bgalpha.tif differ diff --git a/backend/tests/data/tif/code128_cmyk.tif b/backend/tests/data/tif/code128_cmyk.tif index cbd44513..600c2b1b 100644 Binary files a/backend/tests/data/tif/code128_cmyk.tif and b/backend/tests/data/tif/code128_cmyk.tif differ diff --git a/backend/tests/data/tif/code128_cmyk_fgbg.tif b/backend/tests/data/tif/code128_cmyk_fgbg.tif index 6c5c0389..2e7b3a05 100644 Binary files a/backend/tests/data/tif/code128_cmyk_fgbg.tif and b/backend/tests/data/tif/code128_cmyk_fgbg.tif differ diff --git a/backend/tests/data/tif/code128_cmyk_fgbgalpha.tif b/backend/tests/data/tif/code128_cmyk_fgbgalpha.tif index 4f592daf..921b00b3 100644 Binary files a/backend/tests/data/tif/code128_cmyk_fgbgalpha.tif and b/backend/tests/data/tif/code128_cmyk_fgbgalpha.tif differ diff --git a/backend/tests/data/tif/code128_cmyk_fgbgcmyk.tif b/backend/tests/data/tif/code128_cmyk_fgbgcmyk.tif index 4d1f1ff8..0c46ac72 100644 Binary files a/backend/tests/data/tif/code128_cmyk_fgbgcmyk.tif and b/backend/tests/data/tif/code128_cmyk_fgbgcmyk.tif differ diff --git a/backend/tests/data/tif/code128_fgalpha.tif b/backend/tests/data/tif/code128_fgalpha.tif index e2a6b232..369cc071 100644 Binary files a/backend/tests/data/tif/code128_fgalpha.tif and b/backend/tests/data/tif/code128_fgalpha.tif differ diff --git a/backend/tests/data/tif/code128_fgbg.tif b/backend/tests/data/tif/code128_fgbg.tif index 77c66a68..962e3169 100644 Binary files a/backend/tests/data/tif/code128_fgbg.tif and b/backend/tests/data/tif/code128_fgbg.tif differ diff --git a/backend/tests/data/tif/code128_fgbgalpha.tif b/backend/tests/data/tif/code128_fgbgalpha.tif index 194e8a43..fa2a6cad 100644 Binary files a/backend/tests/data/tif/code128_fgbgalpha.tif and b/backend/tests/data/tif/code128_fgbgalpha.tif differ diff --git a/backend/tests/data/tif/code128_reverse.tif b/backend/tests/data/tif/code128_reverse.tif index 3d4f0393..1b062f57 100644 Binary files a/backend/tests/data/tif/code128_reverse.tif and b/backend/tests/data/tif/code128_reverse.tif differ diff --git a/backend/tests/test_codablock.c b/backend/tests/test_codablock.c index 911a0c4c..e7f0c3c9 100644 --- a/backend/tests/test_codablock.c +++ b/backend/tests/test_codablock.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -57,8 +57,8 @@ static void test_large(const testCtx *const p_ctx) { /* 6*/ { -1, -1, "12", 2726 * 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 7*/ { -1, -1, "\351", 2726 / 2, 0, 44, 739 }, /* 8*/ { -1, -1, "\351", 2726 / 2 + 1, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 9*/ { 1, -1, "A", 60, 0, 1, 695 }, /* CODE128 60 max */ - /* 10*/ { 1, -1, "A", 61, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 9*/ { 1, -1, "A", 99, 0, 1, 1124 }, /* CODE128 99 max */ + /* 10*/ { 1, -1, "A", 100, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 11*/ { 2, -1, "A", 122, 0, 2, 739 }, /* 12*/ { 2, 10, "A", 122, 0, 2, 739 }, /* Cols 10 -> 67 */ /* 13*/ { 2, 67, "A", 122, 0, 2, 739 }, @@ -85,11 +85,11 @@ static void test_large(const testCtx *const p_ctx) { }; int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char data_buf[ZINT_MAX_DATA_LEN + 2]; - testStart("test_large"); + testStartSymbol("test_large", &symbol); for (i = 0; i < data_size; i++) { @@ -159,9 +159,9 @@ static void test_options(const testCtx *const p_ctx) { }; int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_options"); + testStartSymbol("test_options", &symbol); for (i = 0; i < data_size; i++) { @@ -207,11 +207,11 @@ static void test_reader_init(const testCtx *const p_ctx) { }; int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; - testStart("test_reader_init"); + testStartSymbol("test_reader_init", &symbol); for (i = 0; i < data_size; i++) { @@ -328,7 +328,7 @@ static void test_input(const testCtx *const p_ctx) { }; int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[16834]; char cmp_buf[32768]; @@ -337,7 +337,7 @@ static void test_input(const testCtx *const p_ctx) { int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */ - testStart("test_input"); + testStartSymbol("test_input", &symbol); for (i = 0; i < data_size; i++) { @@ -504,7 +504,7 @@ static void test_encode(const testCtx *const p_ctx) { }; int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char escaped[1024]; char cmp_buf[8192]; @@ -513,7 +513,7 @@ static void test_encode(const testCtx *const p_ctx) { int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); /* Only do BWIPP test if asked, too slow otherwise */ int do_zxingcpp = (debug & ZINT_DEBUG_TEST_ZXINGCPP) && testUtilHaveZXingCPPDecoder(); /* Only do ZXing-C++ test if asked, too slow otherwise */ - testStart("test_encode"); + testStartSymbol("test_encode", &symbol); for (i = 0; i < data_size; i++) { @@ -590,9 +590,9 @@ static void test_fuzz(const testCtx *const p_ctx) { }; int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; - testStart("test_fuzz"); + testStartSymbol("test_fuzz", &symbol); for (i = 0; i < data_size; i++) { diff --git a/backend/tests/test_code128.c b/backend/tests/test_code128.c index 4894a2ae..053dafdb 100644 --- a/backend/tests/test_code128.c +++ b/backend/tests/test_code128.c @@ -38,6 +38,7 @@ static void test_large(const testCtx *const p_ctx) { struct item { int symbology; + int output_options; char *pattern; int length; int ret; @@ -48,26 +49,31 @@ static void test_large(const testCtx *const p_ctx) { */ /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { BARCODE_CODE128, "A", 60, 0, 695 }, - /* 1*/ { BARCODE_CODE128, "A", 61, ZINT_ERROR_TOO_LONG, -1 }, - /* 2*/ { BARCODE_CODE128, "A", 161, ZINT_ERROR_TOO_LONG, -1 }, - /* 3*/ { BARCODE_CODE128, "\351A", 40, 0, 695 }, - /* 4*/ { BARCODE_CODE128, "\351A", 41, ZINT_ERROR_TOO_LONG, -1 }, /* 41 chars (+ 20 shifts) */ - /* 5*/ { BARCODE_CODE128, "0", 120, 0, 695 }, - /* 6*/ { BARCODE_CODE128, "0", 121, ZINT_ERROR_TOO_LONG, -1 }, - /* 7*/ { BARCODE_CODE128AB, "A", 60, 0, 695 }, - /* 8*/ { BARCODE_CODE128AB, "A", 61, ZINT_ERROR_TOO_LONG, -1 }, - /* 9*/ { BARCODE_CODE128AB, "0", 60, 0, 695 }, - /* 10*/ { BARCODE_CODE128AB, "0", 61, ZINT_ERROR_TOO_LONG, -1 }, - /* 11*/ { BARCODE_GS1_128, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]1234567890", -1, 0, 706 }, /* 116 nos + 3 FNC1s */ - /* 12*/ { BARCODE_GS1_128, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]1234[93]1234", -1, ZINT_ERROR_TOO_LONG, -1 }, /* 116 nos + 4 FNC1s */ - /* 13*/ { BARCODE_GS1_128, "A", 161, ZINT_ERROR_TOO_LONG, -1 }, - /* 14*/ { BARCODE_EAN14, "1234567890123", -1, 0, 134 }, - /* 15*/ { BARCODE_EAN14, "12345678901234", -1, ZINT_ERROR_TOO_LONG, -1 }, - /* 16*/ { BARCODE_NVE18, "12345678901234567", -1, 0, 156 }, - /* 17*/ { BARCODE_NVE18, "123456789012345678", -1, ZINT_ERROR_TOO_LONG, -1 }, - /* 18*/ { BARCODE_HIBC_128, "1", 110, 0, 684 }, - /* 19*/ { BARCODE_HIBC_128, "1", 111, ZINT_ERROR_TOO_LONG, -1 }, + /* 0*/ { BARCODE_CODE128, -1, "A", 99, 0, 1124 }, + /* 1*/ { BARCODE_CODE128, -1, "A", 100, ZINT_ERROR_TOO_LONG, -1 }, + /* 2*/ { BARCODE_CODE128, -1, "A", 257, ZINT_ERROR_TOO_LONG, -1 }, + /* 3*/ { BARCODE_CODE128, READER_INIT, "A", 99, 0, 1135 }, + /* 4*/ { BARCODE_CODE128, READER_INIT, "A", 100, ZINT_ERROR_TOO_LONG, -1 }, + /* 5*/ { BARCODE_CODE128, READER_INIT, "A", 257, ZINT_ERROR_TOO_LONG, -1 }, + /* 6*/ { BARCODE_CODE128, -1, "\351A", 66, 0, 1124 }, + /* 7*/ { BARCODE_CODE128, -1, "\351A", 67, ZINT_ERROR_TOO_LONG, -1 }, /* 67 chars (+ 34 shifts) */ + /* 8*/ { BARCODE_CODE128, -1, "0", 198, 0, 1124 }, + /* 9*/ { BARCODE_CODE128, -1, "0", 199, ZINT_ERROR_TOO_LONG, -1 }, + /* 10*/ { BARCODE_CODE128, -1, "0", 257, ZINT_ERROR_TOO_LONG, -1 }, + /* 11*/ { BARCODE_CODE128AB, -1, "A", 99, 0, 1124 }, + /* 12*/ { BARCODE_CODE128AB, -1, "A", 100, ZINT_ERROR_TOO_LONG, -1 }, + /* 13*/ { BARCODE_CODE128AB, -1, "0", 99, 0, 1124 }, + /* 14*/ { BARCODE_CODE128AB, -1, "0", 100, ZINT_ERROR_TOO_LONG, -1 }, + /* 15*/ { BARCODE_GS1_128, -1, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", -1, ZINT_WARN_HRT_TRUNCATED, 1135 }, /* 196 nos + 3 FNC1s */ + /* 16*/ { BARCODE_GS1_128, -1, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", -1, ZINT_ERROR_TOO_LONG, -1 }, /* 196 nos + CodeA + single no. + 3 FNC1s */ + /* 17*/ { BARCODE_GS1_128, -1, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", -1, ZINT_ERROR_TOO_LONG, -1 }, /* 198 nos + 3 FNC1s */ + /* 18*/ { BARCODE_GS1_128, -1, "A", 257, ZINT_ERROR_TOO_LONG, -1 }, + /* 19*/ { BARCODE_EAN14, -1, "1234567890123", -1, 0, 134 }, + /* 20*/ { BARCODE_EAN14, -1, "12345678901234", -1, ZINT_ERROR_TOO_LONG, -1 }, + /* 21*/ { BARCODE_NVE18, -1, "12345678901234567", -1, 0, 156 }, + /* 22*/ { BARCODE_NVE18, -1, "123456789012345678", -1, ZINT_ERROR_TOO_LONG, -1 }, + /* 23*/ { BARCODE_HIBC_128, -1, "1", 110, 0, 684 }, + /* 24*/ { BARCODE_HIBC_128, -1, "1", 111, ZINT_ERROR_TOO_LONG, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -91,7 +97,7 @@ static void test_large(const testCtx *const p_ctx) { strcpy(data_buf, data[i].pattern); } - length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data_buf, data[i].length, debug); + length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, data[i].output_options, data_buf, data[i].length, debug); ret = ZBarcode_Encode(symbol, (unsigned char *) data_buf, length); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); @@ -130,40 +136,41 @@ static void test_hrt(const testCtx *const p_ctx) { /* 4*/ { BARCODE_CODE128, UNICODE_MODE, -1, "abcdé", -1, "abcdé" }, /* 5*/ { BARCODE_CODE128, DATA_MODE, -1, "abcd\351", -1, "abcdé" }, /* 6*/ { BARCODE_CODE128, DATA_MODE, -1, "ab\240cd\351", -1, "ab\302\240cdé" }, /* NBSP */ - /* 7*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, "abcdé", -1, "abcdé" }, - /* 8*/ { BARCODE_CODE128AB, DATA_MODE, -1, "abcd\351", -1, "abcdé" }, - /* 9*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "1234567890", -1, "*+12345678900*" }, - /* 10*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "a99912345", -1, "*+A999123457*" }, /* Converts to upper */ - /* 11*/ { BARCODE_DPD, UNICODE_MODE, -1, "000393206219912345678101040", -1, "0003 932 0621 9912 3456 78 101 040 9" }, /* DPDAPPD 4.0.2 - Illustration 7 */ - /* 12*/ { BARCODE_DPD, UNICODE_MODE, -1, "007110601782532948375101276", -1, "0071 106 0178 2532 9483 75 101 276 X" }, /* DPDAPPD 4.0.2 - Illustration 6, figure's HRT seems incorrect */ - /* 13*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020028101276", -1, "0081 827 0998 0000 0200 28 101 276 B" }, /* DPDPLS Section 4 */ - /* 14*/ { BARCODE_DPD, UNICODE_MODE, -1, "007110601632532948375179276", -1, "0071 106 0163 2532 9483 75 179 276 A" }, /* DPDPLS Section 4.6 */ - /* 15*/ { BARCODE_DPD, UNICODE_MODE, -1, "001990009980000020084109203", -1, "0019 900 0998 0000 0200 84 109 203 1" }, /* DPDPLS Section 5.1 */ - /* 16*/ { BARCODE_DPD, UNICODE_MODE, 1, "007110601632532948375101276", -1, "0071 106 0163 2532 9483 75 101 276 O" }, /* DPDPLS Section 6.1.2 relabel, figure is actually 8.7.2 with mislabelled HRT */ - /* 17*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020029136276", -1, "0081 827 0998 0000 0200 29 136 276 3" }, /* DPDPLS Section 8.1 */ - /* 18*/ { BARCODE_DPD, UNICODE_MODE, -1, "001234509980000020031105276", -1, "0012 345 0998 0000 0200 31 105 276 L" }, /* DPDPLS Section 8.2 */ - /* 19*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020032154276", -1, "0081 827 0998 0000 0200 32 154 276 J" }, /* DPDPLS Section 8.3 */ - /* 20*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020030109276", -1, "0081 827 0998 0000 0200 30 109 276 W" }, /* DPDPLS Section 8.4 */ - /* 21*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020033350276", -1, "0081 827 0998 0000 0200 33 350 276 C" }, /* DPDPLS Section 8.5.1 */ - /* 22*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020034179276", -1, "0081 827 0998 0000 0200 34 179 276 I" }, /* DPDPLS Section 8.5.2 */ - /* 23*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020035225276", -1, "0081 827 0998 0000 0200 35 225 276 H" }, /* DPDPLS Section 8.5.3 */ - /* 24*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020036155276", -1, "0081 827 0998 0000 0200 36 155 276 5" }, /* DPDPLS Section 8.5.4 */ - /* 25*/ { BARCODE_DPD, UNICODE_MODE, -1, "000280009980000020037155056", -1, "0002 800 0998 0000 0200 37 155 056 6" }, /* DPDPLS Section 8.5.5 */ - /* 26*/ { BARCODE_DPD, UNICODE_MODE, -1, "007855009980000020041302840", -1, "0078 550 0998 0000 0200 41 302 840 U" }, /* DPDPLS Section 8.5.6 */ - /* 27*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020042102276", -1, "0081 827 0998 0000 0200 42 102 276 R" }, /* DPDPLS Section 8.6.1 */ - /* 28*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020043113276", -1, "0081 827 0998 0000 0200 43 113 276 Y" }, /* DPDPLS Section 8.7.1 */ - /* 29*/ { BARCODE_DPD, UNICODE_MODE, 1, "006376209980000020044118276", -1, "0063 762 0998 0000 0200 44 118 276 I" }, /* DPDPLS Section 8.7.2 relabel */ - /* 30*/ { BARCODE_DPD, UNICODE_MODE, -1, "007160009980000020050294276", -1, "0071 600 0998 0000 0200 50 294 276 C" }, /* DPDPLS Section 8.8 */ - /* 31*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020045327276", -1, "0081 827 0998 0000 0200 45 327 276 N" }, /* DPDPLS Section 8.9.1 */ - /* 32*/ { BARCODE_DPD, UNICODE_MODE, -1, "006374309980000020047337276", -1, "0063 743 0998 0000 0200 47 337 276 O" }, /* DPDPLS Section 8.9.2 */ - /* 33*/ { BARCODE_DPD, UNICODE_MODE, 1, "006374109980978004757332276", -1, "0063 741 0998 0978 0047 57 332 276 M" }, /* DPDPLS Section 8.9.3 relabel, figure's HRT seems incorrect */ - /* 34*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020051106276", -1, "0081 827 0998 0000 0200 51 106 276 M" }, /* DPDPLS Section 9.1 */ - /* 35*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020052110276", -1, "0081 827 0998 0000 0200 52 110 276 W" }, /* DPDPLS Section 9.2 */ - /* 36*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020053161276", -1, "0081 827 0998 0000 0200 53 161 276 O" }, /* DPDPLS Section 9.3 */ - /* 37*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020054352276", -1, "0081 827 0998 0000 0200 54 352 276 B" }, /* DPDPLS Section 9.4 */ - /* 38*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020055191276", -1, "0081 827 0998 0000 0200 55 191 276 A" }, /* DPDPLS Section 9.5 */ - /* 39*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020056237276", -1, "0081 827 0998 0000 0200 56 237 276 K" }, /* DPDPLS Section 9.6 */ - /* 40*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, "EE876543216CA", -1, "EE 876 543 216 CA" }, /* UPU S10 Annex A */ + /* 7*/ { BARCODE_CODE128, ESCAPE_MODE | EXTRA_ESCAPE_MODE, -1, "\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C1234567890\\^C123456789012345678", -1, "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678" }, /* Max length 198 + 19 special escapes = 99 + 19*3 = 255 */ + /* 8*/ { BARCODE_CODE128AB, UNICODE_MODE, -1, "abcdé", -1, "abcdé" }, + /* 9*/ { BARCODE_CODE128AB, DATA_MODE, -1, "abcd\351", -1, "abcdé" }, + /* 10*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "1234567890", -1, "*+12345678900*" }, + /* 11*/ { BARCODE_HIBC_128, UNICODE_MODE, -1, "a99912345", -1, "*+A999123457*" }, /* Converts to upper */ + /* 12*/ { BARCODE_DPD, UNICODE_MODE, -1, "000393206219912345678101040", -1, "0003 932 0621 9912 3456 78 101 040 9" }, /* DPDAPPD 4.0.2 - Illustration 7 */ + /* 13*/ { BARCODE_DPD, UNICODE_MODE, -1, "007110601782532948375101276", -1, "0071 106 0178 2532 9483 75 101 276 X" }, /* DPDAPPD 4.0.2 - Illustration 6, figure's HRT seems incorrect */ + /* 14*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020028101276", -1, "0081 827 0998 0000 0200 28 101 276 B" }, /* DPDPLS Section 4 */ + /* 15*/ { BARCODE_DPD, UNICODE_MODE, -1, "007110601632532948375179276", -1, "0071 106 0163 2532 9483 75 179 276 A" }, /* DPDPLS Section 4.6 */ + /* 16*/ { BARCODE_DPD, UNICODE_MODE, -1, "001990009980000020084109203", -1, "0019 900 0998 0000 0200 84 109 203 1" }, /* DPDPLS Section 5.1 */ + /* 17*/ { BARCODE_DPD, UNICODE_MODE, 1, "007110601632532948375101276", -1, "0071 106 0163 2532 9483 75 101 276 O" }, /* DPDPLS Section 6.1.2 relabel, figure is actually 8.7.2 with mislabelled HRT */ + /* 18*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020029136276", -1, "0081 827 0998 0000 0200 29 136 276 3" }, /* DPDPLS Section 8.1 */ + /* 19*/ { BARCODE_DPD, UNICODE_MODE, -1, "001234509980000020031105276", -1, "0012 345 0998 0000 0200 31 105 276 L" }, /* DPDPLS Section 8.2 */ + /* 20*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020032154276", -1, "0081 827 0998 0000 0200 32 154 276 J" }, /* DPDPLS Section 8.3 */ + /* 21*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020030109276", -1, "0081 827 0998 0000 0200 30 109 276 W" }, /* DPDPLS Section 8.4 */ + /* 22*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020033350276", -1, "0081 827 0998 0000 0200 33 350 276 C" }, /* DPDPLS Section 8.5.1 */ + /* 23*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020034179276", -1, "0081 827 0998 0000 0200 34 179 276 I" }, /* DPDPLS Section 8.5.2 */ + /* 24*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020035225276", -1, "0081 827 0998 0000 0200 35 225 276 H" }, /* DPDPLS Section 8.5.3 */ + /* 25*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020036155276", -1, "0081 827 0998 0000 0200 36 155 276 5" }, /* DPDPLS Section 8.5.4 */ + /* 26*/ { BARCODE_DPD, UNICODE_MODE, -1, "000280009980000020037155056", -1, "0002 800 0998 0000 0200 37 155 056 6" }, /* DPDPLS Section 8.5.5 */ + /* 27*/ { BARCODE_DPD, UNICODE_MODE, -1, "007855009980000020041302840", -1, "0078 550 0998 0000 0200 41 302 840 U" }, /* DPDPLS Section 8.5.6 */ + /* 28*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020042102276", -1, "0081 827 0998 0000 0200 42 102 276 R" }, /* DPDPLS Section 8.6.1 */ + /* 29*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020043113276", -1, "0081 827 0998 0000 0200 43 113 276 Y" }, /* DPDPLS Section 8.7.1 */ + /* 30*/ { BARCODE_DPD, UNICODE_MODE, 1, "006376209980000020044118276", -1, "0063 762 0998 0000 0200 44 118 276 I" }, /* DPDPLS Section 8.7.2 relabel */ + /* 31*/ { BARCODE_DPD, UNICODE_MODE, -1, "007160009980000020050294276", -1, "0071 600 0998 0000 0200 50 294 276 C" }, /* DPDPLS Section 8.8 */ + /* 32*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020045327276", -1, "0081 827 0998 0000 0200 45 327 276 N" }, /* DPDPLS Section 8.9.1 */ + /* 33*/ { BARCODE_DPD, UNICODE_MODE, -1, "006374309980000020047337276", -1, "0063 743 0998 0000 0200 47 337 276 O" }, /* DPDPLS Section 8.9.2 */ + /* 34*/ { BARCODE_DPD, UNICODE_MODE, 1, "006374109980978004757332276", -1, "0063 741 0998 0978 0047 57 332 276 M" }, /* DPDPLS Section 8.9.3 relabel, figure's HRT seems incorrect */ + /* 35*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020051106276", -1, "0081 827 0998 0000 0200 51 106 276 M" }, /* DPDPLS Section 9.1 */ + /* 36*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020052110276", -1, "0081 827 0998 0000 0200 52 110 276 W" }, /* DPDPLS Section 9.2 */ + /* 37*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020053161276", -1, "0081 827 0998 0000 0200 53 161 276 O" }, /* DPDPLS Section 9.3 */ + /* 38*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020054352276", -1, "0081 827 0998 0000 0200 54 352 276 B" }, /* DPDPLS Section 9.4 */ + /* 39*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020055191276", -1, "0081 827 0998 0000 0200 55 191 276 A" }, /* DPDPLS Section 9.5 */ + /* 40*/ { BARCODE_DPD, UNICODE_MODE, -1, "008182709980000020056237276", -1, "0081 827 0998 0000 0200 56 237 276 K" }, /* DPDPLS Section 9.6 */ + /* 41*/ { BARCODE_UPU_S10, UNICODE_MODE, -1, "EE876543216CA", -1, "EE 876 543 216 CA" }, /* UPU S10 Annex A */ /* BARCODE_GS1_128, BARCODE_EAN14, BARCODE_NVE18 hrt tested in test_gs1.c */ }; int data_size = ARRAY_SIZE(data); @@ -179,6 +186,8 @@ static void test_hrt(const testCtx *const p_ctx) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); + memset(symbol->text, 0xDD, sizeof(symbol->text)); /* Detect non-NUL terminated HRT */ + length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, data[i].length, debug); ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); @@ -430,7 +439,7 @@ static void test_input(const testCtx *const p_ctx) { testFinish(); } -static void test_ean128_input(const testCtx *const p_ctx) { +static void test_gs1_128_input(const testCtx *const p_ctx) { int debug = p_ctx->debug; struct item { @@ -466,8 +475,11 @@ static void test_ean128_input(const testCtx *const p_ctx) { /* 21*/ { GS1_MODE, "[90]12A[90]123", 0, 145, "(13) 105 102 90 12 100 33 102 25 99 1 23 25 106", "StartC FNC1 90 12 CodeB A FNC1 9 CodeC 01 23" }, /* 22*/ { GS1_MODE, "[90]123[90]A234[90]123", 0, 244, "(22) 105 102 90 12 100 19 99 102 90 100 33 18 99 34 102 100 25 99 1 23 37 106", "StartC FNC1 90 12 CodeB 3 CodeC FNC1 90 CodeB A 2 CodeC 34 FNC1 CodeB 9 CodeC 01 23" }, /* 23*/ { GS1_MODE, "[90]12345A12345A", 0, 178, "(16) 105 102 90 12 34 100 21 33 17 99 23 45 100 33 59 106", "StartC FNC1 90 12 34 CodeB 5 A 1 CodeC 23 45 CodeB A [" }, - /* 24*/ { GS1_MODE, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", 0, 684, "(62) 105 102 1 12 34 56 78 90 12 31 90 12 34 56 78 90 12 34 56 78 90 12 34 56 78 90 102 91", "Max length" }, - /* 25*/ { GS1_MODE, "[01]12345678901231[90]123456789012345678901234567890[91]12345678901234567890123456789012345678901234567890123456789012345", ZINT_ERROR_TOO_LONG, 0, "Error 344: Input too long (60 symbol character maximum)", "" }, + /* 24*/ { GS1_MODE, "[01]12345678901231[90]12345678901234567890123456789", 0, 321, "(29) 105 102 1 12 34 56 78 90 12 31 90 12 34 56 78 90 12 34 56 78 90 12 34 56 78 100 25 59", "Max length" }, + /* 25*/ { GS1_MODE, "[01]12345678901231[90]123456789012345678901234567890[91]1", ZINT_WARN_NONCOMPLIANT, 365, "Warning 843: GS1-128 input too long (48 character maximum)", "Over length" }, + /* 26*/ { GS1_MODE, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]12345678901234567890123456789012345678901234567890123456789012345678901234567890[93]1234", ZINT_WARN_HRT_TRUNCATED, 1135, "Warning 844: Human Readable Text truncated", "Max input" }, + /* 27*/ { GS1_MODE, "[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[3100]567890[20]34[20]78", ZINT_WARN_HRT_TRUNCATED, 1135, "Warning 844: Human Readable Text truncated", "HRT truncation warning trumps non-compliant (3100) warning" }, + /* 28*/ { GS1_MODE, "[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234567890[92]12345678901234567890123456789012345678901234567890123456789012345678901234567890[93]12345", ZINT_ERROR_TOO_LONG, 0, "Error 344: Input too long (99 symbol character maximum)", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -475,7 +487,7 @@ static void test_ean128_input(const testCtx *const p_ctx) { char escaped[1024]; - testStartSymbol("test_ean128_input", &symbol); + testStartSymbol("test_gs1_128_input", &symbol); for (i = 0; i < data_size; i++) { @@ -484,6 +496,8 @@ static void test_ean128_input(const testCtx *const p_ctx) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); + memset(symbol->text, 0xDD, sizeof(symbol->text)); /* Detect non-NUL terminated HRT */ + symbol->debug = ZINT_DEBUG_TEST; /* Needed to get codeword dump in errtxt */ length = testUtilSetSymbol(symbol, BARCODE_GS1_128, data[i].input_mode, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); @@ -498,6 +512,13 @@ static void test_ean128_input(const testCtx *const p_ctx) { } else { if (ret < ZINT_ERROR) { assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); + if (ret == ZINT_WARN_HRT_TRUNCATED) { + assert_nonzero((int) ustrlen(symbol->text) < (int) strlen(data[i].data), "i:%d len symbol->text(%s) %d >= %d (%s) (%s)\n", + i, symbol->text, (int) ustrlen(symbol->text), (int) strlen(data[i].data), data[i].data, symbol->errtxt); + } else { + assert_equal((int) ustrlen(symbol->text), (int) strlen(data[i].data), "i:%d len symbol->text(%s) %d != %d (%s, %s) (%s)\n", + i, symbol->text, (int) ustrlen(symbol->text), (int) strlen(data[i].data), testUtilErrorName(ret), data[i].data, symbol->errtxt); + } } assert_zero(strcmp(symbol->errtxt, data[i].expected), "i:%d strcmp(%s, %s) != 0\n", i, symbol->errtxt, data[i].expected); } @@ -523,9 +544,10 @@ static void test_hibc_input(const testCtx *const p_ctx) { /* 1*/ { "A99912345/$$52001510X3", 0, 255, "(23) 104 11 33 99 99 91 23 45 100 15 4 4 99 52 0 15 10 100 56 19 19 53 106", "Check digit 3" }, /* 2*/ { "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%", 0, 497, "(45) 104 11 99 1 23 45 67 89 100 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51", "Check digit +" }, /* 3*/ { "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", 0, 695, "(63) 104 11 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5", "Check digit Q" }, - /* 4*/ { "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", ZINT_ERROR_TOO_LONG, -1, "Error 341: Input too long (60 symbol character maximum)", "" }, - /* 5*/ { "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 0, 684, "(62) 104 11 99 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", "Check digit %" }, - /* 6*/ { "09AZ-.19AZ-.29AZ-.39AZ-.49AZ-.59AZ-.69AZ-.79AZ-.89AZ-.99AZ", 0, 695, "(63) 104 11 16 25 33 58 13 14 17 25 33 58 13 14 18 25 33 58 13 14 19 25 33 58 13 14 20 25", "Check digit -" }, + /* 4*/ { "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", 0, 1124, "(102) 104 11 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5", "" }, + /* 5*/ { "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%", ZINT_ERROR_TOO_LONG, -1, "Error 341: Input too long (99 symbol character maximum)", "" }, + /* 6*/ { "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 0, 684, "(62) 104 11 99 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", "Check digit %" }, + /* 7*/ { "09AZ-.19AZ-.29AZ-.39AZ-.49AZ-.59AZ-.69AZ-.79AZ-.89AZ-.99AZ", 0, 695, "(63) 104 11 16 25 33 58 13 14 17 25 33 58 13 14 18 25 33 58 13 14 19 25 33 58 13 14 20 25", "Check digit -" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -905,8 +927,8 @@ static void test_encode(const testCtx *const p_ctx) { /* 35*/ { BARCODE_GS1_128, GS1_MODE, -1, "[90]ABCDEfGHI", 0, 1, 167, 0, "Shift A; BWIPP different encodation, same codeword count", "11010010000111101011101110010110010011101100101000110001000101100010001000110101100010001000110100010110000100110100010001100010100011000100010110010011101100011101011" }, - /* 36*/ { BARCODE_GS1_128, GS1_MODE, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", 0, 1, 684, 1, "Max length", - "110100111001111010111011001101100101100111001000101100011100010110110000101001101111011010110011100110110001101101111011010110011100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011110101110111101101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101011001110010001011000100011110101100011101011" + /* 36*/ { BARCODE_GS1_128, GS1_MODE, -1, "[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[00]345678901234567890[3100]121212[20]34[20]78", ZINT_WARN_HRT_TRUNCATED, 1, 1135, 1, "Max length", + "1101001110011110101110110110011001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101101100110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011011001100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110110110011001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101101100110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011011001100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110110110011001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101101100110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011011011001100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110110110001101101100110010110011100101100111001011001110011001001110100010110001100100111011000010100100100110001100011101011" }, /* 37*/ { BARCODE_EAN14, GS1_MODE, -1, "4070071967072", 0, 1, 134, 1, "Verified manually against TEC-IT", "11010011100111101011101100110110011000101000101100001001001100010011001011100100001011001001100010011001001110110111001001100011101011" @@ -1132,7 +1154,7 @@ int main(int argc, char *argv[]) { { "test_hrt", test_hrt }, { "test_reader_init", test_reader_init }, { "test_input", test_input }, - { "test_ean128_input", test_ean128_input }, + { "test_gs1_128_input", test_gs1_128_input }, { "test_hibc_input", test_hibc_input }, { "test_ean14_input", test_ean14_input }, { "test_dpd_input", test_dpd_input }, diff --git a/backend/tests/test_common.c b/backend/tests/test_common.c index 52df6d26..52bad579 100644 --- a/backend/tests/test_common.c +++ b/backend/tests/test_common.c @@ -485,21 +485,21 @@ static void test_hrt_cpy_iso8859_1(const testCtx *const p_ctx) { /* 4*/ { "\241\242\243\244\257\260", -1, 0, "¡¢£¤¯°", "" }, /* 5*/ { "\276\277\300\337\377", -1, 0, "¾¿Àßÿ", "" }, /* 6*/ { "\351", -1, 0, "é", "" }, - /* 7*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 0, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "79 \241" }, - /* 8*/ { "a\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 0, "a¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "a + 79 \241" }, - /* 9*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241a", -1, 0, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡a", "79 \241 + a" }, - /* 10*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "80 \241 (truncated)" }, - /* 11*/ { "a\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "a¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "a + 80 \241 (truncated)" }, - /* 12*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241a", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "80 \241 + a (truncated)" }, - /* 13*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "81 \241 (truncated)" }, - /* 14*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 0, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "79 \351" }, - /* 15*/ { "a\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 0, "aééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "a + 79 \351" }, - /* 16*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351a", -1, 0, "éééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééa", "79 \351 + a" }, - /* 17*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "80 \351 (truncated)" }, - /* 18*/ { "a\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "aééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "a + 80 \351 (truncated)" }, - /* 19*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351a", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "80 \351 + a (truncated)" }, - /* 20*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "81 \351 (truncated)" }, - /* 21*/ { "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "160 A (truncated)" }, + /* 7*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 0, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "99 \241" }, + /* 8*/ { "a\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 0, "a¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "a + 99 \241" }, + /* 9*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241a", -1, 0, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡a", "99 \241 + a" }, + /* 10*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "100 \241 (truncated)" }, + /* 11*/ { "a\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "a¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "a + 100 \241 (truncated)" }, + /* 12*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241a", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "100 \241 + a (truncated)" }, + /* 13*/ { "\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241\241", -1, 1, "¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡", "101 \241 (truncated)" }, + /* 14*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 0, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "99 \351" }, + /* 15*/ { "a\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 0, "aééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "a + 99 \351" }, + /* 16*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351a", -1, 0, "éééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééa", "99 \351 + a" }, + /* 17*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "100 \351 (truncated)" }, + /* 18*/ { "a\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "aééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "a + 100 \351 (truncated)" }, + /* 19*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351a", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "100 \351 + a (truncated)" }, + /* 20*/ { "\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351\351", -1, 1, "ééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééééé", "101 \351 (truncated)" }, + /* 21*/ { "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", -1, 1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "200 A (truncated)" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_composite.c b/backend/tests/test_composite.c index c5d74b53..1638e897 100644 --- a/backend/tests/test_composite.c +++ b/backend/tests/test_composite.c @@ -1396,21 +1396,21 @@ static void test_examples(const testCtx *const p_ctx) { "0000000001011000110000101000100110010011010011000110111010011100011101001001111010110010000100101001100011001001110010010000100101001100011010000100010011010001100010100001001000100010011100010100000000000" "0000000110100111001111010111011001101100101100111001000101100011100010110110000101001101111011010110011100110110001101101111011010110011100101111011101100101110011101011110110111011101100011101011000000000" }, - /* 66*/ { BARCODE_GS1_128_CC, -1, 3, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[20]12", 0, 5, 702, 1, "Example with max linear input and min CC-C input, CC-C 30 cols, 3 rows (bumped up from 1)", + /* 66*/ { BARCODE_GS1_128_CC, -1, 3, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[20]12", ZINT_WARN_NONCOMPLIANT, 5, 702, 1, "Example with overlarge linear input and min CC-C input, CC-C 30 cols, 3 rows (bumped up from 1)", "111111110101010001110101011100000010100010000010000111011111011101001000001000010001011101001101111000100110011110111001000011011100110011100010110111100100010111011100001010111000111000010000101100000110100100000010010001100001100010100011011000111001110110010011101111001000101111011110010100001110001110100011000011010001101111011100010010100110001100000101100011110111001111011110101000010000010001101100100011011001000001110101101111000010001100011100110111011010110000001110111010000100011000010110001110110100001000011001000010010000001010101111011110000111111101000101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "111111110101010001111010100001000011110011011000100111100000100010101110010001100001011101011101100000111111011100101001111100100010011011100000010011010110010011100000101111001010000001010110011111001000111111010001011101110001100011101011111000110010100110101111101110001110010011110111011100011011101000110111110010111101110111001111001011110101101100000110011101111100101101000011100100011011000011110010100010001111101101010011110000100010011000111110100111100110110001001111000001000101011100100011000010111010111011000001111110111001010011111010101100000111111101000101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "111111110101010001010111000111111011011101011100000110001111101000101100010111111001011001001111110010100010001001111001101000001011111011100011110101110110111110011001101101001000111110010011010011100000101111101100000101000000110010111010000110110111100110101101111110001011111000111011010110100001110000101110000100110001101111000010011010100110001111100110101100111111001001010011110000011110101111001000110101000111110001000110001001110010100011001111100100000111001001101000110011011110010011010000111000110111111001101001110101111101000010101000011110000111111101000101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "000000000101100011000010100010011001001101001100011011101001110001110100100111101011001000010010100110001100100111001001000010010100110001101110100111000111010010011110101100100001001010011000110111010011100011101001001111010110010000100101001100011011101001110001110100100111101011001000010010000101000100001001001010011000110111010011100011101001001111010110010000100101001100011011101001110001110100100111101011001000010010100110001101110100111000111010010011110101100100001001010011000110111010011100011101001001111010110010000100101001100011011101001110001110100100111101011001000010010100110001101110100111000111010010011110101100100001001010011000110111010011101000010001001100110010011100010100" "000000011010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110110111101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101111010111011110110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110101100111001000101100010111101110110011001101100011101011" }, - /* 67*/ { BARCODE_GS1_128_CC, -1, 3, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[20]01[90]123456789012345678901234567890[91]123456789012", 0, 5, 702, 1, "Example with max linear input and medium CC-C input, CC-C 30 cols, 3 rows (bumped up from 1 (before last digit) than 2)", + /* 67*/ { BARCODE_GS1_128_CC, -1, 3, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[20]01[90]123456789012345678901234567890[91]123456789012", ZINT_WARN_NONCOMPLIANT, 5, 702, 1, "Example with overlarge linear input and medium CC-C input, CC-C 30 cols, 3 rows (bumped up from 1 (before last digit) than 2)", "111111110101010001110101011100000010100010000010000111011111011101001000001000010001011101001101111000111000101000111001100100011101111010001011000001100101100000110000101101101100110000011010010000110000110000100011011101001110011101000011110111011011100111101100010011101111001001011110011101110001000010111000101001110001011000001100010011010010011000000110011100001101001100011011000011011101110001010000110100001000001101010011000110000010110001111011100111101111010100001000001000110110010001101100100000111010110111100001000110001110011010101111011110000111111101000101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "111111110101010001111010100001000011010000111001000110110000111100101000100011111011010100111100001000100110001111101001111001101100010011110000010001010111001000110000101110101110110000011111101110010100111110010001001101110000001001101011001001110000010111100101000000101011001111100100011111101000101110111000110001110101111100011001010011010111110111000111001001111011101110001101110100011011111001011110111011100111100101111010110110000011001110111110010110100001110010001101100001111001010001000111110110101001111000010001001100011111010011111010101100000111111101000101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "111111110101010001010111000111111010001100110111100101111110111000101001100101110000010101110011111100101111000010000101101110101110000011000111110100010110001011111100101100100111111001010001000100111100110100000101111101110001111010111011011111001100110110100100011111001001101001110000010111110110000010100000011001011101000011011011110010101000011110000101001100011111001101011001111110010010100111100000111111010011010001000110101110000011101111100100110110100011011111101100111110100001011001111100001010100001010011110001101011111100010010101000011110000111111101000101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "000000000101100011000010100010011001001101001100011011101001110001110100100111101011001000010010100110001100100111001001000010010100110001101110100111000111010010011110101100100001001010011000110111010011100011101001001111010110010000100101001100011011101001110001110100100111101011001000010010000101000100001001001010011000110111010011100011101001001111010110010000100101001100011011101001110001110100100111101011001000010010100110001101110100111000111010010011110101100100001001010011000110111010011100011101001001111010110010000100101001100011011101001110001110100100111101011001000010010100110001101110100111000111010010011110101100100001001010011000110111010011101000010001001100110010011100010100" "000000011010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110110111101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101111010111011110110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110101100111001000101100011100010110110000101001101111011010110011100100010110001110001011011000010100110111101101011001110010001011000111000101101100001010011011110110101100111001000101100010111101110110011001101100011101011" }, - /* 68*/ { BARCODE_GS1_128_CC, -1, 3, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[20]01[90]123456789012345678901234567890[91]1234567890123", 0, 5, 702, 1, "Example with max linear input and medium CC-C input, CC-C 30 cols, 3 rows (bumped up from 2)", + /* 68*/ { BARCODE_GS1_128_CC, -1, 3, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[20]01[90]123456789012345678901234567890[91]1234567890123", ZINT_WARN_NONCOMPLIANT, 5, 702, 1, "Example with overlarge linear input and medium CC-C input, CC-C 30 cols, 3 rows (bumped up from 2)", "111111110101010001110101011100000010100010000010000111011111011101001000001000010001011101001101111000111000101000111001100100011101111010001011000001100101100000110000101101101100110000011010010000110000110000100011011101001110011101000011110111011011100111101100010011101111001001011110011101110001000010111000101001110001011000001100010011010010011000000110011100001101001100011011000011010111001111001100110100000100110001010011000110000010110001111011100111101111010100001000001000110110010001101100100000111010110111100001000110001110011010101111011110000111111101000101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "111111110101010001111010100001000011010000111001000110110000111100101000100011111011010100111100001000100110001111101001111001101100010011110000010001010111001000110000101110101110110000011111101110010100111110010001001101110000001001101011001001110000010111100101000000101011001111100100011111101000101110111000110001110101111100011001010011010111110111000111001001111011101110001101110100011011111001011110111011100111100101111010110110000011001110111110010110100001110010001101100001111001010001000111110110101001111000010001001100011111010011111010101100000111111101000101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "111111110101010001010111000111111010001100110111100101111110111000101001100101110000010101110011111100101111000010000101101110101110000011000111110100010110001011111100101100100111111001010001000100111100110100000101111101110001111010111011011111001100110110100100011111001001101001110000010111110110000010100000011001011101000011011011110010101000011110000101001100011111001101011001111110010010100111100000111011110001011101101111000001011010111100000100010110100100011111001011101000011000010001101011100000101111110001110101011110110011000010101000011110000111111101000101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" @@ -3409,8 +3409,8 @@ static void test_input(const testCtx *const p_ctx) { /* 96*/ { BARCODE_DBAR_OMNSTK_CC, GS1NOCHECK_MODE, -1, -1, -1, "12345678901231", "[02]12345678901234", 0, 11, 56, "" }, /* 97*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "", "[20]12", ZINT_ERROR_INVALID_OPTION, -1, -1, "Error 445: No primary (linear) message" }, /* 98*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 31, 273, "" }, /* Tries CC-A then CC-B then CC-C - ensure errtxt empty */ - /* 99*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123", 0, 29, 702, "" }, /* Max linear and CC-C input */ - /*100*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1,"[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_TOO_LONG, -1, -1, "Error 442: Input too long for selected 2D component" }, /* Max linear and oversized CC-C input */ + /* 99*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[95]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[96]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[97]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[98]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[99]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890123456789012345678901234567890123", ZINT_WARN_NONCOMPLIANT, 29, 702, "Warning 843: GS1-128 input too long (48 character maximum) in linear component" }, /* Overlarge linear and CC-C input */ + /*100*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1,"[01]12345678901231[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890123456789012345678901234", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL", ZINT_ERROR_TOO_LONG, -1, -1, "Error 442: Input too long for selected 2D component" }, /* Overlarge linear and oversized CC-C input */ /*101*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[97]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[98]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[99]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[94]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[95]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[96]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[92]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI" "JKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKL[93]ABCDEFGHIJKLM", ZINT_ERROR_TOO_LONG, -1, -1, "Error 446: 2D component input data too long" }, /* Reduced length 2291 */ /*102*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, "[01]12345678901231", "[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012" "345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[00]123456789012345675[11]121212[20]12", 0, 32, 579, "" }, /* Reduced length 2372 digits (no FNC1s) with not recommended ECC 4 > 2361 digit limit given in ISO/IEC 24723:2010 4.1 (d)(2)(iii) */ /*103*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, -1, -1, "[91]1234567890123456789012345678901234", "[20]12", 0, 13, 102, "" }, diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index 078b9e5f..925e3e33 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -79,8 +79,8 @@ static void test_checks(const testCtx *const p_ctx) { /* 14*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, -1, -1, -1, 0, -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, 0, -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, 0, -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.1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 219: Text gap out of range (0 to 10)", -1 }, - /* 18*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, 10.1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 219: Text gap out of range (0 to 10)", -1 }, + /* 17*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, -5.1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 219: Text gap out of range (-5 to 10)", -1 }, + /* 18*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, 10.1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 219: Text gap out of range (-5 to 10)", -1 }, /* 19*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, 0, -0.5, -1, ZINT_ERROR_INVALID_OPTION, "Error 769: Guard bar descent out of range (0 to 50)", -1 }, /* 20*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, 0, 50.1, -1, ZINT_ERROR_INVALID_OPTION, "Error 769: Guard bar descent out of range (0 to 50)", -1 }, /* 21*/ { BARCODE_GS1_128, -1, "[21]12\0004", 8, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 262: NUL characters not permitted in GS1 mode", -1 }, @@ -1505,7 +1505,7 @@ static void test_scale_from_xdimdp(const testCtx *const p_ctx) { assert_equal(ret, data[i].expected, "i:%d ZBarcode_Scale_From_XdimDp(%s, %g (dpi %d), %g, %s) %.8g != %.8g\n", i, testUtilBarcodeName(data[i].symbology), dpmm_from_dpi, data[i].dpi, data[i].x_dim, data[i].filetype, ret, data[i].expected); - if (data[i].expected > 0.1f && data[i].expected < 200.0f /* Can't round trip scales <= 0.1 or >= 200.0f */ + if (data[i].expected > 0.1f && data[i].expected < 200.0f /* Can't round trip scales <= 0.1 or >= 200.0 */ && (data[i].symbology == BARCODE_MAXICODE || strcmp(data[i].filetype, "gif") != 0)) { /* Non-MAXICODE raster rounds to half-increments */ x_dim_from_scale = ZBarcode_XdimDp_From_Scale(data[i].symbology, ret, data[i].dpmm, data[i].filetype); x_dim_from_scale = stripf(stripf(roundf(x_dim_from_scale * 100.0f)) / 100.0f); diff --git a/backend/tests/test_output.c b/backend/tests/test_output.c index 7b90dfe5..42fe3e12 100644 --- a/backend/tests/test_output.c +++ b/backend/tests/test_output.c @@ -328,6 +328,10 @@ static void test_fopen(const testCtx *const p_ctx) { testFinish(); } +#ifndef _WIN32 +extern FILE *fmemopen(void *buf, size_t size, const char *mode); +#endif + static void test_out_putsf(const testCtx *const p_ctx) { int debug = p_ctx->debug; diff --git a/backend/tests/test_pcx.c b/backend/tests/test_pcx.c index 2304467c..c75edf8b 100644 --- a/backend/tests/test_pcx.c +++ b/backend/tests/test_pcx.c @@ -117,10 +117,10 @@ static void test_print(const testCtx *const p_ctx) { assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); if (p_ctx->generate) { - printf(" /*%3d*/ { %s, %d, %s, %d, %d, %d, %d, \"%s\", \"%s\", \"%s\", \"%s\"},\n", + printf(" /*%3d*/ { %s, %d, %s, %d, %d, %d, %d, \"%s\", \"%s\", %.5g, \"%s\", \"%s\"},\n", i, testUtilBarcodeName(data[i].symbology), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, data[i].whitespace_height, - data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, + data[i].option_1, data[i].option_2, data[i].fgcolour, data[i].bgcolour, data[i].scale, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].expected_file); ret = testUtilRename(symbol->outfile, expected_file); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0 (%d: %s)\n", i, symbol->outfile, expected_file, ret, errno, strerror(errno)); diff --git a/backend/tests/test_png.c b/backend/tests/test_png.c index 9caef6fe..0ffb54f2 100644 --- a/backend/tests/test_png.c +++ b/backend/tests/test_png.c @@ -57,7 +57,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { }; int data_size = ARRAY_SIZE(data); int i, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; char *png = "out.png"; @@ -65,7 +65,7 @@ static void test_pixel_plot(const testCtx *const p_ctx) { const char *const have_identify = testUtilHaveIdentify(); - testStart("test_pixel_plot"); + testStartSymbol("test_pixel_plot", &symbol); for (i = 0; i < data_size; i++) { int size; @@ -144,93 +144,95 @@ static void test_print(const testCtx *const p_ctx) { char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold.png", "" }, - /* 1*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_box3.png", "" }, - /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.png", "" }, - /* 3*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", 0, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.png", "" }, - /* 4*/ { BARCODE_CODABLOCKF, -1, 3, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_3rows.png", "" }, - /* 5*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2.png", "" }, - /* 6*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.png", "" }, - /* 7*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9771384524017", "", 0, "ean13_ggs_5.2.2.1-1.png", "" }, - /* 8*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9771384524017", "", 0, "ean13_ggs_5.2.2.1-1_gws.png", "" }, - /* 9*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.png", "" }, - /* 10*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2_gws.png", "" }, - /* 11*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.png", "" }, - /* 12*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2_gws.png", "" }, - /* 13*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012", "[91]12345678901234567890123456789", 0, "ean13_cc_cca_5x4.png", "" }, - /* 14*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012", "[91]12345678901234567890123456789", 0, "ean13_cc_cca_5x4_gws.png", "" }, - /* 15*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.png", "" }, - /* 16*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4_gws.png", "" }, - /* 17*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.png", "" }, - /* 18*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_gws.png", "" }, - /* 19*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.png", "" }, - /* 20*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.png", "" }, - /* 21*/ { BARCODE_UPCA, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5_gws.png", "" }, - /* 22*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "614141234417+12345", "", 0, "upca_5addon.png", "" }, - /* 23*/ { BARCODE_UPCA, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_gws.png", "" }, - /* 24*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_notext.png", "" }, - /* 25*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_bind3.png", "" }, - /* 26*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.png", "" }, - /* 27*/ { BARCODE_UPCA_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4_gws.png", "" }, - /* 28*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.png", "" }, - /* 29*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.png", "" }, - /* 30*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.png", "" }, - /* 31*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12", "", 0, "upce_2addon.png", "" }, - /* 32*/ { BARCODE_UPCE, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12", "", 0, "upce_2addon_gws.png", "" }, - /* 33*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12345", "", 0, "upce_5addon.png", "" }, - /* 34*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12345", "", 0, "upce_5addon_small.png", "" }, - /* 35*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT | EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12345", "", 0, "upce_5addon_small_gws.png", "" }, - /* 36*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.png", "" }, - /* 37*/ { BARCODE_UPCE_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_gws.png", "" }, - /* 38*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.png", "" }, - /* 39*/ { BARCODE_UPCE_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_gws.png", "" }, - /* 40*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.png", "" }, - /* 41*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567", "", 0, "ean8_gss_5.2.2.2-1.png", "" }, - /* 42*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567", "", 0, "ean8_gss_5.2.2.2-1_gws.png", "" }, - /* 43*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12", "", 0, "ean8_2addon.png", "" }, - /* 44*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12", "", 0, "ean8_2addon_gws.png", "" }, - /* 45*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12345", "", 0, "ean8_5addon.png", "" }, - /* 46*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12345", "", 0, "ean8_5addon_gws.png", "" }, - /* 47*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.png", "" }, - /* 48*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3_gws.png", "" }, - /* 49*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.png", "" }, - /* 50*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3_gws.png", "" }, - /* 51*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345", "", 0, "ean5.png", "" }, - /* 52*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345", "", 0, "ean5_gws.png", "" }, - /* 53*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12", "", 0, "ean2.png", "" }, - /* 54*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12", "", 0, "ean2_gws.png", "" }, - /* 55*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123", "", 0, "code39_small.png", "" }, - /* 56*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3.5, { 0, 0, "" }, "", "", 0, "12345", "", 0, "postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" }, - /* 57*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "CFCECDCC", 0, "12345", "", 0, "pdf417_bgalpha.png", "" }, - /* 58*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "30313233", "", 0, "12345", "", 0, "pdf417_fgalpha.png", "" }, - /* 59*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "20212244", "CFCECDCC", 0, "12345", "", 0, "pdf417_bgfgalpha.png", "" }, - /* 60*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF000033", 0, "12345", "", 0, "ultra_bgfgalpha.png", "" }, - /* 61*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "FF000033", 0, "12345", "", 0, "ultra_bgalpha.png", "" }, - /* 62*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF0000", 0, "12345", "", 0, "ultra_fgalpha.png", "" }, - /* 63*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "", 0, "12345", "", 0, "ultra_fgalpha_nobg.png", "" }, - /* 64*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345", "", 0, "ultra_hvwsp1_box1.png", "" }, - /* 65*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", 0, "12345", "", 0, "ultra_fgalpha_hvwsp1_box1.png", "" }, - /* 66*/ { BARCODE_ULTRA, -1, 1, BARCODE_BIND_TOP, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", 0, "12345", "", 0, "ultra_fgalpha_hvwsp1_bindtop1.png", "" }, - /* 67*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", 0, "1", "", 0, "ultra_odd.png", "" }, - /* 68*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.5.png", "6 dpmm, 150 dpi" }, - /* 69*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" }, - /* 70*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4, { 0, 0, "" }, "1111117F", "EEEEEEEE", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" }, - /* 71*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_2.1.png", "24 dpmm, 600 dpi" }, - /* 72*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_hvwsp1_box2.png", "" }, - /* 73*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.png", "" }, - /* 74*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", 0, "1234", "", 0, "datamatrix_2.0_bind1_dotty.png", "" }, - /* 75*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", 0, "1234", "", 0, "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" }, - /* 76*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678909", "", 0, "dbar_ltd.png", "" }, - /* 77*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5.0, 0, { 0, 0, "" }, "", "", 0, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.png", "" }, - /* 78*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, 0, { 0, 0, "" }, "", "", 0, "12345678901234567890", "", 0, "imail_height7.75.png", "" }, - /* 79*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 4, 7, "Z1.txt" }, "", "", 0, "3456", "", 0, "aztec_z1_seq4of7.png", "" }, - /* 80*/ { BARCODE_PDF417, -1, -1, BARCODE_NO_QUIET_ZONES, -1, -1, -1, 5, 8, 16, 1.5, { 0, 0, "" }, "", "", 0, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "", ZINT_WARN_NONCOMPLIANT, "pdf417_#204.png", "Ticket #204 Blank line in PDF417" }, - /* 81*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "008182709980000020028101276", "", 0, "dpd_compliant.png", "Now with bind top 3X default" }, - /* 82*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "100,85,0,20", "FFFFFF00", 0, "123", "", 0, "channel_cmyk_nobg.png", "" }, + /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "Égjpqy", "", 0, "code128_egrave_bold.png", "" }, + /* 1*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "Égjpqy", "", 0, "code128_egrave_bold_box3.png", "" }, + /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.png", "" }, + /* 3*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", 1, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.png", "" }, + /* 4*/ { BARCODE_CODABLOCKF, -1, 3, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", 1, "AAAAAAAAA", "", 0, "codablockf_3rows.png", "" }, + /* 5*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "AAAAAAAAA", "", 0, "codablockf_hvwsp2.png", "" }, + /* 6*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.png", "" }, + /* 7*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9771384524017", "", 0, "ean13_ggs_5.2.2.1-1.png", "" }, + /* 8*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9771384524017", "", 0, "ean13_ggs_5.2.2.1-1_gws.png", "" }, + /* 9*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.png", "" }, + /* 10*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2_gws.png", "" }, + /* 11*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.png", "" }, + /* 12*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2_gws.png", "" }, + /* 13*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "123456789012", "[91]12345678901234567890123456789", 0, "ean13_cc_cca_5x4.png", "" }, + /* 14*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "123456789012", "[91]12345678901234567890123456789", 0, "ean13_cc_cca_5x4_gws.png", "" }, + /* 15*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.png", "" }, + /* 16*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4_gws.png", "" }, + /* 17*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.png", "" }, + /* 18*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_gws.png", "" }, + /* 19*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.png", "" }, + /* 20*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.png", "" }, + /* 21*/ { BARCODE_UPCA, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5_gws.png", "" }, + /* 22*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "614141234417+12345", "", 0, "upca_5addon.png", "" }, + /* 23*/ { BARCODE_UPCA, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "614141234417+12345", "", 0, "upca_5addon_gws.png", "" }, + /* 24*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "614141234417+12345", "", 0, "upca_5addon_notext.png", "" }, + /* 25*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "614141234417+12345", "", 0, "upca_5addon_bind3.png", "" }, + /* 26*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.png", "" }, + /* 27*/ { BARCODE_UPCA_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4_gws.png", "" }, + /* 28*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.png", "" }, + /* 29*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.png", "" }, + /* 30*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.png", "" }, + /* 31*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12", "", 0, "upce_2addon.png", "" }, + /* 32*/ { BARCODE_UPCE, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12", "", 0, "upce_2addon_gws.png", "" }, + /* 33*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", 0, "upce_5addon.png", "" }, + /* 34*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", 0, "upce_5addon_small.png", "" }, + /* 35*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT | EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", 0, "upce_5addon_small_gws.png", "" }, + /* 36*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.png", "" }, + /* 37*/ { BARCODE_UPCE_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_gws.png", "" }, + /* 38*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.png", "" }, + /* 39*/ { BARCODE_UPCE_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_gws.png", "" }, + /* 40*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.png", "" }, + /* 41*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567", "", 0, "ean8_gss_5.2.2.2-1.png", "" }, + /* 42*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567", "", 0, "ean8_gss_5.2.2.2-1_gws.png", "" }, + /* 43*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12", "", 0, "ean8_2addon.png", "" }, + /* 44*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12", "", 0, "ean8_2addon_gws.png", "" }, + /* 45*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", 0, "ean8_5addon.png", "" }, + /* 46*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "1234567+12345", "", 0, "ean8_5addon_gws.png", "" }, + /* 47*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.png", "" }, + /* 48*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3_gws.png", "" }, + /* 49*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.png", "" }, + /* 50*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 1, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3_gws.png", "" }, + /* 51*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ean5.png", "" }, + /* 52*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ean5_gws.png", "" }, + /* 53*/ { BARCODE_EANX, -1, 2, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ean5_bind2.png", "" }, + /* 54*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12", "", 0, "ean2.png", "" }, + /* 55*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12", "", 0, "ean2_gws.png", "" }, + /* 56*/ { BARCODE_EANX, -1, 1, BARCODE_BOX, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12", "", 0, "ean2_box1.png", "" }, + /* 57*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "123", "", 0, "code39_small.png", "" }, + /* 58*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3.5, { 0, 0, "" }, "", "", 1, "12345", "", 0, "postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" }, + /* 59*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "CFCECDCC", 1, "12345", "", 0, "pdf417_bgalpha.png", "" }, + /* 60*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "30313233", "", 1, "12345", "", 0, "pdf417_fgalpha.png", "" }, + /* 61*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "20212244", "CFCECDCC", 1, "12345", "", 0, "pdf417_bgfgalpha.png", "" }, + /* 62*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF000033", 1, "12345", "", 0, "ultra_bgfgalpha.png", "" }, + /* 63*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "FF000033", 1, "12345", "", 0, "ultra_bgalpha.png", "" }, + /* 64*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF0000", 1, "12345", "", 0, "ultra_fgalpha.png", "" }, + /* 65*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "", 1, "12345", "", 0, "ultra_fgalpha_nobg.png", "" }, + /* 66*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345", "", 0, "ultra_hvwsp1_box1.png", "" }, + /* 67*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", 1, "12345", "", 0, "ultra_fgalpha_hvwsp1_box1.png", "" }, + /* 68*/ { BARCODE_ULTRA, -1, 1, BARCODE_BIND_TOP, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", 1, "12345", "", 0, "ultra_fgalpha_hvwsp1_bindtop1.png", "" }, + /* 69*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", 1, "1", "", 0, "ultra_odd.png", "" }, + /* 70*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.5.png", "6 dpmm, 150 dpi" }, + /* 71*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7, { 0, 0, "" }, "", "", 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" }, + /* 72*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4, { 0, 0, "" }, "1111117F", "EEEEEEEE", 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" }, + /* 73*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1, { 0, 0, "" }, "", "", 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_2.1.png", "24 dpmm, 600 dpi" }, + /* 74*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_hvwsp1_box2.png", "" }, + /* 75*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.png", "" }, + /* 76*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0, { 0, 0, "" }, "", "", 1, "1234", "", 0, "datamatrix_2.0_bind1_dotty.png", "" }, + /* 77*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0, { 0, 0, "" }, "", "", 1, "1234", "", 0, "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" }, + /* 78*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "12345678909", "", 0, "dbar_ltd.png", "" }, + /* 79*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5.0, 0, { 0, 0, "" }, "", "", 1, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.png", "" }, + /* 80*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, 0, { 0, 0, "" }, "", "", 1, "12345678901234567890", "", 0, "imail_height7.75.png", "" }, + /* 81*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 4, 7, "Z1.txt" }, "", "", 1, "3456", "", 0, "aztec_z1_seq4of7.png", "" }, + /* 82*/ { BARCODE_PDF417, -1, -1, BARCODE_NO_QUIET_ZONES, -1, -1, -1, 5, 8, 16, 1.5, { 0, 0, "" }, "", "", 1, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "", ZINT_WARN_NONCOMPLIANT, "pdf417_#204.png", "Ticket #204 Blank line in PDF417" }, + /* 83*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 1, "008182709980000020028101276", "", 0, "dpd_compliant.png", "Now with bind top 3X default" }, + /* 84*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "100,85,0,20", "FFFFFF00", 1, "123", "", 0, "channel_cmyk_nobg.png", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; - struct zint_symbol *symbol; + struct zint_symbol *symbol = NULL; const char *data_dir = "/backend/tests/data/png"; const char *png = "out.png"; @@ -241,7 +243,7 @@ static void test_print(const testCtx *const p_ctx) { const char *const have_identify = testUtilHaveIdentify(); - testStart("test_print"); + testStartSymbol("test_print", &symbol); if (p_ctx->generate) { char data_dir_path[1024]; @@ -308,9 +310,11 @@ static void test_print(const testCtx *const p_ctx) { assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); if (p_ctx->generate) { - printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %.5g, %.5g, \"%s\", \"%s\", \"%s\", \"%s\", %s, \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %.5g, %.5g, { %d, %d, \"%s\" }, \"%s\", \"%s\", %.5g, \"%s\", \"%s\", %s, \"%s\", \"%s\" },\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), - data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].height, data[i].scale, data[i].fgcolour, data[i].bgcolour, + data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].height, data[i].scale, + data[i].structapp.index, data[i].structapp.count, data[i].structapp.id, + data[i].fgcolour, data[i].bgcolour, data[i].text_gap, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, testUtilErrorName(data[i].ret), data[i].expected_file, data[i].comment); ret = testUtilRename(symbol->outfile, expected_file); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); @@ -441,7 +445,7 @@ static void test_large_compliant_height(const testCtx *const p_ctx) { (void)p_ctx; - testStart("test_large_compliant_height"); + testStartSymbol("test_large_compliant_height", &symbol); symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c index a9f092da..d22856ea 100644 --- a/backend/tests/test_raster.c +++ b/backend/tests/test_raster.c @@ -300,8 +300,8 @@ static void test_buffer(const testCtx *const p_ctx) { /*175*/ { BARCODE_AZTEC, COMPLIANT_HEIGHT, "1234567890AB", "", 15, 15, 15, 30, 30 }, /*176*/ { BARCODE_DAFT, -1, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 }, /*177*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 }, - /*178*/ { BARCODE_DPD, -1, "0123456789012345678901234567", "", 50, 1, 189, 378, 128 }, - /*179*/ { BARCODE_DPD, COMPLIANT_HEIGHT, "0123456789012345678901234567", "", 66.5, 1, 189, 378, 161 }, + /*178*/ { BARCODE_DPD, -1, "0123456789012345678901234567", "", 50, 1, 189, 378, 122 }, + /*179*/ { BARCODE_DPD, COMPLIANT_HEIGHT, "0123456789012345678901234567", "", 66.5, 1, 189, 378, 155 }, /*180*/ { BARCODE_MICROQR, -1, "12345", "", 11, 11, 11, 22, 22 }, /*181*/ { BARCODE_MICROQR, COMPLIANT_HEIGHT, "12345", "", 11, 11, 11, 22, 22 }, /*182*/ { BARCODE_HIBC_128, -1, "1234567890", "", 50, 1, 123, 246, 116 }, @@ -1226,11 +1226,11 @@ static void test_scale(const testCtx *const p_ctx) { /* 50*/ { BARCODE_PDF417, -1, -1, -1, 45, 0.5, "1", "", 0, 45, 5, 103, 206 * 0.5, 45, 0 /*set_row*/, 45, 170 * 0.5, 14 * 0.5 }, /* Height specified */ /* 51*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 0, 0, "123456789012", "", 0, 50, 1, 79, 158, 116, 104 /*set_row*/, 114, 20, 2 }, /* With no scaling */ /* 52*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 0, 1.5, "123456789012", "", 0, 50, 1, 79, 158 * 1.5, 116 * 1.5, 104 * 1.5 /*set_row*/, 114 * 1.5, 20 * 1.5, 1 * 1.5 }, - /* 53*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 0, 2.0, "123456789012", "", 0, 50, 1, 79, 158 * 2.0, 116 * 2.0, 104 * 2.0 /*set_row*/, 114 * 2.0, 20 * 2.0, 1 * 2.0 }, - /* 54*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 0, 3.5, "123456789012", "", 0, 50, 1, 79, 158 * 3.5, 116 * 3.5, 104 * 3.5 /*set_row*/, 114 * 3.5, 20 * 3.5, 1 * 3.5 }, + /* 53*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 0, 2.0, "123456789012", "", 0, 50, 1, 79, 158 * 2.0, 116 * 2.0, 104 * 2.0 /*set_row*/, 114 * 2.0, 20 * 2.0 + 1, 1 * 2.0 + 1 }, + /* 54*/ { BARCODE_DBAR_LTD, -1, -1, BOLD_TEXT, 0, 3.5, "123456789012", "", 0, 50, 1, 79, 158 * 3.5, 116 * 3.5, 104 * 3.5 /*set_row*/, 114 * 3.5, 20 * 3.5 + 1, 1 * 3.5 + 0.5 }, /* 55*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "12345678904", "", 0, 50, 1, 95, 226, 116, 104 /*set_row*/, 114, 5, 2 }, /* With no scaling */ - /* 56*/ { BARCODE_UPCA, -1, -1, -1, 0, 2.5, "12345678904", "", 0, 50, 1, 95, 226 * 2.5, 116 * 2.5, 104 * 2.5 /*set_row*/, 114 * 2.5, 5 * 2.5, 2 * 2.5 }, - /* 57*/ { BARCODE_UPCA, -1, -1, -1, 0, 4.5, "12345678904", "", 0, 50, 1, 95, 226 * 4.5, 116 * 4.5, 104 * 4.5 /*set_row*/, 114 * 4.5, 5 * 4.5, 2 * 4.5 }, + /* 56*/ { BARCODE_UPCA, -1, -1, -1, 0, 2.5, "12345678904", "", 0, 50, 1, 95, 226 * 2.5, 116 * 2.5, 104 * 2.5 /*set_row*/, 114 * 2.5, 5 * 2.5 + 1.5, 2 * 2.5 }, + /* 57*/ { BARCODE_UPCA, -1, -1, -1, 0, 4.5, "12345678904", "", 0, 50, 1, 95, 226 * 4.5, 116 * 4.5, 104 * 4.5 /*set_row*/, 114 * 4.5, 5 * 4.5 + 1.5, 2 * 4.5 }, /* 58*/ { BARCODE_CODABLOCKF, -1, -1, -1, 0, 0, "1234567890123456", "", 0, 30, 3, 101, 242, 64, 0 /*set_row*/, 64, 42, 2 }, /* With no scaling */ /* 59*/ { BARCODE_CODABLOCKF, -1, -1, -1, 0, 0.5, "1234567890123456", "", 0, 30, 3, 101, 242 * 0.5, 64 * 0.5, 0 /*set_row*/, 64 * 0.5, 42 * 0.5, 2 * 0.5 }, /* 60*/ { BARCODE_CODABLOCKF, -1, -1, -1, 34, 0.5, "1234567890123456", "", 0, 33, 3, 101, 242 * 0.5, 35, 0 /*set_row*/, 35, 42 * 0.5, 2 * 0.5 }, /* Height specified */ @@ -1295,28 +1295,36 @@ static void test_scale(const testCtx *const p_ctx) { length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, data[i].output_options, text, -1, debug); ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); - assert_nonzero(ret < ZINT_ERROR, "i:%d ZBarcode_Encode(%d) ret %d >= ZINT_ERROR (%s)\n", i, data[i].symbology, ret, symbol->errtxt); + assert_nonzero(ret < ZINT_ERROR, "i:%d ZBarcode_Encode(%s) ret %d >= ZINT_ERROR (%s)\n", + i, testUtilBarcodeName(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); + assert_equal(ret, data[i].ret_raster, "i:%d ZBarcode_Buffer(%s) ret %d != %d (%s)\n", + i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret_raster, symbol->errtxt); + assert_nonnull(symbol->bitmap, "i:%d (%s) symbol->bitmap NULL\n", i, testUtilBarcodeName(data[i].symbology)); if (p_ctx->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); + assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n", + i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); + assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", + i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); + assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", + i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); + assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%s) symbol->bitmap_width %d != %d\n", + i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_bitmap_width); + assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%s) symbol->bitmap_height %d != %d\n", + i, testUtilBarcodeName(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_equal(ret, data[i].ret_raster, "i:%d ZBarcode_Print(%s) ret %d != %d (%s)\n", + i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret_raster, symbol->errtxt); assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%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); + assert_nonzero(symbol->bitmap_height >= data[i].expected_set_rows, "i:%d (%s) symbol->bitmap_height %d < expected_set_rows %d\n", + i, testUtilBarcodeName(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 (%s) expected_set_rows %d <= expected_set_row %d\n", + i, testUtilBarcodeName(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++) { @@ -1324,7 +1332,8 @@ static void test_scale(const testCtx *const p_ctx) { bits_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); + assert_equal(bits_set, data[i].expected_set_len, "i:%d (%s) row %d,%d bits_set %d != expected_set_len %d\n", + i, testUtilBarcodeName(data[i].symbology), row, data[i].expected_set_col, bits_set, data[i].expected_set_len); } ZBarcode_Delete(symbol); } @@ -1425,10 +1434,10 @@ static void test_guard_descent(const testCtx *const p_ctx) { 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(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%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); + assert_nonzero(symbol->bitmap_height >= data[i].expected_set_rows, "i:%d (%s) symbol->bitmap_height %d < expected_set_rows %d\n", + i, testUtilBarcodeName(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 (%s) expected_set_rows %d < expected_set_row %d\n", + i, testUtilBarcodeName(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++) { @@ -1669,8 +1678,8 @@ static void test_quiet_zones(const testCtx *const p_ctx) { /*191*/ { BARCODE_DAFT, -1, -1, -1, -1, "FADT", "", 0, 8, 3, 7, 14, 16, 1 /*set*/, 0, 16, 0, 2 }, /*192*/ { BARCODE_DAFT, BARCODE_QUIET_ZONES, -1, -1, -1, "FADT", "", 0, 8, 3, 7, 14, 16, 1 /*set*/, 0, 16, 0, 2 }, /*193*/ { BARCODE_DAFT, BARCODE_NO_QUIET_ZONES, -1, -1, -1, "FADT", "", 0, 8, 3, 7, 14, 16, 1 /*set*/, 0, 16, 0, 2 }, - /*194*/ { BARCODE_DPD, -1, -1, -1, -1, "1234567890123456789012345678", "", 0, 50, 1, 189, 378, 128, 1 /*set*/, 0, 100, 0, 4 }, - /*195*/ { BARCODE_DPD, BARCODE_QUIET_ZONES, -1, -1, -1, "1234567890123456789012345678", "", 0, 50, 1, 189, 428, 128, 0 /*set*/, 0, 100, 0, 24 }, + /*194*/ { BARCODE_DPD, -1, -1, -1, -1, "1234567890123456789012345678", "", 0, 50, 1, 189, 378, 122, 1 /*set*/, 0, 100, 0, 4 }, + /*195*/ { BARCODE_DPD, BARCODE_QUIET_ZONES, -1, -1, -1, "1234567890123456789012345678", "", 0, 50, 1, 189, 428, 122, 0 /*set*/, 0, 100, 0, 24 }, /*196*/ { BARCODE_MICROQR, -1, -1, -1, -1, "1234", "", 0, 11, 11, 11, 22, 22, 1 /*set*/, 0, 14, 0, 2 }, /*197*/ { BARCODE_MICROQR, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 11, 11, 11, 30, 30, 0 /*set*/, 0, 30, 0, 4 }, /*198*/ { BARCODE_HIBC_128, -1, -1, -1, -1, "1234", "", 0, 50, 1, 90, 180, 116, 1 /*set*/, 0, 100, 0, 4 }, @@ -1894,58 +1903,64 @@ static void test_text_gap(const testCtx *const p_ctx) { }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { BARCODE_CODE11, -1, -1, -1, 0, 0, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 104, 105, 55, 6 }, /* Default */ - /* 1*/ { BARCODE_CODE11, -1, -1, -1, 0, 0, "1234", "", 0, 50, 1, 62, 124, 116, 0 /*set*/, 103, 104, 0, 124 }, /* Default */ - /* 2*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 0, "1234", "", 0, 50, 1, 62, 124, 114, 1 /*set*/, 102, 103, 55, 6 }, - /* 3*/ { BARCODE_CODE11, -1, -1, -1, 0.4, 0, "1234", "", 0, 50, 1, 62, 124, 114, 1 /*set*/, 102, 103, 55, 6 }, - /* 4*/ { BARCODE_CODE11, -1, -1, -1, 0.5, 0, "1234", "", 0, 50, 1, 62, 124, 115, 1 /*set*/, 103, 104, 55, 6 }, - /* 5*/ { BARCODE_CODE11, -1, -1, -1, 0.5, 0, "1234", "", 0, 50, 1, 62, 124, 115, 0 /*set*/, 102, 103, 0, 124 }, - /* 6*/ { BARCODE_CODE11, -1, -1, -1, 0.6, 0, "1234", "", 0, 50, 1, 62, 124, 115, 1 /*set*/, 103, 104, 55, 6 }, - /* 7*/ { BARCODE_CODE11, -1, -1, -1, 1.0, 0, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 104, 105, 55, 6 }, /* Same as default */ - /* 8*/ { BARCODE_CODE11, -1, -1, -1, 1.0, 0, "1234", "", 0, 50, 1, 62, 124, 116, 0 /*set*/, 103, 104, 0, 124 }, /* Same as default */ - /* 9*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 0, "1234", "", 0, 50, 1, 62, 124, 117, 1 /*set*/, 105, 106, 55, 6 }, - /* 10*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 0, "1234", "", 0, 50, 1, 62, 124, 117, 0 /*set*/, 104, 105, 0, 124 }, - /* 11*/ { BARCODE_CODE11, -1, -1, -1, 2.0, 0, "1234", "", 0, 50, 1, 62, 124, 118, 1 /*set*/, 106, 107, 55, 6 }, - /* 12*/ { BARCODE_CODE11, -1, -1, -1, 2.0, 0, "1234", "", 0, 50, 1, 62, 124, 118, 0 /*set*/, 105, 106, 0, 124 }, - /* 13*/ { BARCODE_CODE11, -1, -1, -1, 3.0, 0, "1234", "", 0, 50, 1, 62, 124, 120, 1 /*set*/, 108, 109, 55, 6 }, - /* 14*/ { BARCODE_CODE11, -1, -1, -1, 3.0, 0, "1234", "", 0, 50, 1, 62, 124, 120, 0 /*set*/, 107, 108, 0, 124 }, - /* 15*/ { BARCODE_CODE11, -1, -1, -1, 4.0, 0, "1234", "", 0, 50, 1, 62, 124, 122, 1 /*set*/, 110, 111, 55, 6 }, - /* 16*/ { BARCODE_CODE11, -1, -1, -1, 4.0, 0, "1234", "", 0, 50, 1, 62, 124, 122, 0 /*set*/, 109, 110, 0, 124 }, - /* 17*/ { BARCODE_CODE11, -1, -1, -1, 5.0, 0, "1234", "", 0, 50, 1, 62, 124, 124, 1 /*set*/, 112, 113, 55, 6 }, - /* 18*/ { BARCODE_CODE11, -1, -1, -1, 5.0, 0, "1234", "", 0, 50, 1, 62, 124, 124, 0 /*set*/, 111, 112, 0, 124 }, - /* 19*/ { BARCODE_CODE11, -1, -1, -1, 0, 3.0, "1234", "", 0, 50, 1, 62, 372, 348, 1 /*set*/, 312, 315, 165, 18 }, /* Scale default */ - /* 20*/ { BARCODE_CODE11, -1, -1, -1, 0, 3.0, "1234", "", 0, 50, 1, 62, 372, 348, 0 /*set*/, 311, 312, 0, 372 }, /* Scale default */ - /* 21*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 3.0, "1234", "", 0, 50, 1, 62, 372, 351, 1 /*set*/, 315, 318, 165, 18 }, /* Scale */ - /* 22*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 3.0, "1234", "", 0, 50, 1, 62, 372, 351, 0 /*set*/, 314, 315, 0, 372 }, /* Scale */ - /* 23*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 1 /*set*/, 102, 104, 81, 9 }, /* Default */ - /* 24*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 0 /*set*/, 101, 102, 38, 72 }, /* Default */ - /* 25*/ { BARCODE_UPCA, -1, -1, -1, 0.5, 0, "01457130763", "", 0, 50, 1, 95, 226, 115, 1 /*set*/, 101, 103, 81, 9 }, - /* 26*/ { BARCODE_UPCA, -1, -1, -1, 0.75, 0, "01457130763", "", 0, 50, 1, 95, 226, 115, 1 /*set*/, 101, 103, 81, 9 }, - /* 27*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 1 /*set*/, 102, 104, 81, 9 }, /* Same as default */ - /* 28*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 0 /*set*/, 101, 102, 38, 72 }, /* Same as default */ - /* 29*/ { BARCODE_UPCA, -1, -1, -1, 2.0, 0, "01457130763", "", 0, 50, 1, 95, 226, 118, 1 /*set*/, 104, 106, 81, 9 }, - /* 30*/ { BARCODE_UPCA, -1, -1, -1, 2.0, 2.5, "01457130763", "", 0, 50, 1, 95, 565, 295, 1 /*set*/, 260, 265, 201, 22 }, /* Scale */ - /* 31*/ { BARCODE_UPCA, -1, -1, -1, 2.0, 2.5, "01457130763", "", 0, 50, 1, 95, 565, 295, 0 /*set*/, 259, 260, 95, 180 }, /* Scale */ - /* 32*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 0 /*set*/, 14, 16, 208, 68 }, /* Default */ - /* 33*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 1 /*set*/, 16, 100, 244, 4 }, /* Default */ - /* 34*/ { BARCODE_UPCA, -1, -1, -1, 0.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 115, 0 /*set*/, 14, 15, 208, 68 }, - /* 35*/ { BARCODE_UPCA, -1, -1, -1, 0.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 115, 1 /*set*/, 16, 100, 244, 4 }, - /* 36*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 0 /*set*/, 14, 16, 208, 68 }, /* Same as default */ - /* 37*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 1 /*set*/, 16, 100, 244, 4 }, /* Same as default */ - /* 38*/ { BARCODE_UPCA, -1, -1, -1, 1.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117, 0 /*set*/, 14, 17, 208, 68 }, - /* 39*/ { BARCODE_UPCA, -1, -1, -1, 1.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117, 1 /*set*/, 17, 100, 244, 4 }, - /* 40*/ { BARCODE_UPCA, -1, -1, -1, 2.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 119, 0 /*set*/, 14, 19, 208, 68 }, - /* 41*/ { BARCODE_UPCA, -1, -1, -1, 2.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 119, 1 /*set*/, 19, 100, 244, 4 }, - /* 42*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 0 /*set*/, 38, 40, 208, 68 }, /* Default */ - /* 43*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 1 /*set*/, 40, 100, 258, 4 }, /* Default */ - /* 44*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 0 /*set*/, 38, 40, 208, 68 }, /* Same as default */ - /* 45*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 1 /*set*/, 40, 100, 258, 4 }, - /* 46*/ { BARCODE_UPCA_CC, -1, -1, -1, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 120, 0 /*set*/, 38, 44, 208, 68 }, - /* 47*/ { BARCODE_UPCA_CC, -1, -1, -1, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 120, 1 /*set*/, 44, 100, 258, 4 }, - /* 48*/ { BARCODE_UPCA_CC, -1, -1, 0, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 0 /*set*/, 38, 40, 208, 68 }, /* Hide text default */ - /* 49*/ { BARCODE_UPCA_CC, -1, -1, 0, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 1 /*set*/, 40, 100, 258, 4 }, /* Hide text default */ - /* 50*/ { BARCODE_UPCA_CC, -1, -1, 0, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 0 /*set*/, 38, 44, 208, 68 }, /* Hide text */ - /* 51*/ { BARCODE_UPCA_CC, -1, -1, 0, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 1 /*set*/, 44, 100, 258, 4 }, /* Hide text */ + /* 0*/ { BARCODE_CODE11, -1, -1, -1, 1, 0, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 104, 105, 55, 6 }, /* Default */ + /* 1*/ { BARCODE_CODE11, -1, -1, -1, 1, 0, "1234", "", 0, 50, 1, 62, 124, 116, 0 /*set*/, 103, 104, 0, 124 }, /* Default */ + /* 2*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 0, "1234", "", 0, 50, 1, 62, 124, 115, 1 /*set*/, 102, 103, 55, 6 }, + /* 3*/ { BARCODE_CODE11, -1, -1, -1, 0.3, 0, "1234", "", 0, 50, 1, 62, 124, 115, 1 /*set*/, 102, 103, 55, 6 }, + /* 4*/ { BARCODE_CODE11, -1, -1, -1, 0.4, 0, "1234", "", 0, 50, 1, 62, 124, 115, 1 /*set*/, 102, 103, 55, 6 }, + /* 5*/ { BARCODE_CODE11, -1, -1, -1, 0.5, 0, "1234", "", 0, 50, 1, 62, 124, 115, 1 /*set*/, 103, 104, 55, 6 }, + /* 6*/ { BARCODE_CODE11, -1, -1, -1, 0.5, 0, "1234", "", 0, 50, 1, 62, 124, 115, 0 /*set*/, 102, 103, 0, 124 }, + /* 7*/ { BARCODE_CODE11, -1, -1, -1, 0.6, 0, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 103, 104, 55, 6 }, + /* 8*/ { BARCODE_CODE11, -1, -1, -1, 0.9, 0, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 103, 104, 55, 6 }, + /* 9*/ { BARCODE_CODE11, -1, -1, -1, 0.9, 0, "1234", "", 0, 50, 1, 62, 124, 116, 0 /*set*/, 102, 103, 0, 124 }, + /* 10*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 0, "1234", "", 0, 50, 1, 62, 124, 117, 1 /*set*/, 105, 106, 55, 6 }, + /* 11*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 0, "1234", "", 0, 50, 1, 62, 124, 117, 0 /*set*/, 104, 105, 0, 124 }, + /* 12*/ { BARCODE_CODE11, -1, -1, -1, 2.0, 0, "1234", "", 0, 50, 1, 62, 124, 118, 1 /*set*/, 106, 107, 55, 6 }, + /* 13*/ { BARCODE_CODE11, -1, -1, -1, 2.0, 0, "1234", "", 0, 50, 1, 62, 124, 118, 0 /*set*/, 105, 106, 0, 124 }, + /* 14*/ { BARCODE_CODE11, -1, -1, -1, 3.0, 0, "1234", "", 0, 50, 1, 62, 124, 120, 1 /*set*/, 108, 109, 55, 6 }, + /* 15*/ { BARCODE_CODE11, -1, -1, -1, 3.0, 0, "1234", "", 0, 50, 1, 62, 124, 120, 0 /*set*/, 107, 108, 0, 124 }, + /* 16*/ { BARCODE_CODE11, -1, -1, -1, 4.0, 0, "1234", "", 0, 50, 1, 62, 124, 122, 1 /*set*/, 110, 111, 55, 6 }, + /* 17*/ { BARCODE_CODE11, -1, -1, -1, 4.0, 0, "1234", "", 0, 50, 1, 62, 124, 122, 0 /*set*/, 109, 110, 0, 124 }, + /* 18*/ { BARCODE_CODE11, -1, -1, -1, 5.0, 0, "1234", "", 0, 50, 1, 62, 124, 124, 1 /*set*/, 112, 113, 55, 6 }, + /* 19*/ { BARCODE_CODE11, -1, -1, -1, 5.0, 0, "1234", "", 0, 50, 1, 62, 124, 124, 0 /*set*/, 111, 112, 0, 124 }, + /* 20*/ { BARCODE_CODE11, -1, -1, -1, 10.0, 0, "1234", "", 0, 50, 1, 62, 124, 134, 1 /*set*/, 122, 123, 55, 6 }, + /* 21*/ { BARCODE_CODE11, -1, -1, -1, 10.0, 0, "1234", "", 0, 50, 1, 62, 124, 134, 0 /*set*/, 121, 122, 0, 124 }, + /* 22*/ { BARCODE_CODE11, -1, -1, -1, -1.0, 0, "1234", "", 0, 50, 1, 62, 124, 112, 1 /*set*/, 100, 101, 55, 6 }, + /* 23*/ { BARCODE_CODE11, -1, -1, -1, -0.5, 0, "1234", "", 0, 50, 1, 62, 124, 113, 1 /*set*/, 101, 102, 55, 6 }, + /* 24*/ { BARCODE_CODE11, -1, -1, -1, -0.5, 0, "1234", "", 0, 50, 1, 62, 124, 113, 0 /*set*/, 100, 101, 0, 124 }, + /* 25*/ { BARCODE_CODE11, -1, -1, -1, 1, 3.0, "1234", "", 0, 50, 1, 62, 372, 348, 1 /*set*/, 312, 315, 165, 18 }, /* Scale default */ + /* 26*/ { BARCODE_CODE11, -1, -1, -1, 1, 3.0, "1234", "", 0, 50, 1, 62, 372, 348, 0 /*set*/, 311, 312, 0, 372 }, /* Scale default */ + /* 27*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 3.0, "1234", "", 0, 50, 1, 62, 372, 351, 1 /*set*/, 315, 318, 165, 18 }, /* Scale */ + /* 28*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 3.0, "1234", "", 0, 50, 1, 62, 372, 351, 0 /*set*/, 314, 315, 0, 372 }, /* Scale */ + /* 29*/ { BARCODE_UPCA, -1, -1, -1, 1, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 1 /*set*/, 102, 104, 82, 9 }, /* Default */ + /* 30*/ { BARCODE_UPCA, -1, -1, -1, 1, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 0 /*set*/, 101, 102, 38, 72 }, /* Default */ + /* 31*/ { BARCODE_UPCA, -1, -1, -1, 0.5, 0, "01457130763", "", 0, 50, 1, 95, 226, 115, 1 /*set*/, 101, 103, 82, 9 }, + /* 32*/ { BARCODE_UPCA, -1, -1, -1, 0.75, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 1 /*set*/, 101, 103, 82, 9 }, + /* 33*/ { BARCODE_UPCA, -1, -1, -1, 0.9, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 1 /*set*/, 101, 103, 82, 9 }, + /* 34*/ { BARCODE_UPCA, -1, -1, -1, 0.9, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 0 /*set*/, 100, 101, 38, 72 }, + /* 35*/ { BARCODE_UPCA, -1, -1, -1, 2.0, 0, "01457130763", "", 0, 50, 1, 95, 226, 118, 1 /*set*/, 104, 106, 82, 9 }, + /* 36*/ { BARCODE_UPCA, -1, -1, -1, 2.0, 2.5, "01457130763", "", 0, 50, 1, 95, 565, 295, 1 /*set*/, 260, 265, 206, 22 }, /* Scale */ + /* 37*/ { BARCODE_UPCA, -1, -1, -1, 2.0, 2.5, "01457130763", "", 0, 50, 1, 95, 565, 295, 0 /*set*/, 259, 260, 95, 180 }, /* Scale */ + /* 38*/ { BARCODE_UPCA, -1, -1, -1, 1, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 0 /*set*/, 14, 16, 208, 68 }, /* Default */ + /* 39*/ { BARCODE_UPCA, -1, -1, -1, 1, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 1 /*set*/, 16, 100, 244, 4 }, /* Default */ + /* 40*/ { BARCODE_UPCA, -1, -1, -1, 0.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 115, 0 /*set*/, 14, 15, 208, 68 }, + /* 41*/ { BARCODE_UPCA, -1, -1, -1, 0.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 115, 1 /*set*/, 16, 100, 244, 4 }, + /* 42*/ { BARCODE_UPCA, -1, -1, -1, 0.9, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 0 /*set*/, 14, 16, 208, 68 }, + /* 43*/ { BARCODE_UPCA, -1, -1, -1, 0.9, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 1 /*set*/, 16, 100, 244, 4 }, + /* 44*/ { BARCODE_UPCA, -1, -1, -1, 1.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117, 0 /*set*/, 14, 17, 208, 68 }, + /* 45*/ { BARCODE_UPCA, -1, -1, -1, 1.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117, 1 /*set*/, 17, 100, 244, 4 }, + /* 46*/ { BARCODE_UPCA, -1, -1, -1, 2.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 119, 0 /*set*/, 14, 19, 208, 68 }, + /* 47*/ { BARCODE_UPCA, -1, -1, -1, 2.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 119, 1 /*set*/, 19, 100, 244, 4 }, + /* 48*/ { BARCODE_UPCA_CC, -1, -1, -1, 1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 0 /*set*/, 38, 40, 208, 68 }, /* Default */ + /* 49*/ { BARCODE_UPCA_CC, -1, -1, -1, 1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 1 /*set*/, 40, 100, 258, 4 }, /* Default */ + /* 50*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 0 /*set*/, 38, 40, 208, 68 }, /* Same as default */ + /* 51*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 1 /*set*/, 40, 100, 258, 4 }, + /* 52*/ { BARCODE_UPCA_CC, -1, -1, -1, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 120, 0 /*set*/, 38, 44, 208, 68 }, + /* 53*/ { BARCODE_UPCA_CC, -1, -1, -1, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 120, 1 /*set*/, 44, 100, 258, 4 }, + /* 54*/ { BARCODE_UPCA_CC, -1, -1, 0, 1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 0 /*set*/, 38, 40, 208, 68 }, /* Hide text default */ + /* 55*/ { BARCODE_UPCA_CC, -1, -1, 0, 1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 1 /*set*/, 40, 100, 258, 4 }, /* Hide text default */ + /* 56*/ { BARCODE_UPCA_CC, -1, -1, 0, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 0 /*set*/, 38, 44, 208, 68 }, /* Hide text */ + /* 57*/ { BARCODE_UPCA_CC, -1, -1, 0, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 1 /*set*/, 44, 100, 258, 4 }, /* Hide text */ }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1998,13 +2013,13 @@ static void test_text_gap(const testCtx *const p_ctx) { assert_equal(ret, data[i].ret, "i:%d ZBarcode_Print(%d) ret %d != %d (%s)\n", i, data[i].symbology, ret, data[i].ret, symbol->errtxt); assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%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); + assert_nonzero(symbol->bitmap_height >= data[i].expected_set_rows, "i:%d (%s) symbol->bitmap_height %d < expected_set_rows %d\n", + i, testUtilBarcodeName(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 (%s) expected_set_rows %d < expected_set_row %d\n", + i, testUtilBarcodeName(data[i].symbology), data[i].expected_set_rows, data[i].expected_set_row); assert_nonzero(symbol->bitmap_width >= data[i].expected_set_col + data[i].expected_set_len, - "i:%d (%d) symbol->bitmap_width %d < expected_set_col %d + expected_set_len %d\n", - i, data[i].symbology, symbol->bitmap_width, data[i].expected_set_col, data[i].expected_set_len); + "i:%d (%s) symbol->bitmap_width %d < expected_set_col %d + expected_set_len %d\n", + i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_set_col, data[i].expected_set_len); 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++) { @@ -2013,7 +2028,8 @@ static void test_text_gap(const testCtx *const p_ctx) { } } 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); + assert_equal(bits_set, data[i].expected_set_len, "i:%d (%s) row %d,%d bits_set %d != expected_set_len %d\n", + i, testUtilBarcodeName(data[i].symbology), row, data[i].expected_set_col, 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); } @@ -2587,10 +2603,10 @@ static void test_height(const testCtx *const p_ctx) { /*348*/ { BARCODE_DAFT, -1, 12, "DAFTDAFTDAFTDAFT", "", 0, 12, 3, 31, 62, 24, "" }, /*349*/ { BARCODE_DAFT, -1, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" }, /*350*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" }, - /*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 14, "" }, - /*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 136, "" }, - /*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 136, "" }, - /*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 137, "" }, + /*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 8, "" }, + /*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 130, "" }, + /*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 130, "" }, + /*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 131, "" }, /*355*/ { BARCODE_MICROQR, -1, 1, "12345", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" }, /*356*/ { BARCODE_HIBC_128, -1, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" }, /*357*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" }, @@ -2624,8 +2640,8 @@ static void test_height(const testCtx *const p_ctx) { /*385*/ { BARCODE_MAILMARK_2D, -1, 1, "012100123412345678AB19XY1A 0", "", 0, 24, 24, 24, 48, 48, "Fixed width-to-height ratio, symbol->height ignored" }, /*386*/ { BARCODE_UPU_S10, -1, 1, "EE876543216CA", "", 0, 1, 1, 156, 312, 2, "" }, /*387*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 1, "EE876543216CA", "", ZINT_WARN_NONCOMPLIANT, 1, 1, 156, 312, 2, "" }, - /*388*/ { BARCODE_UPU_S10, -1, 24.5f, "EE876543216CA", "", 0, 24.5f, 1, 156, 312, 49, "" }, - /*389*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 24.5f, "EE876543216CA", "", ZINT_WARN_NONCOMPLIANT, 24.5f, 1, 156, 312, 49, "" }, + /*388*/ { BARCODE_UPU_S10, -1, 24.5, "EE876543216CA", "", 0, 24.5, 1, 156, 312, 49, "" }, + /*389*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 24.5, "EE876543216CA", "", ZINT_WARN_NONCOMPLIANT, 24.5, 1, 156, 312, 49, "" }, /*390*/ { BARCODE_UPU_S10, -1, 25, "EE876543216CA", "", 0, 25, 1, 156, 312, 50, "" }, /*391*/ { BARCODE_UPU_S10, COMPLIANT_HEIGHT, 25, "EE876543216CA", "", 0, 25, 1, 156, 312, 50, "" }, /*392*/ { BARCODE_MAILMARK_4S, -1, -1, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, diff --git a/backend/tests/test_svg.c b/backend/tests/test_svg.c index 8deec5b3..523d42c9 100644 --- a/backend/tests/test_svg.c +++ b/backend/tests/test_svg.c @@ -119,24 +119,26 @@ static void test_print(const testCtx *const p_ctx) { /* 59*/ { BARCODE_EANX_CC, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3_gws.svg", "" }, /* 60*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5.svg", "" }, /* 61*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5_gws.svg", "" }, - /* 62*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12", "", 0, "ean2.svg", "" }, - /* 63*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12", "", 0, "ean2_gws.svg", "" }, - /* 64*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "123", "", 0, "code39_small.svg", "" }, - /* 65*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "postnet_zip.svg", "" }, - /* 66*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_box2.svg", "" }, - /* 67*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.svg", "" }, - /* 68*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "121212DD", "EEEEEE22", 90, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_fgbg_rotate_90.svg", "" }, - /* 69*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_vwsp1_bind1_dotty.svg", "" }, - /* 70*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_hvwsp1_bind1_dotty.svg", "" }, - /* 71*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345678909", "", 0, "dbar_ltd.svg", "" }, - /* 72*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, "", "", 0, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.svg", "" }, - /* 73*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, "", "", 0, "12345678901234567890", "", 0, "imail_height7.75.svg", "" }, - /* 74*/ { BARCODE_ULTRA, -1, 3, BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "FF0000", "0000FF", 0, "12345678901234567890", "", 0, "ultra_fgbg_hvwsp2_box3.svg", "" }, - /* 75*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0.4, "", "", 180, "A", "", 0, "telepen_height0.4_rotate_180.svg", "" }, - /* 76*/ { BARCODE_CODE49, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "FF11157F", "", 0, "A", "", 0, "code49_comph_fgalpha.svg", "" }, - /* 77*/ { BARCODE_CODABLOCKF, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 2, 0, "00000033", "FFFFFF66", 0, "1234567890123456789012345678901234", "", 0, "codablockf_comph_sep2_fgbgalpha.svg", "" }, - /* 78*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "008182709980000020028101276", "", 0, "dpd_compliant.svg", "" }, - /* 79*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "100,85,0,20", "FFFFFF00", 0, "123", "", 0, "channel_cmyk_nobg.svg", "" }, + /* 62*/ { BARCODE_EANX, -1, 2, BARCODE_BIND, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5_bind2.svg", "" }, + /* 63*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12", "", 0, "ean2.svg", "" }, + /* 64*/ { BARCODE_EANX, -1, -1, EANUPC_GUARD_WHITESPACE, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12", "", 0, "ean2_gws.svg", "" }, + /* 65*/ { BARCODE_EANX, -1, 1, BARCODE_BOX, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12", "", 0, "ean2_box1.svg", "" }, + /* 66*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "123", "", 0, "code39_small.svg", "" }, + /* 67*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "postnet_zip.svg", "" }, + /* 68*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_box2.svg", "" }, + /* 69*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.svg", "" }, + /* 70*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "121212DD", "EEEEEE22", 90, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_fgbg_rotate_90.svg", "" }, + /* 71*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_vwsp1_bind1_dotty.svg", "" }, + /* 72*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_hvwsp1_bind1_dotty.svg", "" }, + /* 73*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345678909", "", 0, "dbar_ltd.svg", "" }, + /* 74*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, "", "", 0, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.svg", "" }, + /* 75*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, "", "", 0, "12345678901234567890", "", 0, "imail_height7.75.svg", "" }, + /* 76*/ { BARCODE_ULTRA, -1, 3, BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "FF0000", "0000FF", 0, "12345678901234567890", "", 0, "ultra_fgbg_hvwsp2_box3.svg", "" }, + /* 77*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0.4, "", "", 180, "A", "", 0, "telepen_height0.4_rotate_180.svg", "" }, + /* 78*/ { BARCODE_CODE49, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "FF11157F", "", 0, "A", "", 0, "code49_comph_fgalpha.svg", "" }, + /* 79*/ { BARCODE_CODABLOCKF, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 2, 0, "00000033", "FFFFFF66", 0, "1234567890123456789012345678901234", "", 0, "codablockf_comph_sep2_fgbgalpha.svg", "" }, + /* 80*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "008182709980000020028101276", "", 0, "dpd_compliant.svg", "" }, + /* 81*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "100,85,0,20", "FFFFFF00", 0, "123", "", 0, "channel_cmyk_nobg.svg", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -216,11 +218,12 @@ static void test_print(const testCtx *const p_ctx) { assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); if (p_ctx->generate) { - printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.8g, \"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.8g, \"%s\", \"%s\", %d, \"%s\", \"%s\", %s, \"%s\", \"%s\" },\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].option_3, data[i].height, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle, - testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file, data[i].comment); + testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, + testUtilErrorName(data[i].ret), data[i].expected_file, data[i].comment); ret = testUtilRename(symbol->outfile, expected_file); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); if (have_libreoffice) { diff --git a/backend/tests/test_vector.c b/backend/tests/test_vector.c index 2159d30c..9ad6365a 100644 --- a/backend/tests/test_vector.c +++ b/backend/tests/test_vector.c @@ -167,7 +167,7 @@ static int check_vector_strings(const struct zint_symbol *symbol, char errmsg[12 return 0; } } - if (is_extendable(symbol->symbology)) { + if ((ZBarcode_Cap(symbol->symbology, ZINT_CAP_EANUPC) & ZINT_CAP_EANUPC) == ZINT_CAP_EANUPC) { const unsigned char *addon = (const unsigned char *) strchr((const char *) symbol->text, '+'); const int has_addon = addon != NULL; const int text_len = has_addon ? (int) (addon - symbol->text) : (int) ustrlen(symbol->text); @@ -640,7 +640,7 @@ static void test_buffer_vector(const testCtx *const p_ctx) { /* 86*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 }, /* 87*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 }, /* 88*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 }, - /* 89*/ { BARCODE_DPD, "0123456789012345678901234567", "", 50, 1, 189, 378, 128.28 }, + /* 89*/ { BARCODE_DPD, "0123456789012345678901234567", "", 50, 1, 189, 378, 122.28 }, /* 90*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 }, /* 91*/ { BARCODE_HIBC_128, "1234567890", "", 50, 1, 123, 246, 116.28 }, /* 92*/ { BARCODE_HIBC_39, "1234567890", "", 50, 1, 223, 446, 116.28 }, @@ -1029,14 +1029,14 @@ static void test_upcean_hrt(const testCtx *const p_ctx) { assert_nonnull(symbol->vector->strings, "i:%d (%s) vector->strings NULL\n", i, testUtilBarcodeName(data[i].symbology)); string = find_string(symbol, data[i].expected_string_x, data[i].expected_string_y); - assert_nonnull(string, "i:%d (%s) find_string(%g, %g) NULL\n", + assert_nonnull(string, "i:%d (%s) find_string(%.9g, %.9g) NULL\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_string_x, data[i].expected_string_y); if (data[i].expected_string2_x != -1) { assert_nonnull(symbol->vector->strings->next, "i:%d (%s) vector->strings->next NULL\n", i, testUtilBarcodeName(data[i].symbology)); string = find_string(symbol, data[i].expected_string2_x, data[i].expected_string2_y); - assert_nonnull(string, "i:%d (%s) find_string(%g, %g) NULL\n", + assert_nonnull(string, "i:%d (%s) find_string(%.9g, %.9g) NULL\n", i, testUtilBarcodeName(data[i].symbology), data[i].expected_string2_x, data[i].expected_string2_y); } } else { @@ -1675,8 +1675,9 @@ static void test_guard_descent(const testCtx *const p_ctx) { 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); + assert_nonnull(rect, "i:%d (%s) find_rect(%.9g, %.9g, %.9g, %.9g) NULL\n", + i, testUtilBarcodeName(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); @@ -1903,8 +1904,8 @@ static void test_quiet_zones(const testCtx *const p_ctx) { /*190*/ { BARCODE_DAFT, -1, -1, -1, -1, "FADT", "", 0, 8, 3, 7, 14, 16, 0, 0, 2, 16 }, /*191*/ { BARCODE_DAFT, BARCODE_QUIET_ZONES, -1, -1, -1, "FADT", "", 0, 8, 3, 7, 14, 16, 0, 0, 2, 16 }, /*192*/ { BARCODE_DAFT, BARCODE_NO_QUIET_ZONES, -1, -1, -1, "FADT", "", 0, 8, 3, 7, 14, 16, 0, 0, 2, 16 }, - /*193*/ { BARCODE_DPD, -1, -1, -1, -1, "1234567890123456789012345678", "", 0, 50, 1, 189, 378, 128.28, 0, 6, 4, 100 }, - /*194*/ { BARCODE_DPD, BARCODE_QUIET_ZONES, -1, -1, -1, "1234567890123456789012345678", "", 0, 50, 1, 189, 428, 128.28, 25, 6, 4, 100 }, + /*193*/ { BARCODE_DPD, -1, -1, -1, -1, "1234567890123456789012345678", "", 0, 50, 1, 189, 378, 122.28, 0, 6, 4, 100 }, + /*194*/ { BARCODE_DPD, BARCODE_QUIET_ZONES, -1, -1, -1, "1234567890123456789012345678", "", 0, 50, 1, 189, 428, 122.28, 25, 6, 4, 100 }, /*195*/ { BARCODE_MICROQR, -1, -1, -1, -1, "1234", "", 0, 11, 11, 11, 22, 22, 0, 0, 14, 2 }, /*196*/ { BARCODE_MICROQR, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 11, 11, 11, 30, 30, 4, 4, 14, 2 }, /*197*/ { BARCODE_HIBC_128, -1, -1, -1, -1, "1234", "", 0, 50, 1, 90, 180, 116.28, 0, 0, 4, 100 }, @@ -2065,12 +2066,14 @@ static void test_quiet_zones(const testCtx *const p_ctx) { if (symbol->symbology == BARCODE_MAXICODE || symbol->symbology == BARCODE_DOTCODE) { circle = find_circle(symbol, data[i].expected_set_x, data[i].expected_set_y, data[i].expected_set_width); - assert_nonnull(circle, "i:%d (%d) find_circle(%g, %g, %g) NULL\n", - i, data[i].symbology, data[i].expected_set_x, data[i].expected_set_y, data[i].expected_set_width); + assert_nonnull(circle, "i:%d (%s) find_circle(%.9g, %.9g, %.9g) NULL\n", + i, testUtilBarcodeName(data[i].symbology), data[i].expected_set_x, + data[i].expected_set_y, data[i].expected_set_width); } else { 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); + assert_nonnull(rect, "i:%d (%s) find_rect(%.9g, %.9g, %.9g, %.9g) NULL\n", + i, testUtilBarcodeName(data[i].symbology), data[i].expected_set_x, + data[i].expected_set_y, data[i].expected_set_width, data[i].expected_set_height); } } @@ -2106,18 +2109,18 @@ static void test_text_gap(const testCtx *const p_ctx) { }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { BARCODE_CODE11, -1, -1, -1, 0, 0, "1234", "", 0, 50, 1, 62, 124, 116.28, 62.0, 113.3444, -1, -1 }, /* Default */ - /* 1*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 0, "1234", "", 0, 50, 1, 62, 124, 114.479996, 62.0, 111.5444, -1, -1 }, - /* 2*/ { BARCODE_CODE11, -1, -1, -1, 0.2, 0, "1234", "", 0, 50, 1, 62, 124, 114.68, 62.0, 111.7444, -1, -1 }, - /* 3*/ { BARCODE_CODE11, -1, -1, -1, 0.3, 0, "1234", "", 0, 50, 1, 62, 124, 114.88, 62.0, 111.9444, -1, -1 }, - /* 4*/ { BARCODE_CODE11, -1, -1, -1, 0.4, 0, "1234", "", 0, 50, 1, 62, 124, 115.08, 62.0, 112.1444, -1, -1 }, - /* 5*/ { BARCODE_CODE11, -1, -1, -1, 0.5, 0, "1234", "", 0, 50, 1, 62, 124, 115.28, 62.0, 112.3444, -1, -1 }, - /* 6*/ { BARCODE_CODE11, -1, -1, -1, 0.6, 0, "1234", "", 0, 50, 1, 62, 124, 115.479996, 62.0, 112.5444, -1, -1 }, - /* 7*/ { BARCODE_CODE11, -1, -1, -1, 0.7, 0, "1234", "", 0, 50, 1, 62, 124, 115.68, 62.0, 112.7444, -1, -1 }, - /* 8*/ { BARCODE_CODE11, -1, -1, -1, 0.75, 0, "1234", "", 0, 50, 1, 62, 124, 115.78, 62.0, 112.8444, -1, -1 }, - /* 9*/ { BARCODE_CODE11, -1, -1, -1, 0.8, 0, "1234", "", 0, 50, 1, 62, 124, 115.88, 62.0, 112.9444, -1, -1 }, - /* 10*/ { BARCODE_CODE11, -1, -1, -1, 0.9, 0, "1234", "", 0, 50, 1, 62, 124, 116.08, 62.0, 113.1444, -1, -1 }, - /* 11*/ { BARCODE_CODE11, -1, -1, -1, 1.0, 0, "1234", "", 0, 50, 1, 62, 124, 116.28, 62.0, 113.3444, -1, -1 }, /* Same as default */ + /* 0*/ { BARCODE_CODE11, -1, -1, -1, 1, 0, "1234", "", 0, 50, 1, 62, 124, 116.28, 62.0, 113.3444, -1, -1 }, /* Default */ + /* 1*/ { BARCODE_CODE11, -1, -1, -1, 0, 0, "1234", "", 0, 50, 1, 62, 124, 114.28, 62.0, 111.3444, -1, -1 }, + /* 2*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 0, "1234", "", 0, 50, 1, 62, 124, 114.479996, 62.0, 111.5444, -1, -1 }, + /* 3*/ { BARCODE_CODE11, -1, -1, -1, 0.2, 0, "1234", "", 0, 50, 1, 62, 124, 114.68, 62.0, 111.7444, -1, -1 }, + /* 4*/ { BARCODE_CODE11, -1, -1, -1, 0.3, 0, "1234", "", 0, 50, 1, 62, 124, 114.88, 62.0, 111.9444, -1, -1 }, + /* 5*/ { BARCODE_CODE11, -1, -1, -1, 0.4, 0, "1234", "", 0, 50, 1, 62, 124, 115.08, 62.0, 112.1444, -1, -1 }, + /* 6*/ { BARCODE_CODE11, -1, -1, -1, 0.5, 0, "1234", "", 0, 50, 1, 62, 124, 115.28, 62.0, 112.3444, -1, -1 }, + /* 7*/ { BARCODE_CODE11, -1, -1, -1, 0.6, 0, "1234", "", 0, 50, 1, 62, 124, 115.479996, 62.0, 112.5444, -1, -1 }, + /* 8*/ { BARCODE_CODE11, -1, -1, -1, 0.7, 0, "1234", "", 0, 50, 1, 62, 124, 115.68, 62.0, 112.7444, -1, -1 }, + /* 9*/ { BARCODE_CODE11, -1, -1, -1, 0.75, 0, "1234", "", 0, 50, 1, 62, 124, 115.78, 62.0, 112.8444, -1, -1 }, + /* 10*/ { BARCODE_CODE11, -1, -1, -1, 0.8, 0, "1234", "", 0, 50, 1, 62, 124, 115.88, 62.0, 112.9444, -1, -1 }, + /* 11*/ { BARCODE_CODE11, -1, -1, -1, 0.9, 0, "1234", "", 0, 50, 1, 62, 124, 116.08, 62.0, 113.1444, -1, -1 }, /* 12*/ { BARCODE_CODE11, -1, -1, -1, 1.1, 0, "1234", "", 0, 50, 1, 62, 124, 116.479996, 62.0, 113.5444, -1, -1 }, /* 13*/ { BARCODE_CODE11, -1, -1, -1, 1.2, 0, "1234", "", 0, 50, 1, 62, 124, 116.68, 62.0, 113.7444, -1, -1 }, /* 14*/ { BARCODE_CODE11, -1, -1, -1, 1.3, 0, "1234", "", 0, 50, 1, 62, 124, 116.88, 62.0, 113.9444, -1, -1 }, @@ -2130,38 +2133,43 @@ static void test_text_gap(const testCtx *const p_ctx) { /* 21*/ { BARCODE_CODE11, -1, -1, -1, 4.0, 0, "1234", "", 0, 50, 1, 62, 124, 122.28, 62.0, 119.3444, -1, -1 }, /* 22*/ { BARCODE_CODE11, -1, -1, -1, 5.0, 0, "1234", "", 0, 50, 1, 62, 124, 124.28, 62.0, 121.3444, -1, -1 }, /* 23*/ { BARCODE_CODE11, -1, -1, -1, 10.0, 0, "1234", "", 0, 50, 1, 62, 124, 134.28, 62.0, 131.3444, -1, -1 }, - /* 24*/ { BARCODE_CODE11, -1, -1, -1, 0, 3.0, "1234", "", 0, 50, 1, 62, 372, 348.84, 186.0, 340.0332, -1, -1 }, /* Scale default */ - /* 25*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 3.0, "1234", "", 0, 50, 1, 62, 372, 343.44, 186.0, 334.6332, -1, -1 }, /* Scale */ - /* 26*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763", "", 0, 50, 1, 95, 226, 118, 74.0, 117.2, -1, -1 }, /* Default */ - /* 27*/ { BARCODE_UPCA, -1, -1, -1, 0.1, 0, "01457130763", "", 0, 50, 1, 95, 226, 116.2, 74.0, 115.4, -1, -1 }, - /* 28*/ { BARCODE_UPCA, -1, -1, -1, 0.6, 0, "01457130763", "", 0, 50, 1, 95, 226, 117.2, 74.0, 116.4, -1, -1 }, - /* 29*/ { BARCODE_UPCA, -1, -1, -1, 0.7, 0, "01457130763", "", 0, 50, 1, 95, 226, 117.4, 74.0, 116.6, -1, -1 }, - /* 30*/ { BARCODE_UPCA, -1, -1, -1, 0.75, 0, "01457130763", "", 0, 50, 1, 95, 226, 117.5, 74.0, 116.7, -1, -1 }, - /* 31*/ { BARCODE_UPCA, -1, -1, -1, 0.8, 0, "01457130763", "", 0, 50, 1, 95, 226, 117.6, 74.0, 116.8, -1, -1 }, - /* 32*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763", "", 0, 50, 1, 95, 226, 118, 74.0, 117.2, -1, -1 }, /* Same as default */ - /* 33*/ { BARCODE_UPCA, -1, -1, -1, 1.1, 0, "01457130763", "", 0, 50, 1, 95, 226, 118.2, 74.0, 117.4, -1, -1 }, - /* 34*/ { BARCODE_UPCA, -1, -1, -1, 1.6, 0, "01457130763", "", 0, 50, 1, 95, 226, 119.2, 74.0, 118.4, -1, -1 }, - /* 35*/ { BARCODE_UPCA, -1, -1, -1, 1.6, 2.5, "01457130763", "", 0, 50, 1, 95, 565, 298, 185.0, 296.0, -1, -1 }, /* Scale */ - /* 36*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 118, 74.0, 117.2, -1, -1 }, /* Default */ - /* 37*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 118, 230.0, 18, 4.0, 82 }, /* Default */ - /* 38*/ { BARCODE_UPCA, -1, -1, -1, 0.1, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116.2, 230.0, 16.2, 4.0, 83.8 }, - /* 39*/ { BARCODE_UPCA, -1, -1, -1, 0.6, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117.2, 230.0, 17.2, 4.0, 82.8 }, - /* 40*/ { BARCODE_UPCA, -1, -1, -1, 0.75, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117.5, 230.0, 17.5, 4.0, 82.5 }, - /* 41*/ { BARCODE_UPCA, -1, -1, -1, 0.9, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117.8, 230.0, 17.8, 4.0, 82.2 }, - /* 42*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 118, 74.0, 117.2, -1, -1 }, /* Same as default */ - /* 43*/ { BARCODE_UPCA, -1, -1, -1, 1.1, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 118.2, 74.0, 117.4, -1, -1 }, - /* 44*/ { BARCODE_UPCA, -1, -1, -1, 4.2, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 124.4, 230.0, 24.4, 4.0, 75.6 }, - /* 45*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 118, 74.0, 117.2, -1, -1 }, /* Default */ - /* 46*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116.2, 74.0, 115.4, -1, -1 }, - /* 47*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 118, 236.0, 42, 4.0, 58 }, /* Default */ - /* 48*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116.2, 236.0, 40.2, 4.0, 59.8 }, - /* 49*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.6, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 117.2, 236.0, 41.2, 4.0, 58.8 }, - /* 50*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.75, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 117.5, 236.0, 41.5, 4.0, 58.5 }, - /* 51*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 118, 236.0, 42, 4.0, 58 }, /* Same as default */ - /* 52*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 118.2, 236.0, 42.2, 4.0, 57.8 }, - /* 53*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.5, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 119.0, 236.0, 43.0, 4.0, 57.0 }, - /* 54*/ { BARCODE_UPCA_CC, -1, -1, 0, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 236.0, 42, 4.0, 58 }, /* Hide text default */ - /* 55*/ { BARCODE_UPCA_CC, -1, -1, 0, 1.5, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 236.0, 43.0, 4.0, 57.0 }, /* Hide text */ + /* 24*/ { BARCODE_CODE11, -1, -1, -1, -1.0, 0, "1234", "", 0, 50, 1, 62, 124, 112.28, 62.0, 109.344406, -1, -1 }, + /* 25*/ { BARCODE_CODE11, -1, -1, -1, -0.5, 0, "1234", "", 0, 50, 1, 62, 124, 113.28, 62.0, 110.344406, -1, -1 }, + /* 26*/ { BARCODE_CODE11, -1, -1, -1, 1, 3.0, "1234", "", 0, 50, 1, 62, 372, 348.84, 186.0, 340.0332, -1, -1 }, /* Scale default */ + /* 27*/ { BARCODE_CODE11, -1, -1, -1, 0, 3.0, "1234", "", 0, 50, 1, 62, 372, 342.84, 186.0, 334.0332, -1, -1 }, /* Scale */ + /* 28*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 3.0, "1234", "", 0, 50, 1, 62, 372, 343.44, 186.0, 334.6332, -1, -1 }, /* Scale */ + /* 29*/ { BARCODE_UPCA, -1, -1, -1, 1, 0, "01457130763", "", 0, 50, 1, 95, 226, 118, 74.0, 117.2, -1, -1 }, /* Default */ + /* 30*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 74.0, 115.2, -1, -1 }, + /* 31*/ { BARCODE_UPCA, -1, -1, -1, 0.1, 0, "01457130763", "", 0, 50, 1, 95, 226, 116.2, 74.0, 115.4, -1, -1 }, + /* 32*/ { BARCODE_UPCA, -1, -1, -1, 0.6, 0, "01457130763", "", 0, 50, 1, 95, 226, 117.2, 74.0, 116.4, -1, -1 }, + /* 33*/ { BARCODE_UPCA, -1, -1, -1, 0.7, 0, "01457130763", "", 0, 50, 1, 95, 226, 117.4, 74.0, 116.6, -1, -1 }, + /* 34*/ { BARCODE_UPCA, -1, -1, -1, 0.75, 0, "01457130763", "", 0, 50, 1, 95, 226, 117.5, 74.0, 116.7, -1, -1 }, + /* 35*/ { BARCODE_UPCA, -1, -1, -1, 0.8, 0, "01457130763", "", 0, 50, 1, 95, 226, 117.6, 74.0, 116.8, -1, -1 }, + /* 36*/ { BARCODE_UPCA, -1, -1, -1, 1.1, 0, "01457130763", "", 0, 50, 1, 95, 226, 118.2, 74.0, 117.4, -1, -1 }, + /* 37*/ { BARCODE_UPCA, -1, -1, -1, 1.6, 0, "01457130763", "", 0, 50, 1, 95, 226, 119.2, 74.0, 118.4, -1, -1 }, + /* 38*/ { BARCODE_UPCA, -1, -1, -1, 1.6, 2.5, "01457130763", "", 0, 50, 1, 95, 565, 298, 185.0, 296.0, -1, -1 }, /* Scale */ + /* 39*/ { BARCODE_UPCA, -1, -1, -1, 1, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 118, 74.0, 117.2, -1, -1 }, /* Default */ + /* 40*/ { BARCODE_UPCA, -1, -1, -1, 1, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 118, 230.0, 18, 4.0, 82 }, /* Default */ + /* 41*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 230.0, 16, 4.0, 84 }, + /* 42*/ { BARCODE_UPCA, -1, -1, -1, 0.1, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116.2, 230.0, 16.2, 4.0, 83.8 }, + /* 43*/ { BARCODE_UPCA, -1, -1, -1, 0.6, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117.2, 230.0, 17.2, 4.0, 82.8 }, + /* 44*/ { BARCODE_UPCA, -1, -1, -1, 0.75, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117.5, 230.0, 17.5, 4.0, 82.5 }, + /* 45*/ { BARCODE_UPCA, -1, -1, -1, 0.9, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117.8, 230.0, 17.8, 4.0, 82.2 }, + /* 46*/ { BARCODE_UPCA, -1, -1, -1, 1.1, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 118.2, 74.0, 117.4, -1, -1 }, + /* 47*/ { BARCODE_UPCA, -1, -1, -1, 4.2, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 124.4, 230.0, 24.4, 4.0, 75.6 }, + /* 48*/ { BARCODE_UPCA_CC, -1, -1, -1, 1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 118, 74.0, 117.2, -1, -1 }, /* Default */ + /* 49*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 74.0, 115.2, -1, -1 }, + /* 50*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116.2, 74.0, 115.4, -1, -1 }, + /* 51*/ { BARCODE_UPCA_CC, -1, -1, -1, 1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 118, 236.0, 42, 4.0, 58 }, /* Default */ + /* 52*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116, 236.0, 40, 4.0, 60 }, + /* 53*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 116.2, 236.0, 40.2, 4.0, 59.8 }, + /* 54*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.6, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 117.2, 236.0, 41.2, 4.0, 58.8 }, + /* 55*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.75, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 117.5, 236.0, 41.5, 4.0, 58.5 }, + /* 56*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 118.2, 236.0, 42.2, 4.0, 57.8 }, + /* 57*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.5, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 119.0, 236.0, 43.0, 4.0, 57.0 }, + /* 58*/ { BARCODE_UPCA_CC, -1, -1, 0, 1, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 236.0, 42, 4.0, 58 }, /* Hide text default */ + /* 59*/ { BARCODE_UPCA_CC, -1, -1, 0, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 236.0, 40, 4.0, 60 }, /* Hide text */ + /* 60*/ { BARCODE_UPCA_CC, -1, -1, 0, 1.5, 0, "01457130763+10", "[91]12", 0, 50, 7, 127, 276, 110, 236.0, 43.0, 4.0, 57.0 }, /* Hide text */ }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -2221,12 +2229,13 @@ static void test_text_gap(const testCtx *const p_ctx) { if (data[i].expected_set_width == -1.0f) { string = find_string(symbol, data[i].expected_set_x, data[i].expected_set_y); - assert_nonnull(string, "i:%d (%d) find_string(%g, %g) NULL\n", - i, data[i].symbology, data[i].expected_set_x, data[i].expected_set_y); + assert_nonnull(string, "i:%d (%s) find_string(%.9g, %.9g) NULL\n", + i, testUtilBarcodeName(data[i].symbology), data[i].expected_set_x, data[i].expected_set_y); } else { 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); + assert_nonnull(rect, "i:%d (%s) find_rect(%.9g, %.9g, %.9g, %.9g) NULL\n", + i, testUtilBarcodeName(data[i].symbology), data[i].expected_set_x, + data[i].expected_set_y, data[i].expected_set_width, data[i].expected_set_height); } } @@ -2607,10 +2616,10 @@ static void test_height(const testCtx *const p_ctx) { /*348*/ { BARCODE_DAFT, -1, 12, "DAFTDAFTDAFTDAFT", "", 0, 12, 3, 31, 62, 24, "" }, /*349*/ { BARCODE_DAFT, -1, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" }, /*350*/ { BARCODE_DAFT, COMPLIANT_HEIGHT, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" }, - /*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 14, "" }, - /*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 136, "" }, - /*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 136, "" }, - /*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 137, "" }, + /*351*/ { BARCODE_DPD, -1, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 8, "" }, + /*352*/ { BARCODE_DPD, -1, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 130, "" }, + /*353*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62, "0123456789012345678901234567", "", ZINT_WARN_NONCOMPLIANT, 62, 1, 189, 378, 130, "" }, + /*354*/ { BARCODE_DPD, COMPLIANT_HEIGHT, 62.5, "0123456789012345678901234567", "", 0, 62.5, 1, 189, 378, 131, "" }, /*355*/ { BARCODE_MICROQR, -1, 1, "12345", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" }, /*356*/ { BARCODE_HIBC_128, -1, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" }, /*357*/ { BARCODE_HIBC_128, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" }, diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index ad90ccab..2e914a5d 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -2579,10 +2579,10 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int int r, h; int parse = 0, parsefnc = p_parsefnc ? *p_parsefnc : 0; - int upcean = is_extendable(symbology); - int upca = symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC; - char obracket = symbol->input_mode & GS1PARENS_MODE ? '(' : '['; - char cbracket = symbol->input_mode & GS1PARENS_MODE ? ')' : ']'; + const int upcean = (ZBarcode_Cap(symbology, ZINT_CAP_EANUPC) & ZINT_CAP_EANUPC) == ZINT_CAP_EANUPC; + const int upca = symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC; + const char obracket = symbol->input_mode & GS1PARENS_MODE ? '(' : '['; + const char cbracket = symbol->input_mode & GS1PARENS_MODE ? ')' : ']'; int addon_posn; int eci; int i, j, len; @@ -3652,7 +3652,7 @@ static const char *testUtilZXingCPPName(int index, const struct zint_symbol *sym } return NULL; } - } else if (is_extendable(symbology)) { + } else if ((ZBarcode_Cap(symbology, ZINT_CAP_EANUPC) & ZINT_CAP_EANUPC) == ZINT_CAP_EANUPC) { if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) { if (length < 9) { if (length < 6) { @@ -3821,7 +3821,7 @@ int testUtilZXingCPPCmp(struct zint_symbol *symbol, char *msg, char *cmp_buf, in const int have_c25inter = (symbology == BARCODE_C25INTER && ((expected_len & 1) || have_c25checkdigit)) || symbology == BARCODE_ITF14 || symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT; - const int is_upcean = is_extendable(symbology); + const int is_upcean = (ZBarcode_Cap(symbology, ZINT_CAP_EANUPC) & ZINT_CAP_EANUPC) == ZINT_CAP_EANUPC; const int need_dpd_prefix = (symbology == BARCODE_DPD && expected_len == 27 && symbol->option_2 != 1); const int is_vin_international = symbology == BARCODE_VIN && (symbol->option_2 & 1); diff --git a/backend/vector.c b/backend/vector.c index 6f1944a8..c9d3eb56 100644 --- a/backend/vector.c +++ b/backend/vector.c @@ -385,13 +385,13 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ int comp_xoffset = 0; int comp_roffset = 0; unsigned char addon[6]; + int addon_len = 0; int addon_gap = 0; float addon_text_yposn = 0.0f; float xoffset, yoffset, roffset, boffset; float textoffset; int upceanflag = 0; int addon_latch = 0; - unsigned char textparts[4][7]; int hide_text; int i, r; int block_width = 0; @@ -404,6 +404,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ const int no_extend = is_codablockf || symbol->symbology == BARCODE_DPD; float large_bar_height; + int xoffset_comp; const float descent = 1.32779717f; /* Arimo value for normal text (font height 7) */ const float descent_small = 0.948426545f; /* Arimo value for SMALL_TEXT (font height 5) */ @@ -462,8 +463,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ comp_xoffset++; } } - if (is_extendable(symbol->symbology)) { - upceanflag = out_process_upcean(symbol, comp_xoffset, &main_width, addon, &addon_gap); + if (is_upcean(symbol->symbology)) { + upceanflag = out_process_upcean(symbol, comp_xoffset, &main_width, addon, &addon_len, &addon_gap); } else if (is_composite(symbol->symbology)) { int x; for (x = symbol->width - 1; x && !module_is_set(symbol, symbol->rows - 1, x); comp_roffset++, x--); @@ -472,42 +473,10 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0)); - out_set_whitespace_offsets(symbol, hide_text, comp_xoffset, &xoffset, &yoffset, &roffset, &boffset, 0 /*scaler*/, - NULL, NULL, NULL, NULL); + out_set_whitespace_offsets(symbol, hide_text, comp_xoffset, &xoffset, &yoffset, &roffset, &boffset, NULL, + 0 /*scaler*/, NULL, NULL, NULL, NULL, NULL); - /* Note font sizes scaled by 2 so really twice these values */ - if (upceanflag) { - /* Note BOLD_TEXT ignored for UPCEAN by svg/emf/ps/qzint */ - font_height = symbol->output_options & SMALL_TEXT ? 7 : 10; - digit_ascender = font_height * digit_ascender_factor; - antialias_fudge = font_height * antialias_fudge_factor; - /* Although font size 7 (for normal) seems small it meets GS1 General Spec (GGS) Section 5.2.5: - "the size of the first and last digits should be reduced to a maximum width equivalent to four modules" */ - upcae_outside_font_height = symbol->output_options & SMALL_TEXT ? 6 : 7; - /* Note default now 1.0 (GGS 5.2.5 "Normally the minimum is one module") but was 0.5 (absolute minimum) */ - text_gap = (symbol->text_gap ? symbol->text_gap : 1.0f) - digit_ascender; - /* Guard bar height (none for EAN-2 and EAN-5) */ - guard_descent = upceanflag >= 6 ? symbol->guard_descent : 0.0f; - } else { - font_height = symbol->output_options & SMALL_TEXT ? 5 : 7; - antialias_fudge = font_height * antialias_fudge_factor; - text_gap = symbol->text_gap ? symbol->text_gap : 1.0f; - guard_descent = 0.0f; - } - - if (hide_text) { - textoffset = guard_descent; - } else { - if (upceanflag) { - /* Add fudge for anti-aliasing of digit bottoms */ - textoffset = font_height + text_gap + antialias_fudge; - if (textoffset < guard_descent) { - textoffset = guard_descent; - } - } else { - textoffset = font_height + stripf(text_gap + antialias_fudge); - } - } + xoffset_comp = xoffset + comp_xoffset; if ((symbol->symbology != BARCODE_MAXICODE) && (symbol->output_options & BARCODE_DOTTY_MODE)) { if (symbol->dot_size < 1.0f) { @@ -521,6 +490,38 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ } vector->width = symbol->width + dot_overspill + (xoffset + roffset); + + /* Note font sizes scaled by 2 so really twice these values */ + if (upceanflag) { + /* Note BOLD_TEXT ignored for UPCEAN by svg/emf/ps/qzint */ + font_height = symbol->output_options & SMALL_TEXT ? 7 : 10; + digit_ascender = font_height * digit_ascender_factor; + antialias_fudge = font_height * antialias_fudge_factor; + /* Although font size 7 (for normal) seems small it meets GS1 General Spec (GGS) Section 5.2.5: + "the size of the first and last digits should be reduced to a maximum width equivalent to four modules" */ + upcae_outside_font_height = symbol->output_options & SMALL_TEXT ? 6 : 7; + /* Note default now 1.0 (GGS 5.2.5 "Normally the minimum is one module") but was 0.5 (absolute minimum) */ + text_gap = symbol->text_gap - digit_ascender; + /* Guard bar height (none for EAN-2 and EAN-5) */ + guard_descent = upceanflag >= 6 ? symbol->guard_descent : 0.0f; + } else { + font_height = symbol->output_options & SMALL_TEXT ? 5 : 7; + antialias_fudge = font_height * antialias_fudge_factor; + text_gap = symbol->text_gap; + guard_descent = 0.0f; + } + + if (hide_text) { + textoffset = guard_descent; + } else { + textoffset = font_height + stripf(text_gap + antialias_fudge); + if (upceanflag) { + if (textoffset < guard_descent) { + textoffset = guard_descent; + } + } + } + vector->height = symbol->height + textoffset + dot_overspill + (yoffset + boffset); /* Plot Maxicode symbols */ @@ -734,54 +735,35 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ /* Add the text */ if (!hide_text) { - float text_xposn; - float text_yposn; float textwidth; - text_yposn = yoffset + symbol->height + font_height + text_gap; /* Calculated to bottom of text */ - if (upceanflag) { /* Allow for anti-aliasing if UPC/EAN */ - if (upceanflag >= 6) { - text_yposn -= antialias_fudge; - } else { /* EAN-2/5 */ - text_yposn = yoffset + font_height - digit_ascender; - if (text_yposn < 0.0f) { - text_yposn = 0.0f; - } - } - } else { /* Else adjust to baseline */ - text_yposn -= symbol->output_options & SMALL_TEXT ? descent_small : descent; - } - if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) { - text_yposn += symbol->border_width; /* Note not needed for BARCODE_BIND_TOP */ - } - if (upceanflag >= 6) { /* UPC-E, EAN-8, UPC-A, EAN-13 */ - const int addon_len = (int) ustrlen(addon); - xoffset += comp_xoffset; /* Hacky shortcut - restored at end */ - - out_upcean_split_text(upceanflag, symbol->text, textparts); + float text_yposn = yoffset + symbol->height + font_height + text_gap - antialias_fudge; /* Baseline */ + if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) { + text_yposn += symbol->border_width; /* Note not needed for BARCODE_BIND_TOP */ + } if (upceanflag == 6) { /* UPC-E */ - text_xposn = -(5.0f - 0.35f) + xoffset; + float text_xposn = -(5.0f - 0.35f) + xoffset_comp; textwidth = 6.2f; - if (!vector_add_string(symbol, textparts[0], 1, text_xposn, text_yposn, upcae_outside_font_height, + if (!vector_add_string(symbol, symbol->text, 1, text_xposn, text_yposn, upcae_outside_font_height, textwidth, 2 /*right align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = (24.0f + 0.5f) + xoffset; + text_xposn = (24.0f + 0.5f) + xoffset_comp; textwidth = 6.0f * 8.5f; - if (!vector_add_string(symbol, textparts[1], 6, text_xposn, text_yposn, font_height, textwidth, + if (!vector_add_string(symbol, symbol->text + 1, 6, text_xposn, text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = (51.0f - 0.35f) + 3.0f + xoffset; + text_xposn = (51.0f - 0.35f) + 3.0f + xoffset_comp; textwidth = 6.2f; - if (!vector_add_string(symbol, textparts[2], 1, text_xposn, text_yposn, upcae_outside_font_height, + if (!vector_add_string(symbol, symbol->text + 7, 1, text_xposn, text_yposn, upcae_outside_font_height, textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; if (addon_len) { - text_xposn = (addon_len == 2 ? 61.0f : 75.0f) + xoffset + addon_gap; + text_xposn = (addon_len == 2 ? 61.0f : 75.0f) + xoffset_comp + addon_gap; textwidth = addon_len * 8.5f; if (!vector_add_string(symbol, addon, addon_len, text_xposn, addon_text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; if (upcean_guard_whitespace) { - text_xposn = (addon_len == 2 ? 70.0f : 97.0f) - 0.2f + xoffset + addon_gap; + text_xposn = (addon_len == 2 ? 70.0f : 97.0f) - 0.2f + xoffset_comp + addon_gap; textwidth = 8.5f; if (!vector_add_string(symbol, (const unsigned char *) ">", 1, text_xposn, addon_text_yposn, font_height, textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; @@ -789,60 +771,63 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ } } else if (upceanflag == 8) { /* EAN-8 */ + float text_xposn; if (upcean_guard_whitespace) { - text_xposn = -0.75f + xoffset; + text_xposn = -0.75f + xoffset_comp; textwidth = 8.5f; if (!vector_add_string(symbol, (const unsigned char *) "<", 1, text_xposn, text_yposn, font_height, textwidth, 2 /*right align*/, &last_string)) return ZINT_ERROR_MEMORY; } - text_xposn = (17.0f + 0.5f) + xoffset; + text_xposn = (17.0f + 0.5f) + xoffset_comp; textwidth = 4.0f * 8.5f; - if (!vector_add_string(symbol, textparts[0], 4, text_xposn, text_yposn, font_height, textwidth, + if (!vector_add_string(symbol, symbol->text, 4, text_xposn, text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = (50.0f - 0.5f) + xoffset; - if (!vector_add_string(symbol, textparts[1], 4, text_xposn, text_yposn, font_height, textwidth, + text_xposn = (50.0f - 0.5f) + xoffset_comp; + if (!vector_add_string(symbol, symbol->text + 4, 4, text_xposn, text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; if (addon_len) { - text_xposn = (addon_len == 2 ? 77.0f : 91.0f) + xoffset + addon_gap; + text_xposn = (addon_len == 2 ? 77.0f : 91.0f) + xoffset_comp + addon_gap; textwidth = addon_len * 8.5f; if (!vector_add_string(symbol, addon, addon_len, text_xposn, addon_text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; if (upcean_guard_whitespace) { - text_xposn = (addon_len == 2 ? 86.0f : 113.0f) - 0.2f + xoffset + addon_gap; + text_xposn = (addon_len == 2 ? 86.0f : 113.0f) - 0.2f + xoffset_comp + addon_gap; textwidth = 8.5f; if (!vector_add_string(symbol, (const unsigned char *) ">", 1, text_xposn, addon_text_yposn, font_height, textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; } } else if (upcean_guard_whitespace) { - text_xposn = (68.0f - 0.2f) + xoffset; + text_xposn = (68.0f - 0.2f) + xoffset_comp; textwidth = 8.5f; if (!vector_add_string(symbol, (const unsigned char *) ">", 1, text_xposn, text_yposn, font_height, textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; } } else if (upceanflag == 12) { /* UPC-A */ - text_xposn = -(5.0f - 0.35f) + xoffset; + float text_xposn = -(5.0f - 0.35f) + xoffset_comp; textwidth = 6.2f; - if (!vector_add_string(symbol, textparts[0], 1, text_xposn, text_yposn, upcae_outside_font_height, + if (!vector_add_string(symbol, symbol->text, 1, text_xposn, text_yposn, upcae_outside_font_height, textwidth, 2 /*right align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = (27.0f + 1.0f) + xoffset; + text_xposn = 28.0f + xoffset_comp; textwidth = 5.0f * 8.5f; - if (!vector_add_string(symbol, textparts[1], 5, text_xposn, text_yposn, font_height, textwidth, + if (!vector_add_string(symbol, symbol->text + 1, 5, text_xposn, text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = 67.0f + xoffset; - if (!vector_add_string(symbol, textparts[2], 5, text_xposn, text_yposn, font_height, textwidth, - 0 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = (95.0f - 0.35f) + 5.0f + xoffset; + text_xposn = 67.0f + xoffset_comp; + if (!vector_add_string(symbol, symbol->text + 6, 5, text_xposn, text_yposn, font_height, textwidth, + 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; + text_xposn = (95.0f - 0.35f) + 5.0f + xoffset_comp; textwidth = 6.2f; - if (!vector_add_string(symbol, textparts[3], 1, text_xposn, text_yposn, upcae_outside_font_height, - textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; + if (!vector_add_string(symbol, symbol->text + 11, 1, text_xposn, text_yposn, + upcae_outside_font_height, textwidth, 1 /*left align*/, &last_string)) { + return ZINT_ERROR_MEMORY; + } if (addon_len) { - text_xposn = (addon_len == 2 ? 105.0f : 119.0f) + xoffset + addon_gap; + text_xposn = (addon_len == 2 ? 105.0f : 119.0f) + xoffset_comp + addon_gap; textwidth = addon_len * 8.5f; if (!vector_add_string(symbol, addon, addon_len, text_xposn, addon_text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; if (upcean_guard_whitespace) { - text_xposn = (addon_len == 2 ? 114.0f : 141.0f) - 0.2f + xoffset + addon_gap; + text_xposn = (addon_len == 2 ? 114.0f : 141.0f) - 0.2f + xoffset_comp + addon_gap; textwidth = 8.5f; if (!vector_add_string(symbol, (const unsigned char *) ">", 1, text_xposn, addon_text_yposn, font_height, textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; @@ -850,42 +835,48 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ } } else { /* EAN-13 */ - text_xposn = -(5.0f - 0.1f) + xoffset; + float text_xposn = -(5.0f - 0.1f) + xoffset_comp; textwidth = 8.5f; - if (!vector_add_string(symbol, textparts[0], 1, text_xposn, text_yposn, font_height, textwidth, + if (!vector_add_string(symbol, symbol->text, 1, text_xposn, text_yposn, font_height, textwidth, 2 /*right align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = (24.0f + 0.5f) + xoffset; + text_xposn = (24.0f + 0.5f) + xoffset_comp; textwidth = 6.0f * 8.5f; - if (!vector_add_string(symbol, textparts[1], 6, text_xposn, text_yposn, font_height, textwidth, + if (!vector_add_string(symbol, symbol->text + 1, 6, text_xposn, text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = (71.0f - 0.5f) + xoffset; - if (!vector_add_string(symbol, textparts[2], 6, text_xposn, text_yposn, font_height, textwidth, + text_xposn = (71.0f - 0.5f) + xoffset_comp; + if (!vector_add_string(symbol, symbol->text + 7, 6, text_xposn, text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; if (addon_len) { - text_xposn = (addon_len == 2 ? 105.0f : 119.0f) + xoffset + addon_gap; + text_xposn = (addon_len == 2 ? 105.0f : 119.0f) + xoffset_comp + addon_gap; textwidth = addon_len * 8.5f; if (!vector_add_string(symbol, addon, addon_len, text_xposn, addon_text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; if (upcean_guard_whitespace) { - text_xposn = (addon_len == 2 ? 114.0f : 141.0f) + xoffset + addon_gap; + text_xposn = (addon_len == 2 ? 114.0f : 141.0f) + xoffset_comp + addon_gap; textwidth = 8.5f; if (!vector_add_string(symbol, (const unsigned char *) ">", 1, text_xposn, addon_text_yposn, font_height, textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; } } else if (upcean_guard_whitespace) { - text_xposn = 96.0f + xoffset; + text_xposn = 96.0f + xoffset_comp; textwidth = 8.5f; if (!vector_add_string(symbol, (const unsigned char *) ">", 1, text_xposn, text_yposn, font_height, textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; } } - xoffset -= comp_xoffset; /* Restore xoffset */ - } else if (upceanflag) { /* EAN-2, EAN-5 (standalone add-ons) */ - const int addon_len = (int) ustrlen(symbol->text); /* Put at top (and centered) */ - text_xposn = main_width / 2.0f + xoffset; + float text_xposn = main_width / 2.0f + xoffset; + float text_yposn = yoffset + font_height - digit_ascender; + if (symbol->border_width > 0 + && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND | BARCODE_BIND_TOP))) { + text_yposn -= symbol->border_width; + } + if (text_yposn < 0.0f) { + text_yposn = 0.0f; + } + addon_len = (int) ustrlen(symbol->text); textwidth = addon_len * 8.5f; if (!vector_add_string(symbol, symbol->text, addon_len, text_xposn, text_yposn, font_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; @@ -898,7 +889,12 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ } else { /* Put normal human readable text at the bottom (and centered) */ - text_xposn = main_width / 2.0f + xoffset + comp_xoffset; + float text_xposn = main_width / 2.0f + xoffset_comp; + float text_yposn = yoffset + symbol->height + font_height + text_gap; /* Calculated to bottom of text */ + text_yposn -= symbol->output_options & SMALL_TEXT ? descent_small : descent; + if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) { + text_yposn += symbol->border_width; /* Note not needed for BARCODE_BIND_TOP */ + } if (!vector_add_string(symbol, symbol->text, -1, text_xposn, text_yposn, font_height, symbol->width, 0, &last_string)) return ZINT_ERROR_MEMORY; } @@ -958,6 +954,9 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ if (horz_outside) { ybind_top = 0; ybind_bot = vector->height - symbol->border_width; + } else if (upceanflag == 2 || upceanflag == 5) { + ybind_top += textoffset; + ybind_bot += textoffset; } /* Top */ if (!vector_add_rect(symbol, 0.0f, ybind_top, vector->width, symbol->border_width, &last_rect)) @@ -985,6 +984,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ if (horz_outside) { box_top = symbol->border_width; box_height = vector->height - symbol->border_width * 2; + } else if (upceanflag == 2 || upceanflag == 5) { + box_top += textoffset; } /* Left */ if (!vector_add_rect(symbol, 0.0f, box_top, symbol->border_width, box_height, &last_rect)) diff --git a/backend/zint.h b/backend/zint.h index 5c45f676..6b61fabe 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -85,7 +85,7 @@ extern "C" { struct zint_vector_circle *circles; /* Pointer to first circle */ }; - /* Structured Append info - ignored unless `zint_structapp.count` is set to non-zero value */ + /* Structured Append info (see `symbol->structapp` below) - ignored unless `zint_structapp.count` is non-zero */ struct zint_structapp { int index; /* Position in Structured Append sequence, 1-based. Must be <= `count` */ int count; /* Number of symbols in Structured Append sequence. Set >= 2 to add SA Info */ @@ -115,12 +115,12 @@ extern "C" { int eci; /* Extended Channel Interpretation. Default 0 (none) */ float dpmm; /* Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none) */ float dot_size; /* Size of dots used in BARCODE_DOTTY_MODE. Default 0.8 */ - float text_gap; /* Gap between barcode and text (HRT). 0 means use default (font-specific) */ + float text_gap; /* Gap between barcode and text (HRT) in X-dimensions. Default 1 */ float guard_descent; /* Height in X-dimensions that EAN/UPC guard bars descend. Default 5 */ struct zint_structapp structapp; /* Structured Append info. Default structapp.count 0 (none) */ int warn_level; /* Affects error/warning value returned by Zint API (see WARN_XXX below) */ int debug; /* Debugging flags */ - unsigned char text[160]; /* Human Readable Text (HRT) (if any), UTF-8, NUL-terminated (output only) */ + unsigned char text[200]; /* Human Readable Text (HRT) (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) */ unsigned char encoded_data[200][144]; /* Encoded data (output only). Allows for rows of 1152 modules */ @@ -319,7 +319,7 @@ extern "C" { #define ULTRA_COMPRESSION 128 /* Enable Ultracode compression (experimental) */ /* Warning and error conditions (API return values) */ -#define ZINT_WARN_HRT_TRUNCATED 1 /* Human Readable Text was truncated (max 159 bytes) */ +#define ZINT_WARN_HRT_TRUNCATED 1 /* Human Readable Text was truncated (max 199 bytes) */ #define ZINT_WARN_INVALID_OPTION 2 /* Invalid option given but overridden by Zint */ #define ZINT_WARN_USES_ECI 3 /* Automatic ECI inserted by Zint */ #define ZINT_WARN_NONCOMPLIANT 4 /* Symbol created not compliant with standards */ @@ -343,7 +343,8 @@ extern "C" { /* Capability flags (ZBarcode_Cap() `cap_flag`) */ #define ZINT_CAP_HRT 0x0001 /* Prints Human Readable Text? */ #define ZINT_CAP_STACKABLE 0x0002 /* Is stackable? */ -#define ZINT_CAP_EXTENDABLE 0x0004 /* Is extendable with add-on data? (Is EAN/UPC?) */ +#define ZINT_CAP_EANUPC 0x0004 /* Is EAN/UPC? */ +#define ZINT_CAP_EXTENDABLE 0x0004 /* Legacy */ #define ZINT_CAP_COMPOSITE 0x0008 /* Can have composite data? */ #define ZINT_CAP_ECI 0x0010 /* Supports Extended Channel Interpretations? */ #define ZINT_CAP_GS1 0x0020 /* Supports GS1 data? */ diff --git a/backend_qt/qzint.cpp b/backend_qt/qzint.cpp index d16801e4..7c4d79fe 100644 --- a/backend_qt/qzint.cpp +++ b/backend_qt/qzint.cpp @@ -175,7 +175,7 @@ namespace Zint { m_scale(1.0f), m_dotty(false), m_dot_size(4.0f / 5.0f), m_guardDescent(5.0f), - m_textGap(0.0f), + m_textGap(1.0f), m_fgStr(QSL("000000")), m_bgStr(QSL("FFFFFF")), m_cmyk(false), m_borderType(0), m_borderWidth(0), m_whitespace(0), m_vwhitespace(0), @@ -615,7 +615,7 @@ namespace Zint { m_textGap = textGap; } - /* Show (true) or hide (false) Human Readable Text */ + /* Show (true) or hide (false) Human Readable Text (HRT) */ bool QZint::showText() const { return m_show_hrt; } @@ -817,8 +817,12 @@ namespace Zint { return ZBarcode_Cap(symbology ? symbology : m_symbol, ZINT_CAP_STACKABLE); } - bool QZint::isExtendable(int symbology) const { - return ZBarcode_Cap(symbology ? symbology : m_symbol, ZINT_CAP_EXTENDABLE); + bool QZint::isEANUPC(int symbology) const { + return ZBarcode_Cap(symbology ? symbology : m_symbol, ZINT_CAP_EANUPC); + } + + bool QZint::isExtendable(int symbology) const { /* Legacy - same as `isEANUPC()` */ + return ZBarcode_Cap(symbology ? symbology : m_symbol, ZINT_CAP_EANUPC); } bool QZint::isComposite(int symbology) const { @@ -1115,8 +1119,8 @@ namespace Zint { QPen p; p.setColor(fgColor); painter.setPen(p); - bool bold = (m_zintSymbol->output_options & BOLD_TEXT) && !isExtendable(); - QFont font(isExtendable() ? upceanFontFamily : normalFontFamily, -1 /*pointSize*/, + bool bold = (m_zintSymbol->output_options & BOLD_TEXT) && !isEANUPC(); + QFont font(isEANUPC() ? upceanFontFamily : normalFontFamily, -1 /*pointSize*/, bold ? QFont::Bold : -1); while (string) { font.setPixelSize(string->fsize); @@ -1223,7 +1227,7 @@ namespace Zint { arg_int(cmd, longOptOnly ? "--barcode=" : "-b ", m_symbol); } - if (isExtendable()) { + if (isEANUPC()) { arg_int(cmd, "--addongap=", option2()); } @@ -1254,7 +1258,7 @@ namespace Zint { if (!default_bind_top) { arg_bool(cmd, "--bindtop", borderType() & BARCODE_BIND_TOP); } - arg_bool(cmd, "--bold", !notext && (fontSetting() & BOLD_TEXT) && !isExtendable()); + arg_bool(cmd, "--bold", !notext && (fontSetting() & BOLD_TEXT) && !isEANUPC()); if (!default_border) { arg_int(cmd, "--border=", borderWidth()); } @@ -1317,10 +1321,10 @@ namespace Zint { arg_bool(cmd, "--gssep", gsSep()); } - if (isExtendable() && guardDescent() != 5.0f) { + if (isEANUPC() && guardDescent() != 5.0f) { arg_float(cmd, "--guarddescent=", guardDescent(), true /*allowZero*/); } - if (isExtendable() && showText()) { + if (isEANUPC() && showText()) { arg_bool(cmd, "--guardwhitespace", guardWhitespace()); } @@ -1396,7 +1400,7 @@ namespace Zint { arg_structapp(cmd, "--structapp=", structAppCount(), structAppIndex(), structAppID(), win); } - if (!notext && textGap() != 0.0f) { + if (!notext && textGap() != 1.0f) { arg_float(cmd, "--textgap=", textGap(), true /*allowZero*/); } diff --git a/backend_qt/qzint.h b/backend_qt/qzint.h index a4eb06b4..20e4f0d8 100644 --- a/backend_qt/qzint.h +++ b/backend_qt/qzint.h @@ -169,7 +169,7 @@ public: float textGap() const; // `symbol->text_gap` void setTextGap(float textGap); - /* Show (true) or hide (false) Human Readable Text */ + /* Show (true) or hide (false) Human Readable Text (HRT) */ bool showText() const; // `symbol->show_hrt` void setShowText(bool showText); @@ -252,7 +252,8 @@ public: /* Test capabilities - `ZBarcode_Cap()` */ bool hasHRT(int symbology = 0) const; bool isStackable(int symbology = 0) const; - bool isExtendable(int symbology = 0) const; + bool isEANUPC(int symbology = 0) const; + bool isExtendable(int symbology = 0) const; /* Legacy - same as `isEANUPC()` */ bool isComposite(int symbology = 0) const; bool supportsECI(int symbology = 0) const; bool supportsGS1(int symbology = 0) const; diff --git a/backend_qt/tests/test_qzint.cpp b/backend_qt/tests/test_qzint.cpp index 580f64da..eb6e2b85 100644 --- a/backend_qt/tests/test_qzint.cpp +++ b/backend_qt/tests/test_qzint.cpp @@ -593,7 +593,7 @@ private slots: QTest::newRow("BARCODE_AUSPOST") << true << 0.0f << "" << BARCODE_AUSPOST << DATA_MODE // symbology-inputMode << "12345678" << "" // text-primary - << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -610,7 +610,7 @@ private slots: QTest::newRow("BARCODE_AZTEC") << false << 0.0f << "" << BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode << "12345678Ж0%var%" << "" // text-primary - << 0.0f << 1 << 0 << 0 << 4.0f << 0.0f << true << 0.9f << 0.0f // height-textGap + << 0.0f << 1 << 0 << 0 << 4.0f << 0.0f << true << 0.9f << 1.0f // height-textGap << 5.0f << 2 << 1 << "as\"dfa'sdf" // guardDescent-structAppID << "" << "" << QColor(Qt::blue) << QColor(Qt::white) << true // fgStr-cmyk << 0 << 0 << 2 << 3 << 0 // borderTypeIndex-fontSetting @@ -626,7 +626,7 @@ private slots: QTest::newRow("BARCODE_AZTEC (bgStr CMYK, fgStr CMYK)") << false << 0.0f << "" << BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode << "12345678Ж0%var%" << "" // text-primary - << 0.0f << 1 << 0 << 0 << 4.0f << 0.0f << true << 0.9f << 0.0f // height-textGap + << 0.0f << 1 << 0 << 0 << 4.0f << 0.0f << true << 0.9f << 1.0f // height-textGap << 5.0f << 2 << 1 << "as\"dfa'sdf" // guardDescent-structAppID << "71,0,40,44" << "0,0,0,0" << QColor(Qt::black) << QColor(Qt::white) << true // fgStr-cmyk << 0 << 0 << 2 << 3 << 0 // borderTypeIndex-fontSetting @@ -642,7 +642,7 @@ private slots: QTest::newRow("BARCODE_C25INTER") << true << 0.0f << "" << BARCODE_C25INTER << UNICODE_MODE // symbology-inputMode << "12345" << "" // text-primary - << 0.0f << -1 << 2 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 0.0f << -1 << 2 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << SMALL_TEXT // borderTypeIndex-fontSetting @@ -656,7 +656,7 @@ private slots: QTest::newRow("BARCODE_CHANNEL") << false << 0.0f << "" << BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode << "453678" << "" // text-primary - << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(255, 255, 255, 0) << false // fgStr-cmyk << 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting @@ -672,7 +672,7 @@ private slots: QTest::newRow("BARCODE_CHANNEL (bgStr FFFFFF00)") << false << 0.0f << "" << BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode << "453678" << "" // text-primary - << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "FFFFFF00" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting @@ -688,7 +688,7 @@ private slots: QTest::newRow("BARCODE_CHANNEL (bgStr 12345600)") << false << 0.0f << "" << BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode << "453678" << "" // text-primary - << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "12345600" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting @@ -704,7 +704,7 @@ private slots: QTest::newRow("BARCODE_CODE128") << false << 0.0f << "" << BARCODE_CODE128 << (UNICODE_MODE | EXTRA_ESCAPE_MODE) // symbology-inputMode << "1234\\^A56" << "" // text-primary - << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -718,7 +718,7 @@ private slots: QTest::newRow("BARCODE_GS1_128_CC") << false << 0.0f << "" << BARCODE_GS1_128_CC << UNICODE_MODE // symbology-inputMode << "[01]12345678901231[15]121212" << "[11]901222[99]ABCDE" // text-primary - << 71.142f << 3 << 0 << 0 << 3.5f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 71.142f << 3 << 0 << 0 << 3.5f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -734,7 +734,7 @@ private slots: QTest::newRow("BARCODE_CODE16K") << false << 11.7f << "" << BARCODE_CODE16K << (UNICODE_MODE | HEIGHTPERROW_MODE) // symbology-inputMode << "12345678901234567890123456789012" << "" // text-primary - << 0.0f << 4 << 0 << 2 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 0.0f << 4 << 0 << 2 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 1 << 1 << 0 << 0 << SMALL_TEXT // borderTypeIndex-fontSetting @@ -750,7 +750,7 @@ private slots: QTest::newRow("BARCODE_CODE49") << true << 0.0f << "" << BARCODE_CODE49 << UNICODE_MODE // symbology-inputMode << "12345678901234567890" << "" // text-primary - << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -764,7 +764,7 @@ private slots: QTest::newRow("BARCODE_CODABLOCKF") << true << 0.0f << "" << BARCODE_CODABLOCKF << (DATA_MODE | ESCAPE_MODE) // symbology-inputMode << "T\\n\\xA0t\\\"" << "" // text-primary - << 0.0f << 2 << 5 << 3 << 3.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 0.0f << 2 << 5 << 3 << 3.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 2 << 4 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -780,7 +780,7 @@ private slots: QTest::newRow("BARCODE_DAFT") << false << 0.0f << "" << BARCODE_DAFT << UNICODE_MODE // symbology-inputMode << "daft" << "" // text-primary - << 9.2f << -1 << 251 << 0 << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap + << 9.2f << -1 << 251 << 0 << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(0x30, 0x31, 0x32, 0x33) << QColor(0xBF, 0xBE, 0xBD, 0xBC) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -794,7 +794,7 @@ private slots: QTest::newRow("BARCODE_DATAMATRIX (GS1)") << true << 0.0f << "" << BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode << "[20]12" << "" // text-primary - << 0.0f << -1 << 0 << DM_SQUARE << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap + << 0.0f << -1 << 0 << DM_SQUARE << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -808,7 +808,7 @@ private slots: QTest::newRow("BARCODE_DATAMATRIX") << false << 0.0f << "" << BARCODE_DATAMATRIX << (DATA_MODE | ESCAPE_MODE | FAST_MODE) // symbology-inputMode << "ABCDEFGH\\x01I" << "" // text-primary - << 0.0f << -1 << 0 << DM_ISO_144 << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap + << 0.0f << -1 << 0 << DM_ISO_144 << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -822,7 +822,7 @@ private slots: QTest::newRow("BARCODE_DBAR_EXPSTK_CC") << false << 40.8f << "" << BARCODE_DBAR_EXPSTK_CC << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode << "[91]ABCDEFGHIJKL" << "[11]901222[99]ABCDE" // text-primary - << 0.0f << -1 << 0 << 2 << 1.0f << 0.0f << true << 0.9f << 0.0f // height-textGap + << 0.0f << -1 << 0 << 2 << 1.0f << 0.0f << true << 0.9f << 1.0f // height-textGap << 3.0f << 2 << 1 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -838,7 +838,7 @@ private slots: QTest::newRow("BARCODE_DOTCODE") << false << 1.0f << "" << BARCODE_DOTCODE << GS1_MODE // symbology-inputMode << "[20]01" << "" // text-primary - << 30.0f << -1 << 8 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap + << 30.0f << -1 << 8 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 0.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -852,7 +852,7 @@ private slots: QTest::newRow("BARCODE_DPD") << true << 0.0f << "" << BARCODE_DPD << UNICODE_MODE // symbology-inputMode << "1234567890123456789012345678" << "" // text-primary - << 0.0f << -1 << 0 << 0 << 4.5f << 24.0f << true << 0.8f << 0.0f // height-textGap + << 0.0f << -1 << 0 << 0 << 4.5f << 24.0f << true << 0.8f << 1.0f // height-textGap << 0.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -867,7 +867,7 @@ private slots: QTest::newRow("BARCODE_EANX") << true << 0.0f << "" << BARCODE_EANX << UNICODE_MODE // symbology-inputMode << "123456789012+12" << "" // text-primary - << 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f << 0.0f // height-textGap + << 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f << 1.0f // height-textGap << 0.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -881,7 +881,7 @@ private slots: QTest::newRow("BARCODE_EANX (guardWhitespace/embedVectorFont") << true << 0.0f << "" << BARCODE_EANX << UNICODE_MODE // symbology-inputMode << "123456789012+12" << "" // text-primary - << 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f << 0.0f // height-textGap + << 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f << 1.0f // height-textGap << 0.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -895,7 +895,7 @@ private slots: QTest::newRow("BARCODE_GRIDMATRIX") << false << 0.0f << "" << BARCODE_GRIDMATRIX << UNICODE_MODE // symbology-inputMode << "Your Data Here!" << "" // text-primary - << 0.0f << 1 << 5 << 0 << 0.5f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 0.0f << 1 << 5 << 0 << 0.5f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -909,7 +909,7 @@ private slots: QTest::newRow("BARCODE_HANXIN") << false << 0.0f << "" << BARCODE_HANXIN << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode << "éβÿ啊\\e\"'" << "" // text-primary - << 30.0f << 2 << 5 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 30.0f << 2 << 5 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -923,7 +923,7 @@ private slots: QTest::newRow("BARCODE_HIBC_DM") << false << 10.0f << "" << BARCODE_HIBC_DM << UNICODE_MODE // symbology-inputMode << "1234" << "" // text-primary - << 0.0f << -1 << 8 << DM_DMRE << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap + << 0.0f << -1 << 8 << DM_DMRE << 1.0f << 0.0f << false << 0.7f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -937,7 +937,7 @@ private slots: QTest::newRow("BARCODE_HIBC_PDF") << false << 0.0f << "" << BARCODE_HIBC_PDF << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode << "TEXT" << "" // text-primary - << 3.5f << 3 << 4 << 10 << 10.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 3.5f << 3 << 4 << 10 << 10.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 2 << 1 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -953,7 +953,7 @@ private slots: QTest::newRow("BARCODE_ITF14") << true << 0.0f << "" << BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode << "9212320967145" << "" // text-primary - << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -967,7 +967,7 @@ private slots: QTest::newRow("BARCODE_ITF14 (border)") << true << 0.0f << "" << BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode << "9212320967145" << "" // text-primary - << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 1 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -982,7 +982,7 @@ private slots: << BARCODE_MAXICODE << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode << "152382802840001" << "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G1 MAIN ST\\GTOWN\\GNY\\R\\E" // text-primary - << 0.0f << -1 << (96 + 1) << 0 << 2.5f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 0.0f << -1 << (96 + 1) << 0 << 2.5f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -998,7 +998,7 @@ private slots: QTest::newRow("BARCODE_MICROQR") << false << 0.0f << "" << BARCODE_MICROQR << UNICODE_MODE // symbology-inputMode << "1234" << "" // text-primary - << 30.0f << 2 << 3 << (ZINT_FULL_MULTIBYTE | (3 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 30.0f << 2 << 3 << (ZINT_FULL_MULTIBYTE | (3 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -1012,7 +1012,7 @@ private slots: QTest::newRow("BARCODE_QRCODE") << true << 0.0f << "" << BARCODE_QRCODE << GS1_MODE // symbology-inputMode << "(01)12" << "" // text-primary - << 0.0f << 1 << 5 << (ZINT_FULL_MULTIBYTE | (0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 0.0f << 1 << 5 << (ZINT_FULL_MULTIBYTE | (0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -1028,7 +1028,7 @@ private slots: QTest::newRow("BARCODE_RMQR") << true << 0.0f << "" << BARCODE_RMQR << UNICODE_MODE // symbology-inputMode << "テ" << "" // text-primary - << 30.0f << -1 << 8 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 30.0f << -1 << 8 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -1042,7 +1042,7 @@ private slots: QTest::newRow("BARCODE_ULTRA") << false << 0.0f << "" << BARCODE_ULTRA << (GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE) // symbology-inputMode << "(01)1" << "" // text-primary - << 0.0f << 6 << 2 << 0 << 1.0f << 0.0f << true << 0.8f << 0.0f // height-textGap + << 0.0f << 6 << 2 << 0 << 1.0f << 0.0f << true << 0.8f << 1.0f // height-textGap << 5.0f << 2 << 1 << "4" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -1056,7 +1056,7 @@ private slots: QTest::newRow("BARCODE_UPCE_CC") << true << 0.0f << "out.svg" << BARCODE_UPCE_CC << UNICODE_MODE // symbology-inputMode << "12345670+1234" << "[11]901222[99]ABCDE" // text-primary - << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap + << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 1.0f // height-textGap << 6.5f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(0xEF, 0x29, 0x29) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting diff --git a/docs/README b/docs/README index 6086c03f..ad68fd2b 100644 --- a/docs/README +++ b/docs/README @@ -2,8 +2,8 @@ For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" usin On Ubuntu/Debian (tested on Ubuntu 22.04) - wget https://github.com/jgm/pandoc/releases/download/3.1.5/pandoc-3.1.5-1-amd64.deb - sudo dpkg -i pandoc-3.1.5-1-amd64.deb + wget https://github.com/jgm/pandoc/releases/download/3.1.9/pandoc-3.1.9-1-amd64.deb + sudo dpkg -i pandoc-3.1.9-1-amd64.deb sudo apt install python3-pip pip install pandoc-tablenos --user export PATH=~/.local/bin:"$PATH" @@ -18,9 +18,9 @@ On Ubuntu/Debian (tested on Ubuntu 22.04) On Fedora (tested on Fedora Linux 38 (Workstation Edition)) - wget https://github.com/jgm/pandoc/releases/download/3.1.5/pandoc-3.1.5-linux-amd64.tar.gz - tar xf pandoc-3.1.5-linux-amd64.tar.gz - sudo mv -i pandoc-3.1.5/bin/pandoc /usr/local/bin + wget https://github.com/jgm/pandoc/releases/download/3.1.9/pandoc-3.1.9-linux-amd64.tar.gz + tar xf pandoc-3.1.9-linux-amd64.tar.gz + sudo mv -i pandoc-3.1.9/bin/pandoc /usr/local/bin sudo dnf install python3-pip pip install pandoc-tablenos --user export PATH=~/.local/bin:"$PATH" diff --git a/docs/images/dpd.svg b/docs/images/dpd.svg index 2353e4ee..ff06bbf2 100644 --- a/docs/images/dpd.svg +++ b/docs/images/dpd.svg @@ -1,9 +1,9 @@ - + Zint Generated Symbol - + 0003 932 0621 9912 3456 78 101 040 9 diff --git a/docs/images/gui_appearance.png b/docs/images/gui_appearance.png index ea17f694..5f609b06 100644 Binary files a/docs/images/gui_appearance.png and b/docs/images/gui_appearance.png differ diff --git a/docs/manual.html b/docs/manual.html index 9943b88d..5c99bd03 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -258,7 +258,7 @@ .display.math{display: block; text-align: center; margin: 0.5rem auto;} /* CSS for syntax highlighting */ pre > code.sourceCode { white-space: pre; position: relative; } - pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } + pre > code.sourceCode > span { line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } .sourceCode { overflow: visible; } code.sourceCode > span { color: inherit; text-decoration: inherit; } @@ -329,7 +329,7 @@

Zint Barcode Generator and Zint Barcode Studio User Manual

Version 2.12.0.9

-

July 2023

+

November 2023