UPC/EAN, ITF14: quiet zones, addongap; raster/vector: sync code, use double

This commit is contained in:
gitlost 2020-07-15 19:00:12 +01:00
parent e90c273165
commit 2a19b883a5
55 changed files with 2917 additions and 1351 deletions

View File

@ -279,6 +279,13 @@ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int lengt
localstr[14] = '\0'; localstr[14] = '\0';
error_number = interleaved_two_of_five(symbol, (unsigned char *) localstr, strlen(localstr)); error_number = interleaved_two_of_five(symbol, (unsigned char *) localstr, strlen(localstr));
ustrcpy(symbol->text, localstr); ustrcpy(symbol->text, localstr);
symbol->output_options |= BARCODE_BOX;
if (symbol->border_width == 0) { /* Allow override if non-zero */
/* GS1 General Specifications 20.0 Sections 5.3.2.4 & 5.3.6 (4.83 / 1.016 ~ 4.75) */
symbol->border_width = 5; /* Note change from previous value 8 */
}
return error_number; return error_number;
} }

View File

@ -45,19 +45,18 @@
static const char *C128Table[107] = { static const char *C128Table[107] = {
/* Code 128 character encodation - Table 1 */ /* Code 128 character encodation - Table 1 */
"212222", "222122", "222221", "121223", "121322", "131222", "122213", /* 0 1 2 3 4 5 6 7 8 9 */
"122312", "132212", "221213", "221312", "231212", "112232", "122132", "122231", "113222", "212222", "222122", "222221", "121223", "121322", "131222", "122213", "122312", "132212", "221213", /* 0 */
"123122", "123221", "223211", "221132", "221231", "213212", "223112", "312131", "311222", "221312", "231212", "112232", "122132", "122231", "113222", "123122", "123221", "223211", "221132", /* 10 */
"321122", "321221", "312212", "322112", "322211", "212123", "212321", "232121", "111323", "221231", "213212", "223112", "312131", "311222", "321122", "321221", "312212", "322112", "322211", /* 20 */
"131123", "131321", "112313", "132113", "132311", "211313", "231113", "231311", "112133", "212123", "212321", "232121", "111323", "131123", "131321", "112313", "132113", "132311", "211313", /* 30 */
"112331", "132131", "113123", "113321", "133121", "313121", "211331", "231131", "213113", "231113", "231311", "112133", "112331", "132131", "113123", "113321", "133121", "313121", "211331", /* 40 */
"213311", "213131", "311123", "311321", "331121", "312113", "312311", "332111", "314111", "231131", "213113", "213311", "213131", "311123", "311321", "331121", "312113", "312311", "332111", /* 50 */
"221411", "431111", "111224", "111422", "121124", "121421", "141122", "141221", "112214", "314111", "221411", "431111", "111224", "111422", "121124", "121421", "141122", "141221", "112214", /* 60 */
"112412", "122114", "122411", "142112", "142211", "241211", "221114", "413111", "241112", "112412", "122114", "122411", "142112", "142211", "241211", "221114", "413111", "241112", "134111", /* 70 */
"134111", "111242", "121142", "121241", "114212", "124112", "124211", "411212", "421112", "111242", "121142", "121241", "114212", "124112", "124211", "411212", "421112", "421211", "212141", /* 80 */
"421211", "212141", "214121", "412121", "111143", "111341", "131141", "114113", "114311", "214121", "412121", "111143", "111341", "131141", "114113", "114311", "411113", "411311", "113141", /* 90 */
"411113", "411311", "113141", "114131", "311141", "411131", "211412", "211214", "211232", "114131", "311141", "411131", "211412", "211214", "211232", "2331112" /*100 */
"2331112"
}; };
/* Determine appropriate mode for a given character */ /* Determine appropriate mode for a given character */

View File

@ -218,28 +218,22 @@ INTERNAL int is_stackable(const int symbology) {
return 0; return 0;
} }
/* Indicates which symbols can have addon (EAN-2 and EAN-5) */ /* Indicates which symbols can have addon (EAN-2 and EAN-5)
* Note: if change this must also change version in frontend/main.c */
INTERNAL int is_extendable(const int symbology) { INTERNAL int is_extendable(const int symbology) {
if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) {
return 1; switch (symbology) {
} case BARCODE_EANX:
if (symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK) { case BARCODE_EANX_CHK:
return 1; case BARCODE_UPCA:
} case BARCODE_UPCA_CHK:
if (symbology == BARCODE_UPCE || symbology == BARCODE_UPCE_CHK) { case BARCODE_UPCE:
return 1; case BARCODE_UPCE_CHK:
} case BARCODE_ISBNX:
if (symbology == BARCODE_ISBNX) { case BARCODE_EANX_CC:
return 1; case BARCODE_UPCA_CC:
} case BARCODE_UPCE_CC:
if (symbology == BARCODE_UPCA_CC) { return 1;
return 1;
}
if (symbology == BARCODE_UPCE_CC) {
return 1;
}
if (symbology == BARCODE_EANX_CC) {
return 1;
} }
return 0; return 0;

View File

@ -328,6 +328,7 @@ static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) {
char pattern[580]; char pattern[580];
int variant, LeftRAPStart, CentreRAPStart, RightRAPStart, StartCluster; int variant, LeftRAPStart, CentreRAPStart, RightRAPStart, StartCluster;
int LeftRAP, CentreRAP, RightRAP, Cluster, loop; int LeftRAP, CentreRAP, RightRAP, Cluster, loop;
int columns;
length = strlen(source) / 8; length = strlen(source) / 8;
@ -445,10 +446,10 @@ static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) {
/* Now we have the variant we can load the data - from here on the same as MicroPDF417 code */ /* Now we have the variant we can load the data - from here on the same as MicroPDF417 code */
variant--; variant--;
assert(variant >= 0); assert(variant >= 0);
symbol->option_2 = MicroVariants[variant]; /* columns */ columns = MicroVariants[variant]; /* columns */
symbol->rows = MicroVariants[variant + 34]; /* rows */ symbol->rows = MicroVariants[variant + 34]; /* rows */
k = MicroVariants[variant + 68]; /* number of EC CWs */ k = MicroVariants[variant + 68]; /* number of EC CWs */
longueur = (symbol->option_2 * symbol->rows) - k; /* number of non-EC CWs */ longueur = (columns * symbol->rows) - k; /* number of non-EC CWs */
i = longueur - mclength; /* amount of padding required */ i = longueur - mclength; /* amount of padding required */
offset = MicroVariants[variant + 102]; /* coefficient offset */ offset = MicroVariants[variant + 102]; /* coefficient offset */
@ -506,8 +507,8 @@ static int cc_b(struct zint_symbol *symbol, char source[], int cc_width) {
for (j = 0; j < 5; j++) { for (j = 0; j < 5; j++) {
dummy[j] = 0; dummy[j] = 0;
} }
for (j = 0; j < symbol->option_2; j++) { for (j = 0; j < columns; j++) {
dummy[j + 1] = chainemc[i * symbol->option_2 + j]; dummy[j + 1] = chainemc[i * columns + j];
} }
/* Copy the data into codebarre */ /* Copy the data into codebarre */
bin_append(rap_side[LeftRAP - 1], 10, pattern); bin_append(rap_side[LeftRAP - 1], 10, pattern);

View File

@ -244,7 +244,7 @@ INTERNAL void large_unset_bit(large_int *t, int bit) {
} }
} }
/* Ouput large_int into an unsigned int array of size `size`, each element containing `bits` bits */ /* Output large_int into an unsigned int array of size `size`, each element containing `bits` bits */
INTERNAL void large_uint_array(const large_int *t, unsigned int *uint_array, int size, int bits) { INTERNAL void large_uint_array(const large_int *t, unsigned int *uint_array, int size, int bits) {
int i, j; int i, j;
uint64_t mask; uint64_t mask;

View File

@ -672,14 +672,6 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
unsigned char* preprocessed = (unsigned char*) _alloca(in_length + 1); unsigned char* preprocessed = (unsigned char*) _alloca(in_length + 1);
#endif #endif
if (symbol->symbology == BARCODE_ITF14) {
symbol->whitespace_width = 20;
symbol->border_width = 8;
if (!(symbol->output_options & BARCODE_BOX)) {
symbol->output_options += BARCODE_BOX;
}
}
switch (symbol->input_mode & 0x07) { switch (symbol->input_mode & 0x07) {
case DATA_MODE: case DATA_MODE:
case GS1_MODE: case GS1_MODE:

View File

@ -30,14 +30,13 @@
*/ */
/* vim: set ts=4 sw=4 et : */ /* vim: set ts=4 sw=4 et : */
#include <string.h>
#include "common.h" #include "common.h"
#include "output.h" #include "output.h"
#define SSET "0123456789ABCDEF" #define SSET "0123456789ABCDEF"
/* Check colour options are good. Note: using raster.c error nos 651-654 */ /* Check colour options are good. Note: using raster.c error nos 651-654 */
INTERNAL int check_colour_options(struct zint_symbol *symbol) { INTERNAL int output_check_colour_options(struct zint_symbol *symbol) {
int error_number; int error_number;
if (strlen(symbol->fgcolour) != 6) { if (strlen(symbol->fgcolour) != 6) {
@ -68,32 +67,346 @@ INTERNAL int check_colour_options(struct zint_symbol *symbol) {
} }
/* Return minimum quiet zones for each symbology */ /* Return minimum quiet zones for each symbology */
static void quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *top, int *bottom) { static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *top, int *bottom) {
int done = 0;
*left = *right = *top = *bottom = 0; *left = *right = *top = *bottom = 0;
/* These always have quiet zones set (previously used whitespace_width) */
switch (symbol->symbology) { switch (symbol->symbology) {
case BARCODE_CODE16K: case BARCODE_CODE16K:
/* BS EN 12323:2005 Section 4.5 c) */ /* BS EN 12323:2005 Section 4.5 (c) */
*left = 10; *left = 10;
*right = 1; *right = 1;
done = 1;
break; break;
case BARCODE_CODE49: case BARCODE_CODE49:
/* ANSI/AIM BC6-2000 Section 2.4 */ /* ANSI/AIM BC6-2000 Section 2.4 */
*left = 10; *left = 10;
*right = 1; *right = 1;
done = 1;
break; break;
case BARCODE_CODABLOCKF: case BARCODE_CODABLOCKF:
case BARCODE_HIBC_BLOCKF: case BARCODE_HIBC_BLOCKF:
/* AIM ISS-X-24 Section 4.6.1 */ /* AIM ISS-X-24 Section 4.6.1 */
*left = 10; *left = 10;
*right = 10; *right = 10;
done = 1;
break;
case BARCODE_ITF14:
/* GS1 General Specifications 20.0 Section 5.3.2.2 */
*left = 10;
*right = 10;
done = 1;
break;
case BARCODE_EANX:
case BARCODE_EANX_CHK:
case BARCODE_EANX_CC:
case BARCODE_ISBNX:
/* GS1 General Specifications 20.0 Section 5.2.3.4 */
switch (ustrlen(symbol->text)) {
case 13: /* EAN-13 */
*left = 11;
*right = 7;
break;
case 16: /* EAN-13/ISBN + 2 digit addon */
case 19: /* EAN-13/ISBN + 5 digit addon */
*left = 11;
*right = 5;
break;
case 5: /* EAN-5 addon */
case 2: /* EAN-2 addon */
*left = 7;
*right = 5;
break;
default: /* EAN-8 (+/- 2/5 digit addon) */
*left = 7;
*right = 7;
break;
}
done = 1;
break;
case BARCODE_UPCA:
case BARCODE_UPCA_CHK:
case BARCODE_UPCA_CC:
/* GS1 General Specifications 20.0 Section 5.2.3.4 */
*left = 9;
if (ustrlen(symbol->text) > 12) { /* UPC-A + addon */
*right = 5;
} else {
*right = 9;
}
done = 1;
break;
case BARCODE_UPCE:
case BARCODE_UPCE_CHK:
case BARCODE_UPCE_CC:
/* GS1 General Specifications 20.0 Section 5.2.3.4 */
*left = 9;
if (ustrlen(symbol->text) > 8) { /* UPC-E + addon */
*right = 5;
} else {
*right = 7;
}
done = 1;
break; break;
/* TODO: others */
} }
if (done) {
return done;
}
/* Only do others if flag set TODO: finish */
#if 0
if (!(symbol->output_options & BARCODE_QUIET_ZONES)) {
return done;
}
#else
return done;
#endif
switch (symbol->symbology) {
case BARCODE_CODE11:
/* TODO */
break;
case BARCODE_C25MATRIX:
case BARCODE_C25INTER:
case BARCODE_C25IATA:
case BARCODE_C25LOGIC:
case BARCODE_C25IND:
*left = *right = 10; // Probably this TODO: check
done = 1;
break;
case BARCODE_CODE39:
case BARCODE_EXCODE39:
case BARCODE_LOGMARS:
case BARCODE_PZN:
case BARCODE_VIN:
case BARCODE_HIBC_39:
case BARCODE_CODE32:
/* ISO/IEC 16388:2007 Section 4.4 (d) */
*left = *right = 10;
done = 1;
break;
case BARCODE_EAN128: /* GS1-128 */
case BARCODE_EAN128_CC:
case BARCODE_EAN14:
/* GS1 General Specifications 20.0 Section 5.4.4.2 */
*left = *right = 10;
done = 1;
break;
case BARCODE_CODABAR:
/* BS EN 798:1995 Section 4.4.1 (d) */
*left = *right = 10;
done = 1;
break;
case BARCODE_CODE128:
case BARCODE_CODE128B:
case BARCODE_HIBC_128:
case BARCODE_NVE18:
/* ISO/IEC 15417:2007 4.4.2 */
*left = *right = 10;
done = 1;
break;
case BARCODE_DPLEIT:
case BARCODE_DPIDENT:
/* TODO */
break;
case BARCODE_CODE93:
/* TODO */
break;
case BARCODE_FLAT:
/* TODO */
break;
case BARCODE_RSS14: /* GS1 Databar Omnidirectional */
case BARCODE_RSS_LTD: /* GS1 Databar Limited */
case BARCODE_RSS_EXP: /* GS1 Databar Expanded */
case BARCODE_RSS14STACK: /* GS1 DataBar Stacked */
case BARCODE_RSS14STACK_OMNI: /* GS1 DataBar Stacked Omnidirectional */
case BARCODE_RSS_EXPSTACK: /* GS1 Databar Expanded Stacked */
/* GS1 General Specifications 20.0 Section 5.5.1.1 - Quiet Zones: None required */
*left = *right = 0;
done = 1;
break;
case BARCODE_RSS14_CC:
case BARCODE_RSS_LTD_CC:
case BARCODE_RSS_EXP_CC:
case BARCODE_RSS14STACK_CC:
case BARCODE_RSS14_OMNI_CC:
case BARCODE_RSS_EXPSTACK_CC:
/* GS1 General Specifications 20.0 Sections 5.9.2.1 (CC-A) & 5.9.2.2 (CC-B) */
*left = *right = 1;
done = 1;
break;
case BARCODE_TELEPEN:
case BARCODE_TELEPEN_NUM:
/* TODO */
break;
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
done = 1;
break;
case BARCODE_MSI_PLESSEY:
/* TODO */
break;
case BARCODE_FIM:
/* TODO */
break;
case BARCODE_PHARMA:
case BARCODE_PHARMA_TWO:
/* TODO */
break;
case BARCODE_PDF417:
case BARCODE_PDF417TRUNC:
case BARCODE_HIBC_PDF:
/* ISO/IEC 15438:2015 Section 5.8.3 */
*left = *right = *top = *bottom = 2;
done = 1;
break;
case BARCODE_MICROPDF417:
case BARCODE_HIBC_MICPDF:
/* ISO/IEC 24728:2006 Section 5.8.3 */
*left = *right = *top = *bottom = 1;
done = 1;
break;
case BARCODE_MAXICODE:
/* ISO/IEC 16023:2000 Section 4.11.5 */
*left = *right = *top = *bottom = 1;
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;
done = 1;
break;
case BARCODE_MICROQR:
/* ISO/IEC 18004:2015 Section 9.1 */
*left = *right = *top = *bottom = 2;
done = 1;
break;
case BARCODE_RMQR:
/* ISO/IEC JTC1/SC31N000 Section 6.3.10 */
*left = *right = *top = *bottom = 2;
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
done = 1;
break;
case BARCODE_RM4SCC:
/* TODO */
break;
case BARCODE_DATAMATRIX:
case BARCODE_HIBC_DM:
/* ISO/IEC 16022:2006 Section 7.1 */
*left = *right = *top = *bottom = 1;
done = 1;
break;
case BARCODE_JAPANPOST:
/* TODO */
break;
case BARCODE_KOREAPOST:
/* TODO */
break;
case BARCODE_ONECODE:
/* 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
done = 1;
break;
case BARCODE_PLESSEY:
/* TODO */
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
done = 1;
break;
case BARCODE_AZTEC:
case BARCODE_HIBC_AZTEC:
case BARCODE_AZRUNE:
/* ISO/IEC 24778:2008 Section 4.1 (c) & Annex A.1 (Rune) - no quiet zone required */
done = 1;
break;
case BARCODE_DAFT:
/* TODO */
break;
case BARCODE_DOTCODE:
/* ISS DotCode Rev. 4.0 Section 4.1 (3) (c) */
*left = *right = *top = *bottom = 3;
done = 1;
break;
case BARCODE_HANXIN:
/* ISO/IEC DIS 20830:2019 Section 4.2.8 (also Section 6.2) */
*left = *right = *top = *bottom = 3;
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
done = 1;
break;
case BARCODE_CHANNEL:
/* ANSI/AIM BC12-1998 Section 4.4 (c) */
*left = 1;
*right = 2;
done = 1;
break;
case BARCODE_CODEONE:
/* TODO */
break;
case BARCODE_GRIDMATRIX:
/* AIMD014 (v 1.63) Section 7.1 */
*left = *right = *top = *bottom = 6;
done = 1;
break;
case BARCODE_ULTRA:
/* AIMD/TSC15032-43 (v 0.99c) Section 9.2 */
*left = *right = *top = *bottom = 1;
done = 1;
break;
}
return done; /* For self-checking */
} }
/* Set left (x), top (y), right and bottom offsets for whitespace */ /* Set left (x), top (y), right and bottom offsets for whitespace */
INTERNAL void set_whitespace_offsets(struct zint_symbol *symbol, int *xoffset, int *yoffset, int *roffset, int *boffset) { 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; int qz_left, qz_right, qz_top, qz_bottom;
quiet_zones(symbol, &qz_left, &qz_right, &qz_top, &qz_bottom); quiet_zones(symbol, &qz_left, &qz_right, &qz_top, &qz_bottom);
@ -112,3 +425,163 @@ INTERNAL void set_whitespace_offsets(struct zint_symbol *symbol, int *xoffset, i
*boffset += symbol->border_width; *boffset += symbol->border_width;
} }
} }
/* 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 */
int i, j, latch;
int text_length = ustrlen(symbol->text);
latch = 0;
j = 0;
/* Isolate add-on text */
for (i = 6; i < text_length && j < 5; i++) {
if (latch == 1) {
addon[j] = symbol->show_hrt ? symbol->text[i] : ' '; /* Use dummy space-filled addon if no hrt */
j++;
} else if (symbol->text[i] == '+') {
latch = 1;
}
}
addon[j] = '\0';
if (latch) {
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;
}
}
/* Calculate composite offset */
comp_offset = 0;
if (is_composite(symbol->symbology)) {
while (!(module_is_set(symbol, symbol->rows - 1, comp_offset))) {
comp_offset++;
}
}
upceanflag = 0;
main_width = symbol->width;
if ((symbol->symbology == BARCODE_EANX) || (symbol->symbology == BARCODE_EANX_CHK)
|| (symbol->symbology == BARCODE_EANX_CC) || (symbol->symbology == BARCODE_ISBNX)) {
switch (text_length) {
case 13: /* EAN-13 */
case 16: /* EAN-13 + EAN-2 */
case 19: /* EAN-13 + EAN-5 */
main_width = 95 + comp_offset; /* EAN-13 main symbol 95 modules wide */
upceanflag = 13;
break;
case 2:
/* EAN-2 can't have addon or be composite */
upceanflag = 2;
break;
case 5:
/* EAN-5 can't have addon or be composite */
upceanflag = 5;
break;
default:
main_width = 68 + comp_offset; /* EAN-8 main symbol 68 modules wide */
upceanflag = 8;
break;
}
} else if ((symbol->symbology == BARCODE_UPCA) || (symbol->symbology == BARCODE_UPCA_CHK)
|| (symbol->symbology == BARCODE_UPCA_CC)) {
main_width = 95 + comp_offset; /* UPC-A main symbol 95 modules wide */
upceanflag = 12;
} else if ((symbol->symbology == BARCODE_UPCE) || (symbol->symbology == BARCODE_UPCE_CHK)
|| (symbol->symbology == BARCODE_UPCE_CC)) {
main_width = 51 + comp_offset; /* UPC-E main symbol 51 modules wide */
upceanflag = 6;
}
*p_comp_offset = comp_offset;
*p_main_width = main_width;
return upceanflag;
}
/* Calculate large bar height i.e. linear bars */
INTERNAL double output_large_bar_height(struct zint_symbol *symbol) {
int i, large_bar_count, preset_height;
double 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 (large_bar_count) {
large_bar_height = (double) (symbol->height - preset_height) / large_bar_count;
} else {
large_bar_height = 0.0; /* Not used if large_bar_count zero */
}
return large_bar_height;
}
/* 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]) {
int i;
if (upceanflag == 6) { /* UPC-E */
textpart1[0] = text[0];
textpart1[1] = '\0';
for (i = 0; i < 6; i++) {
textpart2[i] = text[i + 1];
}
textpart2[6] = '\0';
textpart3[0] = text[7];
textpart3[1] = '\0';
} else if (upceanflag == 8) { /* EAN-8 */
for (i = 0; i < 4; i++) {
textpart1[i] = text[i];
}
textpart1[4] = '\0';
for (i = 0; i < 4; i++) {
textpart2[i] = text[i + 4];
}
textpart2[4] = '\0';
} else if (upceanflag == 12) { /* UPC-A */
textpart1[0] = text[0];
textpart1[1] = '\0';
for (i = 0; i < 5; i++) {
textpart2[i] = text[i + 1];
}
textpart2[5] = '\0';
for (i = 0; i < 5; i++) {
textpart3[i] = text[i + 6];
}
textpart3[5] = '\0';
textpart4[0] = text[11];
textpart4[1] = '\0';
} else if (upceanflag == 13) { /* EAN-13 */
textpart1[0] = text[0];
textpart1[1] = '\0';
for (i = 0; i < 6; i++) {
textpart2[i] = text[i + 1];
}
textpart2[6] = '\0';
for (i = 0; i < 6; i++) {
textpart3[i] = text[i + 7];
}
textpart3[6] = '\0';
}
}

View File

@ -37,8 +37,12 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
INTERNAL int check_colour_options(struct zint_symbol *symbol); INTERNAL int output_check_colour_options(struct zint_symbol *symbol);
INTERNAL void set_whitespace_offsets(struct zint_symbol *symbol, int *xoffset, int *yoffset, int *roffset, int *boffset); 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 double output_large_bar_height(struct zint_symbol *symbol);
INTERNAL void output_upcean_split_text(int upceanflag, unsigned char text[],
unsigned char textpart1[], unsigned char textpart2[], unsigned char textpart3[], unsigned char textpart4[]);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -36,7 +36,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <io.h> #include <io.h>
#endif #endif
#include <string.h> #include <math.h>
#include "common.h" #include "common.h"
#include "output.h" #include "output.h"
@ -46,7 +46,7 @@
#include "font.h" /* Font for human readable text */ #include "font.h" /* Font for human readable text */
#define SSET "0123456789ABCDEF" #define SSET "0123456789ABCDEF"
#define DEFAULT_INK '1' #define DEFAULT_INK '1'
#define DEFAULT_PAPER '0' #define DEFAULT_PAPER '0'
@ -66,6 +66,7 @@ static int buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
int fgred, fggrn, fgblu, bgred, bggrn, bgblu; int fgred, fggrn, fgblu, bgred, bggrn, bgblu;
int row, column, i; int row, column, i;
/* Free any previous bitmap */
if (symbol->bitmap != NULL) { if (symbol->bitmap != NULL) {
free(symbol->bitmap); free(symbol->bitmap);
symbol->bitmap = NULL; symbol->bitmap = NULL;
@ -137,7 +138,6 @@ static int buffer_plot(struct zint_symbol *symbol, char *pixelbuf) {
symbol->bitmap[i + 1] = bggrn; symbol->bitmap[i + 1] = bggrn;
symbol->bitmap[i + 2] = bgblu; symbol->bitmap[i + 2] = bgblu;
break; break;
} }
} }
} }
@ -251,7 +251,7 @@ static void draw_bar(char *pixelbuf, int xpos, int xlen, int ypos, int ylen, int
} }
} }
static void draw_circle(char *pixelbuf, int image_width, int image_height, int x0, int y0, float radius, char fill) { static void draw_circle(char *pixelbuf, int image_width, int image_height, int x0, int y0, double radius, char fill) {
int x, y; int x, y;
int radius_i = (int) radius; int radius_i = (int) radius;
@ -269,8 +269,8 @@ static void draw_circle(char *pixelbuf, int image_width, int image_height, int x
static void draw_bullseye(char *pixelbuf, int image_width, int image_height, int xoffset, int yoffset, int scaler) { static void draw_bullseye(char *pixelbuf, int image_width, int image_height, int xoffset, int yoffset, int scaler) {
/* Central bullseye in Maxicode symbols */ /* Central bullseye in Maxicode symbols */
float x = 14.5 * scaler; double x = 14.5 * scaler;
float y = 15.0 * scaler; double y = 15.0 * scaler;
if(scaler < 10) { if(scaler < 10) {
x = 16.0 * scaler; x = 16.0 * scaler;
y = 16.5 * scaler; y = 16.5 * scaler;
@ -415,7 +415,7 @@ static void draw_letter(char *pixelbuf, unsigned char letter, int xposn, int ypo
} }
/* Plot a string into the pixel buffer */ /* Plot a string into the pixel buffer */
static void draw_string(char *pixbuf, char input_string[], int xposn, int yposn, int textflags, int image_width, int image_height) { static void draw_string(char *pixbuf, unsigned char input_string[], int xposn, int yposn, int textflags, int image_width, int image_height) {
int i, string_length, string_left_hand, letter_width = 7; int i, string_length, string_left_hand, letter_width = 7;
switch (textflags) { switch (textflags) {
@ -432,27 +432,25 @@ static void draw_string(char *pixbuf, char input_string[], int xposn, int yposn,
break; break;
} }
string_length = strlen(input_string); string_length = ustrlen(input_string);
string_left_hand = xposn - ((letter_width * string_length) / 2); string_left_hand = xposn - ((letter_width * string_length) / 2);
for (i = 0; i < string_length; i++) { for (i = 0; i < string_length; i++) {
// NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) suppress false positive about 2nd arg input_string[i] being uninitialized
draw_letter(pixbuf, input_string[i], string_left_hand + (i * letter_width), yposn, textflags, image_width, image_height); draw_letter(pixbuf, input_string[i], string_left_hand + (i * letter_width), yposn, textflags, image_width, image_height);
} }
} }
static void plot_hexline(char *scaled_hexagon, int hexagon_size, float start_x, float start_y, float end_x, float end_y) { static void plot_hexline(char *scaled_hexagon, int hexagon_size, double start_x, double start_y, double end_x, double end_y) {
/* Draw a straight line from start to end */ /* Draw a straight line from start to end */
int i; int i;
float inc_x, inc_y; double inc_x, inc_y;
inc_x = (end_x - start_x) / hexagon_size; inc_x = (end_x - start_x) / hexagon_size;
inc_y = (end_y - start_y) / hexagon_size; inc_y = (end_y - start_y) / hexagon_size;
for (i = 0; i < hexagon_size; i++) { for (i = 0; i < hexagon_size; i++) {
float this_x = start_x + ((float)i * inc_x); double this_x = start_x + (i * inc_x);
float this_y = start_y + ((float)i * inc_y); double this_y = start_y + (i * inc_y);
if (((this_x >= 0) && (this_x < hexagon_size)) && ((this_y >= 0) && (this_y < hexagon_size))) { if (((this_x >= 0) && (this_x < hexagon_size)) && ((this_y >= 0) && (this_y < hexagon_size))) {
scaled_hexagon[(hexagon_size * (int)this_y) + (int)this_x] = DEFAULT_INK; scaled_hexagon[(hexagon_size * (int)this_y) + (int)this_x] = DEFAULT_INK;
} }
@ -463,10 +461,10 @@ static void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
/* Create a hexagon shape and fill it */ /* Create a hexagon shape and fill it */
int line, i; int line, i;
float x_offset[6]; double x_offset[6];
float y_offset[6]; double y_offset[6];
float start_x, start_y; double start_x, start_y;
float end_x, end_y; double end_x, end_y;
x_offset[0] = 0.0; x_offset[0] = 0.0;
x_offset[1] = 0.86; x_offset[1] = 0.86;
@ -484,16 +482,16 @@ static void plot_hexagon(char *scaled_hexagon, int hexagon_size) {
/* Plot hexagon outline */ /* Plot hexagon outline */
for (line = 0; line < 5; line++) { for (line = 0; line < 5; line++) {
start_x = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * x_offset[line]); start_x = (hexagon_size / 2.0) + ((hexagon_size / 2.0) * x_offset[line]);
start_y = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * y_offset[line]); start_y = (hexagon_size / 2.0) + ((hexagon_size / 2.0) * y_offset[line]);
end_x = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * x_offset[line + 1]); end_x = (hexagon_size / 2.0) + ((hexagon_size / 2.0) * x_offset[line + 1]);
end_y = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * y_offset[line + 1]); end_y = (hexagon_size / 2.0) + ((hexagon_size / 2.0) * y_offset[line + 1]);
plot_hexline(scaled_hexagon, hexagon_size, start_x, start_y, end_x, end_y); plot_hexline(scaled_hexagon, hexagon_size, start_x, start_y, end_x, end_y);
} }
start_x = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * x_offset[line]); start_x = (hexagon_size / 2.0) + ((hexagon_size / 2.0) * x_offset[line]);
start_y = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * y_offset[line]); start_y = (hexagon_size / 2.0) + ((hexagon_size / 2.0) * y_offset[line]);
end_x = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * x_offset[0]); end_x = (hexagon_size / 2.0) + ((hexagon_size / 2.0) * x_offset[0]);
end_y = ((float)hexagon_size / 2.0) + (((float)hexagon_size / 2.0) * y_offset[0]); end_y = (hexagon_size / 2.0) + ((hexagon_size / 2.0) * y_offset[0]);
plot_hexline(scaled_hexagon, hexagon_size, start_x, start_y, end_x, end_y); plot_hexline(scaled_hexagon, hexagon_size, start_x, start_y, end_x, end_y);
/* Fill hexagon */ /* Fill hexagon */
@ -523,7 +521,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, in
int error_number; int error_number;
int xoffset, yoffset; int xoffset, yoffset;
int roffset, boffset; int roffset, boffset;
float scaler = symbol->scale; double scaler = symbol->scale;
char *scaled_hexagon; char *scaled_hexagon;
int hexagon_size; int hexagon_size;
@ -531,10 +529,10 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, in
scaler = 0.5; scaler = 0.5;
} }
set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset); output_set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset);
image_width = (300 + 2 * (xoffset + roffset)) * scaler; image_width = ceil((300 + 2 * (xoffset + roffset)) * scaler);
image_height = (300 + 2 * (yoffset + boffset)) * scaler; image_height = ceil((300 + 2 * (yoffset + boffset)) * scaler);
if (!(pixelbuf = (char *) malloc(image_width * image_height))) { if (!(pixelbuf = (char *) malloc(image_width * image_height))) {
strcpy(symbol->errtxt, "655: Insufficient memory for pixel buffer"); strcpy(symbol->errtxt, "655: Insufficient memory for pixel buffer");
@ -542,7 +540,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, in
} }
memset(pixelbuf, DEFAULT_PAPER, image_width * image_height); memset(pixelbuf, DEFAULT_PAPER, image_width * image_height);
hexagon_size = (int)(scaler * 10); hexagon_size = ceil(scaler * 10);
if (!(scaled_hexagon = (char *) malloc(hexagon_size * hexagon_size))) { if (!(scaled_hexagon = (char *) malloc(hexagon_size * hexagon_size))) {
strcpy(symbol->errtxt, "656: Insufficient memory for pixel buffer"); strcpy(symbol->errtxt, "656: Insufficient memory for pixel buffer");
@ -593,47 +591,9 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, in
return error_number; return error_number;
} }
/* Convert UTF-8 to Latin1 Codepage for the interpretation line */
static void to_latin1(unsigned char source[], unsigned char preprocessed[]) {
int j, i, input_length;
input_length = ustrlen(source);
j = 0;
i = 0;
while (i < input_length) {
switch (source[i]) {
case 0xC2:
/* UTF-8 C2xxh */
/* Character range: C280h (latin: 80h) to C2BFh (latin: BFh) */
i++;
preprocessed[j] = source[i];
j++;
break;
case 0xC3:
/* UTF-8 C3xx */
/* Character range: C380h (latin: C0h) to C3BFh (latin: FFh) */
i++;
preprocessed[j] = source[i] + 64;
j++;
break;
default:
/* Process ASCII (< 80h), all other unicode points are ignored */
if (source[i] < 128) {
preprocessed[j] = source[i];
j++;
}
break;
}
i++;
}
preprocessed[j] = '\0';
return;
}
static int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_type) { static int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int data_type) {
float scaler = 2 * symbol->scale; double scaler = 2 * symbol->scale;
double half_scaler, dot_size_scaled;
char *scaled_pixelbuf; char *scaled_pixelbuf;
int r, i; int r, i;
int scale_width, scale_height; int scale_width, scale_height;
@ -643,7 +603,7 @@ static int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int d
symbol->height = symbol->rows; // This is true because only 2d matrix symbols are processed here symbol->height = symbol->rows; // This is true because only 2d matrix symbols are processed here
set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset); output_set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset);
image_width = symbol->width + xoffset + roffset; image_width = symbol->width + xoffset + roffset;
image_height = symbol->height + yoffset + boffset; image_height = symbol->height + yoffset + boffset;
@ -662,13 +622,16 @@ static int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int d
memset(scaled_pixelbuf, DEFAULT_PAPER, scale_width * scale_height); memset(scaled_pixelbuf, DEFAULT_PAPER, scale_width * scale_height);
/* Plot the body of the symbol to the pixel buffer */ /* Plot the body of the symbol to the pixel buffer */
half_scaler = scaler / 2.0;
dot_size_scaled = (symbol->dot_size * scaler) / 2.0;
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
double row_scaled = (r + yoffset) * scaler + half_scaler;
for (i = 0; i < symbol->width; i++) { for (i = 0; i < symbol->width; i++) {
if (module_is_set(symbol, r, i)) { if (module_is_set(symbol, r, i)) {
draw_circle(scaled_pixelbuf, scale_width, scale_height, draw_circle(scaled_pixelbuf, scale_width, scale_height,
(int) ((i + xoffset) * scaler) + (scaler / 2.0), (i + xoffset) * scaler + half_scaler,
(int) ((r + yoffset) * scaler) + (scaler / 2.0), row_scaled,
(symbol->dot_size / 2.0) * scaler, dot_size_scaled,
DEFAULT_INK); DEFAULT_INK);
} }
} }
@ -681,139 +644,61 @@ static int plot_raster_dotty(struct zint_symbol *symbol, int rotate_angle, int d
} }
static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_type) { static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_type) {
int textdone, main_width, comp_offset, large_bar_count;
char textpart[10], addon[6];
float addon_text_posn, preset_height, large_bar_height;
int i, r, textoffset, yoffset, xoffset, latch, image_width, image_height;
int roffset, boffset;
char *pixelbuf;
int addon_latch = 0, textflags = 0;
int block_width, textpos;
float row_height, row_posn;
int error_number; int error_number;
double large_bar_height;
int textdone;
int main_width, comp_offset, addon_gap;
unsigned char addon[6];
int xoffset, yoffset, roffset, boffset;
double addon_text_posn;
int textoffset;
int default_text_posn; int default_text_posn;
double row_height, row_posn;
int upceanflag = 0;
int addon_latch = 0;
unsigned char textpart1[5], textpart2[7], textpart3[7], textpart4[2];
int textpos;
int hide_text = 0;
int i, r;
int textflags = 0;
int image_width, image_height;
char *pixelbuf;
int next_yposn; int next_yposn;
float scaler = symbol->scale; int latch;
int block_width;
double scaler = symbol->scale;
int scale_width, scale_height;
char *scaled_pixelbuf; char *scaled_pixelbuf;
int horiz, vert; int horiz, vert;
int scale_width, scale_height;
#ifndef _MSC_VER
unsigned char local_text[ustrlen(symbol->text) + 1];
#else
unsigned char* local_text = (unsigned char*) _alloca(ustrlen(symbol->text) + 1);
#endif
if (symbol->show_hrt != 0) {
/* Copy text from symbol */
to_latin1(symbol->text, local_text);
} else {
/* No text needed */
if (is_extendable(symbol->symbology)) {
/* For these symbols use dummy text to ensure formatting is done
* properly even if no text is required */
for (i = 0; i < (int) ustrlen(symbol->text); i++) {
if (symbol->text[i] == '+') {
local_text[i] = '+';
} else {
local_text[i] = ' ';
}
}
local_text[ustrlen(symbol->text)] = '\0';
} else {
/* For everything else, just remove the text */
memset(local_text, 0, ustrlen(symbol->text) + 1); /* Note using memset() here to suppress clang-tidy false positives */
}
}
large_bar_height = output_large_bar_height(symbol);
textdone = 0; textdone = 0;
main_width = symbol->width; main_width = symbol->width;
comp_offset = 0; comp_offset = 0;
if (is_extendable(symbol->symbology)) {
upceanflag = output_process_upcean(symbol, &main_width, &comp_offset, addon, &addon_gap);
}
output_set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset);
addon_text_posn = 0.0; addon_text_posn = 0.0;
hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0));
if (symbol->output_options & SMALL_TEXT) { if (symbol->output_options & SMALL_TEXT) {
textflags = 1; textflags = 1;
} else if (symbol->output_options & BOLD_TEXT) { } else if (symbol->output_options & BOLD_TEXT) {
textflags = 2; textflags = 2;
} }
if (symbol->height == 0) { if (ustrlen(symbol->text) != 0) {
symbol->height = 50;
}
large_bar_count = 0;
preset_height = 0.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;
large_bar_height = 10;
} else {
large_bar_height = (symbol->height - preset_height) / large_bar_count;
}
if (is_composite(symbol->symbology)) {
while (!(module_is_set(symbol, symbol->rows - 1, comp_offset))) {
comp_offset++;
}
}
/* Certain symbols need whitespace otherwise characters get chopped off the sides */
if ((symbol->symbology == BARCODE_EANX) || (symbol->symbology == BARCODE_EANX_CHK)
|| (symbol->symbology == BARCODE_EANX_CC) || (symbol->symbology == BARCODE_ISBNX)) {
switch (ustrlen(local_text)) {
case 13: /* EAN 13 */
case 16:
case 19:
if (symbol->whitespace_width == 0) {
symbol->whitespace_width = 10;
}
main_width = 96 + comp_offset;
break;
default:
main_width = 68 + comp_offset;
}
} else if ((symbol->symbology == BARCODE_UPCA) || (symbol->symbology == BARCODE_UPCA_CHK)
|| (symbol->symbology == BARCODE_UPCA_CC)) {
if (symbol->whitespace_width == 0) {
symbol->whitespace_width = 10;
}
main_width = 96 + comp_offset;
} else if ((symbol->symbology == BARCODE_UPCE) || (symbol->symbology == BARCODE_UPCE_CHK)
|| (symbol->symbology == BARCODE_UPCE_CC)) {
if (symbol->whitespace_width == 0) {
symbol->whitespace_width = 10;
}
main_width = 51 + comp_offset;
}
latch = 0;
r = 0;
/* Isolate add-on text */
if (is_extendable(symbol->symbology)) {
for (i = 0; i < (int) ustrlen(local_text); i++) {
if (latch == 1) {
addon[r] = local_text[i];
r++;
}
if (symbol->text[i] == '+') {
latch = 1;
}
}
}
addon[r] = '\0';
if (ustrlen(local_text) != 0) {
textoffset = 9; textoffset = 9;
} else { } else {
textoffset = 0; textoffset = 0;
} }
set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset);
image_width = 2 * (symbol->width + xoffset + roffset); image_width = 2 * (symbol->width + xoffset + roffset);
image_height = 2 * (symbol->height + textoffset + yoffset + boffset); image_height = 2 * (symbol->height + textoffset + yoffset + boffset);
@ -825,9 +710,9 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
default_text_posn = image_height - 17; default_text_posn = image_height - 17;
row_height = 0.0;
row_posn = textoffset + yoffset; row_posn = textoffset + yoffset;
next_yposn = textoffset + yoffset; next_yposn = textoffset + yoffset;
row_height = 0;
/* Plot the body of the symbol to the pixel buffer */ /* Plot the body of the symbol to the pixel buffer */
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
@ -855,9 +740,13 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
} while ((i + block_width < symbol->width) && module_is_set(symbol, this_row, i + block_width) == module_is_set(symbol, this_row, i)); } while ((i + block_width < symbol->width) && module_is_set(symbol, this_row, i + block_width) == module_is_set(symbol, this_row, i));
if ((addon_latch == 0) && (r == 0) && (i > main_width)) { if ((addon_latch == 0) && (r == 0) && (i > main_width)) {
plot_height = (int) (row_height - 5.0); if (upceanflag == 12 || upceanflag == 6) { /* UPC-A/E add-ons don't descend */
plot_yposn = (int) (row_posn - 5.0); plot_height = row_height > 8.0 ? row_height - 8.0 : 1;
addon_text_posn = row_posn + row_height - 8.0; plot_yposn = row_posn;
} else {
plot_height = row_height > 3.0 ? row_height - 3.0 : 1;
plot_yposn = row_posn - 5;
}
addon_latch = 1; addon_latch = 1;
} }
if (module_fill) { if (module_fill) {
@ -875,193 +764,161 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
xoffset += comp_offset; xoffset += comp_offset;
if ((symbol->symbology == BARCODE_EANX) || (symbol->symbology == BARCODE_EANX_CHK) if (upceanflag) {
|| (symbol->symbology == BARCODE_EANX_CC) || (symbol->symbology == BARCODE_ISBNX)) { /* Guard bar extension */
/* guard bar extensions and text formatting for EAN8 and EAN13 */
switch (ustrlen(local_text)) {
case 8: /* EAN-8 */
case 11:
case 14:
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (32 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (34 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (64 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (66 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
for (i = 0; i < 4; i++) {
textpart[i] = local_text[i];
}
textpart[4] = '\0';
textpos = 2 * (17 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height); if (upceanflag == 6) { /* UPC-E */
for (i = 0; i < 4; i++) { draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
textpart[i] = local_text[i + 4]; draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
} draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
textpart[4] = '\0'; draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
textpos = 2 * (50 + xoffset); draw_bar(pixelbuf, (50 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height);
textdone = 1;
switch (strlen(addon)) {
case 2:
textpos = 2 * (xoffset + 86);
draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, textflags, image_width, image_height);
break;
case 5:
textpos = 2 * (xoffset + 100);
draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, textflags, image_width, image_height);
break;
}
break; } else if (upceanflag == 8) { /* EAN-8 */
case 13: /* EAN 13 */ draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
case 16: draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
case 19: draw_bar(pixelbuf, (32 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK); draw_bar(pixelbuf, (34 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK); draw_bar(pixelbuf, (64 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK); draw_bar(pixelbuf, (66 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (92 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (94 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
textpart[0] = local_text[0]; } else if (upceanflag == 12) { /* UPC-A */
textpart[1] = '\0'; latch = 1;
textpos = 2 * (-7 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height); i = 0 + comp_offset;
for (i = 0; i < 6; i++) { do {
textpart[i] = local_text[i + 1]; block_width = 0;
do {
block_width++;
} while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i));
if (latch == 1) {
/* a bar */
draw_bar(pixelbuf, (i + xoffset - comp_offset) * 2, block_width * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
latch = 0;
} else {
/* a space */
latch = 1;
} }
textpart[6] = '\0'; i += block_width;
} while (i < 11 + comp_offset);
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
latch = 1;
i = 85 + comp_offset;
do {
block_width = 0;
do {
block_width++;
} while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i));
if (latch == 1) {
/* a bar */
draw_bar(pixelbuf, (i + xoffset - comp_offset) * 2, block_width * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
latch = 0;
} else {
/* a space */
latch = 1;
}
i += block_width;
} while (i < 96 + comp_offset);
} else if (upceanflag == 13) { /* EAN-13 */
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (92 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (94 + xoffset) * 2, 1 * 2, (4 + yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
}
}
if (!hide_text) {
if (upceanflag) {
output_upcean_split_text(upceanflag, symbol->text, textpart1, textpart2, textpart3, textpart4);
if (upceanflag == 6) { /* UPC-E */
textpos = 2 * (-5 + xoffset);
draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height);
textpos = 2 * (24 + xoffset); textpos = 2 * (24 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height); draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height);
for (i = 0; i < 6; i++) { textpos = 2 * (55 + xoffset);
textpart[i] = local_text[i + 7]; draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height);
}
textpart[6] = '\0';
textpos = 2 * (71 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height);
textdone = 1; textdone = 1;
switch (strlen(addon)) { switch (ustrlen(addon)) {
case 2: case 2:
textpos = 2 * (xoffset + 114); textpos = 2 * (61 + xoffset + addon_gap);
draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, textflags, image_width, image_height); draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height);
break; break;
case 5: case 5:
textpos = 2 * (xoffset + 128); textpos = 2 * (75 + xoffset + addon_gap);
draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, textflags, image_width, image_height); draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height);
break; break;
} }
break;
} } else if (upceanflag == 8) { /* EAN-8 */
textpos = 2 * (17 + xoffset);
draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height);
textpos = 2 * (50 + xoffset);
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height);
textdone = 1;
switch (ustrlen(addon)) {
case 2:
textpos = 2 * (77 + xoffset + addon_gap);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height);
break;
case 5:
textpos = 2 * (91 + xoffset + addon_gap);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height);
break;
}
} else if ((symbol->symbology == BARCODE_UPCA) || (symbol->symbology == BARCODE_UPCA_CHK) } else if (upceanflag == 12) { /* UPC-A */
|| (symbol->symbology == BARCODE_UPCA_CC)) { textpos = 2 * (-5 + xoffset);
/* guard bar extensions and text formatting for UPCA */ draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height);
latch = 1; textpos = 2 * (27 + xoffset);
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height);
textpos = 2 * (68 + xoffset);
draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height);
textpos = 2 * (100 + xoffset);
draw_string(pixelbuf, textpart4, textpos, default_text_posn, textflags, image_width, image_height);
textdone = 1;
switch (ustrlen(addon)) {
case 2:
textpos = 2 * (107 + xoffset + addon_gap);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height);
break;
case 5:
textpos = 2 * (121 + xoffset + addon_gap);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height);
break;
}
i = 0 + comp_offset; } else if (upceanflag == 13) { /* EAN-13 */
do { textpos = 2 * (-7 + xoffset);
block_width = 0; draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height);
do { textpos = 2 * (24 + xoffset);
block_width++; draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height);
} while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i)); textpos = 2 * (71 + xoffset);
if (latch == 1) { draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height);
/* a bar */ textdone = 1;
draw_bar(pixelbuf, (i + xoffset - comp_offset) * 2, block_width * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK); switch (ustrlen(addon)) {
latch = 0; case 2:
} else { textpos = 2 * (105 + xoffset + addon_gap);
/* a space */ draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height);
latch = 1; break;
case 5:
textpos = 2 * (119 + xoffset + addon_gap);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height);
break;
}
} }
i += block_width;
} while (i < 11 + comp_offset);
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
latch = 1;
i = 85 + comp_offset;
do {
block_width = 0;
do {
block_width++;
} while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_is_set(symbol, symbol->rows - 1, i));
if (latch == 1) {
/* a bar */
draw_bar(pixelbuf, (i + xoffset - comp_offset) * 2, block_width * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
latch = 0;
} else {
/* a space */
latch = 1;
}
i += block_width;
} while (i < 96 + comp_offset);
textpart[0] = local_text[0];
textpart[1] = '\0';
textpos = 2 * (-5 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height);
for (i = 0; i < 5; i++) {
textpart[i] = local_text[i + 1];
}
textpart[5] = '\0';
textpos = 2 * (27 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height);
for (i = 0; i < 5; i++) {
textpart[i] = local_text[i + 6];
}
textpart[6] = '\0';
textpos = 2 * (68 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height);
textpart[0] = local_text[11];
textpart[1] = '\0';
textpos = 2 * (100 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height);
textdone = 1;
switch (strlen(addon)) {
case 2:
textpos = 2 * (xoffset + 116);
draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, textflags, image_width, image_height);
break;
case 5:
textpos = 2 * (xoffset + 130);
draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, textflags, image_width, image_height);
break;
} }
} else if ((symbol->symbology == BARCODE_UPCE) || (symbol->symbology == BARCODE_UPCE_CHK) if (!textdone) {
|| (symbol->symbology == BARCODE_UPCE_CC)) { /* Put the human readable text at the bottom */
/* guard bar extensions and text formatting for UPCE */ textpos = 2 * (main_width / 2 + xoffset);
draw_bar(pixelbuf, (0 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK); draw_string(pixelbuf, symbol->text, textpos, default_text_posn, textflags, image_width, image_height);
draw_bar(pixelbuf, (2 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (46 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (50 + xoffset) * 2, 1 * 2, (4 + (int) yoffset) * 2, 5 * 2, image_width, image_height, DEFAULT_INK);
textpart[0] = local_text[0];
textpart[1] = '\0';
textpos = 2 * (-5 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height);
for (i = 0; i < 6; i++) {
textpart[i] = local_text[i + 1];
} }
textpart[6] = '\0';
textpos = 2 * (24 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height);
textpart[0] = local_text[7];
textpart[1] = '\0';
textpos = 2 * (55 + xoffset);
draw_string(pixelbuf, textpart, textpos, default_text_posn, textflags, image_width, image_height);
textdone = 1;
switch (strlen(addon)) {
case 2:
textpos = 2 * (xoffset + 70);
draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, textflags, image_width, image_height);
break;
case 5:
textpos = 2 * (xoffset + 84);
draw_string(pixelbuf, addon, textpos, image_height - (addon_text_posn * 2) - 13, textflags, image_width, image_height);
break;
}
} }
xoffset -= comp_offset; xoffset -= comp_offset;
@ -1103,13 +960,6 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
draw_bar(pixelbuf, (symbol->width + xoffset + roffset - symbol->border_width) * 2, symbol->border_width * 2, textoffset * 2, (symbol->height + (2 * symbol->border_width)) * 2, image_width, image_height, DEFAULT_INK); draw_bar(pixelbuf, (symbol->width + xoffset + roffset - symbol->border_width) * 2, symbol->border_width * 2, textoffset * 2, (symbol->height + (2 * symbol->border_width)) * 2, image_width, image_height, DEFAULT_INK);
} }
/* Put the human readable text at the bottom */
if ((textdone == 0) && (ustrlen(local_text) != 0)) {
textpos = (image_width / 2);
draw_string(pixelbuf, (char*) local_text, textpos, default_text_posn, textflags, image_width, image_height);
}
if (scaler <= 0) { if (scaler <= 0) {
scaler = 0.5; scaler = 0.5;
} }
@ -1127,8 +977,9 @@ static int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int
memset(scaled_pixelbuf, DEFAULT_PAPER, scale_width * scale_height); memset(scaled_pixelbuf, DEFAULT_PAPER, scale_width * scale_height);
for (vert = 0; vert < scale_height; vert++) { for (vert = 0; vert < scale_height; vert++) {
double vert_scaled = (vert * image_width) / scaler;
for (horiz = 0; horiz < scale_width; horiz++) { for (horiz = 0; horiz < scale_width; horiz++) {
*(scaled_pixelbuf + (vert * scale_width) + horiz) = *(pixelbuf + ((int) (vert / scaler) * image_width) + (int) (horiz / scaler)); *(scaled_pixelbuf + (vert * scale_width) + horiz) = *(pixelbuf + (int) (vert_scaled + (horiz / scaler)));
} }
} }
@ -1151,7 +1002,7 @@ INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_
} }
#endif /* NO_PNG */ #endif /* NO_PNG */
error = check_colour_options(symbol); error = output_check_colour_options(symbol);
if (error != 0) { if (error != 0) {
return error; return error;
} }

View File

@ -44,10 +44,18 @@ To show debug info (if any), use '-d <flag>':
./test_dotcode -f input -i 2 -d 1 ./test_dotcode -f input -i 2 -d 1
(for other flags see <project-dir>/backend/tests/testcommon.h)
To generate test data, use '-g': To generate test data, use '-g':
./test_dotcode -f encode -g ./test_dotcode -f encode -g
To run a test against BWIPP (if any), use '-d 128':
./test_composite -d 128
(see also <project-dir>/backend/tests/tools/run_bwipp_tests.sh)
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
To make with gcc sanitize, first set for libzint and make: To make with gcc sanitize, first set for libzint and make:

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 845 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 645 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 710 B

View File

@ -0,0 +1,65 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="276" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="276" height="118" fill="#FFFFFF" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="26.00" y="0.00" width="2.00" height="110.00" />
<rect x="30.00" y="0.00" width="6.00" height="100.00" />
<rect x="38.00" y="0.00" width="4.00" height="100.00" />
<rect x="46.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="58.00" y="0.00" width="4.00" height="100.00" />
<rect x="66.00" y="0.00" width="4.00" height="100.00" />
<rect x="72.00" y="0.00" width="8.00" height="100.00" />
<rect x="82.00" y="0.00" width="2.00" height="100.00" />
<rect x="90.00" y="0.00" width="2.00" height="100.00" />
<rect x="96.00" y="0.00" width="2.00" height="100.00" />
<rect x="100.00" y="0.00" width="2.00" height="100.00" />
<rect x="108.00" y="0.00" width="4.00" height="100.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="110.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="128.00" y="0.00" width="6.00" height="100.00" />
<rect x="136.00" y="0.00" width="4.00" height="100.00" />
<rect x="142.00" y="0.00" width="4.00" height="100.00" />
<rect x="150.00" y="0.00" width="2.00" height="100.00" />
<rect x="154.00" y="0.00" width="6.00" height="100.00" />
<rect x="164.00" y="0.00" width="6.00" height="100.00" />
<rect x="174.00" y="0.00" width="2.00" height="100.00" />
<rect x="178.00" y="0.00" width="4.00" height="100.00" />
<rect x="186.00" y="0.00" width="4.00" height="100.00" />
<rect x="192.00" y="0.00" width="2.00" height="100.00" />
<rect x="200.00" y="0.00" width="2.00" height="100.00" />
<rect x="206.00" y="0.00" width="2.00" height="110.00" />
<rect x="210.00" y="0.00" width="2.00" height="110.00" />
<rect x="226.00" y="20.00" width="2.00" height="90.00" />
<rect x="230.00" y="20.00" width="4.00" height="90.00" />
<rect x="238.00" y="20.00" width="4.00" height="90.00" />
<rect x="246.00" y="20.00" width="2.00" height="90.00" />
<rect x="250.00" y="20.00" width="2.00" height="90.00" />
<rect x="256.00" y="20.00" width="2.00" height="90.00" />
<rect x="262.00" y="20.00" width="4.00" height="90.00" />
<text x="8.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
9
</text>
<text x="70.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
771384
</text>
<text x="164.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
524017
</text>
<text x="246.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,74 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="330" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="330" height="118" fill="#FFFFFF" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="26.00" y="0.00" width="2.00" height="110.00" />
<rect x="30.00" y="0.00" width="6.00" height="100.00" />
<rect x="38.00" y="0.00" width="4.00" height="100.00" />
<rect x="48.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="58.00" y="0.00" width="2.00" height="100.00" />
<rect x="64.00" y="0.00" width="6.00" height="100.00" />
<rect x="72.00" y="0.00" width="4.00" height="100.00" />
<rect x="78.00" y="0.00" width="6.00" height="100.00" />
<rect x="88.00" y="0.00" width="2.00" height="100.00" />
<rect x="96.00" y="0.00" width="2.00" height="100.00" />
<rect x="100.00" y="0.00" width="6.00" height="100.00" />
<rect x="108.00" y="0.00" width="4.00" height="100.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="110.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="130.00" y="0.00" width="2.00" height="100.00" />
<rect x="136.00" y="0.00" width="6.00" height="100.00" />
<rect x="144.00" y="0.00" width="2.00" height="100.00" />
<rect x="150.00" y="0.00" width="6.00" height="100.00" />
<rect x="158.00" y="0.00" width="2.00" height="100.00" />
<rect x="164.00" y="0.00" width="2.00" height="100.00" />
<rect x="174.00" y="0.00" width="2.00" height="100.00" />
<rect x="178.00" y="0.00" width="6.00" height="100.00" />
<rect x="188.00" y="0.00" width="2.00" height="100.00" />
<rect x="192.00" y="0.00" width="2.00" height="100.00" />
<rect x="196.00" y="0.00" width="2.00" height="100.00" />
<rect x="206.00" y="0.00" width="2.00" height="110.00" />
<rect x="210.00" y="0.00" width="2.00" height="110.00" />
<rect x="226.00" y="20.00" width="2.00" height="90.00" />
<rect x="230.00" y="20.00" width="4.00" height="90.00" />
<rect x="236.00" y="20.00" width="6.00" height="90.00" />
<rect x="246.00" y="20.00" width="2.00" height="90.00" />
<rect x="250.00" y="20.00" width="2.00" height="90.00" />
<rect x="254.00" y="20.00" width="2.00" height="90.00" />
<rect x="262.00" y="20.00" width="4.00" height="90.00" />
<rect x="268.00" y="20.00" width="2.00" height="90.00" />
<rect x="272.00" y="20.00" width="2.00" height="90.00" />
<rect x="282.00" y="20.00" width="2.00" height="90.00" />
<rect x="286.00" y="20.00" width="2.00" height="90.00" />
<rect x="292.00" y="20.00" width="2.00" height="90.00" />
<rect x="298.00" y="20.00" width="4.00" height="90.00" />
<rect x="304.00" y="20.00" width="2.00" height="90.00" />
<rect x="310.00" y="20.00" width="4.00" height="90.00" />
<rect x="318.00" y="20.00" width="2.00" height="90.00" />
<text x="8.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
9
</text>
<text x="70.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
780877
</text>
<text x="164.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
799306
</text>
<text x="274.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
54321
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,23 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="64" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="64" height="118" fill="#FFFFFF" />
<rect x="14.00" y="0.00" width="2.00" height="100.00" />
<rect x="18.00" y="0.00" width="4.00" height="100.00" />
<rect x="26.00" y="0.00" width="4.00" height="100.00" />
<rect x="34.00" y="0.00" width="2.00" height="100.00" />
<rect x="38.00" y="0.00" width="2.00" height="100.00" />
<rect x="44.00" y="0.00" width="2.00" height="100.00" />
<rect x="50.00" y="0.00" width="4.00" height="100.00" />
<text x="34.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 969 B

View File

@ -0,0 +1,32 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="118" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="118" height="118" fill="#FFFFFF" />
<rect x="14.00" y="0.00" width="2.00" height="100.00" />
<rect x="18.00" y="0.00" width="4.00" height="100.00" />
<rect x="24.00" y="0.00" width="4.00" height="100.00" />
<rect x="32.00" y="0.00" width="4.00" height="100.00" />
<rect x="38.00" y="0.00" width="2.00" height="100.00" />
<rect x="44.00" y="0.00" width="2.00" height="100.00" />
<rect x="50.00" y="0.00" width="4.00" height="100.00" />
<rect x="56.00" y="0.00" width="2.00" height="100.00" />
<rect x="60.00" y="0.00" width="2.00" height="100.00" />
<rect x="70.00" y="0.00" width="2.00" height="100.00" />
<rect x="74.00" y="0.00" width="2.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="86.00" y="0.00" width="4.00" height="100.00" />
<rect x="92.00" y="0.00" width="2.00" height="100.00" />
<rect x="96.00" y="0.00" width="4.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<text x="61.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,53 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="216" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="216" height="118" fill="#FFFFFF" />
<rect x="14.00" y="0.00" width="2.00" height="110.00" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="24.00" y="0.00" width="4.00" height="100.00" />
<rect x="32.00" y="0.00" width="2.00" height="100.00" />
<rect x="38.00" y="0.00" width="2.00" height="100.00" />
<rect x="44.00" y="0.00" width="4.00" height="100.00" />
<rect x="50.00" y="0.00" width="8.00" height="100.00" />
<rect x="60.00" y="0.00" width="2.00" height="100.00" />
<rect x="64.00" y="0.00" width="2.00" height="100.00" />
<rect x="72.00" y="0.00" width="4.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="110.00" />
<rect x="82.00" y="0.00" width="2.00" height="110.00" />
<rect x="86.00" y="0.00" width="2.00" height="100.00" />
<rect x="92.00" y="0.00" width="6.00" height="100.00" />
<rect x="100.00" y="0.00" width="2.00" height="100.00" />
<rect x="104.00" y="0.00" width="2.00" height="100.00" />
<rect x="114.00" y="0.00" width="2.00" height="100.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="128.00" y="0.00" width="6.00" height="100.00" />
<rect x="138.00" y="0.00" width="2.00" height="100.00" />
<rect x="142.00" y="0.00" width="2.00" height="110.00" />
<rect x="146.00" y="0.00" width="2.00" height="110.00" />
<rect x="162.00" y="20.00" width="2.00" height="90.00" />
<rect x="166.00" y="20.00" width="4.00" height="90.00" />
<rect x="174.00" y="20.00" width="4.00" height="90.00" />
<rect x="182.00" y="20.00" width="2.00" height="90.00" />
<rect x="186.00" y="20.00" width="2.00" height="90.00" />
<rect x="192.00" y="20.00" width="2.00" height="90.00" />
<rect x="198.00" y="20.00" width="4.00" height="90.00" />
<text x="48.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
1234
</text>
<text x="114.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
5670
</text>
<text x="182.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,62 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="270" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="270" height="118" fill="#FFFFFF" />
<rect x="14.00" y="0.00" width="2.00" height="110.00" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="24.00" y="0.00" width="4.00" height="100.00" />
<rect x="32.00" y="0.00" width="2.00" height="100.00" />
<rect x="38.00" y="0.00" width="2.00" height="100.00" />
<rect x="44.00" y="0.00" width="4.00" height="100.00" />
<rect x="50.00" y="0.00" width="8.00" height="100.00" />
<rect x="60.00" y="0.00" width="2.00" height="100.00" />
<rect x="64.00" y="0.00" width="2.00" height="100.00" />
<rect x="72.00" y="0.00" width="4.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="110.00" />
<rect x="82.00" y="0.00" width="2.00" height="110.00" />
<rect x="86.00" y="0.00" width="2.00" height="100.00" />
<rect x="92.00" y="0.00" width="6.00" height="100.00" />
<rect x="100.00" y="0.00" width="2.00" height="100.00" />
<rect x="104.00" y="0.00" width="2.00" height="100.00" />
<rect x="114.00" y="0.00" width="2.00" height="100.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="128.00" y="0.00" width="6.00" height="100.00" />
<rect x="138.00" y="0.00" width="2.00" height="100.00" />
<rect x="142.00" y="0.00" width="2.00" height="110.00" />
<rect x="146.00" y="0.00" width="2.00" height="110.00" />
<rect x="162.00" y="20.00" width="2.00" height="90.00" />
<rect x="166.00" y="20.00" width="4.00" height="90.00" />
<rect x="172.00" y="20.00" width="4.00" height="90.00" />
<rect x="180.00" y="20.00" width="4.00" height="90.00" />
<rect x="186.00" y="20.00" width="2.00" height="90.00" />
<rect x="192.00" y="20.00" width="2.00" height="90.00" />
<rect x="198.00" y="20.00" width="4.00" height="90.00" />
<rect x="204.00" y="20.00" width="2.00" height="90.00" />
<rect x="208.00" y="20.00" width="2.00" height="90.00" />
<rect x="218.00" y="20.00" width="2.00" height="90.00" />
<rect x="222.00" y="20.00" width="2.00" height="90.00" />
<rect x="226.00" y="20.00" width="2.00" height="90.00" />
<rect x="234.00" y="20.00" width="4.00" height="90.00" />
<rect x="240.00" y="20.00" width="2.00" height="90.00" />
<rect x="244.00" y="20.00" width="4.00" height="90.00" />
<rect x="254.00" y="20.00" width="2.00" height="90.00" />
<text x="48.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
1234
</text>
<text x="114.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
5670
</text>
<text x="210.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -0,0 +1,69 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="276" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="276" height="118" fill="#FFFFFF" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="30.00" y="0.00" width="4.00" height="110.00" />
<rect x="36.00" y="0.00" width="2.00" height="110.00" />
<rect x="42.00" y="0.00" width="4.00" height="100.00" />
<rect x="50.00" y="0.00" width="2.00" height="100.00" />
<rect x="56.00" y="0.00" width="2.00" height="100.00" />
<rect x="62.00" y="0.00" width="4.00" height="100.00" />
<rect x="68.00" y="0.00" width="8.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="82.00" y="0.00" width="2.00" height="100.00" />
<rect x="90.00" y="0.00" width="4.00" height="100.00" />
<rect x="96.00" y="0.00" width="4.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<rect x="110.00" y="0.00" width="2.00" height="110.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="100.00" />
<rect x="122.00" y="0.00" width="2.00" height="100.00" />
<rect x="132.00" y="0.00" width="2.00" height="100.00" />
<rect x="140.00" y="0.00" width="2.00" height="100.00" />
<rect x="146.00" y="0.00" width="2.00" height="100.00" />
<rect x="152.00" y="0.00" width="2.00" height="100.00" />
<rect x="160.00" y="0.00" width="6.00" height="100.00" />
<rect x="168.00" y="0.00" width="2.00" height="100.00" />
<rect x="174.00" y="0.00" width="6.00" height="100.00" />
<rect x="184.00" y="0.00" width="2.00" height="100.00" />
<rect x="188.00" y="0.00" width="2.00" height="110.00" />
<rect x="194.00" y="0.00" width="6.00" height="110.00" />
<rect x="202.00" y="0.00" width="2.00" height="110.00" />
<rect x="206.00" y="0.00" width="2.00" height="110.00" />
<rect x="226.00" y="20.00" width="2.00" height="80.00" />
<rect x="230.00" y="20.00" width="4.00" height="80.00" />
<rect x="238.00" y="20.00" width="2.00" height="80.00" />
<rect x="244.00" y="20.00" width="4.00" height="80.00" />
<rect x="250.00" y="20.00" width="2.00" height="80.00" />
<rect x="254.00" y="20.00" width="2.00" height="80.00" />
<rect x="262.00" y="20.00" width="4.00" height="80.00" />
<text x="8.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
0
</text>
<text x="72.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
<text x="154.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
67890
</text>
<text x="218.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
5
</text>
<text x="250.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
24
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -0,0 +1,78 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="330" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="330" height="118" fill="#FFFFFF" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="26.00" y="0.00" width="2.00" height="110.00" />
<rect x="30.00" y="0.00" width="8.00" height="110.00" />
<rect x="42.00" y="0.00" width="4.00" height="100.00" />
<rect x="50.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="62.00" y="0.00" width="4.00" height="100.00" />
<rect x="70.00" y="0.00" width="4.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="82.00" y="0.00" width="2.00" height="100.00" />
<rect x="90.00" y="0.00" width="4.00" height="100.00" />
<rect x="98.00" y="0.00" width="4.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<rect x="110.00" y="0.00" width="2.00" height="110.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="4.00" height="100.00" />
<rect x="124.00" y="0.00" width="4.00" height="100.00" />
<rect x="132.00" y="0.00" width="2.00" height="100.00" />
<rect x="142.00" y="0.00" width="2.00" height="100.00" />
<rect x="146.00" y="0.00" width="2.00" height="100.00" />
<rect x="150.00" y="0.00" width="6.00" height="100.00" />
<rect x="160.00" y="0.00" width="2.00" height="100.00" />
<rect x="164.00" y="0.00" width="6.00" height="100.00" />
<rect x="174.00" y="0.00" width="4.00" height="100.00" />
<rect x="182.00" y="0.00" width="4.00" height="100.00" />
<rect x="188.00" y="0.00" width="2.00" height="110.00" />
<rect x="196.00" y="0.00" width="2.00" height="110.00" />
<rect x="202.00" y="0.00" width="2.00" height="110.00" />
<rect x="206.00" y="0.00" width="2.00" height="110.00" />
<rect x="226.00" y="20.00" width="2.00" height="80.00" />
<rect x="230.00" y="20.00" width="4.00" height="80.00" />
<rect x="236.00" y="20.00" width="4.00" height="80.00" />
<rect x="244.00" y="20.00" width="4.00" height="80.00" />
<rect x="250.00" y="20.00" width="2.00" height="80.00" />
<rect x="256.00" y="20.00" width="2.00" height="80.00" />
<rect x="262.00" y="20.00" width="4.00" height="80.00" />
<rect x="268.00" y="20.00" width="2.00" height="80.00" />
<rect x="272.00" y="20.00" width="2.00" height="80.00" />
<rect x="282.00" y="20.00" width="2.00" height="80.00" />
<rect x="286.00" y="20.00" width="2.00" height="80.00" />
<rect x="290.00" y="20.00" width="2.00" height="80.00" />
<rect x="298.00" y="20.00" width="4.00" height="80.00" />
<rect x="304.00" y="20.00" width="2.00" height="80.00" />
<rect x="308.00" y="20.00" width="4.00" height="80.00" />
<rect x="318.00" y="20.00" width="2.00" height="80.00" />
<text x="8.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
6
</text>
<text x="72.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
14141
</text>
<text x="154.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
23441
</text>
<text x="218.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
7
</text>
<text x="278.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,52 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="184" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="184" height="118" fill="#FFFFFF" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="28.00" y="0.00" width="2.00" height="100.00" />
<rect x="34.00" y="0.00" width="4.00" height="100.00" />
<rect x="40.00" y="0.00" width="8.00" height="100.00" />
<rect x="50.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="62.00" y="0.00" width="4.00" height="100.00" />
<rect x="68.00" y="0.00" width="6.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="88.00" y="0.00" width="2.00" height="100.00" />
<rect x="92.00" y="0.00" width="2.00" height="100.00" />
<rect x="98.00" y="0.00" width="2.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<rect x="110.00" y="0.00" width="2.00" height="110.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="110.00" />
<rect x="134.00" y="20.00" width="2.00" height="80.00" />
<rect x="138.00" y="20.00" width="4.00" height="80.00" />
<rect x="146.00" y="20.00" width="4.00" height="80.00" />
<rect x="154.00" y="20.00" width="2.00" height="80.00" />
<rect x="158.00" y="20.00" width="2.00" height="80.00" />
<rect x="164.00" y="20.00" width="2.00" height="80.00" />
<rect x="170.00" y="20.00" width="4.00" height="80.00" />
<text x="8.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
1
</text>
<text x="66.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
234567
</text>
<text x="128.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
0
</text>
<text x="154.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,61 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="238" height="118" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="238" height="118" fill="#FFFFFF" />
<rect x="18.00" y="0.00" width="2.00" height="110.00" />
<rect x="22.00" y="0.00" width="2.00" height="110.00" />
<rect x="28.00" y="0.00" width="2.00" height="100.00" />
<rect x="34.00" y="0.00" width="4.00" height="100.00" />
<rect x="40.00" y="0.00" width="8.00" height="100.00" />
<rect x="50.00" y="0.00" width="2.00" height="100.00" />
<rect x="54.00" y="0.00" width="2.00" height="100.00" />
<rect x="62.00" y="0.00" width="4.00" height="100.00" />
<rect x="68.00" y="0.00" width="6.00" height="100.00" />
<rect x="78.00" y="0.00" width="2.00" height="100.00" />
<rect x="88.00" y="0.00" width="2.00" height="100.00" />
<rect x="92.00" y="0.00" width="2.00" height="100.00" />
<rect x="98.00" y="0.00" width="2.00" height="100.00" />
<rect x="106.00" y="0.00" width="2.00" height="100.00" />
<rect x="110.00" y="0.00" width="2.00" height="110.00" />
<rect x="114.00" y="0.00" width="2.00" height="110.00" />
<rect x="118.00" y="0.00" width="2.00" height="110.00" />
<rect x="134.00" y="20.00" width="2.00" height="80.00" />
<rect x="138.00" y="20.00" width="4.00" height="80.00" />
<rect x="144.00" y="20.00" width="4.00" height="80.00" />
<rect x="152.00" y="20.00" width="4.00" height="80.00" />
<rect x="158.00" y="20.00" width="2.00" height="80.00" />
<rect x="164.00" y="20.00" width="2.00" height="80.00" />
<rect x="170.00" y="20.00" width="4.00" height="80.00" />
<rect x="176.00" y="20.00" width="2.00" height="80.00" />
<rect x="180.00" y="20.00" width="2.00" height="80.00" />
<rect x="190.00" y="20.00" width="2.00" height="80.00" />
<rect x="194.00" y="20.00" width="2.00" height="80.00" />
<rect x="198.00" y="20.00" width="2.00" height="80.00" />
<rect x="206.00" y="20.00" width="4.00" height="80.00" />
<rect x="212.00" y="20.00" width="2.00" height="80.00" />
<rect x="216.00" y="20.00" width="4.00" height="80.00" />
<rect x="226.00" y="20.00" width="2.00" height="80.00" />
<text x="8.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
1
</text>
<text x="66.00" y="118.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
234567
</text>
<text x="128.00" y="114.00" text-anchor="middle"
font-family="Helvetica" font-size="16.0" fill="#000000" >
0
</text>
<text x="182.00" y="16.00" text-anchor="middle"
font-family="Helvetica" font-size="22.0" fill="#000000" >
12345
</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -193,6 +193,8 @@ static void test_encode(int index, int generate, int debug) {
testStart(""); testStart("");
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise
int ret; int ret;
struct item { struct item {
int symbology; int symbology;
@ -206,37 +208,37 @@ static void test_encode(int index, int generate, int debug) {
}; };
// BARCODE_ITF14 examples verified manually against GS1 General Specifications 20.0 // BARCODE_ITF14 examples verified manually against GS1 General Specifications 20.0
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_C25MATRIX, "87654321", 0, 1, 97, "Standard Code 2 of 5; verified manually against bwipp and tec-it", /* 0*/ { BARCODE_C25MATRIX, "87654321", 0, 1, 97, "Standard Code 2 of 5; note zint uses 4X start/end wides while BWIPP uses 3X",
"1111010101110100010101000111010001110101110111010101110111011100010101000101110111010111011110101" "1111010101110100010101000111010001110101110111010101110111011100010101000101110111010111011110101"
}, },
/* 1*/ { BARCODE_C25INTER, "87654321", 0, 1, 81, "Interleaved Code 2 of 5; verified manually against bwipp and tec-it", /* 1*/ { BARCODE_C25INTER, "87654321", 0, 1, 81, "Interleaved Code 2 of 5; verified manually against tec-it",
"101011101010111000100010001110111000101010001000111010111010001110101011100011101" "101011101010111000100010001110111000101010001000111010111010001110101011100011101"
}, },
/* 2*/ { BARCODE_C25INTER, "602003", 0, 1, 63, "DX cartridge barcode https://en.wikipedia.org/wiki/Interleaved_2_of_5 example", /* 2*/ { BARCODE_C25INTER, "602003", 0, 1, 63, "DX cartridge barcode https://en.wikipedia.org/wiki/Interleaved_2_of_5 example",
"101010111011100010001010111010001000111010001000111011101011101" "101010111011100010001010111010001000111010001000111011101011101"
}, },
/* 3*/ { BARCODE_C25IATA, "87654321", 0, 1, 121, "IATA Code 2 of 5; verified manually against bwipp and tec-it", /* 3*/ { BARCODE_C25IATA, "87654321", 0, 1, 121, "IATA Code 2 of 5; verified manually against tec-it",
"1010111010101110101010101110111010111011101010111010111010101010111010111011101110101010101110101011101110101010111011101" "1010111010101110101010101110111010111011101010111010111010101010111010111011101110101010101110101011101110101010111011101"
}, },
/* 4*/ { BARCODE_C25LOGIC, "87654321", 0, 1, 89, "Code 2 of 5 Data Logic; verified manually against bwipp and tec-it", /* 4*/ { BARCODE_C25LOGIC, "87654321", 0, 1, 89, "Code 2 of 5 Data Logic; verified manually against tec-it",
"10101110100010101000111010001110101110111010101110111011100010101000101110111010111011101" "10101110100010101000111010001110101110111010101110111011100010101000101110111010111011101"
}, },
/* 5*/ { BARCODE_C25IND, "87654321", 0, 1, 131, "Industrial Code 2 of 5; verified manually against bwipp and tec-it", /* 5*/ { BARCODE_C25IND, "87654321", 0, 1, 131, "Industrial Code 2 of 5; verified manually against tec-it",
"11101110101110101011101010101011101110101110111010101110101110101010101110101110111011101010101011101010111011101010101110111010111" "11101110101110101011101010101011101110101110111010101110101110101010101110101110111011101010101011101010111011101010101110111010111"
}, },
/* 6*/ { BARCODE_DPLEIT, "87654321", 0, 1, 135, "Deutsche Post Leitcode; verified manually against bwipp and tec-it (0000087654321)", /* 6*/ { BARCODE_DPLEIT, "0000087654321", 0, 1, 135, "Deutsche Post Leitcode; verified manually against tec-it",
"101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101" "101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101"
}, },
/* 7*/ { BARCODE_DPLEIT, "5082300702800", 0, 1, 135, "Deutsche Post Leitcode https://de.wikipedia.org/wiki/Leitcode example", /* 7*/ { BARCODE_DPLEIT, "5082300702800", 0, 1, 135, "Deutsche Post Leitcode https://de.wikipedia.org/wiki/Leitcode example",
"101011101011100010001011101000101110100011101110100010001010101110111000100010100011101110100011101010001110001010001011100011101011101" "101011101011100010001011101000101110100011101110100010001010101110111000100010100011101110100011101010001110001010001011100011101011101"
}, },
/* 8*/ { BARCODE_DPIDENT, "87654321", 0, 1, 117, "Deutsche Post Identcode; verified manually against bwipp and tec-it (00087654321)", /* 8*/ { BARCODE_DPIDENT, "00087654321", 0, 1, 117, "Deutsche Post Identcode; verified manually against tec-it",
"101010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101" "101010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000100010111011101"
}, },
/* 9*/ { BARCODE_DPIDENT, "39601313414", 0, 1, 117, "Deutsche Post Identcode https://de.wikipedia.org/wiki/Leitcode example", /* 9*/ { BARCODE_DPIDENT, "39601313414", 0, 1, 117, "Deutsche Post Identcode https://de.wikipedia.org/wiki/Leitcode example",
"101011101110001010001010111011100010001011100010001010111011100010001010111010001011101011100010101110001000111011101" "101011101110001010001010111011100010001011100010001010111011100010001010111010001011101011100010101110001000111011101"
}, },
/* 10*/ { BARCODE_ITF14, "87654321", 0, 1, 135, "ITF-14; verified manually against bwipp and tec-it (0000087654321)", /* 10*/ { BARCODE_ITF14, "0000087654321", 0, 1, 135, "ITF-14; verified manually against tec-it",
"101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000101011100011101" "101010101110001110001010101110001110001010001011101110001010100010001110111011101011100010100011101110001010100011101000101011100011101"
}, },
/* 11*/ { BARCODE_ITF14, "0950110153000", 0, 1, 135, "GS1 General Specifications Figure 5.1-2", /* 11*/ { BARCODE_ITF14, "0950110153000", 0, 1, 135, "GS1 General Specifications Figure 5.1-2",
@ -252,6 +254,8 @@ static void test_encode(int index, int generate, int debug) {
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
char escaped[1024]; char escaped[1024];
char bwipp_buf[4096];
char bwipp_msg[1024];
for (int i = 0; i < data_size; i++) { for (int i = 0; i < data_size; i++) {
@ -281,6 +285,15 @@ static void test_encode(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
} }
if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) {
ret = testUtilBwipp(symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
}
} }
} }

View File

@ -432,7 +432,7 @@ static void test_encode(int index, int generate, int debug) {
if (generate) { if (generate) {
printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n", printf(" /*%3d*/ { %s, %d, %d, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), i, testUtilBarcodeName(data[i].symbology), data[i].option_1, data[i].option_2, testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->rows, data[i].bwipp_cmp, symbol->width, data[i].comment); testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
testUtilModulesDump(symbol, " ", "\n"); testUtilModulesDump(symbol, " ", "\n");
printf(" },\n"); printf(" },\n");
} else { } else {
@ -448,7 +448,7 @@ static void test_encode(int index, int generate, int debug) {
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, data[i].option_2, -1, debug)) { if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, data[i].option_2, -1, debug)) {
if (!data[i].bwipp_cmp) { if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s skipped, not BWIPP compatible\n", i, testUtilBarcodeName(symbol->symbology)); if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else { } else {
ret = testUtilBwipp(symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); ret = testUtilBwipp(symbol, data[i].option_1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);

View File

@ -443,99 +443,127 @@ static void test_encode(int index, int generate, int debug) {
int expected_rows; int expected_rows;
int expected_width; int expected_width;
int bwipp_cmp;
char *comment; char *comment;
char *expected; char *expected;
}; };
// BARCODE_EAN128 examples verified manually against GS1 General Specifications 20.0 // BARCODE_EAN128 examples verified manually against GS1 General Specifications 20.0 (GGS)
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODE128, UNICODE_MODE, "AIM", 0, 1, 68, "ISO/IEC 15417:2007 Figure 1", /* 0*/ { BARCODE_CODE128, UNICODE_MODE, "AIM", 0, 1, 68, 1, "ISO/IEC 15417:2007 Figure 1",
"11010010000101000110001100010001010111011000101110110001100011101011" "11010010000101000110001100010001010111011000101110110001100011101011"
}, },
/* 1*/ { BARCODE_CODE128B, UNICODE_MODE, "AIM", 0, 1, 68, "128B same", /* 1*/ { BARCODE_CODE128B, UNICODE_MODE, "AIM", 0, 1, 68, 1, "128B same",
"11010010000101000110001100010001010111011000101110110001100011101011" "11010010000101000110001100010001010111011000101110110001100011101011"
}, },
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, "1234567890", 0, 1, 90, "", /* 2*/ { BARCODE_CODE128, UNICODE_MODE, "1234567890", 0, 1, 90, 1, "",
"110100111001011001110010001011000111000101101100001010011011110110100111100101100011101011" "110100111001011001110010001011000111000101101100001010011011110110100111100101100011101011"
}, },
/* 3*/ { BARCODE_CODE128B, UNICODE_MODE, "1234567890", 0, 1, 145, "", /* 3*/ { BARCODE_CODE128B, UNICODE_MODE, "1234567890", 0, 1, 145, 1, "",
"1101001000010011100110110011100101100101110011001001110110111001001100111010011101101110111010011001110010110010011101100101000110001100011101011" "1101001000010011100110110011100101100101110011001001110110111001001100111010011101101110111010011001110010110010011101100101000110001100011101011"
}, },
/* 4*/ { BARCODE_EAN128, GS1_MODE, "[8018]950110153123456781", 0, 1, 167, "GS1 General Specifications Figure 2.5.2-1", /* 4*/ { BARCODE_EAN128, GS1_MODE, "[8018]950110153123456781", 0, 1, 167, 1, "GGS Figure 2.5.2-1",
"11010011100111101011101010011110011001110010101111010001100110110011001000100101110011001101100011011101101110101110110001000010110010010111100101111001001100011101011" "11010011100111101011101010011110011001110010101111010001100110110011001000100101110011001101100011011101101110101110110001000010110010010111100101111001001100011101011"
}, },
/* 5*/ { BARCODE_EAN128, GS1_MODE, "[415]5412345678908[3911]710125", 0, 1, 189, "GS1 General Specifications Figure 2.6.6-1 top", /* 5*/ { BARCODE_EAN128, GS1_MODE, "[415]5412345678908[3911]710125", 0, 1, 189, 1, "GGS Figure 2.6.6-1 top",
"110100111001111010111011000100010111010001101100010001011101101110101110110001000010110011011011110100011001001101000100011000100100100110100001100110110011100101100100001001101100011101011" "110100111001111010111011000100010111010001101100010001011101101110101110110001000010110011011011110100011001001101000100011000100100100110100001100110110011100101100100001001101100011101011"
}, },
/* 6*/ { BARCODE_EAN128, GS1_MODE, "[12]010425[8020]ABC123", 0, 1, 189, "GS1 General Specifications Figure 2.6.6-1 bottom", /* 6*/ { BARCODE_EAN128, GS1_MODE, "[12]010425[8020]ABC123", 0, 1, 189, 1, "GGS Figure 2.6.6-1 bottom",
"110100111001111010111010110011100110011011001001000110011100101100101001111001100100111010111101110101000110001000101100010001000110100111001101100111001011001011100110010111001100011101011" "110100111001111010111010110011100110011011001001000110011100101100101001111001100100111010111101110101000110001000101100010001000110100111001101100111001011001011100110010111001100011101011"
}, },
/* 7*/ { BARCODE_EAN128, GS1_MODE, "[253]950110153005812345678901", 0, 1, 211, "GS1 General Specifications Figure 2.6.9-1", /* 7*/ { BARCODE_EAN128, GS1_MODE, "[253]950110153005812345678901", 0, 1, 211, 1, "GGS Figure 2.6.9-1",
"1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001110110001010110011100100010110001110001011011000010100110111101101011110111010011100110101110110001100011101011" "1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001110110001010110011100100010110001110001011011000010100110111101101011110111010011100110101110110001100011101011"
}, },
/* 8*/ { BARCODE_EAN128, GS1_MODE, "[253]950110153006567890543210987", 0, 1, 211, "GS1 General Specifications Figure 2.6.9-2", /* 8*/ { BARCODE_EAN128, GS1_MODE, "[253]950110153006567890543210987", 0, 1, 211, 1, "GGS Figure 2.6.9-2",
"1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001001011000010000101100110110111101000100110010110001110110111001001100100100011110010100101110011001100011101011" "1101001110011110101110111001011001101000100011000101110110001001001100110110011011101110110110011001001011000010000101100110110111101000100110010110001110110111001001100100100011110010100101110011001100011101011"
}, },
/* 9*/ { BARCODE_EAN128, GS1_MODE, "[253]95011015300657654321", 0, 1, 189, "GS1 General Specifications Figure 2.6.9-3", /* 9*/ { BARCODE_EAN128, GS1_MODE, "[253]95011015300657654321", 0, 1, 189, 1, "GGS Figure 2.6.9-3",
"110100111001111010111011100101100110100010001100010111011000100100110011011001101110111011011001100100101100001100101000011101011000110001101101011110111010011100110111001001101100011101011" "110100111001111010111011100101100110100010001100010111011000100100110011011001101110111011011001100100101100001100101000011101011000110001101101011110111010011100110111001001101100011101011"
}, },
/* 10*/ { BARCODE_EAN128, GS1_MODE, "[253]9501101530065123456", 0, 1, 167, "GS1 General Specifications Figure 2.6.9-4", /* 10*/ { BARCODE_EAN128, GS1_MODE, "[253]9501101530065123456", 0, 1, 167, 1, "GGS Figure 2.6.9-4",
"11010011100111101011101110010110011010001000110001011101100010010011001101100110111011101101100110010010110000101100111001000101100011100010110100011110101100011101011" "11010011100111101011101110010110011010001000110001011101100010010011001101100110111011101101100110010010110000101100111001000101100011100010110100011110101100011101011"
}, },
/* 11*/ { BARCODE_EAN128, GS1_MODE, "[01]10857674002017[10]1152KMB", 0, 1, 211, "GS1 General Specifications Figure 4.15.1-1", /* 11*/ { BARCODE_EAN128, GS1_MODE, "[01]10857674002017[10]1152KMB", 0, 1, 211, 1, "GGS Figure 4.15.1-1",
"1101001110011110101110110011011001100100010010011110010110010100001000011001011011001100110010011101001110011011001000100110001001001101110001010111101110101100011101011101100010001011000100111001101100011101011" "1101001110011110101110110011011001100100010010011110010110010100001000011001011011001100110010011101001110011011001000100110001001001101110001010111101110101100011101011101100010001011000100111001101100011101011"
}, },
/* 12*/ { BARCODE_EAN128, GS1_MODE, "[01]09501101530003", 0, 1, 134, "GS1 General Specifications Figure 5.1-3", /* 12*/ { BARCODE_EAN128, GS1_MODE, "[01]09501101530003", 0, 1, 134, 1, "GGS Figure 5.1-3",
"11010011100111101011101100110110011001001000110001011101100010010011001101100110111011101101100110010010011000100110100001100011101011" "11010011100111101011101100110110011001001000110001011101100010010011001101100110111011101101100110010010011000100110100001100011101011"
}, },
/* 13*/ { BARCODE_EAN128, GS1_MODE, "[00]395123451234567895", 0, 1, 156, "GS1 General Specifications Figure 5.4.2-1", /* 13*/ { BARCODE_EAN128, GS1_MODE, "[00]395123451234567895", 0, 1, 156, 1, "GGS Figure 5.4.2-1",
"110100111001111010111011011001100110100010001101110100011101101110101110110001011001110010001011000111000101101100001010010111101000101111000101100011101011" "110100111001111010111011011001100110100010001101110100011101101110101110110001011001110010001011000111000101101100001010010111101000101111000101100011101011"
}, },
/* 14*/ { BARCODE_EAN128, GS1_MODE, "[00]395011010013000129", 0, 1, 156, "GS1 General Specifications Figure 6.6.5-6", /* 14*/ { BARCODE_EAN128, GS1_MODE, "[00]006141411234567890", 0, 1, 156, 1, "GGS Figure 6.6.5-1. (and Figures 6.6.5-3 bottom, 6.6.5-4 bottom)",
"110100111001111010111011011001100110110011001100100001011000100010110001000101011001110010001011000111000101101100001010011011110110110110110001100011101011"
},
/* 15*/ { BARCODE_EAN128, GS1_MODE, "[403]402621[401]950110153B01001", 0, 1, 266, 0, "GGS Figure 6.6.5-2 top **NOT SAME**, different encodation for zint, BWIPP & standard, same codeword count",
"11010011100111101011101100010100010001011000110011001101111000101010111101110100111001101011101111011110101110110001010001100101110011000101110110001001001100110110011011101110101111011101000101100010011101100101110111101100100010011001101100101001111001100011101011"
},
/* 16*/ { BARCODE_EAN128, GS1_MODE, "[00]395011015300000011", 0, 1, 156, 1, "GGS Figure 6.6.5-2 bottom",
"110100111001111010111011011001100110100010001100010111011000100100110011011001101110111011011001100110110011001101100110011000100100100011101101100011101011"
},
/* 17*/ { BARCODE_EAN128, GS1_MODE, "[420]45458", 0, 1, 90, 1, "GGS Figure 6.6.5-3 top",
"110100111001111010111010110111000100100011001110101100011101100010111100100101100011101011"
},
/* 18*/ { BARCODE_EAN128, GS1_MODE, "[02]00614141000418[15]210228[10]451214[37]20", 0, 1, 255, 1, "GGS Figure 6.6.5-4 top",
"110100111001111010111011001100110110110011001100100001011000100010110001000101101100110010010001100110011100101011100110011011100100110011001101110011010011001000100101110110001011001110010011001110111101011101000110100011001001110100011110101100011101011"
},
/* 19*/ { BARCODE_EAN128, GS1_MODE, "[420]87109", 0, 1, 90, 1, "GGS Figure 6.6.5-5 top",
"110100111001111010111010110111000100011001001001101000011001001000111001001101100011101011"
},
/* 20*/ { BARCODE_EAN128, GS1_MODE, "[90]1528", 0, 1, 79, 1, "GGS Figure 6.6.5-5 middle",
"1101001110011110101110110111101101011100110011100110100111001100101100011101011"
},
/* 21*/ { BARCODE_EAN128, GS1_MODE, "[00]000521775138957172", 0, 1, 156, 1, "GGS Figure 6.6.5-5 bottom",
"110100111001111010111011011001100110110011001000100110011011100100111101110101101110100010001100010101111010001001101000010011000010110011011001100011101011"
},
/* 22*/ { BARCODE_EAN128, GS1_MODE, "[00]395011010013000129", 0, 1, 156, 1, "GGS Figure 6.6.5-6",
"110100111001111010111011011001100110100010001100010111011000100100110011011001101100110010011011100110110011001100110110011100110010111101101101100011101011" "110100111001111010111011011001100110100010001100010111011000100100110011011001101100110010011011100110110011001100110110011100110010111101101101100011101011"
}, },
/* 15*/ { BARCODE_EAN128, GS1_MODE, "[401]931234518430GR", 0, 1, 167, "GS1 General Specifications Figure 6.6.5-7 top", /* 23*/ { BARCODE_EAN128, GS1_MODE, "[00]395011010013000129", 0, 1, 156, 1, "GGS Figure 6.6.5-6",
"110100111001111010111011011001100110100010001100010111011000100100110011011001101100110010011011100110110011001100110110011100110010111101101101100011101011"
},
/* 24*/ { BARCODE_EAN128, GS1_MODE, "[401]931234518430GR", 0, 1, 167, 1, "GGS Figure 6.6.5-7 top",
"11010011100111101011101100010100011001011100110110001101110110111010111011000110011100101011000111010111101110100111011001101000100011000101110100110111001100011101011" "11010011100111101011101100010100011001011100110110001101110110111010111011000110011100101011000111010111101110100111011001101000100011000101110100110111001100011101011"
}, },
/* 16*/ { BARCODE_EAN128, GS1_MODE, "[00]093123450000000012", 0, 1, 156, "GS1 General Specifications Figure 6.6.5-7 bottom", /* 25*/ { BARCODE_EAN128, GS1_MODE, "[00]093123450000000012", 0, 1, 156, 1, "GGS Figure 6.6.5-7 bottom",
"110100111001111010111011011001100110010010001101100011011101101110101110110001101100110011011001100110110011001101100110010110011100110111010001100011101011" "110100111001111010111011011001100110010010001101100011011101101110101110110001101100110011011001100110110011001101100110010110011100110111010001100011101011"
}, },
/* 17*/ { BARCODE_EAN128, GS1_MODE, "[01]95012345678903", 0, 1, 134, "GS1 General Specifications Figure 7.8.5.1-1 1st", /* 26*/ { BARCODE_EAN128, GS1_MODE, "[01]95012345678903", 0, 1, 134, 1, "GGS Figure 7.8.5.1-1 1st",
"11010011100111101011101100110110010111101000110011011001110110111010111011000100001011001101101111010010011000110110001101100011101011" "11010011100111101011101100110110010111101000110011011001110110111010111011000100001011001101101111010010011000110110001101100011101011"
}, },
/* 18*/ { BARCODE_EAN128, GS1_MODE, "[3102]000400", 0, 1, 101, "GS1 General Specifications Figure 7.8.5.1-1 2nd", /* 27*/ { BARCODE_EAN128, GS1_MODE, "[3102]000400", 0, 1, 101, 1, "GGS Figure 7.8.5.1-1 2nd",
"11010011100111101011101101100011011001100110110110011001001000110011011001100110110111101100011101011" "11010011100111101011101101100011011001100110110110011001001000110011011001100110110111101100011101011"
}, },
/* 19*/ { BARCODE_EAN128, GS1_MODE, "[01]95012345678903[3102]000400", 0, 1, 189, "GS1 General Specifications Figure 7.8.5.1-2", /* 28*/ { BARCODE_EAN128, GS1_MODE, "[01]95012345678903[3102]000400", 0, 1, 189, 1, "GGS Figure 7.8.5.1-2",
"110100111001111010111011001101100101111010001100110110011101101110101110110001000010110011011011110100100110001101100011011001100110110110011001001000110011011001100100100110001100011101011" "110100111001111010111011001101100101111010001100110110011101101110101110110001000010110011011011110100100110001101100011011001100110110110011001001000110011011001100100100110001100011101011"
}, },
/* 20*/ { BARCODE_EAN128, GS1_MODE, "[8005]000365", 0, 1, 101, "GS1 General Specifications Figure 7.8.5.2-1 1st", /* 29*/ { BARCODE_EAN128, GS1_MODE, "[8005]000365", 0, 1, 101, 1, "GGS Figure 7.8.5.2-1 1st",
"11010011100111101011101010011110010001001100110110011001001001100010010110000100100001101100011101011" "11010011100111101011101010011110010001001100110110011001001001100010010110000100100001101100011101011"
}, },
/* 21*/ { BARCODE_EAN128, GS1_MODE, "[10]123456", 0, 1, 90, "GS1 General Specifications Figure 7.8.5.2-1 2nd", /* 30*/ { BARCODE_EAN128, GS1_MODE, "[10]123456", 0, 1, 90, 1, "GGS Figure 7.8.5.2-1 2nd",
"110100111001111010111011001000100101100111001000101100011100010110110010000101100011101011" "110100111001111010111011001000100101100111001000101100011100010110110010000101100011101011"
}, },
/* 22*/ { BARCODE_EAN128, GS1_MODE, "[8005]000365[10]123456", 0, 1, 156, "GS1 General Specifications Figure 7.8.5.2-2", /* 31*/ { BARCODE_EAN128, GS1_MODE, "[8005]000365[10]123456", 0, 1, 156, 1, "GGS Figure 7.8.5.2-2",
"110100111001111010111010100111100100010011001101100110010010011000100101100001111010111011001000100101100111001000101100011100010110101100001001100011101011" "110100111001111010111010100111100100010011001101100110010010011000100101100001111010111011001000100101100111001000101100011100010110101100001001100011101011"
}, },
/* 23*/ { BARCODE_EAN128, GS1_MODE, "[403]27653113+99000900090010", 0, 1, 222, "DHL Leitcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html", /* 32*/ { BARCODE_EAN128, GS1_MODE, "[403]27653113+99000900090010", 0, 1, 222, 1, "DHL Leitcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
"110100111001111010111011000101000110001101101100101000011011101110110001001001011110111011001011100110001001001011101111010111011110110110011001100100100011011001100110010010001101100110011001000100110001000101100011101011" "110100111001111010111011000101000110001101101100101000011011101110110001001001011110111011001011100110001001001011101111010111011110110110011001100100100011011001100110010010001101100110011001000100110001000101100011101011"
}, },
/* 24*/ { BARCODE_EAN128, GS1_MODE, "[00]340433935039756615", 0, 1, 156, "DHL Identcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html", /* 33*/ { BARCODE_EAN128, GS1_MODE, "[00]340433935039756615", 0, 1, 156, 1, "DHL Identcode https://www.dhl.de/de/geschaeftskunden/paket/information/geschaeftskunden/abrechnung/leitcodierung.html",
"110100111001111010111011011001100100010110001001000110010100011000101000111101100010111011010001000110000100101001000011010111001100100111001101100011101011" "110100111001111010111011011001100100010110001001000110010100011000101000111101100010111011010001000110000100101001000011010111001100100111001101100011101011"
}, },
/* 25*/ { BARCODE_EAN14, GS1_MODE, "4070071967072", 0, 1, 134, "Verified manually against tec-it", /* 34*/ { BARCODE_EAN14, GS1_MODE, "4070071967072", 0, 1, 134, 1, "Verified manually against tec-it",
"11010011100111101011101100110110011000101000101100001001001100010011001011100100001011001001100010011001001110110111001001100011101011" "11010011100111101011101100110110011000101000101100001001001100010011001011100100001011001001100010011001001110110111001001100011101011"
}, },
/* 26*/ { BARCODE_NVE18, GS1_MODE, "40700000071967072", 0, 1, 156, "Verified manually against tec-it", /* 35*/ { BARCODE_NVE18, GS1_MODE, "40700000071967072", 0, 1, 156, 1, "Verified manually against tec-it",
"110100111001111010111011011001100110001010001011000010011011001100110110011001001100010011001011100100001011001001100010011001001110110111011101100011101011" "110100111001111010111011011001100110001010001011000010011011001100110110011001001100010011001011100100001011001001100010011001001110110111011101100011101011"
}, },
/* 27*/ { BARCODE_HIBC_128, UNICODE_MODE, "83278F8G9H0J2G", 0, 1, 211, "ANSI/HIBC 2.6 - 2016 Section 4.1, not same, uses different encoding (eg begins StartA instead of StartB)", /* 36*/ { BARCODE_HIBC_128, UNICODE_MODE, "83278F8G9H0J2G", 0, 1, 211, 1, "ANSI/HIBC 2.6 - 2016 Section 4.1, not same, uses different encoding (eg begins StartA instead of StartB)",
"1101001000011000100100111010011001011101111011000110110110000101001011110111010001100010111010011001101000100011100101100110001010001001110110010110111000110011100101101000100010001001100111101010001100011101011" "1101001000011000100100111010011001011101111011000110110110000101001011110111010001100010111010011001101000100011100101100110001010001001110110010110111000110011100101101000100010001001100111101010001100011101011"
}, },
/* 28*/ { BARCODE_HIBC_128, UNICODE_MODE, "A123BJC5D6E71", 0, 1, 200, "ANSI/HIBC 2.6 - 2016 Figure 1, same", /* 37*/ { BARCODE_HIBC_128, UNICODE_MODE, "A123BJC5D6E71", 0, 1, 200, 1, "ANSI/HIBC 2.6 - 2016 Figure 1, same",
"11010010000110001001001010001100010011100110110011100101100101110010001011000101101110001000100011011011100100101100010001100111010010001101000111011011101001110011011010001000110001101101100011101011" "11010010000110001001001010001100010011100110110011100101100101110010001011000101101110001000100011011011100100101100010001100111010010001101000111011011101001110011011010001000110001101101100011101011"
}, },
/* 29*/ { BARCODE_HIBC_128, UNICODE_MODE, "$$52001510X3G", 0, 1, 178, "ANSI/HIBC 2.6 - 2016 Figure 5, same", /* 38*/ { BARCODE_HIBC_128, UNICODE_MODE, "$$52001510X3G", 0, 1, 178, 1, "ANSI/HIBC 2.6 - 2016 Figure 5, same",
"1101001000011000100100100100011001001000110010111011110110111000101101100110010111001100110010001001011110111011100010110110010111001101000100010110001000100011110101100011101011" "1101001000011000100100100100011001001000110010111011110110111000101101100110010111001100110010001001011110111011100010110110010111001101000100010110001000100011110101100011101011"
}, },
}; };
@ -558,9 +586,9 @@ static void test_encode(int index, int generate, int debug) {
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (generate) { if (generate) {
printf(" /*%3d*/ { %s, %s, \"%s\", %s, %d, %d, \"%s\",\n", printf(" /*%3d*/ { %s, %s, \"%s\", %s, %d, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)), i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), testUtilEscape(data[i].data, length, escaped, sizeof(escaped)),
testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].bwipp_cmp, data[i].comment);
testUtilModulesDump(symbol, " ", "\n"); testUtilModulesDump(symbol, " ", "\n");
printf(" },\n"); printf(" },\n");
} else { } else {
@ -575,12 +603,16 @@ static void test_encode(int index, int generate, int debug) {
} }
if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) { if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, -1, -1, debug)) {
ret = testUtilBwipp(symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf)); if (!data[i].bwipp_cmp) {
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else {
ret = testUtilBwipp(symbol, -1, -1, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected); ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n", assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected); i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
}
} }
} }
} }

View File

@ -55,22 +55,22 @@ static void test_eanx_leading_zeroes(int index, int debug) {
/* 5*/ { BARCODE_EANX_CC, "123456", "[21]A12345678", 0, 8, 72 }, /* 5*/ { BARCODE_EANX_CC, "123456", "[21]A12345678", 0, 8, 72 },
/* 6*/ { BARCODE_EANX_CC, "1234567", "[21]A12345678", 0, 8, 72 }, /* 6*/ { BARCODE_EANX_CC, "1234567", "[21]A12345678", 0, 8, 72 },
/* 7*/ { BARCODE_EANX_CC, "12345678", "[21]A12345678", 0, 7, 99 }, // EAN-13 /* 7*/ { BARCODE_EANX_CC, "12345678", "[21]A12345678", 0, 7, 99 }, // EAN-13
/* 8*/ { BARCODE_EANX_CC, "1+12", "[21]A12345678", 0, 8, 101 }, // EAN-8 + EAN-2 /* 8*/ { BARCODE_EANX_CC, "1+12", "[21]A12345678", 0, 8, 99 }, // EAN-8 + EAN-2
/* 9*/ { BARCODE_EANX_CC, "12+12", "[21]A12345678", 0, 8, 101 }, /* 9*/ { BARCODE_EANX_CC, "12+12", "[21]A12345678", 0, 8, 99 },
/*10*/ { BARCODE_EANX_CC, "123+12", "[21]A12345678", 0, 8, 101 }, /*10*/ { BARCODE_EANX_CC, "123+12", "[21]A12345678", 0, 8, 99 },
/*11*/ { BARCODE_EANX_CC, "1234+12", "[21]A12345678", 0, 8, 101 }, /*11*/ { BARCODE_EANX_CC, "1234+12", "[21]A12345678", 0, 8, 99 },
/*12*/ { BARCODE_EANX_CC, "12345+12", "[21]A12345678", 0, 8, 101 }, /*12*/ { BARCODE_EANX_CC, "12345+12", "[21]A12345678", 0, 8, 99 },
/*13*/ { BARCODE_EANX_CC, "123456+12", "[21]A12345678", 0, 8, 101 }, /*13*/ { BARCODE_EANX_CC, "123456+12", "[21]A12345678", 0, 8, 99 },
/*14*/ { BARCODE_EANX_CC, "1234567+12", "[21]A12345678", 0, 8, 101 }, /*14*/ { BARCODE_EANX_CC, "1234567+12", "[21]A12345678", 0, 8, 99 },
/*15*/ { BARCODE_EANX_CC, "12345678+12", "[21]A12345678", 0, 7, 128 }, // EAN-13 + EAN-2 /*15*/ { BARCODE_EANX_CC, "12345678+12", "[21]A12345678", 0, 7, 126 }, // EAN-13 + EAN-2
/*16*/ { BARCODE_EANX_CC, "1+123", "[21]A12345678", 0, 8, 128 }, // EAN-8 + EAN-5 /*16*/ { BARCODE_EANX_CC, "1+123", "[21]A12345678", 0, 8, 126 }, // EAN-8 + EAN-5
/*17*/ { BARCODE_EANX_CC, "12+123", "[21]A12345678", 0, 8, 128 }, /*17*/ { BARCODE_EANX_CC, "12+123", "[21]A12345678", 0, 8, 126 },
/*18*/ { BARCODE_EANX_CC, "123+123", "[21]A12345678", 0, 8, 128 }, /*18*/ { BARCODE_EANX_CC, "123+123", "[21]A12345678", 0, 8, 126 },
/*19*/ { BARCODE_EANX_CC, "1234+123", "[21]A12345678", 0, 8, 128 }, /*19*/ { BARCODE_EANX_CC, "1234+123", "[21]A12345678", 0, 8, 126 },
/*20*/ { BARCODE_EANX_CC, "12345+123", "[21]A12345678", 0, 8, 128 }, /*20*/ { BARCODE_EANX_CC, "12345+123", "[21]A12345678", 0, 8, 126 },
/*21*/ { BARCODE_EANX_CC, "123456+123", "[21]A12345678", 0, 8, 128 }, /*21*/ { BARCODE_EANX_CC, "123456+123", "[21]A12345678", 0, 8, 126 },
/*22*/ { BARCODE_EANX_CC, "1234567+123", "[21]A12345678", 0, 8, 128 }, /*22*/ { BARCODE_EANX_CC, "1234567+123", "[21]A12345678", 0, 8, 126 },
/*23*/ { BARCODE_EANX_CC, "12345678+123", "[21]A12345678", 0, 7, 155 }, // EAN-13 + EAN-5 /*23*/ { BARCODE_EANX_CC, "12345678+123", "[21]A12345678", 0, 7, 153 }, // EAN-13 + EAN-5
}; };
int data_size = sizeof(data) / sizeof(struct item); int data_size = sizeof(data) / sizeof(struct item);
@ -1129,6 +1129,93 @@ static void test_examples(int index, int generate, int debug) {
"000000000101100011000010100010011001001101001100011011101001110001110100100111101011001000010010100110001100100111001010000100010111001000100111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "000000000101100011000010100010011001001101001100011011101001110001110100100111101011001000010010100110001100100111001010000100010111001000100111000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
"000000011010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110101111011101000110111011000111010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" "000000011010011100111101011101100110110010110011100100010110001110001011011000010100110111101101011001110011011000110101111011101000110111011000111010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}, },
/*56*/ { BARCODE_EANX_CC, 1, "123456789012+12", "[91]123456789012345678901", 0, 8, 126, "Example of EAN-13 with 2-digit addon, CC-A 4 cols, 4 rows",
"110100100011110011010011100101110111000100001001000110101110111001000001100000100110111011101100101000000000000000000000000000"
"110101100011101011001000000110011110101111101001000010110010111101100001100100111000001011001100101000000000000000000000000000"
"110101110011101011111010000111111001101110101011000010111110101111001101001101001110000011011100101000000000000000000000000000"
"110101111010001100110000100100001011100011101011100010100011100111000101101000100011000011011110101000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000"
"001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000"
"000101001001101111010011101011000100001010010001010101001000111010011100101100110110110010010001010000000101100110010100100110"
},
/*57*/ { BARCODE_EANX_CC, 1, "123456789012+54321", "[91]1234567890", 0, 7, 153, "Example of EAN-13 with 5-digit addon, CC-B 4 cols, 3 rows",
"110110111011110011010011100101110111000100001001110100101110111001000001100000100110111011011000101000000000000000000000000000000000000000000000000000000"
"110110110011111101010011100111110001001001101001100100110100011100010001001011111100111011001000101000000000000000000000000000000000000000000000000000000"
"110110100010100000101111000111001111001011101001100110110011111010010001001111101101000011101000101000000000000000000000000000000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"000101001001101111010011101011000100001010010001010101001000111010011100101100110110110010010001010000000101101110010101000110101000010100100110100110010"
},
/*58*/ { BARCODE_UPCA_CC, 1, "12345678901+12", "[91]123456789", 0, 7, 128, "Example of UPC-A with 2-digit addon, CC-A 4 cols, 3 rows",
"11011011101111001101001110010111011100010000100111010010111011100100000110000010011011101101100010100000000000000000000000000000"
"11011011001110011100111101011000010001110010100110010011101011001000000100101111110011101100100010100000000000000000000000000000"
"11011010001000011110010001010111101000000100100110011010001110000101100110111000100011101110100010100000000000000000000000000000"
"00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000"
"00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000"
"00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000"
"00010100110010010011011110101000110110001010111101010100010010010001110100111001011001101101100101000000000101100110010100100110"
},
/*59*/ { BARCODE_UPCA_CC, 2, "12345678901+12121", "[91]1234567890123", 0, 8, 155, "Example of UPC-A with 5-digit addon, CC-B 4 cols, 4 rows",
"11010011101000111110100111011011111101011100100111011011010000111101100110010111000010001101001000100000000000000000000000000000000000000000000000000000000"
"11010011001011001001110000010111110110000010100111010011011111100110100111010011111001001101011000100000000000000000000000000000000000000000000000000000000"
"11010001001110011010000110011001000001011000100110010010011110111101000111000111010001001101011100100000000000000000000000000000000000000000000000000000000"
"11010001101100010111000001011101101110010000100110011011111000101011000111100010010100001101011110100000000000000000000000000000000000000000000000000000000"
"00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000"
"00100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000"
"00010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000"
"00010100110010010011011110101000110110001010111101010100010010010001110100111001011001101101100101000000000101100110010100100110101100110100110110100110010"
},
/*60*/ { BARCODE_UPCE_CC, 1, "0654321+89", "[91]1", 0, 9, 82, "Example of UPC-E with 2-digit addon, CC-A 2 cols, 5 rows",
"1101100110111101110101111101010001000111100011110101001000000000000000000000000000"
"1101101110111011000010001101110010101110000011100101001000000000000000000000000000"
"1101101100110001011111011101111010000100100011101101001000000000000000000000000000"
"1101101000100111011100111101110011110101110011101001001000000000000000000000000000"
"1101001000110011001000000101110100011011110011101001101000000000000000000000000000"
"0001000000000000000000000000000000000000000000000000010000000000000000000000000000"
"0010000000000000000000000000000000000000000000000000001000000000000000000000000000"
"0001000000000000000000000000000000000000000000000000010000000000000000000000000000"
"0001010000101011000100111010111101001101100110010101010000000101101101110100101110"
},
/*61*/ { BARCODE_UPCE_CC, 2, "1876543+56789", "[91]12345", 0, 12, 109, "Example of UPC-E with 5-digit addon, CC-B 2 cols, 8 rows",
"1100100010111011111011101001000001000010001011001000101000000000000000000000000000000000000000000000000000000"
"1110100010110100001111011001100101110000100011101000101000000000000000000000000000000000000000000000000000000"
"1110110010111011001001111101000111100100001011101100101000000000000000000000000000000000000000000000000000000"
"1100110010110011101100010001010111110111110011001100101000000000000000000000000000000000000000000000000000000"
"1101110010111110010011011101001111110100110011011100101000000000000000000000000000000000000000000000000000000"
"1101111010110011100001011101001101000011100011011110101000000000000000000000000000000000000000000000000000000"
"1100111010101000100000100001011110111110110011001110101000000000000000000000000000000000000000000000000000000"
"1110111010101111001011110001011110001001111011101110101000000000000000000000000000000000000000000000000000000"
"0001000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"0010000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000"
"0001000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"0001010110111001000100001010110001010001101000010101010000000101101100010101011110100100010101101110100101110"
},
/*62*/ { BARCODE_EANX_CC, 1, "9876543+65", "[91]1234567", 0, 8, 99, "Example of EAN-8 with 2-digit addon, CC-A 3 cols, 4 rows",
"100100011111001101010011000111000101110011001100010111010000011101001101000000000000000000000000000"
"110111111001101001010111000110111100101100001111000100111101011101011101000000000000000000000000000"
"100001011000001101010110000101011111011111001110100100001110011101011001000000000000000000000000000"
"111100100011001101010010000110010011111011101010011111000110011101010001000000000000000000000000000"
"000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000"
"000100000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000"
"000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000"
"000010100010110110111011101101011110101010011101011100100001011100101010000000101101011110101110010"
},
/*63*/ { BARCODE_EANX_CC, 2, "9876543+74083", "[91]123456789012345678", 0, 12, 136, "Example of EAN-8 with 5-digit addon, CC-B 3 cols, 8 rows",
"1100111010111011111011101001000010110100000100001000101111101101001111011001110101000000000000000000000000000000000000000000000000000000"
"1110111010110010111000010001000010010111001011001000001110001101110100011101110101000000000000000000000000000000000000000000000000000000"
"1110011010110111111001101001000011010101000101111000001100100110111111011100110101000000000000000000000000000000000000000000000000000000"
"1111011010111011010000110001000111010110000110110011001110011010011000011110110101000000000000000000000000000000000000000000000000000000"
"1111001010111011011100100001000110010111011101111001001010011110000100011110010101000000000000000000000000000000000000000000000000000000"
"1110001010111111010110001001000100010111001011111101101001111000011011011100010101000000000000000000000000000000000000000000000000000000"
"1100001010111100100010111101001100010111001111001100101001110001110010011000010101000000000000000000000000000000000000000000000000000000"
"1100011010110011001111010001001110010111110111101110101011100111111001011000110101000000000000000000000000000000000000000000000000000000"
"0000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"0000000000000100000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000"
"0000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000"
"0000000000000010100010110110111011101101011110101010011101011100100001011100101010000000101101110110100111010100011010101101110101000010"
},
}; };
int data_size = sizeof(data) / sizeof(struct item); int data_size = sizeof(data) / sizeof(struct item);
@ -1469,7 +1556,7 @@ static void test_ean128_cc_shift(int index, int generate, int debug) {
if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) { if (do_bwipp && testUtilCanBwipp(symbol->symbology, data[i].option_1, -1, -1, debug)) {
if (!data[i].bwipp_cmp) { if (!data[i].bwipp_cmp) {
if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s skipped, not BWIPP compatible\n", i, testUtilBarcodeName(symbol->symbology)); if (debug & ZINT_DEBUG_TEST_PRINT) printf("%d: %s not BWIPP compatible (%s)\n", i, testUtilBarcodeName(symbol->symbology), data[i].comment);
} else { } else {
ret = testUtilBwipp(symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf)); ret = testUtilBwipp(symbol, data[i].option_1, -1, -1, data[i].composite, composite_length, symbol->primary, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret); assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);

View File

@ -125,6 +125,16 @@ static void test_print(int index, int generate, int debug) {
}; };
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/png/codablockf_3rows.png" }, /* 0*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/png/codablockf_3rows.png" },
/* 1*/ { BARCODE_EANX, -1, -1, "9771384524017+12", "../data/png/ean13_2addon_ggs_5.2.2.5.1-2.png" },
/* 2*/ { BARCODE_EANX, -1, -1, "9780877799306+54321", "../data/png/ean13_5addon_ggs_5.2.2.5.2-2.png" },
/* 3*/ { BARCODE_UPCA, -1, -1, "012345678905+24", "../data/png/upca_2addon_ggs_5.2.6.6-5.png" },
/* 4*/ { BARCODE_UPCA, -1, -1, "614141234417+12345", "../data/png/upca_5addon.png" },
/* 5*/ { BARCODE_UPCE, -1, -1, "1234567+12", "../data/png/upce_2addon.png" },
/* 6*/ { BARCODE_UPCE, -1, -1, "1234567+12345", "../data/png/upce_5addon.png" },
/* 7*/ { BARCODE_EANX, -1, -1, "1234567+12", "../data/png/ean8_2addon.png" },
/* 8*/ { BARCODE_EANX, -1, -1, "1234567+12345", "../data/png/ean8_5addon.png" },
/* 9*/ { BARCODE_EANX, -1, -1, "12345", "../data/png/ean5.png" },
/* 10*/ { BARCODE_EANX, -1, -1, "12", "../data/png/ean2.png" },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);

View File

@ -124,111 +124,122 @@ static void test_buffer(int index, int generate, int debug) {
/* 5*/ { BARCODE_C25IND, "0000000000", "", 50, 1, 159, 318, 118 }, /* 5*/ { BARCODE_C25IND, "0000000000", "", 50, 1, 159, 318, 118 },
/* 6*/ { BARCODE_CODE39, "0000000000", "", 50, 1, 155, 310, 118 }, /* 6*/ { BARCODE_CODE39, "0000000000", "", 50, 1, 155, 310, 118 },
/* 7*/ { BARCODE_EXCODE39, "0000000000", "", 50, 1, 155, 310, 118 }, /* 7*/ { BARCODE_EXCODE39, "0000000000", "", 50, 1, 155, 310, 118 },
/* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 230, 118 }, /* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 226, 118 },
/* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 230, 118 }, /* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 226, 118 },
/* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 124, 288, 118 }, /* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 122, 276, 118 },
/* 11*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 151, 342, 118 }, /* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 50, 1, 122, 276, 118 },
/* 12*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 134, 118 }, /* 12*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 149, 330, 118 },
/* 13*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 96, 192, 118 }, /* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 50, 1, 149, 330, 118 },
/* 14*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 123, 246, 118 }, /* 14*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 162, 118 },
/* 15*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 94, 118 }, /* 15*/ { BARCODE_EANX_CHK, "12345670", "", 50, 1, 67, 162, 118 },
/* 16*/ { BARCODE_EANX, "12", "", 50, 1, 20, 40, 118 }, /* 16*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 94, 216, 118 },
/* 17*/ { BARCODE_EAN128, "[01]12345678901234", "", 50, 1, 134, 268, 118 }, /* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", 50, 1, 94, 216, 118 },
/* 18*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 118 }, /* 18*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 121, 270, 118 },
/* 19*/ { BARCODE_CODE128, "0000000000", "", 50, 1, 90, 180, 118 }, /* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", 50, 1, 121, 270, 118 },
/* 20*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 118 }, /* 20*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 118, 118 },
/* 21*/ { BARCODE_DPIDENT, "12345678901", "", 50, 1, 117, 234, 118 }, /* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 118 },
/* 22*/ { BARCODE_CODE16K, "0000000000", "", 20, 2, 70, 162, 44 }, /* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 118 },
/* 23*/ { BARCODE_CODE49, "0000000000", "", 20, 2, 70, 162, 44 }, /* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 118 },
/* 24*/ { BARCODE_CODE93, "0000000000", "", 50, 1, 127, 254, 118 }, /* 24*/ { BARCODE_EAN128, "[01]12345678901234", "", 50, 1, 134, 268, 118 },
/* 25*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 }, /* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 118 },
/* 26*/ { BARCODE_RSS14, "1234567890123", "", 50, 1, 96, 192, 118 }, /* 26*/ { BARCODE_CODE128, "0000000000", "", 50, 1, 90, 180, 118 },
/* 27*/ { BARCODE_RSS_LTD, "1234567890123", "", 50, 1, 74, 148, 118 }, /* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 118 },
/* 28*/ { BARCODE_RSS_EXP, "[01]12345678901234", "", 34, 1, 134, 268, 86 }, /* 28*/ { BARCODE_DPIDENT, "12345678901", "", 50, 1, 117, 234, 118 },
/* 29*/ { BARCODE_TELEPEN, "0000000000", "", 50, 1, 208, 416, 118 }, /* 29*/ { BARCODE_CODE16K, "0000000000", "", 20, 2, 70, 162, 44 },
/* 30*/ { BARCODE_UPCA, "12345678904", "", 50, 1, 95, 230, 118 }, /* 30*/ { BARCODE_CODE49, "0000000000", "", 20, 2, 70, 162, 44 },
/* 31*/ { BARCODE_UPCA_CHK, "12345678905", "", 50, 1, 95, 230, 118 }, /* 31*/ { BARCODE_CODE93, "0000000000", "", 50, 1, 127, 254, 118 },
/* 32*/ { BARCODE_UPCA, "12345678904+12", "", 50, 1, 124, 288, 118 }, /* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
/* 33*/ { BARCODE_UPCA, "12345678904+12345", "", 50, 1, 151, 342, 118 }, /* 33*/ { BARCODE_RSS14, "1234567890123", "", 50, 1, 96, 192, 118 },
/* 34*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 142, 118 }, /* 34*/ { BARCODE_RSS_LTD, "1234567890123", "", 50, 1, 74, 148, 118 },
/* 35*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 142, 118 }, /* 35*/ { BARCODE_RSS_EXP, "[01]12345678901234", "", 34, 1, 134, 268, 86 },
/* 36*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 80, 200, 118 }, /* 36*/ { BARCODE_TELEPEN, "0000000000", "", 50, 1, 208, 416, 118 },
/* 37*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 107, 254, 118 }, /* 37*/ { BARCODE_UPCA, "12345678904", "", 50, 1, 95, 226, 118 },
/* 38*/ { BARCODE_POSTNET, "00000000000", "", 12, 2, 185, 370, 24 }, /* 38*/ { BARCODE_UPCA_CHK, "123456789043", "", 50, 1, 95, 226, 118 },
/* 39*/ { BARCODE_MSI_PLESSEY, "0000000000", "", 50, 1, 127, 254, 118 }, /* 39*/ { BARCODE_UPCA, "12345678904+12", "", 50, 1, 124, 276, 118 },
/* 40*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34, 100 }, /* 40*/ { BARCODE_UPCA_CHK, "123456789043+12", "", 50, 1, 124, 276, 118 },
/* 41*/ { BARCODE_LOGMARS, "0000000000", "", 50, 1, 191, 382, 118 }, /* 41*/ { BARCODE_UPCA, "12345678904+12345", "", 50, 1, 151, 330, 118 },
/* 42*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116, 100 }, /* 42*/ { BARCODE_UPCA_CHK, "123456789043+12345", "", 50, 1, 151, 330, 118 },
/* 43*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284, 118 }, /* 43*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 134, 118 },
/* 44*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58, 20 }, /* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 134, 118 },
/* 45*/ { BARCODE_PDF417, "0000000000", "", 21, 7, 103, 206, 42 }, /* 45*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 78, 184, 118 },
/* 46*/ { BARCODE_PDF417TRUNC, "0000000000", "", 21, 7, 68, 136, 42 }, /* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 50, 1, 78, 184, 118 },
/* 47*/ { BARCODE_MAXICODE, "0000000000", "", 165, 33, 30, 300, 300 }, /* 47*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 105, 238, 118 },
/* 48*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42, 42 }, /* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 50, 1, 105, 238, 118 },
/* 49*/ { BARCODE_CODE128B, "0000000000", "", 50, 1, 145, 290, 118 }, /* 49*/ { BARCODE_POSTNET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 50*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266, 16 }, /* 50*/ { BARCODE_MSI_PLESSEY, "0000000000", "", 50, 1, 127, 254, 118 },
/* 51*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146, 16 }, /* 51*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34, 100 },
/* 52*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146, 16 }, /* 52*/ { BARCODE_LOGMARS, "0000000000", "", 50, 1, 191, 382, 118 },
/* 53*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146, 16 }, /* 53*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116, 100 },
/* 54*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 230, 118 }, /* 54*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284, 118 },
/* 55*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 124, 288, 118 }, /* 55*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58, 20 },
/* 56*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 151, 342, 118 }, /* 56*/ { BARCODE_PDF417, "0000000000", "", 21, 7, 103, 206, 42 },
/* 57*/ { BARCODE_RM4SCC, "0000000000", "", 8, 3, 91, 182, 16 }, /* 57*/ { BARCODE_PDF417TRUNC, "0000000000", "", 21, 7, 68, 136, 42 },
/* 58*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20, 20 }, /* 58*/ { BARCODE_MAXICODE, "0000000000", "", 165, 33, 30, 300, 300 }, // Differs from vector
/* 59*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268, 118 }, /* 59*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 60*/ { BARCODE_VIN, "00000000000000000", "", 50, 1, 246, 492, 118 }, /* 60*/ { BARCODE_CODE128B, "0000000000", "", 50, 1, 145, 290, 118 },
/* 61*/ { BARCODE_CODABLOCKF, "0000000000", "", 20, 2, 101, 242, 44 }, /* 61*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266, 16 },
/* 62*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312, 118 }, /* 62*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146, 16 },
/* 63*/ { BARCODE_JAPANPOST, "0000000000", "", 8, 3, 133, 266, 16 }, /* 63*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146, 16 },
/* 64*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 118 }, /* 64*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146, 16 },
/* 65*/ { BARCODE_RSS14STACK, "0000000000000", "", 13, 3, 50, 100, 26 }, /* 65*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 226, 118 },
/* 66*/ { BARCODE_RSS14STACK_OMNI, "0000000000000", "", 69, 5, 50, 100, 138 }, /* 66*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 122, 276, 118 },
/* 67*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", "", 71, 5, 102, 204, 142 }, /* 67*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 149, 330, 118 },
/* 68*/ { BARCODE_PLANET, "00000000000", "", 12, 2, 185, 370, 24 }, /* 68*/ { BARCODE_RM4SCC, "0000000000", "", 8, 3, 91, 182, 16 },
/* 69*/ { BARCODE_MICROPDF417, "0000000000", "", 12, 6, 82, 164, 24 }, /* 69*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20, 20 },
/* 70*/ { BARCODE_ONECODE, "12345678901234567890", "", 8, 3, 129, 258, 16 }, /* 70*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268, 118 },
/* 71*/ { BARCODE_PLESSEY, "0000000000", "", 50, 1, 227, 454, 118 }, /* 71*/ { BARCODE_VIN, "00000000000000000", "", 50, 1, 246, 492, 118 },
/* 72*/ { BARCODE_TELEPEN_NUM, "0000000000", "", 50, 1, 128, 256, 118 }, /* 72*/ { BARCODE_CODABLOCKF, "0000000000", "", 20, 2, 101, 242, 44 },
/* 73*/ { BARCODE_ITF14, "0000000000", "", 50, 1, 135, 382, 150 }, /* 73*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312, 118 },
/* 74*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 }, /* 74*/ { BARCODE_JAPANPOST, "0000000000", "", 8, 3, 133, 266, 16 },
/* 75*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 }, /* 75*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 118 },
/* 76*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 }, /* 76*/ { BARCODE_RSS14STACK, "0000000000000", "", 13, 3, 50, 100, 26 },
/* 77*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 }, /* 77*/ { BARCODE_RSS14STACK_OMNI, "0000000000000", "", 69, 5, 50, 100, 138 },
/* 78*/ { BARCODE_HIBC_128, "0000000000", "", 50, 1, 134, 268, 118 }, /* 78*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", "", 71, 5, 102, 204, 142 },
/* 79*/ { BARCODE_HIBC_39, "0000000000", "", 50, 1, 223, 446, 118 }, /* 79*/ { BARCODE_PLANET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 80*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 }, /* 80*/ { BARCODE_MICROPDF417, "0000000000", "", 12, 6, 82, 164, 24 },
/* 81*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 }, /* 81*/ { BARCODE_ONECODE, "12345678901234567890", "", 8, 3, 129, 258, 16 },
/* 82*/ { BARCODE_HIBC_PDF, "0000000000", "", 27, 9, 103, 206, 54 }, /* 82*/ { BARCODE_PLESSEY, "0000000000", "", 50, 1, 227, 454, 118 },
/* 83*/ { BARCODE_HIBC_MICPDF, "0000000000", "", 34, 17, 38, 76, 68 }, /* 83*/ { BARCODE_TELEPEN_NUM, "0000000000", "", 50, 1, 128, 256, 118 },
/* 84*/ { BARCODE_HIBC_BLOCKF, "0000000000", "", 30, 3, 101, 242, 64 }, /* 84*/ { BARCODE_ITF14, "0000000000", "", 50, 1, 135, 330, 138 },
/* 85*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 }, /* 85*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 },
/* 86*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 33, 23 }, /* 86*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 },
/* 87*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 }, /* 87*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
/* 88*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 }, /* 88*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 },
/* 89*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 }, /* 89*/ { BARCODE_HIBC_128, "0000000000", "", 50, 1, 134, 268, 118 },
/* 90*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 118 }, /* 90*/ { BARCODE_HIBC_39, "0000000000", "", 50, 1, 223, 446, 118 },
/* 91*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 238, 118 }, /* 91*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 },
/* 92*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 128, 296, 118 }, /* 92*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 93*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 155, 350, 118 }, /* 93*/ { BARCODE_HIBC_PDF, "0000000000", "", 27, 9, 103, 206, 54 },
/* 94*/ { BARCODE_EAN128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290, 118 }, /* 94*/ { BARCODE_HIBC_MICPDF, "0000000000", "", 34, 17, 38, 76, 68 },
/* 95*/ { BARCODE_RSS14_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60 }, /* 95*/ { BARCODE_HIBC_BLOCKF, "0000000000", "", 30, 3, 101, 242, 64 },
/* 96*/ { BARCODE_RSS_LTD_CC, "1234567890123", "[20]01", 19, 6, 74, 148, 56 }, /* 96*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 },
/* 97*/ { BARCODE_RSS_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268, 100 }, /* 97*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 33, 23 }, // Differs from vector
/* 98*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 238, 118 }, /* 98*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 },
/* 99*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 296, 118 }, /* 99*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
/*100*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 350, 118 }, /*100*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 },
/*101*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 150, 118 }, /*101*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 118 },
/*102*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 84, 208, 118 }, /*102*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 234, 118 },
/*103*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 111, 262, 118 }, /*103*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 126, 284, 118 },
/*104*/ { BARCODE_RSS14STACK_CC, "0000000000000", "[20]01", 24, 9, 56, 112, 48 }, /*104*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 153, 338, 118 },
/*105*/ { BARCODE_RSS14_OMNI_CC, "0000000000000", "[20]01", 80, 11, 56, 112, 160 }, /*105*/ { BARCODE_EAN128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290, 118 },
/*106*/ { BARCODE_RSS_EXPSTACK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204, 156 }, /*106*/ { BARCODE_RSS14_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60 },
/*107*/ { BARCODE_CHANNEL, "00", "", 50, 1, 19, 38, 118 }, /*107*/ { BARCODE_RSS_LTD_CC, "1234567890123", "[20]01", 19, 6, 74, 148, 56 },
/*108*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 }, /*108*/ { BARCODE_RSS_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268, 100 },
/*109*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 }, /*109*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 118 },
/*110*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 }, /*110*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 118 },
/*111*/ { BARCODE_ULTRA, "0000000000", "", 13, 13, 18, 36, 26 }, /*111*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 118 },
/*112*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 }, /*112*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 142, 118 },
/*113*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 82, 192, 118 },
/*114*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 118 },
/*115*/ { BARCODE_RSS14STACK_CC, "0000000000000", "[20]01", 24, 9, 56, 112, 48 },
/*116*/ { BARCODE_RSS14_OMNI_CC, "0000000000000", "[20]01", 80, 11, 56, 112, 160 },
/*117*/ { BARCODE_RSS_EXPSTACK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204, 156 },
/*118*/ { BARCODE_CHANNEL, "00", "", 50, 1, 19, 38, 118 },
/*119*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
/*120*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
/*121*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
/*122*/ { BARCODE_ULTRA, "0000000000", "", 13, 13, 18, 36, 26 },
/*123*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
@ -305,34 +316,38 @@ static void test_upcean_hrt(int index, int debug) {
}; };
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13 /* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 1*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13 /* 1*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13 /* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 3*/ { BARCODE_EANX_CHK, 0, "1234567890128", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13 /* 3*/ { BARCODE_EANX_CHK, 0, "1234567890128", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, // EAN-13
/* 4*/ { BARCODE_EANX_CHK, -1, "1234567890128+12", 0, 50, 1, 124, 288, 118, 103 /*text_row*/, 0, 20, 5, 210, 78 }, // EAN-13 + EAN-2 /* 4*/ { BARCODE_EANX_CHK, -1, "1234567890128+12", 0, 50, 1, 122, 276, 118, 103 /*text_row*/, 0, 20, 5, 212, 64 }, // EAN-13 + EAN-2
/* 5*/ { BARCODE_EANX_CHK, 0, "1234567890128+12", 0, 50, 1, 124, 288, 118, 103 /*text_row*/, 0, 20, 5, 210, 78 }, // EAN-13 + EAN-2 /* 5*/ { BARCODE_EANX_CHK, 0, "1234567890128+12", 0, 50, 1, 122, 276, 118, 103 /*text_row*/, 0, 20, 5, 212, 64 }, // EAN-13 + EAN-2
/* 6*/ { BARCODE_EANX, -1, "1234567890128+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, // EAN-13 + EAN-5 /* 6*/ { BARCODE_EANX, -1, "1234567890128+12345", 0, 50, 1, 149, 330, 118, 103 /*text_row*/, 0, 20, 5, 212, 118 }, // EAN-13 + EAN-5
/* 7*/ { BARCODE_EANX, 0, "1234567890128+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, // EAN-13 + EAN-5 /* 7*/ { BARCODE_EANX, 0, "1234567890128+12345", 0, 50, 1, 149, 330, 118, 103 /*text_row*/, 0, 20, 5, 212, 118 }, // EAN-13 + EAN-5
/* 8*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, // ISBNX + EAN-5 /* 8*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 149, 330, 118, 103 /*text_row*/, 0, 20, 5, 212, 118 }, // ISBNX + EAN-5
/* 9*/ { BARCODE_ISBNX, 0, "9784567890120+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, // ISBNX + EAN-5 /* 9*/ { BARCODE_ISBNX, 0, "9784567890120+12345", 0, 50, 1, 149, 330, 118, 103 /*text_row*/, 0, 20, 5, 212, 118 }, // ISBNX + EAN-5
/* 10*/ { BARCODE_EANX, -1, "123456", 0, 50, 1, 67, 134, 118, 103 /*text_row*/, 6, 58, -1, -1, -1 }, // EAN-8 /* 10*/ { BARCODE_EANX, -1, "123456", 0, 50, 1, 67, 162, 118, 103 /*text_row*/, 20, 58, -1, -1, -1 }, // EAN-8
/* 11*/ { BARCODE_EANX, 0, "123456", 0, 50, 1, 67, 134, 118, 103 /*text_row*/, 6, 58, -1, -1, -1 }, // EAN-8 /* 11*/ { BARCODE_EANX, 0, "123456", 0, 50, 1, 67, 162, 118, 103 /*text_row*/, 20, 58, -1, -1, -1 }, // EAN-8
/* 12*/ { BARCODE_EANX, -1, "123456+12", 0, 50, 1, 96, 192, 118, 103 /*text_row*/, 6, 58, 5, 134, 58 }, // EAN-8 + EAN-2 /* 12*/ { BARCODE_EANX, -1, "123456+12", 0, 50, 1, 94, 216, 118, 103 /*text_row*/, 20, 58, 5, 148, 68 }, // EAN-8 + EAN-2
/* 13*/ { BARCODE_EANX, 0, "123456+12", 0, 50, 1, 96, 192, 118, 103 /*text_row*/, 6, 58, 5, 134, 58 }, // EAN-8 + EAN-2 /* 13*/ { BARCODE_EANX, 0, "123456+12", 0, 50, 1, 94, 216, 118, 103 /*text_row*/, 20, 58, 5, 148, 68 }, // EAN-8 + EAN-2
/* 14*/ { BARCODE_EANX, -1, "123456+12345", 0, 50, 1, 123, 246, 118, 103 /*text_row*/, 6, 58, 5, 134, 112 }, // EAN-8 + EAN-5 /* 14*/ { BARCODE_EANX, -1, "123456+12345", 0, 50, 1, 121, 270, 118, 103 /*text_row*/, 20, 58, 5, 148, 122 }, // EAN-8 + EAN-5
/* 15*/ { BARCODE_EANX, 0, "123456+12345", 0, 50, 1, 123, 246, 118, 103 /*text_row*/, 6, 58, 5, 134, 112 }, // EAN-8 + EAN-5 /* 15*/ { BARCODE_EANX, 0, "123456+12345", 0, 50, 1, 121, 270, 118, 103 /*text_row*/, 20, 58, 5, 148, 122 }, // EAN-8 + EAN-5
/* 16*/ { BARCODE_UPCA, -1, "123456789012", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, /* 16*/ { BARCODE_EANX, -1, "1234", 0, 50, 1, 47, 118, 118, 103 /*text_row*/, 40, 36, -1, -1, -1 }, // EAN-5
/* 17*/ { BARCODE_UPCA, 0, "123456789012", 0, 50, 1, 95, 230, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, /* 17*/ { BARCODE_EANX, 0, "1234", 0, 50, 1, 47, 118, 118, 103 /*text_row*/, 40, 36, -1, -1, -1 }, // EAN-5
/* 18*/ { BARCODE_UPCA, -1, "123456789012+12", 0, 50, 1, 124, 288, 118, 103 /*text_row*/, 0, 20, 5, 210, 78 }, /* 18*/ { BARCODE_EANX, -1, "12", 0, 50, 1, 20, 64, 118, 103 /*text_row*/, 20, 20, -1, -1, -1 }, // EAN-2
/* 19*/ { BARCODE_UPCA, 0, "123456789012+12", 0, 50, 1, 124, 288, 118, 103 /*text_row*/, 0, 20, 5, 210, 78 }, /* 19*/ { BARCODE_EANX, 0, "12", 0, 50, 1, 20, 64, 118, 103 /*text_row*/, 20, 20, -1, -1, -1 }, // EAN-2
/* 20*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, /* 20*/ { BARCODE_UPCA, -1, "123456789012", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 18, -1, -1, -1 },
/* 21*/ { BARCODE_UPCA_CHK, 0, "123456789012+12345", 0, 50, 1, 151, 342, 118, 103 /*text_row*/, 0, 20, 5, 210, 130 }, /* 21*/ { BARCODE_UPCA, 0, "123456789012", 0, 50, 1, 95, 226, 118, 103 /*text_row*/, 0, 18, -1, -1, -1 },
/* 22*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 142, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, /* 22*/ { BARCODE_UPCA, -1, "123456789012+12", 0, 50, 1, 124, 276, 118, 103 /*text_row*/, 0, 18, 5, 208, 68 },
/* 23*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 142, 118, 103 /*text_row*/, 0, 20, -1, -1, -1 }, /* 23*/ { BARCODE_UPCA, 0, "123456789012+12", 0, 50, 1, 124, 276, 118, 103 /*text_row*/, 0, 18, 5, 208, 68 },
/* 24*/ { BARCODE_UPCE_CHK, -1, "12345670+12", 0, 50, 1, 80, 200, 118, 103 /*text_row*/, 0, 20, 5, 122, 78 }, /* 24*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", 0, 50, 1, 151, 330, 118, 103 /*text_row*/, 0, 18, 5, 208, 122 },
/* 25*/ { BARCODE_UPCE_CHK, 0, "12345670+12", 0, 50, 1, 80, 200, 118, 103 /*text_row*/, 0, 20, 5, 122, 78 }, /* 25*/ { BARCODE_UPCA_CHK, 0, "123456789012+12345", 0, 50, 1, 151, 330, 118, 103 /*text_row*/, 0, 18, 5, 208, 122 },
/* 26*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 107, 254, 118, 103 /*text_row*/, 0, 20, 5, 122, 130 }, /* 26*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 118, 103 /*text_row*/, 0, 18, -1, -1, -1 },
/* 27*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 107, 254, 118, 103 /*text_row*/, 0, 20, 5, 122, 130 }, /* 27*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 134, 118, 103 /*text_row*/, 0, 18, -1, -1, -1 },
/* 28*/ { BARCODE_UPCE_CHK, -1, "12345670+12", 0, 50, 1, 78, 184, 118, 103 /*text_row*/, 0, 18, 5, 120, 64 },
/* 29*/ { BARCODE_UPCE_CHK, 0, "12345670+12", 0, 50, 1, 78, 184, 118, 103 /*text_row*/, 0, 18, 5, 120, 64 },
/* 30*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238, 118, 103 /*text_row*/, 0, 18, 5, 120, 118 },
/* 31*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238, 118, 103 /*text_row*/, 0, 18, 5, 120, 118 },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
@ -357,11 +372,13 @@ static void test_upcean_hrt(int index, int debug) {
if (index != -1) testUtilBitmapPrint(symbol); if (index != -1) testUtilBitmapPrint(symbol);
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 (%s) symbol->height %d != %d\n", i, testUtilBarcodeName(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->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 (%d) symbol->width %d != %d\n", i, data[i].symbology, symbol->width, data[i].expected_width); 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 (%d) symbol->bitmap_width %d != %d\n", i, data[i].symbology, symbol->bitmap_width, data[i].expected_bitmap_width); assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%s) symbol->bitmap_width %d != %d\n",
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%d) symbol->bitmap_height %d != %d\n", i, data[i].symbology, symbol->bitmap_height, data[i].expected_bitmap_height); i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_bitmap_width);
assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%s) symbol->bitmap_height %d != %d\n",
i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_height, data[i].expected_bitmap_height);
if (data[i].expected_text_row != -1) { if (data[i].expected_text_row != -1) {
int text_bits_set = 0; int text_bits_set = 0;

View File

@ -49,6 +49,16 @@ static void test_print(int index, int generate, int debug) {
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, -1, "<>\"&'", "../data/svg/code128_amperands.svg" }, /* 0*/ { BARCODE_CODE128, -1, -1, "<>\"&'", "../data/svg/code128_amperands.svg" },
/* 1*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/svg/codablockf_3rows.svg"}, /* 1*/ { BARCODE_CODABLOCKF, 3, -1, "AAAAAAAAA", "../data/svg/codablockf_3rows.svg"},
/* 2*/ { BARCODE_EANX, -1, -1, "9771384524017+12", "../data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg" },
/* 3*/ { BARCODE_EANX, -1, -1, "9780877799306+54321", "../data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg" },
/* 4*/ { BARCODE_UPCA, -1, -1, "012345678905+24", "../data/svg/upca_2addon_ggs_5.2.6.6-5.svg" },
/* 5*/ { BARCODE_UPCA, -1, -1, "614141234417+12345", "../data/svg/upca_5addon.svg" },
/* 6*/ { BARCODE_UPCE, -1, -1, "1234567+12", "../data/svg/upce_2addon.svg" },
/* 7*/ { BARCODE_UPCE, -1, -1, "1234567+12345", "../data/svg/upce_5addon.svg" },
/* 8*/ { BARCODE_EANX, -1, -1, "1234567+12", "../data/svg/ean8_2addon.svg" },
/* 9*/ { BARCODE_EANX, -1, -1, "1234567+12345", "../data/svg/ean8_5addon.svg" },
/* 10*/ { BARCODE_EANX, -1, -1, "12345", "../data/svg/ean5.svg" },
/* 11*/ { BARCODE_EANX, -1, -1, "12", "../data/svg/ean2.svg" },
}; };
int data_size = sizeof(data) / sizeof(struct item); int data_size = sizeof(data) / sizeof(struct item);

View File

@ -74,7 +74,7 @@ static void test_upce_length(int index, int debug) {
int length = strlen(data[i].data); int length = strlen(data[i].data);
ret = ZBarcode_Encode(symbol, data[i].data, length); ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
} }
@ -112,11 +112,11 @@ static void test_upca_print(int index, int debug) {
int length = strlen(data[i].data); int length = strlen(data[i].data);
ret = ZBarcode_Encode(symbol, data[i].data, length); ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ret %d != %d\n", i, ret, data[i].ret); assert_equal(ret, data[i].ret, "i:%d ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
strcpy(symbol->outfile, "out.gif"); strcpy(symbol->outfile, "out.gif");
ret = ZBarcode_Print(symbol, 0); 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_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile); assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile);
@ -136,48 +136,51 @@ static void test_isbn(int index, int debug) {
int ret_encode; int ret_encode;
int ret_vector; int ret_vector;
}; };
// s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<")) // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = { struct item data[] = {
/* 0*/ { "0", 0, 0 }, // Left zero-padded if < 10 chars /* 0*/ { "0", 0, 0 }, // Left zero-padded if < 10 chars
/* 1*/ { "12345678", ZINT_ERROR_INVALID_CHECK, -1 }, /* 1*/ { "12345678", ZINT_ERROR_INVALID_CHECK, -1 },
/* 2*/ { "12345679", 0, 0 }, // 9 is correct check digit /* 2*/ { "12345679", 0, 0 }, // 9 is correct check digit
/* 3*/ { "123456789", 0, 0 }, /* 3*/ { "123456789", 0, 0 },
/* 4*/ { "0123456789", 0, 0 }, /* 4*/ { "0123456789", 0, 0 },
/* 5*/ { "1234567890", ZINT_ERROR_INVALID_CHECK, -1 }, /* 5*/ { "1234567890", ZINT_ERROR_INVALID_CHECK, -1 },
/* 6*/ { "123456789X", 0, 0 }, // X is correct check digit /* 6*/ { "123456789X", 0, 0 }, // X is correct check digit
/* 7*/ { "8175257660", 0, 0 }, // 0 is correct check digit /* 7*/ { "123456789x", 0, 0 }, // x is correct check digit
/* 8*/ { "0590764845", 0, 0 }, // 5 is correct check digit /* 8*/ { "8175257660", 0, 0 }, // 0 is correct check digit
/* 9*/ { "0906495741", 0, 0 }, // 1 is correct check digit /* 9*/ { "0590764845", 0, 0 }, // 5 is correct check digit
/*10*/ { "0140430016", 0, 0 }, // 6 is correct check digit /* 10*/ { "0906495741", 0, 0 }, // 1 is correct check digit
/*11*/ { "0571086187", 0, 0 }, // 7 is correct check digit /* 11*/ { "0140430016", 0, 0 }, // 6 is correct check digit
/*12*/ { "0486600882", 0, 0 }, // 2 is correct check digit /* 12*/ { "0571086187", 0, 0 }, // 7 is correct check digit
/*13*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1 }, /* 13*/ { "0486600882", 0, 0 }, // 2 is correct check digit
/*14*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1 }, /* 14*/ { "12345678901", ZINT_ERROR_TOO_LONG, -1 },
/*15*/ { "1234567890123", ZINT_ERROR_INVALID_DATA, -1 }, /* 15*/ { "123456789012", ZINT_ERROR_TOO_LONG, -1 },
/*16*/ { "9784567890120", 0, 0 }, // 0 is correct check digit /* 16*/ { "1234567890123", ZINT_ERROR_INVALID_DATA, -1 },
/*17*/ { "9783161484100", 0, 0 }, // 0 is correct check digit /* 17*/ { "9784567890120", 0, 0 }, // 0 is correct check digit
/*18*/ { "9781846688225", 0, 0 }, // 5 is correct check digit /* 18*/ { "9783161484100", 0, 0 }, // 0 is correct check digit
/*19*/ { "9781847657954", 0, 0 }, // 4 is correct check digit /* 19*/ { "9781846688225", 0, 0 }, // 5 is correct check digit
/*20*/ { "9781846688188", 0, 0 }, // 8 is correct check digit /* 20*/ { "9781847657954", 0, 0 }, // 4 is correct check digit
/*21*/ { "9781847659293", 0, 0 }, // 3 is correct check digit /* 21*/ { "9781846688188", 0, 0 }, // 8 is correct check digit
/*22*/ { "97845678901201", ZINT_ERROR_TOO_LONG, -1 }, /* 22*/ { "9781847659293", 0, 0 }, // 3 is correct check digit
/*23*/ { "3954994+12", 0, 0 }, /* 23*/ { "97845678901201", ZINT_ERROR_TOO_LONG, -1 },
/*24*/ { "3954994+12345", 0, 0 }, /* 24*/ { "3954994+12", 0, 0 },
/*25*/ { "3954994+123456", ZINT_ERROR_TOO_LONG, -1 }, /* 25*/ { "3954994+12345", 0, 0 },
/*26*/ { "3954994+", 0, 0 }, /* 26*/ { "3954994+123456", ZINT_ERROR_TOO_LONG, -1 },
/*27*/ { "61954993+1", 0, 0 }, /* 27*/ { "3954994+", 0, 0 },
/*28*/ { "61954993+123", 0, 0 }, /* 28*/ { "61954993+1", 0, 0 },
/*29*/ { "361954999+12", 0, 0 }, /* 29*/ { "61954993+123", 0, 0 },
/*30*/ { "361954999+1234", 0, 0 }, /* 30*/ { "361954999+12", 0, 0 },
/*31*/ { "361954999+12", 0, 0 }, /* 31*/ { "361954999+1234", 0, 0 },
/*32*/ { "199900003X+12", 0, 0 }, /* 32*/ { "361954999+12", 0, 0 },
/*33*/ { "199900003X+12345", 0, 0 }, /* 33*/ { "199900003X+12", 0, 0 },
/*34*/ { "9791234567896+12", 0, 0 }, /* 34*/ { "199900003x+12", 0, 0 },
/*35*/ { "9791234567896+12345", 0, 0 }, /* 35*/ { "199900003X+12345", 0, 0 },
/*36*/ { "9791234567896+", 0, 0 }, /* 36*/ { "199900003x+12345", 0, 0 },
/*37*/ { "97912345678961+", ZINT_ERROR_TOO_LONG, -1 }, /* 37*/ { "9791234567896+12", 0, 0 },
/*38*/ { "97912345678961+12345", ZINT_ERROR_TOO_LONG, -1 }, /* 38*/ { "9791234567896+12345", 0, 0 },
/*39*/ { "9791234567896+123456", ZINT_ERROR_TOO_LONG, -1 }, /* 39*/ { "9791234567896+", 0, 0 },
/* 40*/ { "97912345678961+", ZINT_ERROR_TOO_LONG, -1 },
/* 41*/ { "97912345678961+12345", ZINT_ERROR_TOO_LONG, -1 },
/* 42*/ { "9791234567896+123456", ZINT_ERROR_TOO_LONG, -1 },
}; };
int data_size = sizeof(data) / sizeof(struct item); int data_size = sizeof(data) / sizeof(struct item);
@ -194,11 +197,11 @@ static void test_isbn(int index, int debug) {
int length = strlen(data[i].data); int length = strlen(data[i].data);
ret = ZBarcode_Encode(symbol, data[i].data, length); ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d, errtxt %s\n", i, ret, data[i].ret_encode, symbol->errtxt); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
if (data[i].ret_vector != -1) { if (data[i].ret_vector != -1) {
ret = ZBarcode_Buffer_Vector(symbol, 0); ret = ZBarcode_Buffer_Vector(symbol, 0);
assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d\n", i, ret, data[i].ret_vector); assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d (%s)\n", i, ret, data[i].ret_vector, symbol->errtxt);
} }
ZBarcode_Delete(symbol); ZBarcode_Delete(symbol);
@ -242,10 +245,10 @@ static void test_vector_same(int index, int debug) {
int length = strlen(data[i].data); int length = strlen(data[i].data);
ret = ZBarcode_Encode(symbol, data[i].data, length); ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret_encode); assert_equal(ret, data[i].ret_encode, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret_encode, symbol->errtxt);
ret = ZBarcode_Buffer_Vector(symbol, 0); ret = ZBarcode_Buffer_Vector(symbol, 0);
assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d\n", i, ret, data[i].ret_vector); assert_equal(ret, data[i].ret_vector, "i:%d ZBarcode_Buffer_Vector ret %d != %d (%s)\n", i, ret, data[i].ret_vector, symbol->errtxt);
assert_nonnull(symbol->vector, "i:%d symbol->vector NULL\n", i); assert_nonnull(symbol->vector, "i:%d symbol->vector NULL\n", i);
vectors[j] = testUtilVectorCpy(symbol->vector); vectors[j] = testUtilVectorCpy(symbol->vector);
@ -268,13 +271,18 @@ static void test_vector_same(int index, int debug) {
testFinish(); testFinish();
} }
// https://www.isbn-international.org/content/isbn-users-manual ISBN Users' Manual
// https://bisg.org/page/BarcodingGuidelines BISG Barcode Guidelines for the US Book Industry (BISG BGUSBI)
static void test_encode(int index, int generate, int debug) { static void test_encode(int index, int generate, int debug) {
testStart(""); testStart("");
int do_bwipp = (debug & ZINT_DEBUG_TEST_BWIPP) && testUtilHaveGhostscript(); // Only do BWIPP test if asked, too slow otherwise
int ret; int ret;
struct item { struct item {
int symbology; int symbology;
int option_2;
unsigned char *data; unsigned char *data;
int ret; int ret;
@ -284,15 +292,120 @@ static void test_encode(int index, int generate, int debug) {
char *expected; char *expected;
}; };
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_UPCA, "1234567890", 0, 1, 95, "GS1 General Specifications 20.0 Figure 5.1-1 left", /* 0*/ { BARCODE_UPCA, -1, "01234567890", 0, 1, 95, "GGS Figure 5.1-1 UPC-A (also Figure 5.2.2.3-1., 5.2.6.6-2., 6.4.9-1. and BS EN 797:1996 Figure 3)",
"10100011010011001001001101111010100011011000101010101000010001001001000111010011100101001110101" "10100011010011001001001101111010100011011000101010101000010001001001000111010011100101001110101"
}, },
/* 1*/ { BARCODE_EANX, "4512345678906", 0, 1, 95, "GS1 General Specifications 20.0 Figure 5.1-1 right", /* 1*/ { BARCODE_EANX, -1, "4512345678906", 0, 1, 95, "GGS Figure 5.1-1 EAN-13",
"10101100010110011001001101111010011101011100101010101000010001001001000111010011100101010000101" "10101100010110011001001101111010011101011100101010101000010001001001000111010011100101010000101"
}, },
/* 2*/ { BARCODE_EANX_CHK, -1, "9501101531000", 0, 1, 95, "GGS Figure 5.2.2.1-2. EAN-13 (also Figure 6.5.2.2-1., 6.5.3.2-1., 6.5.3.2-2., 6.5.6.4-1.)",
"10101100010100111011001100110010100111001100101010100111010000101100110111001011100101110010101"
},
/* 3*/ { BARCODE_EANX, -1, "9501234", 0, 1, 67, "GGS Figure 5.2.2.2-1. EAN-8",
"1010001011011000100011010011001010101101100100001010111001010000101"
},
/* 4*/ { BARCODE_UPCE, -1, "0012345", 0, 1, 51, "GGS Figure 5.2.2.4-1. UPC-E (also BS EN 797:1996 Figure 4)",
"101010011100110010011011011110100111010110001010101"
},
/* 5*/ { BARCODE_EANX, -1, "9771384524017+12", 0, 1, 122, "GGS Figure 5.2.2.5.1-2. EAN-13 barcode with two-digit add-on",
"10101110110010001011001101111010001001010001101010100111011011001011100111001011001101000100101000000010110011001010010011"
},
/* 6*/ { BARCODE_EANX, -1, "9780877799306+54321", 0, 1, 149, "GGS Figure 5.2.2.5.2-2. EAN-13 barcode with five-digit add-on",
"10101110110001001010011101101110010001011101101010100010011101001110100100001011100101010000101000000010110111001010100011010100001010010011010011001"
},
/* 7*/ { BARCODE_EANX, -1, "501234567890", 0, 1, 95, "GGS Figure 5.2.6.6-1. EAN-13 (also BS EN 797:1996 Figure 1)",
"10100011010110011001101101111010100011011100101010101000010001001001000111010011100101110010101"
},
/* 8*/ { BARCODE_EANX, -1, "2012345", 0, 1, 67, "GGS Figure 5.2.6.6-3. EAN-8",
"1010010011000110100110010010011010101000010101110010011101100110101"
},
/* 9*/ { BARCODE_UPCE_CHK, -1, "00783491", 0, 1, 51, "GGS Figure 5.2.6.6-4. UPC-E",
"101010011100100010110111010000101000110001011010101"
},
/* 10*/ { BARCODE_UPCA, -1, "01234567890+24", 0, 1, 124, "GGS Figure 5.2.6.6-5. UPC-A barcode with two-digit add-on",
"1010001101001100100100110111101010001101100010101010100001000100100100011101001110010100111010100000000010110010011010100011"
},
/* 11*/ { BARCODE_EANX, -1, "1234567891019+45678", 0, 1, 149, "GGS Figure 5.2.6.6-6. EAN-13 barcode with five-digit add-on",
"10100100110111101001110101100010000101001000101010100100011101001100110111001011001101110100101000000010110011101010110001010101111010010001010110111"
},
/* 12*/ { BARCODE_EANX, -1, "5024425377399", 0, 1, 95, "GGS Figure 5.10.5.12-1. EAN-13",
"10100011010011011001110101000110010011011100101010100001010001001000100100001011101001110100101"
},
/* 13*/ { BARCODE_UPCA_CHK, -1, "614141000302", 0, 1, 95, "GGS Figure 5.10.6.3-1. UPC-A",
"10101011110011001010001100110010100011001100101010111001011100101110010100001011100101101100101"
},
/* 14*/ { BARCODE_UPCA, -1, "61414123440", 0, 1, 95, "GGS Figure 6.4.17-2. UPC-A Daisy 5pc Set",
"10101011110011001010001100110010100011001100101010110110010000101011100101110011100101110010101"
},
/* 15*/ { BARCODE_EANX, -1, "5410038302178", 0, 1, 95, "GGS Figure 6.5.5.3-1. EAN-13",
"10101000110110011010011100011010111101000100101010100001011100101101100110011010001001001000101"
},
/* 16*/ { BARCODE_EANX, -1, "501234567890+12", 0, 1, 122, "BS EN 797:1996 Figure 5 EAN-13 with 2-digit add-on",
"10100011010110011001101101111010100011011100101010101000010001001001000111010011100101110010101000000010110011001010010011"
},
/* 17*/ { BARCODE_EANX, -1, "501234567890+86104", 0, 1, 149, "BS EN 797:1996 Figure 6 EAN-13 with 5-digit add-on",
"10100011010110011001101101111010100011011100101010101000010001001001000111010011100101110010101000000010110001001010101111010011001010001101010011101"
},
/* 18*/ { BARCODE_UPCA_CHK, -1, "614141234417+12345", 0, 1, 151, "Example of UPC-A with 5-digit add-on",
"1010101111001100101000110011001010001100110010101011011001000010101110010111001100110100010010100000000010110110011010010011010100001010100011010110001"
},
/* 19*/ { BARCODE_UPCE, -1, "1234567+12", 0, 1, 78, "Example of UPC-E with 2-digit add-on",
"101001001101111010100011011100100001010010001010101000000010110011001010010011"
},
/* 20*/ { BARCODE_UPCE_CHK, -1, "12345670+12345", 0, 1, 105, "Example of UPC-E with 5-digit add-on",
"101001001101111010100011011100100001010010001010101000000010110110011010010011010100001010100011010110001"
},
/* 21*/ { BARCODE_EANX, -1, "1234567+12", 0, 1, 94, "Example of EAN-8 with 2-digit add-on",
"1010011001001001101111010100011010101001110101000010001001110010101000000010110011001010010011"
},
/* 22*/ { BARCODE_EANX_CHK, -1, "12345670+12345", 0, 1, 121, "Example of EAN-8 with 5-digit add-on",
"1010011001001001101111010100011010101001110101000010001001110010101000000010110110011010010011010100001010100011010110001"
},
/* 23*/ { BARCODE_EANX, -1, "54321", 0, 1, 47, "Example of EAN-5",
"10110111001010100011010100001010010011010011001"
},
/* 24*/ { BARCODE_EANX, -1, "21", 0, 1, 20, "Example of EAN-2",
"10110010011010110011"
},
/* 25*/ { BARCODE_EANX_CHK, 9, "76543210+21", 0, 1, 96, "Example of EAN-8 barcode with two-digit add-on, addon_gap 9",
"101011101101011110110001010001101010100001011011001100110111001010100000000010110010011010110011"
},
/* 26*/ { BARCODE_EANX, 12, "7654321+54321", 0, 1, 126, "Example of EAN-8 barcode with five-digit add-on, addon_gap 12",
"101011101101011110110001010001101010100001011011001100110111001010100000000000010110111001010100011010100001010010011010011001"
},
/* 27*/ { BARCODE_UPCA_CHK, 10, "210987654329+21", 0, 1, 125, "Example of UPC-A with 2-digit add-on, addon_gap 10",
"10100100110011001000110100010110110111011101101010101000010011101011100100001011011001110100101000000000010110010011010110011"
},
/* 28*/ { BARCODE_UPCA, 12, "21098765432+12121", 0, 1, 154, "Example of UPC-A with 5-digit add-on, addon_gap 12",
"1010010011001100100011010001011011011101110110101010100001001110101110010000101101100111010010100000000000010110011001010010011010110011010011011010011001"
},
/* 29*/ { BARCODE_UPCE_CHK, 8, "06543217+21", 0, 1, 79, "Example of UPC-A with 2-digit add-on, addon_gap 8",
"1010000101011000100111010111101001101100110010101010000000010110010011010110011"
},
/* 30*/ { BARCODE_UPCE, 11, "1654321+12121", 0, 1, 109, "Example of UPC-A with 5-digit add-on, addon_gap 11",
"1010101111011100101000110111101001101101100110101010000000000010110011001010010011010110011010011011010011001"
},
/* 31*/ { BARCODE_ISBNX, -1, "9789295055124", 0, 1, 95, "ISBN Users' Manual 7th Ed. 13.2",
"10101110110001001001011100100110010111011000101010111001010011101001110110011011011001011100101"
},
/* 32*/ { BARCODE_ISBNX, -1, "9780123456786+50995", 0, 1, 149, "BISG BGUSBI Figure 1: Bookland EAN (with Price Add-On) (and Figures 4, 5, 6)",
"10101110110001001010011100110010011011011110101010101110010011101010000100010010010001010000101000000010110110001010100111010001011010001011010111001"
},
/* 33*/ { BARCODE_ISBNX, -1, "9781402894626+50495", 0, 1, 149, "BISG BGUSBI Figure 2",
"10101110110001001011001101000110100111001001101010100100011101001011100101000011011001010000101000000010110111001010001101010100011010001011010111001"
},
/* 34*/ { BARCODE_ISBNX, 10, "9780940016644+50750", 0, 1, 152, "BISG BGUSBI Figure 3, addon_gap 10",
"10101110110001001010011100010110011101000110101010111001011001101010000101000010111001011100101000000000010110111001010001101010010001010110001010001101"
},
/* 35*/ { BARCODE_ISBNX, -1, "9791234567896+12", 0, 1, 122, "Example of ISBN with 2-digit add-on",
"10101110110010111011001100100110100001010001101010100111010100001000100100100011101001010000101000000010110011001010010011"
},
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);
char bwipp_buf[4096];
char bwipp_msg[1024];
for (int i = 0; i < data_size; i++) { for (int i = 0; i < data_size; i++) {
if (index != -1 && i != index) continue; if (index != -1 && i != index) continue;
@ -300,14 +413,14 @@ static void test_encode(int index, int generate, int debug) {
struct zint_symbol *symbol = ZBarcode_Create(); struct zint_symbol *symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n"); assert_nonnull(symbol, "Symbol not created\n");
int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, -1, -1, -1 /*output_options*/, data[i].data, -1, debug); int length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, -1 /*output_options*/, data[i].data, -1, debug);
ret = ZBarcode_Encode(symbol, data[i].data, length); ret = ZBarcode_Encode(symbol, data[i].data, length);
assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d\n", i, ret, data[i].ret); assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", i, ret, data[i].ret, symbol->errtxt);
if (generate) { if (generate) {
printf(" /*%3d*/ { %s, \"%s\", %s, %d, %d, \"%s\",\n", printf(" /*%3d*/ { %s, %d, \"%s\", %s, %d, %d, \"%s\",\n",
i, testUtilBarcodeName(data[i].symbology), data[i].data, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment); i, testUtilBarcodeName(data[i].symbology), data[i].option_2, data[i].data, testUtilErrorName(data[i].ret), symbol->rows, symbol->width, data[i].comment);
testUtilModulesDump(symbol, " ", "\n"); testUtilModulesDump(symbol, " ", "\n");
printf(" },\n"); printf(" },\n");
} else { } else {
@ -320,6 +433,15 @@ static void test_encode(int index, int generate, int debug) {
ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row); ret = testUtilModulesCmp(symbol, data[i].expected, &width, &row);
assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data); assert_zero(ret, "i:%d testUtilModulesCmp ret %d != 0 width %d row %d (%s)\n", i, ret, width, row, data[i].data);
} }
if (do_bwipp && testUtilCanBwipp(symbol->symbology, -1, data[i].option_2, -1, debug)) {
ret = testUtilBwipp(symbol, -1, data[i].option_2, -1, data[i].data, length, NULL, bwipp_buf, sizeof(bwipp_buf));
assert_zero(ret, "i:%d %s testUtilBwipp ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), ret);
ret = testUtilBwippCmp(symbol, bwipp_msg, bwipp_buf, data[i].expected);
assert_zero(ret, "i:%d %s testUtilBwippCmp %d != 0 %s\n actual: %s\nexpected: %s\n",
i, testUtilBarcodeName(data[i].symbology), ret, bwipp_msg, bwipp_buf, data[i].expected);
}
} }
} }

View File

@ -138,119 +138,130 @@ static void test_buffer_vector(int index, int generate, int debug) {
float expected_vector_height; float expected_vector_height;
}; };
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_CODE11, "0000000000", "", 50, 1, 99, 198.0, 118.0 }, /* 0*/ { BARCODE_CODE11, "0000000000", "", 50, 1, 99, 198, 118 },
/* 1*/ { BARCODE_C25MATRIX, "0000000000", "", 50, 1, 117, 234.0, 118.0 }, /* 1*/ { BARCODE_C25MATRIX, "0000000000", "", 50, 1, 117, 234, 118 },
/* 2*/ { BARCODE_C25INTER, "0000000000", "", 50, 1, 99, 198.0, 118.0 }, /* 2*/ { BARCODE_C25INTER, "0000000000", "", 50, 1, 99, 198, 118 },
/* 3*/ { BARCODE_C25IATA, "0000000000", "", 50, 1, 149, 298.0, 118.0 }, /* 3*/ { BARCODE_C25IATA, "0000000000", "", 50, 1, 149, 298, 118 },
/* 4*/ { BARCODE_C25LOGIC, "0000000000", "", 50, 1, 109, 218.0, 118.0 }, /* 4*/ { BARCODE_C25LOGIC, "0000000000", "", 50, 1, 109, 218, 118 },
/* 5*/ { BARCODE_C25IND, "0000000000", "", 50, 1, 159, 318.0, 118.0 }, /* 5*/ { BARCODE_C25IND, "0000000000", "", 50, 1, 159, 318, 118 },
/* 6*/ { BARCODE_CODE39, "0000000000", "", 50, 1, 155, 310.0, 118.0 }, /* 6*/ { BARCODE_CODE39, "0000000000", "", 50, 1, 155, 310, 118 },
/* 7*/ { BARCODE_EXCODE39, "0000000000", "", 50, 1, 155, 310.0, 118.0 }, /* 7*/ { BARCODE_EXCODE39, "0000000000", "", 50, 1, 155, 310, 118 },
/* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 230.0, 118.0 }, /* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 226, 118 },
/* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 230.0, 118.0 }, /* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 226, 118 },
/* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 124, 288.0, 118.0 }, /* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 122, 276, 118 },
/* 11*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 151, 342.0, 118.0 }, /* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 50, 1, 122, 276, 118 },
/* 12*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 134.0, 118.0 }, /* 12*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 149, 330, 118 },
/* 13*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 96, 192.0, 118.0 }, /* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 50, 1, 149, 330, 118 },
/* 14*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 123, 246.0, 118.0 }, /* 14*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 162, 118 },
/* 15*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 94.0, 118.0 }, /* 15*/ { BARCODE_EANX_CHK, "12345670", "", 50, 1, 67, 162, 118 },
/* 16*/ { BARCODE_EANX, "12", "", 50, 1, 20, 40.0, 118.0 }, /* 16*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 94, 216, 118 },
/* 17*/ { BARCODE_EAN128, "[01]12345678901234", "", 50, 1, 134, 268.0, 118.0 }, /* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", 50, 1, 94, 216, 118 },
/* 18*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204.0, 118.0 }, /* 18*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 121, 270, 118 },
/* 19*/ { BARCODE_CODE128, "0000000000", "", 50, 1, 90, 180.0, 118.0 }, /* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", 50, 1, 121, 270, 118 },
/* 20*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270.0, 118.0 }, /* 20*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 118, 118 },
/* 21*/ { BARCODE_DPIDENT, "12345678901", "", 50, 1, 117, 234.0, 118.0 }, /* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 118 },
/* 22*/ { BARCODE_CODE16K, "0000000000", "", 20, 2, 70, 162.0, 44.0 }, /* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 118 },
/* 23*/ { BARCODE_CODE49, "0000000000", "", 20, 2, 70, 162.0, 44.0 }, /* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 118 },
/* 24*/ { BARCODE_CODE93, "0000000000", "", 50, 1, 127, 254.0, 118.0 }, /* 24*/ { BARCODE_EAN128, "[01]12345678901234", "", 50, 1, 134, 268, 118 },
/* 25*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180.0, 100.0 }, /* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 118 },
/* 26*/ { BARCODE_RSS14, "1234567890123", "", 50, 1, 96, 192.0, 118.0 }, /* 26*/ { BARCODE_CODE128, "0000000000", "", 50, 1, 90, 180, 118 },
/* 27*/ { BARCODE_RSS_LTD, "1234567890123", "", 50, 1, 74, 148.0, 118.0 }, /* 27*/ { BARCODE_DPLEIT, "1234567890123", "", 50, 1, 135, 270, 118 },
/* 28*/ { BARCODE_RSS_EXP, "[01]12345678901234", "", 34, 1, 134, 268.0, 86.0 }, /* 28*/ { BARCODE_DPIDENT, "12345678901", "", 50, 1, 117, 234, 118 },
/* 29*/ { BARCODE_TELEPEN, "0000000000", "", 50, 1, 208, 416.0, 118.0 }, /* 29*/ { BARCODE_CODE16K, "0000000000", "", 20, 2, 70, 162, 44 },
/* 30*/ { BARCODE_UPCA, "12345678904", "", 50, 1, 95, 230.0, 118.0 }, /* 30*/ { BARCODE_CODE49, "0000000000", "", 20, 2, 70, 162, 44 },
/* 31*/ { BARCODE_UPCA_CHK, "12345678905", "", 50, 1, 95, 230.0, 118.0 }, /* 31*/ { BARCODE_CODE93, "0000000000", "", 50, 1, 127, 254, 118 },
/* 32*/ { BARCODE_UPCA, "12345678904+12", "", 50, 1, 124, 288.0, 118.0 }, /* 32*/ { BARCODE_FLAT, "1234567890", "", 50, 1, 90, 180, 100 },
/* 33*/ { BARCODE_UPCA, "12345678904+12345", "", 50, 1, 151, 342.0, 118.0 }, /* 33*/ { BARCODE_RSS14, "1234567890123", "", 50, 1, 96, 192, 118 },
/* 34*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 142.0, 118.0 }, /* 34*/ { BARCODE_RSS_LTD, "1234567890123", "", 50, 1, 74, 148, 118 },
/* 35*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 142.0, 118.0 }, /* 35*/ { BARCODE_RSS_EXP, "[01]12345678901234", "", 34, 1, 134, 268, 86 },
/* 36*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 80, 200.0, 118.0 }, /* 36*/ { BARCODE_TELEPEN, "0000000000", "", 50, 1, 208, 416, 118 },
/* 37*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 107, 254.0, 118.0 }, /* 37*/ { BARCODE_UPCA, "12345678904", "", 50, 1, 95, 226, 118 },
/* 38*/ { BARCODE_POSTNET, "00000000000", "", 12, 2, 185, 370.0, 24.0 }, /* 38*/ { BARCODE_UPCA_CHK, "123456789043", "", 50, 1, 95, 226, 118 },
/* 39*/ { BARCODE_MSI_PLESSEY, "0000000000", "", 50, 1, 127, 254.0, 118.0 }, /* 39*/ { BARCODE_UPCA, "12345678904+12", "", 50, 1, 124, 276, 118 },
/* 40*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34.0, 100.0 }, /* 40*/ { BARCODE_UPCA_CHK, "123456789043+12", "", 50, 1, 124, 276, 118 },
/* 41*/ { BARCODE_LOGMARS, "0000000000", "", 50, 1, 191, 382.0, 118.0 }, /* 41*/ { BARCODE_UPCA, "12345678904+12345", "", 50, 1, 151, 330, 118 },
/* 42*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116.0, 100.0 }, /* 42*/ { BARCODE_UPCA_CHK, "123456789043+12345", "", 50, 1, 151, 330, 118 },
/* 43*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284.0, 118.0 }, /* 43*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 134, 118 },
/* 44*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58.0, 20.0 }, /* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 134, 118 },
/* 45*/ { BARCODE_PDF417, "0000000000", "", 21, 7, 103, 206.0, 42.0 }, /* 45*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 78, 184, 118 },
/* 46*/ { BARCODE_PDF417TRUNC, "0000000000", "", 21, 7, 68, 136.0, 42.0 }, /* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 50, 1, 78, 184, 118 },
/* 47*/ { BARCODE_MAXICODE, "0000000000", "", 165, 33, 30, 74.0, 72.0 }, /* 47*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 105, 238, 118 },
/* 48*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42.0, 42.0 }, /* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 50, 1, 105, 238, 118 },
/* 49*/ { BARCODE_CODE128B, "0000000000", "", 50, 1, 145, 290.0, 118.0 }, /* 49*/ { BARCODE_POSTNET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 50*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266.0, 16.0 }, /* 50*/ { BARCODE_MSI_PLESSEY, "0000000000", "", 50, 1, 127, 254, 118 },
/* 51*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146.0, 16.0 }, /* 51*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34, 100 },
/* 52*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146.0, 16.0 }, /* 52*/ { BARCODE_LOGMARS, "0000000000", "", 50, 1, 191, 382, 118 },
/* 53*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146.0, 16.0 }, /* 53*/ { BARCODE_PHARMA, "123456", "", 50, 1, 58, 116, 100 },
/* 54*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 230.0, 118.0 }, /* 54*/ { BARCODE_PZN, "123456", "", 50, 1, 142, 284, 118 },
/* 55*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 124, 288.0, 118.0 }, /* 55*/ { BARCODE_PHARMA_TWO, "12345678", "", 10, 2, 29, 58, 20 },
/* 56*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 151, 342.0, 118.0 }, /* 56*/ { BARCODE_PDF417, "0000000000", "", 21, 7, 103, 206, 42 },
/* 57*/ { BARCODE_RM4SCC, "0000000000", "", 8, 3, 91, 182.0, 16.0 }, /* 57*/ { BARCODE_PDF417TRUNC, "0000000000", "", 21, 7, 68, 136, 42 },
/* 58*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20.0, 20.0 }, /* 58*/ { BARCODE_MAXICODE, "0000000000", "", 165, 33, 30, 74, 72 }, // Differs from raster
/* 59*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268.0, 118.0 }, /* 59*/ { BARCODE_QRCODE, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 60*/ { BARCODE_VIN, "00000000000000000", "", 50, 1, 246, 492.0, 118.0 }, /* 60*/ { BARCODE_CODE128B, "0000000000", "", 50, 1, 145, 290, 118 },
/* 61*/ { BARCODE_CODABLOCKF, "0000000000", "", 20, 2, 101, 242.0, 44.0 }, /* 61*/ { BARCODE_AUSPOST, "12345678901234567890123", "", 8, 3, 133, 266, 16 },
/* 62*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312.0, 118.0 }, /* 62*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146, 16 },
/* 63*/ { BARCODE_JAPANPOST, "0000000000", "", 8, 3, 133, 266.0, 16.0 }, /* 63*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146, 16 },
/* 64*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334.0, 118.0 }, /* 64*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146, 16 },
/* 65*/ { BARCODE_RSS14STACK, "0000000000000", "", 13, 3, 50, 100.0, 26.0 }, /* 65*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 226, 118 },
/* 66*/ { BARCODE_RSS14STACK_OMNI, "0000000000000", "", 69, 5, 50, 100.0, 138.0 }, /* 66*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 122, 276, 118 },
/* 67*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", "", 71, 5, 102, 204.0, 142.0 }, /* 67*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 149, 330, 118 },
/* 68*/ { BARCODE_PLANET, "00000000000", "", 12, 2, 185, 370.0, 24.0 }, /* 68*/ { BARCODE_RM4SCC, "0000000000", "", 8, 3, 91, 182, 16 },
/* 69*/ { BARCODE_MICROPDF417, "0000000000", "", 12, 6, 82, 164.0, 24.0 }, /* 69*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20, 20 },
/* 70*/ { BARCODE_ONECODE, "12345678901234567890", "", 8, 3, 129, 258.0, 16.0 }, /* 70*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268, 118 },
/* 71*/ { BARCODE_PLESSEY, "0000000000", "", 50, 1, 227, 454.0, 118.0 }, /* 71*/ { BARCODE_VIN, "00000000000000000", "", 50, 1, 246, 492, 118 },
/* 72*/ { BARCODE_TELEPEN_NUM, "0000000000", "", 50, 1, 128, 256.0, 118.0 }, /* 72*/ { BARCODE_CODABLOCKF, "0000000000", "", 20, 2, 101, 242, 44 },
/* 73*/ { BARCODE_ITF14, "0000000000", "", 50, 1, 135, 382.0, 150.0 }, /* 73*/ { BARCODE_NVE18, "12345678901234567", "", 50, 1, 156, 312, 118 },
/* 74*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174.0, 16.0 }, /* 74*/ { BARCODE_JAPANPOST, "0000000000", "", 8, 3, 133, 266, 16 },
/* 75*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30.0, 30.0 }, /* 75*/ { BARCODE_KOREAPOST, "123456", "", 50, 1, 167, 334, 118 },
/* 76*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62.0, 16.0 }, /* 76*/ { BARCODE_RSS14STACK, "0000000000000", "", 13, 3, 50, 100, 26 },
/* 77*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22.0, 22.0 }, /* 77*/ { BARCODE_RSS14STACK_OMNI, "0000000000000", "", 69, 5, 50, 100, 138 },
/* 78*/ { BARCODE_HIBC_128, "0000000000", "", 50, 1, 134, 268.0, 118.0 }, /* 78*/ { BARCODE_RSS_EXPSTACK, "[01]12345678901234", "", 71, 5, 102, 204, 142 },
/* 79*/ { BARCODE_HIBC_39, "0000000000", "", 50, 1, 223, 446.0, 118.0 }, /* 79*/ { BARCODE_PLANET, "00000000000", "", 12, 2, 185, 370, 24 },
/* 80*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24.0, 24.0 }, /* 80*/ { BARCODE_MICROPDF417, "0000000000", "", 12, 6, 82, 164, 24 },
/* 81*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42.0, 42.0 }, /* 81*/ { BARCODE_ONECODE, "12345678901234567890", "", 8, 3, 129, 258, 16 },
/* 82*/ { BARCODE_HIBC_PDF, "0000000000", "", 27, 9, 103, 206.0, 54.0 }, /* 82*/ { BARCODE_PLESSEY, "0000000000", "", 50, 1, 227, 454, 118 },
/* 83*/ { BARCODE_HIBC_MICPDF, "0000000000", "", 34, 17, 38, 76.0, 68.0 }, /* 83*/ { BARCODE_TELEPEN_NUM, "0000000000", "", 50, 1, 128, 256, 118 },
/* 84*/ { BARCODE_HIBC_BLOCKF, "0000000000", "", 30, 3, 101, 242.0, 64.0 }, /* 84*/ { BARCODE_ITF14, "0000000000", "", 50, 1, 135, 330, 138 },
/* 85*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38.0, 38.0 }, /* 85*/ { BARCODE_KIX, "123456ABCDE", "", 8, 3, 87, 174, 16 },
/* 86*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 32.0, 22.0 }, /* 86*/ { BARCODE_AZTEC, "1234567890AB", "", 15, 15, 15, 30, 30 },
/* 87*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46.0, 46.0 }, /* 87*/ { BARCODE_DAFT, "DAFTDAFTDAFTDAFT", "", 8, 3, 31, 62, 16 },
/* 88*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310.0, 20.0 }, /* 88*/ { BARCODE_MICROQR, "12345", "", 11, 11, 11, 22, 22 },
/* 89*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22.0, 22.0 }, /* 89*/ { BARCODE_HIBC_128, "0000000000", "", 50, 1, 134, 268, 118 },
/* 90*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206.0, 118.0 }, /* 90*/ { BARCODE_HIBC_39, "0000000000", "", 50, 1, 223, 446, 118 },
/* 91*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 238.0, 118.0 }, /* 91*/ { BARCODE_HIBC_DM, "ABC", "", 12, 12, 12, 24, 24 },
/* 92*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 128, 296.0, 118.0 }, /* 92*/ { BARCODE_HIBC_QR, "1234567890AB", "", 21, 21, 21, 42, 42 },
/* 93*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 155, 350.0, 118.0 }, /* 93*/ { BARCODE_HIBC_PDF, "0000000000", "", 27, 9, 103, 206, 54 },
/* 94*/ { BARCODE_EAN128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290.0, 118.0 }, /* 94*/ { BARCODE_HIBC_MICPDF, "0000000000", "", 34, 17, 38, 76, 68 },
/* 95*/ { BARCODE_RSS14_CC, "1234567890123", "[20]01", 21, 5, 100, 200.0, 60.0 }, /* 95*/ { BARCODE_HIBC_BLOCKF, "0000000000", "", 30, 3, 101, 242, 64 },
/* 96*/ { BARCODE_RSS_LTD_CC, "1234567890123", "[20]01", 19, 6, 74, 148.0, 56.0 }, /* 96*/ { BARCODE_HIBC_AZTEC, "1234567890AB", "", 19, 19, 19, 38, 38 },
/* 97*/ { BARCODE_RSS_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268.0, 100.0 }, /* 97*/ { BARCODE_DOTCODE, "ABC", "", 11, 11, 16, 32, 22 }, // Differs from raster
/* 98*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 238.0, 118.0 }, /* 98*/ { BARCODE_HANXIN, "1234567890AB", "", 23, 23, 23, 46, 46 },
/* 99*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 296.0, 118.0 }, /* 99*/ { BARCODE_MAILMARK, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 },
/*100*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 350.0, 118.0 }, /*100*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 },
/*101*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 150.0, 118.0 }, /*101*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 118 },
/*102*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 84, 208.0, 118.0 }, /*102*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 234, 118 },
/*103*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 111, 262.0, 118.0 }, /*103*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 126, 284, 118 },
/*104*/ { BARCODE_RSS14STACK_CC, "0000000000000", "[20]01", 24, 9, 56, 112.0, 48.0 }, /*104*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 153, 338, 118 },
/*105*/ { BARCODE_RSS14_OMNI_CC, "0000000000000", "[20]01", 80, 11, 56, 112.0, 160.0 }, /*105*/ { BARCODE_EAN128_CC, "[01]12345678901234", "[20]01", 50, 5, 145, 290, 118 },
/*106*/ { BARCODE_RSS_EXPSTACK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204.0, 156.0 }, /*106*/ { BARCODE_RSS14_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60 },
/*107*/ { BARCODE_CHANNEL, "00", "", 50, 1, 19, 38.0, 118.0 }, /*107*/ { BARCODE_RSS_LTD_CC, "1234567890123", "[20]01", 19, 6, 74, 148, 56 },
/*108*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44.0, 44.0 }, /*108*/ { BARCODE_RSS_EXP_CC, "[01]12345678901234", "[20]01", 41, 5, 134, 268, 100 },
/*109*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36.0, 36.0 }, /*109*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 118 },
/*110*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154.0, 154.0 }, /*110*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 118 },
/*111*/ { BARCODE_ULTRA, "0000000000", "", 13, 13, 18, 36.0, 26.0 }, /*111*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 118 },
/*112*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54.0, 22.0 }, /*112*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 142, 118 },
/*113*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 82, 192, 118 },
/*114*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 118 },
/*115*/ { BARCODE_RSS14STACK_CC, "0000000000000", "[20]01", 24, 9, 56, 112, 48 },
/*116*/ { BARCODE_RSS14_OMNI_CC, "0000000000000", "[20]01", 80, 11, 56, 112, 160 },
/*117*/ { BARCODE_RSS_EXPSTACK_CC, "[01]12345678901234", "[20]01", 78, 9, 102, 204, 156 },
/*118*/ { BARCODE_CHANNEL, "00", "", 50, 1, 19, 38, 118 },
/*119*/ { BARCODE_CODEONE, "12345678901234567890", "", 22, 22, 22, 44, 44 },
/*120*/ { BARCODE_GRIDMATRIX, "ABC", "", 18, 18, 18, 36, 36 },
/*121*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
/*122*/ { BARCODE_ULTRA, "0000000000", "", 13, 13, 18, 36, 26 },
/*123*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 },
}; };
int data_size = sizeof(data) / sizeof(struct item); int data_size = sizeof(data) / sizeof(struct item);
@ -323,34 +334,46 @@ static void test_upcean_hrt(int index, int debug) {
}; };
// s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<")) // s/\/\*[ 0-9]*\*\//\=printf("\/*%3d*\/", line(".") - line("'<"))
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 230.0, 118.0, 10, -1 }, // EAN-13 /* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 230.0, 118.0, 8, -1 }, // EAN-13
/* 1*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 230.0, 118.0, -1, -1 }, // EAN-13 /* 1*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 230.0, 118.0, -1, -1 }, // EAN-13
/* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 230.0, 118.0, 10, -1 }, // EAN-13 /* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 230.0, 118.0, 8, -1 }, // EAN-13
/* 3*/ { BARCODE_EANX_CHK, 0, "1234567890128", 0, 50, 1, 95, 230.0, 118.0, -1, -1 }, // EAN-13 /* 3*/ { BARCODE_EANX_CHK, 0, "1234567890128", 0, 50, 1, 95, 230.0, 118.0, -1, -1 }, // EAN-13
/* 4*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 124, 288.0, 118.0, 10, 70 }, // EAN-13 + EAN-2 /* 4*/ { BARCODE_ISBNX, -1, "9784567890120", 0, 50, 1, 95, 230.0, 118.0, 8, -1 },
/* 5*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 124, 288.0, 118.0, -1, -1 }, // EAN-13 + EAN-2 /* 5*/ { BARCODE_ISBNX, 0, "9784567890120", 0, 50, 1, 95, 230.0, 118.0, -1, -1 },
/* 6*/ { BARCODE_EANX, -1, "123456789012+12345", 0, 50, 1, 151, 342.0, 118.0, 10, 70 }, // EAN-13 + EAN-5 /* 6*/ { BARCODE_EANX, -1, "1234567", 0, 50, 1, 67, 134.0, 118.0, 48, -1 }, // EAN-8
/* 7*/ { BARCODE_EANX, 0, "123456789012+12345", 0, 50, 1, 151, 342.0, 118.0, -1, -1 }, // EAN-13 + EAN-5 /* 7*/ { BARCODE_EANX, 0, "1234567", 0, 50, 1, 67, 134.0, 118.0, -1, -1 }, // EAN-8
/* 8*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 151, 342.0, 118.0, 10, 70 }, // ISBNX + EAN-5 /* 8*/ { BARCODE_EANX, -1, "1234", 0, 50, 1, 47, 94.0, 118.0, 61, -1 }, // EAN-5
/* 9*/ { BARCODE_ISBNX, 0, "9784567890120+12345", 0, 50, 1, 151, 342.0, 118.0, -1, -1 }, // ISBNX + EAN-5 /* 9*/ { BARCODE_EANX, 0, "1234", 0, 50, 1, 47, 94.0, 118.0, -1, -1 }, // EAN-5
/* 10*/ { BARCODE_EANX, -1, "1234567", 0, 50, 1, 67, 134.0, 118.0, 34, -1 }, // EAN-8 /* 10*/ { BARCODE_EANX, -1, "12", 0, 50, 1, 20, 40.0, 118.0, 34, -1 }, // EAN-2
/* 11*/ { BARCODE_EANX, 0, "1234567", 0, 50, 1, 67, 134.0, 118.0, -1, -1 }, // EAN-8 /* 11*/ { BARCODE_EANX, 0, "12", 0, 50, 1, 20, 40.0, 118.0, -1, -1 }, // EAN-2
/* 12*/ { BARCODE_EANX, -1, "1234567+12", 0, 50, 1, 96, 192.0, 118.0, 34, 100 }, // EAN-8 + EAN-2 /* 12*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 230.0, 118.0, 8, -1 },
/* 13*/ { BARCODE_EANX, 0, "1234567+12", 0, 50, 1, 96, 192.0, 118.0, -1, -1 }, // EAN-8 + EAN-2 /* 13*/ { BARCODE_UPCA, 0, "12345678901", 0, 50, 1, 95, 230.0, 118.0, -1, -1 },
/* 14*/ { BARCODE_EANX, -1, "1234567+12345", 0, 50, 1, 123, 246.0, 118.0, 34, 100 }, // EAN-8 + EAN-5 /* 14*/ { BARCODE_UPCA_CHK, -1, "123456789012", 0, 50, 1, 95, 230.0, 118.0, 8, -1 },
/* 15*/ { BARCODE_EANX, 0, "1234567+12345", 0, 50, 1, 123, 246.0, 118.0, -1, -1 }, // EAN-8 + EAN-5 /* 15*/ { BARCODE_UPCA_CHK, 0, "123456789012", 0, 50, 1, 95, 230.0, 118.0, -1, -1 },
/* 16*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 230.0, 118.0, 10, -1 }, /* 16*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 142.0, 118.0, 8, -1 },
/* 17*/ { BARCODE_UPCA, 0, "12345678901", 0, 50, 1, 95, 230.0, 118.0, -1, -1 }, /* 17*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 142.0, 118.0, -1, -1 },
/* 18*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 288.0, 118.0, 10, 74 }, /* 18*/ { BARCODE_UPCE_CHK, -1, "12345670", 0, 50, 1, 51, 142.0, 118.0, 8, -1 },
/* 19*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 288.0, 118.0, -1, -1 }, /* 19*/ { BARCODE_UPCE_CHK, 0, "12345670", 0, 50, 1, 51, 142.0, 118.0, -1, -1 },
/* 20*/ { BARCODE_UPCA_CHK, -1, "123456789012+12345", 0, 50, 1, 151, 342.0, 118.0, 10, 74 }, /* 20*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276.0, 118.0, 8, 70 }, // EAN-13 + EAN-2
/* 21*/ { BARCODE_UPCA_CHK, 0, "123456789012+12345", 0, 50, 1, 151, 342.0, 118.0, -1, -1 }, /* 21*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 122, 276.0, 118.0, -1, -1 }, // EAN-13 + EAN-2
/* 22*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 142.0, 118.0, 10, -1 }, /* 22*/ { BARCODE_ISBNX, -1, "9784567890120+12", 0, 50, 1, 122, 276.0, 118.0, 8, 70 }, // ISBN + EAN-2
/* 23*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 142.0, 118.0, -1, -1 }, /* 23*/ { BARCODE_ISBNX, 0, "9784567890120+12", 0, 50, 1, 122, 276.0, 118.0, -1, -1 }, // ISBN + EAN-2
/* 24*/ { BARCODE_UPCE_CHK, -1, "12345670+12", 0, 50, 1, 80, 200.0, 118.0, 10, 68 }, /* 24*/ { BARCODE_EANX, -1, "123456789012+12345", 0, 50, 1, 149, 330.0, 118.0, 8, 70 }, // EAN-13 + EAN-5
/* 25*/ { BARCODE_UPCE_CHK, 0, "12345670+12", 0, 50, 1, 80, 200.0, 118.0, -1, -1 }, /* 25*/ { BARCODE_EANX, 0, "123456789012+12345", 0, 50, 1, 149, 330.0, 118.0, -1, -1 }, // EAN-13 + EAN-5
/* 26*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 107, 254.0, 118.0, 10, 68 }, /* 26*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 149, 330.0, 118.0, 8, 70 }, // ISBN + EAN-5
/* 27*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 107, 254.0, 118.0, -1, -1 }, /* 27*/ { BARCODE_ISBNX, 0, "9784567890120+12345", 0, 50, 1, 149, 330.0, 118.0, -1, -1 }, // ISBN + EAN-5
/* 28*/ { BARCODE_EANX, -1, "1234567+12", 0, 50, 1, 94, 216.0, 118.0, 48, 114 }, // EAN-8 + EAN-2
/* 29*/ { BARCODE_EANX, 0, "1234567+12", 0, 50, 1, 94, 216.0, 118.0, -1, -1 }, // EAN-8 + EAN-2
/* 30*/ { BARCODE_EANX, -1, "1234567+12345", 0, 50, 1, 121, 270.0, 118.0, 48, 114 }, // EAN-8 + EAN-5
/* 31*/ { BARCODE_EANX, 0, "1234567+12345", 0, 50, 1, 121, 270.0, 118.0, -1, -1 }, // EAN-8 + EAN-5
/* 32*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 288.0, 118.0, 8, 72 },
/* 33*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 288.0, 118.0, -1, -1 },
/* 34*/ { BARCODE_UPCA, -1, "12345678901+12345", 0, 50, 1, 151, 342.0, 118.0, 8, 72 },
/* 35*/ { BARCODE_UPCA, 0, "12345678901+12345", 0, 50, 1, 151, 342.0, 118.0, -1, -1 },
/* 36*/ { BARCODE_UPCE, -1, "1234567+12", 0, 50, 1, 78, 184.0, 118.0, 8, 66 },
/* 37*/ { BARCODE_UPCE, 0, "1234567+12", 0, 50, 1, 78, 184.0, 118.0, -1, -1 },
/* 38*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238.0, 118.0, 8, 66 },
/* 39*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238.0, 118.0, -1, -1 },
}; };
int data_size = sizeof(data) / sizeof(struct item); int data_size = sizeof(data) / sizeof(struct item);
@ -647,10 +670,10 @@ static void test_upcean_whitespace_width(int index, int debug) {
}; };
// s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<")) // s/\/\*[ 0-9]*\*\//\=printf("\/*%2d*\/", line(".") - line("'<"))
struct item data[] = { struct item data[] = {
/* 0*/ { BARCODE_UPCA, "12345678904+12345", 0, 151, 342.0, 5, 16.0 }, /* 0*/ { BARCODE_UPCA, "12345678904+12345", 0, 151, 330.0, 5, 16.0 },
/* 1*/ { BARCODE_UPCA, "12345678904+12345", 11, 151, 342.0 + 4 * (11 - 10), 5, 16.0 }, /* 1*/ { BARCODE_UPCA, "12345678904+12345", 11, 151, 330.0 + 4 * 11, 5, 16.0 },
/* 2*/ { BARCODE_UPCE, "1234567+12", 0, 80, 200.0, 4, 16.0 }, /* 2*/ { BARCODE_UPCE, "1234567+12", 0, 78, 184.0, 4, 16.0 },
/* 3*/ { BARCODE_UPCE, "1234567+12", 8, 80, 200.0 + 4 * (8 - 10), 4, 16.0 }, // Note: change from previous behaviour where if whitespace < 10 then set to 10 /* 3*/ { BARCODE_UPCE, "1234567+12", 8, 78, 184.0 + 4 * 8, 4, 16.0 }, // Note: change from previous behaviour where if whitespace < 10 then set to 10
}; };
int data_size = sizeof(data) / sizeof(struct item); int data_size = sizeof(data) / sizeof(struct item);

View File

@ -383,7 +383,7 @@ char *testUtilBarcodeName(int symbology) {
return ""; return "";
} }
if (data[symbology].val != symbology || (data[symbology].define != -1 && data[symbology].define != symbology)) { // Self-check if (data[symbology].val != symbology || (data[symbology].define != -1 && data[symbology].define != symbology)) { // Self-check
fprintf(stderr, "testUtilBarcodeName data table out of sync (%d)\n", symbology); fprintf(stderr, "testUtilBarcodeName: data table out of sync (%d)\n", symbology);
abort(); abort();
} }
return data[symbology].name; return data[symbology].name;
@ -443,7 +443,7 @@ char *testUtilErrorName(int error_number) {
return ""; return "";
} }
if (data[error_number].val != error_number || (data[error_number].define != -1 && data[error_number].define != error_number)) { // Self-check if (data[error_number].val != error_number || (data[error_number].define != -1 && data[error_number].define != error_number)) { // Self-check
fprintf(stderr, "testUtilErrorName data table out of sync (%d)\n", error_number); fprintf(stderr, "testUtilErrorName: data table out of sync (%d)\n", error_number);
abort(); abort();
} }
return data[error_number].name; return data[error_number].name;
@ -474,7 +474,7 @@ char *testUtilInputModeName(int input_mode) {
return input_mode == -1 ? "-1" : ""; return input_mode == -1 ? "-1" : "";
} }
if (data[input_mode].val != input_mode || (data[input_mode].define != -1 && data[input_mode].define != input_mode)) { // Self-check if (data[input_mode].val != input_mode || (data[input_mode].define != -1 && data[input_mode].define != input_mode)) { // Self-check
fprintf(stderr, "testUtilInputModeName data table out of sync (%d)\n", input_mode); fprintf(stderr, "testUtilInputModeName: data table out of sync (%d)\n", input_mode);
abort(); abort();
} }
return data[input_mode].name; return data[input_mode].name;
@ -487,7 +487,11 @@ char *testUtilOption3Name(int option_3) {
case ZINT_FULL_MULTIBYTE: return "ZINT_FULL_MULTIBYTE"; case ZINT_FULL_MULTIBYTE: return "ZINT_FULL_MULTIBYTE";
case ULTRA_COMPRESSION: return "ULTRA_COMPRESSION"; case ULTRA_COMPRESSION: return "ULTRA_COMPRESSION";
} }
return "-1"; if (option_3 != -1 && option_3 != 0) {
fprintf(stderr, "testUtilOption3Name: unknown value (%d)\n", option_3);
abort();
}
return option_3 ? "-1" : "0";
} }
char *testUtilOutputOptionsName(int output_options) { char *testUtilOutputOptionsName(int output_options) {
@ -523,7 +527,7 @@ char *testUtilOutputOptionsName(int output_options) {
buf[0] = '\0'; buf[0] = '\0';
for (i = 0; i < data_size; i++) { for (i = 0; i < data_size; i++) {
if (data[i].define != data[i].val) { // Self-check if (data[i].define != data[i].val) { // Self-check
fprintf(stderr, "testUtilOutputOptionsName data table out of sync (%d)\n", i); fprintf(stderr, "testUtilOutputOptionsName: data table out of sync (%d)\n", i);
abort(); abort();
} }
if (output_options & data[i].define) { if (output_options & data[i].define) {
@ -531,9 +535,13 @@ char *testUtilOutputOptionsName(int output_options) {
strcat(buf, " | "); strcat(buf, " | ");
} }
strcat(buf, data[i].name); strcat(buf, data[i].name);
set = 1; set |= data[i].define;
} }
} }
if (set != output_options) {
fprintf(stderr, "testUtilOutputOptionsName: unknown output option(s) %d (%d)\n", output_options & set, output_options);
abort();
}
return buf; return buf;
} }
@ -1472,10 +1480,10 @@ static char *testUtilBwippName(int symbology, int option_1, int option_2, int op
{ "", -1, 10, 0, 0, 0, 0, 0, }, { "", -1, 10, 0, 0, 0, 0, 0, },
{ "", -1, 11, 0, 0, 0, 0, 0, }, { "", -1, 11, 0, 0, 0, 0, 0, },
{ "", -1, 12, 0, 0, 0, 0, 0, }, { "", -1, 12, 0, 0, 0, 0, 0, },
{ "ean13", BARCODE_EANX, 13, 0, 0, 0, 0, 0, }, { "ean13", BARCODE_EANX, 13, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "ean13", BARCODE_EANX_CHK, 14, 0, 0, 0, 0, 0, }, { "ean13", BARCODE_EANX_CHK, 14, 0, 1, 0, 0, 1, },
{ "", -1, 15, 0, 0, 0, 0, 0, }, { "", -1, 15, 0, 0, 0, 0, 0, },
{ "gs1-128", BARCODE_EAN128, 16, 0, 0, 0, 0, 1 /*gs1_cnt*/, }, { "gs1-128", BARCODE_EAN128, 16, 0, 0, 0, 0, 1 /*gs1_cvt*/, },
{ "", -1, 17, 0, 0, 0, 0, 0, }, { "", -1, 17, 0, 0, 0, 0, 0, },
{ "rationalizedCodabar", BARCODE_CODABAR, 18, 0, 0, 0, 0, 0, }, { "rationalizedCodabar", BARCODE_CODABAR, 18, 0, 0, 0, 0, 0, },
{ "", -1, 19, 0, 0, 0, 0, 0, }, { "", -1, 19, 0, 0, 0, 0, 0, },
@ -1493,11 +1501,11 @@ static char *testUtilBwippName(int symbology, int option_1, int option_2, int op
{ "databarexpanded", BARCODE_RSS_EXP, 31, 0, 1, 0, 1 /*linear_row_height*/, 1, }, { "databarexpanded", BARCODE_RSS_EXP, 31, 0, 1, 0, 1 /*linear_row_height*/, 1, },
{ "telepen", BARCODE_TELEPEN, 32, 0, 0, 0, 0, 0, }, { "telepen", BARCODE_TELEPEN, 32, 0, 0, 0, 0, 0, },
{ "", -1, 33, 0, 0, 0, 0, 0, }, { "", -1, 33, 0, 0, 0, 0, 0, },
{ "upca", BARCODE_UPCA, 34, 0, 0, 0, 0, 0, }, { "upca", BARCODE_UPCA, 34, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "upca", BARCODE_UPCA_CHK, 35, 0, 0, 0, 0, 0, }, { "upca", BARCODE_UPCA_CHK, 35, 0, 1, 0, 0, 1, },
{ "", -1, 36, 0, 0, 0, 0, 0, }, { "", -1, 36, 0, 0, 0, 0, 0, },
{ "upce", BARCODE_UPCE, 37, 0, 0, 0, 0, 0, }, { "upce", BARCODE_UPCE, 37, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "upce", BARCODE_UPCE_CHK, 38, 0, 0, 0, 0, 0, }, { "upce", BARCODE_UPCE_CHK, 38, 0, 1, 0, 0, 1, },
{ "", -1, 39, 0, 0, 0, 0, 0, }, { "", -1, 39, 0, 0, 0, 0, 0, },
{ "postnet", BARCODE_POSTNET, 40, 0, 0, 0, 0, 0, }, { "postnet", BARCODE_POSTNET, 40, 0, 0, 0, 0, 0, },
{ "", -1, 41, 0, 0, 0, 0, 0, }, { "", -1, 41, 0, 0, 0, 0, 0, },
@ -1528,7 +1536,7 @@ static char *testUtilBwippName(int symbology, int option_1, int option_2, int op
{ "", BARCODE_AUSREPLY, 66, 0, 0, 0, 0, 0, }, { "", BARCODE_AUSREPLY, 66, 0, 0, 0, 0, 0, },
{ "", BARCODE_AUSROUTE, 67, 0, 0, 0, 0, 0, }, { "", BARCODE_AUSROUTE, 67, 0, 0, 0, 0, 0, },
{ "", BARCODE_AUSREDIRECT, 68, 0, 0, 0, 0, 0, }, { "", BARCODE_AUSREDIRECT, 68, 0, 0, 0, 0, 0, },
{ "isbn", BARCODE_ISBNX, 69, 0, 0, 0, 0, 0, }, { "isbn", BARCODE_ISBNX, 69, 0, 1, 0, 0, 1 /*gs1_cvt*/, },
{ "royalmail", BARCODE_RM4SCC, 70, 0, 0, 0, 0, 0, }, { "royalmail", BARCODE_RM4SCC, 70, 0, 0, 0, 0, 0, },
{ "datamatrix", BARCODE_DATAMATRIX, 71, 0, 0, 0, 0, 0, }, { "datamatrix", BARCODE_DATAMATRIX, 71, 0, 0, 0, 0, 0, },
{ "ean14", BARCODE_EAN14, 72, 0, 0, 0, 0, 1 /*gs1_cvt*/, }, { "ean14", BARCODE_EAN14, 72, 0, 0, 0, 0, 1 /*gs1_cvt*/, },
@ -1612,7 +1620,7 @@ static char *testUtilBwippName(int symbology, int option_1, int option_2, int op
return NULL; return NULL;
} }
if (data[symbology].val != symbology || (data[symbology].define != -1 && data[symbology].define != symbology)) { // Self-check if (data[symbology].val != symbology || (data[symbology].define != -1 && data[symbology].define != symbology)) { // Self-check
fprintf(stderr, "testUtilBarcodeName data table out of sync (%d)\n", symbology); fprintf(stderr, "testUtilBwippName: data table out of sync (%d)\n", symbology);
abort(); abort();
} }
if (data[symbology].name[0] == '\0') { if (data[symbology].name[0] == '\0') {
@ -1654,14 +1662,22 @@ int testUtilCanBwipp(int symbology, int option_1, int option_2, int option_3, in
return 0; return 0;
} }
static void testUtilBwippCvtGS1Data(char *bwipp_data) { static void testUtilBwippCvtGS1Data(char *bwipp_data, int upcean, int *addon_posn) {
char *b; char *b;
int pipe = 0;
*addon_posn = 0;
for (b = bwipp_data; *b; b++) { for (b = bwipp_data; *b; b++) {
if (upcean && *b == '|') {
pipe = 1;
}
if (*b == '[') { if (*b == '[') {
*b = '('; *b = '(';
} else if (*b == ']') { } else if (*b == ']') {
*b = ')'; *b = ')';
} else if (*b == '+' && upcean && !pipe) {
*b = ' ';
*addon_posn = b - bwipp_data;
} }
} }
} }
@ -1693,6 +1709,24 @@ static char *testUtilBwippEscape(char *bwipp_data, int bwipp_data_size, const ch
return bwipp_data; return bwipp_data;
} }
static void testUtilISBNHyphenate(char *bwipp_data, int addon_posn) {
/* Hack in 4 hyphens in fixed format, wrong for many ISBNs */
char temp[13 + 4 + 1 + 5 + 1];
int len = strlen(bwipp_data);
int i, j;
if (len < 13 || (addon_posn && addon_posn < 13 ) || len >= (int) sizeof(temp)) {
return;
}
for (i = 0, j = 0; i <= len; i++, j++) {
if (i == 3 || i == 5 || i == 10 || i == 12) {
temp[j++] = '-';
}
temp[j] = bwipp_data[i];
}
strcpy(bwipp_data, temp);
}
#define GS_INITIAL_LEN 35 /* Length of cmd up to -q */ #define GS_INITIAL_LEN 35 /* Length of cmd up to -q */
int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2, int option_3, const char *data, int length, const char *primary, char *buffer, int buffer_size) { int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2, int option_3, const char *data, int length, const char *primary, char *buffer, int buffer_size) {
@ -1704,7 +1738,7 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
int symbology = symbol->symbology; int symbology = symbol->symbology;
int data_len = length == -1 ? (int) strlen(data) : length; int data_len = length == -1 ? (int) strlen(data) : length;
int primary_len = primary ? (int) strlen(primary) : 0; int primary_len = primary ? (int) strlen(primary) : 0;
int max_data_len = 4 + primary_len + 1 + 1 + data_len * 4; /* 4 AI prefix + primary + '|' + leading zero + escaped data */ int max_data_len = 4 + primary_len + 1 + 1 + data_len * 4 + 32; /* 4 AI prefix + primary + '|' + leading zero + escaped data + fudge */
char cmd[max_data_len + 1024]; char cmd[max_data_len + 1024];
char *bwipp_barcode = NULL; char *bwipp_barcode = NULL;
@ -1723,6 +1757,10 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
int r, h; int r, h;
int parse; int parse;
int upcean = is_extendable(symbology);
int upca = symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC;
int addon_posn;
bwipp_data[0] = bwipp_opts_buf[0] = '\0'; bwipp_data[0] = bwipp_opts_buf[0] = '\0';
bwipp_barcode = testUtilBwippName(symbology, option_1, option_2, option_3, &linear_row_height, &gs1_cvt); bwipp_barcode = testUtilBwippName(symbology, option_1, option_2, option_3, &linear_row_height, &gs1_cvt);
@ -1739,20 +1777,27 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
} }
if (is_composite(symbology)) { if (is_composite(symbology)) {
if (symbology == BARCODE_EANX_CC && primary_len <= 7) {
bwipp_barcode = "ean8composite";
}
if (!primary) { if (!primary) {
fprintf(stderr, "testUtilBwipp: no primary data given %s\n", testUtilBarcodeName(symbology)); fprintf(stderr, "testUtilBwipp: no primary data given %s\n", testUtilBarcodeName(symbology));
return -1; return -1;
} }
if (*primary != '[' && symbology != BARCODE_EANX_CC && symbology != BARCODE_UPCE_CC && symbology != BARCODE_UPCA_CC) { if (*primary != '[' && !upcean) {
strcat(bwipp_data, "(01)"); strcat(bwipp_data, "(01)");
} }
strcat(bwipp_data, primary); strcat(bwipp_data, primary);
strcat(bwipp_data, "|"); strcat(bwipp_data, "|");
strcat(bwipp_data, data); strcat(bwipp_data, data);
testUtilBwippCvtGS1Data(bwipp_data); testUtilBwippCvtGS1Data(bwipp_data, upcean, &addon_posn);
if (upcean) {
if (symbology == BARCODE_EANX_CC && (primary_len <= 8 || (addon_posn && addon_posn <= 8))) {
bwipp_barcode = "ean8composite";
}
if (addon_posn) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%saddongap=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 > 0 ? option_2 : upca ? 9 : 7);
bwipp_opts = bwipp_opts_buf;
}
}
if (option_1 > 0) { if (option_1 > 0) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sccversion=%c", strlen(bwipp_opts_buf) ? " " : "", option_1 == 1 ? 'a' : option_1 == 2 ? 'b' : 'c'); sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%sccversion=%c", strlen(bwipp_opts_buf) ? " " : "", option_1 == 1 ? 'a' : option_1 == 2 ? 'b' : 'c');
@ -1764,11 +1809,24 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
} }
} else { } else {
if (gs1_cvt) { if (gs1_cvt) {
if (*data != '[') { if (*data != '[' && !upcean) {
strcat(bwipp_data, symbology == BARCODE_NVE18 ? "(00)" : "(01)"); strcat(bwipp_data, symbology == BARCODE_NVE18 ? "(00)" : "(01)");
} }
strcat(bwipp_data, data); strcat(bwipp_data, data);
testUtilBwippCvtGS1Data(bwipp_data); testUtilBwippCvtGS1Data(bwipp_data, upcean, &addon_posn);
if (upcean) {
if ((symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK) && (data_len <= 8 || (addon_posn && addon_posn <= 8))) {
bwipp_barcode = data_len <= 3 ? "ean2" : data_len <= 5 ? "ean5" : "ean8";
}
if (symbology == BARCODE_ISBNX) {
testUtilISBNHyphenate(bwipp_data, addon_posn);
}
if (addon_posn) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%saddongap=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 > 0 ? option_2 : upca ? 9 : 7);
bwipp_opts = bwipp_opts_buf;
}
}
if (option_2 > 0) { if (option_2 > 0) {
if (symbology == BARCODE_RSS_EXP || symbology == BARCODE_RSS_EXPSTACK) { if (symbology == BARCODE_RSS_EXP || symbology == BARCODE_RSS_EXPSTACK) {
@ -1802,13 +1860,11 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
if (option_1 > 0) { if (option_1 > 0) {
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%srows=%d", strlen(bwipp_opts_buf) ? " " : "", option_1); sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%srows=%d", strlen(bwipp_opts_buf) ? " " : "", option_1);
} }
//} else { /* BWIPP does not really support both row and column given */ if (option_2 > 0) {
if (option_2 > 0) { sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 - 5);
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", option_2 - 5); } else {
} else { sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", (symbol->width - 57) / 11);
sprintf(bwipp_opts_buf + (int) strlen(bwipp_opts_buf), "%scolumns=%d", strlen(bwipp_opts_buf) ? " " : "", (symbol->width - 57) / 11); }
}
//}
bwipp_opts = bwipp_opts_buf; bwipp_opts = bwipp_opts_buf;
} else if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_LOGMARS) { } else if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_LOGMARS) {
if (option_2 > 0) { if (option_2 > 0) {
@ -1843,19 +1899,35 @@ int testUtilBwipp(const struct zint_symbol *symbol, int option_1, int option_2,
/* Hack in various adjustments */ /* Hack in various adjustments */
if (symbology == BARCODE_RSS14 || symbology == BARCODE_RSS_LTD || symbology == BARCODE_RSS_EXP) { if (symbology == BARCODE_RSS14 || symbology == BARCODE_RSS_LTD || symbology == BARCODE_RSS_EXP) {
/* Begin with space */ /* Begin with space */
memmove(cmd + GS_INITIAL_LEN + 5, cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN); char adj[5] = " -sbs";
memcpy(cmd + GS_INITIAL_LEN, " -sbs", 5); memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
} }
if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_PZN || symbology == BARCODE_VIN) { if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_PZN || symbology == BARCODE_VIN) {
/* Ratio 3 width bar/space -> 2 width */ /* Ratio 3 width bar/space -> 2 width */
memmove(cmd + GS_INITIAL_LEN + 8, cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN); char adj[8] = " -sr=0.6";
memcpy(cmd + GS_INITIAL_LEN, " -sr=0.6", 8); memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
}
if (symbology == BARCODE_C25INTER || symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT || symbology == BARCODE_ITF14) {
/* Ratio 2 width bar/space -> 3 width */
char adj[8] = " -sr=1.3";
memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
} }
if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_HIBC_39 if (symbology == BARCODE_CODE11 || symbology == BARCODE_CODE39 || symbology == BARCODE_EXCODE39 || symbology == BARCODE_HIBC_39
|| symbology == BARCODE_LOGMARS || symbology == BARCODE_PZN || symbology == BARCODE_VIN) { || symbology == BARCODE_LOGMARS || symbology == BARCODE_PZN || symbology == BARCODE_VIN
|| symbology == BARCODE_C25INTER || symbology == BARCODE_DPLEIT || symbology == BARCODE_DPIDENT || symbology == BARCODE_ITF14) {
/* End sbs loop on bar */ /* End sbs loop on bar */
memmove(cmd + GS_INITIAL_LEN + 6, cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN); char adj[6] = " -selb";
memcpy(cmd + GS_INITIAL_LEN, " -selb", 6); memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
}
if (symbology == BARCODE_C25MATRIX) {
/* Zint uses 4X start/stop wides while BWIPP uses 3X - convert */
char adj[91] = " -sp='i 0 eq i limit 4 sub eq or sbs i get 3 eq and { (1111) print true } { false } ifelse'";
memmove(cmd + GS_INITIAL_LEN + sizeof(adj), cmd + GS_INITIAL_LEN, strlen(cmd) + 1 - GS_INITIAL_LEN);
memcpy(cmd + GS_INITIAL_LEN, adj, sizeof(adj));
} }
if (symbol->debug & ZINT_DEBUG_TEST_PRINT) { if (symbol->debug & ZINT_DEBUG_TEST_PRINT) {

View File

@ -1,5 +1,5 @@
--- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-07-10 13:08:57.215118693 +0100 --- ../../../../postscriptbarcode/build/monolithic/barcode.ps 2020-07-14 14:52:24.208222925 +0100
+++ ../tools/bwipp_dump.ps 2020-07-10 13:44:00.892056648 +0100 +++ ../tools/bwipp_dump.ps 2020-07-14 17:29:15.314238749 +0100
@@ -29,6 +29,8 @@ @@ -29,6 +29,8 @@
% CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS % CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
% IN THE SOFTWARE. % IN THE SOFTWARE.
@ -9,7 +9,7 @@
% --BEGIN TEMPLATE-- % --BEGIN TEMPLATE--
% --BEGIN RESOURCE preamble-- % --BEGIN RESOURCE preamble--
@@ -24484,34 +24486,72 @@ @@ -24485,34 +24487,80 @@
pop pop
} ifelse } ifelse
@ -64,7 +64,7 @@
+ } { + } {
+ /linsym exch def + /linsym exch def
+ /linpixs [ + /linpixs [
+ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's + linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def + ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def + /linheight linsym /bhs get 0 get 72 mul cvi def
@ -75,18 +75,26 @@
+ +
+ /linpad [ ccpixx 97 sub {0} repeat ] def + /linpad [ ccpixx 97 sub {0} repeat ] def
+ +
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { + 0 ccpixx ccpixs length 1 sub {
+ /i exch def + /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop } repeat + 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for + } for
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat + 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 } repeat + 2 { linpad aload pop 1 0 93 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat + 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat + linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def + ] def
+ +
+ /pixx ccpixx def
+ /pixy pixs length pixx idiv def + /pixy pixs length pixx idiv def
+ << + <<
+ /ren //renmatrix + /ren //renmatrix
@ -101,7 +109,7 @@
end end
@@ -24570,7 +24610,7 @@ @@ -24571,7 +24619,7 @@
pop pop
} ifelse } ifelse
@ -110,7 +118,7 @@
% Get the result of encoding with ean8 and gs1-cc % Get the result of encoding with ean8 and gs1-cc
options (lintype) (ean8) put options (lintype) (ean8) put
@@ -24578,29 +24618,67 @@ @@ -24579,29 +24627,75 @@
options (dontdraw) true put options (dontdraw) true put
% Plot the linear part % Plot the linear part
@ -157,7 +165,7 @@
+ } { + } {
+ /linsym exch def + /linsym exch def
+ /linpixs [ + /linpixs [
+ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's + linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def + ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def + /linheight linsym /bhs get 0 get 72 mul cvi def
@ -172,18 +180,26 @@
- grestore - grestore
+ /linpad [ ccpixx 69 sub {0} repeat ] def + /linpad [ ccpixx 69 sub {0} repeat ] def
+ +
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { + 0 ccpixx ccpixs length 1 sub {
+ /i exch def + /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop } repeat + 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for + } for
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 } repeat + 2 { linpad aload pop 0 1 65 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 65 {0} repeat 0 1 } repeat + 2 { linpad aload pop 1 0 65 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 65 {0} repeat 1 0 } repeat + 2 { linpad aload pop 0 1 65 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat + linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def + ] def
+ +
+ /pixx ccpixx def
+ /pixy pixs length pixx idiv def + /pixy pixs length pixx idiv def
+ << + <<
+ /ren //renmatrix + /ren //renmatrix
@ -198,7 +214,7 @@
end end
@@ -24659,34 +24737,72 @@ @@ -24660,34 +24754,80 @@
pop pop
} ifelse } ifelse
@ -253,7 +269,7 @@
+ } { + } {
+ /linsym exch def + /linsym exch def
+ /linpixs [ + /linpixs [
+ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's + linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def + ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def + /linheight linsym /bhs get 0 get 72 mul cvi def
@ -264,18 +280,26 @@
+ +
+ /linpad [ ccpixx 97 sub {0} repeat ] def + /linpad [ ccpixx 97 sub {0} repeat ] def
+ +
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { + 0 ccpixx ccpixs length 1 sub {
+ /i exch def + /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop } repeat + 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for + } for
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat + 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 93 {0} repeat 0 1 } repeat + 2 { linpad aload pop 1 0 93 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 93 {0} repeat 1 0 } repeat + 2 { linpad aload pop 0 1 93 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat + linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def + ] def
+ +
+ /pixx ccpixx def
+ /pixy pixs length pixx idiv def + /pixy pixs length pixx idiv def
+ << + <<
+ /ren //renmatrix + /ren //renmatrix
@ -290,7 +314,7 @@
end end
@@ -24760,34 +24876,72 @@ @@ -24761,34 +24901,80 @@
/opt options /opt options
>> def >> def
@ -345,7 +369,7 @@
+ } { + } {
+ /linsym exch def + /linsym exch def
+ /linpixs [ + /linpixs [
+ linsym /sbs get { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's + linsym /sbs get { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def + ] def
+ /linheight linsym /bhs get 0 get 72 mul cvi def + /linheight linsym /bhs get 0 get 72 mul cvi def
@ -356,18 +380,26 @@
+ +
+ /linpad [ ccpixx 53 sub {0} repeat ] def + /linpad [ ccpixx 53 sub {0} repeat ] def
+ +
+ /diff linpixs length linpad length add 2 add ccpixx sub def % An add-on can make linear wider than composite
+ diff 0 gt { % Left align composite
+ /ccrpad [ diff {0} repeat ] def
+ /pixx ccpixx diff add def
+ } {
+ /ccrpad 0 array def
+ /pixx ccpixx def
+ } ifelse
+
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { + 0 ccpixx ccpixs length 1 sub {
+ /i exch def + /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop } repeat + 2 { ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for + } for
+ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 } repeat + 2 { linpad aload pop 0 1 49 {0} repeat 1 0 ccrpad aload pop } repeat
+ 2 { linpad aload pop 1 0 49 {0} repeat 0 1 } repeat + 2 { linpad aload pop 1 0 49 {0} repeat 0 1 ccrpad aload pop } repeat
+ 2 { linpad aload pop 0 1 49 {0} repeat 1 0 } repeat + 2 { linpad aload pop 0 1 49 {0} repeat 1 0 ccrpad aload pop } repeat
+ linheight { linpad aload pop 0 linpixs aload pop 0 } repeat + linheight { linpad aload pop 0 linpixs aload pop 0 } repeat
+ ] def + ] def
+ +
+ /pixx ccpixx def
+ /pixy pixs length pixx idiv def + /pixy pixs length pixx idiv def
+ << + <<
+ /ren //renmatrix + /ren //renmatrix
@ -382,7 +414,7 @@
end end
@@ -24846,7 +25000,7 @@ @@ -24847,7 +25033,7 @@
pop pop
} ifelse } ifelse
@ -391,7 +423,7 @@
options (lintype) (databaromni) put options (lintype) (databaromni) put
options (linkage) true put options (linkage) true put
@@ -24857,7 +25011,7 @@ @@ -24858,7 +25044,7 @@
linear options //databaromni exec linear options //databaromni exec
dup (sbs) get /linsbs exch def dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def dup (bhs) get 0 get 72 mul /linheight exch def
@ -400,7 +432,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -24888,20 +25042,66 @@ @@ -24889,20 +25075,66 @@
sep 0 [0 0 0] putinterval sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval sep sep length 4 sub [0 0 0 0] putinterval
18 sepfinder 64 sepfinder 18 sepfinder 64 sepfinder
@ -436,14 +468,14 @@
+ /ccpixs compsym /pixs get def + /ccpixs compsym /pixs get def
+ /ccpixx compsym /pixx get def + /ccpixx compsym /pixx get def
+ +
+ /linpixs [ 0 % Begin with left guard space + /linpixs [ 0 % Begin with left guard space
+ linsbs { 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's + linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ ] def + ] def
+ /sep [ 0 sep aload pop ] def % Pad with left guard space + /sep [ 0 sep aload pop ] def % Pad with left guard space
+ +
+ /linheight linheight cvi def + /linheight linheight cvi def
+ /diff linpixs length ccpixx sub def + /diff linpixs length ccpixx sub def
+ diff 0 gt { % Centre align composite, doubling up rows + diff 0 gt { % Centre align composite, doubling up rows
+ /ccpad [ diff 2 idiv {0} repeat ] def + /ccpad [ diff 2 idiv {0} repeat ] def
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { + 0 ccpixx ccpixs length 1 sub {
@ -453,10 +485,10 @@
+ sep aload pop linheight { linpixs aload pop } repeat + sep aload pop linheight { linpixs aload pop } repeat
+ ] def + ] def
+ /pixx linpixs length def + /pixx linpixs length def
+ } { % Right pad composite, doubling up rows, and left pad (right align) separator/linear + } { % Right pad composite, doubling up rows, and left pad (right align) separator/linear
+ /linpad [ diff neg 1 add {0} repeat ] def + /linpad [ diff neg 1 add {0} repeat ] def
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space + 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space
+ /i exch def + /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop 0 } repeat + 2 { ccpixs i ccpixx getinterval aload pop 0 } repeat
+ } for + } for
@ -479,7 +511,7 @@
end end
@@ -24959,7 +25159,7 @@ @@ -24960,7 +25192,7 @@
pop pop
} ifelse } ifelse
@ -488,7 +520,7 @@
options (lintype) (databarstacked) put options (lintype) (databarstacked) put
options (linkage) true put options (linkage) true put
@@ -24970,7 +25170,7 @@ @@ -24971,7 +25203,7 @@
linear options //databarstacked exec linear options //databarstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def dup (pixy) get /linheight exch def
@ -497,7 +529,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -24998,20 +25198,52 @@ @@ -24999,20 +25231,52 @@
sep 0 [ 0 0 0 0 ] putinterval sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder 18 sepfinder
@ -537,12 +569,12 @@
+ /pixx ccpixx 1 add def + /pixx ccpixx 1 add def
+ /linpad [ pixx linwidth sub {0} repeat ] def + /linpad [ pixx linwidth sub {0} repeat ] def
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows + 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows
+ /i exch def + /i exch def
+ 2 { 0 ccpixs i ccpixx getinterval aload pop } repeat + 2 { 0 ccpixs i ccpixx getinterval aload pop } repeat
+ } for + } for
+ sep aload pop linpad aload pop + sep aload pop linpad aload pop
+ 0 linwidth linpixs length 1 sub { % Right pad linear + 0 linwidth linpixs length 1 sub { % Right pad linear
+ /i exch def + /i exch def
+ linpixs i linwidth getinterval aload pop linpad aload pop + linpixs i linwidth getinterval aload pop linpad aload pop
+ } for + } for
@ -562,7 +594,7 @@
end end
@@ -25069,7 +25301,7 @@ @@ -25070,7 +25334,7 @@
pop pop
} ifelse } ifelse
@ -571,7 +603,7 @@
options (lintype) (databarstackedomni) put options (lintype) (databarstackedomni) put
options (linkage) true put options (linkage) true put
@@ -25080,7 +25312,7 @@ @@ -25081,7 +25345,7 @@
linear options //databarstackedomni exec linear options //databarstackedomni exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def dup (pixy) get /linheight exch def
@ -580,7 +612,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -25108,20 +25340,52 @@ @@ -25109,20 +25373,52 @@
sep 0 [ 0 0 0 0 ] putinterval sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder 18 sepfinder
@ -620,12 +652,12 @@
+ /pixx ccpixx 1 add def + /pixx ccpixx 1 add def
+ /linpad [ pixx linwidth sub {0} repeat ] def + /linpad [ pixx linwidth sub {0} repeat ] def
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows + 0 ccpixx ccpixs length 1 sub { % Left pad composite with 1 space, doubling up rows
+ /i exch def + /i exch def
+ 2 { 0 ccpixs i ccpixx getinterval aload pop } repeat + 2 { 0 ccpixs i ccpixx getinterval aload pop } repeat
+ } for + } for
+ sep aload pop linpad aload pop + sep aload pop linpad aload pop
+ 0 linwidth linpixs length 1 sub { % Right pad linear + 0 linwidth linpixs length 1 sub { % Right pad linear
+ /i exch def + /i exch def
+ linpixs i linwidth getinterval aload pop linpad aload pop + linpixs i linwidth getinterval aload pop linpad aload pop
+ } for + } for
@ -645,7 +677,7 @@
end end
@@ -25294,7 +25558,7 @@ @@ -25295,7 +25591,7 @@
pop pop
} ifelse } ifelse
@ -654,7 +686,7 @@
options (lintype) (databarlimited) put options (lintype) (databarlimited) put
options (linkage) true put options (linkage) true put
@@ -25305,7 +25569,7 @@ @@ -25306,7 +25602,7 @@
linear options //databarlimited exec linear options //databarlimited exec
dup (sbs) get /linsbs exch def dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def dup (bhs) get 0 get 72 mul /linheight exch def
@ -663,7 +695,7 @@
% Plot the separator % Plot the separator
mark mark
@@ -25313,22 +25577,68 @@ @@ -25314,22 +25610,68 @@
counttomark 1 sub array astore /sep exch def pop pop counttomark 1 sub array astore /sep exch def pop pop
sep 0 [0 0 0] putinterval sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval sep sep length 4 sub [0 0 0 0] putinterval
@ -703,14 +735,14 @@
+ /ccpixx compsym /pixx get def + /ccpixx compsym /pixx get def
- grestore - grestore
+ /linpixs [ 0 % Begin with left guard space + /linpixs [ 0 % Begin with left guard space
+ linsbs { 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's + linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ ] def + ] def
+ /sep [ 0 sep aload pop ] def % Offset by 1 + /sep [ 0 sep aload pop ] def % Offset by 1
+ +
+ /linheight linheight cvi def + /linheight linheight cvi def
+ /diff linpixs length ccpixx sub def + /diff linpixs length ccpixx sub def
+ diff 0 gt { % 2 column - centre align + diff 0 gt { % 2 column - centre align
+ /ccpad [ diff 2 idiv {0} repeat ] def + /ccpad [ diff 2 idiv {0} repeat ] def
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { + 0 ccpixx ccpixs length 1 sub {
@ -720,10 +752,10 @@
+ sep aload pop linheight { linpixs aload pop } repeat + sep aload pop linheight { linpixs aload pop } repeat
+ ] def + ] def
+ /pixx linpixs length def + /pixx linpixs length def
+ } { % 3/4 column - right pad 1 and right align separator/linear + } { % 3/4 column - right pad 1 and right align separator/linear
+ /linpad [ diff neg 1 add {0} repeat ] def + /linpad [ diff neg 1 add {0} repeat ] def
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space + 0 ccpixx ccpixs length 1 sub { % Right pad composite with 1 space
+ /i exch def + /i exch def
+ 2 { ccpixs i ccpixx getinterval aload pop 0 } repeat + 2 { ccpixs i ccpixx getinterval aload pop 0 } repeat
+ } for + } for
@ -746,7 +778,7 @@
end end
@@ -25387,7 +25697,7 @@ @@ -25388,7 +25730,7 @@
pop pop
} ifelse } ifelse
@ -755,7 +787,7 @@
options (lintype) (databarexpanded) put options (lintype) (databarexpanded) put
options (linkage) true put options (linkage) true put
@@ -25398,7 +25708,7 @@ @@ -25399,7 +25741,7 @@
linear options //databarexpanded exec linear options //databarexpanded exec
dup (sbs) get /linsbs exch def dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def dup (bhs) get 0 get 72 mul /linheight exch def
@ -764,7 +796,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -25427,20 +25737,60 @@ @@ -25428,20 +25770,60 @@
18 98 bot length 13 sub {} for 18 98 bot length 13 sub {} for
69 98 bot length 13 sub {} for 69 98 bot length 13 sub {} for
] {sepfinder} forall ] {sepfinder} forall
@ -800,10 +832,10 @@
+ /ccpixs compsym /pixs get def + /ccpixs compsym /pixs get def
+ /ccpixx compsym /pixx get def + /ccpixx compsym /pixx get def
+ +
+ /linpixs [ 0 % Begin with left guard space + /linpixs [ 0 % Begin with left guard space
+ linsbs { 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's + linsbs { cvi 1 index 0 eq {{1}} {{0}} ifelse repeat } forall % Alternates x 1/0's
+ ] def + ] def
+ /sep [ 0 sep aload pop ] def % Offset by 1 + /sep [ 0 sep aload pop ] def % Offset by 1
+ +
+ /linheight linheight cvi def + /linheight linheight cvi def
+ /diff linpixs length ccpixx sub def + /diff linpixs length ccpixx sub def
@ -837,7 +869,7 @@
end end
@@ -25498,7 +25848,7 @@ @@ -25499,7 +25881,7 @@
pop pop
} ifelse } ifelse
@ -846,7 +878,7 @@
options (lintype) (databarexpandedstacked) put options (lintype) (databarexpandedstacked) put
options (linkage) true put options (linkage) true put
@@ -25509,7 +25859,7 @@ @@ -25510,7 +25892,7 @@
linear options //databarexpandedstacked exec linear options //databarexpandedstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def dup (pixy) get /linheight exch def
@ -855,7 +887,7 @@
% Plot the separator % Plot the separator
/sepfinder { /sepfinder {
@@ -25529,27 +25879,55 @@ @@ -25530,27 +25912,55 @@
} for } for
} bind def } bind def
/sep [ bot {1 exch sub} forall ] def /sep [ bot {1 exch sub} forall ] def
@ -900,10 +932,10 @@
+ /ccpixx compsym /pixx get def + /ccpixx compsym /pixx get def
+ +
+ /pixx sep length def + /pixx sep length def
+ /cclpad [ pixx ccpixx sub 1 add 2 idiv {0} repeat ] def % Add 1 to allow for odd difference + /cclpad [ pixx ccpixx sub 1 add 2 idiv {0} repeat ] def % Add 1 to allow for odd difference
+ /ccrpad [ pixx ccpixx sub 2 idiv {0} repeat ] def + /ccrpad [ pixx ccpixx sub 2 idiv {0} repeat ] def
+ /pixs [ + /pixs [
+ 0 ccpixx ccpixs length 1 sub { % Centre align composite + 0 ccpixx ccpixs length 1 sub { % Centre align composite
+ /i exch def + /i exch def
+ 2 { cclpad aload pop ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat + 2 { cclpad aload pop ccpixs i ccpixx getinterval aload pop ccrpad aload pop } repeat
+ } for + } for
@ -925,7 +957,7 @@
end end
@@ -25608,7 +25986,7 @@ @@ -25609,7 +26019,7 @@
pop pop
} ifelse } ifelse
@ -934,7 +966,7 @@
options (inkspread) (0) put options (inkspread) (0) put
options (dontdraw) true put options (dontdraw) true put
@@ -25635,35 +26013,87 @@ @@ -25636,35 +26046,87 @@
linear << options {} forall >> //gs1-128 exec linear << options {} forall >> //gs1-128 exec
dup (sbs) get /linsbs exch def dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def dup (bhs) get 0 get 72 mul /linheight exch def
@ -989,23 +1021,23 @@
+ /ccpixx compsym /pixx get def + /ccpixx compsym /pixx get def
+ +
+ /linpixs [ + /linpixs [
+ linsbs { 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's + linsbs { cvi 1 index 1 eq {{0}} {{1}} ifelse repeat } forall % Alternates x 1/0's
+ ] def + ] def
+ +
+ x 0 gt { % Left pad composite + x 0 gt { % Left pad composite
+ /cclpad [ x {0} repeat ] def + /cclpad [ x {0} repeat ] def
+ /linlpad 0 array def + /linlpad 0 array def
+ /diff linwidth ccpixx x add sub def + /diff linwidth ccpixx x add sub def
+ } { % Left pad linear + } { % Left pad linear
+ /cclpad 0 array def + /cclpad 0 array def
+ /linlpad [ x neg {0} repeat ] def + /linlpad [ x neg {0} repeat ] def
+ /diff linwidth x sub ccpixx sub def + /diff linwidth x sub ccpixx sub def
+ } ifelse + } ifelse
+ +
+ diff 0 gt { % Right pad composite + diff 0 gt { % Right pad composite
+ /ccrpad [ diff {0} repeat ] def + /ccrpad [ diff {0} repeat ] def
+ /linrpad 0 array def + /linrpad 0 array def
+ } { % Right pad linear + } { % Right pad linear
+ /ccrpad 0 array def + /ccrpad 0 array def
+ /linrpad [ diff neg {0} repeat ] def + /linrpad [ diff neg {0} repeat ] def
+ } ifelse + } ifelse
@ -1036,7 +1068,7 @@
end end
@@ -26961,3 +27391,115 @@ @@ -26962,3 +27424,124 @@
% --END ENCODER hibcazteccode-- % --END ENCODER hibcazteccode--
% --END TEMPLATE-- % --END TEMPLATE--
@ -1099,15 +1131,15 @@
+ret /pixs known { +ret /pixs known {
+ /pixs ret /pixs get def + /pixs ret /pixs get def
+ +
+ n ret /pixx known and { % If newlines requested and have row width + n ret /pixx known and { % If newlines requested and have row width
+ /pixx ret /pixx get def + /pixx ret /pixx get def
+ 0 pixx pixs length 1 sub { % For i = 0; i < pixs length; i += pixx + 0 pixx pixs length 1 sub { % For i = 0; i < pixs length; i += pixx
+ pixs exch pixx getinterval { % For j = i; j < i + pixx; j++ + pixs exch pixx getinterval { % For j = i; j < i + pixx; j++
+ 1 string cvs print + 1 string cvs print
+ } forall + } forall
+ (\n) print + (\n) print
+ } for + } for
+ } { % Else dump the whole thing, no newlines + } { % Else dump the whole thing, no newlines
+ pixs { 1 string cvs print } forall + pixs { 1 string cvs print } forall
+ } ifelse + } ifelse
+} { +} {
@ -1115,10 +1147,17 @@
+ ret /sbs known { + ret /sbs known {
+ /sbs ret /sbs get def + /sbs ret /sbs get def
+ +
+ % Check if given ratio arg to adjust width of bars/spaces (eg "0.6" reduces 3 -> 2) + % Check if given preprocessor override
+ systemdict /p known {
+ /p systemdict /p get cvx def
+ } {
+ /p { false } def
+ } ifelse
+
+ % Check if given ratio arg to adjust width of bars/spaces (e.g. "0.6" reduces 3 -> 2, "1.3" increases 2 -> 3)
+ systemdict /r known { + systemdict /r known {
+ /r systemdict /r get cvr def + /r systemdict /r get cvr def
+ /f { r mul ceiling cvi } def + /f { r mul round cvi } def
+ } { + } {
+ /f {} def + /f {} def
+ } ifelse + } ifelse
@ -1135,11 +1174,13 @@
+ +
+ 0 1 limit { + 0 1 limit {
+ /i exch def + /i exch def
+ i 2 mod 0 eq { % i is even + p not { % If not preprocessed
+ sbs i get f { (1) print } repeat + i 2 mod 0 eq { % i is even
+ } { + sbs i get f cvi { (1) print } repeat
+ sbs i get f { (0) print } repeat + } {
+ } ifelse + sbs i get f cvi { (0) print } repeat
+ } ifelse
+ } if
+ } for + } for
+ n { (\n) print } if + n { (\n) print } if
+ } if + } if

View File

@ -0,0 +1,11 @@
#!/bin/bash
./test_2of5 -f encode -d $(expr 128 + 16)
./test_channel -f encode -d $(expr 128 + 16)
./test_codablock -f encode -d $(expr 128 + 16)
./test_code -f encode -d $(expr 128 + 16)
./test_code128 -f encode -d $(expr 128 + 16)
./test_composite -d $(expr 128 + 16)
./test_gs1 -f gs1_reduce -d $(expr 128 + 16)
./test_rss -d $(expr 128 + 16)
./test_telepen -f encode -d $(expr 128 + 16)
./test_upcean -f encode -d $(expr 128 + 16)

View File

@ -0,0 +1,46 @@
<?php
/* Generate mod 928 powers table for `encode928()` in "composite.c" */
/*
libzint - the open source barcode library
Copyright (C) 2020 Robin Stuart <rstuart114@gmail.com>
*/
/* vim: set ts=4 sw=4 et : */
/* The functions "getBit", "init928" and "encode928" are copyright BSI and are
released with permission under the following terms:
"Copyright subsists in all BSI publications. BSI also holds the copyright, in the
UK, of the international standardisation bodies. Except as
permitted under the Copyright, Designs and Patents Act 1988 no extract may be
reproduced, stored in a retrieval system or transmitted in any form or by any
means - electronic, photocopying, recording or otherwise - without prior written
permission from BSI.
"This does not preclude the free use, in the course of implementing the standard,
of necessary details such as symbols, and size, type or grade designations. If these
details are to be used for any other purpose than implementation then the prior
written permission of BSI must be obtained."
The date of publication for these functions is 31 May 2006
*/
$cw = array(0, 0, 0, 0, 0, 0, 1);
$pwr928 = array( $cw );
for ($j = 1; $j < 69; $j++) {
for ($v = 0, $i = 6; $i >= 1; $i--) {
$v = (2 * $cw[$i]) + (int)($v / 928);
$pwr928[$j][$i] = $cw[$i] = $v % 928;
}
$pwr928[$j][0] = $cw[0] = (2 * $cw[0]) + (int)($v / 928);
}
printf("static UINT pwr928[69][7] = {\n");
for ($i = 0; $i < 69; $i++) {
printf(" { ");
for ($j = 0; $j < 7; $j++) {
printf("%3d, ", $pwr928[$i][$j]);
}
printf("},\n");
}
printf("};\n");

View File

@ -305,13 +305,15 @@ static int upce(struct zint_symbol *symbol, unsigned char source[], char dest[])
} }
/* EAN-2 and EAN-5 add-on codes */ /* EAN-2 and EAN-5 add-on codes */
static void add_on(unsigned char source[], char dest[], int mode) { static void add_on(unsigned char source[], char dest[], int addon_gap) {
char parity[6]; char parity[6];
unsigned int i, code_type; unsigned int i, code_type;
/* If an add-on then append with space */ /* If an add-on then append with space */
if (mode != 0) { if (addon_gap != 0) {
strcat(dest, "9"); i = strlen(dest);
dest[i] = itoc(addon_gap);
dest[i + 1] = '\0';
} }
/* Start character */ /* Start character */
@ -704,6 +706,7 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le
unsigned char local_source[20] = {0}; unsigned char local_source[20] = {0};
unsigned int latch, reader, writer, with_addon; unsigned int latch, reader, writer, with_addon;
int error_number, i, plus_count; int error_number, i, plus_count;
int addon_gap = 0;
with_addon = FALSE; with_addon = FALSE;
latch = FALSE; latch = FALSE;
@ -714,7 +717,7 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le
return ZINT_ERROR_TOO_LONG; return ZINT_ERROR_TOO_LONG;
} }
if (symbol->symbology != BARCODE_ISBNX) { if (symbol->symbology != BARCODE_ISBNX) {
/* ISBN has it's own checking routine */ /* ISBN has its own checking routine */
error_number = is_sane("0123456789+", source, src_len); error_number = is_sane("0123456789+", source, src_len);
if (error_number == ZINT_ERROR_INVALID_DATA) { if (error_number == ZINT_ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "284: Invalid characters in data"); strcpy(symbol->errtxt, "284: Invalid characters in data");
@ -741,11 +744,6 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le
} }
/* Add leading zeroes */ /* Add leading zeroes */
ustrcpy(local_source, (unsigned char *) "");
if (symbol->symbology == BARCODE_ISBNX) {
to_upper(local_source);
}
ean_leading_zeroes(symbol, source, local_source); ean_leading_zeroes(symbol, source, local_source);
for (reader = 0; reader < ustrlen(local_source); reader++) { for (reader = 0; reader < ustrlen(local_source); reader++) {
@ -774,6 +772,12 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le
writer++; writer++;
} }
} while (reader <= ustrlen(local_source)); } while (reader <= ustrlen(local_source));
if (symbol->symbology == BARCODE_UPCA || symbol->symbology == BARCODE_UPCA_CHK || symbol->symbology == BARCODE_UPCA_CC) {
addon_gap = symbol->option_2 >= 9 && symbol->option_2 <= 12 ? symbol->option_2 : 9;
} else {
addon_gap = symbol->option_2 >= 7 && symbol->option_2 <= 12 ? symbol->option_2 : 7;
}
} else { } else {
strcpy((char*) first_part, (char*) local_source); strcpy((char*) first_part, (char*) local_source);
} }
@ -894,12 +898,12 @@ INTERNAL int eanx(struct zint_symbol *symbol, unsigned char source[], int src_le
switch (ustrlen(second_part)) { switch (ustrlen(second_part)) {
case 0: break; case 0: break;
case 2: case 2:
add_on(second_part, (char*) dest, 1); add_on(second_part, (char*) dest, addon_gap);
strcat((char*) symbol->text, "+"); strcat((char*) symbol->text, "+");
strcat((char*) symbol->text, (char*) second_part); strcat((char*) symbol->text, (char*) second_part);
break; break;
case 5: case 5:
add_on(second_part, (char*) dest, 1); add_on(second_part, (char*) dest, addon_gap);
strcat((char*) symbol->text, "+"); strcat((char*) symbol->text, "+");
strcat((char*) symbol->text, (char*) second_part); strcat((char*) symbol->text, (char*) second_part);
break; break;

View File

@ -31,7 +31,6 @@
/* vim: set ts=4 sw=4 et : */ /* vim: set ts=4 sw=4 et : */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <math.h> #include <math.h>
#ifdef _MSC_VER #ifdef _MSC_VER
@ -45,7 +44,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol);
INTERNAL int svg_plot(struct zint_symbol *symbol); INTERNAL int svg_plot(struct zint_symbol *symbol);
INTERNAL int emf_plot(struct zint_symbol *symbol); INTERNAL int emf_plot(struct zint_symbol *symbol);
static struct zint_vector_rect *vector_plot_create_rect(float x, float y, float width, float height) { static struct zint_vector_rect *vector_plot_create_rect(double x, double y, double width, double height) {
struct zint_vector_rect *rect; struct zint_vector_rect *rect;
rect = (struct zint_vector_rect*) malloc(sizeof (struct zint_vector_rect)); rect = (struct zint_vector_rect*) malloc(sizeof (struct zint_vector_rect));
@ -72,7 +71,7 @@ static int vector_plot_add_rect(struct zint_symbol *symbol, struct zint_vector_r
return 1; return 1;
} }
static struct zint_vector_hexagon *vector_plot_create_hexagon(float x, float y, float diameter) { static struct zint_vector_hexagon *vector_plot_create_hexagon(double x, double y, double diameter) {
struct zint_vector_hexagon *hexagon; struct zint_vector_hexagon *hexagon;
hexagon = (struct zint_vector_hexagon*) malloc(sizeof (struct zint_vector_hexagon)); hexagon = (struct zint_vector_hexagon*) malloc(sizeof (struct zint_vector_hexagon));
@ -80,7 +79,7 @@ static struct zint_vector_hexagon *vector_plot_create_hexagon(float x, float y,
hexagon->next = NULL; hexagon->next = NULL;
hexagon->x = x; hexagon->x = x;
hexagon->y = y; hexagon->y = y;
hexagon->diameter = (float)((diameter * 5.0) / 4.0); // Ugly kludge for legacy support hexagon->diameter = (diameter * 5.0) / 4.0; // Ugly kludge for legacy support
return hexagon; return hexagon;
} }
@ -96,7 +95,7 @@ static int vector_plot_add_hexagon(struct zint_symbol *symbol, struct zint_vecto
return 1; return 1;
} }
static struct zint_vector_circle *vector_plot_create_circle(float x, float y, float diameter, int colour) { static struct zint_vector_circle *vector_plot_create_circle(double x, double y, double diameter, int colour) {
struct zint_vector_circle *circle; struct zint_vector_circle *circle;
circle = (struct zint_vector_circle *) malloc(sizeof (struct zint_vector_circle)); circle = (struct zint_vector_circle *) malloc(sizeof (struct zint_vector_circle));
@ -122,7 +121,7 @@ static int vector_plot_add_circle(struct zint_symbol *symbol, struct zint_vector
} }
static int vector_plot_add_string(struct zint_symbol *symbol, static int vector_plot_add_string(struct zint_symbol *symbol,
unsigned char *text, float x, float y, float fsize, float width, unsigned char *text, double x, double y, double fsize, double width,
struct zint_vector_string **last_string) { struct zint_vector_string **last_string) {
struct zint_vector_string *string; struct zint_vector_string *string;
@ -196,7 +195,7 @@ static void vector_scale(struct zint_symbol *symbol, int file_type) {
struct zint_vector_hexagon *hex; struct zint_vector_hexagon *hex;
struct zint_vector_circle *circle; struct zint_vector_circle *circle;
struct zint_vector_string *string; struct zint_vector_string *string;
float scale = symbol->scale * 2.0f; double scale = symbol->scale * 2.0;
if ((file_type == OUT_EMF_FILE) && (symbol->symbology == BARCODE_MAXICODE)) { if ((file_type == OUT_EMF_FILE) && (symbol->symbology == BARCODE_MAXICODE)) {
// Increase size to overcome limitations in EMF file format // Increase size to overcome limitations in EMF file format
@ -270,39 +269,44 @@ static void vector_reduce_rectangles(struct zint_symbol *symbol) {
INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) { INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type) {
int error_number; int error_number;
double large_bar_height;
int textdone;
int main_width, comp_offset, addon_gap;
unsigned char addon[6];
int xoffset, yoffset, roffset, boffset;
double addon_text_posn;
int textoffset;
int default_text_posn;
double row_height, row_posn;
int upceanflag = 0;
int addon_latch = 0;
unsigned char textpart1[5], textpart2[7], textpart3[7], textpart4[2];
int textpos;
int hide_text = 0;
int i, r;
double text_height;
int rect_count, last_row_start;
int this_row;
struct zint_vector *vector; struct zint_vector *vector;
struct zint_vector_rect *rectangle, *rect, *last_rectangle = NULL; struct zint_vector_rect *rectangle, *rect, *last_rectangle = NULL;
struct zint_vector_hexagon *last_hexagon = NULL; struct zint_vector_hexagon *last_hexagon = NULL;
struct zint_vector_string *last_string = NULL; struct zint_vector_string *last_string = NULL;
struct zint_vector_circle *last_circle = NULL; struct zint_vector_circle *last_circle = NULL;
int i, r, latch;
float textpos, large_bar_height, preset_height, row_height, row_posn = 0.0;
float text_offset, text_height;
int xoffset, yoffset, textdone, main_symbol_width_x;
int roffset, boffset;
char addon[6];
int large_bar_count, symbol_lead_in;
float addon_text_posn;
float default_text_posn;
int hide_text = 0;
int upceanflag = 0;
int rect_count, last_row_start;
int this_row;
int addon_latch = 0;
struct zint_vector_string *string; struct zint_vector_string *string;
(void)rotate_angle; /* Not currently implemented */ (void)rotate_angle; /* Not currently implemented */
// Free any previous rendering structures
vector_free(symbol);
// Sanity check colours // Sanity check colours
error_number = check_colour_options(symbol); error_number = output_check_colour_options(symbol);
if (error_number != 0) { if (error_number != 0) {
return error_number; return error_number;
} }
// Free any previous rendering structures
vector_free(symbol);
// Allocate memory // Allocate memory
vector = symbol->vector = (struct zint_vector *) malloc(sizeof (struct zint_vector)); vector = symbol->vector = (struct zint_vector *) malloc(sizeof (struct zint_vector));
if (!vector) return ZINT_ERROR_MEMORY; if (!vector) return ZINT_ERROR_MEMORY;
@ -311,121 +315,44 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
vector->circles = NULL; vector->circles = NULL;
vector->strings = NULL; vector->strings = NULL;
row_height = 0; large_bar_height = output_large_bar_height(symbol);
textdone = 0; textdone = 0;
main_symbol_width_x = symbol->width;
strcpy(addon, "");
symbol_lead_in = 0;
addon_text_posn = 0.0;
rect_count = 0;
last_row_start = 0;
/* main_width = symbol->width;
* Determine if there will be any addon texts and text height comp_offset = 0;
*/
latch = 0;
r = 0;
/* Isolate add-on text */
if (is_extendable(symbol->symbology)) { if (is_extendable(symbol->symbology)) {
for (i = 0; i < (int) ustrlen(symbol->text); i++) { upceanflag = output_process_upcean(symbol, &main_width, &comp_offset, addon, &addon_gap);
if (latch == 1) {
addon[r] = symbol->text[i];
r++;
}
if (symbol->text[i] == '+') {
latch = 1;
}
}
}
addon[r] = '\0';
/*
* Calculate the width of the barcode, especially if there are any extra
* borders or white space to add.
*/
if (is_composite(symbol->symbology)) {
while (!(module_is_set(symbol, symbol->rows - 1, symbol_lead_in))) {
symbol_lead_in++;
}
} }
/* Certain symbols need whitespace otherwise characters get chopped off the sides */ output_set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset);
if ((symbol->symbology == BARCODE_EANX) || (symbol->symbology == BARCODE_EANX_CHK)
|| (symbol->symbology == BARCODE_EANX_CC) || (symbol->symbology == BARCODE_ISBNX)) {
switch (ustrlen(symbol->text)) {
case 13: /* EAN 13 */
case 16:
case 19:
if (symbol->whitespace_width == 0) {
symbol->whitespace_width = 10;
}
main_symbol_width_x = 96 + symbol_lead_in;
upceanflag = 13;
break;
case 2:
main_symbol_width_x = 22 + symbol_lead_in;
upceanflag = 2;
break;
case 5:
main_symbol_width_x = 49 + symbol_lead_in;
upceanflag = 5;
break;
default:
main_symbol_width_x = 68 + symbol_lead_in;
upceanflag = 8;
}
} else if ((symbol->symbology == BARCODE_UPCA) || (symbol->symbology == BARCODE_UPCA_CHK)
|| (symbol->symbology == BARCODE_UPCA_CC)) {
upceanflag = 12;
if (symbol->whitespace_width == 0) {
symbol->whitespace_width = 10;
}
main_symbol_width_x = 96 + symbol_lead_in;
} else if ((symbol->symbology == BARCODE_UPCE) || (symbol->symbology == BARCODE_UPCE_CHK)
|| (symbol->symbology == BARCODE_UPCE_CC)) {
upceanflag = 6;
if (symbol->whitespace_width == 0) {
symbol->whitespace_width = 10;
}
main_symbol_width_x = 51 + symbol_lead_in;
}
if ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0)) { addon_text_posn = 0.0;
hide_text = 1; hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0));
if (hide_text) {
text_height = 0.0; text_height = 0.0;
text_offset = upceanflag ? 9.0f : 0.0f; textoffset = upceanflag ? 9.0 : 0.0;
} else { } else {
text_height = upceanflag ? 11.0f : 9.0f; text_height = upceanflag ? 11.0 : 9.0;
text_offset = 9.0; textoffset = 9.0;
} }
if (symbol->output_options & SMALL_TEXT) if (symbol->output_options & SMALL_TEXT)
text_height *= 0.8f; text_height *= 0.8;
set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset); vector->width = ceil(symbol->width + (xoffset + roffset));
vector->height = ceil(symbol->height + textoffset + (yoffset + boffset));
// Determine if height should be overridden
large_bar_count = 0;
preset_height = 0.0;
for (i = 0; i < symbol->rows; i++) {
preset_height += symbol->row_height[i];
if (symbol->row_height[i] == 0) {
large_bar_count++;
}
}
vector->width = (float)ceil(symbol->width + (xoffset + roffset));
vector->height = (float)ceil(symbol->height + text_offset + (yoffset + boffset));
large_bar_height = large_bar_count ? (symbol->height - preset_height) / large_bar_count : 0 /*Not used if large_bar_count zero*/;
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) { if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
default_text_posn = symbol->height + text_offset + symbol->border_width + symbol->border_width; default_text_posn = symbol->height + textoffset + symbol->border_width + symbol->border_width;
} else { } else {
default_text_posn = symbol->height + text_offset; default_text_posn = symbol->height + textoffset;
} }
row_height = 0.0;
rect_count = 0;
last_row_start = 0;
// Plot rectangles - most symbols created here // Plot rectangles - most symbols created here
if ((symbol->symbology != BARCODE_MAXICODE) && ((symbol->output_options & BARCODE_DOTTY_MODE) == 0)) { if ((symbol->symbology != BARCODE_MAXICODE) && ((symbol->output_options & BARCODE_DOTTY_MODE) == 0)) {
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
@ -434,7 +361,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
if (symbol->row_height[this_row] == 0) { if (symbol->row_height[this_row] == 0) {
row_height = large_bar_height; row_height = large_bar_height;
} else { } else {
row_height = (float)symbol->row_height[this_row]; row_height = symbol->row_height[this_row];
} }
row_posn = 0; row_posn = 0;
for (i = 0; i < r; i++) { for (i = 0; i < r; i++) {
@ -453,19 +380,23 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
do { do {
block_width++; block_width++;
} while (i + block_width < symbol->width && module_is_set(symbol, this_row, i + block_width) == module_is_set(symbol, this_row, i)); } while (i + block_width < symbol->width && module_is_set(symbol, this_row, i + block_width) == module_is_set(symbol, this_row, i));
if ((addon_latch == 0) && (r == (symbol->rows - 1)) && (i > main_symbol_width_x)) { if ((addon_latch == 0) && (r == (symbol->rows - 1)) && (i > main_width)) {
addon_text_posn = row_posn + 8.0f; addon_text_posn = row_posn + 8.0;
addon_latch = 1; addon_latch = 1;
} }
if (module_is_set(symbol, this_row, i)) { if (module_is_set(symbol, this_row, i)) {
/* a bar or colour block */ /* a bar or colour block */
if (addon_latch == 0) { if (addon_latch == 0) {
rectangle = vector_plot_create_rect((float)(i + xoffset), row_posn, (float)block_width, row_height); rectangle = vector_plot_create_rect(i + xoffset, row_posn, block_width, row_height);
if (symbol->symbology == BARCODE_ULTRA) { if (symbol->symbology == BARCODE_ULTRA) {
rectangle->colour = module_is_set(symbol, this_row, i); rectangle->colour = module_is_set(symbol, this_row, i);
} }
} else { } else {
rectangle = vector_plot_create_rect((float)(i + xoffset), row_posn + 10.0f, (float)block_width, row_height - 5.0f); if (upceanflag == 12 || upceanflag == 6) { /* UPC-A/E don't descend */
rectangle = vector_plot_create_rect(i + xoffset, row_posn + 10.0, block_width, row_height > 10.0 ? row_height - 10.0 : 1.0);
} else {
rectangle = vector_plot_create_rect(i + xoffset, row_posn + 10.0, block_width, row_height > 5.0 ? row_height - 5.0 : 1.0);
}
} }
vector_plot_add_rect(symbol, rectangle, &last_rectangle); vector_plot_add_rect(symbol, rectangle, &last_rectangle);
rect_count++; rect_count++;
@ -479,21 +410,21 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
// Plot Maxicode symbols // Plot Maxicode symbols
if (symbol->symbology == BARCODE_MAXICODE) { if (symbol->symbology == BARCODE_MAXICODE) {
struct zint_vector_circle *circle; struct zint_vector_circle *circle;
vector->width = 37.0f + (xoffset + roffset); vector->width = 37.0 + (xoffset + roffset);
vector->height = 36.0f + (yoffset + boffset); vector->height = 36.0 + (yoffset + boffset);
// Bullseye // Bullseye
circle = vector_plot_create_circle(17.88f + xoffset, 17.8f + yoffset, 10.85f, 0); circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 10.85, 0);
vector_plot_add_circle(symbol, circle, &last_circle); vector_plot_add_circle(symbol, circle, &last_circle);
circle = vector_plot_create_circle(17.88f + xoffset, 17.8f + yoffset, 8.97f, 1); circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 8.97, 1);
vector_plot_add_circle(symbol, circle, &last_circle); vector_plot_add_circle(symbol, circle, &last_circle);
circle = vector_plot_create_circle(17.88f + xoffset, 17.8f + yoffset, 7.10f, 0); circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 7.10, 0);
vector_plot_add_circle(symbol, circle, &last_circle); vector_plot_add_circle(symbol, circle, &last_circle);
circle = vector_plot_create_circle(17.88f + xoffset, 17.8f + yoffset, 5.22f, 1); circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 5.22, 1);
vector_plot_add_circle(symbol, circle, &last_circle); vector_plot_add_circle(symbol, circle, &last_circle);
circle = vector_plot_create_circle(17.88f + xoffset, 17.8f + yoffset, 3.31f, 0); circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 3.31, 0);
vector_plot_add_circle(symbol, circle, &last_circle); vector_plot_add_circle(symbol, circle, &last_circle);
circle = vector_plot_create_circle(17.88f + xoffset, 17.8f + yoffset, 1.43f, 1); circle = vector_plot_create_circle(17.88 + xoffset, 17.8 + yoffset, 1.43, 1);
vector_plot_add_circle(symbol, circle, &last_circle); vector_plot_add_circle(symbol, circle, &last_circle);
/* Hexagons */ /* Hexagons */
@ -501,8 +432,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
for (i = 0; i < symbol->width; i++) { for (i = 0; i < symbol->width; i++) {
if (module_is_set(symbol, r, i)) { if (module_is_set(symbol, r, i)) {
//struct zint_vector_hexagon *hexagon = vector_plot_create_hexagon(((i * 0.88) + ((r & 1) ? 1.76 : 1.32)), ((r * 0.76) + 0.76), symbol->dot_size); //struct zint_vector_hexagon *hexagon = vector_plot_create_hexagon(((i * 0.88) + ((r & 1) ? 1.76 : 1.32)), ((r * 0.76) + 0.76), symbol->dot_size);
struct zint_vector_hexagon *hexagon = vector_plot_create_hexagon(((i * 1.23f) + 0.615f + ((r & 1) ? 0.615f : 0.0f)) + xoffset, struct zint_vector_hexagon *hexagon = vector_plot_create_hexagon(((i * 1.23) + 0.615 + ((r & 1) ? 0.615 : 0.0)) + xoffset,
((r * 1.067f) + 0.715f) + yoffset, symbol->dot_size); ((r * 1.067) + 0.715) + yoffset, symbol->dot_size);
vector_plot_add_hexagon(symbol, hexagon, &last_hexagon); vector_plot_add_hexagon(symbol, hexagon, &last_hexagon);
} }
} }
@ -514,247 +445,204 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
for (r = 0; r < symbol->rows; r++) { for (r = 0; r < symbol->rows; r++) {
for (i = 0; i < symbol->width; i++) { for (i = 0; i < symbol->width; i++) {
if (module_is_set(symbol, r, i)) { if (module_is_set(symbol, r, i)) {
struct zint_vector_circle *circle = vector_plot_create_circle(i + 0.5f + xoffset, r + 0.5f + yoffset, 1.0f, 0); struct zint_vector_circle *circle = vector_plot_create_circle(i + 0.5 + xoffset, r + 0.5 + yoffset, 1.0, 0);
vector_plot_add_circle(symbol, circle, &last_circle); vector_plot_add_circle(symbol, circle, &last_circle);
} }
} }
} }
} }
/* Guard bar extension */ if (upceanflag) {
if (upceanflag == 6) { /* Guard bar extension */
i = 0; if (upceanflag == 6) { /* UPC-E */
for (rect = symbol->vector->rectangles; rect != NULL; rect = rect->next) { i = 0;
switch (i - last_row_start) { for (rect = symbol->vector->rectangles; rect != NULL; rect = rect->next) {
case 0: switch (i - last_row_start) {
case 1: case 0:
case 14: case 1:
case 15: case 14:
case 16: case 15:
rect->height += 5.0; case 16:
break; rect->height += 5.0;
break;
}
i++;
} }
i++; } else if (upceanflag == 8) { /* EAN-8 */
} i = 0;
} for (rect = symbol->vector->rectangles; rect != NULL; rect = rect->next) {
switch (i - last_row_start) {
if (upceanflag == 8) { case 0:
i = 0; case 1:
for (rect = symbol->vector->rectangles; rect != NULL; rect = rect->next) { case 10:
switch (i - last_row_start) { case 11:
case 0: case 20:
case 1: case 21:
case 10: rect->height += 5.0;
case 11: break;
case 20: }
case 21: i++;
rect->height += 5.0;
break;
} }
i++; } else if (upceanflag == 12) { /* UPC-A */
} i = 0;
} for (rect = symbol->vector->rectangles; rect != NULL; rect = rect->next) {
switch (i - last_row_start) {
if (upceanflag == 12) { case 0:
i = 0; case 1:
for (rect = symbol->vector->rectangles; rect != NULL; rect = rect->next) { case 2:
switch (i - last_row_start) { case 3:
case 0: case 14:
case 1: case 15:
case 2: case 26:
case 3: case 27:
case 14: case 28:
case 15: case 29:
case 26: rect->height += 5.0;
case 27: break;
case 28: }
case 29: i++;
rect->height += 5.0;
break;
} }
i++; } else if (upceanflag == 13) { /* EAN-13 */
} i = 0;
} for (rect = symbol->vector->rectangles; rect != NULL; rect = rect->next) {
switch (i - last_row_start) {
if (upceanflag == 13) { case 0:
i = 0; case 1:
for (rect = symbol->vector->rectangles; rect != NULL; rect = rect->next) { case 14:
switch (i - last_row_start) { case 15:
case 0: case 28:
case 1: case 29:
case 14: rect->height += 5.0;
case 15: break;
case 28: }
case 29: i++;
rect->height += 5.0;
break;
} }
i++;
} }
} }
/* Add the text */ /* Add the text */
if (!hide_text) { if (!hide_text) {
char textpart[10];
float textwidth;
xoffset += symbol_lead_in; xoffset += comp_offset;
if (upceanflag == 8) { if (upceanflag) {
for (i = 0; i < 4; i++) { double textwidth;
textpart[i] = symbol->text[i]; output_upcean_split_text(upceanflag, symbol->text, textpart1, textpart2, textpart3, textpart4);
}
textpart[4] = '\0';
textpos = 17;
textwidth = 4.0 * 8.5;
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn, text_height, textwidth, &last_string);
for (i = 0; i < 4; i++) {
textpart[i] = symbol->text[i + 4];
}
textpart[4] = '\0';
textpos = 50;
vector_plot_add_string(symbol, (unsigned char *) textpart, (textpos + xoffset), default_text_posn, text_height, textwidth, &last_string);
textdone = 1;
switch (strlen(addon)) {
case 2:
textpos = (float)(xoffset + 86);
textwidth = 2.0f * 8.5f;
vector_plot_add_string(symbol, (unsigned char *) addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
case 5:
textpos = (float)(xoffset + 100);
textwidth = 5.0f * 8.5f;
vector_plot_add_string(symbol, (unsigned char *) addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
}
} if (upceanflag == 6) { /* UPC-E */
textpos = -5 + xoffset;
textwidth = 6.2;
vector_plot_add_string(symbol, textpart1, textpos, default_text_posn - 2.0, text_height * (8.0 / 11.0), textwidth, &last_string);
textpos = 24 + xoffset;
textwidth = 6.0 * 8.5;
vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, &last_string);
textpos = 55 + xoffset;
textwidth = 6.2;
vector_plot_add_string(symbol, textpart3, textpos, default_text_posn - 2.0, text_height * (8.0 / 11.0), textwidth, &last_string);
textdone = 1;
switch (ustrlen(addon)) {
case 2:
textpos = 61 + xoffset + addon_gap;
textwidth = 2.0 * 8.5;
vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
case 5:
textpos = 75 + xoffset + addon_gap;
textwidth = 5.0 * 8.5;
vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
}
if (upceanflag == 13) { } else if (upceanflag == 8) { /* EAN-8 */
textpart[0] = symbol->text[0]; textpos = 17 + xoffset;
textpart[1] = '\0'; textwidth = 4.0 * 8.5;
textpos = -5; // 7 vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, text_height, textwidth, &last_string);
textwidth = 8.5; textpos = 50 + xoffset;
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn, text_height, textwidth, &last_string); vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, &last_string);
textdone = 1;
switch (ustrlen(addon)) {
case 2:
textpos = 77 + xoffset + addon_gap;
textwidth = 2.0 * 8.5;
vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
case 5:
textpos = 91 + xoffset + addon_gap;
textwidth = 5.0 * 8.5;
vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
}
for (i = 0; i < 6; i++) { } else if (upceanflag == 12) { /* UPC-A */
textpart[i] = symbol->text[i + 1]; textpos = -5 + xoffset;
} textwidth = 6.2;
textpart[6] = '\0'; vector_plot_add_string(symbol, textpart1, textpos, default_text_posn - 2.0, text_height * (8.0 / 11.0), textwidth, &last_string);
textpos = 25; textpos = 27 + xoffset;
textwidth = 6.0 * 8.5; textwidth = 5.0 * 8.5;
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn, text_height, textwidth, &last_string); vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, &last_string);
for (i = 0; i < 6; i++) { textpos = 68 + xoffset;
textpart[i] = symbol->text[i + 7]; vector_plot_add_string(symbol, textpart3, textpos, default_text_posn, text_height, textwidth, &last_string);
} textpos = 100 + xoffset;
textpart[6] = '\0'; textwidth = 6.2;
textpos = 72; vector_plot_add_string(symbol, textpart4, textpos, default_text_posn - 2.0, text_height * (8.0 / 11.0), textwidth, &last_string);
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn, text_height, textwidth, &last_string); textdone = 1;
textdone = 1; switch (ustrlen(addon)) {
switch (strlen(addon)) { case 2:
case 2: textpos = 107 + xoffset + addon_gap;
textpos = (float)(xoffset + 114); textwidth = 2.0 * 8.5;
textwidth = 2.0f * 8.5f; vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
vector_plot_add_string(symbol, (unsigned char *) addon, textpos, addon_text_posn, text_height, textwidth, &last_string); break;
break; case 5:
case 5: textpos = 121 + xoffset + addon_gap;
textpos = (float)(xoffset + 128); textwidth = 5.0 * 8.5;
textwidth = 5.0f * 8.5f; vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
vector_plot_add_string(symbol, (unsigned char *) addon, textpos, addon_text_posn, text_height, textwidth, &last_string); break;
break; }
} else if (upceanflag == 13) { /* EAN-13 */
textpos = -7 + xoffset;
textwidth = 8.5;
vector_plot_add_string(symbol, textpart1, textpos, default_text_posn, text_height, textwidth, &last_string);
textpos = 24 + xoffset;
textwidth = 6.0 * 8.5;
vector_plot_add_string(symbol, textpart2, textpos, default_text_posn, text_height, textwidth, &last_string);
textpos = 71 + xoffset;
vector_plot_add_string(symbol, textpart3, textpos, default_text_posn, text_height, textwidth, &last_string);
textdone = 1;
switch (ustrlen(addon)) {
case 2:
textpos = 105 + xoffset + addon_gap;
textwidth = 2.0 * 8.5;
vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
case 5:
textpos = 119 + xoffset + addon_gap;
textwidth = 5.0 * 8.5;
vector_plot_add_string(symbol, addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
}
} }
} }
if (upceanflag == 12) { if (!textdone) {
textpart[0] = symbol->text[0]; /* Put normal human readable text at the bottom (and centered) */
textpart[1] = '\0'; // calculate start xoffset to center text
textpos = -5; vector_plot_add_string(symbol, symbol->text, main_width / 2.0 + xoffset, default_text_posn, text_height, symbol->width, &last_string);
textwidth = 6.2f;
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn - 2.0f, text_height * (8.0f / 11.0f), textwidth, &last_string); // Remove control characters from readable text
for (i = 0; i < 5; i++) { // This only applies to Code 128
textpart[i] = symbol->text[i + 1]; string = symbol->vector->strings;
} if (string) {
textpart[5] = '\0'; for (i = 0; i < string->length; i++) {
textpos = 27; if (string->text[i] < ' ') {
textwidth = 5.0f * 8.5f; string->text[i] = ' ';
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn, text_height, textwidth, &last_string); }
for (i = 0; i < 5; i++) { }
textpart[i] = symbol->text[i + 6];
}
textpos = 68;
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn, text_height, textwidth, &last_string);
textpart[0] = symbol->text[11];
textpart[1] = '\0';
textpos = 100;
textwidth = 6.2f;
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn - 2.0f, text_height * (8.0f / 11.0f), textwidth, &last_string);
textdone = 1;
switch (strlen(addon)) {
case 2:
textpos = (float)(xoffset + 116);
textwidth = 2.0f * 8.5f;
vector_plot_add_string(symbol, (unsigned char *) addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
case 5:
textpos = (float)(xoffset + 130);
textwidth = 5.0f * 8.5f;
vector_plot_add_string(symbol, (unsigned char *) addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
} }
} }
if (upceanflag == 6) { xoffset -= comp_offset; // Restore xoffset
textpart[0] = symbol->text[0];
textpart[1] = '\0';
textpos = -5;
textwidth = 6.2f;
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn - 2.0f, text_height * (8.0f / 11.0f), textwidth, &last_string);
for (i = 0; i < 6; i++) {
textpart[i] = symbol->text[i + 1];
}
textpart[6] = '\0';
textpos = 24;
textwidth = 6.0 * 8.5;
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn, text_height, textwidth, &last_string);
textpart[0] = symbol->text[7];
textpart[1] = '\0';
textpos = 55;
textwidth = 6.2f;
vector_plot_add_string(symbol, (unsigned char *) textpart, textpos + xoffset, default_text_posn - 2.0f, text_height * (8.0f / 11.0f), textwidth, &last_string);
textdone = 1;
switch (strlen(addon)) {
case 2:
textpos = (float)(xoffset + 70);
textwidth = 2.0f * 8.5f;
vector_plot_add_string(symbol, (unsigned char *) addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
case 5:
textpos = (float)(xoffset + 84);
textwidth = 5.0f * 8.5f;
vector_plot_add_string(symbol, (unsigned char *) addon, textpos, addon_text_posn, text_height, textwidth, &last_string);
break;
}
}
/* Put normal human readable text at the bottom (and centered) */
if (textdone == 0) {
// caculate start xoffset to center text
vector_plot_add_string(symbol, symbol->text, (symbol->width / 2.0f) + xoffset, default_text_posn, text_height, (float)symbol->width, &last_string);
}
xoffset -= symbol_lead_in; // Restore xoffset
}
//Remove control characters from readable text
// This only applies to Code 128
string = symbol->vector->strings;
if (string) {
for (i = 0; i < string->length; i++) {
if (string->text[i] < ' ') {
string->text[i] = ' ';
}
}
} }
// Binding and boxes // Binding and boxes
@ -767,7 +655,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
/* row binding */ /* row binding */
for (r = 1; r < symbol->rows; r++) { for (r = 1; r < symbol->rows; r++) {
if (symbol->symbology != BARCODE_CODABLOCKF && symbol->symbology != BARCODE_HIBC_BLOCKF) { if (symbol->symbology != BARCODE_CODABLOCKF && symbol->symbology != BARCODE_HIBC_BLOCKF) {
rectangle = vector_plot_create_rect((float)xoffset, (r * row_height) + yoffset - sep_height / 2, (float)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); vector_plot_add_rect(symbol, rectangle, &last_rectangle);
} else { } else {
/* Avoid 11-module start and 13-module stop chars */ /* Avoid 11-module start and 13-module stop chars */
@ -779,26 +667,26 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
} }
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) { if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
// Top // Top
rectangle = vector_plot_create_rect(0.0f, 0.0f, vector->width, (float)symbol->border_width); rectangle = vector_plot_create_rect(0.0, 0.0, vector->width, symbol->border_width);
if (!(symbol->output_options & BARCODE_BOX) && (symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF)) { if (!(symbol->output_options & BARCODE_BOX) && (symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF)) {
rectangle->x = (float)xoffset; rectangle->x = xoffset;
rectangle->width -= (2.0f * xoffset); rectangle->width -= (2.0 * xoffset);
} }
vector_plot_add_rect(symbol, rectangle, &last_rectangle); vector_plot_add_rect(symbol, rectangle, &last_rectangle);
// Bottom // Bottom
rectangle = vector_plot_create_rect(0.0f, vector->height - symbol->border_width - text_offset, vector->width, (float)symbol->border_width); rectangle = vector_plot_create_rect(0.0, vector->height - symbol->border_width - textoffset, vector->width, symbol->border_width);
if (!(symbol->output_options & BARCODE_BOX) && (symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF)) { if (!(symbol->output_options & BARCODE_BOX) && (symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF)) {
rectangle->x = (float)xoffset; rectangle->x = xoffset;
rectangle->width -= (2.0f * xoffset); rectangle->width -= (2.0 * xoffset);
} }
vector_plot_add_rect(symbol, rectangle, &last_rectangle); vector_plot_add_rect(symbol, rectangle, &last_rectangle);
} }
if (symbol->output_options & BARCODE_BOX) { if (symbol->output_options & BARCODE_BOX) {
// Left // Left
rectangle = vector_plot_create_rect(0.0f, 0.0f, (float)symbol->border_width, vector->height - text_offset); rectangle = vector_plot_create_rect(0.0, 0.0, symbol->border_width, vector->height - textoffset);
vector_plot_add_rect(symbol, rectangle, &last_rectangle); vector_plot_add_rect(symbol, rectangle, &last_rectangle);
// Right // Right
rectangle = vector_plot_create_rect(vector->width - symbol->border_width, 0.0f, (float)symbol->border_width, vector->height - text_offset); rectangle = vector_plot_create_rect(vector->width - symbol->border_width, 0.0, symbol->border_width, vector->height - textoffset);
vector_plot_add_rect(symbol, rectangle, &last_rectangle); vector_plot_add_rect(symbol, rectangle, &last_rectangle);
} }

View File

@ -297,7 +297,7 @@ Numeric Value | Barcode Name
72 | EAN-14 72 | EAN-14
73 | Vehicle Identification Number 73 | Vehicle Identification Number
74 | Codablock-F 74 | Codablock-F
75 | NVE-18 75 | NVE-18 (SSCC-18)
76 | Japanese Postal Code 76 | Japanese Postal Code
77 | Korea Post 77 | Korea Post
79 | GS1 DataBar Stacked (stacked version of GS1 DataBar Truncated) 79 | GS1 DataBar Stacked (stacked version of GS1 DataBar Truncated)
@ -352,7 +352,7 @@ example:
zint --height=100 -d "This Text" zint --height=100 -d "This Text"
This specifies a symbol height of 100 times the x-resolution of the symbol. This specifies a symbol height of 100 times the X-dimension of the symbol.
4.5 Adjusting whitespace 4.5 Adjusting whitespace
------------------------ ------------------------
@ -361,7 +361,7 @@ altered using the w switch. For example:
zint -w 10 -d "This Text" zint -w 10 -d "This Text"
This specifies a whitespace width of 10 times the x-resolution of the symbol. This specifies a whitespace width of 10 times the X-dimension of the symbol.
4.6 Adding boundary bars and boxes 4.6 Adding boundary bars and boxes
---------------------------------- ----------------------------------
@ -376,7 +376,7 @@ For example:
zint --box --border=10 -d "This" zint --box --border=10 -d "This"
gives a box with a width 10 times the x-resolution of the symbol. gives a box with a width 10 times the X-dimension of the symbol.
4.7 Using colour 4.7 Using colour
---------------- ----------------
@ -1031,7 +1031,7 @@ Value |
72 | BARCODE_EAN14 | EAN-14 72 | BARCODE_EAN14 | EAN-14
73 | BARCODE_VIN | Vehicle Identification Number 73 | BARCODE_VIN | Vehicle Identification Number
74 | BARCODE_CODABLOCKF | Codablock-F 74 | BARCODE_CODABLOCKF | Codablock-F
75 | BARCODE_NVE18 | NVE-18 75 | BARCODE_NVE18 | NVE-18 (SSCC-18)
76 | BARCODE_JAPANPOST | Japanese Postal Code 76 | BARCODE_JAPANPOST | Japanese Postal Code
77 | BARCODE_KOREAPOST | Korea Post 77 | BARCODE_KOREAPOST | Korea Post
79 | BARCODE_RSS14STACK | GS1 DataBar Stacked 79 | BARCODE_RSS14STACK | GS1 DataBar Stacked
@ -1245,8 +1245,13 @@ my_symbol->symbology = BARCODE_UPCA;
error = ZBarcode_Encode_and_Print(my_symbol, "72527270270+12345"); error = ZBarcode_Encode_and_Print(my_symbol, "72527270270+12345");
If your input data already includes the check digit symbology 35 can be used If your input data already includes the check digit symbology BARCODE_UPCA_CHK
which takes a 12 digit input and validates the check digit before encoding. (35) can be used which takes a 12 digit input and validates the check digit
before encoding.
You can adjust the gap between the main symbol and an add-on in multiples of
the X-dimension by setting --addongap= (option_2) to a value between 9 (default)
and 12.
6.1.3.2 UPC Version E 6.1.3.2 UPC Version E
--------------------- ---------------------
@ -1265,8 +1270,13 @@ my_symbol->symbology = BARCODE_UPCE;
error = ZBarcode_Encode_and_Print(my_symbol, "1123456"); error = ZBarcode_Encode_and_Print(my_symbol, "1123456");
If your input data already includes the check digit symbology 38 can be used If your input data already includes the check digit symbology BARCODE_UPCE_CHK
which takes a 7 or 8 digit input and validates the check digit before encoding. (38) can be used which takes a 7 or 8 digit input and validates the check digit
before encoding.
You can adjust the gap between the main symbol and an add-on in multiples of
the X-dimension by setting --addongap= (option_2) to a value between 7 (default)
and 12.
6.1.4 European Article Number (EN 797) 6.1.4 European Article Number (EN 797)
-------------------------------------- --------------------------------------
@ -1296,8 +1306,12 @@ error = ZBarcode_Encode_and_Print(my_symbol, "7432365+54321");
All of the EAN symbols include check digits which are added by Zint. All of the EAN symbols include check digits which are added by Zint.
If you are encoding an EAN-8 or EAN-13 symbol and your data already includes If you are encoding an EAN-8 or EAN-13 symbol and your data already includes
the check digit then you can use symbology 14 which takes an 8 or 13 digit input the check digit then you can use symbology BARCODE_EANX_CHK (14) which takes an
and validates the check digit before encoding. 8 or 13 digit input and validates the check digit before encoding.
You can adjust the gap between the main symbol and an add-on in multiples of
the X-dimension by setting --addongap= (option_2) to a value between 7 (default)
and 12.
6.1.4.2 SBN, ISBN and ISBN-13 6.1.4.2 SBN, ISBN and ISBN-13
----------------------------- -----------------------------
@ -1305,7 +1319,8 @@ EAN-13 symbols (also known as Bookland EAN-13) can also be produced from
9-digit SBN, 10-digit ISBN or 13-digit ISBN-13 data. The relevant check digit 9-digit SBN, 10-digit ISBN or 13-digit ISBN-13 data. The relevant check digit
needs to be present in the input data and will be verified before the symbol is needs to be present in the input data and will be verified before the symbol is
generated. In addition EAN-2 and EAN-5 add-on symbols can be added using the + generated. In addition EAN-2 and EAN-5 add-on symbols can be added using the +
symbol as with UPC symbols. symbol as with UPC symbols, and the gap set with --addongap= (option_2) to
between 7 (default) and 12.
6.1.5 Plessey 6.1.5 Plessey
------------- -------------
@ -1454,11 +1469,12 @@ zint --barcode=16 -d "[01]98898765432106[3202]012345[15]991231"
A shorter version of GS1-128 which encodes GTIN data only. A 13 digit number is A shorter version of GS1-128 which encodes GTIN data only. A 13 digit number is
required. The GTIN check digit and AI (01) are added by Zint. required. The GTIN check digit and AI (01) are added by Zint.
6.1.11.5 NVE-18 6.1.11.5 NVE-18 (SSCC-18)
--------------- -------------------------
A variation of Code 128 the "Nummer der Versandeinheit" standard includes both A variation of Code 128 the "Nummer der Versandeinheit" standard, also known as
modulo-10 and modulo-103 check digits. NVE-18 requires a 17 digit numerical SSCC-18 (Serial Shipping Container Code), includes both modulo-10 and modulo-103
input and check digits are added by Zint. check digits. NVE-18 requires a 17 digit numerical input. Check digits and AI
(00) are added by Zint.
6.1.11.6 HIBC Code 128 6.1.11.6 HIBC Code 128
---------------------- ----------------------

View File

@ -78,6 +78,7 @@ static void usage(void) {
printf( "Zint version %d.%d.%d\n" printf( "Zint version %d.%d.%d\n"
"Encode input data in a barcode and save as BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT\n\n" "Encode input data in a barcode and save as BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT\n\n"
" -b, --barcode=NUMBER Number of barcode type. Default is 20 (Code 128)\n" " -b, --barcode=NUMBER Number of barcode type. Default is 20 (Code 128)\n"
" --addongap=NUMBER Set add-on gap in multiples of X-dimension for UPC/EAN\n"
" --batch Treat each line of input file as a separate data set\n" " --batch Treat each line of input file as a separate data set\n"
" --bg=COLOUR Specify a background colour (in hex)\n" " --bg=COLOUR Specify a background colour (in hex)\n"
" --binary Treat input as raw binary data\n" " --binary Treat input as raw binary data\n"
@ -420,6 +421,27 @@ static int is_stackable(const int symbology) {
return 0; return 0;
} }
/* Indicates which symbols can have addon (EAN-2 and EAN-5)
* Note: if change this must also change version in backend/common.c */
static int is_extendable(const int symbology) {
switch (symbology) {
case BARCODE_EANX:
case BARCODE_EANX_CHK:
case BARCODE_UPCA:
case BARCODE_UPCA_CHK:
case BARCODE_UPCE:
case BARCODE_UPCE_CHK:
case BARCODE_ISBNX:
case BARCODE_EANX_CC:
case BARCODE_UPCA_CC:
case BARCODE_UPCE_CC:
return 1;
}
return 0;
}
int main(int argc, char **argv) { int main(int argc, char **argv) {
struct zint_symbol *my_symbol; struct zint_symbol *my_symbol;
int error_number; int error_number;
@ -429,6 +451,7 @@ int main(int argc, char **argv) {
int mirror_mode; int mirror_mode;
int fullmultibyte; int fullmultibyte;
int separator; int separator;
int addon_gap;
char filetype[4]; char filetype[4];
int i; int i;
@ -441,6 +464,7 @@ int main(int argc, char **argv) {
mirror_mode = 0; mirror_mode = 0;
fullmultibyte = 0; fullmultibyte = 0;
separator = 0; separator = 0;
addon_gap = 0;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
filetype[i] = '\0'; filetype[i] = '\0';
@ -491,6 +515,7 @@ int main(int argc, char **argv) {
{"small", 0, 0, 0}, {"small", 0, 0, 0},
{"bold", 0, 0, 0}, {"bold", 0, 0, 0},
{"cmyk", 0, 0, 0}, {"cmyk", 0, 0, 0},
{"addongap", 1, 0, 0},
{"batch", 0, 0, 0}, {"batch", 0, 0, 0},
{"mirror", 0, 0, 0}, {"mirror", 0, 0, 0},
{"dotty", 0, 0, 0}, {"dotty", 0, 0, 0},
@ -591,6 +616,19 @@ int main(int argc, char **argv) {
separator = 0; separator = 0;
} }
} }
if (!strcmp(long_options[option_index].name, "addongap")) {
error_number = validator(NESET, optarg);
if (error_number == ZINT_ERROR_INVALID_DATA) {
fprintf(stderr, "Error 139: Invalid add-on gap value\n");
exit(1);
}
addon_gap = atoi(optarg);
if (addon_gap < 7 || addon_gap > 12) {
fprintf(stderr, "Warning 140: Invalid add-on gap value\n");
fflush(stderr);
addon_gap = 0;
}
}
if (!strcmp(long_options[option_index].name, "dotsize")) { if (!strcmp(long_options[option_index].name, "dotsize")) {
my_symbol->dot_size = (float) (atof(optarg)); my_symbol->dot_size = (float) (atof(optarg));
if (my_symbol->dot_size < 0.01) { if (my_symbol->dot_size < 0.01) {
@ -816,6 +854,9 @@ int main(int argc, char **argv) {
} else if (separator && is_stackable(my_symbol->symbology)) { } else if (separator && is_stackable(my_symbol->symbology)) {
my_symbol->option_3 = separator; my_symbol->option_3 = separator;
} }
if (addon_gap && is_extendable(my_symbol->symbology)) {
my_symbol->option_2 = addon_gap;
}
error_number = ZBarcode_Encode(my_symbol, (unsigned char*) optarg, strlen(optarg)); error_number = ZBarcode_Encode(my_symbol, (unsigned char*) optarg, strlen(optarg));
generated = 1; generated = 1;
if (error_number != 0) { if (error_number != 0) {

View File

@ -8,9 +8,9 @@ set(zint-qt_SRCS barcodeitem.cpp main.cpp mainwindow.cpp datawindow.cpp sequen
QT5_WRAP_CPP(zint-qt_SRCS mainwindow.h datawindow.h sequencewindow.h exportwindow.h) QT5_WRAP_CPP(zint-qt_SRCS mainwindow.h datawindow.h sequencewindow.h exportwindow.h)
QT5_WRAP_UI(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui) QT5_WRAP_UI(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui)
# grpAztec.ui grpC49.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpVIN.ui # grpAztec.ui grpC49.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpUPCA.ui
# grpC11.ui grpChannel.ui grpDM.ui grpMaxicode.ui grpPZN.ui # grpC11.ui grpChannel.ui grpDM.ui grpMaxicode.ui grpPZN.ui grpUPCEAN.ui
# grpC128.ui grpCodabar.ui grpDotCode.ui grpMicroPDF.ui grpQR.ui # grpC128.ui grpCodabar.ui grpDotCode.ui grpMicroPDF.ui grpQR.ui grpVIN.ui
# grpC16k.ui grpCodablockF.ui grpGrid.ui grpMQR.ui grpRMQR.ui # grpC16k.ui grpCodablockF.ui grpGrid.ui grpMQR.ui grpRMQR.ui
# grpC39.ui grpCodeOne.ui grpHX.ui grpMSICheck.ui grpUltra.ui # grpC39.ui grpCodeOne.ui grpHX.ui grpMSICheck.ui grpUltra.ui

View File

@ -39,6 +39,8 @@ FORMS += extData.ui \
grpPDF417.ui \ grpPDF417.ui \
grpQR.ui \ grpQR.ui \
grpRMQR.ui \ grpRMQR.ui \
grpUPCA.ui \
grpUPCEAN.ui \
grpVIN.ui \ grpVIN.ui \
mainWindow.ui \ mainWindow.ui \
grpDotCode.ui grpDotCode.ui

81
frontend_qt/grpUPCA.ui Normal file
View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>grpUPCA</class>
<widget class="QWidget" name="grpUPCA">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>310</width>
<height>78</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lblUPCAAddonGap">
<property name="text">
<string>&amp;Add-on Gap:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>cmbUPCAAddonGap</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbUPCAAddonGap">
<item>
<property name="text">
<string>9 X (default)</string>
</property>
</item>
<item>
<property name="text">
<string>10 X</string>
</property>
</item>
<item>
<property name="text">
<string>11 X</string>
</property>
</item>
<item>
<property name="text">
<string>12 X</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

91
frontend_qt/grpUPCEAN.ui Normal file
View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>grpUPCEAN</class>
<widget class="QWidget" name="grpUPCEAN">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>310</width>
<height>78</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>16777215</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lblUPCEANAddonGap">
<property name="text">
<string>&amp;Add-on Gap:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>cmbUPCEANAddonGap</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="cmbUPCEANAddonGap">
<item>
<property name="text">
<string>7 X (default)</string>
</property>
</item>
<item>
<property name="text">
<string>8 X</string>
</property>
</item>
<item>
<property name="text">
<string>9 X</string>
</property>
</item>
<item>
<property name="text">
<string>10 X</string>
</property>
</item>
<item>
<property name="text">
<string>11 X</string>
</property>
</item>
<item>
<property name="text">
<string>12 X</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -96,7 +96,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl)
"MicroPDF417 (ISO 24728)", "MicroPDF417 (ISO 24728)",
"Micro QR Code", "Micro QR Code",
"MSI Plessey", "MSI Plessey",
"NVE-18", "NVE-18 (SSCC-18)",
"PDF417 (ISO 15438)", "PDF417 (ISO 15438)",
"Pharmacode", "Pharmacode",
"Pharmacode 2-track", "Pharmacode 2-track",
@ -738,6 +738,36 @@ void MainWindow::change_options()
connect(m_optionWidget->findChild<QObject*>("radUltraGS1"), SIGNAL(clicked( bool )), SLOT(update_preview())); connect(m_optionWidget->findChild<QObject*>("radUltraGS1"), SIGNAL(clicked( bool )), SLOT(update_preview()));
} }
if (symbology == BARCODE_UPCA || symbology == BARCODE_UPCA_CHK || symbology == BARCODE_UPCA_CC)
{
QFile file(":/grpUPCA.ui");
if (!file.open(QIODevice::ReadOnly))
return;
m_optionWidget=uiload.load(&file);
file.close();
tabMain->insertTab(1, m_optionWidget, tr("UPC-A"));
connect(m_optionWidget->findChild<QObject*>("cmbUPCAAddonGap"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
}
if (symbology == BARCODE_EANX || symbology == BARCODE_EANX_CHK || symbology == BARCODE_EANX_CC
|| symbology == BARCODE_UPCE || symbology == BARCODE_UPCE_CHK || symbology == BARCODE_UPCE_CC
|| symbology == BARCODE_ISBNX)
{
QFile file(":/grpUPCEAN.ui");
if (!file.open(QIODevice::ReadOnly))
return;
m_optionWidget=uiload.load(&file);
file.close();
if (symbology == BARCODE_UPCE || symbology == BARCODE_UPCE_CHK || symbology == BARCODE_UPCE_CC) {
tabMain->insertTab(1, m_optionWidget, tr("UPC-E"));
} else if (symbology == BARCODE_ISBNX) {
tabMain->insertTab(1, m_optionWidget, tr("ISBN"));
} else {
tabMain->insertTab(1, m_optionWidget, tr("EAN"));
}
connect(m_optionWidget->findChild<QObject*>("cmbUPCEANAddonGap"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
}
if (symbology == BARCODE_VIN) if (symbology == BARCODE_VIN)
{ {
QFile file(":/grpVIN.ui"); QFile file(":/grpVIN.ui");
@ -812,8 +842,27 @@ void MainWindow::maxi_primary()
} }
} }
void MainWindow::upcean_addon_gap(QComboBox *comboBox, QLabel* label, int base)
{
const QRegularExpression addonRE("^[0-9X]+[+][0-9]+$");
int item_val;
if (txtData->text().contains(addonRE)) {
comboBox->setEnabled(true);
label->setEnabled(true);
item_val = comboBox->currentIndex();
if (item_val) {
m_bc.bc.setOption2(item_val + base);
}
} else {
comboBox->setEnabled(false);
label->setEnabled(false);
}
}
void MainWindow::update_preview() void MainWindow::update_preview()
{ {
int symbology = metaObject()->enumerator(0).value(bstyle->currentIndex());
int width = view->geometry().width(); int width = view->geometry().width();
int height = view->geometry().height(); int height = view->geometry().height();
int item_val; int item_val;
@ -838,8 +887,9 @@ void MainWindow::update_preview()
m_bc.bc.setHideText(1); m_bc.bc.setHideText(1);
} }
m_bc.bc.setGSSep(false); m_bc.bc.setGSSep(false);
switch(metaObject()->enumerator(0).value(bstyle->currentIndex()))
{ switch (symbology) {
case BARCODE_CODE128: case BARCODE_CODE128:
if(m_optionWidget->findChild<QRadioButton*>("radC128Stand")->isChecked()) if(m_optionWidget->findChild<QRadioButton*>("radC128Stand")->isChecked())
m_bc.bc.setSymbol(BARCODE_CODE128); m_bc.bc.setSymbol(BARCODE_CODE128);
@ -864,6 +914,12 @@ void MainWindow::update_preview()
m_bc.bc.setSymbol(BARCODE_EANX_CC); m_bc.bc.setSymbol(BARCODE_EANX_CC);
else else
m_bc.bc.setSymbol(BARCODE_EANX); m_bc.bc.setSymbol(BARCODE_EANX);
upcean_addon_gap(m_optionWidget->findChild<QComboBox*>("cmbUPCEANAddonGap"), m_optionWidget->findChild<QLabel*>("lblUPCEANAddonGap"), 7 /*base*/);
break;
case BARCODE_ISBNX:
m_bc.bc.setSymbol(symbology);
upcean_addon_gap(m_optionWidget->findChild<QComboBox*>("cmbUPCEANAddonGap"), m_optionWidget->findChild<QLabel*>("lblUPCEANAddonGap"), 7 /*base*/);
break; break;
case BARCODE_UPCA: case BARCODE_UPCA:
@ -871,6 +927,7 @@ void MainWindow::update_preview()
m_bc.bc.setSymbol(BARCODE_UPCA_CC); m_bc.bc.setSymbol(BARCODE_UPCA_CC);
else else
m_bc.bc.setSymbol(BARCODE_UPCA); m_bc.bc.setSymbol(BARCODE_UPCA);
upcean_addon_gap(m_optionWidget->findChild<QComboBox*>("cmbUPCAAddonGap"), m_optionWidget->findChild<QLabel*>("lblUPCAAddonGap"), 9 /*base*/);
break; break;
case BARCODE_UPCE: case BARCODE_UPCE:
@ -878,6 +935,7 @@ void MainWindow::update_preview()
m_bc.bc.setSymbol(BARCODE_UPCE_CC); m_bc.bc.setSymbol(BARCODE_UPCE_CC);
else else
m_bc.bc.setSymbol(BARCODE_UPCE); m_bc.bc.setSymbol(BARCODE_UPCE);
upcean_addon_gap(m_optionWidget->findChild<QComboBox*>("cmbUPCEANAddonGap"), m_optionWidget->findChild<QLabel*>("lblUPCEANAddonGap"), 7 /*base*/);
break; break;
case BARCODE_RSS14: case BARCODE_RSS14:
@ -1213,7 +1271,7 @@ void MainWindow::update_preview()
break; break;
default: default:
m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex())); m_bc.bc.setSymbol(symbology);
break; break;
} }

View File

@ -129,6 +129,7 @@ public slots:
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);
void upcean_addon_gap(QComboBox *comboBox, QLabel* label, int base);
private slots: private slots:
bool save(); bool save();

View File

@ -29,6 +29,8 @@
<file>grpCodablockF.ui</file> <file>grpCodablockF.ui</file>
<file>grpRMQR.ui</file> <file>grpRMQR.ui</file>
<file>grpUltra.ui</file> <file>grpUltra.ui</file>
<file>grpUPCA.ui</file>
<file>grpUPCEAN.ui</file>
<file>grpVIN.ui</file> <file>grpVIN.ui</file>
</qresource> </qresource>
</RCC> </RCC>