diff --git a/backend/2of5.c b/backend/2of5.c index 21c00eb2..860b0ba8 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -142,13 +142,14 @@ INTERNAL int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[ return c25_common(symbol, source, length, 80, C25MatrixTable, C25IataLogicStartStop, 307); } -/* Code 2 of 5 Interleaved */ -INTERNAL int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) { - +/* Common to Interleaved, ITF-14, DP Leitcode, DP Identcode */ +static int c25inter_common(struct zint_symbol *symbol, unsigned char source[], int length, + const int dont_set_height) { int i, j, error_number; char bars[7], spaces[7], mixed[14], dest[512]; /* 4 + (90 + 2) * 5 + 3 + 1 = 468 */ unsigned char temp[90 + 2 + 1]; int have_checkdigit = symbol->option_2 == 1 || symbol->option_2 == 2; + float height; if (length > 90) { strcpy(symbol->errtxt, "309: Input too long"); @@ -209,12 +210,33 @@ INTERNAL int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char s symbol->text[length - 1] = '\0'; } + if (!dont_set_height) { +#ifdef COMPLIANT_HEIGHTS + /* ISO/IEC 16390:2007 Section 4.4 min height 5mm or 15% of symbol width whichever greater where + (P = character pairs, N = wide/narrow ratio = 3) width = (P(4N + 6) + N + 6)X = (length / 2) * 18 + 9 */ + height = (float) ((18.0 * (length / 2) + 9.0) * 0.15); + if (height < (float) (5.0 / 0.33)) { /* Taking X = 0.330mm from Annex D.3.1 (application specification) */ + height = (float) (5.0 / 0.33); + } + /* Using 50 as default as none recommended */ + error_number = set_height(symbol, height, height > 50.0f ? height : 50.0f, 0.0f, 0 /*no_errtxt*/); +#else + height = 50.0f; + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); +#endif + } + return error_number; } -/* Interleaved 2-of-5 (ITF) */ +/* Code 2 of 5 Interleaved ISO/IEC 16390:2007 */ +INTERNAL int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length) { + return c25inter_common(symbol, source, length, 0 /*dont_set_height*/); +} + +/* Interleaved 2-of-5 (ITF-14) */ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int length) { - int i, error_number, zeroes; + int i, error_number, warn_number = 0, zeroes; unsigned char localstr[16] = {0}; if (length > 13) { @@ -238,7 +260,7 @@ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int lengt /* Calculate the check digit - the same method used for EAN-13 */ localstr[13] = check_digit(gs1_checksum(localstr, 13)); localstr[14] = '\0'; - error_number = interleaved_two_of_five(symbol, (unsigned char *) localstr, 14); + error_number = c25inter_common(symbol, localstr, 14, 1 /*dont_set_height*/); ustrcpy(symbol->text, localstr); if (!((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND))) { @@ -250,7 +272,18 @@ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int lengt } } - return error_number; + if (error_number < ZINT_ERROR) { +#ifdef COMPLIANT_HEIGHTS + /* 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, (float) (5.8 / 1.016), (float) (31.75 / 0.495), 0.0f, 0 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); +#endif + } + + return error_number ? error_number : warn_number; } /* Deutshe Post Leitcode */ @@ -285,8 +318,11 @@ INTERNAL int dpleit(struct zint_symbol *symbol, unsigned char source[], int leng } localstr[13] = check_digit(count); localstr[14] = '\0'; - error_number = interleaved_two_of_five(symbol, localstr, 14); + error_number = c25inter_common(symbol, localstr, 14, 1 /*dont_set_height*/); ustrcpy(symbol->text, localstr); + + // TODO: Find documentation on BARCODE_DPLEIT dimensions/height + return error_number; } @@ -321,7 +357,10 @@ INTERNAL int dpident(struct zint_symbol *symbol, unsigned char source[], int len } localstr[11] = check_digit(count); localstr[12] = '\0'; - error_number = interleaved_two_of_five(symbol, localstr, 12); + error_number = c25inter_common(symbol, localstr, 12, 1 /*dont_set_height*/); ustrcpy(symbol->text, localstr); + + // TODO: Find documentation on BARCODE_DPIDENT dimensions/height + return error_number; } diff --git a/backend/auspost.c b/backend/auspost.c index 3e4a3921..63d3e8ac 100644 --- a/backend/auspost.c +++ b/backend/auspost.c @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2008 - 2020 Robin Stuart + Copyright (C) 2008 - 2021 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -31,7 +31,7 @@ */ /* vim: set ts=4 sw=4 et : */ -#define GDSET "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #" +#define GDSET "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #" static const char *AusNTable[10] = { "00", "01", "02", "10", "11", "12", "20", "21", "22", "30" @@ -88,6 +88,8 @@ static void rs_error(char data_pattern[]) { } } +INTERNAL int daft_set_height(struct zint_symbol *symbol, float min_height, float max_height); + /* Handles Australia Posts's 4 State Codes */ INTERNAL int australia_post(struct zint_symbol *symbol, unsigned char source[], int length) { /* Customer Standard Barcode, Barcode 2 or Barcode 3 system determined automatically @@ -239,10 +241,21 @@ INTERNAL int australia_post(struct zint_symbol *symbol, unsigned char source[], writer += 2; } - symbol->row_height[0] = 3; - symbol->row_height[1] = 2; - symbol->row_height[2] = 3; - +#ifdef COMPLIANT_HEIGHTS + /* Australia Post Customer Barcoding Technical Specifications (Revised Aug 2012) Dimensions, placement and + printing p.12 + https://auspost.com.au/content/dam/auspost_corp/media/documents/customer-barcode-technical-specifications-aug2012.pdf + X 0.5mm (average of 0.4mm - 0.6mm), min height 4.2mm / 0.6mm (X max) = 7, max 5.6mm / 0.4mm (X min) = 14 + Tracker 1.3mm (average of 1mm - 1.6mm), Ascender/Descender 3.15mm (average of 2.6mm - 3.7mm) less T = 1.85mm + */ + symbol->row_height[0] = 1.85f / 0.5f; /* 3.7 */ + symbol->row_height[1] = 1.3f / 0.5f; /* 2.6 */ + error_number = daft_set_height(symbol, 7.0f, 14.0f); /* Note using max X for minimum and min X for maximum */ +#else + symbol->row_height[0] = 3.0f; + symbol->row_height[1] = 2.0f; + error_number = daft_set_height(symbol, 0.0f, 0.0f); +#endif symbol->rows = 3; symbol->width = writer - 1; diff --git a/backend/aztec.c b/backend/aztec.c index a9fe53c5..3ba3454f 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -669,7 +669,8 @@ static int aztec_text_process(const unsigned char source[], int src_len, char bi byte_mode = 1; } - if ((reduced_encode_mode[i] != 'B') && (reduced_encode_mode[i] != 'u') && (reduced_encode_mode[i] != 'p')) { + if ((reduced_encode_mode[i] != 'B') && (reduced_encode_mode[i] != 'u') + && (reduced_encode_mode[i] != 'p')) { current_mode = reduced_encode_mode[i]; } } @@ -1383,6 +1384,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt } symbol->row_height[y - offset] = 1; } + symbol->height = 27 - (2 * offset); symbol->rows = 27 - (2 * offset); symbol->width = 27 - (2 * offset); } else { @@ -1401,6 +1403,7 @@ INTERNAL int aztec(struct zint_symbol *symbol, unsigned char source[], int lengt } symbol->row_height[y - offset] = 1; } + symbol->height = 151 - (2 * offset); symbol->rows = 151 - (2 * offset); symbol->width = 151 - (2 * offset); } @@ -1481,6 +1484,7 @@ INTERNAL int aztec_runes(struct zint_symbol *symbol, unsigned char source[], int } symbol->row_height[y - 8] = 1; } + symbol->height = 11; symbol->rows = 11; symbol->width = 11; diff --git a/backend/codablock.c b/backend/codablock.c index a2e449cc..4ce91ba6 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2016 - 2020 Harald Oehlmann + Copyright (C) 2016 - 2021 Harald Oehlmann Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -304,7 +304,8 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const /* or ? */ if (T[charCur].BFollowing == 1 || (isFNC4 && T[charCur].BFollowing == 2)) { - /* Note using order "FNC4 shift char" (same as CODE128) not "shift FNC4 char" as given in Table B.1 and Table B.2 */ + /* Note using order "FNC4 shift char" (same as CODE128) not "shift FNC4 char" as + given in Table B.1 and Table B.2 */ if (isFNC4) { /* So skip FNC4 and shift value instead */ --emptyColumns; ++charCur; @@ -338,7 +339,8 @@ static int Columns2Rows(struct zint_symbol *symbol, CharacterSetTable *T, const /* or ? */ if (T[charCur].AFollowing == 1 || (isFNC4 && T[charCur].AFollowing == 2)) { - /* Note using order "FNC4 shift char" (same as CODE128) not "shift FNC4 char" as given in Table B.1 and Table B.2 */ + /* Note using order "FNC4 shift char" (same as CODE128) not "shift FNC4 char" as + given in Table B.1 and Table B.2 */ if (isFNC4) { /* So skip FNC4 and shift value instead */ --emptyColumns; ++charCur; @@ -638,6 +640,7 @@ INTERNAL int codablock(struct zint_symbol *symbol, unsigned char source[], int l int emptyColumns; char dest[1000]; int r, c; + float min_row_height; #ifdef _MSC_VER CharacterSetTable *T; unsigned char *data; @@ -658,6 +661,13 @@ INTERNAL int codablock(struct zint_symbol *symbol, unsigned char source[], int l symbol->border_width = 1; /* AIM ISS-X-24 Section 4.6.1 b) (note change from previous default 2) */ } symbol->text[0] = '\0'; /* Disable HRT for compatibility with CODABLOCKF */ +#ifdef COMPLIANT_HEIGHTS + /* AIM ISS-X-24 Section 4.5.1 minimum row height 8 (for compatibility with CODABLOCKF, not specced for + CODE128) */ + error_number = set_height(symbol, 8.0f, 10.0f, 0.0f, 0 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 5.0f, 0.0f, 1 /*no_errtxt*/); +#endif } return error_number; } @@ -779,7 +789,7 @@ INTERNAL int codablock(struct zint_symbol *symbol, unsigned char source[], int l #ifndef _MSC_VER uchar pOutput[columns * rows]; #else - pOutput = (unsigned char *)_alloca(columns * rows * sizeof(char)); + pOutput = (unsigned char *) _alloca(columns * rows); #endif pOutPos = pOutput; charCur=0; @@ -976,9 +986,21 @@ INTERNAL int codablock(struct zint_symbol *symbol, unsigned char source[], int l strcat(dest, C128Table[pOutput[r * columns + c]]); } expand(symbol, dest); - symbol->row_height[r] = 10; } +#ifdef COMPLIANT_HEIGHTS + /* AIM ISS-X-24 Section 4.6.1 minimum row height; use 10 * rows as default for back-compatibility */ + min_row_height = (float) (0.55 * useColumns + 3.0); + if (min_row_height < 8.0f) { + min_row_height = 8.0f; + } + error_number = set_height(symbol, min_row_height, (min_row_height > 10.0f ? min_row_height : 10.0f) * rows, 0.0f, + 0 /*no_errtxt*/); +#else + (void)min_row_height; + (void) set_height(symbol, 0.0f, 10.0f * rows, 0.0f, 1 /*no_errtxt*/); +#endif + symbol->output_options |= BARCODE_BIND; if (symbol->border_width == 0) { /* Allow override if non-zero */ diff --git a/backend/code.c b/backend/code.c index 719bdcb2..3f764f89 100644 --- a/backend/code.c +++ b/backend/code.c @@ -5,7 +5,7 @@ /* libzint - the open source barcode library - Copyright (C) 2008 - 2020 Robin Stuart + Copyright (C) 2008 - 2021 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -205,6 +205,8 @@ INTERNAL int code_11(struct zint_symbol *symbol, unsigned char source[], int len expand(symbol, dest); + // TODO: Find documentation on BARCODE_CODE11 dimensions/height + ustrcpy(symbol->text, source); if (num_check_digits) { ustrcat(symbol->text, checkstr); @@ -219,6 +221,7 @@ INTERNAL int c39(struct zint_symbol *symbol, unsigned char source[], int length) int error_number; char dest[880]; /* 10 (Start) + 85 * 10 + 10 (Check) + 9 (Stop) + 1 = 880 */ char localstr[2] = {0}; + float height; counter = 0; @@ -229,7 +232,8 @@ INTERNAL int c39(struct zint_symbol *symbol, unsigned char source[], int length) if ((symbol->symbology == BARCODE_LOGMARS) && (length > 30)) { /* MIL-STD-1189 Rev. B Section 5.2.6.2 */ strcpy(symbol->errtxt, "322: Input too long"); return ZINT_ERROR_TOO_LONG; - } else if ((symbol->symbology == BARCODE_HIBC_39) && (length > 68)) { /* Prevent encoded_data out-of-bounds >= 143 due to wider 'wide' bars */ + /* Prevent encoded_data out-of-bounds >= 143 for BARCODE_HIBC_39 due to wider 'wide' bars */ + } else if ((symbol->symbology == BARCODE_HIBC_39) && (length > 68)) { strcpy(symbol->errtxt, "319: Input too long"); /* Note use 319 (2of5 range) as 340 taken by CODE128 */ return ZINT_ERROR_TOO_LONG; } else if (length > 85) { @@ -311,6 +315,27 @@ INTERNAL int c39(struct zint_symbol *symbol, unsigned char source[], int length) expand(symbol, dest); +#ifdef COMPLIANT_HEIGHTS + if (symbol->symbology == BARCODE_LOGMARS) { + /* MIL-STD-1189 Rev. B Section 5.2 + Min height 0.25" / 0.04" (X max) = 6.25 + Default height 0.625" (average of 0.375" - 0.875") / 0.01375" (average of 0.0075" - 0.02") ~ 45.45 */ + height = (float) (0.625 / 0.01375); + error_number = set_height(symbol, 6.25f, height, (float) (0.875 / 0.0075), 0 /*no_errtxt*/); + } else if (symbol->symbology == BARCODE_CODE39 || symbol->symbology == BARCODE_EXCODE39 + || symbol->symbology == BARCODE_HIBC_39) { + /* ISO/IEC 16388:2007 4.4 (e) recommended min height 5.0mm or 15% of width excluding quiet zones; + as X left to application specification use + width = (C + 2) * (3 * N + 6) * X + (C + 1) * I = (C + 2) * 9 + C + 1) * X = (10 * C + 19) */ + height = (float) ((10.0 * (symbol->option_2 == 1 ? length + 1 : length) + 19.0) * 0.15); + /* Using 50 as default as none recommended */ + error_number = set_height(symbol, height , height > 50.0f ? height : 50.0f, 0.0f, 0 /*no_errtxt*/); + } +#else + height = 50.0f; + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); +#endif + if (symbol->symbology == BARCODE_CODE39) { ustrcpy(symbol->text, "*"); ustrncat(symbol->text, source, length); @@ -366,6 +391,21 @@ INTERNAL int pharmazentral(struct zint_symbol *symbol, unsigned char source[], i error_number = c39(symbol, (unsigned char *) localstr, 9); ustrcpy(symbol->text, "PZN "); ustrcat(symbol->text, localstr); + +#ifdef COMPLIANT_HEIGHTS + /* Technical Information regarding PZN Coding V 2.1 (25 Feb 2019) Code size + https://www.ifaffm.de/mandanten/1/documents/04_ifa_coding_system/IFA_Info_Code_39_EN.pdf + "normal" X 0.25mm (0.187mm - 0.45mm), height 8mm - 20mm for 0.25mm X, 10mm mentioned so use that as default, + 10mm / 0.25mm = 40 */ + if (error_number < ZINT_ERROR) { + error_number = set_height(symbol, (float) (8.0 / 0.45), 40.0f, (float) (20.0 / 0.187), 0 /*no_errtxt*/); + } +#else + if (error_number < ZINT_ERROR) { + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); + } +#endif + return error_number; } @@ -409,12 +449,12 @@ INTERNAL int c93(struct zint_symbol *symbol, unsigned char source[], int length) c39() and ec39() */ int i; - int h, weight, c, k, values[128], error_number; + int h, weight, c, k, values[128], error_number = 0; char buffer[220]; char dest[670]; char set_copy[] = SILVER; + float height; - error_number = 0; strcpy(buffer, ""); if (length > 107) { @@ -483,6 +523,20 @@ INTERNAL int c93(struct zint_symbol *symbol, unsigned char source[], int length) strcat(dest, "1111411"); expand(symbol, dest); +#ifdef COMPLIANT_HEIGHTS + /* ANSI/AIM BC5-1995 Section 2.6 minimum height 0.2" or 15% of symbol length, whichever is greater + 0.2" / 0.0075" (min X) = ~26.66; symbol length = (9 * (C + 4) + 1) * X + 2 * Q = symbol->width + 20 */ + height = (float) ((symbol->width + 20) * 0.15); + if (height < 0.2f / 0.0075f) { + height = 0.2f / 0.0075f; + } + /* Using 50 as default for back-compatibility */ + error_number = set_height(symbol, height, height > 50.0f ? height : 50.0f, 0.0f, 0 /*no_errtxt*/); +#else + height = 50.0f; + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); +#endif + symbol->text[length] = set_copy[c]; symbol->text[length + 1] = set_copy[k]; symbol->text[length + 2] = '\0'; @@ -497,8 +551,10 @@ typedef const struct s_channel_precalc { //#define CHANNEL_GENERATE_PRECALCS #ifdef CHANNEL_GENERATE_PRECALCS -/* To generate precalc tables uncomment define and run "./test_channel -f generate -g" and place result in "channel_precalcs.h" */ -static void channel_generate_precalc(int channels, long value, int mod, int last, int B[8], int S[8], int bmax[7], int smax[7]) { +/* To generate precalc tables uncomment CHANNEL_GENERATE_PRECALCS define and run "./test_channel -f generate -g" and + place result in "channel_precalcs.h" */ +static void channel_generate_precalc(int channels, long value, int mod, int last, int B[8], int S[8], int bmax[7], + int smax[7]) { int i; if (value == mod) printf("static channel_precalc channel_precalcs%d[] = {\n", channels); printf(" { %7ld, {", value); for (i = 0; i < 8; i++) printf(" %d,", B[i]); printf(" },"); @@ -536,9 +592,8 @@ static long channel_copy_precalc(channel_precalc precalc, int B[8], int S[8], in specification is entirely in the public domain and free of all use restrictions, licenses and fees. AIM USA, its member companies, or individual officers assume no liability for the use of this document." */ - static void CHNCHR(int channels, long target_value, int B[8], int S[8]) { - /* Use of initial pre-calculations taken from Barcode Writer in Pure PostScript (bwipp) + /* Use of initial pre-calculations taken from Barcode Writer in Pure PostScript (BWIPP) * Copyright (c) 2004-2020 Terry Burton (MIT/X-Consortium license) */ static channel_precalc initial_precalcs[6] = { { 0, { 1, 1, 1, 1, 1, 2, 1, 2, }, { 1, 1, 1, 1, 1, 1, 1, 3, }, { 1, 1, 1, 1, 1, 3, 2, }, { 1, 1, 1, 1, 1, 3, 3, }, }, @@ -555,9 +610,11 @@ static void CHNCHR(int channels, long target_value, int B[8], int S[8]) { #ifndef CHANNEL_GENERATE_PRECALCS if (channels == 7 && target_value >= channel_precalcs7[0].value) { - value = channel_copy_precalc(channel_precalcs7[(target_value / channel_precalcs7[0].value) - 1], B, S, bmax, smax); + value = channel_copy_precalc(channel_precalcs7[(target_value / channel_precalcs7[0].value) - 1], B, S, bmax, + smax); } else if (channels == 8 && target_value >= channel_precalcs8[0].value) { - value = channel_copy_precalc(channel_precalcs8[(target_value / channel_precalcs8[0].value) - 1], B, S, bmax, smax); + value = channel_copy_precalc(channel_precalcs8[(target_value / channel_precalcs8[0].value) - 1], B, S, bmax, + smax); } #endif @@ -587,10 +644,14 @@ lb6: B[7] = bmax[6] + 1 - B[6 if (B[5] + S[6] + B[6] + S[7] + B[7] == 5) goto nb6; chkchr: #ifdef CHANNEL_GENERATE_PRECALCS - if (channels == 7 && value && value % 115338 == 0) { /* 115338 == (576688 + 2) / 5 */ - channel_generate_precalc(channels, value, 115338, 115338 * (5 - 1), B, S, bmax, smax); - } else if (channels == 8 && value && value % 119121 == 0) { /* 119121 == (7742862 + 3) / 65 */ - channel_generate_precalc(channels, value, 119121, 119121 * (65 - 1), B, S, bmax, smax); + /* 115338 == (576688 + 2) / 5 */ + if (channels == 7 && value && value % 115338 == 0) { + channel_generate_precalc(channels, value, 115338, + 115338 * (5 - 1), B, S, bmax, smax); + /* 119121 == (7742862 + 3) / 65 */ + } else if (channels == 8 && value && value % 119121 == 0) { + channel_generate_precalc(channels, value, 119121, + 119121 * (65 - 1), B, S, bmax, smax); } #endif if (value == target_value) return; @@ -619,6 +680,7 @@ INTERNAL int channel_code(struct zint_symbol *symbol, unsigned char source[], in int channels, i; int error_number, range = 0, zeroes; char hrt[9]; + float height; if (length > 7) { strcpy(symbol->errtxt, "333: Input too long"); @@ -711,6 +773,18 @@ INTERNAL int channel_code(struct zint_symbol *symbol, unsigned char source[], in expand(symbol, pattern); +#ifdef COMPLIANT_HEIGHTS + /* ANSI/AIM BC12-1998 gives min height as 5mm or 15% of length but X left as application specification so use + 15% of length where + length = (3 (quiet zones) + 9 (finder) + 4 * channels - 2) * X */ + height = (float) ((10 + 4 * channels) * 0.15); + /* Using 50 as default for back-compatibility */ + error_number = set_height(symbol, height > 50.0f ? height : 50.0f, height, 0.0f, 0 /*no_errtxt*/); +#else + height = 50.0f; + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); +#endif + return error_number; } @@ -801,5 +875,7 @@ INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length) ustrcpy(symbol->text, local_source); expand(symbol, dest); + /* Specification of dimensions/height for BARCODE_VIN unlikely */ + return 0; } diff --git a/backend/code1.c b/backend/code1.c index 9ae44bcb..2cb32d02 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -386,7 +386,7 @@ static int decimal_unlatch(char decimal_binary[24], int db_p, unsigned int targe if (bits_left == 6) { db_p = bin_append_posn(1, 2, decimal_binary, db_p); } - (void)decimal_binary_transfer(decimal_binary, db_p, target, p_tp); + (void) decimal_binary_transfer(decimal_binary, db_p, target, p_tp); } else if (bits_left) { if (bits_left >= 4) { @@ -395,7 +395,7 @@ static int decimal_unlatch(char decimal_binary[24], int db_p, unsigned int targe if (bits_left == 2 || bits_left == 6) { db_p = bin_append_posn(1, 2, decimal_binary, db_p); } - (void)decimal_binary_transfer(decimal_binary, db_p, target, p_tp); + (void) decimal_binary_transfer(decimal_binary, db_p, target, p_tp); } *p_sp = sp; @@ -1442,6 +1442,7 @@ INTERNAL int code_one(struct zint_symbol *symbol, unsigned char source[], int le for (i = 0; i < symbol->rows; i++) { symbol->row_height[i] = 1; } + symbol->height = symbol->rows; if (symbol->option_2 == 9) { /* Version S */ if (symbol->eci || (symbol->input_mode & 0x07) == GS1_MODE) { diff --git a/backend/code128.c b/backend/code128.c index 0d2cada5..86d718a9 100644 --- a/backend/code128.c +++ b/backend/code128.c @@ -692,15 +692,18 @@ INTERNAL int code_128(struct zint_symbol *symbol, unsigned char source[], int le expand(symbol, dest); + /* ISO/IEC 15417:2007 leaves dimensions/height as application specification */ + hrt_cpy_iso8859_1(symbol, source, length); return error_number; } -/* Handle EAN-128 (Now known as GS1-128) */ -INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) { +/* Handle EAN-128 (Now known as GS1-128), and composite version if `cc_mode` set */ +INTERNAL int ean_128_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_mode, + const int cc_rows) { int i, j, values[C128_MAX] = {0}, bar_characters, read, total_sum; - int error_number, indexchaine, indexliste; + int error_number, warn_number = 0, indexchaine, indexliste; int list[2][C128_MAX] = {{0}}; char set[C128_MAX] = {0}, mode, last_set; float glyph_count; @@ -737,6 +740,7 @@ INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], int len if (error_number >= ZINT_ERROR) { return error_number; } + reduced_length = (int) ustrlen(reduced); /* Decide on mode using same system as PDF417 and rules of ISO 15417 Annex E */ @@ -936,7 +940,7 @@ INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], int len /* Linkage flags in GS1-128 are determined by ISO/IEC 24723 section 7.4 */ - switch (symbol->option_1) { + switch (cc_mode) { case 1: case 2: /* CC-A or CC-B 2D component */ @@ -1008,6 +1012,24 @@ INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], int len } } +#ifdef COMPLIANT_HEIGHTS + /* 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; + default 31.75mm / 0.495mm ~ 64.14 */ + if (symbol->symbology == BARCODE_GS1_128_CC) { + /* Pass back via temporary linear structure */ + symbol->height = symbol->height ? (float) (5.8 / 1.016) : (float) (31.75 / 0.495); + } else { + warn_number = set_height(symbol, (float) (5.8 / 1.016), (float) (31.75 / 0.495), 0.0f, 0 /*no_errtxt*/); + } +#else + if (symbol->symbology == BARCODE_GS1_128_CC) { + symbol->height = 50.0f - cc_rows * (cc_mode == 3 ? 3 : 2) - 1.0f; + } else { + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); + } +#endif + for (i = 0; i < length; i++) { if ((source[i] != '[') && (source[i] != ']')) { symbol->text[i] = source[i]; @@ -1020,7 +1042,12 @@ INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], int len } } - return error_number; + return error_number ? error_number : warn_number; +} + +/* Handle EAN-128 (Now known as GS1-128) */ +INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], int length) { + return ean_128_cc(symbol, source, length, 0 /*cc_mode*/, 0 /*cc_rows*/); } /* Add check digit if encoding an NVE18 symbol */ @@ -1130,46 +1157,56 @@ INTERNAL int dpd_parcel(struct zint_symbol *symbol, unsigned char source[], int } source[0] = identifier; - error_number = code_128(symbol, source, length); - - cd = mod; - - p = 0; - for (i = 1; i < length; i++) { - symbol->text[p] = source[i]; - p++; - - cd += posn(KRSET, source[i]); - if (cd > mod) cd -= mod; - cd *= 2; - if (cd >= (mod + 1)) cd -= mod + 1; - - switch (i) { - case 4: - case 7: - case 11: - case 15: - case 19: - case 21: - case 24: - case 27: - symbol->text[p] = ' '; - p++; - break; + error_number = code_128(symbol, source, length); /* Only returns errors, not warnings */ + + if (error_number < ZINT_ERROR) { +#ifdef COMPLIANT_HEIGHTS + /* Specification DPD and primetime Parcel Despatch 4.0.2 Section 5.5.1 + 25mm / 0.4mm (X max) = 62.5 min, 25mm / 0.375 (X) ~ 66.66 default */ + error_number = set_height(symbol, 62.5f, (float) (25.0 / 0.375), 0.0f, 0 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); +#endif + + cd = mod; + + p = 0; + for (i = 1; i < length; i++) { + symbol->text[p] = source[i]; + p++; + + cd += posn(KRSET, source[i]); + if (cd > mod) cd -= mod; + cd *= 2; + if (cd >= (mod + 1)) cd -= mod + 1; + + switch (i) { + 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'; } - - 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'; - + return error_number; } diff --git a/backend/code16k.c b/backend/code16k.c index 1d5ba90c..41e3c133 100644 --- a/backend/code16k.c +++ b/backend/code16k.c @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2008 - 2020 Robin Stuart + Copyright (C) 2008 - 2021 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -116,14 +116,15 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len int values[C128_MAX] = {0}; int bar_characters; float glyph_count; - int error_number, first_sum, second_sum; + int error_number = 0, first_sum, second_sum; int input_length; int gs1, c_count; + int separator; + float min_row_height; /* Suppresses clang-analyzer-core.UndefinedBinaryOperatorResult warning on fset which is fully set */ assert(length > 0); - error_number = 0; strcpy(width_pattern, ""); input_length = length; @@ -487,12 +488,22 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len flip_flop = 0; } } - symbol->row_height[current_row] = 10; } symbol->rows = rows; symbol->width = 70; +#ifdef COMPLIANT_HEIGHTS + separator = symbol->option_3 >= 1 && symbol->option_3 <= 4 ? symbol->option_3 : 1; + /* BS EN 12323:2005 Section 4.5 (d) minimum 8X; use 10 * rows as default for back-compatibility */ + min_row_height = 8.0f + separator; + error_number = set_height(symbol, min_row_height, (min_row_height > 10.0f ? min_row_height : 10.0f) * rows, 0.0f, + 0 /*no_errtxt*/); +#else + (void)min_row_height; (void)separator; + (void) set_height(symbol, 0.0f, 10.0f * rows, 0.0f, 1 /*no_errtxt*/); +#endif + symbol->output_options |= BARCODE_BIND; if (symbol->border_width == 0) { /* Allow override if non-zero */ diff --git a/backend/code49.c b/backend/code49.c index e01b37d9..3fec358c 100644 --- a/backend/code49.c +++ b/backend/code49.c @@ -49,6 +49,9 @@ INTERNAL int code_49(struct zint_symbol *symbol, unsigned char source[], int len char pattern[80]; int gs1; int h, len; + int separator; + float min_row_height; + int error_number = 0; if (length > 81) { strcpy(symbol->errtxt, "430: Input too long"); @@ -338,8 +341,6 @@ INTERNAL int code_49(struct zint_symbol *symbol, unsigned char source[], int len strcat(pattern, "1111"); /* Stop character */ /* Expand into symbol */ - symbol->row_height[i] = 10; - for (j = 0, len = (int) strlen(pattern); j < len; j++) { if (pattern[j] == '1') { set_module(symbol, i, j); @@ -350,11 +351,22 @@ INTERNAL int code_49(struct zint_symbol *symbol, unsigned char source[], int len symbol->rows = rows; symbol->width = (int) strlen(pattern); +#ifdef COMPLIANT_HEIGHTS + separator = symbol->option_3 >= 1 && symbol->option_3 <= 4 ? symbol->option_3 : 1; + /* ANSI/AIM BC6-2000 Section 2.6 minimum 8X; use 10 * rows as default for back-compatibility */ + min_row_height = 8.0f + separator; + error_number = set_height(symbol, min_row_height, (min_row_height > 10.0f ? min_row_height : 10.0f) * rows, 0.0f, + 0 /*no_errtxt*/); +#else + (void)min_row_height; (void)separator; + (void) set_height(symbol, 0.0f, 10.0f * rows, 0.0f, 1 /*no_errtxt*/); +#endif + symbol->output_options |= BARCODE_BIND; if (symbol->border_width == 0) { /* Allow override if non-zero */ symbol->border_width = 1; /* ANSI/AIM BC6-2000 Section 2.1 (note change from previous default 2) */ } - return 0; + return error_number; } diff --git a/backend/common.c b/backend/common.c index eb623db5..c0cdb51d 100644 --- a/backend/common.c +++ b/backend/common.c @@ -295,12 +295,14 @@ INTERNAL unsigned int decode_utf8(unsigned int *state, unsigned int *codep, cons /* Copyright (c) 2008-2009 Bjoern Hoehrmann - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation - files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, - modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated + documentation files (the "Software"), to deal in the Software without restriction, including without + limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the + Software, and to permit persons to whom the Software is furnished to do so, subject to the following + conditions: - The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in all copies or substantial portions + of the Software. See https://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. */ @@ -383,29 +385,54 @@ INTERNAL int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char sou return 0; } -/* Enforce minimum permissable height of rows */ -INTERNAL void set_minimum_height(struct zint_symbol *symbol, const int min_height) { - int fixed_height = 0; +/* Set symbol height, returning a warning if not within minimum and/or maximum if given. + `default_height` does not include height of fixed-height rows (i.e. separators/composite data) */ +INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, const float default_height, + const float max_height, const int no_errtxt) { + int error_number = 0; + float fixed_height = 0.0f; int zero_count = 0; + float row_height; int i; + int rows = symbol->rows ? symbol->rows : 1; /* Sometimes called before expand() */ - for (i = 0; i < symbol->rows; i++) { - fixed_height += symbol->row_height[i]; - - if (symbol->row_height[i] == 0) { + for (i = 0; i < rows; i++) { + if (symbol->row_height[i]) { + fixed_height += symbol->row_height[i]; + } else { zero_count++; } } - if (zero_count > 0) { - if (((symbol->height - fixed_height) / zero_count) < min_height) { - for (i = 0; i < symbol->rows; i++) { - if (symbol->row_height[i] == 0) { - symbol->row_height[i] = min_height; - } + if (zero_count) { + if (symbol->height) { + row_height = (symbol->height - fixed_height) / zero_count; + } else if (default_height) { + row_height = default_height / zero_count; + } else { + row_height = min_row_height; + } + if (row_height < 0.5f) { /* Absolute minimum */ + row_height = 0.5f; + } + if (min_row_height && row_height < min_row_height) { + error_number = ZINT_WARN_NONCOMPLIANT; + if (!no_errtxt) { + strcpy(symbol->errtxt, "247: Height not compliant with standards"); } } + symbol->height = row_height * zero_count + fixed_height; + } else { + symbol->height = fixed_height; /* Ignore any given height */ } + if (max_height && symbol->height > max_height) { + error_number = ZINT_WARN_NONCOMPLIANT; + if (!no_errtxt) { + strcpy(symbol->errtxt, "248: Height not compliant with standards"); + } + } + + return error_number; } /* Returns red component if any of ultra colour indexing "0CBMRYGKW" */ diff --git a/backend/common.h b/backend/common.h index 2ad037ef..0856364a 100644 --- a/backend/common.h +++ b/backend/common.h @@ -119,7 +119,8 @@ extern "C" { INTERNAL int module_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord); INTERNAL void set_module(struct zint_symbol *symbol, const int y_coord, const int x_coord); INTERNAL int module_colour_is_set(const struct zint_symbol *symbol, const int y_coord, const int x_coord); - INTERNAL void set_module_colour(struct zint_symbol *symbol, const int y_coord, const int x_coord, const int colour); + INTERNAL void set_module_colour(struct zint_symbol *symbol, const int y_coord, const int x_coord, + const int colour); #endif INTERNAL void unset_module(struct zint_symbol *symbol, const int y_coord, const int x_coord); INTERNAL void expand(struct zint_symbol *symbol, const char data[]); @@ -131,14 +132,16 @@ extern "C" { INTERNAL int is_valid_utf8(const unsigned char source[], const int length); INTERNAL int utf8_to_unicode(struct zint_symbol *symbol, const unsigned char source[], unsigned int vals[], int *length, const int disallow_4byte); - INTERNAL void set_minimum_height(struct zint_symbol *symbol, const int min_height); + INTERNAL int set_height(struct zint_symbol *symbol, const float min_row_height, const float default_height, + const float max_height, const int set_errtxt); INTERNAL int colour_to_red(const int colour); INTERNAL int colour_to_green(const int colour); INTERNAL int colour_to_blue(const int colour); #ifdef ZINT_TEST - INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigned char *codewords, const int length); + INTERNAL void debug_test_codeword_dump(struct zint_symbol *symbol, const unsigned char *codewords, + const int length); INTERNAL void debug_test_codeword_dump_int(struct zint_symbol *symbol, const int *codewords, const int length); #endif diff --git a/backend/composite.c b/backend/composite.c index ecc3b030..73d0ab5e 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -63,13 +63,17 @@ #define UINT unsigned short #include "composite.h" -INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int length); -INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], int length); +INTERNAL int ean_128_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_mode, + const int cc_rows); + +INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows); INTERNAL int ean_leading_zeroes(struct zint_symbol *symbol, const unsigned char source[], unsigned char local_source[], int *p_with_addon); -INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int length); -INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int length); -INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int length); + +INTERNAL int rss14_stk_set_height(struct zint_symbol *symbol, const int first_row); +INTERNAL int rss14_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows); +INTERNAL int rsslimited_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows); +INTERNAL int rssexpanded_cc(struct zint_symbol *symbol, unsigned char source[], int length, const int cc_rows); INTERNAL int rss_date(const unsigned char source[], const int src_posn); static int _min(const int first, const int second) { @@ -1255,8 +1259,7 @@ static int linear_dummy_run(int input_mode, unsigned char *source, const int len dummy = ZBarcode_Create(); dummy->symbology = BARCODE_GS1_128_CC; dummy->input_mode = input_mode; - dummy->option_1 = 3; - error_number = ean_128(dummy, source, length); + error_number = ean_128_cc(dummy, source, length, 3 /*cc_mode*/, 0 /*cc_rows*/); linear_width = dummy->width; if (error_number >= ZINT_ERROR) { strcpy(errtxt, dummy->errtxt); @@ -1270,7 +1273,7 @@ static int linear_dummy_run(int input_mode, unsigned char *source, const int len } INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int length) { - int error_number, cc_mode, cc_width = 0, ecc_level = 0; + int error_number, warn_number = 0, cc_mode, cc_width = 0, ecc_level = 0; int j, i, k; unsigned int bs = 13 * length + 500 + 1; /* Allow for 8 bits + 5-bit latch per char + 500 bits overhead/padding */ #ifndef _MSC_VER @@ -1305,7 +1308,8 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l if (symbol->symbology == BARCODE_GS1_128_CC) { /* Do a test run of encoding the linear component to establish its width */ - linear_width = linear_dummy_run(symbol->input_mode, (unsigned char *) symbol->primary, pri_len, symbol->errtxt); + linear_width = linear_dummy_run(symbol->input_mode, (unsigned char *) symbol->primary, pri_len, + symbol->errtxt); if (linear_width == 0) { strcat(symbol->errtxt, " in linear component"); return ZINT_ERROR_INVALID_DATA; @@ -1427,36 +1431,46 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l linear->symbology = symbol->symbology; linear->input_mode = symbol->input_mode; linear->option_2 = symbol->option_2; + /* If symbol->height given minimum row height will be returned, else default height */ + linear->height = symbol->height; linear->debug = symbol->debug; if (linear->symbology != BARCODE_GS1_128_CC) { /* Set the "component linkage" flag in the linear component */ linear->option_1 = 2; - } else { - /* GS1-128 needs to know which type of 2D component is used */ - linear->option_1 = cc_mode; } switch (symbol->symbology) { - case BARCODE_EANX_CC: error_number = eanx(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_EANX_CC: + error_number = eanx_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); break; - case BARCODE_GS1_128_CC: error_number = ean_128(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_GS1_128_CC: + /* GS1-128 needs to know which type of 2D component is used */ + error_number = ean_128_cc(linear, (unsigned char *) symbol->primary, pri_len, cc_mode, symbol->rows); break; - case BARCODE_DBAR_OMN_CC: error_number = rss14(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_DBAR_OMN_CC: + error_number = rss14_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); break; - case BARCODE_DBAR_LTD_CC: error_number = rsslimited(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_DBAR_LTD_CC: + error_number = rsslimited_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); break; - case BARCODE_DBAR_EXP_CC: error_number = rssexpanded(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_DBAR_EXP_CC: + error_number = rssexpanded_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); break; - case BARCODE_UPCA_CC: error_number = eanx(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_UPCA_CC: + error_number = eanx_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); break; - case BARCODE_UPCE_CC: error_number = eanx(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_UPCE_CC: + error_number = eanx_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); break; - case BARCODE_DBAR_STK_CC: error_number = rss14(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_DBAR_STK_CC: + error_number = rss14_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); break; - case BARCODE_DBAR_OMNSTK_CC: error_number = rss14(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_DBAR_OMNSTK_CC: + error_number = rss14_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); break; - case BARCODE_DBAR_EXPSTK_CC: error_number = rssexpanded(linear, (unsigned char *) symbol->primary, pri_len); + case BARCODE_DBAR_EXPSTK_CC: + error_number = rssexpanded_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows); break; } @@ -1583,10 +1597,27 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l symbol->width += top_shift; } symbol->rows += linear->rows; +#ifdef COMPLIANT_HEIGHTS + if (symbol->symbology == BARCODE_DBAR_STK_CC) { + /* Databar Stacked needs special treatment due to asymmetric rows */ + warn_number = rss14_stk_set_height(symbol, symbol->rows - linear->rows + 1 /*first_row*/); + } 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, + symbol->height ? 0.0f : linear->height, 0.0f, 0 /*no_errtxt*/); + } +#else + if (symbol->symbology == BARCODE_DBAR_STK_CC) { + (void) rss14_stk_set_height(symbol, symbol->rows - linear->rows + 1 /*first_row*/); + } else { + (void) set_height(symbol, symbol->height ? linear->height : 0.0f, symbol->height ? 0.0f : linear->height, + 0.0f, 1 /*no_errtxt*/); + } +#endif ustrcpy(symbol->text, linear->text); ZBarcode_Delete(linear); - return error_number; + return error_number ? error_number : warn_number; } diff --git a/backend/dmatrix.c b/backend/dmatrix.c index 7ec7d93b..c26727fe 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -906,7 +906,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], if (process_p == 2 && symbols_left == 2) { /* 5.2.5.2 (b) */ process_buffer[process_p++] = 0; // Shift 1 - (void)ctx_process_buffer_transfer(process_buffer, process_p, target, &tp, debug); + (void) ctx_process_buffer_transfer(process_buffer, process_p, target, &tp, debug); } else if (process_p == 1 && symbols_left <= 2 && isc40text(current_mode, source[inputlen - 1])) { /* 5.2.5.2 (c)/(d) */ @@ -997,7 +997,7 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[], memset(process_buffer + process_p, 0, sizeof(int) * (4 - process_p)); } } - (void)edi_process_buffer_transfer(process_buffer, 4, target, &tp, debug); + (void) edi_process_buffer_transfer(process_buffer, 4, target, &tp, debug); } } else if (current_mode == DM_BASE256) { @@ -1162,6 +1162,7 @@ static int data_matrix_200(struct zint_symbol *symbol, const unsigned char sourc free(places); } + symbol->height = H; symbol->rows = H; symbol->width = W; diff --git a/backend/dotcode.c b/backend/dotcode.c index eed9d24a..bf7e1370 100644 --- a/backend/dotcode.c +++ b/backend/dotcode.c @@ -1592,6 +1592,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, unsigned char source[], int len } symbol->row_height[k] = 1; } + symbol->height = height; if (!(symbol->output_options & BARCODE_DOTTY_MODE)) { symbol->output_options += BARCODE_DOTTY_MODE; diff --git a/backend/gridmtx.c b/backend/gridmtx.c index b8134018..a72f735a 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -64,7 +64,8 @@ static int in_numeral(const unsigned int gbdata[], const int length, const int i /* Also ensures that numeric mode is not selected when it cannot be used: for example in a string which has "2.2.0" (cannot have more than one non-numeric character for each block of three numeric characters) */ - for (i = in_posn, digit_cnt = 0, nondigit = 0, nondigit_posn = 0; i < length && i < in_posn + 4 && digit_cnt < 3; i++) { + for (i = in_posn, digit_cnt = 0, nondigit = 0, nondigit_posn = 0; i < length && i < in_posn + 4 && digit_cnt < 3; + i++) { if (gbdata[i] >= '0' && gbdata[i] <= '9') { digit_cnt++; } else if (strchr(numeral_nondigits, gbdata[i])) { @@ -944,15 +945,15 @@ static void place_data_in_grid(unsigned char word[], char grid[], int modules, i } /* Place the layer ID into each macromodule */ -static void place_layer_id(char* grid, int size, int layers, int modules, int ecc_level) { +static void place_layer_id(char *grid, int size, int layers, int modules, int ecc_level) { int i, j, layer, start, stop; #ifndef _MSC_VER int layerid[layers + 1]; int id[modules * modules]; #else - int* layerid = (int *) _alloca((layers + 1) * sizeof (int)); - int* id = (int *) _alloca((modules * modules) * sizeof (int)); + int *layerid = (int *) _alloca((layers + 1) * sizeof(int)); + int *id = (int *) _alloca((modules * modules) * sizeof(int)); #endif /* Calculate Layer IDs */ @@ -1110,7 +1111,8 @@ INTERNAL int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int if (input_latch && ecc_level > min_ecc_level) { do { ecc_level--; - } while ((data_cw > gm_data_codewords[(5 * (layers - 1)) + (ecc_level - 1)]) && (ecc_level > min_ecc_level)); + } while ((data_cw > gm_data_codewords[(5 * (layers - 1)) + (ecc_level - 1)]) + && (ecc_level > min_ecc_level)); } while (data_cw > gm_data_codewords[(5 * (layers - 1)) + (ecc_level - 1)] && (layers < 13)) { layers++; @@ -1188,6 +1190,7 @@ INTERNAL int grid_matrix(struct zint_symbol *symbol, unsigned char source[], int } symbol->row_height[x] = 1; } + symbol->height = size; return 0; } diff --git a/backend/hanxin.c b/backend/hanxin.c index 8c0b1941..be9d971a 100644 --- a/backend/hanxin.c +++ b/backend/hanxin.c @@ -305,7 +305,8 @@ static int in_numeric(const unsigned int gbdata[], const int length, const int i return 0; } *p_end = i; - *p_cost = digit_cnt == 1 ? 60 /* 10 * HX_MULT */ : digit_cnt == 2 ? 30 /* (10 / 2) * HX_MULT */ : 20 /* (10 / 3) * HX_MULT */; + *p_cost = digit_cnt == 1 + ? 60 /* 10 * HX_MULT */ : digit_cnt == 2 ? 30 /* (10 / 2) * HX_MULT */ : 20 /* (10 / 3) * HX_MULT */; return 1; } @@ -693,10 +694,12 @@ static void calculate_binary(char binary[], const char mode[], unsigned int sour } /* Terminator */ - bp = bin_append_posn(position + block_length == length || mode[position + block_length] != '2' ? 4095 : 4094, 12, binary, bp); + bp = bin_append_posn(position + block_length == length || mode[position + block_length] != '2' + ? 4095 : 4094, 12, binary, bp); if (debug & ZINT_DEBUG_PRINT) { - printf("(TERM %x)\n", position + block_length == length || mode[position + block_length] != '2' ? 4095 : 4094); + printf("(TERM %x)\n", position + block_length == length || mode[position + block_length] != '2' + ? 4095 : 4094); } break; @@ -728,10 +731,12 @@ static void calculate_binary(char binary[], const char mode[], unsigned int sour } /* Terminator */ - bp = bin_append_posn(position + block_length == length || mode[position + block_length] != '1' ? 4095 : 4094, 12, binary, bp); + bp = bin_append_posn(position + block_length == length || mode[position + block_length] != '1' + ? 4095 : 4094, 12, binary, bp); if (debug & ZINT_DEBUG_PRINT) { - printf("(TERM %x)\n", position + block_length == length || mode[position + block_length] != '1' ? 4095 : 4094); + printf("(TERM %x)\n", position + block_length == length || mode[position + block_length] != '1' + ? 4095 : 4094); } break; @@ -883,7 +888,8 @@ static void hx_safe_plot(unsigned char *grid, const int size, const int x, const } /* Plot an alignment pattern around top and right of a module */ -static void hx_plot_alignment(unsigned char *grid, const int size, const int x, const int y, const int w, const int h) { +static void hx_plot_alignment(unsigned char *grid, const int size, const int x, const int y, const int w, + const int h) { int i; hx_safe_plot(grid, size, x, y, 0x11); hx_safe_plot(grid, size, x - 1, y + 1, 0x10); @@ -1148,7 +1154,8 @@ static void hx_set_function_info(unsigned char *grid, const int size, const int } if (debug & ZINT_DEBUG_PRINT) { - printf("Version: %d, ECC: %d, Mask: %d, Structural Info: %.34s\n", version, ecc_level, bitmask, function_information); + printf("Version: %d, ECC: %d, Mask: %d, Structural Info: %.34s\n", version, ecc_level, bitmask, + function_information); } /* Add function information to symbol */ @@ -1289,7 +1296,8 @@ static int hx_evaluate(const unsigned char *local, const int size) { * position of the module.” - however i being the length of the run of the * same colour (i.e. "block" below) in the same fashion as ISO/IEC 18004 * makes more sense. -- Confirmed by Wang Yi */ - /* Fixed in ISO/IEC 20830 (draft 2019-10-10) section 5.8.3.2 "In Table 12 below, i refers to the modules with same color." */ + /* Fixed in ISO/IEC 20830 (draft 2019-10-10) section 5.8.3.2 "In Table 12 below, i refers to the modules with + same color." */ /* Vertical */ for (x = 0; x < size; x++) { @@ -1351,8 +1359,8 @@ static void hx_apply_bitmask(unsigned char *grid, const int size, const int vers unsigned char mask[size_squared]; unsigned char local[size_squared]; #else - unsigned char *mask = (unsigned char *) _alloca(size_squared * sizeof(unsigned char)); - unsigned char *local = (unsigned char *) _alloca(size_squared * sizeof(unsigned char)); + unsigned char *mask = (unsigned char *) _alloca(size_squared); + unsigned char *local = (unsigned char *) _alloca(size_squared); #endif /* Perform data masking */ @@ -1569,7 +1577,8 @@ INTERNAL int han_xin(struct zint_symbol *symbol, unsigned char source[], int len /* If there is spare capacity, increase the level of ECC */ - if (symbol->option_1 == -1 || symbol->option_1 != ecc_level) { /* Unless explicitly specified (within min/max bounds) by user */ + /* Unless explicitly specified (within min/max bounds) by user */ + if (symbol->option_1 == -1 || symbol->option_1 != ecc_level) { if ((ecc_level == 1) && (codewords < hx_data_codewords_L2[version - 1])) { ecc_level = 2; data_codewords = hx_data_codewords_L2[version - 1]; @@ -1595,10 +1604,10 @@ INTERNAL int han_xin(struct zint_symbol *symbol, unsigned char source[], int len unsigned char picket_fence[hx_total_codewords[version - 1]]; unsigned char grid[size_squared]; #else - datastream = (unsigned char *) _alloca((data_codewords) * sizeof (unsigned char)); - fullstream = (unsigned char *) _alloca((hx_total_codewords[version - 1]) * sizeof (unsigned char)); - picket_fence = (unsigned char *) _alloca((hx_total_codewords[version - 1]) * sizeof (unsigned char)); - grid = (unsigned char *) _alloca(size_squared * sizeof(unsigned char)); + datastream = (unsigned char *) _alloca(data_codewords); + fullstream = (unsigned char *) _alloca(hx_total_codewords[version - 1]); + picket_fence = (unsigned char *) _alloca(hx_total_codewords[version - 1]); + grid = (unsigned char *) _alloca(size_squared); #endif memset(datastream, 0, data_codewords); @@ -1657,6 +1666,7 @@ INTERNAL int han_xin(struct zint_symbol *symbol, unsigned char source[], int len } symbol->row_height[i] = 1; } + symbol->height = size; return 0; } diff --git a/backend/imail.c b/backend/imail.c index 37c17fd1..ccb23fd9 100644 --- a/backend/imail.c +++ b/backend/imail.c @@ -242,6 +242,8 @@ static unsigned short USPS_MSB_Math_CRC11GenerateFrameCheckSequence(unsigned cha return FrameCheckSequence; } +INTERNAL int daft_set_height(struct zint_symbol *symbol, float min_height, float max_height); + INTERNAL int imail(struct zint_symbol *symbol, unsigned char source[], int length) { char data_pattern[200]; int error_number; @@ -432,10 +434,22 @@ INTERNAL int imail(struct zint_symbol *symbol, unsigned char source[], int lengt read += 2; } - symbol->row_height[0] = 3; - symbol->row_height[1] = 2; - symbol->row_height[2] = 3; - +#ifdef COMPLIANT_HEIGHTS + /* USPS-B-3200 Section 2.3.1 + Using bar pitch as X (1" / 43) ~ 0.023" based on 22 bars + 21 spaces per inch (bar width 0.015" - 0.025"), + height 0.125" - 0.165" + Tracker 0.048" (average of 0.039" - 0.057") + Ascender/descender 0.0965" (average of 0.082" - 0.111") less T = 0.0485" + */ + symbol->row_height[0] = 0.0485f * 43; /* 2.0855 */ + symbol->row_height[1] = 0.048f * 43; /* 2.064 */ + /* Note using max X for minimum and min X for maximum */ + error_number = daft_set_height(symbol, 0.125f * 39 /*4.875*/, 0.165f * 47 /*7.755*/); +#else + symbol->row_height[0] = 3.0f; + symbol->row_height[1] = 2.0f; + daft_set_height(symbol, 0.0f, 0.0f); +#endif symbol->rows = 3; symbol->width = read - 1; return error_number; diff --git a/backend/library.c b/backend/library.c index cb8f62a7..a8ee2145 100644 --- a/backend/library.c +++ b/backend/library.c @@ -127,18 +127,26 @@ void ZBarcode_Delete(struct zint_symbol *symbol) { INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN system barcodes */ INTERNAL int c39(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 3 from 9 (or Code 39) */ -INTERNAL int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmazentral Nummer (PZN) */ -INTERNAL int ec39(struct zint_symbol *symbol, unsigned char source[], int length); /* Extended Code 3 from 9 (or Code 39+) */ -INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int length); /* Codabar - a simple substitution cipher */ -INTERNAL int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Standard (& Matrix) */ -INTERNAL int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Industrial */ +/* Pharmazentral Nummer (PZN) */ +INTERNAL int pharmazentral(struct zint_symbol *symbol, unsigned char source[], int length); +/* Extended Code 3 from 9 (or Code 39+) */ +INTERNAL int ec39(struct zint_symbol *symbol, unsigned char source[], int length); +/* Codabar - a simple substitution cipher */ +INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int length); +/* Code 2 of 5 Standard (& Matrix) */ +INTERNAL int matrix_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); +/* Code 2 of 5 Industrial */ +INTERNAL int industrial_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); INTERNAL int iata_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 IATA */ -INTERNAL int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Interleaved */ -INTERNAL int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 2 of 5 Data Logic */ +/* Code 2 of 5 Interleaved */ +INTERNAL int interleaved_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); +/* Code 2 of 5 Data Logic */ +INTERNAL int logic_two_of_five(struct zint_symbol *symbol, unsigned char source[], int length); INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int length); /* ITF-14 */ INTERNAL int dpleit(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Leitcode */ INTERNAL int dpident(struct zint_symbol *symbol, unsigned char source[], int length); /* Deutsche Post Identcode */ -INTERNAL int c93(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 93 - a re-working of Code 39+, generates 2 check digits */ +/* Code 93 - a re-working of Code 39+, generates 2 check digits */ +INTERNAL int c93(struct zint_symbol *symbol, unsigned char source[], int length); INTERNAL int code_128(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 128 and NVE-18 */ INTERNAL int ean_128(struct zint_symbol *symbol, unsigned char source[], int length); /* EAN-128 (GS1-128) */ INTERNAL int code_11(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 11 */ @@ -152,9 +160,11 @@ INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length) INTERNAL int pharma_two(struct zint_symbol *symbol, unsigned char source[], int length); /* Pharmacode Two Track */ INTERNAL int post_plot(struct zint_symbol *symbol, unsigned char source[], int length); /* Postnet */ INTERNAL int planet_plot(struct zint_symbol *symbol, unsigned char source[], int length); /* PLANET */ -INTERNAL int imail(struct zint_symbol *symbol, unsigned char source[], int length); /* Intelligent Mail (aka USPS OneCode) */ +/* Intelligent Mail (aka USPS OneCode) */ +INTERNAL int imail(struct zint_symbol *symbol, unsigned char source[], int length); INTERNAL int royal_plot(struct zint_symbol *symbol, unsigned char source[], int length); /* RM4SCC */ -INTERNAL int australia_post(struct zint_symbol *symbol, unsigned char source[], int length); /* Australia Post 4-state */ +/* Australia Post 4-state */ +INTERNAL int australia_post(struct zint_symbol *symbol, unsigned char source[], int length); INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int length); /* Code 16k */ INTERNAL int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int length); /* PDF417 */ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length); /* Micro PDF417 */ @@ -183,8 +193,10 @@ INTERNAL int codablock(struct zint_symbol *symbol, unsigned char source[], int l INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int length); /* UPNQR */ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int length); /* QR Code */ INTERNAL int dmatrix(struct zint_symbol *symbol, unsigned char source[], int length); /* Data Matrix (IEC16022) */ -INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length); /* VIN Code (Vehicle Identification Number) */ -INTERNAL int mailmark(struct zint_symbol *symbol, unsigned char source[], int length); /* Royal Mail 4-state Mailmark */ +/* VIN Code (Vehicle Identification Number) */ +INTERNAL int vin(struct zint_symbol *symbol, unsigned char source[], int length); +/* Royal Mail 4-state Mailmark */ +INTERNAL int mailmark(struct zint_symbol *symbol, unsigned char source[], int length); INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int length); /* Ultracode */ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length); /* rMQR */ INTERNAL int dpd_parcel(struct zint_symbol *symbol, unsigned char source[], int length); /* DPD Code */ @@ -192,6 +204,7 @@ INTERNAL int dpd_parcel(struct zint_symbol *symbol, unsigned char source[], int INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to EPS/EMF/SVG */ +/* Prefix error message with Error/Warning */ STATIC_UNLESS_ZINT_TEST int error_tag(char error_string[100], int error_number) { if (error_number != 0) { @@ -358,37 +371,6 @@ static int hibc(struct zint_symbol *symbol, unsigned char source[], int length) return error_number; } -static void check_row_heights(struct zint_symbol *symbol) { - /* Check that rows with undefined heights are never less than 5x */ - int large_bar_count = 0; - int i; - int preset_height = 0; - int large_bar_height = 0; - - for (i = 0; i < symbol->rows; i++) { - preset_height += symbol->row_height[i]; - if (symbol->row_height[i] == 0) { - large_bar_count++; - } - } - - if (large_bar_count == 0) { - symbol->height = preset_height; - } else { - large_bar_height = (symbol->height - preset_height) / large_bar_count; - } - - if (large_bar_height < 5) { - for (i = 0; i < symbol->rows; i++) { - if (symbol->row_height[i] == 0) { - symbol->row_height[i] = 5; - preset_height += 5; - } - } - symbol->height = preset_height; - } -} - static int check_force_gs1(const int symbology) { /* Returns 1 if symbology MUST have GS1 data */ @@ -476,70 +458,6 @@ static int is_fixed_ratio(const int symbology) { return result; } -static int is_linear(const int symbology) { - /* Returns 1 if symbology is linear (1 dimensional) */ - - int result = 0; - switch (symbology) { - case BARCODE_CODE11: - case BARCODE_C25STANDARD: - case BARCODE_C25INTER: - case BARCODE_C25IATA: - case BARCODE_C25LOGIC: - case BARCODE_C25IND: - case BARCODE_CODE39: - case BARCODE_EXCODE39: - case BARCODE_EANX: - case BARCODE_EANX_CHK: - case BARCODE_GS1_128: - case BARCODE_CODABAR: - case BARCODE_CODE128: - case BARCODE_DPLEIT: - case BARCODE_DPIDENT: - case BARCODE_CODE93: - case BARCODE_FLAT: - case BARCODE_DBAR_OMN: - case BARCODE_DBAR_LTD: - case BARCODE_DBAR_EXP: - case BARCODE_TELEPEN: - case BARCODE_UPCA: - case BARCODE_UPCA_CHK: - case BARCODE_UPCE: - case BARCODE_UPCE_CHK: - case BARCODE_MSI_PLESSEY: - case BARCODE_FIM: - case BARCODE_LOGMARS: - case BARCODE_PHARMA: - case BARCODE_PZN: - case BARCODE_CODE128B: - case BARCODE_ISBNX: - case BARCODE_EAN14: - case BARCODE_NVE18: - case BARCODE_KOREAPOST: - case BARCODE_USPS_IMAIL: - case BARCODE_PLESSEY: - case BARCODE_TELEPEN_NUM: - case BARCODE_ITF14: - case BARCODE_HIBC_128: - case BARCODE_HIBC_39: - case BARCODE_CODE32: - case BARCODE_EANX_CC: - case BARCODE_GS1_128_CC: - case BARCODE_DBAR_OMN_CC: - case BARCODE_DBAR_LTD_CC: - case BARCODE_DBAR_EXP_CC: - case BARCODE_UPCA_CC: - case BARCODE_UPCE_CC: - case BARCODE_CHANNEL: - case BARCODE_VIN: - case BARCODE_DPD: - result = 1; - break; - } - - return result; -} - static int supports_eci(const int symbology) { /* Returns 1 if symbology can encode the ECI character */ @@ -763,10 +681,6 @@ static int reduced_charset(struct zint_symbol *symbol, unsigned char *source, in } } - if ((symbol->height == 0) && is_linear(symbol->symbology)) { - symbol->height = 50; - } - switch (symbol->symbology) { case BARCODE_C25STANDARD: error_number = matrix_two_of_five(symbol, preprocessed, in_length); break; @@ -1332,7 +1246,9 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int (void)error_tag(symbol->errtxt, error_number); if (error_number < ZINT_ERROR) { - check_row_heights(symbol); + if (symbol->height < 0.5f) { /* Absolute minimum */ + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); + } } return error_number; @@ -1515,7 +1431,8 @@ int ZBarcode_Encode_and_Buffer(struct zint_symbol *symbol, unsigned char *input, return error_number; } -int ZBarcode_Encode_and_Buffer_Vector(struct zint_symbol *symbol, unsigned char *input, int length, int rotate_angle) { +int ZBarcode_Encode_and_Buffer_Vector(struct zint_symbol *symbol, unsigned char *input, int length, + int rotate_angle) { int error_number; int first_err; diff --git a/backend/mailmark.c b/backend/mailmark.c index 7db032f7..627318d9 100644 --- a/backend/mailmark.c +++ b/backend/mailmark.c @@ -120,6 +120,8 @@ static int verify_postcode(char* postcode, int type) { return 0; } +INTERNAL int daft_set_height(struct zint_symbol *symbol, float min_height, float max_height); + /* Royal Mail Mailmark */ INTERNAL int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { @@ -143,6 +145,7 @@ INTERNAL int mailmark(struct zint_symbol *symbol, unsigned char source[], int le int check_count; int i, j, len; rs_t rs; + int error_number = 0; if (length > 26) { strcpy(symbol->errtxt, "580: Input too long"); @@ -484,12 +487,24 @@ INTERNAL int mailmark(struct zint_symbol *symbol, unsigned char source[], int le j += 2; } - symbol->row_height[0] = 4; - symbol->row_height[1] = 2; - symbol->row_height[2] = 4; - +#ifdef COMPLIANT_HEIGHTS + /* Royal Mail Mailmark Barcode Definition Document (15 Sept 2015) Section 3.5.1 + https://www.royalmail.com/sites/default/files/Royal-Mail-Mailmark-barcode-definition-document-September-2015.pdf + Using bar pitch as X (25.4mm / 42.3) ~ 0.6mm based on 21.2 bars + 21.1 spaces per 25.4mm (bar width 0.38-63mm) + Using recommended 1.9mm and 1.3mm heights for Ascender/Descenders and Trackers resp. as defaults + Min height 4.22mm * 39 (max pitch) / 25.4mm ~ 6.47, max height 5.84mm * 47 (min pitch) / 25.4mm ~ 10.8 + */ + symbol->row_height[0] = (float) ((1.9 * 42.3) / 25.4); /* ~3.16 */ + symbol->row_height[1] = (float) ((1.3 * 42.3) / 25.4); /* ~2.16 */ + /* Note using max X for minimum and min X for maximum */ + error_number = daft_set_height(symbol, (float) ((4.22 * 39) / 25.4), (float) ((5.84 * 47) / 25.4)); +#else + symbol->row_height[0] = 4.0f; + symbol->row_height[1] = 2.0f; + daft_set_height(symbol, 0.0f, 0.0f); +#endif symbol->rows = 3; symbol->width = j - 1; - return 0; + return error_number; } diff --git a/backend/maxicode.c b/backend/maxicode.c index 535bae35..ec4a28c4 100644 --- a/backend/maxicode.c +++ b/backend/maxicode.c @@ -114,7 +114,8 @@ static void maxi_bump(unsigned char set[], unsigned char character[], const int } /* If the value is present in array, return the value, else return badvalue */ -static int value_in_array(const unsigned char val, const unsigned char arr[], const int badvalue, const int arrLength) { +static int value_in_array(const unsigned char val, const unsigned char arr[], const int badvalue, + const int arrLength) { int i; for (i = 0; i < arrLength; i++) { if (arr[i] == val) return val; @@ -124,8 +125,8 @@ static int value_in_array(const unsigned char val, const unsigned char arr[], co /* Choose the best set from previous and next set in the range of the setval array, if no value can be found we * return setval[0] */ -static int bestSurroundingSet(const int index, const int length, const unsigned char set[], const unsigned char setval[], - const int setLength) { +static int bestSurroundingSet(const int index, const int length, const unsigned char set[], + const unsigned char setval[], const int setLength) { int badValue = -1; int option1 = value_in_array(set[index - 1], setval, badValue, setLength); if (index + 1 < length) { @@ -143,8 +144,8 @@ static int bestSurroundingSet(const int index, const int length, const unsigned } /* Format text according to Appendix A */ -static int maxi_text_process(unsigned char maxi_codeword[144], const int mode, const unsigned char in_source[], int length, - const int eci, const int scm_vv, const int debug_print) { +static int maxi_text_process(unsigned char maxi_codeword[144], const int mode, const unsigned char in_source[], + int length, const int eci, const int scm_vv, const int debug_print) { unsigned char set[144], character[144] = {0}; int i, count, current_set, padding_set; @@ -485,8 +486,8 @@ static int maxi_text_process(unsigned char maxi_codeword[144], const int mode, c } /* Format structured primary for Mode 2 */ -static void maxi_do_primary_2(unsigned char maxi_codeword[144], const unsigned char postcode[], const int postcode_length, - const int country, const int service) { +static void maxi_do_primary_2(unsigned char maxi_codeword[144], const unsigned char postcode[], + const int postcode_length, const int country, const int service) { int postcode_num; postcode_num = atoi((const char *) postcode); @@ -692,5 +693,8 @@ INTERNAL int maxicode(struct zint_symbol *symbol, unsigned char source[], int le symbol->width = 30; symbol->rows = 33; + /* Note MaxiCode fixed size so symbol height ignored but set anyway */ + (void) set_height(symbol, 5.0f, 0.0f, 0.0f, 1 /*no_errtxt*/); + return error_number; } diff --git a/backend/medical.c b/backend/medical.c index 6e125171..b5bb5614 100644 --- a/backend/medical.c +++ b/backend/medical.c @@ -105,6 +105,13 @@ INTERNAL int pharma_one(struct zint_symbol *symbol, unsigned char source[], int expand(symbol, dest); +#ifdef COMPLIANT_HEIGHTS + /* Laetus Pharmacode Guide 1.2 Standard one-track height 8mm / 0.5mm (X) */ + error_number = set_height(symbol, 16.0f, 0.0f, 0.0f, 0 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); +#endif + return error_number; } @@ -158,7 +165,8 @@ INTERNAL int pharma_two(struct zint_symbol *symbol, unsigned char source[], int char height_pattern[200]; unsigned int loopey, h; int writer; - int error_number = 0; + int error_number; + strcpy(height_pattern, ""); if (length > 8) { @@ -189,6 +197,13 @@ INTERNAL int pharma_two(struct zint_symbol *symbol, unsigned char source[], int symbol->rows = 2; symbol->width = writer - 1; +#ifdef COMPLIANT_HEIGHTS + /* Laetus Pharmacode Guide 1.4 + Two-track height min 8mm / 2mm (X max) = 4, standard 8mm / 1mm = 8, max 12mm / 0.8mm (X min) = 15 */ + error_number = set_height(symbol, 2.0f, 8.0f, 15.0f, 0 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 10.0f, 0.0f, 1 /*no_errtxt*/); +#endif return error_number; } @@ -199,6 +214,8 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len int i, error_number; char dest[512]; int add_checksum, count = 0, checksum; + int d_chars = 0; + float height; strcpy(dest, ""); @@ -207,7 +224,7 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len return ZINT_ERROR_TOO_LONG; } /* BS EN 798:1995 4.2 "'Codabar' symbols shall consist of ... b) start character; - * c) one or more symbol characters representing data ... d) stop character ..." */ + c) one or more symbol characters representing data ... d) stop character ..." */ if (length < 3) { strcpy(symbol->errtxt, "362: Input too short (3 character minimum)"); return ZINT_ERROR_TOO_LONG; @@ -255,16 +272,36 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len } } lookup(calcium, CodaTable, source[i], dest); + if (source[i] == '/' || source[i] == ':' || source[i] == '.' || source[i] == '+') { /* Wide data characters */ + d_chars++; + } } expand(symbol, dest); + +#ifdef COMPLIANT_HEIGHTS + /* BS EN 798:1995 4.4.1 (d) max of 5mm / 0.191mm (X) ~ 26.178 or 15% of width where (taking N = narrow/wide ratio + as 2 and I = X) width = ((2 * N + 5) * C + (N – 1) * (D + 2)) * X + I * (C – 1) + 2Q + = ((4 + 5) * C + (D + 2) + C - 1 + 2 * 10) * X = (10 * C + D + 21) * X + Length (C) includes start/stop chars */ + height = (float) ((10.0 * ((add_checksum ? length + 1 : length) + 2.0) + d_chars + 21.0) * 0.15); + if (height < (float) (5.0 / 0.191)) { + height = (float) (5.0 / 0.191); + } + /* Using 50 as default as none recommended */ + error_number = set_height(symbol, height, height > 50.0f ? height : 50.0f, 0.0f, 0 /*no_errtxt*/); +#else + height = 50.0f; + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); +#endif + ustrcpy(symbol->text, source); return error_number; } /* Italian Pharmacode */ INTERNAL int code32(struct zint_symbol *symbol, unsigned char source[], int length) { - int i, zeroes, error_number, checksum, checkpart, checkdigit; + int i, zeroes, error_number = 0, checksum, checkpart, checkdigit; char localstr[10], risultante[7]; long int pharmacode, devisor; int codeword[6]; @@ -329,6 +366,16 @@ INTERNAL int code32(struct zint_symbol *symbol, unsigned char source[], int leng return error_number; } +#ifdef COMPLIANT_HEIGHTS + /* Allegato A Caratteristiche tecniche del bollino farmaceutico + https://www.gazzettaufficiale.it/do/atto/serie_generale/caricaPdf?cdimg=14A0566800100010110001&dgu=2014-07-18&art.dataPubblicazioneGazzetta=2014-07-18&art.codiceRedazionale=14A05668&art.num=1&art.tiposerie=SG + X given as 0.250mm; height (and quiet zones) left to ISO/IEC 16388:2007 (Code 39) + So min height 5mm = 5mm / 0.25mm = 20 > 15% of width, i.e. (10 * 8 + 19) * 0.15 = 14.85 */ + error_number = set_height(symbol, 20.0f, 20.0f, 0.0f, 0 /*no_errtxt*/); /* Use as default also */ +#else + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); +#endif + /* Override the normal text output with the Pharmacode number */ ustrcpy(symbol->text, "A"); ustrcat(symbol->text, localstr); diff --git a/backend/output.c b/backend/output.c index c29b6c7f..ebf4bf66 100644 --- a/backend/output.c +++ b/backend/output.c @@ -30,8 +30,10 @@ */ /* vim: set ts=4 sw=4 et : */ +#include #include "common.h" #include "output.h" +#include "font.h" #define SSET "0123456789ABCDEF" @@ -67,36 +69,34 @@ INTERNAL int output_check_colour_options(struct zint_symbol *symbol) { } /* Return minimum quiet zones for each symbology */ -static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *top, int *bottom) { +static int quiet_zones(struct zint_symbol *symbol, float *left, float *right, float *top, float *bottom) { int done = 0; - *left = *right = *top = *bottom = 0; + *left = *right = *top = *bottom = 0.0f; /* These always have quiet zones set (previously used whitespace_width) */ switch (symbol->symbology) { case BARCODE_CODE16K: /* BS EN 12323:2005 Section 4.5 (c) */ - *left = 10; - *right = 1; + *left = 10.0f; + *right = 1.0f; done = 1; break; case BARCODE_CODE49: /* ANSI/AIM BC6-2000 Section 2.4 */ - *left = 10; - *right = 1; + *left = 10.0f; + *right = 1.0f; done = 1; break; case BARCODE_CODABLOCKF: case BARCODE_HIBC_BLOCKF: /* AIM ISS-X-24 Section 4.6.1 */ - *left = 10; - *right = 10; + *left = *right = 10.0f; done = 1; break; case BARCODE_ITF14: /* GS1 General Specifications 21.0.1 Section 5.3.2.2 */ - *left = 10; - *right = 10; + *left = *right = 10.0f; done = 1; break; case BARCODE_EANX: @@ -106,22 +106,21 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t /* GS1 General Specifications 21.0.1 Section 5.2.3.4 */ switch (ustrlen(symbol->text)) { case 13: /* EAN-13 */ - *left = 11; - *right = 7; + *left = 11.0f; + *right = 7.0f; break; case 16: /* EAN-13/ISBN + 2 digit addon */ case 19: /* EAN-13/ISBN + 5 digit addon */ - *left = 11; - *right = 5; + *left = 11.0f; + *right = 5.0f; break; case 5: /* EAN-5 addon */ case 2: /* EAN-2 addon */ - *left = 7; - *right = 5; + *left = 7.0f; + *right = 5.0f; break; default: /* EAN-8 (+/- 2/5 digit addon) */ - *left = 7; - *right = 7; + *left = *right = 7.0f; break; } done = 1; @@ -130,11 +129,11 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t case BARCODE_UPCA_CHK: case BARCODE_UPCA_CC: /* GS1 General Specifications 21.0.1 Section 5.2.3.4 */ - *left = 9; + *left = 9.0f; if (ustrlen(symbol->text) > 12) { /* UPC-A + addon */ - *right = 5; + *right = 5.0f; } else { - *right = 9; + *right = 9.0f; } done = 1; break; @@ -142,11 +141,11 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t case BARCODE_UPCE_CHK: case BARCODE_UPCE_CC: /* GS1 General Specifications 21.0.1 Section 5.2.3.4 */ - *left = 9; + *left = 9.0f; if (ustrlen(symbol->text) > 8) { /* UPC-E + addon */ - *right = 5; + *right = 5.0f; } else { - *right = 7; + *right = 7.0f; } done = 1; break; @@ -167,15 +166,22 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t switch (symbol->symbology) { case BARCODE_CODE11: - /* TODO */ + /* No known standard. Following ITF-14, set to 10X */ + *left = *right = 10.0f; + done = 1; break; - case BARCODE_C25STANDARD: case BARCODE_C25INTER: + /* ISO/IEC 16390:2007 Section 4.4 10X */ + *left = *right = 10.0f; + done = 1; + break; + case BARCODE_C25STANDARD: case BARCODE_C25IATA: case BARCODE_C25LOGIC: case BARCODE_C25IND: - *left = *right = 10; // Probably this TODO: check + /* No known standards. Following C25INTER, set to 10X */ + *left = *right = 10.0f; done = 1; break; @@ -187,19 +193,19 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t case BARCODE_HIBC_39: case BARCODE_CODE32: /* ISO/IEC 16388:2007 Section 4.4 (d) */ - *left = *right = 10; + *left = *right = 10.0f; done = 1; break; case BARCODE_GS1_128: /* GS1-128 */ case BARCODE_GS1_128_CC: case BARCODE_EAN14: /* GS1 General Specifications 21.0.1 Section 5.4.4.2 */ - *left = *right = 10; + *left = *right = 10.0f; done = 1; break; case BARCODE_CODABAR: /* BS EN 798:1995 Section 4.4.1 (d) */ - *left = *right = 10; + *left = *right = 10.0f; done = 1; break; case BARCODE_CODE128: @@ -207,17 +213,20 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t case BARCODE_HIBC_128: case BARCODE_NVE18: /* ISO/IEC 15417:2007 4.4.2 */ - *left = *right = 10; + *left = *right = 10.0f; + done = 1; + break; + case BARCODE_DPLEIT: + case BARCODE_DPIDENT: + /* Using CODE39 values TODO: Find doc */ + *left = *right = 10.0f; done = 1; break; - case BARCODE_DPLEIT: - case BARCODE_DPIDENT: - /* TODO */ - break; - case BARCODE_CODE93: - /* TODO */ + /* ANSI/AIM BC5-1995 Section 2.4 */ + *left = *right = 10.0f; + done = 1; break; case BARCODE_FLAT: @@ -231,7 +240,6 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t case BARCODE_DBAR_OMNSTK: /* GS1 DataBar Stacked Omnidirectional */ case BARCODE_DBAR_EXPSTK: /* GS1 Databar Expanded Stacked */ /* GS1 General Specifications 21.0.1 Section 5.5.1.1 - Quiet Zones: None required */ - *left = *right = 0; done = 1; break; case BARCODE_DBAR_OMN_CC: @@ -241,7 +249,7 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t case BARCODE_DBAR_OMNSTK_CC: case BARCODE_DBAR_EXPSTK_CC: /* GS1 General Specifications 21.0.1 Sections 5.11.2.1 (CC-A) & 5.11.2.2 (CC-B) */ - *left = *right = 1; + *left = *right = 1.0f; done = 1; break; @@ -252,9 +260,10 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t case BARCODE_POSTNET: case BARCODE_PLANET: - /* Archived DMM C840 (Dec 09, 2004) left/right 0.125" ~ 6X, top/bottom 0.04" ~ 2X */ - *left = *right = 6; // TODO: Proper inch to X calc - *top = *bottom = 2; // TODO: Proper inch to X calc + /* USPS DMM 300 2006 (2011) 5.7 Barcode in Address Block + left/right 0.125" / 0.025" (X max) = 5, top/bottom 0.04" / 0.025" (X max) = 1.6 */ + *left = *right = 5.0f; + *top = *bottom = 1.6f; done = 1; break; @@ -263,72 +272,85 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t break; case BARCODE_FIM: - /* TODO */ + /* USPS DMM 300 2006 (2011) 708.9.3 (top/bottom zero) + right 0.125" (min) / 0.03925" (X max) ~ 3.18, left 1.25" - 0.66725" (max width of barcode) + - 0.375 (max right) = 0.20775" / 0.03925" (X max) ~ 5.29 */ + *right = (float) (0.125 / 0.03925); + *left = (float) (0.20775 / 0.03925); + done = 1; break; - case BARCODE_PHARMA: case BARCODE_PHARMA_TWO: - /* TODO */ + /* Laetus Pharmacode Guide 2.2 from 6mm depending on context, 6mm / 1mm (Pharma Two X) = 6 */ + *left = *right = 6.0f; + done = 1; break; - case BARCODE_PDF417: case BARCODE_PDF417COMP: case BARCODE_HIBC_PDF: /* ISO/IEC 15438:2015 Section 5.8.3 */ - *left = *right = *top = *bottom = 2; + *left = *right = *top = *bottom = 2.0f; done = 1; break; case BARCODE_MICROPDF417: case BARCODE_HIBC_MICPDF: /* ISO/IEC 24728:2006 Section 5.8.3 */ - *left = *right = *top = *bottom = 1; + *left = *right = *top = *bottom = 1.0f; done = 1; break; case BARCODE_MAXICODE: /* ISO/IEC 16023:2000 Section 4.11.5 */ - *left = *right = *top = *bottom = 1; + *left = *right = *top = *bottom = 1.0f; done = 1; break; case BARCODE_QRCODE: case BARCODE_UPNQR: case BARCODE_HIBC_QR: /* ISO/IEC 18004:2015 Section 9.1 */ - *left = *right = *top = *bottom = 4; + *left = *right = *top = *bottom = 4.0f; + done = 1; + break; + case BARCODE_DPD: + /* Specification DPD and primetime Parcel Despatch 4.0.2 Section 5.5.1 5mm / 0.4mm (X max) = 12.5 */ + *left = *right = 12.5f; done = 1; break; case BARCODE_MICROQR: /* ISO/IEC 18004:2015 Section 9.1 */ - *left = *right = *top = *bottom = 2; + *left = *right = *top = *bottom = 2.0f; done = 1; break; case BARCODE_RMQR: /* ISO/IEC JTC1/SC31N000 Section 6.3.10 */ - *left = *right = *top = *bottom = 2; + *left = *right = *top = *bottom = 2.0f; done = 1; break; case BARCODE_AUSPOST: case BARCODE_AUSREPLY: case BARCODE_AUSROUTE: case BARCODE_AUSREDIRECT: - /* Customer Barcode Technical Specifications (2012) left/right 6mm ~ 6X, top/bottom 2mm ~ 2X */ - *left = *right = 6; // TODO: Proper mm to X calc - *top = *bottom = 2; // TODO: Proper mm to X calc + /* Customer Barcode Technical Specifications (2012) left/right 6mm / 0.6mm = 10, + top/bottom 2mm / 0.6mm ~ 3.33 (X max) */ + *left = *right = 10.0f; + *top = *bottom = (float) (2.0 / 0.6); done = 1; break; - case BARCODE_RM4SCC: - /* TODO */ + /* Royal Mail Know How User's Manual Appendix C: using CBC, same as MAILMARK, 2mm all round, + use X max (25.4mm / 39) i.e. 20 bars per 25.4mm */ + *left = *right = *top = *bottom = (float) ((2.0 * 39.0) / 25.4); /* ~ 3.07 */ + done = 1; break; - case BARCODE_DATAMATRIX: case BARCODE_HIBC_DM: /* ISO/IEC 16022:2006 Section 7.1 */ - *left = *right = *top = *bottom = 1; + *left = *right = *top = *bottom = 1.0f; done = 1; break; - case BARCODE_JAPANPOST: - /* TODO */ + /* Japan Post Zip/Barcode Manual p.13 2mm all round, X 0.6mm, 2mm / 0.6mm ~ 3.33 */ + *left = *right = *top = *bottom = (float) (2.0 / 0.6); + done = 1; break; case BARCODE_KOREAPOST: @@ -336,9 +358,10 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t break; case BARCODE_USPS_IMAIL: - /* USPS-B-3200 (2015) Section 2.3.2 left/right 0.125" ~ 6X, top/bottom 0.026" ~ 1X */ - *left = *right = 6; // TODO: Proper inch to X calc - *top = *bottom = 1; // TODO: Proper inch to X calc + /* USPS-B-3200 (2015) Section 2.3.2 left/right 0.125", top/bottom 0.026", use X max (1 / 39) + i.e. 20 bars per inch */ + *left = *right = 0.125f * 39.0f; /* 4.875 */ + *top = *bottom = 0.026f * 39.0f; /* 1.014 */ done = 1; break; @@ -347,8 +370,8 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t break; case BARCODE_KIX: - /* Handleiding KIX code brochure left/right/top/bottom 2mm ~ 2X */ - *left = *right = *top = *bottom = 2; // TODO: Proper mm to X calc + /* Handleiding KIX code brochure - same as RM4SCC/MAILMARK */ + *left = *right = *top = *bottom = (float) ((2.0 * 39.0) / 25.4); /* ~ 3.07 */ done = 1; break; case BARCODE_AZTEC: @@ -357,32 +380,30 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t /* ISO/IEC 24778:2008 Section 4.1 (c) & Annex A.1 (Rune) - no quiet zone required */ done = 1; break; - case BARCODE_DAFT: - /* TODO */ + /* Generic so unlikely to be defined */ + done = 1; break; - case BARCODE_DOTCODE: /* ISS DotCode Rev. 4.0 Section 4.1 (3) (c) */ - *left = *right = *top = *bottom = 3; + *left = *right = *top = *bottom = 3.0f; done = 1; break; case BARCODE_HANXIN: /* ISO/IEC DIS 20830:2019 Section 4.2.8 (also Section 6.2) */ - *left = *right = *top = *bottom = 3; + *left = *right = *top = *bottom = 3.0f; done = 1; break; - case BARCODE_MAILMARK: - /* User Guide left/right/top/bottom 2mm ~ 2X */ - *left = *right = *top = *bottom = 2; // TODO: Proper mm to X calc + /* Royal Mail Mailmark Barcode Definition Document Section 3.5.2, 2mm all round, use X max (25.4mm / 39) + i.e. 20 bars per 25.4mm */ + *left = *right = *top = *bottom = (float) ((2.0 * 39.0) / 25.4); /* ~ 3.07 */ done = 1; break; - case BARCODE_CHANNEL: /* ANSI/AIM BC12-1998 Section 4.4 (c) */ - *left = 1; - *right = 2; + *left = 1.0f; + *right = 2.0f; done = 1; break; @@ -392,12 +413,12 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t case BARCODE_GRIDMATRIX: /* AIMD014 (v 1.63) Section 7.1 */ - *left = *right = *top = *bottom = 6; + *left = *right = *top = *bottom = 6.0f; done = 1; break; case BARCODE_ULTRA: /* AIMD/TSC15032-43 (v 0.99c) Section 9.2 */ - *left = *right = *top = *bottom = 1; + *left = *right = *top = *bottom = 1.0f; done = 1; break; } @@ -406,8 +427,9 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t } /* Set left (x), top (y), right and bottom offsets for whitespace */ -INTERNAL void output_set_whitespace_offsets(struct zint_symbol *symbol, int *xoffset, int *yoffset, int *roffset, int *boffset) { - int qz_left, qz_right, qz_top, qz_bottom; +INTERNAL void output_set_whitespace_offsets(struct zint_symbol *symbol, float *xoffset, float *yoffset, + float *roffset, float *boffset) { + float qz_left, qz_right, qz_top, qz_bottom; quiet_zones(symbol, &qz_left, &qz_right, &qz_top, &qz_bottom); @@ -426,8 +448,10 @@ INTERNAL void output_set_whitespace_offsets(struct zint_symbol *symbol, int *xof } } -/* Set composite offset and main width excluding addon (for start of addon calc) and addon text, returning UPC/EAN type */ -INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width, int *p_comp_offset, unsigned char addon[6], int *p_addon_gap) { +/* Set composite offset and main width excluding addon (for start of addon calc) and addon text, returning + UPC/EAN type */ +INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width, int *p_comp_offset, + unsigned char addon[6], int *p_addon_gap) { int main_width; /* Width of main linear symbol, excluding addon */ int comp_offset; /* Whitespace offset (if any) of main linear symbol due to having composite */ int upceanflag; /* UPC/EAN type flag */ @@ -447,7 +471,8 @@ INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width } addon[j] = '\0'; if (latch) { - if (symbol->symbology == BARCODE_UPCA || symbol->symbology == BARCODE_UPCA_CHK || symbol->symbology == BARCODE_UPCA_CC) { + 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; } else { *p_addon_gap = symbol->option_2 >= 7 && symbol->option_2 <= 12 ? symbol->option_2 : 7; @@ -502,24 +527,50 @@ INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width return upceanflag; } -/* Calculate large bar height i.e. linear bars */ -INTERNAL float output_large_bar_height(struct zint_symbol *symbol) { - int i, large_bar_count, preset_height; +/* 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 to nearest + pixel and symbol height adjusted */ +INTERNAL float output_large_bar_height(struct zint_symbol *symbol, int si) { + float fixed_height = 0.0f; + int zero_count = 0; + int round_rows = 0; + int i; float large_bar_height; - large_bar_count = 0; - preset_height = 0; for (i = 0; i < symbol->rows; i++) { - preset_height += symbol->row_height[i]; - if (symbol->row_height[i] == 0) { - large_bar_count++; + if (symbol->row_height[i]) { + fixed_height += symbol->row_height[i]; + if (!round_rows && si && symbol->row_height[i] * si != (int) (symbol->row_height[i] * si)) { + round_rows = 1; + } + } else { + zero_count++; } } - if (large_bar_count) { - large_bar_height = (float) (symbol->height - preset_height) / large_bar_count; + if (zero_count) { + large_bar_height = (symbol->height - fixed_height) / zero_count; + if (large_bar_height <= 0.0f) { /* Shouldn't happen but protect against memory access violations */ + large_bar_height = 0.01f; /* Token positive value */ + symbol->height = large_bar_height * zero_count + fixed_height; + } + if (si && large_bar_height * si != (int) (large_bar_height * si)) { + large_bar_height = (float) (round(large_bar_height * si) / si); + symbol->height = large_bar_height * zero_count + fixed_height; + } + /* Note should never happen that have both zero_count and round_rows */ } else { - large_bar_height = 0.0f; /* Not used if large_bar_count zero */ + large_bar_height = 0.0f; /* Not used if zero_count zero */ + if (round_rows) { + fixed_height = 0.0f; + for (i = 0; i < symbol->rows; i++) { + if (symbol->row_height[i] * si != (int) (symbol->row_height[i] * si)) { + symbol->row_height[i] = (float) (round(symbol->row_height[i] * si) / si); + } + fixed_height += symbol->row_height[i]; + } + symbol->height = fixed_height; + } } return large_bar_height; @@ -527,7 +578,8 @@ INTERNAL float output_large_bar_height(struct zint_symbol *symbol) { /* Split UPC/EAN add-on text into various constituents */ INTERNAL void output_upcean_split_text(int upceanflag, unsigned char text[], - unsigned char textpart1[5], unsigned char textpart2[7], unsigned char textpart3[7], unsigned char textpart4[2]) { + unsigned char textpart1[5], unsigned char textpart2[7], unsigned char textpart3[7], + unsigned char textpart4[2]) { int i; if (upceanflag == 6) { /* UPC-E */ diff --git a/backend/output.h b/backend/output.h index 32794c0b..25d66e10 100644 --- a/backend/output.h +++ b/backend/output.h @@ -38,11 +38,14 @@ extern "C" { #endif /* __cplusplus */ INTERNAL int output_check_colour_options(struct zint_symbol *symbol); -INTERNAL void output_set_whitespace_offsets(struct zint_symbol *symbol, int *xoffset, int *yoffset, int *roffset, int *boffset); -INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width, int *p_comp_offset, unsigned char addon[6], int *p_addon_gap); -INTERNAL float output_large_bar_height(struct zint_symbol *symbol); +INTERNAL void output_set_whitespace_offsets(struct zint_symbol *symbol, float *xoffset, float *yoffset, + float *roffset, float *boffset); +INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width, int *p_comp_offset, + unsigned char addon[6], int *p_addon_gap); +INTERNAL float output_large_bar_height(struct zint_symbol *symbol, int si); INTERNAL void output_upcean_split_text(int upceanflag, unsigned char text[], - unsigned char textpart1[], unsigned char textpart2[], unsigned char textpart3[], unsigned char textpart4[]); + unsigned char textpart1[], unsigned char textpart2[], unsigned char textpart3[], + unsigned char textpart4[]); #ifdef __cplusplus } diff --git a/backend/pdf417.c b/backend/pdf417.c index 094e4958..90e1aec2 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -509,11 +509,11 @@ static void numbprocess(int *chainemc, int *mclength, char chaine[], int start, /* 366 */ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int length) { int i, k, j, indexchaine, indexliste, mode, longueur, loop, mccorrection[520] = {0}, offset; - int total, chainemc[PDF417_MAX_LEN], mclength, c1, c2, c3, dummy[35], calcheight; + int total, chainemc[PDF417_MAX_LEN], mclength, c1, c2, c3, dummy[35]; int liste[2][PDF417_MAX_LEN] = {{0}}; char pattern[580]; int bp = 0; - int error_number = 0; + int error_number; int debug = symbol->debug & ZINT_DEBUG_PRINT; if (length > PDF417_MAX_LEN) { @@ -784,15 +784,8 @@ static int pdf417(struct zint_symbol *symbol, unsigned char chaine[], const int } symbol->width = bp; - /* Allow user to adjust height of symbol, but enforce minimum row height of 3X */ - calcheight = (int)(symbol->height / i); - if (calcheight < 3) { - calcheight = 3; - } - - for (j = 0; j < i; j++) { - symbol->row_height[j] = calcheight; - } + /* ISO/IEC 15438:2015 Section 5.8.2 3X minimum row height */ + error_number = set_height(symbol, 3.0f, 0.0f, 0.0f, 0 /*no_errtxt*/); /* 843 */ return error_number; @@ -838,12 +831,12 @@ INTERNAL int pdf417enc(struct zint_symbol *symbol, unsigned char source[], int l /* like PDF417 only much smaller! */ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], int length) { int i, k, j, indexchaine, indexliste, mode, longueur, mccorrection[50] = {0}, offset; - int total, chainemc[PDF417_MAX_LEN], mclength, codeerr; + int total, chainemc[PDF417_MAX_LEN], mclength, error_number = 0; int liste[2][PDF417_MAX_LEN] = {{0}}; char pattern[580]; int bp = 0; int variant, LeftRAPStart, CentreRAPStart, RightRAPStart, StartCluster; - int LeftRAP, CentreRAP, RightRAP, Cluster, loop, calcheight; + int LeftRAP, CentreRAP, RightRAP, Cluster, loop; int debug = symbol->debug & ZINT_DEBUG_PRINT; if (length > MICRO_PDF417_MAX_LEN) { @@ -852,7 +845,6 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in } /* Encoding starts out the same as PDF417, so use the same code */ - codeerr = 0; /* 456 */ indexliste = 0; @@ -954,7 +946,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in return ZINT_ERROR_INVALID_OPTION; } else { symbol->option_2 = 0; - codeerr = ZINT_WARN_INVALID_OPTION; + error_number = ZINT_WARN_INVALID_OPTION; } } @@ -977,7 +969,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in return ZINT_ERROR_INVALID_OPTION; } else { symbol->option_2 = 0; - codeerr = ZINT_WARN_INVALID_OPTION; + error_number = ZINT_WARN_INVALID_OPTION; } } @@ -988,7 +980,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in return ZINT_ERROR_INVALID_OPTION; } else { symbol->option_2 = 0; - codeerr = ZINT_WARN_INVALID_OPTION; + error_number = ZINT_WARN_INVALID_OPTION; } } @@ -999,7 +991,7 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in return ZINT_ERROR_INVALID_OPTION; } else { symbol->option_2 = 0; - codeerr = ZINT_WARN_INVALID_OPTION; + error_number = ZINT_WARN_INVALID_OPTION; } } @@ -1208,7 +1200,6 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in set_module(symbol, i, loop); } } - symbol->row_height[i] = 2; /* Set up RAPs and Cluster for next row */ LeftRAP++; @@ -1231,15 +1222,12 @@ INTERNAL int micro_pdf417(struct zint_symbol *symbol, unsigned char chaine[], in } symbol->width = bp; - /* Allow user to adjust height of symbol, but enforce minimum row height of 2X */ - calcheight = (int)(symbol->height / i); - if (calcheight < 2) { - calcheight = 2; - } - - for (j = 0; j < i; j++) { - symbol->row_height[j] = calcheight; + /* ISO/IEC 24728:2006 Section 5.8.2 2X minimum row height */ + if (error_number) { + (void) set_height(symbol, 2.0f, 0.0f, 0.0f, 1 /*no_errtxt*/); + } else { + error_number = set_height(symbol, 2.0f, 0.0f, 0.0f, 0 /*no_errtxt*/); } - return codeerr; + return error_number; } diff --git a/backend/plessey.c b/backend/plessey.c index 24ff6185..cdb00b48 100644 --- a/backend/plessey.c +++ b/backend/plessey.c @@ -106,6 +106,8 @@ INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int len expand(symbol, dest); + // TODO: Find documentation on BARCODE_PLESSEY dimensions/height + symbol->text[0] = '\0'; ustrncat(symbol->text, source, length); @@ -338,5 +340,7 @@ INTERNAL int msi_handle(struct zint_symbol *symbol, unsigned char source[], int expand(symbol, dest); + // TODO: Find documentation on BARCODE_MSI_PLESSEY dimensions/height + return error_number; } diff --git a/backend/postal.c b/backend/postal.c index 41280ba9..dc4de9bf 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -83,6 +83,47 @@ static const char *JapanTable[19] = { "414", "324", "342", "234", "432", "243", "423", "441", "111" }; +/* Set height for POSTNET/PLANET codes, maintaining ratio */ +static int usps_set_height(struct zint_symbol *symbol) { + /* USPS Domestic Mail Manual (USPS DMM 300) Jan 8, 2006 (updated 2011) 708.4.2.5 POSTNET Barcode Dimensions and + Spacing + http://web.archive.org/web/20061113174253/http://pe.usps.com/cpim/ftp/manuals/dmm300/full/mailingStandards.pdf + Using bar pitch as X (1" / 43) ~ 0.023" based on 22 bars + 21 spaces per inch (bar width 0.015" - 0.025") + Half bar height 0.05" +- 0.01; 0.040" (min) / 0.025" (X max) = 1.6 min, 0.060" (max) / 0.015" (X min) = 4 max + Full bar height 0.125" +- 0.01; 0.115" (min) / 0.025" (X max) = 4.6 min, 0.135" (max) / 0.015" (X min) = 9 max + */ + int error_number = 0; + float h_ratio; /* Half ratio */ + +#ifdef COMPLIANT_HEIGHTS + symbol->row_height[0] = 0.075f * 43; /* 3.225 */ + symbol->row_height[1] = 0.05f * 43; /* 2.15 */ +#else + symbol->row_height[0] = 6.0f; + symbol->row_height[1] = 6.0f; +#endif + if (symbol->height) { + h_ratio = symbol->row_height[1] / (symbol->row_height[0] + symbol->row_height[1]); /* 0.4 */ + symbol->row_height[1] = symbol->height * h_ratio; + if (symbol->row_height[1] < 0.5f) { /* Absolute minimum */ + symbol->row_height[1] = 0.5f; + symbol->row_height[0] = 0.5f / h_ratio - 0.5f; /* 0.75 */ + } else { + symbol->row_height[0] = symbol->height - symbol->row_height[1]; + } + } + symbol->height = symbol->row_height[0] + symbol->row_height[1]; + +#ifdef COMPLIANT_HEIGHTS + if (symbol->height < 4.6f || symbol->height > 9.0f) { + error_number = ZINT_WARN_NONCOMPLIANT; + strcpy(symbol->errtxt, "498: Height not compliant with standards"); + } +#endif + + return error_number; +} + /* Handles the PostNet system used for Zip codes in the US */ static int postnet(struct zint_symbol *symbol, unsigned char source[], char dest[], int length) { int i, sum, check_digit; @@ -137,8 +178,7 @@ INTERNAL int post_plot(struct zint_symbol *symbol, unsigned char source[], int l set_module(symbol, 1, writer); writer += 2; } - symbol->row_height[0] = 6; - symbol->row_height[1] = 6; + error_number = usps_set_height(symbol); symbol->rows = 2; symbol->width = writer - 1; @@ -199,8 +239,7 @@ INTERNAL int planet_plot(struct zint_symbol *symbol, unsigned char source[], int set_module(symbol, 1, writer); writer += 2; } - symbol->row_height[0] = 6; - symbol->row_height[1] = 6; + error_number = usps_set_height(symbol); symbol->rows = 2; symbol->width = writer - 1; @@ -243,12 +282,15 @@ INTERNAL int korea_post(struct zint_symbol *symbol, unsigned char source[], int expand(symbol, dest); ustrcpy(symbol->text, (unsigned char*) localstr); + // TODO: Find documentation on BARCODE_KOREAPOST dimensions/height + return error_number; } /* The simplest barcode symbology ever! Supported by MS Word, so here it is! glyphs from http://en.wikipedia.org/wiki/Facing_Identification_Mark */ INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length) { + int error_number = 0; char dest[16] = {0}; if (length > 1) { @@ -281,7 +323,51 @@ INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length) expand(symbol, dest); - return 0; +#ifdef COMPLIANT_HEIGHTS + /* USPS Domestic Mail Manual (USPS DMM 300) Jan 8, 2006 (updated 2011) 708.9.3 + X 0.03125" (1/32) +- 0.008" so X max 0.03925", height 0.625" (5/8) +- 0.125" (1/8) */ + error_number = set_height(symbol, (float) (0.5 / 0.03925), 20.0f /*0.625 / 0.03125*/, (float) (0.75 / 0.02415), + 0 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); +#endif + + return error_number; +} + +/* Set height for DAFT-type codes, maintaining ratio. Expects row_height[0] & row_height[1] to be set */ +/* Used by auspost.c also */ +INTERNAL int daft_set_height(struct zint_symbol *symbol, float min_height, float max_height) { + int error_number = 0; + float t_ratio; /* Tracker ratio */ + + if (symbol->height) { + t_ratio = symbol->row_height[1] / (symbol->row_height[0] * 2 + symbol->row_height[1]); + symbol->row_height[1] = symbol->height * t_ratio; + if (symbol->row_height[1] < 0.5f) { /* Absolute minimum */ + symbol->row_height[1] = 0.5f; + symbol->row_height[0] = 0.25f / t_ratio - 0.25f; + } else { + symbol->row_height[0] = (symbol->height - symbol->row_height[1]) / 2.0f; + } + if (symbol->row_height[0] < 0.5f) { + symbol->row_height[0] = 0.5f; + symbol->row_height[1] = t_ratio / (1.0f - t_ratio); + } + } + symbol->row_height[2] = symbol->row_height[0]; + symbol->height = symbol->row_height[0] + symbol->row_height[1] + symbol->row_height[2]; + +#ifdef COMPLIANT_HEIGHTS + if ((min_height && symbol->height < min_height) || (max_height && symbol->height > max_height)) { + error_number = ZINT_WARN_NONCOMPLIANT; + strcpy(symbol->errtxt, "499: Height not compliant with standards"); + } +#else + (void)min_height; (void)max_height; +#endif + + return error_number; } /* Handles the 4 State barcodes used in the UK by Royal Mail */ @@ -354,9 +440,21 @@ INTERNAL int royal_plot(struct zint_symbol *symbol, unsigned char source[], int writer += 2; } - symbol->row_height[0] = 3; - symbol->row_height[1] = 2; - symbol->row_height[2] = 3; +#ifdef COMPLIANT_HEIGHTS + /* Royal Mail Know How User's Manual Appendix C: using CBC + https://web.archive.org/web/20120120060743/http://www.royalmail.com/sites/default/files/docs/pdf/Know How 2006 PIP vs 1.6a Accepted Changes.pdf + Bar pitch and min/maxes same as Mailmark, so using recommendations from Royal Mail Mailmark Barcode Definition + Document (15 Sept 2015) Section 3.5.1 + */ + symbol->row_height[0] = (float) ((1.9 * 42.3) / 25.4); /* ~3.16 */ + symbol->row_height[1] = (float) ((1.3 * 42.3) / 25.4); /* ~2.16 */ + /* Note using max X for minimum and min X for maximum */ + error_number = daft_set_height(symbol, (float) ((4.22 * 39) / 25.4), (float) ((5.84 * 47) / 25.4)); +#else + symbol->row_height[0] = 3.0f; + symbol->row_height[1] = 2.0f; + error_number = daft_set_height(symbol, 0.0f, 0.0f); +#endif symbol->rows = 3; symbol->width = writer - 1; @@ -404,9 +502,17 @@ INTERNAL int kix_code(struct zint_symbol *symbol, unsigned char source[], int le writer += 2; } - symbol->row_height[0] = 3; - symbol->row_height[1] = 2; - symbol->row_height[2] = 3; +#ifdef COMPLIANT_HEIGHTS + /* Dimensions same as RM4SCC */ + symbol->row_height[0] = (float) ((1.9 * 42.3) / 25.4); /* ~3.16 */ + symbol->row_height[1] = (float) ((1.3 * 42.3) / 25.4); /* ~2.16 */ + /* Note using max X for minimum and min X for maximum */ + error_number = daft_set_height(symbol, (float) ((4.22 * 39) / 25.4), (float) ((5.84 * 47) / 25.4)); +#else + symbol->row_height[0] = 3.0f; + symbol->row_height[1] = 2.0f; + error_number = daft_set_height(symbol, 0.0f, 0.0f); +#endif symbol->rows = 3; symbol->width = writer - 1; @@ -460,9 +566,21 @@ INTERNAL int daft_code(struct zint_symbol *symbol, unsigned char source[], int l writer += 2; } - symbol->row_height[0] = 3; - symbol->row_height[1] = 2; - symbol->row_height[2] = 3; + /* Allow ratio of tracker to be specified in thousandths */ + if (symbol->option_2 >= 50 && symbol->option_2 <= 900) { + float t_ratio = symbol->option_2 / 1000.0f; + if (symbol->height < 0.5f) { + symbol->height = 8.0f; + } + symbol->row_height[1] = symbol->height * t_ratio; + symbol->row_height[0] = (float) ((symbol->height - symbol->row_height[1]) / 2.0); + } else { + symbol->row_height[0] = 3.0f; + symbol->row_height[1] = 2.0f; + } + + /* DAFT generic barcode so no dimensions/height specification */ + (void) daft_set_height(symbol, 0.0f, 0.0f); symbol->rows = 3; symbol->width = writer - 1; @@ -490,6 +608,8 @@ INTERNAL int flattermarken(struct zint_symbol *symbol, unsigned char source[], i expand(symbol, dest); + // TODO: Find documentation on BARCODE_FLAT dimensions/height + return error_number; } @@ -512,8 +632,6 @@ INTERNAL int japan_post(struct zint_symbol *symbol, unsigned char source[], int return ZINT_ERROR_TOO_LONG; } - error_number = 0; - strcpy(local_source, (char*) source); to_upper((unsigned char*) local_source); @@ -589,11 +707,22 @@ INTERNAL int japan_post(struct zint_symbol *symbol, unsigned char source[], int writer += 2; } - symbol->row_height[0] = 3; - symbol->row_height[1] = 2; - symbol->row_height[2] = 3; symbol->rows = 3; symbol->width = writer - 1; +#ifdef COMPLIANT_HEIGHTS + /* Japan Post Zip/Barcode Manual pp.11-12 https://www.post.japanpost.jp/zipcode/zipmanual/p11.html + X 0.6mm (0.5mm - 0.7mm) + Tracker height 1.2mm (1.05mm - 1.35mm) / 0.6mm = 2, + Ascender/descender = 1.2mm (Full 3.6mm (3.4mm - 3.6mm, max preferred) less T divided by 2) / 0.6mm = 2 */ + symbol->row_height[0] = 2.0f; + symbol->row_height[1] = 2.0f; + error_number = daft_set_height(symbol, (float) (3.4 / 0.7) /*~4.857*/, 3.6f / 0.5f /*7.2*/); +#else + symbol->row_height[0] = 3.0f; + symbol->row_height[1] = 2.0f; + error_number = daft_set_height(symbol, 0.0f, 0.0f); +#endif + return error_number; } diff --git a/backend/qr.c b/backend/qr.c index 0c24cf7e..2c43df24 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -94,7 +94,8 @@ static int in_numeric(const unsigned int jisdata[], const int length, const int return 0; } *p_end = i; - *p_cost = digit_cnt == 1 ? 24 /* 4 * QR_MULT */ : digit_cnt == 2 ? 21 /* (7 / 2) * QR_MULT */ : 20 /* (10 / 3) * QR_MULT) */; + *p_cost = digit_cnt == 1 + ? 24 /* 4 * QR_MULT */ : digit_cnt == 2 ? 21 /* (7 / 2) * QR_MULT */ : 20 /* (10 / 3) * QR_MULT) */; return 1; } @@ -393,7 +394,7 @@ static void qr_binary(unsigned char datastream[], const int version, const int t #ifndef _MSC_VER char binary[est_binlen + 12]; #else - char* binary = (char *) _alloca(est_binlen + 12); + char *binary = (char *) _alloca(est_binlen + 12); #endif *binary = '\0'; bp = 0; @@ -478,7 +479,8 @@ static void qr_binary(unsigned char datastream[], const int version, const int t /* Byte mode */ /* Character count indicator */ - bp = bin_append_posn(short_data_block_length + double_byte, cci_bits(version, data_block), binary, bp); + bp = bin_append_posn(short_data_block_length + double_byte, cci_bits(version, data_block), binary, + bp); if (debug_print) { printf("Byte block (length %d)\n\t", short_data_block_length + double_byte); @@ -517,7 +519,8 @@ static void qr_binary(unsigned char datastream[], const int version, const int t } /* Character count indicator */ - bp = bin_append_posn(short_data_block_length + percent_count, cci_bits(version, data_block), binary, bp); + bp = bin_append_posn(short_data_block_length + percent_count, cci_bits(version, data_block), binary, + bp); if (debug_print) { printf("Alpha block (length %d)\n\t", short_data_block_length + percent_count); @@ -656,7 +659,7 @@ static void qr_binary(unsigned char datastream[], const int version, const int t if (version >= MICROQR_VERSION && version < MICROQR_VERSION + 4) { /* MICROQR does its own terminating/padding */ binary[bp] = '\0'; - strcpy((char*)datastream, binary); + ustrcpy(datastream, binary); return; } @@ -716,8 +719,8 @@ static void qr_binary(unsigned char datastream[], const int version, const int t } /* Split data into blocks, add error correction and then interleave the blocks and error correction data */ -static void add_ecc(unsigned char fullstream[], const unsigned char datastream[], const int version, const int data_cw, - const int blocks, int debug_print) { +static void add_ecc(unsigned char fullstream[], const unsigned char datastream[], const int version, + const int data_cw, const int blocks, const int debug_print) { int ecc_cw; int short_data_block_length; int qty_long_blocks; @@ -726,10 +729,10 @@ static void add_ecc(unsigned char fullstream[], const unsigned char datastream[] int i, j, length_this_block, in_posn; rs_t rs; #ifdef _MSC_VER - unsigned char* data_block; - unsigned char* ecc_block; - unsigned char* interleaved_data; - unsigned char* interleaved_ecc; + unsigned char *data_block; + unsigned char *ecc_block; + unsigned char *interleaved_data; + unsigned char *interleaved_ecc; #endif if (version < RMQR_VERSION) { @@ -801,7 +804,8 @@ static void add_ecc(unsigned char fullstream[], const unsigned char datastream[] } if (i >= qty_short_blocks) { - interleaved_data[(short_data_block_length * blocks) + (i - qty_short_blocks)] = data_block[short_data_block_length]; + interleaved_data[(short_data_block_length * blocks) + (i - qty_short_blocks)] + = data_block[short_data_block_length]; } for (j = 0; j < ecc_block_length; j++) { @@ -812,10 +816,12 @@ static void add_ecc(unsigned char fullstream[], const unsigned char datastream[] } for (j = 0; j < data_cw; j++) { - fullstream[j] = interleaved_data[j]; // NOLINT suppress clang-tidy warning: interleaved_data[data_cw] fully set + // NOLINTNEXTLINE suppress clang-tidy warning: interleaved_data[data_cw] fully set + fullstream[j] = interleaved_data[j]; } for (j = 0; j < ecc_cw; j++) { - fullstream[j + data_cw] = interleaved_ecc[j]; // NOLINT suppress clang-tidy warning: interleaved_ecc[ecc_cw] fully set + // NOLINTNEXTLINE suppress clang-tidy warning: interleaved_ecc[ecc_cw] fully set + fullstream[j + data_cw] = interleaved_ecc[j]; } if (debug_print) { @@ -935,7 +941,7 @@ static void setup_grid(unsigned char *grid, const int size, const int version) { } } -static int cwbit(const unsigned char* fullstream, const int i) { +static int cwbit(const unsigned char *fullstream, const int i) { if (fullstream[(i >> 3)] & (0x80 >> (i & 0x07))) { return 1; @@ -1280,8 +1286,8 @@ static int apply_bitmask(unsigned char *grid, const int size, const int ecc_leve unsigned char mask[size_squared]; unsigned char local[size_squared]; #else - unsigned char *mask = (unsigned char *) _alloca(size_squared * sizeof (unsigned char)); - unsigned char *local = (unsigned char *) _alloca(size_squared * sizeof (unsigned char)); + unsigned char *mask = (unsigned char *) _alloca(size_squared); + unsigned char *local = (unsigned char *) _alloca(size_squared); #endif /* Perform data masking */ @@ -1711,7 +1717,8 @@ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int len fullstream = (unsigned char *) _alloca(qr_total_codewords[version - 1] + 1); #endif - qr_binary(datastream, version, target_codewords, mode, jisdata, length, gs1, symbol->eci, est_binlen, debug_print); + qr_binary(datastream, version, target_codewords, mode, jisdata, length, gs1, symbol->eci, est_binlen, + debug_print); #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, datastream, target_codewords); #endif @@ -1722,7 +1729,7 @@ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int len #ifndef _MSC_VER unsigned char grid[size_squared]; #else - grid = (unsigned char *) _alloca(size_squared * sizeof (unsigned char)); + grid = (unsigned char *) _alloca(size_squared); #endif memset(grid, 0, size_squared); @@ -1750,6 +1757,7 @@ INTERNAL int qr_code(struct zint_symbol *symbol, unsigned char source[], int len } symbol->row_height[i] = 1; } + symbol->height = size; return 0; } @@ -2267,8 +2275,8 @@ static int micro_apply_bitmask(unsigned char *grid, const int size, const int us unsigned char mask[size_squared]; unsigned char eval[size_squared]; #else - unsigned char *mask = (unsigned char *) _alloca(size_squared * sizeof (unsigned char)); - unsigned char *eval = (unsigned char *) _alloca(size_squared * sizeof (unsigned char)); + unsigned char *mask = (unsigned char *) _alloca(size_squared); + unsigned char *eval = (unsigned char *) _alloca(size_squared); #endif /* Perform data masking */ @@ -2358,7 +2366,7 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len int size_squared; int debug_print = symbol->debug & ZINT_DEBUG_PRINT; #ifdef _MSC_VER - unsigned char* grid; + unsigned char *grid; #endif if (length > 35) { @@ -2442,7 +2450,8 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len /* Determine length of binary data */ for (i = 0; i < 4; i++) { if (version_valid[i]) { - binary_count[i] = getBinaryLength(MICROQR_VERSION + i, mode, jisdata, length, 0 /*gs1*/, 0 /*eci*/, debug_print); + binary_count[i] = getBinaryLength(MICROQR_VERSION + i, mode, jisdata, length, 0 /*gs1*/, 0 /*eci*/, + debug_print); } else { binary_count[i] = 128 + 1; } @@ -2545,7 +2554,7 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len #ifndef _MSC_VER unsigned char grid[size_squared]; #else - grid = (unsigned char *) _alloca(size_squared * sizeof (unsigned char)); + grid = (unsigned char *) _alloca(size_squared); #endif memset(grid, 0, size_squared); @@ -2641,6 +2650,7 @@ INTERNAL int microqr(struct zint_symbol *symbol, unsigned char source[], int len } symbol->row_height[i] = 1; } + symbol->height = size; return 0; } @@ -2657,17 +2667,17 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt unsigned int jisdata[length + 1]; char mode[length + 1]; #else - unsigned char* datastream; - unsigned char* fullstream; - unsigned char* grid; - unsigned int* jisdata = (unsigned int *) _alloca((length + 1) * sizeof (unsigned int)); - char* mode = (char *) _alloca(length + 1); + unsigned char *datastream; + unsigned char *fullstream; + unsigned char *grid; + unsigned int *jisdata = (unsigned int *) _alloca((length + 1) * sizeof(unsigned int)); + char *mode = (char *) _alloca(length + 1); #endif #ifndef _MSC_VER unsigned char preprocessed[length + 1]; #else - unsigned char* preprocessed = (unsigned char*) _alloca(length + 1); + unsigned char *preprocessed = (unsigned char *) _alloca(length + 1); #endif symbol->eci = 4; /* Set before any processing */ @@ -2729,7 +2739,7 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt #ifndef _MSC_VER unsigned char grid[size_squared]; #else - grid = (unsigned char *) _alloca(size_squared * sizeof (unsigned char)); + grid = (unsigned char *) _alloca(size_squared); #endif memset(grid, 0, size_squared); @@ -2755,11 +2765,12 @@ INTERNAL int upnqr(struct zint_symbol *symbol, unsigned char source[], int lengt } symbol->row_height[i] = 1; } + symbol->height = size; return 0; } -static void setup_rmqr_grid(unsigned char* grid, const int h_size, const int v_size) { +static void setup_rmqr_grid(unsigned char *grid, const int h_size, const int v_size) { int i, j; char alignment[] = {0x1F, 0x11, 0x15, 0x11, 0x1F}; int h_version, finder_position; @@ -2887,11 +2898,11 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length unsigned int jisdata[length + 1]; char mode[length + 1]; #else - unsigned char* datastream; - unsigned char* fullstream; - unsigned char* grid; - unsigned int* jisdata = (unsigned int *) _alloca((length + 1) * sizeof (unsigned int)); - char* mode = (char *) _alloca(length + 1); + unsigned char *datastream; + unsigned char *fullstream; + unsigned char *grid; + unsigned int *jisdata = (unsigned int *) _alloca((length + 1) * sizeof(unsigned int)); + char *mode = (char *) _alloca(length + 1); #endif gs1 = ((symbol->input_mode & 0x07) == GS1_MODE); @@ -3031,11 +3042,12 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length unsigned char datastream[target_codewords + 1]; unsigned char fullstream[rmqr_total_codewords[version] + 1]; #else - datastream = (unsigned char *) _alloca((target_codewords + 1) * sizeof (unsigned char)); - fullstream = (unsigned char *) _alloca((rmqr_total_codewords[version] + 1) * sizeof (unsigned char)); + datastream = (unsigned char *) _alloca(target_codewords + 1); + fullstream = (unsigned char *) _alloca(rmqr_total_codewords[version] + 1); #endif - qr_binary(datastream, RMQR_VERSION + version, target_codewords, mode, jisdata, length, gs1, 0 /*eci*/, est_binlen, debug_print); + qr_binary(datastream, RMQR_VERSION + version, target_codewords, mode, jisdata, length, gs1, 0 /*eci*/, est_binlen, + debug_print); #ifdef ZINT_TEST if (symbol->debug & ZINT_DEBUG_TEST) debug_test_codeword_dump(symbol, datastream, target_codewords); #endif @@ -3047,7 +3059,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length #ifndef _MSC_VER unsigned char grid[h_size * v_size]; #else - grid = (unsigned char *) _alloca((h_size * v_size) * sizeof (unsigned char)); + grid = (unsigned char *) _alloca(h_size * v_size); #endif memset(grid, 0, h_size * v_size); @@ -3084,7 +3096,8 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length for (i = 0; i < 5; i++) { for (j = 0; j < 3; j++) { grid[(h_size * (i + 1)) + j + 8] = (left_format_info >> ((j * 5) + i)) & 0x01; - grid[(h_size * (v_size - 6)) + (h_size * i) + j + (h_size - 8)] = (right_format_info >> ((j * 5) + i)) & 0x01; + grid[(h_size * (v_size - 6)) + (h_size * i) + j + (h_size - 8)] + = (right_format_info >> ((j * 5) + i)) & 0x01; } } grid[(h_size * 1) + 11] = (left_format_info >> 15) & 0x01; @@ -3107,6 +3120,7 @@ INTERNAL int rmqr(struct zint_symbol *symbol, unsigned char source[], int length } symbol->row_height[i] = 1; } + symbol->height = v_size; return 0; } diff --git a/backend/raster.c b/backend/raster.c index a36085b8..a4f0c44e 100644 --- a/backend/raster.c +++ b/backend/raster.c @@ -439,7 +439,8 @@ static void draw_string(unsigned char *pixbuf, const unsigned char input_string[ 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, si); + draw_letter(pixbuf, input_string[i], string_left_hand + x_incr, yposn, textflags, image_width, image_height, + si); } } @@ -649,7 +650,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang int image_height, image_width; unsigned char *pixelbuf; int error_number; - int xoffset, yoffset, roffset, boffset; + float xoffset, yoffset, roffset, boffset; float scaler = symbol->scale; int xoffset_scaled, yoffset_scaled; unsigned char *scaled_hexagon; @@ -715,7 +716,8 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang for (column = 0; column < symbol->width - odd_row; column++) { const int xposn = column * hex_width + xposn_offset; if (module_is_set(symbol, row, column)) { - draw_hexagon(pixelbuf, image_width, image_height, scaled_hexagon, hex_width, hex_height, xposn, yposn); + draw_hexagon(pixelbuf, image_width, image_height, scaled_hexagon, hex_width, hex_height, xposn, + yposn); } } } @@ -765,7 +767,8 @@ static void draw_bind_box(struct zint_symbol *symbol, unsigned char *pixelbuf, c if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) { const int bwidth = symbol->border_width * si; const int ybind_bottom = (textoffset + symbol->whitespace_height) * si; - const int ybind_top = (textoffset + symbol->whitespace_height + symbol->height) * si + overspill_scaled + bwidth; + const int ybind_top = (textoffset + symbol->whitespace_height + symbol->height) * si + overspill_scaled + + bwidth; /* Horizontal boundary bars */ if ((symbol->output_options & BARCODE_BOX) || (symbol->symbology != BARCODE_CODABLOCKF && symbol->symbology != BARCODE_HIBC_BLOCKF)) { @@ -796,7 +799,7 @@ static int plot_raster_dotty(struct zint_symbol *symbol, const int rotate_angle, int r, i; int scale_width, scale_height; int error_number = 0; - int xoffset, yoffset, roffset, boffset; + float xoffset, yoffset, roffset, boffset; float dot_overspill; float dotoffset; float dotradius_scaled; @@ -850,7 +853,8 @@ static int plot_raster_dotty(struct zint_symbol *symbol, const int rotate_angle, draw_bind_box(symbol, scaled_pixelbuf, xoffset, roffset, 0 /*textoffset*/, dot_overspill_scaled, scale_width, scale_height, (int) floorf(scaler)); - error_number = save_raster_image_to_file(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle, file_type); + error_number = save_raster_image_to_file(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle, + file_type); if (rotate_angle || file_type != OUT_BUFFER || !(symbol->output_options & OUT_BUFFER_INTERMEDIATE)) { free(scaled_pixelbuf); } @@ -908,8 +912,8 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl unsigned char addon[6]; int addon_gap = 0; float addon_text_posn = 0.0f; - int xoffset, yoffset, roffset, boffset; - int textoffset; + float xoffset, yoffset, roffset, boffset; + float textoffset; int default_text_posn; float row_height, row_posn; int upceanflag = 0; @@ -919,13 +923,13 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl int hide_text; int i, r; int text_height; /* Font pixel size (so whole integers) */ - int text_gap; /* Gap between barcode and text */ + float text_gap; /* Gap between barcode and text */ int textflags = 0; int guardoffset = 0; int image_width, image_height; unsigned char *pixelbuf; - int next_yposn; + float next_yposn; int latch; float scaler = symbol->scale; int si; @@ -946,7 +950,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl si = 2; } - large_bar_height = output_large_bar_height(symbol); + large_bar_height = output_large_bar_height(symbol, si /*Round to scale*/); main_width = symbol->width; @@ -956,21 +960,22 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl output_set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset); - hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0)); - /* Note font sizes halved as in pixels */ if (upceanflag) { textflags = UPCEAN_TEXT | (symbol->output_options & SMALL_TEXT); /* Bold not available for UPC/EAN */ text_height = (UPCEAN_FONT_HEIGHT + 1) / 2; - text_gap = 1; + text_gap = 1.0f; } else { textflags = symbol->output_options & (SMALL_TEXT | BOLD_TEXT); text_height = textflags & SMALL_TEXT ? (SMALL_FONT_HEIGHT + 1) / 2 : (NORMAL_FONT_HEIGHT + 1) / 2; - text_gap = 1; + text_gap = 1.0f; } + hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0)); + if (hide_text) { - textoffset = upceanflag && upceanflag != 2 && upceanflag != 5 ? 5 : 0; /* Need 5X from bottom for guard bars */ + /* Need 5X from bottom for guard bars */ + textoffset = upceanflag && upceanflag != 2 && upceanflag != 5 ? 5 : 0; } else { if (upceanflag) { textoffset = (text_height > 5 ? text_height : 5) + text_gap; /* Need at least 5X for guard bars */ @@ -999,13 +1004,13 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl /* Plot the body of the symbol to the pixel buffer */ for (r = 0; r < symbol->rows; r++) { - int plot_yposn; + float plot_yposn; float plot_height; int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */ row_posn += row_height; plot_yposn = next_yposn; row_height = symbol->row_height[this_row] ? symbol->row_height[this_row] : large_bar_height; - next_yposn = (int) (row_posn + row_height); + next_yposn = row_posn + row_height; plot_height = next_yposn - plot_yposn; plot_yposn *= si; @@ -1019,11 +1024,13 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl int block_width = 0; do { block_width++; - } while ((i + block_width < symbol->width) && module_colour_is_set(symbol, this_row, i + block_width) == module_fill); + } while ((i + block_width < symbol->width) + && module_colour_is_set(symbol, this_row, i + block_width) == module_fill); if (module_fill) { /* a colour block */ - draw_bar(pixelbuf, (i + xoffset) * si, block_width * si, plot_yposn, plot_height, image_width, image_height, ultra_colour[module_fill]); + draw_bar(pixelbuf, (i + xoffset) * si, block_width * si, plot_yposn, plot_height, image_width, + image_height, ultra_colour[module_fill]); } i += block_width; @@ -1034,7 +1041,8 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl int block_width = 0; do { block_width++; - } while ((i + block_width < symbol->width) && module_is_set(symbol, this_row, i + block_width) == module_fill); + } while ((i + block_width < symbol->width) + && module_is_set(symbol, this_row, i + block_width) == module_fill); if (upceanflag && (addon_latch == 0) && (r == 0) && (i > main_width)) { plot_height = row_height - (text_height + text_gap) + 5.0f; @@ -1050,14 +1058,17 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl plot_height = 0.5f; } /* Need to invert composite position */ - addon_text_posn = is_composite(symbol->symbology) ? image_height - (plot_yposn + plot_height + text_height + text_gap) * si : yoffset * si; + addon_text_posn = is_composite(symbol->symbology) + ? image_height - (plot_yposn + plot_height + text_height + text_gap) * si + : yoffset * si; plot_yposn *= si; plot_height *= si; addon_latch = 1; } if (module_fill) { /* a bar */ - draw_bar(pixelbuf, (i + xoffset) * si, block_width * si, plot_yposn, plot_height, image_width, image_height, DEFAULT_INK); + draw_bar(pixelbuf, (i + xoffset) * si, block_width * si, plot_yposn, plot_height, image_width, + image_height, DEFAULT_INK); } i += block_width; @@ -1071,19 +1082,30 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl /* Guard bar extension */ if (upceanflag == 6) { /* UPC-E */ - draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (50 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); + draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (50 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); } else if (upceanflag == 8) { /* EAN-8 */ - draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (32 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (34 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (64 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (66 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); + draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (32 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (34 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (64 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (66 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); } else if (upceanflag == 12) { /* UPC-A */ latch = 1; @@ -1094,10 +1116,12 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl int block_width = 0; do { block_width++; - } while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_fill); + } while ((i + block_width < symbol->width) + && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_fill); if (latch == 1) { /* a bar */ - draw_bar(pixelbuf, (i + xoffset - comp_offset) * si, block_width * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); + draw_bar(pixelbuf, (i + xoffset - comp_offset) * si, block_width * si, guardoffset * si, 5 * si, + image_width, image_height, DEFAULT_INK); latch = 0; } else { /* a space */ @@ -1105,8 +1129,10 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl } i += block_width; } while (i < 11 + comp_offset); - draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); + draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); latch = 1; i = 85 + comp_offset; do { @@ -1114,10 +1140,12 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl int block_width = 0; do { block_width++; - } while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_fill); + } while ((i + block_width < symbol->width) + && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_fill); if (latch == 1) { /* a bar */ - draw_bar(pixelbuf, (i + xoffset - comp_offset) * si, block_width * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); + draw_bar(pixelbuf, (i + xoffset - comp_offset) * si, block_width * si, guardoffset * si, 5 * si, + image_width, image_height, DEFAULT_INK); latch = 0; } else { /* a space */ @@ -1127,12 +1155,18 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl } while (i < 96 + comp_offset); } else if (upceanflag == 13) { /* EAN-13 */ - draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (92 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); - draw_bar(pixelbuf, (94 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK); + draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (92 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); + draw_bar(pixelbuf, (94 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, + DEFAULT_INK); } } @@ -1140,96 +1174,121 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl if (upceanflag) { /* Note font sizes halved as in pixels */ - int upcea_width_adj = (UPCEAN_SMALL_FONT_WIDTH + 3) / 4; /* Halved again to get middle position that draw_string() expects */ + + /* Halved again to get middle position that draw_string() expects */ + int upcea_width_adj = (UPCEAN_SMALL_FONT_WIDTH + 3) / 4; int upcea_height_adj = (UPCEAN_FONT_HEIGHT - UPCEAN_SMALL_FONT_HEIGHT) * si / 2; - int ean_width_adj = (UPCEAN_FONT_WIDTH + 3) / 4; /* Halved again to get middle position that draw_string() expects */ + /* Halved again to get middle position that draw_string() expects */ + int ean_width_adj = (UPCEAN_FONT_WIDTH + 3) / 4; output_upcean_split_text(upceanflag, symbol->text, textpart1, textpart2, textpart3, textpart4); if (upceanflag == 6) { /* UPC-E */ textpos = (-(5 + upcea_width_adj) + xoffset) * si; - draw_string(pixelbuf, textpart1, textpos, default_text_posn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si); + draw_string(pixelbuf, textpart1, textpos, default_text_posn + upcea_height_adj, + textflags | SMALL_TEXT, image_width, image_height, si); textpos = (24 + xoffset) * si; - draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, + si); textpos = (51 + 3 + upcea_width_adj + xoffset) * si; - draw_string(pixelbuf, textpart3, textpos, default_text_posn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si); + draw_string(pixelbuf, textpart3, textpos, default_text_posn + upcea_height_adj, + textflags | SMALL_TEXT, image_width, image_height, si); textdone = 1; switch (ustrlen(addon)) { case 2: textpos = (61 + xoffset + addon_gap) * si; - draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, + si); break; case 5: textpos = (75 + xoffset + addon_gap) * si; - draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, + si); break; } } else if (upceanflag == 8) { /* EAN-8 */ textpos = (17 + xoffset) * si; - draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height, + si); textpos = (50 + xoffset) * si; - draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, + si); textdone = 1; switch (ustrlen(addon)) { case 2: textpos = (77 + xoffset + addon_gap) * si; - draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, + si); break; case 5: textpos = (91 + xoffset + addon_gap) * si; - draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, + si); break; } } else if (upceanflag == 12) { /* UPC-A */ textpos = (-(5 + upcea_width_adj) + xoffset) * si; - draw_string(pixelbuf, textpart1, textpos, default_text_posn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si); + draw_string(pixelbuf, textpart1, textpos, default_text_posn + upcea_height_adj, + textflags | SMALL_TEXT, image_width, image_height, si); textpos = (27 + xoffset) * si; - draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, + si); textpos = (67 + xoffset) * si; - draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height, + si); textpos = (95 + 5 + upcea_width_adj + xoffset) * si; - draw_string(pixelbuf, textpart4, textpos, default_text_posn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si); + draw_string(pixelbuf, textpart4, textpos, default_text_posn + upcea_height_adj, + textflags | SMALL_TEXT, image_width, image_height, si); textdone = 1; switch (ustrlen(addon)) { case 2: textpos = (105 + xoffset + addon_gap) * si; - draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, + si); break; case 5: textpos = (119 + xoffset + addon_gap) * si; - draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, + si); break; } } else if (upceanflag == 13) { /* EAN-13 */ textpos = (-(5 + ean_width_adj) + xoffset) * si; - draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height, + si); textpos = (24 + xoffset) * si; - draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, + si); textpos = (71 + xoffset) * si; - draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height, + si); textdone = 1; switch (ustrlen(addon)) { case 2: textpos = (105 + xoffset + addon_gap) * si; - draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, + si); break; case 5: textpos = (119 + xoffset + addon_gap) * si; - draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, + si); break; } } } if (!textdone) { - unsigned char local_text[sizeof(symbol->text)] = {0}; /* Suppress clang-analyzer-core.CallAndMessage warning */ + /* 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 */ textpos = (main_width / 2 + xoffset) * si; - draw_string(pixelbuf, local_text, textpos, default_text_posn, textflags, image_width, image_height, si); + draw_string(pixelbuf, local_text, textpos, default_text_posn, textflags, image_width, image_height, + si); } } @@ -1247,14 +1306,16 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl for (r = 1; r < symbol->rows; r++) { row_height = symbol->row_height[r - 1] ? symbol->row_height[r - 1] : large_bar_height; draw_bar(pixelbuf, xoffset * si, symbol->width * si, - ((r * row_height) + textoffset + yoffset - sep_height / 2) * si, sep_height * si, image_width, image_height, DEFAULT_INK); + ((r * row_height) + textoffset + yoffset - sep_height / 2) * si, sep_height * si, + image_width, image_height, DEFAULT_INK); } } else { for (r = 1; r < symbol->rows; r++) { /* Avoid 11-module start and 13-module stop chars */ row_height = symbol->row_height[r - 1] ? symbol->row_height[r - 1] : large_bar_height; draw_bar(pixelbuf, (xoffset + 11) * si, (symbol->width - 24) * si, - ((r * row_height) + textoffset + yoffset - sep_height / 2) * si, sep_height * si, image_width, image_height, DEFAULT_INK); + ((r * row_height) + textoffset + yoffset - sep_height / 2) * si, sep_height * si, + image_width, image_height, DEFAULT_INK); } } } @@ -1282,13 +1343,15 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl } } - error_number = save_raster_image_to_file(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle, file_type); + error_number = save_raster_image_to_file(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle, + file_type); if (rotate_angle || file_type != OUT_BUFFER || !(symbol->output_options & OUT_BUFFER_INTERMEDIATE)) { free(scaled_pixelbuf); } free(pixelbuf); } else { - error_number = save_raster_image_to_file(symbol, image_height, image_width, pixelbuf, rotate_angle, file_type); + error_number = save_raster_image_to_file(symbol, image_height, image_width, pixelbuf, rotate_angle, + file_type); if (rotate_angle || file_type != OUT_BUFFER || !(symbol->output_options & OUT_BUFFER_INTERMEDIATE)) { free(pixelbuf); } diff --git a/backend/rss.c b/backend/rss.c index 6577adca..b25dc316 100644 --- a/backend/rss.c +++ b/backend/rss.c @@ -249,7 +249,7 @@ static void rss14_separator(struct zint_symbol *symbol, int width, const int sep } if (bottom_finder_value_3) { /* ISO/IEC 24724:2011 5.3.2.2 "The single dark module that occurs in the 13 modules over finder value 3 is - * shifted one module to the right so that it is over the start of the three module-wide finder bar." */ + shifted one module to the right so that it is over the start of the three module-wide finder bar." */ finder_value_3_set = finder_start + 10; for (i = finder_start, finder_end = finder_start + 13; i < finder_end; i++) { if (i == finder_value_3_set) { @@ -268,9 +268,46 @@ static void rss14_separator(struct zint_symbol *symbol, int width, const int sep } } -/* GS1 DataBar Omnidirectional/Truncated/Stacked */ -INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) { - int error_number = 0, i; +/* Set Databar Stacked height, maintaining 5:7 ratio of the 2 main row heights */ +INTERNAL int rss14_stk_set_height(struct zint_symbol *symbol, const int first_row) { + int error_number = 0; + float fixed_height = 0.0f; + int second_row = first_row + 2; /* 2 row separator */ + int i; + + for (i = 0; i < symbol->rows; i++) { + if (i != first_row && i != second_row) { + fixed_height += symbol->row_height[i]; + } + } + if (symbol->height) { + symbol->row_height[first_row] = (symbol->height - fixed_height) * symbol->row_height[first_row] / + (symbol->row_height[first_row] + symbol->row_height[second_row]); + if (symbol->row_height[first_row] < 0.5f) { /* Absolute minimum */ + symbol->row_height[first_row] = 0.5f; + symbol->row_height[second_row] = 0.7f; + } else { + symbol->row_height[second_row] = symbol->height - fixed_height - symbol->row_height[first_row]; + if (symbol->row_height[second_row] < 0.7f) { + symbol->row_height[second_row] = 0.7f; + } + } + } + symbol->height = symbol->row_height[first_row] + symbol->row_height[second_row] + fixed_height; + +#ifdef COMPLIANT_HEIGHTS + if (symbol->row_height[first_row] < 5.0f || symbol->row_height[second_row] < 7.0f) { + error_number = ZINT_WARN_NONCOMPLIANT; + strcpy(symbol->errtxt, "379: Height not compliant with standards"); + } +#endif + + return error_number; +} + +/* GS1 DataBar Omnidirectional/Truncated/Stacked, allowing for composite if `cc_rows` set */ +INTERNAL int rss14_cc(struct zint_symbol *symbol, unsigned char source[], int src_len, const int cc_rows) { + int error_number, i; large_int accum; uint64_t left_pair, right_pair; int data_character[4] = {0}, data_group[4] = {0}, v_odd[4], v_even[4]; @@ -312,7 +349,7 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l large_load_str_u64(&accum, source, src_len); - if (symbol->option_1 == 2) { + if (cc_rows) { /* Add symbol linkage flag */ large_add_u64(&accum, 10000000000000); } @@ -473,10 +510,23 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l /* Set human readable text */ set_gtin14_hrt(symbol, source, src_len); - set_minimum_height(symbol, 14); // Minimum height is 14X for truncated symbol - } +#ifdef COMPLIANT_HEIGHTS + /* Minimum height is 13X for truncated symbol ISO/IEC 24724:2011 5.3.1 + Default height is 33X for DataBar Omnidirectional ISO/IEC 24724:2011 5.2 */ + if (symbol->symbology == BARCODE_DBAR_OMN_CC) { + symbol->height = symbol->height ? 13.0f : 33.0f; /* Pass back min row or default height */ + } else { + error_number = set_height(symbol, 13.0f, 33.0f, 0.0f, 0 /*no_errtxt*/); + } +#else + if (symbol->symbology == BARCODE_DBAR_OMN_CC) { + symbol->height = 14.0f; /* 14X truncated min row height used (should be 13X) */ + } else { + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); + } +#endif - if ((symbol->symbology == BARCODE_DBAR_STK) || (symbol->symbology == BARCODE_DBAR_STK_CC)) { + } else if ((symbol->symbology == BARCODE_DBAR_STK) || (symbol->symbology == BARCODE_DBAR_STK_CC)) { /* top row */ writer = 0; latch = 0; @@ -485,7 +535,7 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l } set_module(symbol, symbol->rows, writer); unset_module(symbol, symbol->rows, writer + 1); - symbol->row_height[symbol->rows] = 5; + symbol->row_height[symbol->rows] = 5.0f; /* ISO/IEC 24724:2011 5.3.2.1 set to 5X */ /* bottom row */ symbol->rows = symbol->rows + 2; @@ -496,7 +546,7 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l for (i = 23; i < 46; i++) { writer = rss_expand(symbol, writer, &latch, total_widths[i]); } - symbol->row_height[symbol->rows] = 7; + symbol->row_height[symbol->rows] = 7.0f; /* ISO/IEC 24724:2011 5.3.2.1 set to 7X */ /* separator pattern */ /* See #183 for this interpretation of ISO/IEC 24724:2011 5.3.2.1 */ @@ -524,9 +574,12 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l if (symbol->width < 50) { symbol->width = 50; } - } - if ((symbol->symbology == BARCODE_DBAR_OMNSTK) || (symbol->symbology == BARCODE_DBAR_OMNSTK_CC)) { + if (symbol->symbology != BARCODE_DBAR_STK_CC) { /* Composite calls rss14_stk_set_height() itself */ + error_number = rss14_stk_set_height(symbol, 0 /*first_row*/); + } + + } else if ((symbol->symbology == BARCODE_DBAR_OMNSTK) || (symbol->symbology == BARCODE_DBAR_OMNSTK_CC)) { /* top row */ writer = 0; latch = 0; @@ -570,15 +623,29 @@ INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_l } symbol->rows = symbol->rows + 1; - set_minimum_height(symbol, 33); + /* ISO/IEC 24724:2011 5.3.2.2 minimum 33X height per row */ + if (symbol->symbology == BARCODE_DBAR_OMNSTK_CC) { + symbol->height = symbol->height ? 33.0f : 66.0f; /* Pass back min row or default height */ + } else { +#ifdef COMPLIANT_HEIGHTS + error_number = set_height(symbol, 33.0f, 66.0f, 0.0f, 0 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 66.0f, 0.0f, 1 /*no_errtxt*/); +#endif + } } return error_number; } -/* GS1 DataBar Limited */ -INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len) { - int error_number = 0, i; +/* GS1 DataBar Omnidirectional/Truncated/Stacked */ +INTERNAL int rss14(struct zint_symbol *symbol, unsigned char source[], int src_len) { + return rss14_cc(symbol, source, src_len, 0 /*cc_rows*/); +} + +/* GS1 DataBar Limited, allowing for composite if `cc_rows` set */ +INTERNAL int rsslimited_cc(struct zint_symbol *symbol, unsigned char source[], int src_len, const int cc_rows) { + int error_number, i; large_int accum; uint64_t left_character, right_character; int left_group, right_group, left_odd, left_even, right_odd, right_even; @@ -624,7 +691,7 @@ INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int large_load_str_u64(&accum, source, src_len); - if (symbol->option_1 == 2) { + if (cc_rows) { /* Add symbol linkage flag */ large_add_u64(&accum, 2015133531096); } @@ -745,11 +812,25 @@ INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int /* Set human readable text */ set_gtin14_hrt(symbol, source, src_len); - set_minimum_height(symbol, 10); + /* ISO/IEC 24724:2011 6.2 10X minimum height, use as default also */ + if (symbol->symbology == BARCODE_DBAR_LTD_CC) { + symbol->height = 10.0f; /* Pass back min row == default height */ + } else { +#ifdef COMPLIANT_HEIGHTS + error_number = set_height(symbol, 10.0f, 10.0f, 0.0f, 0 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/); +#endif + } return error_number; } +/* GS1 DataBar Limited */ +INTERNAL int rsslimited(struct zint_symbol *symbol, unsigned char source[], int src_len) { + return rsslimited_cc(symbol, source, src_len, 0 /*cc_rows*/); +} + /* Check and convert date to RSS date value */ INTERNAL int rss_date(const unsigned char source[], const int src_posn) { int yy = to_int(source + src_posn, 2); @@ -757,7 +838,7 @@ INTERNAL int rss_date(const unsigned char source[], const int src_posn) { int dd = to_int(source + src_posn + 4, 2); /* Month can't be zero but day can (means last day of month, - * GS1 General Specifications Sections 3.4.2 to 3.4.7) */ + GS1 General Specifications Sections 3.4.2 to 3.4.7) */ if (yy < 0 || mm <= 0 || mm > 12 || dd < 0 || dd > 31) { return -1; } @@ -1189,9 +1270,9 @@ static void rssexp_separator(struct zint_symbol *symbol, int width, const int co } } -/* GS1 DataBar Expanded */ -INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) { - int error_number; +/* GS1 DataBar Expanded, setting linkage for composite if `cc_rows` set */ +INTERNAL int rssexpanded_cc(struct zint_symbol *symbol, unsigned char source[], int src_len, const int cc_rows) { + int error_number, warn_number = 0; int i, j, k, p, codeblocks, data_chars, vs, group, v_odd, v_even; int latch; int char_widths[21][8], checksum, check_widths[8], c_group; @@ -1201,6 +1282,7 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int unsigned int bin_len = 13 * src_len + 200 + 1; int widths[4]; int bp = 0; + int stack_rows = 1; #ifndef _MSC_VER unsigned char reduced[src_len + 1]; char binary_string[bin_len]; @@ -1227,7 +1309,7 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int symbol->rows += 1; } - if (symbol->option_1 == 2) { /* The "component linkage" flag */ + if (cc_rows) { /* The "component linkage" flag */ binary_string[bp++] = '1'; } else { binary_string[bp++] = '0'; @@ -1388,7 +1470,6 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int } } else { - int stack_rows; int current_row, current_block, left_to_right; int v2_latch = 0; /* RSS Expanded Stacked */ @@ -1401,7 +1482,7 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int if ((symbol->option_2 < 1) || (symbol->option_2 > 11)) { symbol->option_2 = 2; } - if ((symbol->option_1 == 2) && (symbol->option_2 == 1)) { + if (cc_rows && (symbol->option_2 == 1)) { /* "There shall be a minimum of four symbol characters in the first row of an RSS Expanded Stacked symbol when it is the linear component of an EAN.UCC Composite symbol." */ @@ -1522,11 +1603,22 @@ INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int 1 /*left_to_right*/, 0 /*odd_last_row*/, NULL); } - for (i = 0; i < symbol->rows; i++) { - if (symbol->row_height[i] == 0) { - symbol->row_height[i] = 34; - } + /* DataBar Expanded ISO/IEC 24724:2011 7.2.1 and DataBar Expanded Stacked ISO/IEC 24724:2011 7.2.8 + 34X min per row */ + if (symbol->symbology == BARCODE_DBAR_EXP_CC || symbol->symbology == BARCODE_DBAR_EXPSTK_CC) { + symbol->height = symbol->height ? 34.0f : 34.0f * stack_rows; /* Pass back min row or default height */ + } else { +#ifdef COMPLIANT_HEIGHTS + warn_number = set_height(symbol, 34.0f, 34.0f * stack_rows, 0.0f, 0 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 34.0f * stack_rows, 0.0f, 1 /*no_errtxt*/); +#endif } - return error_number; + return error_number ? error_number : warn_number; +} + +/* GS1 DataBar Expanded */ +INTERNAL int rssexpanded(struct zint_symbol *symbol, unsigned char source[], int src_len) { + return rssexpanded_cc(symbol, source, src_len, 0 /*cc_rows*/); } diff --git a/backend/telepen.c b/backend/telepen.c index e6d26f16..eb8a929d 100644 --- a/backend/telepen.c +++ b/backend/telepen.c @@ -2,7 +2,7 @@ /* libzint - the open source barcode library - Copyright (C) 2008-2017 Robin Stuart + Copyright (C) 2008-2021 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -94,6 +94,15 @@ INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], int src strcat(dest, TeleTable['z']); expand(symbol, dest); + +#ifdef COMPLIANT_HEIGHTS + /* Default height from various Telepen docs is based on default 26pt at X 0.01125" (average of 0.01" - 0.0125") + = (26 / 72) / 0.01125 ~ 32; no min height specified */ + (void) set_height(symbol, 0.0f, 32.0f, 0, 1 /*no_errtxt*/); +#else + (void) set_height(symbol, 0.0f, 50.0f, 0, 1 /*no_errtxt*/); +#endif + for (i = 0; i < src_len; i++) { if (source[i] == '\0') { symbol->text[i] = ' '; @@ -164,6 +173,13 @@ INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], int strcat(dest, TeleTable['z']); expand(symbol, dest); + +#ifdef COMPLIANT_HEIGHTS + (void) set_height(symbol, 0.0f, 32.0f, 0, 1 /*no_errtxt*/); /* Same as alphanumeric Telepen */ +#else + (void) set_height(symbol, 0.0f, 50.0f, 0, 1 /*no_errtxt*/); +#endif + ustrcpy(symbol->text, temp); return error_number; } diff --git a/backend/tests/data/png/dbar_ltd.png b/backend/tests/data/png/dbar_ltd.png new file mode 100644 index 00000000..0f2b2a76 Binary files /dev/null and b/backend/tests/data/png/dbar_ltd.png differ diff --git a/backend/tests/data/png/imail_height7.75.png b/backend/tests/data/png/imail_height7.75.png new file mode 100644 index 00000000..c3d9f116 Binary files /dev/null and b/backend/tests/data/png/imail_height7.75.png differ diff --git a/backend/tests/data/png/pdf417_height5.png b/backend/tests/data/png/pdf417_height5.png new file mode 100644 index 00000000..503efcf7 Binary files /dev/null and b/backend/tests/data/png/pdf417_height5.png differ diff --git a/backend/tests/data/svg/dbar_ltd.svg b/backend/tests/data/svg/dbar_ltd.svg new file mode 100644 index 00000000..608c21d3 --- /dev/null +++ b/backend/tests/data/svg/dbar_ltd.svg @@ -0,0 +1,39 @@ + + + + Zint Generated Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (01)00123456789098 + + + diff --git a/backend/tests/data/svg/imail_height7.75.svg b/backend/tests/data/svg/imail_height7.75.svg new file mode 100644 index 00000000..c8f29418 --- /dev/null +++ b/backend/tests/data/svg/imail_height7.75.svg @@ -0,0 +1,77 @@ + + + + Zint Generated Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/tests/data/svg/pdf417_height5.svg b/backend/tests/data/svg/pdf417_height5.svg new file mode 100644 index 00000000..1a7262ee --- /dev/null +++ b/backend/tests/data/svg/pdf417_height5.svg @@ -0,0 +1,163 @@ + + + + Zint Generated Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/backend/tests/data/tif/daft_height1_scale0.5.tif b/backend/tests/data/tif/daft_height1_scale0.5.tif new file mode 100644 index 00000000..387fd36c Binary files /dev/null and b/backend/tests/data/tif/daft_height1_scale0.5.tif differ diff --git a/backend/tests/data/tif/daft_scale0.5.tif b/backend/tests/data/tif/daft_height8_scale0.5.tif similarity index 100% rename from backend/tests/data/tif/daft_scale0.5.tif rename to backend/tests/data/tif/daft_height8_scale0.5.tif diff --git a/backend/tests/test_png.c b/backend/tests/test_png.c index 73839cf4..9035a988 100644 --- a/backend/tests/test_png.c +++ b/backend/tests/test_png.c @@ -124,67 +124,71 @@ static void test_print(int index, int generate, int debug) { int show_hrt; int option_1; int option_2; - int height; + float height; float scale; char *fgcolour; char *bgcolour; char *data; char *composite; + int ret; char *expected_file; char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 0, 0, "", "", "Égjpqy", "", "code128_egrave_bold.png", "" }, - /* 1*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, 0, 0, "", "", "Égjpqy", "", "code128_egrave_bold_box3.png", "" }, - /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, "", "", "Égjpqy", "", "code128_egrave_bold_hvwsp2_box2.png", "" }, - /* 3*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, 0, 0, "", "", "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", "gs1_128_cc_fig12.png", "" }, - /* 4*/ { BARCODE_CODABLOCKF, -1, 3, -1, -1, -1, -1, 3, -1, 0, 0, "", "", "AAAAAAAAA", "", "codablockf_3rows.png", "" }, - /* 5*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, -1, -1, 0, 0, "", "", "AAAAAAAAA", "", "codablockf_hvwsp2.png", "" }, - /* 6*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, "", "", "AAAAAAAAA", "", "codablockf_hvwsp2_box2.png", "" }, - /* 7*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9771384524017+12", "", "ean13_2addon_ggs_5.2.2.5.1-2.png", "" }, - /* 8*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9780877799306+54321", "", "ean13_5addon_ggs_5.2.2.5.2-2.png", "" }, - /* 9*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "123456789012+12", "[91]123456789012345678901", "ean13_cc_2addon_cca_4x4.png", "" }, - /* 10*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "123456789012+54321", "[91]1234567890", "ean13_cc_5addon_ccb_3x4.png", "" }, - /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "123456789012+54321", "[91]1234567890", "ean13_cc_5addon_ccb_3x4_notext.png", "" }, - /* 12*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "012345678905+24", "", "upca_2addon_ggs_5.2.6.6-5.png", "" }, - /* 13*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "614141234417+12345", "", "upca_5addon.png", "" }, - /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, -1, -1, 0, 0, "", "", "614141234417+12345", "", "upca_5addon_notext.png", "" }, - /* 15*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, "", "", "614141234417+12345", "", "upca_5addon_bind3.png", "" }, - /* 16*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "12345678901+12", "[91]123456789", "upca_cc_2addon_cca_3x4.png", "" }, - /* 17*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", "upca_cc_5addon_ccb_4x4.png", "" }, - /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", "upca_cc_5addon_ccb_4x4_notext.png", "" }, - /* 19*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", "upca_cc_5addon_ccb_4x4_bind3.png", "" }, - /* 20*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12", "", "upce_2addon.png", "" }, - /* 21*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", "upce_5addon.png", "" }, - /* 22*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", "upce_5addon_small.png", "" }, - /* 23*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "0654321+89", "[91]1", "upce_cc_2addon_cca_5x2.png", "" }, - /* 24*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "1876543+56789", "[91]12345", "upce_cc_5addon_ccb_8x2.png", "" }, - /* 25*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "1876543+56789", "[91]12345", "upce_cc_5addon_ccb_8x2_notext.png", "" }, - /* 26*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12", "", "ean8_2addon.png", "" }, - /* 27*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", "ean8_5addon.png", "" }, - /* 28*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9876543+65", "[91]1234567", "ean8_cc_2addon_cca_4x3.png", "" }, - /* 29*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9876543+74083", "[91]123456789012345678", "ean8_cc_5addon_ccb_8x3.png", "" }, - /* 30*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12345", "", "ean5.png", "" }, - /* 31*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12", "", "ean2.png", "" }, - /* 32*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, "", "", "123", "", "code39_small.png", "" }, - /* 33*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3.5, "", "", "12345", "", "postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" }, - /* 34*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "CFCECDCC", "12345", "", "pdf417_bgalpha.png", "" }, - /* 35*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "30313233", "", "12345", "", "pdf417_fgalpha.png", "" }, - /* 36*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "20212244", "CFCECDCC", "12345", "", "pdf417_bgfgalpha.png", "" }, - /* 37*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, "0000007F", "FF000033", "12345", "", "ultra_bgfgalpha.png", "" }, - /* 38*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, "", "FF000033", "12345", "", "ultra_bgalpha.png", "" }, - /* 39*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, "0000007F", "FF0000", "12345", "", "ultra_fgalpha.png", "" }, - /* 40*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "0000007F", "", "12345", "", "ultra_fgalpha_nobg.png", "" }, - /* 41*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, "00FF007F", "BABDB6", "12345", "", "ultra_fgalpha_hvwsp1_box1.png", "" }, - /* 42*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5f, "", "", "1", "", "ultra_odd.png", "" }, - /* 43*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5f, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "maxicode_0.5.png", "6 dpmm, 150 dpi" }, - /* 44*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7f, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" }, - /* 45*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4f, "1111117F", "EEEEEEEE", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" }, - /* 46*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1f, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "maxicode_2.1.png", "24 dpmm, 600 dpi" }, - /* 47*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "maxicode_hvwsp1_box2.png", "" }, - /* 48*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "maxicode_vwsp1_bind1.png", "" }, - /* 49*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0f, "", "", "1234", "", "datamatrix_2.0_bind1_dotty.png", "" }, - /* 50*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0f, "", "", "1234", "", "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" }, + /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 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, "", "", "Égjpqy", "", 0, "code128_egrave_bold_box3.png", "" }, + /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 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, "", "", "[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, "", "", "AAAAAAAAA", "", 0, "codablockf_3rows.png", "" }, + /* 5*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, -1, -1, 0, 0, "", "", "AAAAAAAAA", "", 0, "codablockf_hvwsp2.png", "" }, + /* 6*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, "", "", "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.png", "" }, + /* 7*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.png", "" }, + /* 8*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.png", "" }, + /* 9*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.png", "" }, + /* 10*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.png", "" }, + /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.png", "" }, + /* 12*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.png", "" }, + /* 13*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "614141234417+12345", "", 0, "upca_5addon.png", "" }, + /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, -1, -1, 0, 0, "", "", "614141234417+12345", "", 0, "upca_5addon_notext.png", "" }, + /* 15*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, "", "", "614141234417+12345", "", 0, "upca_5addon_bind3.png", "" }, + /* 16*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.png", "" }, + /* 17*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.png", "" }, + /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.png", "" }, + /* 19*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, 0, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.png", "" }, + /* 20*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12", "", 0, "upce_2addon.png", "" }, + /* 21*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", 0, "upce_5addon.png", "" }, + /* 22*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", 0, "upce_5addon_small.png", "" }, + /* 23*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, "", "", "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.png", "" }, + /* 24*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, "", "", "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.png", "" }, + /* 25*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, "", "", "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.png", "" }, + /* 26*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12", "", 0, "ean8_2addon.png", "" }, + /* 27*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "1234567+12345", "", 0, "ean8_5addon.png", "" }, + /* 28*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.png", "" }, + /* 29*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.png", "" }, + /* 30*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12345", "", 0, "ean5.png", "" }, + /* 31*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12", "", 0, "ean2.png", "" }, + /* 32*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, "", "", "123", "", 0, "code39_small.png", "" }, + /* 33*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3.5, "", "", "12345", "", 0, "postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" }, + /* 34*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "CFCECDCC", "12345", "", 0, "pdf417_bgalpha.png", "" }, + /* 35*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "30313233", "", "12345", "", 0, "pdf417_fgalpha.png", "" }, + /* 36*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "20212244", "CFCECDCC", "12345", "", 0, "pdf417_bgfgalpha.png", "" }, + /* 37*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, "0000007F", "FF000033", "12345", "", 0, "ultra_bgfgalpha.png", "" }, + /* 38*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, "", "FF000033", "12345", "", 0, "ultra_bgalpha.png", "" }, + /* 39*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, "0000007F", "FF0000", "12345", "", 0, "ultra_fgalpha.png", "" }, + /* 40*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "0000007F", "", "12345", "", 0, "ultra_fgalpha_nobg.png", "" }, + /* 41*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, "00FF007F", "BABDB6", "12345", "", 0, "ultra_fgalpha_hvwsp1_box1.png", "" }, + /* 42*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5f, "", "", "1", "", 0, "ultra_odd.png", "" }, + /* 43*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5f, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.5.png", "6 dpmm, 150 dpi" }, + /* 44*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7f, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" }, + /* 45*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4f, "1111117F", "EEEEEEEE", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" }, + /* 46*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1f, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_2.1.png", "24 dpmm, 600 dpi" }, + /* 47*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_hvwsp1_box2.png", "" }, + /* 48*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.png", "" }, + /* 49*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0f, "", "", "1234", "", 0, "datamatrix_2.0_bind1_dotty.png", "" }, + /* 50*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0f, "", "", "1234", "", 0, "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" }, + /* 51*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, "", "", "12345678909", "", 0, "dbar_ltd.png", "" }, + /* 52*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5.0f, 0, "", "", "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.png", "" }, + /* 53*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75f, 0, "", "", "12345678901234567890", "", 0, "imail_height7.75.png", "" }, }; int data_size = ARRAY_SIZE(data); @@ -245,16 +249,16 @@ static void test_print(int index, int generate, int debug) { int text_length = strlen(text); ret = ZBarcode_Encode(symbol, (unsigned char *) text, text_length); - assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); + assert_equal(ret, data[i].ret, "i:%d %s ZBarcode_Encode ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt); strcpy(symbol->outfile, png); ret = ZBarcode_Print(symbol, 0); - assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret); + assert_zero(ret, "i:%d %s ZBarcode_Print %s ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), symbol->outfile, ret, symbol->errtxt); assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); if (generate) { - printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.5g, \"%s\",\"%s\", \"%s\", \"%s\", \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %.5g, %.5g, \"%s\",\"%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, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file, data[i].comment); diff --git a/backend/tests/test_postal.c b/backend/tests/test_postal.c index 177a4701..695856ee 100644 --- a/backend/tests/test_postal.c +++ b/backend/tests/test_postal.c @@ -109,7 +109,7 @@ static void test_koreapost(int index, int debug) { int ret_encode; int ret_vector; - int expected_height; + float expected_height; int expected_rows; int expected_width; }; @@ -131,7 +131,7 @@ static void test_koreapost(int index, int debug) { assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret_encode); if (ret < ZINT_ERROR) { - assert_equal(symbol->height, data[i].expected_height, "i:%d symbol->height %d != %d\n", i, symbol->height, data[i].expected_height); + assert_equal(symbol->height, data[i].expected_height, "i:%d symbol->height %.8g != %.8g\n", i, symbol->height, data[i].expected_height); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); @@ -155,7 +155,7 @@ static void test_japanpost(int index, int debug) { int ret_encode; int ret_vector; - int expected_height; + float expected_height; int expected_rows; int expected_width; char *comment; @@ -180,7 +180,7 @@ static void test_japanpost(int index, int debug) { assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret_encode); if (ret < ZINT_ERROR) { - assert_equal(symbol->height, data[i].expected_height, "i:%d symbol->height %d != %d\n", i, symbol->height, data[i].expected_height); + assert_equal(symbol->height, data[i].expected_height, "i:%d symbol->height %.8g != %.8g\n", i, symbol->height, data[i].expected_height); assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d\n", i, symbol->rows, data[i].expected_rows); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d\n", i, symbol->width, data[i].expected_width); diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c index 56dab02f..62363623 100644 --- a/backend/tests/test_raster.c +++ b/backend/tests/test_raster.c @@ -114,7 +114,7 @@ static void test_buffer(int index, int generate, int debug) { char *data; char *composite; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -284,11 +284,11 @@ static void test_buffer(int index, int generate, int debug) { if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); // ZINT_DEBUG_TEST_PRINT 16 if (generate) { - printf(" /*%3d*/ { %s, \"%s\", \"%s\", %d, %d, %d, %d, %d },\n", + printf(" /*%3d*/ { %s, \"%s\", \"%s\", %.8g, %d, %d, %d, %d },\n", i, testUtilBarcodeName(data[i].symbology), data[i].data, data[i].composite, symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height); } else { - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_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", @@ -314,7 +314,7 @@ static void test_upcean_hrt(int index, int debug) { char *data; int ret; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -385,7 +385,7 @@ static void test_upcean_hrt(int index, int debug) { if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); // ZINT_DEBUG_TEST_PRINT 16 - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_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", @@ -451,7 +451,7 @@ static void test_row_separator(int index, int debug) { char *data; int ret; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -490,7 +490,7 @@ static void test_row_separator(int index, int debug) { assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_nonnull(symbol->bitmap, "i:%d (%s) symbol->bitmap NULL\n", i, testUtilBarcodeName(data[i].symbology)); - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_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), @@ -536,7 +536,7 @@ static void test_stacking(int index, int debug) { char *data; char *data2; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -572,7 +572,7 @@ static void test_stacking(int index, int debug) { assert_zero(ret, "i:%d ret %d != zero\n", i, ret); assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology); - assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, data[i].symbology, symbol->height, data[i].expected_height); + 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); @@ -620,7 +620,7 @@ static void test_output_options(int index, int debug) { char *data; int ret; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -741,7 +741,7 @@ static void test_output_options(int index, int debug) { if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); // ZINT_DEBUG_TEST_PRINT 16 - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_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), @@ -778,7 +778,7 @@ static void test_draw_string_wrap(int index, int debug) { char *data; char* text; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -813,7 +813,7 @@ static void test_draw_string_wrap(int index, int debug) { assert_zero(ret, "i:%d ZBarcode_Buffer(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt); assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology); - assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, data[i].symbology, symbol->height, data[i].expected_height); + 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); @@ -848,7 +848,7 @@ static void test_code128_utf8(int index, int debug) { struct item { char *data; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -879,7 +879,7 @@ static void test_code128_utf8(int index, int debug) { assert_zero(ret, "i:%d ZBarcode_Buffer(%d) ret %d != 0\n", i, BARCODE_CODE128, ret); assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, BARCODE_CODE128); - assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, BARCODE_CODE128, symbol->height, data[i].expected_height); + assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %.8g != %.8g\n", i, BARCODE_CODE128, symbol->height, data[i].expected_height); assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, BARCODE_CODE128, symbol->rows, data[i].expected_rows); assert_equal(symbol->width, data[i].expected_width, "i:%d (%d) symbol->width %d != %d\n", i, BARCODE_CODE128, 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, BARCODE_CODE128, symbol->bitmap_width, data[i].expected_bitmap_width); @@ -919,7 +919,7 @@ static void test_scale(int index, int debug) { char *data; char *composite; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -991,7 +991,7 @@ static void test_scale(int index, int debug) { if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); // ZINT_DEBUG_TEST_PRINT 16 - assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, data[i].symbology, symbol->height, data[i].expected_height); + 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); @@ -1030,11 +1030,13 @@ static void test_buffer_plot(int index, int generate, int debug) { int option_2; int whitespace_width; int output_options; + float height; char *fgcolour; char *bgcolour; char *data; + int ret; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -1042,7 +1044,7 @@ static void test_buffer_plot(int index, int generate, int debug) { char *expected_bitmap; }; struct item data[] = { - /* 0*/ { BARCODE_PDF417, 0, 1, -1, -1, "", "", "1", 15, 5, 86, 86, 15, + /* 0*/ { BARCODE_PDF417, 0, 1, -1, -1, 15, "", "", "1", 0, 15, 5, 86, 86, 15, "11111111010101000111101010111100001110101001110000011101010111000000111111101000101001" "11111111010101000111101010111100001110101001110000011101010111000000111111101000101001" "11111111010101000111101010111100001110101001110000011101010111000000111111101000101001" @@ -1059,7 +1061,7 @@ static void test_buffer_plot(int index, int generate, int debug) { "11111111010101000111010111001100001110100111000110011101011100110000111111101000101001" "11111111010101000111010111001100001110100111000110011101011100110000111111101000101001" }, - /* 1*/ { BARCODE_PDF417, 0, 1, -1, -1, "FF0000", "00FF0099", "1", 15, 5, 86, 86, 15, + /* 1*/ { BARCODE_PDF417, 0, 1, -1, -1, 15, "FF0000", "00FF0099", "1", 0, 15, 5, 86, 86, 15, "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRGRGRGGRRRGGGGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRGRGRGGRRRGGGGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRGRGRGGRRRGGGGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" @@ -1076,7 +1078,7 @@ static void test_buffer_plot(int index, int generate, int debug) { "RRRRRRRRGRGRGRGGGRRRGRGRRRGGRRGGGGRRRGRGGRRRGGGRRGGRRRGRGRRRGGRRGGGGRRRRRRRGRGGGRGRGGR" "RRRRRRRRGRGRGRGGGRRRGRGRRRGGRRGGGGRRRGRGGRRRGGGRRGGRRRGRGRRRGGRRGGGGRRRRRRRGRGGGRGRGGR" }, - /* 2*/ { BARCODE_PDF417, 0, 1, 1, -1, "FFFF0033", "00FF00", "1", 15, 5, 86, 88, 15, + /* 2*/ { BARCODE_PDF417, 0, 1, 1, -1, 15, "FFFF0033", "00FF00", "1", 0, 15, 5, 86, 88, 15, "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYGYGYGGYYYGGGGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYGYGYGGYYYGGGGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYGYGYGGYYYGGGGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" @@ -1093,7 +1095,7 @@ static void test_buffer_plot(int index, int generate, int debug) { "GYYYYYYYYGYGYGYGGGYYYGYGYYYGGYYGGGGYYYGYGGYYYGGGYYGGYYYGYGYYYGGYYGGGGYYYYYYYGYGGGYGYGGYG" "GYYYYYYYYGYGYGYGGGYYYGYGYYYGGYYGGGGYYYGYGGYYYGGGYYGGYYYGYGYYYGGYYGGGGYYYYYYYGYGGGYGYGGYG" }, - /* 3*/ { BARCODE_ULTRA, -1, -1, -1, -1, "FF00007F", "00FF0000", "1", 13, 13, 13, 13, 13, + /* 3*/ { BARCODE_ULTRA, -1, -1, -1, -1, 13, "FF00007F", "00FF0000", "1", 0, 13, 13, 13, 13, 13, "1111111111111" "10Y10GYCGYYC1" "11C10MGYCGGG1" @@ -1108,7 +1110,7 @@ static void test_buffer_plot(int index, int generate, int debug) { "10C10MYYYGMY1" "1111111111111" }, - /* 4*/ { BARCODE_ULTRA, -1, -1, 1, -1, "", "00FF0000", "1", 13, 13, 13, 15, 13, + /* 4*/ { BARCODE_ULTRA, -1, -1, 1, -1, 13, "", "00FF0000", "1", 0, 13, 13, 13, 15, 13, "G1111111111111G" "G10Y10GYCGYYC1G" "G11C10MGYCGGG1G" @@ -1123,7 +1125,7 @@ static void test_buffer_plot(int index, int generate, int debug) { "G10C10MYYYGMY1G" "G1111111111111G" }, - /* 5*/ { BARCODE_CHANNEL, -1, -1, 1, -1, "30313233", "CFCECDCC", "1", 5, 1, 19, 21, 5, + /* 5*/ { BARCODE_CHANNEL, -1, -1, 1, -1, 5, "30313233", "CFCECDCC", "1", 0, 5, 1, 19, 21, 5, "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" @@ -1148,6 +1150,9 @@ static void test_buffer_plot(int index, int generate, int debug) { if (data[i].whitespace_width != -1) { symbol->whitespace_width = data[i].whitespace_width; } + if (data[i].height) { + symbol->height = data[i].height; + } if (*data[i].fgcolour) { strcpy(symbol->fgcolour, data[i].fgcolour); } @@ -1157,10 +1162,9 @@ static void test_buffer_plot(int index, int generate, int debug) { /* Keep dumps small */ symbol->show_hrt = 0; symbol->scale = 0.5f; - symbol->height = 1; ret = ZBarcode_Encode(symbol, (unsigned char *) data[i].data, length); - assert_zero(ret, "i:%d ZBarcode_Encode(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode(%s) ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt); ret = ZBarcode_Buffer(symbol, 0); assert_zero(ret, "i:%d ZBarcode_Buffer(%s) ret %d != 0 (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); @@ -1169,13 +1173,14 @@ static void test_buffer_plot(int index, int generate, int debug) { if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); // ZINT_DEBUG_TEST_PRINT 16 if (generate) { - printf(" /*%3d*/ { %s, %d, %d, %d, %s, \"%s\", \"%s\", \"%s\", %d, %d, %d, %d, %d,\n", + printf(" /*%3d*/ { %s, %d, %d, %d, %s, %g, \"%s\", \"%s\", \"%s\", %s, %g, %d, %d, %d, %d,\n", i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, data[i].whitespace_width, testUtilOutputOptionsName(data[i].output_options), - data[i].fgcolour, data[i].bgcolour, data[i].data, symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height); + data[i].height, data[i].fgcolour, data[i].bgcolour, data[i].data, testUtilErrorName(data[i].ret), + symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height); testUtilBitmapPrint(symbol, " ", "\n"); printf(" },\n"); } else { - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); + assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %g != %g\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", @@ -1209,12 +1214,12 @@ static void test_height(int index, int generate, int debug) { int ret; struct item { int symbology; - int height; + float height; char *data; char *composite; int ret; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -1223,403 +1228,403 @@ static void test_height(int index, int generate, int debug) { const char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_CODE11, 1, "1234567890", "", 0, 5, 1, 108, 216, 10, "" }, - /* 1*/ { BARCODE_CODE11, 4, "1234567890", "", 0, 5, 1, 108, 216, 10, "" }, + /* 0*/ { BARCODE_CODE11, 1, "1234567890", "", 0, 1, 1, 108, 216, 2, "" }, + /* 1*/ { BARCODE_CODE11, 4, "1234567890", "", 0, 4, 1, 108, 216, 8, "" }, /* 2*/ { BARCODE_CODE11, 10, "1234567890", "", 0, 10, 1, 108, 216, 20, "" }, - /* 3*/ { BARCODE_C25STANDARD, 1, "1234567890", "", 0, 5, 1, 117, 234, 10, "" }, - /* 4*/ { BARCODE_C25STANDARD, 4, "1234567890", "", 0, 5, 1, 117, 234, 10, "" }, + /* 3*/ { BARCODE_C25STANDARD, 1, "1234567890", "", 0, 1, 1, 117, 234, 2, "" }, + /* 4*/ { BARCODE_C25STANDARD, 4, "1234567890", "", 0, 4, 1, 117, 234, 8, "" }, /* 5*/ { BARCODE_C25STANDARD, 11, "1234567890", "", 0, 11, 1, 117, 234, 22, "" }, - /* 6*/ { BARCODE_C25INTER, 1, "1234567890", "", 0, 5, 1, 99, 198, 10, "" }, - /* 7*/ { BARCODE_C25INTER, 4, "1234567890", "", 0, 5, 1, 99, 198, 10, "" }, + /* 6*/ { BARCODE_C25INTER, 1, "1234567890", "", 0, 1, 1, 99, 198, 2, "" }, + /* 7*/ { BARCODE_C25INTER, 4, "1234567890", "", 0, 4, 1, 99, 198, 8, "" }, /* 8*/ { BARCODE_C25INTER, 15, "1234567890", "", 0, 15, 1, 99, 198, 30, "" }, - /* 9*/ { BARCODE_C25IATA, 1, "1234567890", "", 0, 5, 1, 149, 298, 10, "" }, - /* 10*/ { BARCODE_C25IATA, 4, "1234567890", "", 0, 5, 1, 149, 298, 10, "" }, + /* 9*/ { BARCODE_C25IATA, 1, "1234567890", "", 0, 1, 1, 149, 298, 2, "" }, + /* 10*/ { BARCODE_C25IATA, 4, "1234567890", "", 0, 4, 1, 149, 298, 8, "" }, /* 11*/ { BARCODE_C25IATA, 30, "1234567890", "", 0, 30, 1, 149, 298, 60, "" }, - /* 12*/ { BARCODE_C25LOGIC, 1, "1234567890", "", 0, 5, 1, 109, 218, 10, "" }, - /* 13*/ { BARCODE_C25LOGIC, 4, "1234567890", "", 0, 5, 1, 109, 218, 10, "" }, + /* 12*/ { BARCODE_C25LOGIC, 1, "1234567890", "", 0, 1, 1, 109, 218, 2, "" }, + /* 13*/ { BARCODE_C25LOGIC, 4, "1234567890", "", 0, 4, 1, 109, 218, 8, "" }, /* 14*/ { BARCODE_C25LOGIC, 41, "1234567890", "", 0, 41, 1, 109, 218, 82, "" }, - /* 15*/ { BARCODE_C25IND, 1, "1234567890", "", 0, 5, 1, 159, 318, 10, "" }, - /* 16*/ { BARCODE_C25IND, 4, "1234567890", "", 0, 5, 1, 159, 318, 10, "" }, + /* 15*/ { BARCODE_C25IND, 1, "1234567890", "", 0, 1, 1, 159, 318, 2, "" }, + /* 16*/ { BARCODE_C25IND, 4, "1234567890", "", 0, 4, 1, 159, 318, 8, "" }, /* 17*/ { BARCODE_C25IND, 21, "1234567890", "", 0, 21, 1, 159, 318, 42, "" }, - /* 18*/ { BARCODE_CODE39, 1, "1234567890", "", 0, 5, 1, 155, 310, 10, "" }, - /* 19*/ { BARCODE_CODE39, 4, "1", "", 0, 5, 1, 38, 76, 10, "" }, + /* 18*/ { BARCODE_CODE39, 1, "1234567890", "", 0, 1, 1, 155, 310, 2, "" }, + /* 19*/ { BARCODE_CODE39, 4, "1", "", 0, 4, 1, 38, 76, 8, "" }, /* 20*/ { BARCODE_CODE39, 17, "1234567890", "", 0, 17, 1, 155, 310, 34, "" }, - /* 21*/ { BARCODE_EXCODE39, 1, "1234567890", "", 0, 5, 1, 155, 310, 10, "" }, - /* 22*/ { BARCODE_EXCODE39, 4, "1234567890", "", 0, 5, 1, 155, 310, 10, "" }, + /* 21*/ { BARCODE_EXCODE39, 1, "1234567890", "", 0, 1, 1, 155, 310, 2, "" }, + /* 22*/ { BARCODE_EXCODE39, 4, "1234567890", "", 0, 4, 1, 155, 310, 8, "" }, /* 23*/ { BARCODE_EXCODE39, 17, "1234567890", "", 0, 17, 1, 155, 310, 34, "" }, - /* 24*/ { BARCODE_EANX, 1, "123456789012", "", 0, 5, 1, 95, 226, 20, "EAN-13" }, - /* 25*/ { BARCODE_EANX, 4, "123456789012", "", 0, 5, 1, 95, 226, 20, "" }, + /* 24*/ { BARCODE_EANX, 1, "123456789012", "", 0, 1, 1, 95, 226, 12, "EAN-13" }, + /* 25*/ { BARCODE_EANX, 4, "123456789012", "", 0, 4, 1, 95, 226, 18, "" }, /* 26*/ { BARCODE_EANX, 69, "123456789012", "", 0, 69, 1, 95, 226, 148, "" }, /* 27*/ { BARCODE_EANX, 55, "1234567", "", 0, 55, 1, 67, 162, 120, "EAN-8" }, /* 28*/ { BARCODE_EANX, 66, "12345", "", 0, 66, 1, 47, 118, 132, "EAN-8" }, - /* 29*/ { BARCODE_EANX_CHK, 1, "1234567890128", "", 0, 5, 1, 95, 226, 20, "EAN-13" }, + /* 29*/ { BARCODE_EANX_CHK, 1, "1234567890128", "", 0, 1, 1, 95, 226, 12, "EAN-13" }, /* 30*/ { BARCODE_EANX_CHK, 69, "1234567890128", "", 0, 69, 1, 95, 226, 148, "" }, - /* 31*/ { BARCODE_GS1_128, 1, "[01]12345678901231", "", 0, 5, 1, 134, 268, 10, "" }, - /* 32*/ { BARCODE_GS1_128, 4, "[01]12345678901231", "", 0, 5, 1, 134, 268, 10, "" }, + /* 31*/ { BARCODE_GS1_128, 1, "[01]12345678901231", "", 0, 1, 1, 134, 268, 2, "" }, + /* 32*/ { BARCODE_GS1_128, 4, "[01]12345678901231", "", 0, 4, 1, 134, 268, 8, "" }, /* 33*/ { BARCODE_GS1_128, 5, "[01]12345678901231", "", 0, 5, 1, 134, 268, 10, "" }, /* 34*/ { BARCODE_GS1_128, 50, "[01]12345678901231", "", 0, 50, 1, 134, 268, 100, "" }, - /* 35*/ { BARCODE_CODABAR, 1, "A0B", "", 0, 5, 1, 32, 64, 10, "" }, - /* 36*/ { BARCODE_CODABAR, 4, "A0B", "", 0, 5, 1, 32, 64, 10, "" }, + /* 35*/ { BARCODE_CODABAR, 1, "A0B", "", 0, 1, 1, 32, 64, 2, "" }, + /* 36*/ { BARCODE_CODABAR, 4, "A0B", "", 0, 4, 1, 32, 64, 8, "" }, /* 37*/ { BARCODE_CODABAR, 26, "A0B", "", 0, 26, 1, 32, 64, 52, "" }, - /* 38*/ { BARCODE_CODE128, 1, "1234567890", "", 0, 5, 1, 90, 180, 10, "" }, - /* 39*/ { BARCODE_CODE128, 4, "1234567890", "", 0, 5, 1, 90, 180, 10, "" }, + /* 38*/ { BARCODE_CODE128, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "" }, + /* 39*/ { BARCODE_CODE128, 4, "1234567890", "", 0, 4, 1, 90, 180, 8, "" }, /* 40*/ { BARCODE_CODE128, 7, "1234567890", "", 0, 7, 1, 90, 180, 14, "" }, - /* 41*/ { BARCODE_DPLEIT, 1, "1234567890123", "", 0, 5, 1, 135, 270, 10, "" }, - /* 42*/ { BARCODE_DPLEIT, 4, "1234567890123", "", 0, 5, 1, 135, 270, 10, "" }, - /* 43*/ { BARCODE_DPIDENT, 1, "12345678901", "", 0, 5, 1, 117, 234, 10, "" }, - /* 44*/ { BARCODE_DPIDENT, 4, "12345678901", "", 0, 5, 1, 117, 234, 10, "" }, + /* 41*/ { BARCODE_DPLEIT, 1, "1234567890123", "", 0, 1, 1, 135, 270, 2, "" }, + /* 42*/ { BARCODE_DPLEIT, 4, "1234567890123", "", 0, 4, 1, 135, 270, 8, "" }, + /* 43*/ { BARCODE_DPIDENT, 1, "12345678901", "", 0, 1, 1, 117, 234, 2, "" }, + /* 44*/ { BARCODE_DPIDENT, 4, "12345678901", "", 0, 4, 1, 117, 234, 8, "" }, /* 45*/ { BARCODE_CODE16K, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "2 rows" }, - /* 46*/ { BARCODE_CODE16K, 1, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 47*/ { BARCODE_CODE16K, 4, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 48*/ { BARCODE_CODE16K, 17, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 49*/ { BARCODE_CODE16K, 40, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, + /* 46*/ { BARCODE_CODE16K, 1, "1234567890", "", 0, 1, 2, 70, 162, 6, "" }, + /* 47*/ { BARCODE_CODE16K, 4, "1234567890", "", 0, 4, 2, 70, 162, 12, "" }, + /* 48*/ { BARCODE_CODE16K, 17, "1234567890", "", 0, 17, 2, 70, 162, 38, "" }, + /* 49*/ { BARCODE_CODE16K, 40, "1234567890", "", 0, 40, 2, 70, 162, 84, "" }, /* 50*/ { BARCODE_CODE16K, -1, "12345678901234567890123456789012345678901234567890", "", 0, 60, 6, 70, 162, 124, "6 rows" }, - /* 51*/ { BARCODE_CODE16K, 30, "12345678901234567890123456789012345678901234567890", "", 0, 60, 6, 70, 162, 124, "" }, - /* 52*/ { BARCODE_CODE16K, 120, "12345678901234567890123456789012345678901234567890", "", 0, 60, 6, 70, 162, 124, "" }, + /* 51*/ { BARCODE_CODE16K, 30, "12345678901234567890123456789012345678901234567890", "", 0, 30, 6, 70, 162, 64, "" }, + /* 52*/ { BARCODE_CODE16K, 120, "12345678901234567890123456789012345678901234567890", "", 0, 120, 6, 70, 162, 244, "" }, /* 53*/ { BARCODE_CODE49, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "2 rows" }, - /* 54*/ { BARCODE_CODE49, 1, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 55*/ { BARCODE_CODE49, 4, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 56*/ { BARCODE_CODE49, 18, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 57*/ { BARCODE_CODE49, 40, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, + /* 54*/ { BARCODE_CODE49, 1, "1234567890", "", 0, 1, 2, 70, 162, 6, "" }, + /* 55*/ { BARCODE_CODE49, 4, "1234567890", "", 0, 4, 2, 70, 162, 12, "" }, + /* 56*/ { BARCODE_CODE49, 18, "1234567890", "", 0, 18, 2, 70, 162, 40, "" }, + /* 57*/ { BARCODE_CODE49, 40, "1234567890", "", 0, 40, 2, 70, 162, 84, "" }, /* 58*/ { BARCODE_CODE49, -1, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "3 rows" }, - /* 59*/ { BARCODE_CODE49, 15, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "" }, - /* 60*/ { BARCODE_CODE49, 45, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "" }, - /* 61*/ { BARCODE_CODE93, 1, "1234567890", "", 0, 5, 1, 127, 254, 10, "" }, - /* 62*/ { BARCODE_CODE93, 4, "1234567890", "", 0, 5, 1, 127, 254, 10, "" }, + /* 59*/ { BARCODE_CODE49, 15, "12345678901234567890", "", 0, 15, 3, 70, 162, 34, "" }, + /* 60*/ { BARCODE_CODE49, 45, "12345678901234567890", "", 0, 45, 3, 70, 162, 94, "" }, + /* 61*/ { BARCODE_CODE93, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "" }, + /* 62*/ { BARCODE_CODE93, 4, "1234567890", "", 0, 4, 1, 127, 254, 8, "" }, /* 63*/ { BARCODE_CODE93, 26, "1234567890", "", 0, 26, 1, 127, 254, 52, "" }, - /* 64*/ { BARCODE_FLAT, 1, "1234567890", "", 0, 5, 1, 90, 180, 10, "" }, - /* 65*/ { BARCODE_FLAT, 4, "1234567890", "", 0, 5, 1, 90, 180, 10, "" }, - /* 66*/ { BARCODE_DBAR_OMN, 1, "1234567890123", "", 0, 14, 1, 96, 192, 28, "" }, - /* 67*/ { BARCODE_DBAR_OMN, 4, "1234567890123", "", 0, 14, 1, 96, 192, 28, "" }, - /* 68*/ { BARCODE_DBAR_OMN, 12, "1234567890123", "", 0, 14, 1, 96, 192, 28, "" }, + /* 64*/ { BARCODE_FLAT, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "" }, + /* 65*/ { BARCODE_FLAT, 4, "1234567890", "", 0, 4, 1, 90, 180, 8, "" }, + /* 66*/ { BARCODE_DBAR_OMN, 1, "1234567890123", "", 0, 1, 1, 96, 192, 2, "" }, + /* 67*/ { BARCODE_DBAR_OMN, 4, "1234567890123", "", 0, 4, 1, 96, 192, 8, "" }, + /* 68*/ { BARCODE_DBAR_OMN, 12, "1234567890123", "", 0, 12, 1, 96, 192, 24, "" }, /* 69*/ { BARCODE_DBAR_OMN, 33, "1234567890123", "", 0, 33, 1, 96, 192, 66, "" }, - /* 70*/ { BARCODE_DBAR_LTD, 1, "1234567890123", "", 0, 10, 1, 79, 158, 20, "" }, - /* 71*/ { BARCODE_DBAR_LTD, 4, "1234567890123", "", 0, 10, 1, 79, 158, 20, "" }, - /* 72*/ { BARCODE_DBAR_LTD, 9, "1234567890123", "", 0, 10, 1, 79, 158, 20, "" }, + /* 70*/ { BARCODE_DBAR_LTD, 1, "1234567890123", "", 0, 1, 1, 79, 158, 2, "" }, + /* 71*/ { BARCODE_DBAR_LTD, 4, "1234567890123", "", 0, 4, 1, 79, 158, 8, "" }, + /* 72*/ { BARCODE_DBAR_LTD, 9, "1234567890123", "", 0, 9, 1, 79, 158, 18, "" }, /* 73*/ { BARCODE_DBAR_LTD, 10, "1234567890123", "", 0, 10, 1, 79, 158, 20, "" }, - /* 74*/ { BARCODE_DBAR_EXP, 1, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" }, - /* 75*/ { BARCODE_DBAR_EXP, 33, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" }, + /* 74*/ { BARCODE_DBAR_EXP, 1, "[01]12345678901231", "", 0, 1, 1, 134, 268, 2, "" }, + /* 75*/ { BARCODE_DBAR_EXP, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "" }, /* 76*/ { BARCODE_DBAR_EXP, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" }, - /* 77*/ { BARCODE_TELEPEN, 1, "1234567890", "", 0, 5, 1, 208, 416, 10, "" }, - /* 78*/ { BARCODE_TELEPEN, 4, "1234567890", "", 0, 5, 1, 208, 416, 10, "" }, - /* 79*/ { BARCODE_UPCA, 1, "12345678901", "", 0, 5, 1, 95, 226, 20, "" }, - /* 80*/ { BARCODE_UPCA, 4, "12345678901", "", 0, 5, 1, 95, 226, 20, "" }, + /* 77*/ { BARCODE_TELEPEN, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "" }, + /* 78*/ { BARCODE_TELEPEN, 4, "1234567890", "", 0, 4, 1, 208, 416, 8, "" }, + /* 79*/ { BARCODE_UPCA, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "" }, + /* 80*/ { BARCODE_UPCA, 4, "12345678901", "", 0, 4, 1, 95, 226, 18, "" }, /* 81*/ { BARCODE_UPCA, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "" }, - /* 82*/ { BARCODE_UPCA_CHK, 1, "123456789012", "", 0, 5, 1, 95, 226, 20, "" }, - /* 83*/ { BARCODE_UPCE, 1, "1234567", "", 0, 5, 1, 51, 134, 20, "" }, - /* 84*/ { BARCODE_UPCE, 4, "1234567", "", 0, 5, 1, 51, 134, 20, "" }, + /* 82*/ { BARCODE_UPCA_CHK, 1, "123456789012", "", 0, 1, 1, 95, 226, 12, "" }, + /* 83*/ { BARCODE_UPCE, 1, "1234567", "", 0, 1, 1, 51, 134, 12, "" }, + /* 84*/ { BARCODE_UPCE, 4, "1234567", "", 0, 4, 1, 51, 134, 18, "" }, /* 85*/ { BARCODE_UPCE, 69, "1234567", "", 0, 69, 1, 51, 134, 148, "" }, - /* 86*/ { BARCODE_UPCE_CHK, 1, "12345670", "", 0, 5, 1, 51, 134, 20, "" }, + /* 86*/ { BARCODE_UPCE_CHK, 1, "12345670", "", 0, 1, 1, 51, 134, 12, "" }, /* 87*/ { BARCODE_POSTNET, -1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 88*/ { BARCODE_POSTNET, 1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 89*/ { BARCODE_POSTNET, 4, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 90*/ { BARCODE_POSTNET, 9, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 91*/ { BARCODE_POSTNET, 20, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 92*/ { BARCODE_MSI_PLESSEY, 1, "1234567890", "", 0, 5, 1, 127, 254, 10, "" }, - /* 93*/ { BARCODE_MSI_PLESSEY, 4, "1234567890", "", 0, 5, 1, 127, 254, 10, "" }, - /* 94*/ { BARCODE_FIM, 1, "A", "", 0, 5, 1, 17, 34, 10, "" }, - /* 95*/ { BARCODE_FIM, 4, "A", "", 0, 5, 1, 17, 34, 10, "" }, + /* 88*/ { BARCODE_POSTNET, 1, "12345678901", "", 0, 1, 2, 123, 246, 2, "" }, + /* 89*/ { BARCODE_POSTNET, 4, "12345678901", "", 0, 4, 2, 123, 246, 8, "" }, + /* 90*/ { BARCODE_POSTNET, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "" }, + /* 91*/ { BARCODE_POSTNET, 20, "12345678901", "", 0, 20, 2, 123, 246, 40, "" }, + /* 92*/ { BARCODE_MSI_PLESSEY, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "" }, + /* 93*/ { BARCODE_MSI_PLESSEY, 4, "1234567890", "", 0, 4, 1, 127, 254, 8, "" }, + /* 94*/ { BARCODE_FIM, 1, "A", "", 0, 1, 1, 17, 34, 2, "" }, + /* 95*/ { BARCODE_FIM, 4, "A", "", 0, 4, 1, 17, 34, 8, "" }, /* 96*/ { BARCODE_FIM, 12, "A", "", 0, 12, 1, 17, 34, 24, "" }, - /* 97*/ { BARCODE_LOGMARS, 1, "1234567890", "", 0, 5, 1, 191, 382, 10, "" }, - /* 98*/ { BARCODE_LOGMARS, 4, "1234567890", "", 0, 5, 1, 191, 382, 10, "" }, + /* 97*/ { BARCODE_LOGMARS, 1, "1234567890", "", 0, 1, 1, 191, 382, 2, "" }, + /* 98*/ { BARCODE_LOGMARS, 4, "1234567890", "", 0, 4, 1, 191, 382, 8, "" }, /* 99*/ { BARCODE_LOGMARS, 6, "1234567890", "", 0, 6, 1, 191, 382, 12, "" }, /*100*/ { BARCODE_LOGMARS, 45, "1234567890", "", 0, 45, 1, 191, 382, 90, "" }, - /*101*/ { BARCODE_PHARMA, 1, "123456", "", 0, 5, 1, 58, 116, 10, "" }, - /*102*/ { BARCODE_PHARMA, 4, "123456", "", 0, 5, 1, 58, 116, 10, "" }, + /*101*/ { BARCODE_PHARMA, 1, "123456", "", 0, 1, 1, 58, 116, 2, "" }, + /*102*/ { BARCODE_PHARMA, 4, "123456", "", 0, 4, 1, 58, 116, 8, "" }, /*103*/ { BARCODE_PHARMA, 15, "123456", "", 0, 15, 1, 58, 116, 30, "" }, /*104*/ { BARCODE_PHARMA, 16, "123456", "", 0, 16, 1, 58, 116, 32, "" }, - /*105*/ { BARCODE_PZN, 1, "123456", "", 0, 5, 1, 142, 284, 10, "" }, - /*106*/ { BARCODE_PZN, 4, "123456", "", 0, 5, 1, 142, 284, 10, "" }, + /*105*/ { BARCODE_PZN, 1, "123456", "", 0, 1, 1, 142, 284, 2, "" }, + /*106*/ { BARCODE_PZN, 4, "123456", "", 0, 4, 1, 142, 284, 8, "" }, /*107*/ { BARCODE_PZN, 17, "123456", "", 0, 17, 1, 142, 284, 34, "" }, /*108*/ { BARCODE_PZN, 106, "123456", "", 0, 106, 1, 142, 284, 212, "" }, /*109*/ { BARCODE_PHARMA_TWO, -1, "12345678", "", 0, 10, 2, 29, 58, 20, "" }, - /*110*/ { BARCODE_PHARMA_TWO, 1, "12345678", "", 0, 10, 2, 29, 58, 20, "" }, - /*111*/ { BARCODE_PHARMA_TWO, 4, "12345678", "", 0, 10, 2, 29, 58, 20, "" }, + /*110*/ { BARCODE_PHARMA_TWO, 1, "12345678", "", 0, 1, 2, 29, 58, 2, "" }, + /*111*/ { BARCODE_PHARMA_TWO, 4, "12345678", "", 0, 4, 2, 29, 58, 8, "" }, /*112*/ { BARCODE_PHARMA_TWO, 15, "12345678", "", 0, 15, 2, 29, 58, 30, "" }, /*113*/ { BARCODE_PHARMA_TWO, 20, "12345678", "", 0, 20, 2, 29, 58, 40, "" }, /*114*/ { BARCODE_PHARMA_TWO, 30, "12345678", "", 0, 30, 2, 29, 58, 60, "" }, - /*115*/ { BARCODE_PDF417, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "8 rows" }, - /*116*/ { BARCODE_PDF417, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "" }, - /*117*/ { BARCODE_PDF417, 23, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "" }, + /*115*/ { BARCODE_PDF417, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 4, 8, 120, 240, 8, "8 rows" }, + /*116*/ { BARCODE_PDF417, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 4, 8, 120, 240, 8, "" }, + /*117*/ { BARCODE_PDF417, 23, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 24, 8, 120, 240, 48, "" }, /*118*/ { BARCODE_PDF417, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "" }, /*119*/ { BARCODE_PDF417, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 36, 12, 120, 240, 72, "12 rows" }, - /*120*/ { BARCODE_PDF417, 12, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 36, 12, 120, 240, 72, "" }, - /*121*/ { BARCODE_PDF417COMP, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", 0, 27, 9, 86, 172, 54, "9 rows" }, - /*122*/ { BARCODE_PDF417COMP, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", 0, 27, 9, 86, 172, 54, "" }, - /*123*/ { BARCODE_MAXICODE, 1, "1234567890", "", 0, 165, 33, 30, 299, 298, "Fixed size, symbol->height ignored" }, + /*120*/ { BARCODE_PDF417, 12, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 12, 120, 240, 24, "" }, + /*121*/ { BARCODE_PDF417COMP, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", ZINT_WARN_NONCOMPLIANT, 4.5, 9, 86, 172, 9, "9 rows" }, + /*122*/ { BARCODE_PDF417COMP, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", ZINT_WARN_NONCOMPLIANT, 22.5, 9, 86, 172, 45, "" }, + /*123*/ { BARCODE_MAXICODE, 1, "1234567890", "", 0, 16.5, 33, 30, 299, 298, "Fixed size, symbol->height ignored" }, /*124*/ { BARCODE_QRCODE, 1, "ABCD", "", 0, 21, 21, 21, 42, 42, "Fixed width-to-height ratio, symbol->height ignored" }, - /*125*/ { BARCODE_CODE128B, 1, "1234567890", "", 0, 5, 1, 145, 290, 10, "" }, - /*126*/ { BARCODE_CODE128B, 4, "1234567890", "", 0, 5, 1, 145, 290, 10, "" }, + /*125*/ { BARCODE_CODE128B, 1, "1234567890", "", 0, 1, 1, 145, 290, 2, "" }, + /*126*/ { BARCODE_CODE128B, 4, "1234567890", "", 0, 4, 1, 145, 290, 8, "" }, /*127*/ { BARCODE_AUSPOST, -1, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*128*/ { BARCODE_AUSPOST, 1, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*129*/ { BARCODE_AUSPOST, 4, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*130*/ { BARCODE_AUSPOST, 7, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*131*/ { BARCODE_AUSPOST, 14, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*132*/ { BARCODE_AUSREPLY, 14, "12345678", "", 0, 8, 3, 73, 146, 16, "" }, - /*133*/ { BARCODE_AUSROUTE, 7, "12345678", "", 0, 8, 3, 73, 146, 16, "" }, - /*134*/ { BARCODE_AUSREDIRECT, 14, "12345678", "", 0, 8, 3, 73, 146, 16, "" }, - /*135*/ { BARCODE_ISBNX, 1, "123456789", "", 0, 5, 1, 95, 226, 20, "" }, - /*136*/ { BARCODE_ISBNX, 4, "123456789", "", 0, 5, 1, 95, 226, 20, "" }, + /*128*/ { BARCODE_AUSPOST, 1, "12345678901234567890123", "", 0, 2.5, 3, 133, 266, 5, "" }, + /*129*/ { BARCODE_AUSPOST, 4, "12345678901234567890123", "", 0, 4, 3, 133, 266, 8, "" }, + /*130*/ { BARCODE_AUSPOST, 7, "12345678901234567890123", "", 0, 7, 3, 133, 266, 14, "" }, + /*131*/ { BARCODE_AUSPOST, 14, "12345678901234567890123", "", 0, 14.5, 3, 133, 266, 29, "" }, + /*132*/ { BARCODE_AUSREPLY, 14, "12345678", "", 0, 14.5, 3, 73, 146, 29, "" }, + /*133*/ { BARCODE_AUSROUTE, 7, "12345678", "", 0, 7, 3, 73, 146, 14, "" }, + /*134*/ { BARCODE_AUSREDIRECT, 14, "12345678", "", 0, 14.5, 3, 73, 146, 29, "" }, + /*135*/ { BARCODE_ISBNX, 1, "123456789", "", 0, 1, 1, 95, 226, 12, "" }, + /*136*/ { BARCODE_ISBNX, 4, "123456789", "", 0, 4, 1, 95, 226, 18, "" }, /*137*/ { BARCODE_ISBNX, 69, "123456789", "", 0, 69, 1, 95, 226, 148, "" }, /*138*/ { BARCODE_RM4SCC, -1, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*139*/ { BARCODE_RM4SCC, 1, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*140*/ { BARCODE_RM4SCC, 4, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*141*/ { BARCODE_RM4SCC, 6, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*142*/ { BARCODE_RM4SCC, 11, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*143*/ { BARCODE_RM4SCC, 16, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, + /*139*/ { BARCODE_RM4SCC, 1, "1234567890", "", 0, 2.5, 3, 91, 182, 5, "" }, + /*140*/ { BARCODE_RM4SCC, 4, "1234567890", "", 0, 4, 3, 91, 182, 8, "" }, + /*141*/ { BARCODE_RM4SCC, 6, "1234567890", "", 0, 6.5, 3, 91, 182, 13, "" }, + /*142*/ { BARCODE_RM4SCC, 11, "1234567890", "", 0, 11, 3, 91, 182, 22, "" }, + /*143*/ { BARCODE_RM4SCC, 16, "1234567890", "", 0, 16, 3, 91, 182, 32, "" }, /*144*/ { BARCODE_DATAMATRIX, 1, "ABCD", "", 0, 12, 12, 12, 24, 24, "Fixed width-to-height ratio, symbol->height ignored" }, - /*145*/ { BARCODE_EAN14, 1, "1234567890123", "", 0, 5, 1, 134, 268, 10, "" }, - /*146*/ { BARCODE_EAN14, 4, "1234567890123", "", 0, 5, 1, 134, 268, 10, "" }, + /*145*/ { BARCODE_EAN14, 1, "1234567890123", "", 0, 1, 1, 134, 268, 2, "" }, + /*146*/ { BARCODE_EAN14, 4, "1234567890123", "", 0, 4, 1, 134, 268, 8, "" }, /*147*/ { BARCODE_EAN14, 5, "1234567890123", "", 0, 5, 1, 134, 268, 10, "" }, - /*148*/ { BARCODE_VIN, 1, "12345678701234567", "", 0, 5, 1, 246, 492, 10, "" }, - /*149*/ { BARCODE_VIN, 4, "12345678701234567", "", 0, 5, 1, 246, 492, 10, "" }, + /*148*/ { BARCODE_VIN, 1, "12345678701234567", "", 0, 1, 1, 246, 492, 2, "" }, + /*149*/ { BARCODE_VIN, 4, "12345678701234567", "", 0, 4, 1, 246, 492, 8, "" }, /*150*/ { BARCODE_CODABLOCKF, -1, "1234567890", "", 0, 20, 2, 101, 242, 44, "2 rows" }, - /*151*/ { BARCODE_CODABLOCKF, 1, "1234567890", "", 0, 20, 2, 101, 242, 44, "" }, - /*152*/ { BARCODE_CODABLOCKF, 4, "1234567890", "", 0, 20, 2, 101, 242, 44, "" }, - /*153*/ { BARCODE_CODABLOCKF, 30, "1234567890", "", 0, 20, 2, 101, 242, 44, "" }, + /*151*/ { BARCODE_CODABLOCKF, 1, "1234567890", "", 0, 1, 2, 101, 242, 6, "" }, + /*152*/ { BARCODE_CODABLOCKF, 4, "1234567890", "", 0, 4, 2, 101, 242, 12, "" }, + /*153*/ { BARCODE_CODABLOCKF, 30, "1234567890", "", 0, 30, 2, 101, 242, 64, "" }, /*154*/ { BARCODE_CODABLOCKF, -1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 110, 11, 156, 352, 224, "11 rows, 14 cols" }, - /*155*/ { BARCODE_CODABLOCKF, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 110, 11, 156, 352, 224, "" }, - /*156*/ { BARCODE_CODABLOCKF, 220, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 110, 11, 156, 352, 224, "" }, + /*155*/ { BARCODE_CODABLOCKF, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 88, 11, 156, 352, 180, "" }, + /*156*/ { BARCODE_CODABLOCKF, 220, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 220, 11, 156, 352, 444, "" }, /*157*/ { BARCODE_CODABLOCKF, -1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 110, 11, 167, 374, 224, "11 rows, 15 cols" }, - /*158*/ { BARCODE_CODABLOCKF, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 110, 11, 167, 374, 224, "" }, - /*159*/ { BARCODE_NVE18, 1, "12345678901234567", "", 0, 5, 1, 156, 312, 10, "" }, - /*160*/ { BARCODE_NVE18, 4, "12345678901234567", "", 0, 5, 1, 156, 312, 10, "" }, + /*158*/ { BARCODE_CODABLOCKF, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 88, 11, 167, 374, 180, "" }, + /*159*/ { BARCODE_NVE18, 1, "12345678901234567", "", 0, 1, 1, 156, 312, 2, "" }, + /*160*/ { BARCODE_NVE18, 4, "12345678901234567", "", 0, 4, 1, 156, 312, 8, "" }, /*161*/ { BARCODE_NVE18, 6, "12345678901234567", "", 0, 6, 1, 156, 312, 12, "" }, /*162*/ { BARCODE_JAPANPOST, -1, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*163*/ { BARCODE_JAPANPOST, 1, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*164*/ { BARCODE_JAPANPOST, 4, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*165*/ { BARCODE_JAPANPOST, 7, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*166*/ { BARCODE_JAPANPOST, 16, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*167*/ { BARCODE_KOREAPOST, 1, "123456", "", 0, 5, 1, 167, 334, 10, "" }, - /*168*/ { BARCODE_KOREAPOST, 4, "123456", "", 0, 5, 1, 167, 334, 10, "" }, + /*163*/ { BARCODE_JAPANPOST, 1, "1234567890", "", 0, 2.5, 3, 133, 266, 5, "" }, + /*164*/ { BARCODE_JAPANPOST, 4, "1234567890", "", 0, 4, 3, 133, 266, 8, "" }, + /*165*/ { BARCODE_JAPANPOST, 7, "1234567890", "", 0, 7, 3, 133, 266, 14, "" }, + /*166*/ { BARCODE_JAPANPOST, 16, "1234567890", "", 0, 16, 3, 133, 266, 32, "" }, + /*167*/ { BARCODE_KOREAPOST, 1, "123456", "", 0, 1, 1, 167, 334, 2, "" }, + /*168*/ { BARCODE_KOREAPOST, 4, "123456", "", 0, 4, 1, 167, 334, 8, "" }, /*169*/ { BARCODE_DBAR_STK, -1, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*170*/ { BARCODE_DBAR_STK, 1, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*171*/ { BARCODE_DBAR_STK, 4, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*172*/ { BARCODE_DBAR_STK, 12, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, + /*170*/ { BARCODE_DBAR_STK, 1, "1234567890123", "", 0, 2, 3, 50, 100, 4, "" }, + /*171*/ { BARCODE_DBAR_STK, 4, "1234567890123", "", 0, 4.5, 3, 50, 100, 9, "" }, + /*172*/ { BARCODE_DBAR_STK, 12, "1234567890123", "", 0, 12, 3, 50, 100, 24, "" }, /*173*/ { BARCODE_DBAR_STK, 13, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*174*/ { BARCODE_DBAR_STK, 24, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*175*/ { BARCODE_DBAR_STK, 26, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, + /*174*/ { BARCODE_DBAR_STK, 24, "1234567890123", "", 0, 24, 3, 50, 100, 48, "" }, + /*175*/ { BARCODE_DBAR_STK, 26, "1234567890123", "", 0, 26, 3, 50, 100, 52, "" }, /*176*/ { BARCODE_DBAR_OMNSTK, -1, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, - /*177*/ { BARCODE_DBAR_OMNSTK, 1, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, - /*178*/ { BARCODE_DBAR_OMNSTK, 4, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, - /*179*/ { BARCODE_DBAR_OMNSTK, 68, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, + /*177*/ { BARCODE_DBAR_OMNSTK, 1, "1234567890123", "", 0, 4, 5, 50, 100, 8, "" }, + /*178*/ { BARCODE_DBAR_OMNSTK, 4, "1234567890123", "", 0, 4, 5, 50, 100, 8, "" }, + /*179*/ { BARCODE_DBAR_OMNSTK, 68, "1234567890123", "", 0, 68, 5, 50, 100, 136, "" }, /*180*/ { BARCODE_DBAR_OMNSTK, 69, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, /*181*/ { BARCODE_DBAR_OMNSTK, 150, "1234567890123", "", 0, 150, 5, 50, 100, 300, "" }, /*182*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "2 rows" }, - /*183*/ { BARCODE_DBAR_EXPSTK, 1, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "" }, - /*184*/ { BARCODE_DBAR_EXPSTK, 4, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "" }, + /*183*/ { BARCODE_DBAR_EXPSTK, 1, "[01]12345678901231", "", 0, 4, 5, 102, 204, 8, "" }, + /*184*/ { BARCODE_DBAR_EXPSTK, 4, "[01]12345678901231", "", 0, 4, 5, 102, 204, 8, "" }, /*185*/ { BARCODE_DBAR_EXPSTK, 71, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "" }, - /*186*/ { BARCODE_DBAR_EXPSTK, 76, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "" }, + /*186*/ { BARCODE_DBAR_EXPSTK, 76, "[01]12345678901231", "", 0, 76, 5, 102, 204, 152, "" }, /*187*/ { BARCODE_DBAR_EXPSTK, -1, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "3 rows" }, - /*188*/ { BARCODE_DBAR_EXPSTK, 1, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, - /*189*/ { BARCODE_DBAR_EXPSTK, 54, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, - /*190*/ { BARCODE_DBAR_EXPSTK, 90, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, - /*191*/ { BARCODE_DBAR_EXPSTK, 160, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, + /*188*/ { BARCODE_DBAR_EXPSTK, 1, "[01]09501101530003[3920]123456789012345", "", 0, 7.5, 9, 102, 204, 15, "" }, + /*189*/ { BARCODE_DBAR_EXPSTK, 54, "[01]09501101530003[3920]123456789012345", "", 0, 54, 9, 102, 204, 108, "" }, + /*190*/ { BARCODE_DBAR_EXPSTK, 90, "[01]09501101530003[3920]123456789012345", "", 0, 90, 9, 102, 204, 180, "" }, + /*191*/ { BARCODE_DBAR_EXPSTK, 160, "[01]09501101530003[3920]123456789012345", "", 0, 160.5, 9, 102, 204, 321, "" }, /*192*/ { BARCODE_PLANET, -1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*193*/ { BARCODE_PLANET, 1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*194*/ { BARCODE_PLANET, 4, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*195*/ { BARCODE_PLANET, 9, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*196*/ { BARCODE_PLANET, 24, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, + /*193*/ { BARCODE_PLANET, 1, "12345678901", "", 0, 1, 2, 123, 246, 2, "" }, + /*194*/ { BARCODE_PLANET, 4, "12345678901", "", 0, 4, 2, 123, 246, 8, "" }, + /*195*/ { BARCODE_PLANET, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "" }, + /*196*/ { BARCODE_PLANET, 24, "12345678901", "", 0, 24, 2, 123, 246, 48, "" }, /*197*/ { BARCODE_MICROPDF417, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "10 rows" }, - /*198*/ { BARCODE_MICROPDF417, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "" }, - /*199*/ { BARCODE_MICROPDF417, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "" }, - /*200*/ { BARCODE_MICROPDF417, 19, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "" }, + /*198*/ { BARCODE_MICROPDF417, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 5, 10, 82, 164, 10, "" }, + /*199*/ { BARCODE_MICROPDF417, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 5, 10, 82, 164, 10, "" }, + /*200*/ { BARCODE_MICROPDF417, 19, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 10, 82, 164, 40, "" }, /*201*/ { BARCODE_MICROPDF417, 30, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 30, 10, 82, 164, 60, "" }, /*202*/ { BARCODE_MICROPDF417, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 40, 20, 55, 110, 80, "20 rows" }, - /*203*/ { BARCODE_MICROPDF417, 20, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 40, 20, 55, 110, 80, "" }, + /*203*/ { BARCODE_MICROPDF417, 20, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 20, 55, 110, 40, "" }, /*204*/ { BARCODE_USPS_IMAIL, -1, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*205*/ { BARCODE_USPS_IMAIL, 1, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*206*/ { BARCODE_USPS_IMAIL, 4, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*207*/ { BARCODE_USPS_IMAIL, 7, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*208*/ { BARCODE_PLESSEY, 1, "1234567890", "", 0, 5, 1, 227, 454, 10, "" }, - /*209*/ { BARCODE_PLESSEY, 4, "1234567890", "", 0, 5, 1, 227, 454, 10, "" }, - /*210*/ { BARCODE_TELEPEN_NUM, 1, "1234567890", "", 0, 5, 1, 128, 256, 10, "" }, - /*211*/ { BARCODE_TELEPEN_NUM, 4, "1234567890", "", 0, 5, 1, 128, 256, 10, "" }, - /*212*/ { BARCODE_ITF14, 1, "1234567890", "", 0, 5, 1, 135, 330, 30, "" }, - /*213*/ { BARCODE_ITF14, 4, "1234567890", "", 0, 5, 1, 135, 330, 30, "" }, + /*205*/ { BARCODE_USPS_IMAIL, 1, "12345678901234567890", "", 0, 2.5, 3, 129, 258, 5, "" }, + /*206*/ { BARCODE_USPS_IMAIL, 4, "12345678901234567890", "", 0, 4, 3, 129, 258, 8, "" }, + /*207*/ { BARCODE_USPS_IMAIL, 7, "12345678901234567890", "", 0, 7, 3, 129, 258, 14, "" }, + /*208*/ { BARCODE_PLESSEY, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "" }, + /*209*/ { BARCODE_PLESSEY, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "" }, + /*210*/ { BARCODE_TELEPEN_NUM, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "" }, + /*211*/ { BARCODE_TELEPEN_NUM, 4, "1234567890", "", 0, 4, 1, 128, 256, 8, "" }, + /*212*/ { BARCODE_ITF14, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "" }, + /*213*/ { BARCODE_ITF14, 4, "1234567890", "", 0, 4, 1, 135, 330, 28, "" }, /*214*/ { BARCODE_ITF14, 64, "1234567890", "", 0, 64, 1, 135, 330, 148, "" }, /*215*/ { BARCODE_KIX, -1, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*216*/ { BARCODE_KIX, 1, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*217*/ { BARCODE_KIX, 4, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*218*/ { BARCODE_KIX, 6, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*219*/ { BARCODE_KIX, 10, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*220*/ { BARCODE_KIX, 16, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, + /*216*/ { BARCODE_KIX, 1, "1234567890", "", 0, 2.5, 3, 79, 158, 5, "" }, + /*217*/ { BARCODE_KIX, 4, "1234567890", "", 0, 4, 3, 79, 158, 8, "" }, + /*218*/ { BARCODE_KIX, 6, "1234567890", "", 0, 6.5, 3, 79, 158, 13, "" }, + /*219*/ { BARCODE_KIX, 10, "1234567890", "", 0, 10.5, 3, 79, 158, 21, "" }, + /*220*/ { BARCODE_KIX, 16, "1234567890", "", 0, 16, 3, 79, 158, 32, "" }, /*221*/ { BARCODE_AZTEC, 1, "1234567890AB", "", 0, 15, 15, 15, 30, 30, "Fixed width-to-height ratio, symbol->height ignored" }, /*222*/ { BARCODE_DAFT, -1, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*223*/ { BARCODE_DAFT, 1, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*224*/ { BARCODE_DAFT, 4, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*225*/ { BARCODE_DAFT, 6, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*226*/ { BARCODE_DAFT, 12, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*227*/ { BARCODE_DAFT, 16, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*228*/ { BARCODE_DPD, 1, "0123456789012345678901234567", "", 0, 5, 1, 189, 378, 10, "" }, - /*229*/ { BARCODE_DPD, 4, "0123456789012345678901234567", "", 0, 5, 1, 189, 378, 10, "" }, + /*223*/ { BARCODE_DAFT, 1, "DAFTDAFTDAFTDAFT", "", 0, 2.5, 3, 31, 62, 5, "" }, + /*224*/ { BARCODE_DAFT, 4, "DAFTDAFTDAFTDAFT", "", 0, 4, 3, 31, 62, 8, "" }, + /*225*/ { BARCODE_DAFT, 6, "DAFTDAFTDAFTDAFT", "", 0, 6.5, 3, 31, 62, 13, "" }, + /*226*/ { BARCODE_DAFT, 12, "DAFTDAFTDAFTDAFT", "", 0, 12, 3, 31, 62, 24, "" }, + /*227*/ { BARCODE_DAFT, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" }, + /*228*/ { BARCODE_DPD, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 2, "" }, + /*229*/ { BARCODE_DPD, 4, "0123456789012345678901234567", "", 0, 4, 1, 189, 378, 8, "" }, /*230*/ { BARCODE_DPD, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 124, "" }, /*231*/ { BARCODE_MICROQR, 1, "12345", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" }, - /*232*/ { BARCODE_HIBC_128, 1, "1234567890", "", 0, 5, 1, 123, 246, 10, "" }, - /*233*/ { BARCODE_HIBC_128, 4, "1234567890", "", 0, 5, 1, 123, 246, 10, "" }, - /*234*/ { BARCODE_HIBC_39, 1, "1234567890", "", 0, 5, 1, 223, 446, 10, "" }, - /*235*/ { BARCODE_HIBC_39, 4, "1234567890", "", 0, 5, 1, 223, 446, 10, "" }, + /*232*/ { BARCODE_HIBC_128, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" }, + /*233*/ { BARCODE_HIBC_128, 4, "1234567890", "", 0, 4, 1, 123, 246, 8, "" }, + /*234*/ { BARCODE_HIBC_39, 1, "1234567890", "", 0, 1, 1, 223, 446, 2, "" }, + /*235*/ { BARCODE_HIBC_39, 4, "1234567890", "", 0, 4, 1, 223, 446, 8, "" }, /*236*/ { BARCODE_HIBC_DM, 1, "ABC", "", 0, 12, 12, 12, 24, 24, "Fixed width-to-height ratio, symbol->height ignored" }, /*237*/ { BARCODE_HIBC_QR, 1, "1234567890AB", "", 0, 21, 21, 21, 42, 42, "Fixed width-to-height ratio, symbol->height ignored" }, /*238*/ { BARCODE_HIBC_PDF, -1, "ABCDEF", "", 0, 21, 7, 103, 206, 42, "7 rows" }, - /*239*/ { BARCODE_HIBC_PDF, 1, "ABCDEF", "", 0, 21, 7, 103, 206, 42, "" }, - /*240*/ { BARCODE_HIBC_PDF, 4, "ABCDEF", "", 0, 21, 7, 103, 206, 42, "" }, + /*239*/ { BARCODE_HIBC_PDF, 1, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "" }, + /*240*/ { BARCODE_HIBC_PDF, 4, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "" }, /*241*/ { BARCODE_HIBC_PDF, 36, "ABCDEF", "", 0, 35, 7, 103, 206, 70, "" }, /*242*/ { BARCODE_HIBC_MICPDF, -1, "ABCDEF", "", 0, 12, 6, 82, 164, 24, "6 rows" }, - /*243*/ { BARCODE_HIBC_MICPDF, 1, "ABCDEF", "", 0, 12, 6, 82, 164, 24, "" }, - /*244*/ { BARCODE_HIBC_MICPDF, 4, "ABCDEF", "", 0, 12, 6, 82, 164, 24, "" }, - /*245*/ { BARCODE_HIBC_MICPDF, 47, "ABCDEF", "", 0, 42, 6, 82, 164, 84, "" }, + /*243*/ { BARCODE_HIBC_MICPDF, 1, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3, 6, 82, 164, 6, "" }, + /*244*/ { BARCODE_HIBC_MICPDF, 4, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3, 6, 82, 164, 6, "" }, + /*245*/ { BARCODE_HIBC_MICPDF, 47, "ABCDEF", "", 0, 48, 6, 82, 164, 96, "" }, /*246*/ { BARCODE_HIBC_BLOCKF, -1, "1234567890", "", 0, 30, 3, 101, 242, 64, "3 rows" }, - /*247*/ { BARCODE_HIBC_BLOCKF, 1, "1234567890", "", 0, 30, 3, 101, 242, 64, "" }, - /*248*/ { BARCODE_HIBC_BLOCKF, 4, "1234567890", "", 0, 30, 3, 101, 242, 64, "" }, - /*249*/ { BARCODE_HIBC_BLOCKF, 23, "1234567890", "", 0, 30, 3, 101, 242, 64, "" }, - /*250*/ { BARCODE_HIBC_BLOCKF, 60, "1234567890", "", 0, 30, 3, 101, 242, 64, "" }, + /*247*/ { BARCODE_HIBC_BLOCKF, 1, "1234567890", "", 0, 1.5, 3, 101, 242, 7, "" }, + /*248*/ { BARCODE_HIBC_BLOCKF, 4, "1234567890", "", 0, 4.5, 3, 101, 242, 13, "" }, + /*249*/ { BARCODE_HIBC_BLOCKF, 23, "1234567890", "", 0, 22.5, 3, 101, 242, 49, "" }, + /*250*/ { BARCODE_HIBC_BLOCKF, 60, "1234567890", "", 0, 60, 3, 101, 242, 124, "" }, /*251*/ { BARCODE_HIBC_AZTEC, 1, "1234567890AB", "", 0, 19, 19, 19, 38, 38, "Fixed width-to-height ratio, symbol->height ignored" }, /*252*/ { BARCODE_DOTCODE, 1, "ABC", "", 0, 11, 11, 16, 33, 23, "Fixed width-to-height ratio, symbol->height ignored" }, /*253*/ { BARCODE_HANXIN, 1, "1234567890AB", "", 0, 23, 23, 23, 46, 46, "Fixed width-to-height ratio, symbol->height ignored" }, /*254*/ { BARCODE_MAILMARK, -1, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*255*/ { BARCODE_MAILMARK, 1, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*256*/ { BARCODE_MAILMARK, 4, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*257*/ { BARCODE_MAILMARK, 6, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, + /*255*/ { BARCODE_MAILMARK, 1, "01000000000000000AA00AA0A", "", 0, 2.5, 3, 155, 310, 5, "" }, + /*256*/ { BARCODE_MAILMARK, 4, "01000000000000000AA00AA0A", "", 0, 4, 3, 155, 310, 8, "" }, + /*257*/ { BARCODE_MAILMARK, 6, "01000000000000000AA00AA0A", "", 0, 6, 3, 155, 310, 12, "" }, /*258*/ { BARCODE_MAILMARK, 10, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*259*/ { BARCODE_MAILMARK, 15, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*260*/ { BARCODE_MAILMARK, 20, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, + /*259*/ { BARCODE_MAILMARK, 15, "01000000000000000AA00AA0A", "", 0, 15, 3, 155, 310, 30, "" }, + /*260*/ { BARCODE_MAILMARK, 20, "01000000000000000AA00AA0A", "", 0, 20, 3, 155, 310, 40, "" }, /*261*/ { BARCODE_AZRUNE, 1, "1", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" }, - /*262*/ { BARCODE_CODE32, 1, "12345678", "", 0, 5, 1, 103, 206, 10, "" }, - /*263*/ { BARCODE_CODE32, 4, "12345678", "", 0, 5, 1, 103, 206, 10, "" }, + /*262*/ { BARCODE_CODE32, 1, "12345678", "", 0, 1, 1, 103, 206, 2, "" }, + /*263*/ { BARCODE_CODE32, 4, "12345678", "", 0, 4, 1, 103, 206, 8, "" }, /*264*/ { BARCODE_CODE32, 19, "12345678", "", 0, 19, 1, 103, 206, 38, "" }, /*265*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01", 0, 50, 7, 99, 234, 110, "EAN-13, CC-A 3 rows" }, - /*266*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01", 0, 17, 7, 99, 234, 44, "" }, - /*267*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01", 0, 17, 7, 99, 234, 44, "" }, + /*266*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "" }, + /*267*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "" }, /*268*/ { BARCODE_EANX_CC, 81, "123456789012", "[20]01", 0, 81, 7, 99, 234, 172, "" }, /*269*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 50, 9, 99, 234, 110, "EAN-13, CC-A 5 rows" }, - /*270*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 21, 9, 99, 234, 52, "" }, - /*271*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 21, 9, 99, 234, 52, "" }, - /*272*/ { BARCODE_EANX_CC, 20, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 21, 9, 99, 234, 52, "" }, + /*270*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 16.5, 9, 99, 234, 43, "" }, + /*271*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 16.5, 9, 99, 234, 43, "" }, + /*272*/ { BARCODE_EANX_CC, 20, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 20, 9, 99, 234, 50, "" }, /*273*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 50, 11, 99, 234, 110, "EAN-13, CC-A 7 rows" }, - /*274*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 25, 11, 99, 234, 60, "" }, - /*275*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 25, 11, 99, 234, 60, "" }, + /*274*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20.5, 11, 99, 234, 51, "" }, + /*275*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20.5, 11, 99, 234, 51, "" }, /*276*/ { BARCODE_EANX_CC, 40, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 40, 11, 99, 234, 90, "" }, /*277*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 14, 99, 234, 110, "EAN-13, CC-B 10 rows" }, - /*278*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 31, 14, 99, 234, 72, "" }, - /*279*/ { BARCODE_EANX_CC, 30, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 31, 14, 99, 234, 72, "" }, + /*278*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 26.5, 14, 99, 234, 63, "" }, + /*279*/ { BARCODE_EANX_CC, 30, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 30, 14, 99, 234, 70, "" }, /*280*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01[90]123456789012345678901234", 0, 50, 10, 72, 172, 110, "EAN-8, CC-A 4 rows" }, - /*281*/ { BARCODE_EANX_CC, 1, "1234567", "[20]01[90]123456789012345678901234", 0, 23, 10, 72, 172, 56, "" }, - /*282*/ { BARCODE_EANX_CC, 4, "1234567", "[20]01[90]123456789012345678901234", 0, 23, 10, 72, 172, 56, "" }, + /*281*/ { BARCODE_EANX_CC, 1, "1234567", "[20]01[90]123456789012345678901234", 0, 18.5, 10, 72, 172, 47, "" }, + /*282*/ { BARCODE_EANX_CC, 4, "1234567", "[20]01[90]123456789012345678901234", 0, 18.5, 10, 72, 172, 47, "" }, /*283*/ { BARCODE_EANX_CC, 69, "1234567", "[20]01[90]123456789012345678901234", 0, 69, 10, 72, 172, 148, "" }, - /*284*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 24, 82, 192, 112, "EAN-8, CC-B 15 rows" }, - /*285*/ { BARCODE_EANX_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 24, 82, 192, 112, "" }, - /*286*/ { BARCODE_EANX_CC, 32, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 24, 82, 192, 112, "" }, + /*284*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 50, 24, 82, 192, 110, "EAN-8, CC-B 15 rows" }, + /*285*/ { BARCODE_EANX_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 46.5, 24, 82, 192, 103, "" }, + /*286*/ { BARCODE_EANX_CC, 32, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 46.5, 24, 82, 192, 103, "" }, /*287*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01", 0, 50, 5, 145, 290, 100, "CC-A 3 rows" }, - /*288*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01", 0, 12, 5, 145, 290, 24, "" }, - /*289*/ { BARCODE_GS1_128_CC, 4, "[01]12345678901231", "[20]01", 0, 12, 5, 145, 290, 24, "" }, + /*288*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01", 0, 7.5, 5, 145, 290, 15, "" }, + /*289*/ { BARCODE_GS1_128_CC, 4, "[01]12345678901231", "[20]01", 0, 7.5, 5, 145, 290, 15, "" }, /*290*/ { BARCODE_GS1_128_CC, 12, "[01]12345678901231", "[20]01", 0, 12, 5, 145, 290, 24, "" }, /*291*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 50, 9, 145, 290, 100, "CC-A 7 rows" }, - /*292*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20, 9, 145, 290, 40, "" }, + /*292*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 15.5, 9, 145, 290, 31, "" }, /*293*/ { BARCODE_GS1_128_CC, 52, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 52, 9, 145, 290, 104, "" }, /*294*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 12, 145, 290, 100, "CC-B 10 rows" }, - /*295*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 26, 12, 145, 290, 52, "" }, + /*295*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 145, 290, 43, "" }, /*296*/ { BARCODE_GS1_128_CC, 40, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40, 12, 145, 290, 80, "" }, - /*297*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 96, 32, 154, 308, 192, "CC-C 30 rows" }, - /*298*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 96, 32, 154, 308, 192, "" }, + /*297*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 91.5, 32, 154, 308, 183, "CC-C 30 rows" }, + /*298*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 91.5, 32, 154, 308, 183, "" }, /*299*/ { BARCODE_GS1_128_CC, 100, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 100, 32, 154, 308, 200, "" }, /*300*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01[90]1234567890", 0, 21, 5, 100, 200, 42, "CC-A 3 rows" }, - /*301*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]1234567890", 0, 21, 5, 100, 200, 42, "" }, - /*302*/ { BARCODE_DBAR_OMN_CC, 4, "1234567890123", "[20]01[90]1234567890", 0, 21, 5, 100, 200, 42, "" }, + /*301*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]1234567890", 0, 7.5, 5, 100, 200, 15, "" }, + /*302*/ { BARCODE_DBAR_OMN_CC, 4, "1234567890123", "[20]01[90]1234567890", 0, 7.5, 5, 100, 200, 15, "" }, /*303*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "CC-A 4 rows" }, - /*304*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "" }, - /*305*/ { BARCODE_DBAR_OMN_CC, 4, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "" }, - /*306*/ { BARCODE_DBAR_OMN_CC, 20, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "" }, + /*304*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]12345678901234567890", 0, 9.5, 6, 100, 200, 19, "" }, + /*305*/ { BARCODE_DBAR_OMN_CC, 4, "1234567890123", "[20]01[90]12345678901234567890", 0, 9.5, 6, 100, 200, 19, "" }, + /*306*/ { BARCODE_DBAR_OMN_CC, 20, "1234567890123", "[20]01[90]12345678901234567890", 0, 20, 6, 100, 200, 40, "" }, /*307*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35, 12, 100, 200, 70, "CC-B 10 rows" }, - /*308*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35, 12, 100, 200, 70, "" }, - /*309*/ { BARCODE_DBAR_OMN_CC, 40, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35, 12, 100, 200, 70, "" }, + /*308*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 100, 200, 43, "" }, + /*309*/ { BARCODE_DBAR_OMN_CC, 40, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40, 12, 100, 200, 80, "" }, /*310*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 39, 14, 100, 200, 78, "CC-B 12 rows" }, - /*311*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 39, 14, 100, 200, 78, "" }, - /*312*/ { BARCODE_DBAR_OMN_CC, 36, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 39, 14, 100, 200, 78, "" }, + /*311*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 25.5, 14, 100, 200, 51, "" }, + /*312*/ { BARCODE_DBAR_OMN_CC, 36, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 36, 14, 100, 200, 72, "" }, /*313*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "CC-A 4 rows" }, - /*314*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "" }, - /*315*/ { BARCODE_DBAR_LTD_CC, 4, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "" }, - /*316*/ { BARCODE_DBAR_LTD_CC, 18, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "" }, + /*314*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01", 0, 9.5, 6, 79, 158, 19, "" }, + /*315*/ { BARCODE_DBAR_LTD_CC, 4, "1234567890123", "[20]01", 0, 9.5, 6, 79, 158, 19, "" }, + /*316*/ { BARCODE_DBAR_LTD_CC, 18, "1234567890123", "[20]01", 0, 18, 6, 79, 158, 36, "" }, /*317*/ { BARCODE_DBAR_LTD_CC, 19, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "" }, /*318*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "CC-A 7 rows" }, - /*319*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "" }, - /*320*/ { BARCODE_DBAR_LTD_CC, 26, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "" }, + /*319*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 15.5, 9, 79, 158, 31, "" }, + /*320*/ { BARCODE_DBAR_LTD_CC, 26, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 26, 9, 79, 158, 52, "" }, /*321*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "CC-B 20 rows" }, - /*322*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "" }, - /*323*/ { BARCODE_DBAR_LTD_CC, 50, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "" }, + /*322*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 41.5, 22, 88, 176, 83, "" }, + /*323*/ { BARCODE_DBAR_LTD_CC, 50, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 50, 22, 88, 176, 100, "" }, /*324*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "CC-A 3 rows" }, - /*325*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "" }, - /*326*/ { BARCODE_DBAR_EXP_CC, 4, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "" }, - /*327*/ { BARCODE_DBAR_EXP_CC, 40, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "" }, + /*325*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01", 0, 7.5, 5, 134, 268, 15, "" }, + /*326*/ { BARCODE_DBAR_EXP_CC, 4, "[01]12345678901231", "[20]01", 0, 7.5, 5, 134, 268, 15, "" }, + /*327*/ { BARCODE_DBAR_EXP_CC, 40, "[01]12345678901231", "[20]01", 0, 40, 5, 134, 268, 80, "" }, /*328*/ { BARCODE_DBAR_EXP_CC, 41, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "" }, /*329*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "CC-A 5 rows" }, - /*330*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "" }, - /*331*/ { BARCODE_DBAR_EXP_CC, 50, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "" }, + /*330*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 11.5, 7, 134, 268, 23, "" }, + /*331*/ { BARCODE_DBAR_EXP_CC, 50, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 50, 7, 134, 268, 100, "" }, /*332*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "CC-B 10 rows" }, - /*333*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "" }, - /*334*/ { BARCODE_DBAR_EXP_CC, 46, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "" }, + /*333*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 134, 268, 43, "" }, + /*334*/ { BARCODE_DBAR_EXP_CC, 46, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 46, 12, 134, 268, 92, "" }, /*335*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01", 0, 50, 7, 99, 234, 110, "CC-A 3 rows" }, - /*336*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01", 0, 17, 7, 99, 234, 44, "" }, - /*337*/ { BARCODE_UPCA_CC, 4, "12345678901", "[20]01", 0, 17, 7, 99, 234, 44, "" }, + /*336*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01", 0, 12.5, 7, 99, 234, 35, "" }, + /*337*/ { BARCODE_UPCA_CC, 4, "12345678901", "[20]01", 0, 12.5, 7, 99, 234, 35, "" }, /*338*/ { BARCODE_UPCA_CC, 81, "12345678901", "[20]01", 0, 81, 7, 99, 234, 172, "" }, /*339*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 50, 10, 99, 234, 110, "CC-A 6 rows" }, - /*340*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 23, 10, 99, 234, 56, "" }, - /*341*/ { BARCODE_UPCA_CC, 4, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 23, 10, 99, 234, 56, "" }, + /*340*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 18.5, 10, 99, 234, 47, "" }, + /*341*/ { BARCODE_UPCA_CC, 4, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 18.5, 10, 99, 234, 47, "" }, /*342*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 50, 16, 99, 234, 110, "CC-B 12 rows" }, - /*343*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 35, 16, 99, 234, 80, "" }, + /*343*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 30.5, 16, 99, 234, 71, "" }, /*344*/ { BARCODE_UPCA_CC, 51, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 51, 16, 99, 234, 112, "" }, /*345*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678", 0, 50, 11, 55, 142, 110, "CC-A 7 rows" }, - /*346*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678", 0, 25, 11, 55, 142, 60, "" }, - /*347*/ { BARCODE_UPCE_CC, 4, "1234567", "[20]01[90]123456789012345678", 0, 25, 11, 55, 142, 60, "" }, + /*346*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678", 0, 20.5, 11, 55, 142, 51, "" }, + /*347*/ { BARCODE_UPCE_CC, 4, "1234567", "[20]01[90]123456789012345678", 0, 20.5, 11, 55, 142, 51, "" }, /*348*/ { BARCODE_UPCE_CC, 85, "1234567", "[20]01[90]123456789012345678", 0, 85, 11, 55, 142, 180, "" }, /*349*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 50, 16, 55, 142, 110, "CC-A 12 rows" }, - /*350*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 35, 16, 55, 142, 80, "" }, + /*350*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 30.5, 16, 55, 142, 71, "" }, /*351*/ { BARCODE_UPCE_CC, 49, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 49, 16, 55, 142, 108, "" }, /*352*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 21, 55, 142, 110, "CC-B 17 rows" }, - /*353*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 45, 21, 55, 142, 100, "" }, - /*354*/ { BARCODE_UPCE_CC, 4, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 45, 21, 55, 142, 100, "" }, - /*355*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 57, 27, 55, 142, 124, "CC-B 23 rows" }, - /*356*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 57, 27, 55, 142, 124, "" }, - /*357*/ { BARCODE_UPCE_CC, 52, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 57, 27, 55, 142, 124, "" }, + /*353*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40.5, 21, 55, 142, 91, "" }, + /*354*/ { BARCODE_UPCE_CC, 4, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40.5, 21, 55, 142, 91, "" }, + /*355*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 142, 115, "CC-B 23 rows" }, + /*356*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 142, 115, "" }, + /*357*/ { BARCODE_UPCE_CC, 52, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 142, 115, "" }, /*358*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "CC-A 5 rows" }, - /*359*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "" }, - /*360*/ { BARCODE_DBAR_STK_CC, 4, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "" }, + /*359*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01", 0, 13, 9, 56, 112, 26, "" }, + /*360*/ { BARCODE_DBAR_STK_CC, 4, "1234567890123", "[20]01", 0, 13, 9, 56, 112, 26, "" }, /*361*/ { BARCODE_DBAR_STK_CC, 24, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "" }, /*362*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "CC-A 12 rows" }, - /*363*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "" }, - /*364*/ { BARCODE_DBAR_STK_CC, 25, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "" }, + /*363*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 27, 16, 56, 112, 54, "" }, + /*364*/ { BARCODE_DBAR_STK_CC, 25, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 27, 16, 56, 112, 54, "" }, /*365*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "CC-B 17 rows" }, - /*366*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "" }, - /*367*/ { BARCODE_DBAR_STK_CC, 59, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "" }, + /*366*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 37, 21, 56, 112, 74, "" }, + /*367*/ { BARCODE_DBAR_STK_CC, 59, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 59, 21, 56, 112, 118, "" }, /*368*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "CC-A 6 rows" }, - /*369*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "" }, - /*370*/ { BARCODE_DBAR_OMNSTK_CC, 4, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "" }, - /*371*/ { BARCODE_DBAR_OMNSTK_CC, 80, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "" }, + /*369*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]1234567890123456", 0, 17, 12, 56, 112, 34, "" }, + /*370*/ { BARCODE_DBAR_OMNSTK_CC, 4, "1234567890123", "[20]01[90]1234567890123456", 0, 17, 12, 56, 112, 34, "" }, + /*371*/ { BARCODE_DBAR_OMNSTK_CC, 80, "1234567890123", "[20]01[90]1234567890123456", 0, 80, 12, 56, 112, 160, "" }, /*372*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "CC-A 12 rows" }, - /*373*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "" }, + /*373*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 29, 18, 56, 112, 58, "" }, /*374*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "CC-B 17 rows" }, - /*375*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "" }, - /*376*/ { BARCODE_DBAR_OMNSTK_CC, 4, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "" }, - /*377*/ { BARCODE_DBAR_OMNSTK_CC, 52, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "" }, + /*375*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 39, 23, 56, 112, 78, "" }, + /*376*/ { BARCODE_DBAR_OMNSTK_CC, 4, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 39, 23, 56, 112, 78, "" }, + /*377*/ { BARCODE_DBAR_OMNSTK_CC, 52, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 52, 23, 56, 112, 104, "" }, /*378*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "3 rows, CC-A 3 rows" }, - /*379*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "" }, - /*380*/ { BARCODE_DBAR_EXPSTK_CC, 4, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "" }, - /*381*/ { BARCODE_DBAR_EXPSTK_CC, 77, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "" }, + /*379*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01", 0, 11, 9, 102, 204, 22, "" }, + /*380*/ { BARCODE_DBAR_EXPSTK_CC, 4, "[01]12345678901231", "[20]01", 0, 11, 9, 102, 204, 22, "" }, + /*381*/ { BARCODE_DBAR_EXPSTK_CC, 77, "[01]12345678901231", "[20]01", 0, 77, 9, 102, 204, 154, "" }, /*382*/ { BARCODE_DBAR_EXPSTK_CC, 78, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "" }, /*383*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "5 rows, CC-A 3 rows" }, - /*384*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "" }, + /*384*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 21.5, 21, 102, 204, 43, "" }, /*385*/ { BARCODE_DBAR_EXPSTK_CC, 190, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "" }, /*386*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "3 rows, CC-A 4 rows" }, - /*387*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "" }, - /*388*/ { BARCODE_DBAR_EXPSTK_CC, 38, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "" }, + /*387*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 13, 10, 102, 204, 26, "" }, + /*388*/ { BARCODE_DBAR_EXPSTK_CC, 38, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 38, 10, 102, 204, 76, "" }, /*389*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "3 rows, CC-B 10 rows" }, - /*390*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "" }, - /*391*/ { BARCODE_DBAR_EXPSTK_CC, 4, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "" }, - /*392*/ { BARCODE_DBAR_EXPSTK_CC, 47, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "" }, + /*390*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 25, 16, 102, 204, 50, "" }, + /*391*/ { BARCODE_DBAR_EXPSTK_CC, 4, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 25, 16, 102, 204, 50, "" }, + /*392*/ { BARCODE_DBAR_EXPSTK_CC, 47, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 47, 16, 102, 204, 94, "" }, /*393*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "5 rows, CC-B 10 rows" }, - /*394*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "" }, - /*395*/ { BARCODE_CHANNEL, 1, "1", "", 0, 5, 1, 19, 38, 10, "" }, - /*396*/ { BARCODE_CHANNEL, 4, "123", "", 0, 5, 1, 23, 46, 10, "" }, + /*394*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35.5, 28, 102, 204, 71, "" }, + /*395*/ { BARCODE_CHANNEL, 1, "1", "", 0, 1, 1, 19, 38, 2, "" }, + /*396*/ { BARCODE_CHANNEL, 4, "123", "", 0, 4, 1, 23, 46, 8, "" }, /*397*/ { BARCODE_CODEONE, 1, "12345678901234567890", "", 0, 16, 16, 18, 36, 32, "Fixed height, symbol->height ignored" }, /*398*/ { BARCODE_GRIDMATRIX, 1, "ABC", "", 0, 18, 18, 18, 36, 36, "Fixed width-to-height ratio, symbol->height ignored" }, /*399*/ { BARCODE_UPNQR, 1, "1234567890AB", "", 0, 77, 77, 77, 154, 154, "Fixed width-to-height ratio, symbol->height ignored" }, @@ -1664,11 +1669,11 @@ static void test_height(int index, int generate, int debug) { if (index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); if (generate) { - printf(" /*%3d*/ { %s, %d, \"%s\", \"%s\", %s, %d, %d, %d, %d, %d, \"%s\" },\n", + printf(" /*%3d*/ { %s, %.5g, \"%s\", \"%s\", %s, %.8g, %d, %d, %d, %d, \"%s\" },\n", i, testUtilBarcodeName(data[i].symbology), data[i].height, data[i].data, data[i].composite, testUtilErrorName(data[i].ret), symbol->height, symbol->rows, symbol->width, symbol->bitmap_width, symbol->bitmap_height, data[i].comment); } else { - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_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", diff --git a/backend/tests/test_svg.c b/backend/tests/test_svg.c index 7114741a..56e30011 100644 --- a/backend/tests/test_svg.c +++ b/backend/tests/test_svg.c @@ -54,52 +54,57 @@ static void test_print(int index, int generate, int debug) { int show_hrt; int option_1; int option_2; + float height; char *data; char *composite; + int ret; char *expected_file; }; struct item data[] = { - /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, -1, -1, -1, "<>\"&'", "", "code128_amperands.svg" }, - /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, "Égjpqy", "", "code128_egrave_bold.svg" }, - /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, "Égjpqy", "", "code128_egrave_bold_box3.svg" }, - /* 3*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, "Égjpqy", "", "code128_egrave_bold_hvwsp2_box2.svg" }, - /* 4*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, 3, 3, -1, -1, -1, "Égjpqy", "", "code128_egrave_bold_hvwsp3.svg" }, - /* 5*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", "gs1_128_cc_fig12.svg" }, - /* 6*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, -1, -1, 3, -1, "AAAAAAAAA", "", "codablockf_3rows.svg" }, - /* 7*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, 3, -1, "AAAAAAAAA", "", "codablockf_hvwsp2.svg" }, - /* 8*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, "AAAAAAAAA", "", "codablockf_hvwsp2_box2.svg" }, - /* 9*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, "9771384524017+12", "", "ean13_2addon_ggs_5.2.2.5.1-2.svg" }, - /* 10*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, "9780877799306+54321", "", "ean13_5addon_ggs_5.2.2.5.2-2.svg" }, - /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, "123456789012+12", "[91]123456789012345678901", "ean13_cc_2addon_cca_4x4.svg" }, - /* 12*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, "123456789012+54321", "[91]1234567890", "ean13_cc_5addon_ccb_3x4.svg" }, - /* 13*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, "123456789012+54321", "[91]1234567890", "ean13_cc_5addon_ccb_3x4_notext.svg" }, - /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, "012345678905+24", "", "upca_2addon_ggs_5.2.6.6-5.svg" }, - /* 15*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, "614141234417+12345", "", "upca_5addon.svg" }, - /* 16*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, "614141234417+12345", "", "upca_5addon_bind3.svg" }, - /* 17*/ { BARCODE_UPCA, -1, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, -1, -1, "614141234417+12345", "", "upca_5addon_small_bold.svg" }, - /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, "12345678901+12", "[91]123456789", "upca_cc_2addon_cca_3x4.svg" }, - /* 19*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, "12345678901+12121", "[91]1234567890123", "upca_cc_5addon_ccb_4x4.svg" }, - /* 20*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, "12345678901+12121", "[91]1234567890123", "upca_cc_5addon_ccb_4x4_notext.svg" }, - /* 21*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, "12345678901+12121", "[91]1234567890123", "upca_cc_5addon_ccb_4x4_bind3.svg" }, - /* 22*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, "1234567+12", "", "upce_2addon.svg" }, - /* 23*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, "1234567+12345", "", "upce_5addon.svg" }, - /* 24*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, "1234567+12345", "", "upce_5addon_small.svg" }, - /* 25*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, 0, -1, -1, "1234567+12345", "", "upce_5addon_notext.svg" }, - /* 26*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, "0654321+89", "[91]1", "upce_cc_2addon_cca_5x2.svg" }, - /* 27*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, "1876543+56789", "[91]12345", "upce_cc_5addon_ccb_8x2.svg" }, - /* 28*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, "1876543+56789", "[91]12345", "upce_cc_5addon_ccb_8x2_notext.svg" }, - /* 29*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, "1234567+12", "", "ean8_2addon.svg" }, - /* 30*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, "1234567+12345", "", "ean8_5addon.svg" }, - /* 31*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, "9876543+65", "[91]1234567", "ean8_cc_2addon_cca_4x3.svg" }, - /* 32*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, "9876543+74083", "[91]123456789012345678", "ean8_cc_5addon_ccb_8x3.svg" }, - /* 33*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, "12345", "", "ean5.svg" }, - /* 34*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, "12", "", "ean2.svg" }, - /* 35*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, "123", "", "code39_small.svg" }, - /* 36*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, "12345", "", "postnet_zip.svg" }, - /* 37*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, -1, -1, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "maxicode_box2.svg" }, - /* 38*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "maxicode_vwsp1_bind1.svg" }, - /* 39*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, 1, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "datamatrix_vwsp1_bind1_dotty.svg" }, - /* 40*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", "datamatrix_hvwsp1_bind1_dotty.svg" }, + /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, -1, -1, -1, 0, "<>\"&'", "", 0, "code128_amperands.svg" }, + /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 0, "Égjpqy", "", 0, "code128_egrave_bold.svg" }, + /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, 0, "Égjpqy", "", 0, "code128_egrave_bold_box3.svg" }, + /* 3*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.svg" }, + /* 4*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, 3, 3, -1, -1, -1, 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp3.svg" }, + /* 5*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, 0, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.svg" }, + /* 6*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, -1, -1, 3, -1, 0, "AAAAAAAAA", "", 0, "codablockf_3rows.svg" }, + /* 7*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, 3, -1, 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2.svg" }, + /* 8*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.svg" }, + /* 9*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.svg" }, + /* 10*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.svg" }, + /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.svg" }, + /* 12*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.svg" }, + /* 13*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.svg" }, + /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.svg" }, + /* 15*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, "614141234417+12345", "", 0, "upca_5addon.svg" }, + /* 16*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, "614141234417+12345", "", 0, "upca_5addon_bind3.svg" }, + /* 17*/ { BARCODE_UPCA, -1, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, -1, -1, 0, "614141234417+12345", "", 0, "upca_5addon_small_bold.svg" }, + /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.svg" }, + /* 19*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.svg" }, + /* 20*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.svg" }, + /* 21*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.svg" }, + /* 22*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, "1234567+12", "", 0, "upce_2addon.svg" }, + /* 23*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, "1234567+12345", "", 0, "upce_5addon.svg" }, + /* 24*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, "1234567+12345", "", 0, "upce_5addon_small.svg" }, + /* 25*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, 0, -1, -1, 0, "1234567+12345", "", 0, "upce_5addon_notext.svg" }, + /* 26*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.svg" }, + /* 27*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.svg" }, + /* 28*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.svg" }, + /* 29*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "1234567+12", "", 0, "ean8_2addon.svg" }, + /* 30*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "1234567+12345", "", 0, "ean8_5addon.svg" }, + /* 31*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.svg" }, + /* 32*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.svg" }, + /* 33*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "12345", "", 0, "ean5.svg" }, + /* 34*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "12", "", 0, "ean2.svg" }, + /* 35*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, "123", "", 0, "code39_small.svg" }, + /* 36*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, "12345", "", 0, "postnet_zip.svg" }, + /* 37*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, -1, -1, -1, -1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_box2.svg" }, + /* 38*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.svg" }, + /* 39*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, 1, -1, -1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_vwsp1_bind1_dotty.svg" }, + /* 40*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_hvwsp1_bind1_dotty.svg" }, + /* 41*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, "12345678909", "", 0, "dbar_ltd.svg" }, + /* 42*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.svg" }, + /* 43*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, "12345678901234567890", "", 0, "imail_height7.75.svg" }, }; int data_size = ARRAY_SIZE(data); @@ -130,6 +135,9 @@ static void test_print(int index, int generate, int debug) { if (data[i].show_hrt != -1) { symbol->show_hrt = data[i].show_hrt; } + if (data[i].height) { + symbol->height = data[i].height; + } if (data[i].border_width != -1) { symbol->border_width = data[i].border_width; } @@ -148,7 +156,7 @@ static void test_print(int index, int generate, int debug) { int text_length = strlen(text); ret = ZBarcode_Encode(symbol, (unsigned char *) text, text_length); - assert_zero(ret, "i:%d %s ZBarcode_Encode ret %d != 0 %s\n", i, testUtilBarcodeName(data[i].symbology), ret, symbol->errtxt); + assert_equal(ret, data[i].ret, "i:%d %s ZBarcode_Encode ret %d != %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, data[i].ret, symbol->errtxt); strcpy(symbol->outfile, svg); ret = ZBarcode_Print(symbol, 0); @@ -157,9 +165,9 @@ static void test_print(int index, int generate, int debug) { assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); if (generate) { - printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, \"%s\", \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %.8g, \"%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].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].height, testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file); ret = rename(symbol->outfile, expected_file); assert_zero(ret, "i:%d rename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); diff --git a/backend/tests/test_tif.c b/backend/tests/test_tif.c index 75ca0092..c6dfdede 100644 --- a/backend/tests/test_tif.c +++ b/backend/tests/test_tif.c @@ -178,7 +178,8 @@ static void test_print(int index, int generate, int debug) { /* 11*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, 0, 0.5f, "", "", "1", "", "ultra_odd.tif", "" }, /* 12*/ { BARCODE_HANXIN, UNICODE_MODE, -1, -1, -1, -1, 4, 84, 0, 2, "", "", "1", "", "hanxin_v84_l4_scale2.tif", "" }, /* 13*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, 32, 0, 0, "4BE055", "", "1", "", "aztec_v32_fg.tif", "" }, - /* 14*/ { BARCODE_DAFT, -1, -1, -1, -1, -1, -1, -1, 1, 0.5f, "", "", "F", "", "daft_scale0.5.tif", "" }, + /* 14*/ { BARCODE_DAFT, -1, -1, -1, -1, -1, -1, -1, 8, 0.5f, "", "", "F", "", "daft_height8_scale0.5.tif", "" }, + /* 15*/ { BARCODE_DAFT, -1, -1, -1, -1, -1, -1, -1, 1, 0.5f, "", "", "DAFT", "", "daft_height1_scale0.5.tif", "" }, }; int data_size = ARRAY_SIZE(data); diff --git a/backend/tests/test_vector.c b/backend/tests/test_vector.c index ba32ef39..639ba111 100644 --- a/backend/tests/test_vector.c +++ b/backend/tests/test_vector.c @@ -131,7 +131,7 @@ static void test_buffer_vector(int index, int generate, int debug) { char *data; char *composite; - int expected_height; + float expected_height; int expected_rows; int expected_width; float expected_vector_width; @@ -298,11 +298,11 @@ static void test_buffer_vector(int index, int generate, int debug) { assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology); if (generate) { - printf(" /*%3d*/ { %s, \"%s\", \"%s\", %d, %d, %d, %.8g, %.8g },\n", + printf(" /*%3d*/ { %s, \"%s\", \"%s\", %.8g, %d, %d, %.8g, %.8g },\n", i, testUtilBarcodeName(data[i].symbology), data[i].data, data[i].composite, symbol->height, symbol->rows, symbol->width, symbol->vector->width, symbol->vector->height); } else { - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_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->vector->width, data[i].expected_vector_width, "i:%d (%s) symbol->vector->width %.8g != %.8g\n", @@ -328,7 +328,7 @@ static void test_upcean_hrt(int index, int debug) { char *data; int ret; - int expected_height; + float expected_height; int expected_rows; int expected_width; float expected_vector_width; @@ -403,7 +403,7 @@ static void test_upcean_hrt(int index, int debug) { assert_zero(ret, "i:%d ZBarcode_Buffer_Vector(%d) ret %d != 0\n", i, data[i].symbology, ret); assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology); - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_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); @@ -450,7 +450,7 @@ static void test_row_separator(int index, int debug) { char *data; int ret; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_separator_row; @@ -492,7 +492,7 @@ static void test_row_separator(int index, int debug) { assert_zero(ret, "i:%d ZBarcode_Buffer_Vector(%d) ret %d != 0\n", i, data[i].symbology, ret); assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology); - assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, data[i].symbology, symbol->height, data[i].expected_height); + 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); @@ -518,7 +518,7 @@ static void test_stacking(int index, int debug) { char *data; char *data2; - int expected_height; + float expected_height; int expected_rows; int expected_width; int expected_bitmap_width; @@ -556,7 +556,7 @@ static void test_stacking(int index, int debug) { assert_zero(ret, "i:%d ret %d != zero\n", i, ret); assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology); - assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, data[i].symbology, symbol->height, data[i].expected_height); + 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); @@ -570,7 +570,7 @@ static void test_stacking(int index, int debug) { assert_zero(ret, "i:%d ZBarcode_Buffer_Vector(%d) ret %d != 0\n", i, data[i].symbology, ret); assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology); - assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, data[i].symbology, symbol->height, data[i].expected_height); + 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); @@ -598,7 +598,7 @@ static void test_output_options(int index, int debug) { char *data; int ret; - int expected_height; + float expected_height; int expected_rows; int expected_width; float expected_vector_width; @@ -689,7 +689,7 @@ static void test_output_options(int index, int debug) { ZBarcode_Print(symbol, 0); } - assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %d != %d\n", i, data[i].symbology, symbol->height, data[i].expected_height); + 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); @@ -845,12 +845,12 @@ static void test_height(int index, int generate, int debug) { int ret; struct item { int symbology; - int height; + float height; char *data; char *composite; int ret; - int expected_height; + float expected_height; int expected_rows; int expected_width; float expected_vector_width; @@ -859,403 +859,403 @@ static void test_height(int index, int generate, int debug) { const char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_CODE11, 1, "1234567890", "", 0, 5, 1, 108, 216, 10, "" }, - /* 1*/ { BARCODE_CODE11, 4, "1234567890", "", 0, 5, 1, 108, 216, 10, "" }, + /* 0*/ { BARCODE_CODE11, 1, "1234567890", "", 0, 1, 1, 108, 216, 2, "" }, + /* 1*/ { BARCODE_CODE11, 4, "1234567890", "", 0, 4, 1, 108, 216, 8, "" }, /* 2*/ { BARCODE_CODE11, 10, "1234567890", "", 0, 10, 1, 108, 216, 20, "" }, - /* 3*/ { BARCODE_C25STANDARD, 1, "1234567890", "", 0, 5, 1, 117, 234, 10, "" }, - /* 4*/ { BARCODE_C25STANDARD, 4, "1234567890", "", 0, 5, 1, 117, 234, 10, "" }, + /* 3*/ { BARCODE_C25STANDARD, 1, "1234567890", "", 0, 1, 1, 117, 234, 2, "" }, + /* 4*/ { BARCODE_C25STANDARD, 4, "1234567890", "", 0, 4, 1, 117, 234, 8, "" }, /* 5*/ { BARCODE_C25STANDARD, 11, "1234567890", "", 0, 11, 1, 117, 234, 22, "" }, - /* 6*/ { BARCODE_C25INTER, 1, "1234567890", "", 0, 5, 1, 99, 198, 10, "" }, - /* 7*/ { BARCODE_C25INTER, 4, "1234567890", "", 0, 5, 1, 99, 198, 10, "" }, + /* 6*/ { BARCODE_C25INTER, 1, "1234567890", "", 0, 1, 1, 99, 198, 2, "" }, + /* 7*/ { BARCODE_C25INTER, 4, "1234567890", "", 0, 4, 1, 99, 198, 8, "" }, /* 8*/ { BARCODE_C25INTER, 15, "1234567890", "", 0, 15, 1, 99, 198, 30, "" }, - /* 9*/ { BARCODE_C25IATA, 1, "1234567890", "", 0, 5, 1, 149, 298, 10, "" }, - /* 10*/ { BARCODE_C25IATA, 4, "1234567890", "", 0, 5, 1, 149, 298, 10, "" }, + /* 9*/ { BARCODE_C25IATA, 1, "1234567890", "", 0, 1, 1, 149, 298, 2, "" }, + /* 10*/ { BARCODE_C25IATA, 4, "1234567890", "", 0, 4, 1, 149, 298, 8, "" }, /* 11*/ { BARCODE_C25IATA, 30, "1234567890", "", 0, 30, 1, 149, 298, 60, "" }, - /* 12*/ { BARCODE_C25LOGIC, 1, "1234567890", "", 0, 5, 1, 109, 218, 10, "" }, - /* 13*/ { BARCODE_C25LOGIC, 4, "1234567890", "", 0, 5, 1, 109, 218, 10, "" }, + /* 12*/ { BARCODE_C25LOGIC, 1, "1234567890", "", 0, 1, 1, 109, 218, 2, "" }, + /* 13*/ { BARCODE_C25LOGIC, 4, "1234567890", "", 0, 4, 1, 109, 218, 8, "" }, /* 14*/ { BARCODE_C25LOGIC, 41, "1234567890", "", 0, 41, 1, 109, 218, 82, "" }, - /* 15*/ { BARCODE_C25IND, 1, "1234567890", "", 0, 5, 1, 159, 318, 10, "" }, - /* 16*/ { BARCODE_C25IND, 4, "1234567890", "", 0, 5, 1, 159, 318, 10, "" }, + /* 15*/ { BARCODE_C25IND, 1, "1234567890", "", 0, 1, 1, 159, 318, 2, "" }, + /* 16*/ { BARCODE_C25IND, 4, "1234567890", "", 0, 4, 1, 159, 318, 8, "" }, /* 17*/ { BARCODE_C25IND, 21, "1234567890", "", 0, 21, 1, 159, 318, 42, "" }, - /* 18*/ { BARCODE_CODE39, 1, "1234567890", "", 0, 5, 1, 155, 310, 10, "" }, - /* 19*/ { BARCODE_CODE39, 4, "1", "", 0, 5, 1, 38, 76, 10, "" }, + /* 18*/ { BARCODE_CODE39, 1, "1234567890", "", 0, 1, 1, 155, 310, 2, "" }, + /* 19*/ { BARCODE_CODE39, 4, "1", "", 0, 4, 1, 38, 76, 8, "" }, /* 20*/ { BARCODE_CODE39, 17, "1234567890", "", 0, 17, 1, 155, 310, 34, "" }, - /* 21*/ { BARCODE_EXCODE39, 1, "1234567890", "", 0, 5, 1, 155, 310, 10, "" }, - /* 22*/ { BARCODE_EXCODE39, 4, "1234567890", "", 0, 5, 1, 155, 310, 10, "" }, + /* 21*/ { BARCODE_EXCODE39, 1, "1234567890", "", 0, 1, 1, 155, 310, 2, "" }, + /* 22*/ { BARCODE_EXCODE39, 4, "1234567890", "", 0, 4, 1, 155, 310, 8, "" }, /* 23*/ { BARCODE_EXCODE39, 17, "1234567890", "", 0, 17, 1, 155, 310, 34, "" }, - /* 24*/ { BARCODE_EANX, 1, "123456789012", "", 0, 5, 1, 95, 226, 20, "EAN-13" }, - /* 25*/ { BARCODE_EANX, 4, "123456789012", "", 0, 5, 1, 95, 226, 20, "" }, + /* 24*/ { BARCODE_EANX, 1, "123456789012", "", 0, 1, 1, 95, 226, 12, "EAN-13" }, + /* 25*/ { BARCODE_EANX, 4, "123456789012", "", 0, 4, 1, 95, 226, 18, "" }, /* 26*/ { BARCODE_EANX, 69, "123456789012", "", 0, 69, 1, 95, 226, 148, "" }, /* 27*/ { BARCODE_EANX, 55, "1234567", "", 0, 55, 1, 67, 162, 120, "EAN-8" }, /* 28*/ { BARCODE_EANX, 66, "12345", "", 0, 66, 1, 47, 118, 132, "EAN-8" }, - /* 29*/ { BARCODE_EANX_CHK, 1, "1234567890128", "", 0, 5, 1, 95, 226, 20, "EAN-13" }, + /* 29*/ { BARCODE_EANX_CHK, 1, "1234567890128", "", 0, 1, 1, 95, 226, 12, "EAN-13" }, /* 30*/ { BARCODE_EANX_CHK, 69, "1234567890128", "", 0, 69, 1, 95, 226, 148, "" }, - /* 31*/ { BARCODE_GS1_128, 1, "[01]12345678901231", "", 0, 5, 1, 134, 268, 10, "" }, - /* 32*/ { BARCODE_GS1_128, 4, "[01]12345678901231", "", 0, 5, 1, 134, 268, 10, "" }, + /* 31*/ { BARCODE_GS1_128, 1, "[01]12345678901231", "", 0, 1, 1, 134, 268, 2, "" }, + /* 32*/ { BARCODE_GS1_128, 4, "[01]12345678901231", "", 0, 4, 1, 134, 268, 8, "" }, /* 33*/ { BARCODE_GS1_128, 5, "[01]12345678901231", "", 0, 5, 1, 134, 268, 10, "" }, /* 34*/ { BARCODE_GS1_128, 50, "[01]12345678901231", "", 0, 50, 1, 134, 268, 100, "" }, - /* 35*/ { BARCODE_CODABAR, 1, "A0B", "", 0, 5, 1, 32, 64, 10, "" }, - /* 36*/ { BARCODE_CODABAR, 4, "A0B", "", 0, 5, 1, 32, 64, 10, "" }, + /* 35*/ { BARCODE_CODABAR, 1, "A0B", "", 0, 1, 1, 32, 64, 2, "" }, + /* 36*/ { BARCODE_CODABAR, 4, "A0B", "", 0, 4, 1, 32, 64, 8, "" }, /* 37*/ { BARCODE_CODABAR, 26, "A0B", "", 0, 26, 1, 32, 64, 52, "" }, - /* 38*/ { BARCODE_CODE128, 1, "1234567890", "", 0, 5, 1, 90, 180, 10, "" }, - /* 39*/ { BARCODE_CODE128, 4, "1234567890", "", 0, 5, 1, 90, 180, 10, "" }, + /* 38*/ { BARCODE_CODE128, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "" }, + /* 39*/ { BARCODE_CODE128, 4, "1234567890", "", 0, 4, 1, 90, 180, 8, "" }, /* 40*/ { BARCODE_CODE128, 7, "1234567890", "", 0, 7, 1, 90, 180, 14, "" }, - /* 41*/ { BARCODE_DPLEIT, 1, "1234567890123", "", 0, 5, 1, 135, 270, 10, "" }, - /* 42*/ { BARCODE_DPLEIT, 4, "1234567890123", "", 0, 5, 1, 135, 270, 10, "" }, - /* 43*/ { BARCODE_DPIDENT, 1, "12345678901", "", 0, 5, 1, 117, 234, 10, "" }, - /* 44*/ { BARCODE_DPIDENT, 4, "12345678901", "", 0, 5, 1, 117, 234, 10, "" }, + /* 41*/ { BARCODE_DPLEIT, 1, "1234567890123", "", 0, 1, 1, 135, 270, 2, "" }, + /* 42*/ { BARCODE_DPLEIT, 4, "1234567890123", "", 0, 4, 1, 135, 270, 8, "" }, + /* 43*/ { BARCODE_DPIDENT, 1, "12345678901", "", 0, 1, 1, 117, 234, 2, "" }, + /* 44*/ { BARCODE_DPIDENT, 4, "12345678901", "", 0, 4, 1, 117, 234, 8, "" }, /* 45*/ { BARCODE_CODE16K, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "2 rows" }, - /* 46*/ { BARCODE_CODE16K, 1, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 47*/ { BARCODE_CODE16K, 4, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 48*/ { BARCODE_CODE16K, 17, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 49*/ { BARCODE_CODE16K, 40, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, + /* 46*/ { BARCODE_CODE16K, 1, "1234567890", "", 0, 1, 2, 70, 162, 6, "" }, + /* 47*/ { BARCODE_CODE16K, 4, "1234567890", "", 0, 4, 2, 70, 162, 12, "" }, + /* 48*/ { BARCODE_CODE16K, 17, "1234567890", "", 0, 17, 2, 70, 162, 38, "" }, + /* 49*/ { BARCODE_CODE16K, 40, "1234567890", "", 0, 40, 2, 70, 162, 84, "" }, /* 50*/ { BARCODE_CODE16K, -1, "12345678901234567890123456789012345678901234567890", "", 0, 60, 6, 70, 162, 124, "6 rows" }, - /* 51*/ { BARCODE_CODE16K, 30, "12345678901234567890123456789012345678901234567890", "", 0, 60, 6, 70, 162, 124, "" }, - /* 52*/ { BARCODE_CODE16K, 120, "12345678901234567890123456789012345678901234567890", "", 0, 60, 6, 70, 162, 124, "" }, + /* 51*/ { BARCODE_CODE16K, 30, "12345678901234567890123456789012345678901234567890", "", 0, 30, 6, 70, 162, 64, "" }, + /* 52*/ { BARCODE_CODE16K, 120, "12345678901234567890123456789012345678901234567890", "", 0, 120, 6, 70, 162, 244, "" }, /* 53*/ { BARCODE_CODE49, -1, "1234567890", "", 0, 20, 2, 70, 162, 44, "2 rows" }, - /* 54*/ { BARCODE_CODE49, 1, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 55*/ { BARCODE_CODE49, 4, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 56*/ { BARCODE_CODE49, 18, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, - /* 57*/ { BARCODE_CODE49, 40, "1234567890", "", 0, 20, 2, 70, 162, 44, "" }, + /* 54*/ { BARCODE_CODE49, 1, "1234567890", "", 0, 1, 2, 70, 162, 6, "" }, + /* 55*/ { BARCODE_CODE49, 4, "1234567890", "", 0, 4, 2, 70, 162, 12, "" }, + /* 56*/ { BARCODE_CODE49, 18, "1234567890", "", 0, 18, 2, 70, 162, 40, "" }, + /* 57*/ { BARCODE_CODE49, 40, "1234567890", "", 0, 40, 2, 70, 162, 84, "" }, /* 58*/ { BARCODE_CODE49, -1, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "3 rows" }, - /* 59*/ { BARCODE_CODE49, 15, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "" }, - /* 60*/ { BARCODE_CODE49, 45, "12345678901234567890", "", 0, 30, 3, 70, 162, 64, "" }, - /* 61*/ { BARCODE_CODE93, 1, "1234567890", "", 0, 5, 1, 127, 254, 10, "" }, - /* 62*/ { BARCODE_CODE93, 4, "1234567890", "", 0, 5, 1, 127, 254, 10, "" }, + /* 59*/ { BARCODE_CODE49, 15, "12345678901234567890", "", 0, 15, 3, 70, 162, 34, "" }, + /* 60*/ { BARCODE_CODE49, 45, "12345678901234567890", "", 0, 45, 3, 70, 162, 94, "" }, + /* 61*/ { BARCODE_CODE93, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "" }, + /* 62*/ { BARCODE_CODE93, 4, "1234567890", "", 0, 4, 1, 127, 254, 8, "" }, /* 63*/ { BARCODE_CODE93, 26, "1234567890", "", 0, 26, 1, 127, 254, 52, "" }, - /* 64*/ { BARCODE_FLAT, 1, "1234567890", "", 0, 5, 1, 90, 180, 10, "" }, - /* 65*/ { BARCODE_FLAT, 4, "1234567890", "", 0, 5, 1, 90, 180, 10, "" }, - /* 66*/ { BARCODE_DBAR_OMN, 1, "1234567890123", "", 0, 14, 1, 96, 192, 28, "" }, - /* 67*/ { BARCODE_DBAR_OMN, 4, "1234567890123", "", 0, 14, 1, 96, 192, 28, "" }, - /* 68*/ { BARCODE_DBAR_OMN, 12, "1234567890123", "", 0, 14, 1, 96, 192, 28, "" }, + /* 64*/ { BARCODE_FLAT, 1, "1234567890", "", 0, 1, 1, 90, 180, 2, "" }, + /* 65*/ { BARCODE_FLAT, 4, "1234567890", "", 0, 4, 1, 90, 180, 8, "" }, + /* 66*/ { BARCODE_DBAR_OMN, 1, "1234567890123", "", 0, 1, 1, 96, 192, 2, "" }, + /* 67*/ { BARCODE_DBAR_OMN, 4, "1234567890123", "", 0, 4, 1, 96, 192, 8, "" }, + /* 68*/ { BARCODE_DBAR_OMN, 12, "1234567890123", "", 0, 12, 1, 96, 192, 24, "" }, /* 69*/ { BARCODE_DBAR_OMN, 33, "1234567890123", "", 0, 33, 1, 96, 192, 66, "" }, - /* 70*/ { BARCODE_DBAR_LTD, 1, "1234567890123", "", 0, 10, 1, 79, 158, 20, "" }, - /* 71*/ { BARCODE_DBAR_LTD, 4, "1234567890123", "", 0, 10, 1, 79, 158, 20, "" }, - /* 72*/ { BARCODE_DBAR_LTD, 9, "1234567890123", "", 0, 10, 1, 79, 158, 20, "" }, + /* 70*/ { BARCODE_DBAR_LTD, 1, "1234567890123", "", 0, 1, 1, 79, 158, 2, "" }, + /* 71*/ { BARCODE_DBAR_LTD, 4, "1234567890123", "", 0, 4, 1, 79, 158, 8, "" }, + /* 72*/ { BARCODE_DBAR_LTD, 9, "1234567890123", "", 0, 9, 1, 79, 158, 18, "" }, /* 73*/ { BARCODE_DBAR_LTD, 10, "1234567890123", "", 0, 10, 1, 79, 158, 20, "" }, - /* 74*/ { BARCODE_DBAR_EXP, 1, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" }, - /* 75*/ { BARCODE_DBAR_EXP, 33, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" }, + /* 74*/ { BARCODE_DBAR_EXP, 1, "[01]12345678901231", "", 0, 1, 1, 134, 268, 2, "" }, + /* 75*/ { BARCODE_DBAR_EXP, 33, "[01]12345678901231", "", 0, 33, 1, 134, 268, 66, "" }, /* 76*/ { BARCODE_DBAR_EXP, 34, "[01]12345678901231", "", 0, 34, 1, 134, 268, 68, "" }, - /* 77*/ { BARCODE_TELEPEN, 1, "1234567890", "", 0, 5, 1, 208, 416, 10, "" }, - /* 78*/ { BARCODE_TELEPEN, 4, "1234567890", "", 0, 5, 1, 208, 416, 10, "" }, - /* 79*/ { BARCODE_UPCA, 1, "12345678901", "", 0, 5, 1, 95, 226, 20, "" }, - /* 80*/ { BARCODE_UPCA, 4, "12345678901", "", 0, 5, 1, 95, 226, 20, "" }, + /* 77*/ { BARCODE_TELEPEN, 1, "1234567890", "", 0, 1, 1, 208, 416, 2, "" }, + /* 78*/ { BARCODE_TELEPEN, 4, "1234567890", "", 0, 4, 1, 208, 416, 8, "" }, + /* 79*/ { BARCODE_UPCA, 1, "12345678901", "", 0, 1, 1, 95, 226, 12, "" }, + /* 80*/ { BARCODE_UPCA, 4, "12345678901", "", 0, 4, 1, 95, 226, 18, "" }, /* 81*/ { BARCODE_UPCA, 69, "12345678901", "", 0, 69, 1, 95, 226, 148, "" }, - /* 82*/ { BARCODE_UPCA_CHK, 1, "123456789012", "", 0, 5, 1, 95, 226, 20, "" }, - /* 83*/ { BARCODE_UPCE, 1, "1234567", "", 0, 5, 1, 51, 134, 20, "" }, - /* 84*/ { BARCODE_UPCE, 4, "1234567", "", 0, 5, 1, 51, 134, 20, "" }, + /* 82*/ { BARCODE_UPCA_CHK, 1, "123456789012", "", 0, 1, 1, 95, 226, 12, "" }, + /* 83*/ { BARCODE_UPCE, 1, "1234567", "", 0, 1, 1, 51, 134, 12, "" }, + /* 84*/ { BARCODE_UPCE, 4, "1234567", "", 0, 4, 1, 51, 134, 18, "" }, /* 85*/ { BARCODE_UPCE, 69, "1234567", "", 0, 69, 1, 51, 134, 148, "" }, - /* 86*/ { BARCODE_UPCE_CHK, 1, "12345670", "", 0, 5, 1, 51, 134, 20, "" }, + /* 86*/ { BARCODE_UPCE_CHK, 1, "12345670", "", 0, 1, 1, 51, 134, 12, "" }, /* 87*/ { BARCODE_POSTNET, -1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 88*/ { BARCODE_POSTNET, 1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 89*/ { BARCODE_POSTNET, 4, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 90*/ { BARCODE_POSTNET, 9, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 91*/ { BARCODE_POSTNET, 20, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /* 92*/ { BARCODE_MSI_PLESSEY, 1, "1234567890", "", 0, 5, 1, 127, 254, 10, "" }, - /* 93*/ { BARCODE_MSI_PLESSEY, 4, "1234567890", "", 0, 5, 1, 127, 254, 10, "" }, - /* 94*/ { BARCODE_FIM, 1, "A", "", 0, 5, 1, 17, 34, 10, "" }, - /* 95*/ { BARCODE_FIM, 4, "A", "", 0, 5, 1, 17, 34, 10, "" }, + /* 88*/ { BARCODE_POSTNET, 1, "12345678901", "", 0, 1, 2, 123, 246, 2, "" }, + /* 89*/ { BARCODE_POSTNET, 4, "12345678901", "", 0, 4, 2, 123, 246, 8, "" }, + /* 90*/ { BARCODE_POSTNET, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "" }, + /* 91*/ { BARCODE_POSTNET, 20, "12345678901", "", 0, 20, 2, 123, 246, 40, "" }, + /* 92*/ { BARCODE_MSI_PLESSEY, 1, "1234567890", "", 0, 1, 1, 127, 254, 2, "" }, + /* 93*/ { BARCODE_MSI_PLESSEY, 4, "1234567890", "", 0, 4, 1, 127, 254, 8, "" }, + /* 94*/ { BARCODE_FIM, 1, "A", "", 0, 1, 1, 17, 34, 2, "" }, + /* 95*/ { BARCODE_FIM, 4, "A", "", 0, 4, 1, 17, 34, 8, "" }, /* 96*/ { BARCODE_FIM, 12, "A", "", 0, 12, 1, 17, 34, 24, "" }, - /* 97*/ { BARCODE_LOGMARS, 1, "1234567890", "", 0, 5, 1, 191, 382, 10, "" }, - /* 98*/ { BARCODE_LOGMARS, 4, "1234567890", "", 0, 5, 1, 191, 382, 10, "" }, + /* 97*/ { BARCODE_LOGMARS, 1, "1234567890", "", 0, 1, 1, 191, 382, 2, "" }, + /* 98*/ { BARCODE_LOGMARS, 4, "1234567890", "", 0, 4, 1, 191, 382, 8, "" }, /* 99*/ { BARCODE_LOGMARS, 6, "1234567890", "", 0, 6, 1, 191, 382, 12, "" }, /*100*/ { BARCODE_LOGMARS, 45, "1234567890", "", 0, 45, 1, 191, 382, 90, "" }, - /*101*/ { BARCODE_PHARMA, 1, "123456", "", 0, 5, 1, 58, 116, 10, "" }, - /*102*/ { BARCODE_PHARMA, 4, "123456", "", 0, 5, 1, 58, 116, 10, "" }, + /*101*/ { BARCODE_PHARMA, 1, "123456", "", 0, 1, 1, 58, 116, 2, "" }, + /*102*/ { BARCODE_PHARMA, 4, "123456", "", 0, 4, 1, 58, 116, 8, "" }, /*103*/ { BARCODE_PHARMA, 15, "123456", "", 0, 15, 1, 58, 116, 30, "" }, /*104*/ { BARCODE_PHARMA, 16, "123456", "", 0, 16, 1, 58, 116, 32, "" }, - /*105*/ { BARCODE_PZN, 1, "123456", "", 0, 5, 1, 142, 284, 10, "" }, - /*106*/ { BARCODE_PZN, 4, "123456", "", 0, 5, 1, 142, 284, 10, "" }, + /*105*/ { BARCODE_PZN, 1, "123456", "", 0, 1, 1, 142, 284, 2, "" }, + /*106*/ { BARCODE_PZN, 4, "123456", "", 0, 4, 1, 142, 284, 8, "" }, /*107*/ { BARCODE_PZN, 17, "123456", "", 0, 17, 1, 142, 284, 34, "" }, /*108*/ { BARCODE_PZN, 106, "123456", "", 0, 106, 1, 142, 284, 212, "" }, /*109*/ { BARCODE_PHARMA_TWO, -1, "12345678", "", 0, 10, 2, 29, 58, 20, "" }, - /*110*/ { BARCODE_PHARMA_TWO, 1, "12345678", "", 0, 10, 2, 29, 58, 20, "" }, - /*111*/ { BARCODE_PHARMA_TWO, 4, "12345678", "", 0, 10, 2, 29, 58, 20, "" }, + /*110*/ { BARCODE_PHARMA_TWO, 1, "12345678", "", 0, 1, 2, 29, 58, 2, "" }, + /*111*/ { BARCODE_PHARMA_TWO, 4, "12345678", "", 0, 4, 2, 29, 58, 8, "" }, /*112*/ { BARCODE_PHARMA_TWO, 15, "12345678", "", 0, 15, 2, 29, 58, 30, "" }, /*113*/ { BARCODE_PHARMA_TWO, 20, "12345678", "", 0, 20, 2, 29, 58, 40, "" }, /*114*/ { BARCODE_PHARMA_TWO, 30, "12345678", "", 0, 30, 2, 29, 58, 60, "" }, - /*115*/ { BARCODE_PDF417, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "8 rows" }, - /*116*/ { BARCODE_PDF417, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "" }, - /*117*/ { BARCODE_PDF417, 23, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "" }, + /*115*/ { BARCODE_PDF417, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 4, 8, 120, 240, 8, "8 rows" }, + /*116*/ { BARCODE_PDF417, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 4, 8, 120, 240, 8, "" }, + /*117*/ { BARCODE_PDF417, 23, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 23, 8, 120, 240, 46, "" }, /*118*/ { BARCODE_PDF417, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 24, 8, 120, 240, 48, "" }, /*119*/ { BARCODE_PDF417, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 36, 12, 120, 240, 72, "12 rows" }, - /*120*/ { BARCODE_PDF417, 12, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 36, 12, 120, 240, 72, "" }, - /*121*/ { BARCODE_PDF417COMP, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", 0, 27, 9, 86, 172, 54, "9 rows" }, - /*122*/ { BARCODE_PDF417COMP, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", 0, 27, 9, 86, 172, 54, "" }, - /*123*/ { BARCODE_MAXICODE, 1, "1234567890", "", 0, 165, 33, 30, 60, 57.733398, "Fixed size, symbol->height ignored" }, + /*120*/ { BARCODE_PDF417, 12, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 12, 12, 120, 240, 24, "" }, + /*121*/ { BARCODE_PDF417COMP, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", ZINT_WARN_NONCOMPLIANT, 4.5, 9, 86, 172, 9, "9 rows" }, + /*122*/ { BARCODE_PDF417COMP, 24, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJ", "", ZINT_WARN_NONCOMPLIANT, 24, 9, 86, 172, 48, "" }, + /*123*/ { BARCODE_MAXICODE, 1, "1234567890", "", 0, 16.5, 33, 30, 60, 57.733398, "Fixed size, symbol->height ignored" }, /*124*/ { BARCODE_QRCODE, 1, "ABCD", "", 0, 21, 21, 21, 42, 42, "Fixed width-to-height ratio, symbol->height ignored" }, - /*125*/ { BARCODE_CODE128B, 1, "1234567890", "", 0, 5, 1, 145, 290, 10, "" }, - /*126*/ { BARCODE_CODE128B, 4, "1234567890", "", 0, 5, 1, 145, 290, 10, "" }, + /*125*/ { BARCODE_CODE128B, 1, "1234567890", "", 0, 1, 1, 145, 290, 2, "" }, + /*126*/ { BARCODE_CODE128B, 4, "1234567890", "", 0, 4, 1, 145, 290, 8, "" }, /*127*/ { BARCODE_AUSPOST, -1, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*128*/ { BARCODE_AUSPOST, 1, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*129*/ { BARCODE_AUSPOST, 4, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*130*/ { BARCODE_AUSPOST, 7, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*131*/ { BARCODE_AUSPOST, 14, "12345678901234567890123", "", 0, 8, 3, 133, 266, 16, "" }, - /*132*/ { BARCODE_AUSREPLY, 14, "12345678", "", 0, 8, 3, 73, 146, 16, "" }, - /*133*/ { BARCODE_AUSROUTE, 7, "12345678", "", 0, 8, 3, 73, 146, 16, "" }, - /*134*/ { BARCODE_AUSREDIRECT, 14, "12345678", "", 0, 8, 3, 73, 146, 16, "" }, - /*135*/ { BARCODE_ISBNX, 1, "123456789", "", 0, 5, 1, 95, 226, 20, "" }, - /*136*/ { BARCODE_ISBNX, 4, "123456789", "", 0, 5, 1, 95, 226, 20, "" }, + /*128*/ { BARCODE_AUSPOST, 1, "12345678901234567890123", "", 0, 2, 3, 133, 266, 4, "" }, + /*129*/ { BARCODE_AUSPOST, 4, "12345678901234567890123", "", 0, 4, 3, 133, 266, 8, "" }, + /*130*/ { BARCODE_AUSPOST, 7, "12345678901234567890123", "", 0, 7, 3, 133, 266, 14, "" }, + /*131*/ { BARCODE_AUSPOST, 14, "12345678901234567890123", "", 0, 14, 3, 133, 266, 28, "" }, + /*132*/ { BARCODE_AUSREPLY, 14, "12345678", "", 0, 14, 3, 73, 146, 28, "" }, + /*133*/ { BARCODE_AUSROUTE, 7, "12345678", "", 0, 7, 3, 73, 146, 14, "" }, + /*134*/ { BARCODE_AUSREDIRECT, 14, "12345678", "", 0, 14, 3, 73, 146, 28, "" }, + /*135*/ { BARCODE_ISBNX, 1, "123456789", "", 0, 1, 1, 95, 226, 12, "" }, + /*136*/ { BARCODE_ISBNX, 4, "123456789", "", 0, 4, 1, 95, 226, 18, "" }, /*137*/ { BARCODE_ISBNX, 69, "123456789", "", 0, 69, 1, 95, 226, 148, "" }, /*138*/ { BARCODE_RM4SCC, -1, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*139*/ { BARCODE_RM4SCC, 1, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*140*/ { BARCODE_RM4SCC, 4, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*141*/ { BARCODE_RM4SCC, 6, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*142*/ { BARCODE_RM4SCC, 11, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, - /*143*/ { BARCODE_RM4SCC, 16, "1234567890", "", 0, 8, 3, 91, 182, 16, "" }, + /*139*/ { BARCODE_RM4SCC, 1, "1234567890", "", 0, 2, 3, 91, 182, 4, "" }, + /*140*/ { BARCODE_RM4SCC, 4, "1234567890", "", 0, 4, 3, 91, 182, 8, "" }, + /*141*/ { BARCODE_RM4SCC, 6, "1234567890", "", 0, 6, 3, 91, 182, 12, "" }, + /*142*/ { BARCODE_RM4SCC, 11, "1234567890", "", 0, 11, 3, 91, 182, 22, "" }, + /*143*/ { BARCODE_RM4SCC, 16, "1234567890", "", 0, 16, 3, 91, 182, 32, "" }, /*144*/ { BARCODE_DATAMATRIX, 1, "ABCD", "", 0, 12, 12, 12, 24, 24, "Fixed width-to-height ratio, symbol->height ignored" }, - /*145*/ { BARCODE_EAN14, 1, "1234567890123", "", 0, 5, 1, 134, 268, 10, "" }, - /*146*/ { BARCODE_EAN14, 4, "1234567890123", "", 0, 5, 1, 134, 268, 10, "" }, + /*145*/ { BARCODE_EAN14, 1, "1234567890123", "", 0, 1, 1, 134, 268, 2, "" }, + /*146*/ { BARCODE_EAN14, 4, "1234567890123", "", 0, 4, 1, 134, 268, 8, "" }, /*147*/ { BARCODE_EAN14, 5, "1234567890123", "", 0, 5, 1, 134, 268, 10, "" }, - /*148*/ { BARCODE_VIN, 1, "12345678701234567", "", 0, 5, 1, 246, 492, 10, "" }, - /*149*/ { BARCODE_VIN, 4, "12345678701234567", "", 0, 5, 1, 246, 492, 10, "" }, + /*148*/ { BARCODE_VIN, 1, "12345678701234567", "", 0, 1, 1, 246, 492, 2, "" }, + /*149*/ { BARCODE_VIN, 4, "12345678701234567", "", 0, 4, 1, 246, 492, 8, "" }, /*150*/ { BARCODE_CODABLOCKF, -1, "1234567890", "", 0, 20, 2, 101, 242, 44, "2 rows" }, - /*151*/ { BARCODE_CODABLOCKF, 1, "1234567890", "", 0, 20, 2, 101, 242, 44, "" }, - /*152*/ { BARCODE_CODABLOCKF, 4, "1234567890", "", 0, 20, 2, 101, 242, 44, "" }, - /*153*/ { BARCODE_CODABLOCKF, 30, "1234567890", "", 0, 20, 2, 101, 242, 44, "" }, + /*151*/ { BARCODE_CODABLOCKF, 1, "1234567890", "", 0, 1, 2, 101, 242, 6, "" }, + /*152*/ { BARCODE_CODABLOCKF, 4, "1234567890", "", 0, 4, 2, 101, 242, 12, "" }, + /*153*/ { BARCODE_CODABLOCKF, 30, "1234567890", "", 0, 30, 2, 101, 242, 64, "" }, /*154*/ { BARCODE_CODABLOCKF, -1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 110, 11, 156, 352, 224, "11 rows, 14 cols" }, - /*155*/ { BARCODE_CODABLOCKF, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 110, 11, 156, 352, 224, "" }, - /*156*/ { BARCODE_CODABLOCKF, 220, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 110, 11, 156, 352, 224, "" }, + /*155*/ { BARCODE_CODABLOCKF, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 88, 11, 156, 352, 180, "" }, + /*156*/ { BARCODE_CODABLOCKF, 220, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs", "", 0, 220, 11, 156, 352, 444, "" }, /*157*/ { BARCODE_CODABLOCKF, -1, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 110, 11, 167, 374, 224, "11 rows, 15 cols" }, - /*158*/ { BARCODE_CODABLOCKF, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 110, 11, 167, 374, 224, "" }, - /*159*/ { BARCODE_NVE18, 1, "12345678901234567", "", 0, 5, 1, 156, 312, 10, "" }, - /*160*/ { BARCODE_NVE18, 4, "12345678901234567", "", 0, 5, 1, 156, 312, 10, "" }, + /*158*/ { BARCODE_CODABLOCKF, 88, "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv", "", 0, 88, 11, 167, 374, 180, "" }, + /*159*/ { BARCODE_NVE18, 1, "12345678901234567", "", 0, 1, 1, 156, 312, 2, "" }, + /*160*/ { BARCODE_NVE18, 4, "12345678901234567", "", 0, 4, 1, 156, 312, 8, "" }, /*161*/ { BARCODE_NVE18, 6, "12345678901234567", "", 0, 6, 1, 156, 312, 12, "" }, /*162*/ { BARCODE_JAPANPOST, -1, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*163*/ { BARCODE_JAPANPOST, 1, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*164*/ { BARCODE_JAPANPOST, 4, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*165*/ { BARCODE_JAPANPOST, 7, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*166*/ { BARCODE_JAPANPOST, 16, "1234567890", "", 0, 8, 3, 133, 266, 16, "" }, - /*167*/ { BARCODE_KOREAPOST, 1, "123456", "", 0, 5, 1, 167, 334, 10, "" }, - /*168*/ { BARCODE_KOREAPOST, 4, "123456", "", 0, 5, 1, 167, 334, 10, "" }, + /*163*/ { BARCODE_JAPANPOST, 1, "1234567890", "", 0, 2, 3, 133, 266, 4, "" }, + /*164*/ { BARCODE_JAPANPOST, 4, "1234567890", "", 0, 4, 3, 133, 266, 8, "" }, + /*165*/ { BARCODE_JAPANPOST, 7, "1234567890", "", 0, 7, 3, 133, 266, 14, "" }, + /*166*/ { BARCODE_JAPANPOST, 16, "1234567890", "", 0, 16, 3, 133, 266, 32, "" }, + /*167*/ { BARCODE_KOREAPOST, 1, "123456", "", 0, 1, 1, 167, 334, 2, "" }, + /*168*/ { BARCODE_KOREAPOST, 4, "123456", "", 0, 4, 1, 167, 334, 8, "" }, /*169*/ { BARCODE_DBAR_STK, -1, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*170*/ { BARCODE_DBAR_STK, 1, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*171*/ { BARCODE_DBAR_STK, 4, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*172*/ { BARCODE_DBAR_STK, 12, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, + /*170*/ { BARCODE_DBAR_STK, 1, "1234567890123", "", 0, 2.2, 3, 50, 100, 4.4000001, "" }, + /*171*/ { BARCODE_DBAR_STK, 4, "1234567890123", "", 0, 4, 3, 50, 100, 8, "" }, + /*172*/ { BARCODE_DBAR_STK, 12, "1234567890123", "", 0, 12, 3, 50, 100, 24, "" }, /*173*/ { BARCODE_DBAR_STK, 13, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*174*/ { BARCODE_DBAR_STK, 24, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, - /*175*/ { BARCODE_DBAR_STK, 26, "1234567890123", "", 0, 13, 3, 50, 100, 26, "" }, + /*174*/ { BARCODE_DBAR_STK, 24, "1234567890123", "", 0, 24, 3, 50, 100, 48, "" }, + /*175*/ { BARCODE_DBAR_STK, 26, "1234567890123", "", 0, 26, 3, 50, 100, 52, "" }, /*176*/ { BARCODE_DBAR_OMNSTK, -1, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, - /*177*/ { BARCODE_DBAR_OMNSTK, 1, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, - /*178*/ { BARCODE_DBAR_OMNSTK, 4, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, - /*179*/ { BARCODE_DBAR_OMNSTK, 68, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, + /*177*/ { BARCODE_DBAR_OMNSTK, 1, "1234567890123", "", 0, 4, 5, 50, 100, 8, "" }, + /*178*/ { BARCODE_DBAR_OMNSTK, 4, "1234567890123", "", 0, 4, 5, 50, 100, 8, "" }, + /*179*/ { BARCODE_DBAR_OMNSTK, 68, "1234567890123", "", 0, 68, 5, 50, 100, 136, "" }, /*180*/ { BARCODE_DBAR_OMNSTK, 69, "1234567890123", "", 0, 69, 5, 50, 100, 138, "" }, /*181*/ { BARCODE_DBAR_OMNSTK, 150, "1234567890123", "", 0, 150, 5, 50, 100, 300, "" }, /*182*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "2 rows" }, - /*183*/ { BARCODE_DBAR_EXPSTK, 1, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "" }, - /*184*/ { BARCODE_DBAR_EXPSTK, 4, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "" }, + /*183*/ { BARCODE_DBAR_EXPSTK, 1, "[01]12345678901231", "", 0, 4, 5, 102, 204, 8, "" }, + /*184*/ { BARCODE_DBAR_EXPSTK, 4, "[01]12345678901231", "", 0, 4, 5, 102, 204, 8, "" }, /*185*/ { BARCODE_DBAR_EXPSTK, 71, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "" }, - /*186*/ { BARCODE_DBAR_EXPSTK, 76, "[01]12345678901231", "", 0, 71, 5, 102, 204, 142, "" }, + /*186*/ { BARCODE_DBAR_EXPSTK, 76, "[01]12345678901231", "", 0, 76, 5, 102, 204, 152, "" }, /*187*/ { BARCODE_DBAR_EXPSTK, -1, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "3 rows" }, - /*188*/ { BARCODE_DBAR_EXPSTK, 1, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, - /*189*/ { BARCODE_DBAR_EXPSTK, 54, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, - /*190*/ { BARCODE_DBAR_EXPSTK, 90, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, - /*191*/ { BARCODE_DBAR_EXPSTK, 160, "[01]09501101530003[3920]123456789012345", "", 0, 108, 9, 102, 204, 216, "" }, + /*188*/ { BARCODE_DBAR_EXPSTK, 1, "[01]09501101530003[3920]123456789012345", "", 0, 7.5, 9, 102, 204, 15, "" }, + /*189*/ { BARCODE_DBAR_EXPSTK, 54, "[01]09501101530003[3920]123456789012345", "", 0, 54, 9, 102, 204, 108, "" }, + /*190*/ { BARCODE_DBAR_EXPSTK, 90, "[01]09501101530003[3920]123456789012345", "", 0, 90, 9, 102, 204, 180, "" }, + /*191*/ { BARCODE_DBAR_EXPSTK, 160, "[01]09501101530003[3920]123456789012345", "", 0, 160, 9, 102, 204, 320, "" }, /*192*/ { BARCODE_PLANET, -1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*193*/ { BARCODE_PLANET, 1, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*194*/ { BARCODE_PLANET, 4, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*195*/ { BARCODE_PLANET, 9, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, - /*196*/ { BARCODE_PLANET, 24, "12345678901", "", 0, 12, 2, 123, 246, 24, "" }, + /*193*/ { BARCODE_PLANET, 1, "12345678901", "", 0, 1, 2, 123, 246, 2, "" }, + /*194*/ { BARCODE_PLANET, 4, "12345678901", "", 0, 4, 2, 123, 246, 8, "" }, + /*195*/ { BARCODE_PLANET, 9, "12345678901", "", 0, 9, 2, 123, 246, 18, "" }, + /*196*/ { BARCODE_PLANET, 24, "12345678901", "", 0, 24, 2, 123, 246, 48, "" }, /*197*/ { BARCODE_MICROPDF417, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "10 rows" }, - /*198*/ { BARCODE_MICROPDF417, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "" }, - /*199*/ { BARCODE_MICROPDF417, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "" }, - /*200*/ { BARCODE_MICROPDF417, 19, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 20, 10, 82, 164, 40, "" }, + /*198*/ { BARCODE_MICROPDF417, 1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 5, 10, 82, 164, 10, "" }, + /*199*/ { BARCODE_MICROPDF417, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 5, 10, 82, 164, 10, "" }, + /*200*/ { BARCODE_MICROPDF417, 19, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 19, 10, 82, 164, 38, "" }, /*201*/ { BARCODE_MICROPDF417, 30, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 30, 10, 82, 164, 60, "" }, /*202*/ { BARCODE_MICROPDF417, -1, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 40, 20, 55, 110, 80, "20 rows" }, - /*203*/ { BARCODE_MICROPDF417, 20, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, 40, 20, 55, 110, 80, "" }, + /*203*/ { BARCODE_MICROPDF417, 20, "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ", "", ZINT_WARN_NONCOMPLIANT, 20, 20, 55, 110, 40, "" }, /*204*/ { BARCODE_USPS_IMAIL, -1, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*205*/ { BARCODE_USPS_IMAIL, 1, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*206*/ { BARCODE_USPS_IMAIL, 4, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*207*/ { BARCODE_USPS_IMAIL, 7, "12345678901234567890", "", 0, 8, 3, 129, 258, 16, "" }, - /*208*/ { BARCODE_PLESSEY, 1, "1234567890", "", 0, 5, 1, 227, 454, 10, "" }, - /*209*/ { BARCODE_PLESSEY, 4, "1234567890", "", 0, 5, 1, 227, 454, 10, "" }, - /*210*/ { BARCODE_TELEPEN_NUM, 1, "1234567890", "", 0, 5, 1, 128, 256, 10, "" }, - /*211*/ { BARCODE_TELEPEN_NUM, 4, "1234567890", "", 0, 5, 1, 128, 256, 10, "" }, - /*212*/ { BARCODE_ITF14, 1, "1234567890", "", 0, 5, 1, 135, 330, 30, "" }, - /*213*/ { BARCODE_ITF14, 4, "1234567890", "", 0, 5, 1, 135, 330, 30, "" }, + /*205*/ { BARCODE_USPS_IMAIL, 1, "12345678901234567890", "", 0, 2, 3, 129, 258, 4, "" }, + /*206*/ { BARCODE_USPS_IMAIL, 4, "12345678901234567890", "", 0, 4, 3, 129, 258, 8, "" }, + /*207*/ { BARCODE_USPS_IMAIL, 7, "12345678901234567890", "", 0, 7, 3, 129, 258, 14, "" }, + /*208*/ { BARCODE_PLESSEY, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "" }, + /*209*/ { BARCODE_PLESSEY, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "" }, + /*210*/ { BARCODE_TELEPEN_NUM, 1, "1234567890", "", 0, 1, 1, 128, 256, 2, "" }, + /*211*/ { BARCODE_TELEPEN_NUM, 4, "1234567890", "", 0, 4, 1, 128, 256, 8, "" }, + /*212*/ { BARCODE_ITF14, 1, "1234567890", "", 0, 1, 1, 135, 330, 22, "" }, + /*213*/ { BARCODE_ITF14, 4, "1234567890", "", 0, 4, 1, 135, 330, 28, "" }, /*214*/ { BARCODE_ITF14, 64, "1234567890", "", 0, 64, 1, 135, 330, 148, "" }, /*215*/ { BARCODE_KIX, -1, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*216*/ { BARCODE_KIX, 1, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*217*/ { BARCODE_KIX, 4, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*218*/ { BARCODE_KIX, 6, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*219*/ { BARCODE_KIX, 10, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, - /*220*/ { BARCODE_KIX, 16, "1234567890", "", 0, 8, 3, 79, 158, 16, "" }, + /*216*/ { BARCODE_KIX, 1, "1234567890", "", 0, 2, 3, 79, 158, 4, "" }, + /*217*/ { BARCODE_KIX, 4, "1234567890", "", 0, 4, 3, 79, 158, 8, "" }, + /*218*/ { BARCODE_KIX, 6, "1234567890", "", 0, 6, 3, 79, 158, 12, "" }, + /*219*/ { BARCODE_KIX, 10, "1234567890", "", 0, 10, 3, 79, 158, 20, "" }, + /*220*/ { BARCODE_KIX, 16, "1234567890", "", 0, 16, 3, 79, 158, 32, "" }, /*221*/ { BARCODE_AZTEC, 1, "1234567890AB", "", 0, 15, 15, 15, 30, 30, "Fixed width-to-height ratio, symbol->height ignored" }, /*222*/ { BARCODE_DAFT, -1, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*223*/ { BARCODE_DAFT, 1, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*224*/ { BARCODE_DAFT, 4, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*225*/ { BARCODE_DAFT, 6, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*226*/ { BARCODE_DAFT, 12, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*227*/ { BARCODE_DAFT, 16, "DAFTDAFTDAFTDAFT", "", 0, 8, 3, 31, 62, 16, "" }, - /*228*/ { BARCODE_DPD, 1, "0123456789012345678901234567", "", 0, 5, 1, 189, 378, 10, "" }, - /*229*/ { BARCODE_DPD, 4, "0123456789012345678901234567", "", 0, 5, 1, 189, 378, 10, "" }, + /*223*/ { BARCODE_DAFT, 1, "DAFTDAFTDAFTDAFT", "", 0, 2, 3, 31, 62, 4, "" }, + /*224*/ { BARCODE_DAFT, 4, "DAFTDAFTDAFTDAFT", "", 0, 4, 3, 31, 62, 8, "" }, + /*225*/ { BARCODE_DAFT, 6, "DAFTDAFTDAFTDAFT", "", 0, 6, 3, 31, 62, 12, "" }, + /*226*/ { BARCODE_DAFT, 12, "DAFTDAFTDAFTDAFT", "", 0, 12, 3, 31, 62, 24, "" }, + /*227*/ { BARCODE_DAFT, 16, "DAFTDAFTDAFTDAFT", "", 0, 16, 3, 31, 62, 32, "" }, + /*228*/ { BARCODE_DPD, 1, "0123456789012345678901234567", "", 0, 1, 1, 189, 378, 2, "" }, + /*229*/ { BARCODE_DPD, 4, "0123456789012345678901234567", "", 0, 4, 1, 189, 378, 8, "" }, /*230*/ { BARCODE_DPD, 62, "0123456789012345678901234567", "", 0, 62, 1, 189, 378, 124, "" }, /*231*/ { BARCODE_MICROQR, 1, "12345", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" }, - /*232*/ { BARCODE_HIBC_128, 1, "1234567890", "", 0, 5, 1, 123, 246, 10, "" }, - /*233*/ { BARCODE_HIBC_128, 4, "1234567890", "", 0, 5, 1, 123, 246, 10, "" }, - /*234*/ { BARCODE_HIBC_39, 1, "1234567890", "", 0, 5, 1, 223, 446, 10, "" }, - /*235*/ { BARCODE_HIBC_39, 4, "1234567890", "", 0, 5, 1, 223, 446, 10, "" }, + /*232*/ { BARCODE_HIBC_128, 1, "1234567890", "", 0, 1, 1, 123, 246, 2, "" }, + /*233*/ { BARCODE_HIBC_128, 4, "1234567890", "", 0, 4, 1, 123, 246, 8, "" }, + /*234*/ { BARCODE_HIBC_39, 1, "1234567890", "", 0, 1, 1, 223, 446, 2, "" }, + /*235*/ { BARCODE_HIBC_39, 4, "1234567890", "", 0, 4, 1, 223, 446, 8, "" }, /*236*/ { BARCODE_HIBC_DM, 1, "ABC", "", 0, 12, 12, 12, 24, 24, "Fixed width-to-height ratio, symbol->height ignored" }, /*237*/ { BARCODE_HIBC_QR, 1, "1234567890AB", "", 0, 21, 21, 21, 42, 42, "Fixed width-to-height ratio, symbol->height ignored" }, /*238*/ { BARCODE_HIBC_PDF, -1, "ABCDEF", "", 0, 21, 7, 103, 206, 42, "7 rows" }, - /*239*/ { BARCODE_HIBC_PDF, 1, "ABCDEF", "", 0, 21, 7, 103, 206, 42, "" }, - /*240*/ { BARCODE_HIBC_PDF, 4, "ABCDEF", "", 0, 21, 7, 103, 206, 42, "" }, - /*241*/ { BARCODE_HIBC_PDF, 36, "ABCDEF", "", 0, 35, 7, 103, 206, 70, "" }, + /*239*/ { BARCODE_HIBC_PDF, 1, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3.5, 7, 103, 206, 7, "" }, + /*240*/ { BARCODE_HIBC_PDF, 4, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 4, 7, 103, 206, 8, "" }, + /*241*/ { BARCODE_HIBC_PDF, 36, "ABCDEF", "", 0, 36, 7, 103, 206, 72, "" }, /*242*/ { BARCODE_HIBC_MICPDF, -1, "ABCDEF", "", 0, 12, 6, 82, 164, 24, "6 rows" }, - /*243*/ { BARCODE_HIBC_MICPDF, 1, "ABCDEF", "", 0, 12, 6, 82, 164, 24, "" }, - /*244*/ { BARCODE_HIBC_MICPDF, 4, "ABCDEF", "", 0, 12, 6, 82, 164, 24, "" }, - /*245*/ { BARCODE_HIBC_MICPDF, 47, "ABCDEF", "", 0, 42, 6, 82, 164, 84, "" }, + /*243*/ { BARCODE_HIBC_MICPDF, 1, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 3, 6, 82, 164, 6, "" }, + /*244*/ { BARCODE_HIBC_MICPDF, 4, "ABCDEF", "", ZINT_WARN_NONCOMPLIANT, 4, 6, 82, 164, 8, "" }, + /*245*/ { BARCODE_HIBC_MICPDF, 47, "ABCDEF", "", 0, 47, 6, 82, 164, 94, "" }, /*246*/ { BARCODE_HIBC_BLOCKF, -1, "1234567890", "", 0, 30, 3, 101, 242, 64, "3 rows" }, - /*247*/ { BARCODE_HIBC_BLOCKF, 1, "1234567890", "", 0, 30, 3, 101, 242, 64, "" }, - /*248*/ { BARCODE_HIBC_BLOCKF, 4, "1234567890", "", 0, 30, 3, 101, 242, 64, "" }, - /*249*/ { BARCODE_HIBC_BLOCKF, 23, "1234567890", "", 0, 30, 3, 101, 242, 64, "" }, - /*250*/ { BARCODE_HIBC_BLOCKF, 60, "1234567890", "", 0, 30, 3, 101, 242, 64, "" }, + /*247*/ { BARCODE_HIBC_BLOCKF, 1, "1234567890", "", 0, 1.5, 3, 101, 242, 7, "" }, + /*248*/ { BARCODE_HIBC_BLOCKF, 4, "1234567890", "", 0, 4, 3, 101, 242, 12, "" }, + /*249*/ { BARCODE_HIBC_BLOCKF, 23, "1234567890", "", 0, 23, 3, 101, 242, 50, "" }, + /*250*/ { BARCODE_HIBC_BLOCKF, 60, "1234567890", "", 0, 60, 3, 101, 242, 124, "" }, /*251*/ { BARCODE_HIBC_AZTEC, 1, "1234567890AB", "", 0, 19, 19, 19, 38, 38, "Fixed width-to-height ratio, symbol->height ignored" }, /*252*/ { BARCODE_DOTCODE, 1, "ABC", "", 0, 11, 11, 16, 32, 22, "Fixed width-to-height ratio, symbol->height ignored" }, /*253*/ { BARCODE_HANXIN, 1, "1234567890AB", "", 0, 23, 23, 23, 46, 46, "Fixed width-to-height ratio, symbol->height ignored" }, /*254*/ { BARCODE_MAILMARK, -1, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*255*/ { BARCODE_MAILMARK, 1, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*256*/ { BARCODE_MAILMARK, 4, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*257*/ { BARCODE_MAILMARK, 6, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, + /*255*/ { BARCODE_MAILMARK, 1, "01000000000000000AA00AA0A", "", 0, 2.5, 3, 155, 310, 5, "" }, + /*256*/ { BARCODE_MAILMARK, 4, "01000000000000000AA00AA0A", "", 0, 4, 3, 155, 310, 8, "" }, + /*257*/ { BARCODE_MAILMARK, 6, "01000000000000000AA00AA0A", "", 0, 6, 3, 155, 310, 12, "" }, /*258*/ { BARCODE_MAILMARK, 10, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*259*/ { BARCODE_MAILMARK, 15, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, - /*260*/ { BARCODE_MAILMARK, 20, "01000000000000000AA00AA0A", "", 0, 10, 3, 155, 310, 20, "" }, + /*259*/ { BARCODE_MAILMARK, 15, "01000000000000000AA00AA0A", "", 0, 15, 3, 155, 310, 30, "" }, + /*260*/ { BARCODE_MAILMARK, 20, "01000000000000000AA00AA0A", "", 0, 20, 3, 155, 310, 40, "" }, /*261*/ { BARCODE_AZRUNE, 1, "1", "", 0, 11, 11, 11, 22, 22, "Fixed width-to-height ratio, symbol->height ignored" }, - /*262*/ { BARCODE_CODE32, 1, "12345678", "", 0, 5, 1, 103, 206, 10, "" }, - /*263*/ { BARCODE_CODE32, 4, "12345678", "", 0, 5, 1, 103, 206, 10, "" }, + /*262*/ { BARCODE_CODE32, 1, "12345678", "", 0, 1, 1, 103, 206, 2, "" }, + /*263*/ { BARCODE_CODE32, 4, "12345678", "", 0, 4, 1, 103, 206, 8, "" }, /*264*/ { BARCODE_CODE32, 19, "12345678", "", 0, 19, 1, 103, 206, 38, "" }, - /*265*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01", 0, 17, 7, 99, 234, 44, "EAN-13, CC-A 3 rows" }, - /*266*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01", 0, 17, 7, 99, 234, 44, "" }, - /*267*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01", 0, 17, 7, 99, 234, 44, "" }, + /*265*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01", 0, 50, 7, 99, 234, 110, "EAN-13, CC-A 3 rows" }, + /*266*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "" }, + /*267*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01", 0, 12.5, 7, 99, 234, 35, "" }, /*268*/ { BARCODE_EANX_CC, 81, "123456789012", "[20]01", 0, 81, 7, 99, 234, 172, "" }, - /*269*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 21, 9, 99, 234, 52, "EAN-13, CC-A 5 rows" }, - /*270*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 21, 9, 99, 234, 52, "" }, - /*271*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 21, 9, 99, 234, 52, "" }, - /*272*/ { BARCODE_EANX_CC, 20, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 21, 9, 99, 234, 52, "" }, - /*273*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 25, 11, 99, 234, 60, "EAN-13, CC-A 7 rows" }, - /*274*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 25, 11, 99, 234, 60, "" }, - /*275*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 25, 11, 99, 234, 60, "" }, + /*269*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 50, 9, 99, 234, 110, "EAN-13, CC-A 5 rows" }, + /*270*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 16.5, 9, 99, 234, 43, "" }, + /*271*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 16.5, 9, 99, 234, 43, "" }, + /*272*/ { BARCODE_EANX_CC, 20, "123456789012", "[20]01[90]123456789012345678901234567890", 0, 20, 9, 99, 234, 50, "" }, + /*273*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 50, 11, 99, 234, 110, "EAN-13, CC-A 7 rows" }, + /*274*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20.5, 11, 99, 234, 51, "" }, + /*275*/ { BARCODE_EANX_CC, 4, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20.5, 11, 99, 234, 51, "" }, /*276*/ { BARCODE_EANX_CC, 40, "123456789012", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 40, 11, 99, 234, 90, "" }, - /*277*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 31, 14, 99, 234, 72, "EAN-13, CC-B 10 rows" }, - /*278*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 31, 14, 99, 234, 72, "" }, - /*279*/ { BARCODE_EANX_CC, 30, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 31, 14, 99, 234, 72, "" }, - /*280*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01[90]123456789012345678901234", 0, 23, 10, 72, 172, 56, "EAN-8, CC-A 4 rows" }, - /*281*/ { BARCODE_EANX_CC, 1, "1234567", "[20]01[90]123456789012345678901234", 0, 23, 10, 72, 172, 56, "" }, - /*282*/ { BARCODE_EANX_CC, 4, "1234567", "[20]01[90]123456789012345678901234", 0, 23, 10, 72, 172, 56, "" }, + /*277*/ { BARCODE_EANX_CC, -1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 14, 99, 234, 110, "EAN-13, CC-B 10 rows" }, + /*278*/ { BARCODE_EANX_CC, 1, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 26.5, 14, 99, 234, 63, "" }, + /*279*/ { BARCODE_EANX_CC, 30, "123456789012", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 30, 14, 99, 234, 70, "" }, + /*280*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01[90]123456789012345678901234", 0, 50, 10, 72, 172, 110, "EAN-8, CC-A 4 rows" }, + /*281*/ { BARCODE_EANX_CC, 1, "1234567", "[20]01[90]123456789012345678901234", 0, 18.5, 10, 72, 172, 47, "" }, + /*282*/ { BARCODE_EANX_CC, 4, "1234567", "[20]01[90]123456789012345678901234", 0, 18.5, 10, 72, 172, 47, "" }, /*283*/ { BARCODE_EANX_CC, 69, "1234567", "[20]01[90]123456789012345678901234", 0, 69, 10, 72, 172, 148, "" }, - /*284*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 24, 82, 192, 112, "EAN-8, CC-B 15 rows" }, - /*285*/ { BARCODE_EANX_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 24, 82, 192, 112, "" }, - /*286*/ { BARCODE_EANX_CC, 32, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 24, 82, 192, 112, "" }, - /*287*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01", 0, 12, 5, 145, 290, 24, "CC-A 3 rows" }, - /*288*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01", 0, 12, 5, 145, 290, 24, "" }, - /*289*/ { BARCODE_GS1_128_CC, 4, "[01]12345678901231", "[20]01", 0, 12, 5, 145, 290, 24, "" }, + /*284*/ { BARCODE_EANX_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 50, 24, 82, 192, 110, "EAN-8, CC-B 15 rows" }, + /*285*/ { BARCODE_EANX_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 46.5, 24, 82, 192, 103, "" }, + /*286*/ { BARCODE_EANX_CC, 32, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 46.5, 24, 82, 192, 103, "" }, + /*287*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01", 0, 50, 5, 145, 290, 100, "CC-A 3 rows" }, + /*288*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01", 0, 7.5, 5, 145, 290, 15, "" }, + /*289*/ { BARCODE_GS1_128_CC, 4, "[01]12345678901231", "[20]01", 0, 7.5, 5, 145, 290, 15, "" }, /*290*/ { BARCODE_GS1_128_CC, 12, "[01]12345678901231", "[20]01", 0, 12, 5, 145, 290, 24, "" }, - /*291*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20, 9, 145, 290, 40, "CC-A 7 rows" }, - /*292*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 20, 9, 145, 290, 40, "" }, + /*291*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 50, 9, 145, 290, 100, "CC-A 7 rows" }, + /*292*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 15.5, 9, 145, 290, 31, "" }, /*293*/ { BARCODE_GS1_128_CC, 52, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 52, 9, 145, 290, 104, "" }, - /*294*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 26, 12, 145, 290, 52, "CC-B 10 rows" }, - /*295*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 26, 12, 145, 290, 52, "" }, + /*294*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 12, 145, 290, 100, "CC-B 10 rows" }, + /*295*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 145, 290, 43, "" }, /*296*/ { BARCODE_GS1_128_CC, 40, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40, 12, 145, 290, 80, "" }, - /*297*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 96, 32, 154, 308, 192, "CC-C 30 rows" }, - /*298*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 96, 32, 154, 308, 192, "" }, + /*297*/ { BARCODE_GS1_128_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 91.5, 32, 154, 308, 183, "CC-C 30 rows" }, + /*298*/ { BARCODE_GS1_128_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 91.5, 32, 154, 308, 183, "" }, /*299*/ { BARCODE_GS1_128_CC, 100, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[94]123456789012345678901234567890", 0, 100, 32, 154, 308, 200, "" }, /*300*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01[90]1234567890", 0, 21, 5, 100, 200, 42, "CC-A 3 rows" }, - /*301*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]1234567890", 0, 21, 5, 100, 200, 42, "" }, - /*302*/ { BARCODE_DBAR_OMN_CC, 4, "1234567890123", "[20]01[90]1234567890", 0, 21, 5, 100, 200, 42, "" }, + /*301*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]1234567890", 0, 7.5, 5, 100, 200, 15, "" }, + /*302*/ { BARCODE_DBAR_OMN_CC, 4, "1234567890123", "[20]01[90]1234567890", 0, 7.5, 5, 100, 200, 15, "" }, /*303*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "CC-A 4 rows" }, - /*304*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "" }, - /*305*/ { BARCODE_DBAR_OMN_CC, 4, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "" }, - /*306*/ { BARCODE_DBAR_OMN_CC, 20, "1234567890123", "[20]01[90]12345678901234567890", 0, 23, 6, 100, 200, 46, "" }, + /*304*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]12345678901234567890", 0, 9.5, 6, 100, 200, 19, "" }, + /*305*/ { BARCODE_DBAR_OMN_CC, 4, "1234567890123", "[20]01[90]12345678901234567890", 0, 9.5, 6, 100, 200, 19, "" }, + /*306*/ { BARCODE_DBAR_OMN_CC, 20, "1234567890123", "[20]01[90]12345678901234567890", 0, 20, 6, 100, 200, 40, "" }, /*307*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35, 12, 100, 200, 70, "CC-B 10 rows" }, - /*308*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35, 12, 100, 200, 70, "" }, - /*309*/ { BARCODE_DBAR_OMN_CC, 40, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35, 12, 100, 200, 70, "" }, + /*308*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 100, 200, 43, "" }, + /*309*/ { BARCODE_DBAR_OMN_CC, 40, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40, 12, 100, 200, 80, "" }, /*310*/ { BARCODE_DBAR_OMN_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 39, 14, 100, 200, 78, "CC-B 12 rows" }, - /*311*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 39, 14, 100, 200, 78, "" }, - /*312*/ { BARCODE_DBAR_OMN_CC, 36, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 39, 14, 100, 200, 78, "" }, + /*311*/ { BARCODE_DBAR_OMN_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 25.5, 14, 100, 200, 51, "" }, + /*312*/ { BARCODE_DBAR_OMN_CC, 36, "1234567890123", "[20]01[90]123456789012345678901234567890[91]123456789012345678901234567890", 0, 36, 14, 100, 200, 72, "" }, /*313*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "CC-A 4 rows" }, - /*314*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "" }, - /*315*/ { BARCODE_DBAR_LTD_CC, 4, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "" }, - /*316*/ { BARCODE_DBAR_LTD_CC, 18, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "" }, + /*314*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01", 0, 9.5, 6, 79, 158, 19, "" }, + /*315*/ { BARCODE_DBAR_LTD_CC, 4, "1234567890123", "[20]01", 0, 9.5, 6, 79, 158, 19, "" }, + /*316*/ { BARCODE_DBAR_LTD_CC, 18, "1234567890123", "[20]01", 0, 18, 6, 79, 158, 36, "" }, /*317*/ { BARCODE_DBAR_LTD_CC, 19, "1234567890123", "[20]01", 0, 19, 6, 79, 158, 38, "" }, /*318*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "CC-A 7 rows" }, - /*319*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "" }, - /*320*/ { BARCODE_DBAR_LTD_CC, 26, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 25, 9, 79, 158, 50, "" }, + /*319*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 15.5, 9, 79, 158, 31, "" }, + /*320*/ { BARCODE_DBAR_LTD_CC, 26, "1234567890123", "[20]01[90]123456789012345678901234567890", 0, 26, 9, 79, 158, 52, "" }, /*321*/ { BARCODE_DBAR_LTD_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "CC-B 20 rows" }, - /*322*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "" }, - /*323*/ { BARCODE_DBAR_LTD_CC, 50, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 51, 22, 88, 176, 102, "" }, + /*322*/ { BARCODE_DBAR_LTD_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 41.5, 22, 88, 176, 83, "" }, + /*323*/ { BARCODE_DBAR_LTD_CC, 50, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567890", 0, 50, 22, 88, 176, 100, "" }, /*324*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "CC-A 3 rows" }, - /*325*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "" }, - /*326*/ { BARCODE_DBAR_EXP_CC, 4, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "" }, - /*327*/ { BARCODE_DBAR_EXP_CC, 40, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "" }, + /*325*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01", 0, 7.5, 5, 134, 268, 15, "" }, + /*326*/ { BARCODE_DBAR_EXP_CC, 4, "[01]12345678901231", "[20]01", 0, 7.5, 5, 134, 268, 15, "" }, + /*327*/ { BARCODE_DBAR_EXP_CC, 40, "[01]12345678901231", "[20]01", 0, 40, 5, 134, 268, 80, "" }, /*328*/ { BARCODE_DBAR_EXP_CC, 41, "[01]12345678901231", "[20]01", 0, 41, 5, 134, 268, 82, "" }, /*329*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "CC-A 5 rows" }, - /*330*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "" }, - /*331*/ { BARCODE_DBAR_EXP_CC, 50, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 45, 7, 134, 268, 90, "" }, + /*330*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 11.5, 7, 134, 268, 23, "" }, + /*331*/ { BARCODE_DBAR_EXP_CC, 50, "[01]12345678901231", "[20]01[90]123456789012345678901234567890", 0, 50, 7, 134, 268, 100, "" }, /*332*/ { BARCODE_DBAR_EXP_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "CC-B 10 rows" }, - /*333*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "" }, - /*334*/ { BARCODE_DBAR_EXP_CC, 46, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 55, 12, 134, 268, 110, "" }, - /*335*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01", 0, 17, 7, 99, 234, 44, "CC-A 3 rows" }, - /*336*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01", 0, 17, 7, 99, 234, 44, "" }, - /*337*/ { BARCODE_UPCA_CC, 4, "12345678901", "[20]01", 0, 17, 7, 99, 234, 44, "" }, + /*333*/ { BARCODE_DBAR_EXP_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 21.5, 12, 134, 268, 43, "" }, + /*334*/ { BARCODE_DBAR_EXP_CC, 46, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 46, 12, 134, 268, 92, "" }, + /*335*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01", 0, 50, 7, 99, 234, 110, "CC-A 3 rows" }, + /*336*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01", 0, 12.5, 7, 99, 234, 35, "" }, + /*337*/ { BARCODE_UPCA_CC, 4, "12345678901", "[20]01", 0, 12.5, 7, 99, 234, 35, "" }, /*338*/ { BARCODE_UPCA_CC, 81, "12345678901", "[20]01", 0, 81, 7, 99, 234, 172, "" }, - /*339*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 23, 10, 99, 234, 56, "CC-A 6 rows" }, - /*340*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 23, 10, 99, 234, 56, "" }, - /*341*/ { BARCODE_UPCA_CC, 4, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 23, 10, 99, 234, 56, "" }, - /*342*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 35, 16, 99, 234, 80, "CC-B 12 rows" }, - /*343*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 35, 16, 99, 234, 80, "" }, + /*339*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 50, 10, 99, 234, 110, "CC-A 6 rows" }, + /*340*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 18.5, 10, 99, 234, 47, "" }, + /*341*/ { BARCODE_UPCA_CC, 4, "12345678901", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 18.5, 10, 99, 234, 47, "" }, + /*342*/ { BARCODE_UPCA_CC, -1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 50, 16, 99, 234, 110, "CC-B 12 rows" }, + /*343*/ { BARCODE_UPCA_CC, 1, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 30.5, 16, 99, 234, 71, "" }, /*344*/ { BARCODE_UPCA_CC, 51, "12345678901", "[20]01[90]123456789012345678901234567890[91]123456789012345678912345678901234567", 0, 51, 16, 99, 234, 112, "" }, - /*345*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678", 0, 25, 11, 55, 142, 60, "CC-A 7 rows" }, - /*346*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678", 0, 25, 11, 55, 142, 60, "" }, - /*347*/ { BARCODE_UPCE_CC, 4, "1234567", "[20]01[90]123456789012345678", 0, 25, 11, 55, 142, 60, "" }, + /*345*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678", 0, 50, 11, 55, 142, 110, "CC-A 7 rows" }, + /*346*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678", 0, 20.5, 11, 55, 142, 51, "" }, + /*347*/ { BARCODE_UPCE_CC, 4, "1234567", "[20]01[90]123456789012345678", 0, 20.5, 11, 55, 142, 51, "" }, /*348*/ { BARCODE_UPCE_CC, 85, "1234567", "[20]01[90]123456789012345678", 0, 85, 11, 55, 142, 180, "" }, - /*349*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 35, 16, 55, 142, 80, "CC-A 12 rows" }, - /*350*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 35, 16, 55, 142, 80, "" }, + /*349*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 50, 16, 55, 142, 110, "CC-A 12 rows" }, + /*350*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 30.5, 16, 55, 142, 71, "" }, /*351*/ { BARCODE_UPCE_CC, 49, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 49, 16, 55, 142, 108, "" }, - /*352*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 45, 21, 55, 142, 100, "CC-B 17 rows" }, - /*353*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 45, 21, 55, 142, 100, "" }, - /*354*/ { BARCODE_UPCE_CC, 4, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 45, 21, 55, 142, 100, "" }, - /*355*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 57, 27, 55, 142, 124, "CC-B 23 rows" }, - /*356*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 57, 27, 55, 142, 124, "" }, - /*357*/ { BARCODE_UPCE_CC, 52, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 57, 27, 55, 142, 124, "" }, + /*352*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 50, 21, 55, 142, 110, "CC-B 17 rows" }, + /*353*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40.5, 21, 55, 142, 91, "" }, + /*354*/ { BARCODE_UPCE_CC, 4, "1234567", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 40.5, 21, 55, 142, 91, "" }, + /*355*/ { BARCODE_UPCE_CC, -1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 142, 115, "CC-B 23 rows" }, + /*356*/ { BARCODE_UPCE_CC, 1, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 142, 115, "" }, + /*357*/ { BARCODE_UPCE_CC, 52, "1234567", "[20]01[90]123456789012345678901234567890[91]1234567890123456789012345678901234567", 0, 52.5, 27, 55, 142, 115, "" }, /*358*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "CC-A 5 rows" }, - /*359*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "" }, - /*360*/ { BARCODE_DBAR_STK_CC, 4, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "" }, + /*359*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01", 0, 13.2, 9, 56, 112, 26.4, "" }, + /*360*/ { BARCODE_DBAR_STK_CC, 4, "1234567890123", "[20]01", 0, 13.2, 9, 56, 112, 26.4, "" }, /*361*/ { BARCODE_DBAR_STK_CC, 24, "1234567890123", "[20]01", 0, 24, 9, 56, 112, 48, "" }, /*362*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "CC-A 12 rows" }, - /*363*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "" }, - /*364*/ { BARCODE_DBAR_STK_CC, 25, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 38, 16, 56, 112, 76, "" }, + /*363*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 27.200001, 16, 56, 112, 54.400002, "" }, + /*364*/ { BARCODE_DBAR_STK_CC, 25, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678", 0, 27.200001, 16, 56, 112, 54.400002, "" }, /*365*/ { BARCODE_DBAR_STK_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "CC-B 17 rows" }, - /*366*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "" }, - /*367*/ { BARCODE_DBAR_STK_CC, 59, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 48, 21, 56, 112, 96, "" }, + /*366*/ { BARCODE_DBAR_STK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 37.200001, 21, 56, 112, 74.400002, "" }, + /*367*/ { BARCODE_DBAR_STK_CC, 59, "1234567890123", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 59, 21, 56, 112, 118, "" }, /*368*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "CC-A 6 rows" }, - /*369*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "" }, - /*370*/ { BARCODE_DBAR_OMNSTK_CC, 4, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "" }, - /*371*/ { BARCODE_DBAR_OMNSTK_CC, 80, "1234567890123", "[20]01[90]1234567890123456", 0, 82, 12, 56, 112, 164, "" }, + /*369*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]1234567890123456", 0, 17, 12, 56, 112, 34, "" }, + /*370*/ { BARCODE_DBAR_OMNSTK_CC, 4, "1234567890123", "[20]01[90]1234567890123456", 0, 17, 12, 56, 112, 34, "" }, + /*371*/ { BARCODE_DBAR_OMNSTK_CC, 80, "1234567890123", "[20]01[90]1234567890123456", 0, 80, 12, 56, 112, 160, "" }, /*372*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "CC-A 12 rows" }, - /*373*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 94, 18, 56, 112, 188, "" }, + /*373*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567", 0, 29, 18, 56, 112, 58, "" }, /*374*/ { BARCODE_DBAR_OMNSTK_CC, -1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "CC-B 17 rows" }, - /*375*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "" }, - /*376*/ { BARCODE_DBAR_OMNSTK_CC, 4, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "" }, - /*377*/ { BARCODE_DBAR_OMNSTK_CC, 52, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 104, 23, 56, 112, 208, "" }, + /*375*/ { BARCODE_DBAR_OMNSTK_CC, 1, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 39, 23, 56, 112, 78, "" }, + /*376*/ { BARCODE_DBAR_OMNSTK_CC, 4, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 39, 23, 56, 112, 78, "" }, + /*377*/ { BARCODE_DBAR_OMNSTK_CC, 52, "1234567890123", "[20]01[90]123456789012345678901234567890[91]1234567890", 0, 52, 23, 56, 112, 104, "" }, /*378*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "3 rows, CC-A 3 rows" }, - /*379*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "" }, - /*380*/ { BARCODE_DBAR_EXPSTK_CC, 4, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "" }, - /*381*/ { BARCODE_DBAR_EXPSTK_CC, 77, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "" }, + /*379*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01", 0, 11, 9, 102, 204, 22, "" }, + /*380*/ { BARCODE_DBAR_EXPSTK_CC, 4, "[01]12345678901231", "[20]01", 0, 11, 9, 102, 204, 22, "" }, + /*381*/ { BARCODE_DBAR_EXPSTK_CC, 77, "[01]12345678901231", "[20]01", 0, 77, 9, 102, 204, 154, "" }, /*382*/ { BARCODE_DBAR_EXPSTK_CC, 78, "[01]12345678901231", "[20]01", 0, 78, 9, 102, 204, 156, "" }, /*383*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "5 rows, CC-A 3 rows" }, - /*384*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "" }, - /*385*/ { BARCODE_DBAR_EXPSTK_CC, 190, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 189, 21, 102, 204, 378, "" }, + /*384*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 21.5, 21, 102, 204, 43, "" }, + /*385*/ { BARCODE_DBAR_EXPSTK_CC, 190, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01", 0, 190, 21, 102, 204, 380, "" }, /*386*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "3 rows, CC-A 4 rows" }, - /*387*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "" }, - /*388*/ { BARCODE_DBAR_EXPSTK_CC, 38, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 80, 10, 102, 204, 160, "" }, + /*387*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 13, 10, 102, 204, 26, "" }, + /*388*/ { BARCODE_DBAR_EXPSTK_CC, 38, "[01]12345678901231", "[20]01[90]12345678901234567890", 0, 38, 10, 102, 204, 76, "" }, /*389*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "3 rows, CC-B 10 rows" }, - /*390*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "" }, - /*391*/ { BARCODE_DBAR_EXPSTK_CC, 4, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "" }, - /*392*/ { BARCODE_DBAR_EXPSTK_CC, 47, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 92, 16, 102, 204, 184, "" }, + /*390*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 25, 16, 102, 204, 50, "" }, + /*391*/ { BARCODE_DBAR_EXPSTK_CC, 4, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 25, 16, 102, 204, 50, "" }, + /*392*/ { BARCODE_DBAR_EXPSTK_CC, 47, "[01]12345678901231", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 47, 16, 102, 204, 94, "" }, /*393*/ { BARCODE_DBAR_EXPSTK_CC, -1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "5 rows, CC-B 10 rows" }, - /*394*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 203, 28, 102, 204, 406, "" }, - /*395*/ { BARCODE_CHANNEL, 1, "1", "", 0, 5, 1, 19, 38, 10, "" }, - /*396*/ { BARCODE_CHANNEL, 4, "123", "", 0, 5, 1, 23, 46, 10, "" }, + /*394*/ { BARCODE_DBAR_EXPSTK_CC, 1, "[91]ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFG", "[20]01[90]123456789012345678901234567890[91]12345678901234567890", 0, 35.5, 28, 102, 204, 71, "" }, + /*395*/ { BARCODE_CHANNEL, 1, "1", "", 0, 1, 1, 19, 38, 2, "" }, + /*396*/ { BARCODE_CHANNEL, 4, "123", "", 0, 4, 1, 23, 46, 8, "" }, /*397*/ { BARCODE_CODEONE, 1, "12345678901234567890", "", 0, 16, 16, 18, 36, 32, "Fixed height, symbol->height ignored" }, /*398*/ { BARCODE_GRIDMATRIX, 1, "ABC", "", 0, 18, 18, 18, 36, 36, "Fixed width-to-height ratio, symbol->height ignored" }, /*399*/ { BARCODE_UPNQR, 1, "1234567890AB", "", 0, 77, 77, 77, 154, 154, "Fixed width-to-height ratio, symbol->height ignored" }, @@ -1275,7 +1275,9 @@ static void test_height(int index, int generate, int debug) { assert_nonnull(symbol, "Symbol not created\n"); symbol->symbology = data[i].symbology; - symbol->height = data[i].height; + if (data[i].height != -1) { + symbol->height = data[i].height; + } symbol->input_mode = UNICODE_MODE; symbol->show_hrt = 0; // Note: disabling HRT symbol->debug |= debug; @@ -1296,11 +1298,11 @@ static void test_height(int index, int generate, int debug) { assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%s) vector NULL\n", i, testUtilBarcodeName(data[i].symbology)); if (generate) { - printf(" /*%3d*/ { %s, %d, \"%s\", \"%s\", %s, %d, %d, %d, %.8g, %.8g, \"%s\" },\n", + printf(" /*%3d*/ { %s, %.5g, \"%s\", \"%s\", %s, %.8g, %d, %d, %.8g, %.8g, \"%s\" },\n", i, testUtilBarcodeName(data[i].symbology), data[i].height, data[i].data, data[i].composite, testUtilErrorName(data[i].ret), symbol->height, symbol->rows, symbol->width, symbol->vector->width, symbol->vector->height, data[i].comment); } else { - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_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->vector->width, data[i].expected_vector_width, "i:%d (%s) symbol->vector->width %.8g != %.8g\n", diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 055bf066..ab4aac51 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -783,7 +783,7 @@ struct zint_vector *testUtilVectorCpy(const struct zint_vector *in) { *outstring = malloc(sizeof(struct zint_vector_string)); assert(*outstring != NULL); memcpy(*outstring, string, sizeof(struct zint_vector_string)); - (*outstring)->text = malloc(sizeof(unsigned char) * (ustrlen(string->text) + 1)); + (*outstring)->text = malloc(ustrlen(string->text) + 1); assert((*outstring)->text != NULL); ustrcpy((*outstring)->text, string->text); outstring = &((*outstring)->next); @@ -1133,6 +1133,7 @@ char *testUtilUCharArrayDump(unsigned char *array, int size, char *dump, int dum int testUtilDataPath(char *buffer, int buffer_size, const char *subdir, const char *filename) { int subdir_len = subdir ? (int) strlen(subdir) : 0; int filename_len = filename ? (int) strlen(filename) : 0; + char *s, *s2; int len; #ifdef _WIN32 int i; @@ -1162,18 +1163,22 @@ int testUtilDataPath(char *buffer, int buffer_size, const char *subdir, const ch return 0; } - if (len > 6 && strcmp(buffer + len - 6, "/build") == 0) { - buffer[len - 6] = '\0'; - len -= 6; - } else if (len > 14 && strcmp(buffer + len - 14, "/build/backend") == 0) { - buffer[len - 14] = '\0'; - len -= 14; - } else if (len > 20 && strcmp(buffer + len - 20, "/build/backend/tests") == 0) { - buffer[len - 20] = '\0'; - len -= 20; - } else { - fprintf(stderr, "testUtilDataPath: unrecognized dir '%s'\n", buffer); - return 0; + if ((s = strstr(buffer, "/backend/tests")) != NULL) { + while ((s2 = strstr(s + 1, "/backend/tests")) != NULL) { // Find rightmost + s = s2; + } + *s = '\0'; + len = s - buffer; + } else if ((s = strstr(buffer, "/frontend/tests")) != NULL) { + while ((s2 = strstr(s + 1, "/frontend/tests")) != NULL) { // Find rightmost + s = s2; + } + *s = '\0'; + len = s - buffer; + } + if ((s = strrchr(buffer, '/')) != NULL) { // Remove "build" dir + *s = '\0'; + len = s - buffer; } if (subdir_len) { @@ -1674,8 +1679,16 @@ int testUtilCmpEpss(const char *eps1, const char *eps2) { return ret; } +#ifdef _WIN32 +#define DEV_NULL "> NUL" +#define DEV_NULL_STDERR "> NUL 2>&1" +#else +#define DEV_NULL "> /dev/null" +#define DEV_NULL_STDERR "> /dev/null 2>&1" +#endif + int testUtilHaveIdentify() { - return system("identify --version > /dev/null") == 0; + return system("magick -version " DEV_NULL) == 0; } int testUtilVerifyIdentify(const char *filename, int debug) { @@ -1688,19 +1701,19 @@ int testUtilVerifyIdentify(const char *filename, int debug) { if (debug & ZINT_DEBUG_TEST_PRINT) { // Verbose very noisy though so for quick check just return default output if (debug & ZINT_DEBUG_TEST_LESS_NOISY) { - sprintf(cmd, "identify %s", filename); + sprintf(cmd, "magick identify %s", filename); } else { - sprintf(cmd, "identify -verbose %s", filename); + sprintf(cmd, "magick identify -verbose %s", filename); } } else { - sprintf(cmd, "identify -verbose %s > /dev/null", filename); + sprintf(cmd, "magick identify -verbose %s " DEV_NULL, filename); } return system(cmd); } int testUtilHaveLibreOffice() { - return system("libreoffice --version > /dev/null") == 0; + return system("libreoffice --version " DEV_NULL) == 0; } int testUtilVerifyLibreOffice(const char *filename, int debug) { @@ -1733,7 +1746,7 @@ int testUtilVerifyLibreOffice(const char *filename, int debug) { return -1; } - sprintf(cmd, "libreoffice --convert-to svg %s > /dev/null 2>&1", filename); + sprintf(cmd, "libreoffice --convert-to svg %s " DEV_NULL_STDERR, filename); if (debug & ZINT_DEBUG_TEST_PRINT) { printf("%s\n", cmd); } @@ -1774,8 +1787,14 @@ int testUtilVerifyLibreOffice(const char *filename, int debug) { return 0; } +#ifdef _WIN32 +#define GS_FILENAME "gswin64c" +#else +#define GS_FILENAME "gs" +#endif + int testUtilHaveGhostscript() { - return system("gs -v > /dev/null") == 0; + return system(GS_FILENAME " -v " DEV_NULL) == 0; } int testUtilVerifyGhostscript(const char *filename, int debug) { @@ -1785,10 +1804,10 @@ int testUtilVerifyGhostscript(const char *filename, int debug) { return -1; } if (debug & ZINT_DEBUG_TEST_PRINT) { - sprintf(cmd, "gs -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); // Prints nothing of interest with or without -q unless bad + sprintf(cmd, GS_FILENAME " -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); // Prints nothing of interest with or without -q unless bad printf("%s\n", cmd); } else { - sprintf(cmd, "gs -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); + sprintf(cmd, GS_FILENAME " -dNOPAUSE -dBATCH -dNODISPLAY -q %s", filename); } return system(cmd); @@ -1797,7 +1816,7 @@ int testUtilVerifyGhostscript(const char *filename, int debug) { /* v.Nu https://github.com/validator/validator * Needs "$INSTALL_DIR/vnu-runtime-image/bin" in PATH */ int testUtilHaveVnu() { - return system("vnu --version > /dev/null 2>&1") == 0; + return system("vnu --version " DEV_NULL_STDERR) == 0; } int testUtilVerifyVnu(const char *filename, int debug) { @@ -1818,7 +1837,7 @@ int testUtilVerifyVnu(const char *filename, int debug) { /* Requires libtiff 4.2.0 http://www.libtiff.org to be installed */ int testUtilHaveTiffInfo() { - return system("tiffinfo -h > /dev/null") == 0; + return system("tiffinfo -h " DEV_NULL) == 0; } int testUtilVerifyTiffInfo(const char *filename, int debug) { @@ -1830,7 +1849,7 @@ int testUtilVerifyTiffInfo(const char *filename, int debug) { if (debug & ZINT_DEBUG_TEST_PRINT) { sprintf(cmd, "tiffinfo -D %s", filename); } else { - sprintf(cmd, "tiffinfo -D %s > /dev/null 2>&1", filename); + sprintf(cmd, "tiffinfo -D %s " DEV_NULL_STDERR, filename); } return system(cmd); @@ -2232,13 +2251,6 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int } //fprintf(stderr, "bwipp_row_height[%d] %d, symbol->row_height[%d] %d\n", r, bwipp_row_height[r], r, symbol->row_height[r]); } - if (symbology == BARCODE_DBAR_EXP) { - bwipp_row_height[symbol->rows - 1] = 1; - } else if (symbology == BARCODE_DBAR_OMN_CC) { - bwipp_row_height[symbol->rows - 1] = 33; - } else if (symbology == BARCODE_GS1_128_CC) { - bwipp_row_height[symbol->rows - 1] = 36; - } if ((symbol->input_mode & 0x07) == UNICODE_MODE && ZBarcode_Cap(symbology, ZINT_CAP_ECI) && is_eci_convertible(symbol->eci)) { if (utf8_to_eci(symbol->eci, (const unsigned char *) data, (unsigned char *) converted, &data_len) == 0) { @@ -2442,7 +2454,6 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int strcpy(bwipp_data, "fima"); bwipp_data[3] = data[0] - 'A' + 'a'; } else if (symbology == BARCODE_CODE16K || symbology == BARCODE_CODE49) { - for (r = 0; r < symbol->rows; r++) bwipp_row_height[r] = 8; /* Change from 10 */ sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%ssepheight=0", strlen(bwipp_opts_buf) ? " " : ""); bwipp_opts = bwipp_opts_buf; } else if (symbology == BARCODE_AZTEC || symbology == BARCODE_HIBC_AZTEC) { @@ -2743,7 +2754,7 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int for (h = bwipp_row_height[r]; h > 1; h--) { /* Ignore row copies if any */ cnt = fread(b, 1, symbol->width, fp); if (cnt != symbol->width) { - fprintf(stderr, "i:%d testUtilBwipp: failed to read/ignore symbol->width %d bytes, cnt %d, h %d, bwipp_row_height[%d] %d, symbol->row_height[%d] %d (%s)\n", + fprintf(stderr, "i:%d testUtilBwipp: failed to read/ignore symbol->width %d bytes, cnt %d, h %d, bwipp_row_height[%d] %d, symbol->row_height[%d] %g (%s)\n", index, symbol->width, cnt, h, r, bwipp_row_height[r], r, symbol->row_height[r], cmd); testutil_pclose(fp); return -1; diff --git a/backend/ultra.c b/backend/ultra.c index 2f19b953..b8fa06b3 100644 --- a/backend/ultra.c +++ b/backend/ultra.c @@ -1126,6 +1126,7 @@ INTERNAL int ultracode(struct zint_symbol *symbol, unsigned char source[], int l set_module_colour(symbol, i, j, posn(ultra_colour, pattern[(i * total_width) + j])); } } + symbol->height = total_height; return 0; } diff --git a/backend/upcean.c b/backend/upcean.c index be3cb67d..800e533e 100644 --- a/backend/upcean.c +++ b/backend/upcean.c @@ -1,7 +1,7 @@ /* upcean.c - Handles UPC, EAN and ISBN libzint - the open source barcode library - Copyright (C) 2008 - 2020 Robin Stuart + Copyright (C) 2008 - 2021 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -118,9 +118,11 @@ static void upca_draw(const char source[], const int length, unsigned char dest[ ustrcat(dest, "111"); } -/* Make a UPC A barcode when we haven't been given the check digit */ -static int upca(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char dest[]) { +/* Make a UPC-A barcode, allowing for composite if `cc_rows` set */ +static int upca_cc(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char dest[], + int cc_rows) { char gtin[13]; + float height; int error_number = 0; ustrcpy(gtin, source); @@ -146,14 +148,39 @@ static int upca(struct zint_symbol *symbol, const unsigned char source[], int le upca_draw(gtin, length, dest); ustrcpy(symbol->text, gtin); +#ifdef COMPLIANT_HEIGHTS + /* BS EN 797:1996 4.5.1 Nominal dimensions 22.85mm / 0.33mm (X) ~ 69.24, + same as minimum GS1 General Specifications 21.0.1 5.12.3.1 */ + height = (float) (22.85 / 0.33); + if (symbol->symbology == BARCODE_UPCA_CC) { + symbol->height = height; /* Pass back min row == default height */ + } else { + error_number = set_height(symbol, height, height, 0.0f, 0 /*no_errtxt*/); + } +#else + height = 50.0f; + if (symbol->symbology == BARCODE_UPCA_CC) { + symbol->height = height - cc_rows * 2 - 6.0f; + } else { + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); + } +#endif + return error_number; } -/* UPC E is a zero-compressed version of UPC A */ -static int upce(struct zint_symbol *symbol, unsigned char source[], int length, unsigned char dest[]) { +/* UPC-A */ +static int upca(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char dest[]) { + return upca_cc(symbol, source, length, dest, 0 /*cc_rows*/); +} + +/* UPC-E, allowing for composite if `cc_rows` set */ +static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int length, unsigned char dest[], + int cc_rows) { int i, num_system; char emode, equivalent[12], check_digit, parity[8]; char hrt[9]; + float height; int error_number = 0; /* Two number systems can be used - system 0 and system 1 */ @@ -285,9 +312,32 @@ static int upce(struct zint_symbol *symbol, unsigned char source[], int length, ustrcpy(symbol->text, hrt); +#ifdef COMPLIANT_HEIGHTS + /* BS EN 797:1996 4.5.1 Nominal dimensions 22.85mm / 0.33mm (X) ~ 69.24, + same as minimum GS1 General Specifications 21.0.1 5.12.3.1 */ + height = (float) (22.85 / 0.33); + if (symbol->symbology == BARCODE_UPCE_CC) { + symbol->height = height; /* Pass back min row == default height */ + } else { + error_number = set_height(symbol, height, height, 0.0f, 0 /*no_errtxt*/); + } +#else + height = 50.0f; + if (symbol->symbology == BARCODE_UPCE_CC) { + symbol->height = height - cc_rows * 2 - 6.0f; + } else { + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); + } +#endif + return error_number; } +/* UPC-E is a zero-compressed version of UPC-A */ +static int upce(struct zint_symbol *symbol, unsigned char source[], int length, unsigned char dest[]) { + return upce_cc(symbol, source, length, dest, 0 /*cc_rows*/); +} + /* EAN-2 and EAN-5 add-on codes */ static void add_on(const unsigned char source[], const int length, unsigned char dest[], const int addon_gap) { char parity[6]; @@ -367,10 +417,12 @@ static char ean_check(const char source[], const int length) { return itoc(check_digit); } -static int ean13(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char dest[]) { +static int ean13_cc(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char dest[], + int cc_rows) { int i, half_way; char parity[6]; char gtin[14]; + float height; int error_number = 0; parity[0] = '\0'; @@ -421,13 +473,36 @@ static int ean13(struct zint_symbol *symbol, const unsigned char source[], int l ustrcat(dest, "111"); ustrcpy(symbol->text, gtin); +#ifdef COMPLIANT_HEIGHTS + /* BS EN 797:1996 4.5.1 Nominal dimensions 22.85mm / 0.33mm (X) ~ 69.24, + same as minimum GS1 General Specifications 21.0.1 5.12.3.1 */ + height = (float) (22.85 / 0.33); + if (symbol->symbology == BARCODE_EANX_CC) { + symbol->height = height; /* Pass back min row == default height */ + } else { + error_number = set_height(symbol, height, height, 0.0f, 0 /*no_errtxt*/); + } +#else + height = 50.0f; + if (symbol->symbology == BARCODE_EANX_CC) { + symbol->height = height - cc_rows * 2 - 6.0f; + } else { + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); + } +#endif + return error_number; } -/* Make an EAN-8 barcode when we haven't been given the check digit */ -static int ean8(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char dest[]) { +static int ean13(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char dest[]) { + return ean13_cc(symbol, source, length, dest, 0 /*cc_rows*/); +} + +static int ean8_cc(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char dest[], + int cc_rows) { /* EAN-8 is basically the same as UPC-A but with fewer digits */ char gtin[10]; + float height; int error_number = 0; ustrcpy(gtin, source); @@ -453,9 +528,32 @@ static int ean8(struct zint_symbol *symbol, const unsigned char source[], int le upca_draw(gtin, length, dest); ustrcpy(symbol->text, gtin); +#ifdef COMPLIANT_HEIGHTS + /* BS EN 797:1996 4.5.1 Nominal dimensions 18.23mm / 0.33mm (X) ~ 55.24, + same as minimum GS1 General Specifications 21.0.1 5.12.3.1 */ + height = (float) (18.23 / 0.33); + if (symbol->symbology == BARCODE_EANX_CC) { + symbol->height = height; /* Pass back min row == default height */ + } else { + error_number = set_height(symbol, height, height, 0.0f, 0 /*no_errtxt*/); + } +#else + height = 50.0f; + if (symbol->symbology == BARCODE_EANX_CC) { + symbol->height = height - cc_rows * 2 - 6.0f; + } else { + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); + } +#endif + return error_number; } +/* Make an EAN-8 barcode when we haven't been given the check digit */ +static int ean8(struct zint_symbol *symbol, const unsigned char source[], int length, unsigned char dest[]) { + return ean8_cc(symbol, source, length, dest, 0 /*cc_rows*/); +} + /* For ISBN(10) and SBN only */ static char isbn_check(const unsigned char source[], const int length) { int i, weight, sum, check; @@ -683,7 +781,7 @@ INTERNAL int ean_leading_zeroes(struct zint_symbol *symbol, const unsigned char return 1; /* Success */ } -INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { +INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src_len, int cc_rows) { unsigned char first_part[14] = {0}, second_part[6] = {0}, dest[1000] = {0}; unsigned char local_source[20] = {0}; /* Allow 13 + "+" + 5 + 1 */ int latch, reader, writer; @@ -691,6 +789,7 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le int error_number, i, plus_count; int addon_gap = 0; int first_part_len, second_part_len; + float height; latch = FALSE; writer = 0; @@ -713,7 +812,7 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le return error_number; } } - + /* Check for multiple '+' characters */ plus_count = 0; for (i = 0; i < src_len; i++) { @@ -772,9 +871,25 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le switch (first_part_len) { case 2: add_on(first_part, first_part_len, dest, 0); ustrcpy(symbol->text, first_part); +#ifdef COMPLIANT_HEIGHTS + /* 21.9mm from GS1 General Specifications 5.2.6.6, Figure 5.2.6.6-5 */ + height = (float) (21.9 / 0.33); /* 21.9mm / 0.33mm ~ 66.36 */ + error_number = set_height(symbol, height, height, 0.0f, 0 /*no_errtxt*/); +#else + height = 50.0f; + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); +#endif break; case 5: add_on(first_part, first_part_len, dest, 0); ustrcpy(symbol->text, first_part); +#ifdef COMPLIANT_HEIGHTS + /* 21.9mm from GS1 General Specifications 5.2.6.6, Figure 5.2.6.6-6 */ + height = (float) (21.9 / 0.33); /* 21.9mm / 0.33mm ~ 66.36 */ + error_number = set_height(symbol, height, height, 0.0f, 0 /*no_errtxt*/); +#else + height = 50.0f; + (void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/); +#endif break; case 7: case 8: error_number = ean8(symbol, first_part, first_part_len, dest); @@ -798,7 +913,7 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le symbol->row_height[symbol->rows + 1] = 2; symbol->row_height[symbol->rows + 2] = 2; symbol->rows += 3; - error_number = ean8(symbol, first_part, first_part_len, dest); + error_number = ean8_cc(symbol, first_part, first_part_len, dest, cc_rows); break; case 12: case 13:set_module(symbol, symbol->rows, 1); @@ -811,7 +926,7 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le symbol->row_height[symbol->rows + 1] = 2; symbol->row_height[symbol->rows + 2] = 2; symbol->rows += 3; - error_number = ean13(symbol, first_part, first_part_len, dest); + error_number = ean13_cc(symbol, first_part, first_part_len, dest, cc_rows); break; default: strcpy(symbol->errtxt, "287: Input wrong length"); return ZINT_ERROR_TOO_LONG; @@ -838,7 +953,7 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le symbol->row_height[symbol->rows + 1] = 2; symbol->row_height[symbol->rows + 2] = 2; symbol->rows += 3; - error_number = upca(symbol, first_part, first_part_len, dest); + error_number = upca_cc(symbol, first_part, first_part_len, dest, cc_rows); } else { strcpy(symbol->errtxt, "289: Input wrong length"); return ZINT_ERROR_TOO_LONG; @@ -865,7 +980,7 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le symbol->row_height[symbol->rows + 1] = 2; symbol->row_height[symbol->rows + 2] = 2; symbol->rows += 3; - error_number = upce(symbol, first_part, first_part_len, dest); + error_number = upce_cc(symbol, first_part, first_part_len, dest, cc_rows); } else { strcpy(symbol->errtxt, "291: Input wrong length"); return ZINT_ERROR_TOO_LONG; @@ -920,3 +1035,8 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le return error_number; } + +/* Handle UPC, EAN, ISBN */ +INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_len) { + return eanx_cc(symbol, source, src_len, 0 /*cc_rows*/); +} diff --git a/backend/vector.c b/backend/vector.c index f86685fb..bf267850 100644 --- a/backend/vector.c +++ b/backend/vector.c @@ -65,7 +65,8 @@ static struct zint_vector_rect *vector_plot_create_rect(float x, float y, float return rect; } -static int vector_plot_add_rect(struct zint_symbol *symbol, struct zint_vector_rect *rect, struct zint_vector_rect **last_rect) { +static int vector_plot_add_rect(struct zint_symbol *symbol, struct zint_vector_rect *rect, + struct zint_vector_rect **last_rect) { if (!rect) return ZINT_ERROR_MEMORY; if (*last_rect) (*last_rect)->next = rect; @@ -90,7 +91,8 @@ static struct zint_vector_hexagon *vector_plot_create_hexagon(float x, float y, return hexagon; } -static int vector_plot_add_hexagon(struct zint_symbol *symbol, struct zint_vector_hexagon *hexagon, struct zint_vector_hexagon **last_hexagon) { +static int vector_plot_add_hexagon(struct zint_symbol *symbol, struct zint_vector_hexagon *hexagon, + struct zint_vector_hexagon **last_hexagon) { if (!hexagon) return ZINT_ERROR_MEMORY; if (*last_hexagon) (*last_hexagon)->next = hexagon; @@ -115,7 +117,8 @@ static struct zint_vector_circle *vector_plot_create_circle(float x, float y, fl return circle; } -static int vector_plot_add_circle(struct zint_symbol *symbol, struct zint_vector_circle *circle, struct zint_vector_circle **last_circle) { +static int vector_plot_add_circle(struct zint_symbol *symbol, struct zint_vector_circle *circle, + struct zint_vector_circle **last_circle) { if (!circle) return ZINT_ERROR_MEMORY; if (*last_circle) (*last_circle)->next = circle; @@ -371,7 +374,8 @@ static void vector_reduce_rectangles(struct zint_symbol *symbol) { target = prev->next; while (target) { - if ((rect->x == target->x) && (rect->width == target->width) && ((rect->y + rect->height) == target->y) && (rect->colour == target->colour)) { + if ((rect->x == target->x) && (rect->width == target->width) && ((rect->y + rect->height) == target->y) + && (rect->colour == target->colour)) { rect->height += target->height; prev->next = target->next; free(target); @@ -397,7 +401,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ int addon_gap = 0; float addon_text_posn = 0.0f; float addon_bar_height = 0.0f; - int xoffset, yoffset, roffset, boffset; + float xoffset, yoffset, roffset, boffset; float textoffset; float default_text_posn; float row_height, row_posn; @@ -408,12 +412,12 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ int hide_text; int i, r; int text_height; /* Font pixel size (so whole integers) */ + int upcae_outside_text_height = 0; /* UPC-A/E outside digits font size */ float digit_ascent_factor = 0.25f; /* Assuming digit ascent roughly 25% less than font size */ float text_gap; /* Gap between barcode and text */ float dot_overspill = 0.0f; float dotoffset = 0.0f; - int rect_count, last_row_start = 0; int this_row; @@ -440,7 +444,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ vector->circles = NULL; vector->strings = NULL; - large_bar_height = output_large_bar_height(symbol); + large_bar_height = output_large_bar_height(symbol, 0 /*No rounding to scale*/); main_width = symbol->width; @@ -450,19 +454,20 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ output_set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset); - hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0)); - /* Note font sizes scaled by 2 so really twice these values */ if (upceanflag) { /* Note BOLD_TEXT ignored for UPCEAN by svg/emf/ps/qzint */ text_height = symbol->output_options & SMALL_TEXT ? 7 : 10; upcae_outside_text_height = symbol->output_options & SMALL_TEXT ? 6 : 7; - text_gap = -text_height * digit_ascent_factor + 0.5f; /* Negative to move close to barcode (less digit ascent, then add 0.5X) */ + /* Negative to move close to barcode (less digit ascent, then add 0.5X) */ + text_gap = -text_height * digit_ascent_factor + 0.5f; } else { text_height = symbol->output_options & SMALL_TEXT ? 6 : 7; text_gap = text_height * 0.1f; } + hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0)); + if (hide_text) { textoffset = upceanflag && upceanflag != 2 && upceanflag != 5 ? 5.0f : 0.0f; /* Allow for guard bars */ } else { @@ -551,7 +556,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ for (r = 0; r < symbol->rows; r++) { for (i = 0; i < symbol->width; i++) { if (module_is_set(symbol, r, i)) { - struct zint_vector_circle *circle = vector_plot_create_circle(i + dotradius + dotoffset + xoffset, r + dotradius + dotoffset + yoffset, symbol->dot_size, 0); + struct zint_vector_circle *circle = vector_plot_create_circle(i + dotradius + dotoffset + xoffset, + r + dotradius + dotoffset + yoffset, symbol->dot_size, 0); vector_plot_add_circle(symbol, circle, &last_circle); } } @@ -573,7 +579,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ int block_width = 0; do { block_width++; - } while (i + block_width < symbol->width && module_colour_is_set(symbol, this_row, i + block_width) == module_fill); + } while (i + block_width < symbol->width + && module_colour_is_set(symbol, this_row, i + block_width) == module_fill); if (module_fill) { /* a colour block */ rectangle = vector_plot_create_rect(i + xoffset, row_posn, block_width, row_height); @@ -590,7 +597,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ int block_width = 0; do { block_width++; - } while (i + block_width < symbol->width && module_is_set(symbol, this_row, i + block_width) == module_fill); + } while (i + block_width < symbol->width + && module_is_set(symbol, this_row, i + block_width) == module_fill); if (upceanflag && (addon_latch == 0) && (r == (symbol->rows - 1)) && (i > main_width)) { addon_text_posn = row_posn + text_height - text_height * digit_ascent_factor; if (addon_text_posn < 0.0f) { @@ -610,7 +618,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ if (addon_latch == 0) { rectangle = vector_plot_create_rect(i + xoffset, row_posn, block_width, row_height); } else { - rectangle = vector_plot_create_rect(i + xoffset, addon_text_posn - text_gap, block_width, addon_bar_height); + rectangle = vector_plot_create_rect(i + xoffset, addon_text_posn - text_gap, block_width, + addon_bar_height); } vector_plot_add_rect(symbol, rectangle, &last_rectangle); rect_count++; @@ -706,93 +715,113 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ if (upceanflag == 6) { /* UPC-E */ textpos = -5.0f + xoffset; textwidth = 6.2f; - vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, upcae_outside_text_height, textwidth, 2 /*right align*/, &last_string); + vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, upcae_outside_text_height, + textwidth, 2 /*right align*/, &last_string); textpos = 24.0f + xoffset; textwidth = 6.0f * 8.5f; - vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, 0, + &last_string); textpos = 51.0f + 3.0f + xoffset; textwidth = 6.2f; - vector_plot_add_string(symbol, textpart3, textpos, default_text_posn, upcae_outside_text_height, textwidth, 1 /*left align*/, &last_string); + vector_plot_add_string(symbol, textpart3, textpos, default_text_posn, upcae_outside_text_height, + textwidth, 1 /*left align*/, &last_string); textdone = 1; switch (ustrlen(addon)) { case 2: textpos = 61.0f + xoffset + addon_gap; textwidth = 2.0f * 8.5f; - vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, + &last_string); break; case 5: textpos = 75.0f + xoffset + addon_gap; textwidth = 5.0f * 8.5f; - vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, + &last_string); break; } } else if (upceanflag == 8) { /* EAN-8 */ textpos = 17.0f + xoffset; textwidth = 4.0f * 8.5f; - vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, text_height, textwidth, 0, + &last_string); textpos = 50.0f + xoffset; - vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, 0, + &last_string); textdone = 1; switch (ustrlen(addon)) { case 2: textpos = 77.0f + xoffset + addon_gap; textwidth = 2.0f * 8.5f; - vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, + &last_string); break; case 5: textpos = 91.0f + xoffset + addon_gap; textwidth = 5.0f * 8.5f; - vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, + &last_string); break; } } else if (upceanflag == 12) { /* UPC-A */ textpos = -5.0f + xoffset; textwidth = 6.2f; - vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, upcae_outside_text_height, textwidth, 2 /*right align*/, &last_string); + vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, upcae_outside_text_height, + textwidth, 2 /*right align*/, &last_string); textpos = 27.0f + xoffset; textwidth = 5.0f * 8.5f; - vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, 0, + &last_string); textpos = 67.0f + xoffset; - vector_plot_add_string(symbol, textpart3, textpos, default_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, textpart3, textpos, default_text_posn, text_height, textwidth, 0, + &last_string); textpos = 95.0f + 5.0f + xoffset; textwidth = 6.2f; - vector_plot_add_string(symbol, textpart4, textpos, default_text_posn, upcae_outside_text_height, textwidth, 1 /*left align*/, &last_string); + vector_plot_add_string(symbol, textpart4, textpos, default_text_posn, upcae_outside_text_height, + textwidth, 1 /*left align*/, &last_string); textdone = 1; switch (ustrlen(addon)) { case 2: textpos = 105.0f + xoffset + addon_gap; textwidth = 2.0f * 8.5f; - vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, + &last_string); break; case 5: textpos = 119.0f + xoffset + addon_gap; textwidth = 5.0f * 8.5f; - vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, + &last_string); break; } } else if (upceanflag == 13) { /* EAN-13 */ textpos = -5.0f + xoffset; textwidth = 8.5f; - vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, text_height, textwidth, 2 /*right align*/, &last_string); + vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, text_height, textwidth, + 2 /*right align*/, &last_string); textpos = 24.0f + xoffset; textwidth = 6.0f * 8.5f; - vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, 0, + &last_string); textpos = 71.0f + xoffset; - vector_plot_add_string(symbol, textpart3, textpos, default_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, textpart3, textpos, default_text_posn, text_height, textwidth, 0, + &last_string); textdone = 1; switch (ustrlen(addon)) { case 2: textpos = 105.0f + xoffset + addon_gap; textwidth = 2.0f * 8.5f; - vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, + &last_string); break; case 5: textpos = 119.0f + xoffset + addon_gap; textwidth = 5.0f * 8.5f; - vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, &last_string); + vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, 0, + &last_string); break; } } @@ -801,7 +830,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ if (!textdone) { /* Put normal human readable text at the bottom (and centered) */ // calculate start xoffset to center text - vector_plot_add_string(symbol, symbol->text, main_width / 2.0f + xoffset, default_text_posn, text_height, symbol->width, 0, &last_string); + vector_plot_add_string(symbol, symbol->text, main_width / 2.0f + xoffset, default_text_posn, text_height, + symbol->width, 0, &last_string); } xoffset -= comp_offset; // Restore xoffset @@ -818,14 +848,16 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ if (symbol->symbology != BARCODE_CODABLOCKF && symbol->symbology != BARCODE_HIBC_BLOCKF) { for (r = 1; r < symbol->rows; r++) { row_height = symbol->row_height[r - 1] ? symbol->row_height[r - 1] : large_bar_height; - rectangle = vector_plot_create_rect(xoffset, (r * row_height) + yoffset - sep_height / 2, symbol->width, sep_height); + rectangle = vector_plot_create_rect(xoffset, (r * row_height) + yoffset - sep_height / 2, + symbol->width, sep_height); vector_plot_add_rect(symbol, rectangle, &last_rectangle); } } else { for (r = 1; r < symbol->rows; r++) { /* Avoid 11-module start and 13-module stop chars */ row_height = symbol->row_height[r - 1] ? symbol->row_height[r - 1] : large_bar_height; - rectangle = vector_plot_create_rect(xoffset + 11, (r * row_height) + yoffset - sep_height / 2, symbol->width - 24, sep_height); + rectangle = vector_plot_create_rect(xoffset + 11, (r * row_height) + yoffset - sep_height / 2, + symbol->width - 24, sep_height); vector_plot_add_rect(symbol, rectangle, &last_rectangle); } } diff --git a/backend/zint.h b/backend/zint.h index f9c4d9d5..460d82e3 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -75,7 +75,7 @@ extern "C" { struct zint_symbol { int symbology; - int height; /* Height in X-dims (ignored for fixed-width barcodes) */ + float height; /* Height in X-dims (ignored for fixed-width barcodes) */ int whitespace_width; /* Width in X-dims of whitespace to left/right of barcode */ int whitespace_height; /* Height in X-dims of whitespace above and below the barcode */ int border_width; /* Size of border in X-dims */ @@ -98,7 +98,7 @@ extern "C" { int width; char primary[128]; unsigned char encoded_data[200][143]; - int row_height[200]; /* Largest symbol is 189 x 189 Han Xin */ + float row_height[200]; /* Allow for 200 row DotCode */ char errtxt[100]; unsigned char *bitmap; int bitmap_width; diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index 796027e9..3de724f9 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -455,7 +455,7 @@ static char help_message[] = "zint tcl(stub,obj) dll\n" /* cli option --gs1 replaced by -format */ " -gs1parens bool: for gs1, AIs enclosed in parentheses instead of square brackets\n" " -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n" - " -height integer: Symbol height in modules\n" + " -height double: Symbol height in modules\n" /* cli option --input not supported */ " -init bool: Create reader initialisation symbol (Code 128, Data Matrix)\n" " -mask number: set masking pattern to use (QR/MicroQR/HanXin/DotCode)\n" @@ -957,12 +957,12 @@ static int Encode(Tcl_Interp *interp, int objc, } break; case iHeight: - if (intValue < 1 || intValue > 1000) { + if ((float)doubleValue < 0.5f || (float)doubleValue > 1000.0f) { Tcl_SetObjResult(interp, Tcl_NewStringObj("Height out of range", -1)); fError = 1; } else { - my_symbol->height = intValue; + my_symbol->height = (float)doubleValue; } break; case iSeparator: diff --git a/docs/manual.txt b/docs/manual.txt index 72b6450d..2c302e2e 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -419,7 +419,7 @@ gives a box with a width 10 times the X-dimension of the symbol. Note that when specifying a box, horizontal whitespace is usually required in order to create a quiet zone between the barcode and the sides of the box. -Code 16k, Code 49 and Codablock-F always have boundary bars, and default to +Codablock-F, Code 16k and Code 49 always have boundary bars, and default to particular horizontal whitespace values. Special considerations apply to ITF-14 - see the specific section 6.1.2.6 for that symbology. @@ -979,7 +979,9 @@ Variable Name | Type | Meaning | Default Value -------------------------------------------------------------------------------- symbology | integer | Symbol to use (see section | BARCODE_CODE128 | | 5.7). | -height | integer | Symbol height. [1] | 50 +height | float | Symbol height, excluding | Symbol + | | fixed width-to-height | dependent + | | symbols. [1] | whitespace_width | integer | Horizontal whitespace width.| 0 whitespace_height | integer | Vertical whitespace height. | 0 border_width | integer | Border width. | 0 @@ -1033,7 +1035,7 @@ encoding_data | array of | Representation of the | (output only) | character | encoded data. | | strings | | row_height | array of | Representation of the | (output only) - | integers | height of a row. | + | floats | height of a row. | errtxt | character | Error message in the event | (output only) | string | that an error occurred. | bitmap | pointer to | Pointer to stored bitmap | (output only) @@ -1054,9 +1056,10 @@ vector | pointer to | Pointer to vector header | (output only) | structure | vector elements. | -------------------------------------------------------------------------------- -[1] This value is ignored for Australia Post 4-State Barcodes, POSTNET, PLANET, -USPS Intelligent Mail, RM4SCC, PDF417, Data Matrix, MaxiCode, QR Code, GS1 -DataBar Stacked, PDF417 and MicroPDF417 - all of which have a fixed height. +[1] This value is ignored for Aztec (including HIBC and Aztec Rune), Code One, +Data Matrix (including HIBC), DotCode, Grid Matrix, Han Xin, MaxiCode, QR Code +(including HIBC, Micro QR, rMQR and UPNQR), and Ultracode - all of which have a +fixed width-to-height ratio (or, in the case of Code One, a fixed height). To alter these values use the syntax shown in the example below. This code has the same result as the previous example except the output is now taller and @@ -1069,7 +1072,7 @@ int main(int argc, char **argv) struct zint_symbol *my_symbol; my_symbol = ZBarcode_Create(); strcpy(my_symbol->fgcolour, "00ff00"); - my_symbol->height = 400; + my_symbol->height = 400.0f; ZBarcode_Encode_and_Print(my_symbol, argv[1], 0, 0); ZBarcode_Delete(my_symbol); return 0; @@ -1302,7 +1305,7 @@ Value | Effect 0 | No options selected. BARCODE_BIND | Boundary bars above and below the symbol and between | rows if stacking multiple symbols. [2] -BARCODE_BOX | Add a box surrounding the symbol and whitespace. [2] +BARCODE_BOX | Add a box surrounding the symbol and whitespace. BARCODE_STDOUT | Output the file to stdout. READER_INIT | Add a reader initialisation symbol to the data before | encoding. @@ -1316,8 +1319,9 @@ OUT_BUFFER_INTERMEDIATE | Return the bitmap buffer as ASCII values instead of | separate colour channels (OUT_BUFFER only). -------------------------------------------------------------------------------- -[2] This value is ignored for Code 16k and Codablock-F. Special considerations -apply to ITF-14 - see the specific section 6.1.2.6 for that symbology. +[2] This flag is always set for Codablock-F, Code 16k and Code 49. Special +considerations apply to ITF-14 - see the specific section 6.1.2.6 for that +symbology. 5.9 Setting the Input Mode -------------------------- @@ -2614,15 +2618,15 @@ Annex A. 6.6.9 Code One -------------- A matrix symbology developed by Ted Williams in 1992 which encodes data in a -way similar to Data Matrix. Code One is able to encode the Latin-1 -character set or GS1 data. There are two types of Code One symbol - variable -height symbols which are roughly square (versions A through to H) and -fixed-height versions (version S and T). These can be selected by using --vers= -or setting option_2 as shown in the table below: +way similar to Data Matrix. Code One is able to encode the Latin-1 character +set or GS1 data. There are two types of Code One symbol - fixed-ratio symbols +which are roughly square (versions A through to H) and variable-width versions +(version S and T). These can be selected by using --vers= or setting option_2 +as shown in the table below: -------------------------------------------------------------------- Input | Version | Size | Numeric | Alphanumeric - | | | Data Capacity | Data Capacity + | | (W x H) | Data Capacity | Data Capacity -------------------------------------------------------------------- 1 | A | 16 x 18 | 22 | 13 2 | B | 22 x 22 | 44 | 27 @@ -2632,8 +2636,8 @@ Input | Version | Size | Numeric | Alphanumeric 6 | F | 70 x 76 | 886 | 553 7 | G | 104 x 98 | 1755 | 1096 8 | H | 148 x 134 | 3550 | 2218 -9 | S | 8X height | 18 | N/A -10 | T | 16X height | 90 | 55 +9 | S | width x 8 | 18 | N/A +10 | T | width x 16 | 90 | 55 -------------------------------------------------------------------- Version S symbols can only encode numeric data. The width of version S and @@ -2882,7 +2886,9 @@ This is a method for creating 4-state codes where the data encoding is provided by an external program. Input data should consist of the letters 'D', 'A', 'F' and 'T' where these refer to descender, ascender, full (ascender and descender) and tracker (neither ascender nor descender) respectively. All other characters -are ignored. +are invalid. The ratio of the tracker size to full height can be given in +thousandths (permille) using the --vers= option or by setting option_2. The +default value is 250 (25%). 7. Legal and Version Information @@ -3206,6 +3212,7 @@ international standards: > Uniform Symbology Specification Code One (AIM Inc., 1994) > ANSI/AIM BC12-1998 - Uniform Symbology Specification Channel Code > ANSI/AIM BC6-2000 - Uniform Symbology Specification Code 49 +> ANSI/AIM BC5-1995 - Uniform Symbology Specification Code 93 > ANSI/HIBC 2.6-2016 - The Health Industry Bar Code (HIBC) Supplier Labeling Standard > AIM ISS-X-24 - Uniform Symbology Specification Codablock-F diff --git a/frontend/main.c b/frontend/main.c index 8c61047c..95fb00a0 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -770,6 +770,7 @@ int main(int argc, char **argv) { int ret; char *outfile_extension; int data_arg_num = 0; + float float_opt; #ifndef _MSC_VER arg_opt arg_opts[argc]; #else @@ -1009,14 +1010,11 @@ int main(int argc, char **argv) { my_symbol->output_options |= GS1_GS_SEPARATOR; break; case OPT_HEIGHT: - if (!validate_int(optarg, &val)) { - fprintf(stderr, "Error 109: Invalid symbol height value (digits only)\n"); - return do_exit(1); - } - if ((val >= 1) && (val <= 1000)) { - my_symbol->height = val; + float_opt = (float) atof(optarg); + if (float_opt >= 0.5f && float_opt <= 1000.0f) { + my_symbol->height = float_opt; } else { - fprintf(stderr, "Warning 110: Symbol height out of range (1 to 1000), ignoring\n"); + fprintf(stderr, "Warning 110: Symbol height '%g' out of range (0.5 to 1000), ignoring\n", float_opt); fflush(stderr); } break; diff --git a/frontend/tests/test_args.c b/frontend/tests/test_args.c index 81bfff6e..9fcd750f 100644 --- a/frontend/tests/test_args.c +++ b/frontend/tests/test_args.c @@ -636,8 +636,8 @@ static void test_checks(int index, int debug) { /* 8*/ { -1, -1, -1, -1, -2, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 138: Invalid ECI value (digits only)" }, /* 9*/ { -1, -1, -1, -1, 1000000, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 118: ECI code out of range (0 to 999999), ignoring" }, /* 10*/ { -1, -1, -1, -1, -1, "jpg", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 142: File type 'jpg' not supported, ignoring" }, - /* 11*/ { -1, -1, -1, -1, -1, NULL, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 109: Invalid symbol height value (digits only)" }, - /* 12*/ { -1, -1, -1, -1, -1, NULL, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height out of range (1 to 1000), ignoring" }, + /* 11*/ { -1, -1, -1, -1, -1, NULL, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '-2' out of range (0.5 to 1000), ignoring" }, + /* 12*/ { -1, -1, -1, -1, -1, NULL, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '0' out of range (0.5 to 1000), ignoring" }, /* 13*/ { -1, -1, -1, -1, -1, NULL, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 148: Invalid mask value (digits only)" }, /* 14*/ { -1, -1, -1, -1, -1, NULL, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 147: Mask value out of range (0 to 7), ignoring" }, /* 15*/ { -1, -1, -1, -1, -1, NULL, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 116: Mode value out of range (0 to 6), ignoring" }, diff --git a/frontend_qt/CMakeLists.txt b/frontend_qt/CMakeLists.txt index 2bec9e36..b884a93b 100644 --- a/frontend_qt/CMakeLists.txt +++ b/frontend_qt/CMakeLists.txt @@ -16,11 +16,11 @@ else() qt5_wrap_ui(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui) qt5_add_resources(zint-qt_SRCS resources.qrc) endif() -# grpAztec.ui grpC39.ui grpCodeOne.ui grpHX.ui grpMSICheck.ui grpUPCA.ui -# grpC11.ui grpC49.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpUPCEAN.ui -# grpC128.ui grpChannel.ui grpDM.ui grpMaxicode.ui grpQR.ui grpVIN.ui -# grpC16k.ui grpCodabar.ui grpDotCode.ui grpMicroPDF.ui grpRMQR.ui -# grpC25.ui grpCodablockF.ui grpGrid.ui grpMQR.ui grpUltra.ui +# grpAztec.ui grpC39.ui grpCodeOne.ui grpGrid.ui grpMQR.ui grpUltra.ui +# grpC11.ui grpC49.ui grpDAFT.ui grpHX.ui grpMSICheck.ui grpUPCA.ui +# grpC128.ui grpChannel.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpUPCEAN.ui +# grpC16k.ui grpCodabar.ui grpDM.ui grpMaxicode.ui grpQR.ui grpVIN.ui +# grpC25.ui grpCodablockF.ui grpDotCode.ui grpMicroPDF.ui grpRMQR.ui add_executable(zint-qt ${zint-qt_SRCS}) add_dependencies(zint-qt zint) diff --git a/frontend_qt/frontend_qt.pro b/frontend_qt/frontend_qt.pro index a4811dd7..147cc5d4 100644 --- a/frontend_qt/frontend_qt.pro +++ b/frontend_qt/frontend_qt.pro @@ -72,6 +72,7 @@ FORMS += extData.ui \ grpCodabar.ui \ grpCodeOne.ui \ grpCodablockF.ui \ + grpDAFT.ui \ grpDBExtend.ui \ grpDM.ui \ grpDotCode.ui \ diff --git a/frontend_qt/frontend_qt_zintdll.pro b/frontend_qt/frontend_qt_zintdll.pro index c9be008e..851f1726 100644 --- a/frontend_qt/frontend_qt_zintdll.pro +++ b/frontend_qt/frontend_qt_zintdll.pro @@ -25,6 +25,7 @@ FORMS += extData.ui \ grpCodabar.ui \ grpCodablockF.ui \ grpCodeOne.ui \ + grpDAFT.ui \ grpDBExtend.ui \ grpDM.ui \ grpDotCode.ui \ diff --git a/frontend_qt/grpDAFT.ui b/frontend_qt/grpDAFT.ui new file mode 100644 index 00000000..a210fc89 --- /dev/null +++ b/frontend_qt/grpDAFT.ui @@ -0,0 +1,122 @@ + + + grpDAFT + + + + 0 + 0 + 310 + 78 + + + + + 600 + 16777215 + + + + Form + + + + + + + + &Tracker Ratio: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnDAFTTrackerRatio + + + Size of tracker as percentage of full height + + + + + + + Size of tracker as percentage of full height + + + + + + % + + + 1 + + + 5.000000000000000 + + + 90.000000000000000 + + + 1.000000000000000 + + + 25.000000000000000 + + + + + + + + + + 0 + 0 + + + + + 9 + + + + Examples of tracker ratios:<table cellspacing="3"> +<tr><td>Australia Post&nbsp;</td><td>26%</td></tr> +<tr><td>Japan Post&nbsp;</td><td>33%</td></tr> +<tr><td>PLANET, POSTNET&nbsp;</td><td>40%</td></tr> +<tr><td>Royal Mail, Dutch Post&nbsp;</td><td>25.6%</td></tr> +<tr><td>USPS Intelligent Mail&nbsp;</td><td>33.1%</td></tr> +<tr><td>Default&nbsp;</td><td>25%</td></tr> +</table> + + + Qt::RichText + + + Qt::AlignLeft + + + true + + + + + + + Qt::Vertical + + + + 20 + 30 + + + + + + + + + diff --git a/frontend_qt/mainWindow.ui b/frontend_qt/mainWindow.ui index dfda32f2..7ad25cd4 100644 --- a/frontend_qt/mainWindow.ui +++ b/frontend_qt/mainWindow.ui @@ -672,7 +672,7 @@ as GS1 application identifiers delimiters - + false @@ -680,20 +680,26 @@ as GS1 application identifiers delimiters Overall symbol height (ignored if disabled) - - X - + + X + + + 3 + - 1 + 0.500000000000000 - 300 + 300.000000000000000 + + + 0.100000000000000 - 50 + 50.000000000000000 diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 033a6d21..7a5e96aa 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -165,7 +165,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) chkRInit->setChecked(settings.value("studio/chk_rinit").toInt() ? true : false); chkGS1Parens->setChecked(settings.value("studio/chk_gs1parens").toInt() ? true : false); chkAutoHeight->setChecked(settings.value("studio/appearance/autoheight", 1).toInt() ? true : false); - heightb->setValue(settings.value("studio/appearance/height", 50).toInt()); + heightb->setValue(settings.value("studio/appearance/height", 50.0f).toFloat()); bwidth->setValue(settings.value("studio/appearance/border", 0).toInt()); spnWhitespace->setValue(settings.value("studio/appearance/whitespace", 0).toInt()); spnVWhitespace->setValue(settings.value("studio/appearance/vwhitespace", 0).toInt()); @@ -187,7 +187,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(change_options())); connect(bstyle, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(filter_bstyle, SIGNAL(textChanged( const QString& )), SLOT(filter_symbologies())); - connect(heightb, SIGNAL(valueChanged( int )), SLOT(update_preview())); + connect(heightb, SIGNAL(valueChanged( double )), SLOT(update_preview())); connect(bwidth, SIGNAL(valueChanged( int )), SLOT(update_preview())); connect(btype, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(cmbFontSetting, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); @@ -481,7 +481,9 @@ void MainWindow::dotty_ui_set() void MainWindow::on_encoded() { if (!chkAutoHeight->isEnabled() || chkAutoHeight->isChecked()) { - heightb->setValue(m_bc.bc.height()); + /* setValue() rounds up/down to precision (decimals 3), we want round up only */ + float height = (float) (ceil(m_bc.bc.height() * 1000.0f) / 1000.0f); + heightb->setValue(height); } } @@ -782,6 +784,15 @@ void MainWindow::change_options() connect(m_optionWidget->findChild("radCbfStand"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild("radCbfHIBC"), SIGNAL(clicked( bool )), SLOT(update_preview())); + } else if (symbology == BARCODE_DAFT) { + QFile file(":/grpDAFT.ui"); + if (file.open(QIODevice::ReadOnly)) { + m_optionWidget = uiload.load(&file); + file.close(); + tabMain->insertTab(1, m_optionWidget, tr("DAFT")); + connect(m_optionWidget->findChild("spnDAFTTrackerRatio"), SIGNAL(valueChanged( double )), SLOT(update_preview())); + } + } else if (symbology == BARCODE_DATAMATRIX) { QFile file(":/grpDM.ui"); if (!file.open(QIODevice::ReadOnly)) @@ -907,6 +918,7 @@ void MainWindow::change_options() btype->setItemText(0, tr("Default (bind)")); connect(m_optionWidget->findChild("cmbC49RowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(m_optionWidget->findChild("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview())); + } else if (symbology == BARCODE_DBAR_EXPSTK) { QFile file(":/grpDBExtend.ui"); if (!file.open(QIODevice::ReadOnly)) @@ -1381,6 +1393,11 @@ void MainWindow::update_preview() } break; + case BARCODE_DAFT: + m_bc.bc.setSymbol(BARCODE_DAFT); + m_bc.bc.setOption2((int) (get_doublespinbox_val("spnDAFTTrackerRatio") * 10)); // Kept as percentage, convert to thousandths + break; + case BARCODE_DATAMATRIX: if(m_optionWidget->findChild("radDM200HIBC")->isChecked()) m_bc.bc.setSymbol(BARCODE_HIBC_DM); @@ -1848,6 +1865,20 @@ void MainWindow::set_checkbox_from_setting(QSettings &settings, const QString &s } } +/* Helper to return value of double spinner, checking for NULL */ +double MainWindow::get_doublespinbox_val(const QString &child) { + QDoubleSpinBox *spinBox = m_optionWidget->findChild(child); + return spinBox ? spinBox->value() : 0.0; +} + +/* Helper to set double spinner from settings, checking for NULL */ +void MainWindow::set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, float default_val) { + QDoubleSpinBox *spinBox = m_optionWidget->findChild(child); + if (spinBox) { + spinBox->setValue(settings.value(setting, default_val).toFloat()); + } +} + /* Helper to return text of line edit, checking for NULL */ QString MainWindow::get_lineedit_val(const QString &child) { QLineEdit *lineEdit = m_optionWidget ? m_optionWidget->findChild(child) : nullptr; @@ -2017,6 +2048,10 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) { settings.setValue("studio/bc/codablockf/encoding_mode", get_button_group_index(QStringList() << "radCbfStand" << "radCbfHIBC")); break; + case BARCODE_DAFT: + settings.setValue("studio/bc/daft/tracker_ratio", QString::number(get_doublespinbox_val("spnDAFTTrackerRatio"), 'f', 1 /*precision*/)); + break; + case BARCODE_DATAMATRIX: case BARCODE_HIBC_DM: settings.setValue("studio/bc/datamatrix/size", get_combobox_index("cmbDM200Size")); @@ -2146,7 +2181,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { chkGS1Parens->setChecked(settings.value(QString("studio/bc/%1/chk_gs1parens").arg(name)).toInt() ? true : false); if (chkAutoHeight->isEnabled()) { chkAutoHeight->setChecked(settings.value(QString("studio/bc/%1/appearance/autoheight").arg(name), 1).toInt() ? true : false); - heightb->setValue(settings.value(QString("studio/bc/%1/appearance/height").arg(name), 50).toInt()); + heightb->setValue(settings.value(QString("studio/bc/%1/appearance/height").arg(name), 50.0f).toFloat()); } bwidth->setValue(settings.value(QString("studio/bc/%1/appearance/border").arg(name), 0).toInt()); spnWhitespace->setValue(settings.value(QString("studio/bc/%1/appearance/whitespace").arg(name), 0).toInt()); @@ -2266,6 +2301,10 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) { set_radiobutton_from_setting(settings, "studio/bc/codablockf/encoding_mode", QStringList() << "radCbfStand" << "radCbfHIBC"); break; + case BARCODE_DAFT: + set_doublespinbox_from_setting(settings, "studio/bc/daft/tracker_ratio", "spnDAFTTrackerRatio", 25.0f); + break; + case BARCODE_DATAMATRIX: case BARCODE_HIBC_DM: set_combobox_from_setting(settings, "studio/bc/datamatrix/size", "cmbDM200Size"); diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index 02fbd0b5..2a89fd49 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -136,19 +136,22 @@ protected: void combobox_item_enabled(QComboBox *comboBox, int index, bool enabled); void upcean_addon_gap(QComboBox *comboBox, QLabel *label, int base); void set_gs1_mode(bool gs1_mode); + const char *get_setting_name(int symbology); + int get_button_group_index(const QStringList &children); void set_radiobutton_from_setting(QSettings &settings, const QString &setting, const QStringList &children, int default_val = 0); int get_combobox_index(const QString &child); void set_combobox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val = 0); int get_checkbox_val(const QString &child); void set_checkbox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val = 0); - float get_doublespinbox_val(const QString &child); - void set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, float default_val = 0); + double get_doublespinbox_val(const QString &child); + void set_doublespinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, float default_val = 0.0f); QString get_lineedit_val(const QString &child); void set_lineedit_from_setting(QSettings &settings, const QString &setting, const QString &child, const char *default_val = ""); int get_spinbox_val(const QString &child); void set_spinbox_from_setting(QSettings &settings, const QString &setting, const QString &child, int default_val = 0); + void save_sub_settings(QSettings &settings, int symbology); void load_sub_settings(QSettings &settings, int symbology); diff --git a/frontend_qt/qzint.cpp b/frontend_qt/qzint.cpp index 23cadfa7..2f39c5f1 100644 --- a/frontend_qt/qzint.cpp +++ b/frontend_qt/qzint.cpp @@ -38,7 +38,7 @@ namespace Zint { QZint::QZint() { m_symbol = BARCODE_CODE128; - m_height = 0; + m_height = 0.0f; m_borderType = 0; m_borderWidth = 0; m_fontSetting = 0; @@ -170,11 +170,11 @@ namespace Zint { m_primaryMessage = primaryMessage; } - int QZint::height() const { + float QZint::height() const { return m_height; } - void QZint::setHeight(int height) { + void QZint::setHeight(float height) { m_height = height; } diff --git a/frontend_qt/qzint.h b/frontend_qt/qzint.h index c6e7b31b..c591cdcc 100644 --- a/frontend_qt/qzint.h +++ b/frontend_qt/qzint.h @@ -48,8 +48,8 @@ public: QString primaryMessage() const; void setPrimaryMessage(const QString & primaryMessage); - int height() const; - void setHeight(int height); + float height() const; + void setHeight(float height); int option2() const; void setOption2(int option); @@ -138,7 +138,7 @@ private: int m_symbol; QString m_text; QString m_primaryMessage; - int m_height; + float m_height; int m_borderType; int m_borderWidth; int m_fontSetting; diff --git a/frontend_qt/resources.qrc b/frontend_qt/resources.qrc index 3ce904f9..ee3c5f70 100644 --- a/frontend_qt/resources.qrc +++ b/frontend_qt/resources.qrc @@ -11,6 +11,7 @@ grpCodabar.ui grpCodablockF.ui grpCodeOne.ui + grpDAFT.ui grpDBExtend.ui grpDM.ui grpDotCode.ui