diff --git a/ChangeLog b/ChangeLog index 7e79ba85..a8ee7b60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ Version 2.12.0.9 (dev) not released yet for "C,M,Y,K" comma-separated decimal percentage strings - CMYK values for EPS (slightly) and TIF (significantly) have changed - now use the same RGB -> CMYK formula +- Text (HRT) placement for vector (EMF/EPS/SVG) output changed - for EAN/UPC + slightly further away from barcode, for all others slightly nearer. Some + horizontal alignments of EAN/UPC vector text also tweaked Changes ------- @@ -25,6 +28,9 @@ Changes - GUI: Rearrange some Appearance tab inputs (Border Type <-> Width, Show Text <-> Font, Text/Font <-> Printing Scale/Size) to flow more naturally; save button "Save As..." -> "Save..." and add icon +- Add `text_gap` option to allow adjustment of vertical gap between barcode and + text (HRT) +- DAFT: up max to 250 chars Bugs ---- @@ -35,6 +41,8 @@ Bugs - GUI: fg/bgcolor text edit: fix right-click context menu not working properly by checking for it on FocusOut - GUI: fix fg/gbcolor icon background not being reset on zap +- EMF/EPS/SVG/GUI: ignore BOLD_TEXT for EAN/UPC +- EMF/EPS/SVG: fix addon bars placement/length when text hidden Version 2.12.0 (2022-12-12) diff --git a/backend/emf.c b/backend/emf.c index 9f3ec22d..684bcd73 100644 --- a/backend/emf.c +++ b/backend/emf.c @@ -553,8 +553,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) { /* Create font records, alignment records and text color */ if (symbol->vector->strings) { - bold = (symbol->output_options & BOLD_TEXT) && - (!is_extendable(symbol->symbology) || (symbol->output_options & SMALL_TEXT)); + bold = (symbol->output_options & BOLD_TEXT) && !is_extendable(symbol->symbology); memset(&emr_extcreatefontindirectw, 0, sizeof(emr_extcreatefontindirectw)); emr_extcreatefontindirectw.type = 0x00000052; /* EMR_EXTCREATEFONTINDIRECTW */ emr_extcreatefontindirectw.size = 104; diff --git a/backend/gs1.c b/backend/gs1.c index 0de6c79c..3445cf6a 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -1,7 +1,7 @@ /* gs1.c - Verifies GS1 data */ /* libzint - the open source barcode library - Copyright (C) 2009-2022 Robin Stuart + Copyright (C) 2009-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -846,7 +846,11 @@ static const unsigned char *coupon_vli(const unsigned char *data, const int data if ((vli < vli_min || vli > vli_max) && (vli != 9 || !vli_nine)) { *p_err_no = 3; *p_err_posn = d - data + 1; - sprintf(err_msg, vli < 0 ? "Non-numeric %s VLI '%c'" : "Invalid %s VLI '%c'", name, *d); + if (vli < 0) { + sprintf(err_msg, "Non-numeric %s VLI '%c'", name, *d); + } else { + sprintf(err_msg, "Invalid %s VLI '%c'", name, *d); + } return NULL; } d++; @@ -1101,8 +1105,11 @@ static int couponcode(const unsigned char *data, int data_len, int offset, int m *p_err_no = 3; *p_err_posn = d - 1 - data + 1; - sprintf(err_msg, data_field < 0 ? "Non-numeric Data Field '%c'" : "Invalid Data Field '%c'", - *(d - 1)); + if (data_field < 0) { + sprintf(err_msg, "Non-numeric Data Field '%c'", *(d - 1)); + } else { + sprintf(err_msg, "Invalid Data Field '%c'", *(d - 1)); + } return 0; } } diff --git a/backend/library.c b/backend/library.c index ad7759a8..5948d3dc 100644 --- a/backend/library.c +++ b/backend/library.c @@ -216,9 +216,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ static int error_tag(struct zint_symbol *symbol, int error_number, const char *error_string) { if (error_number != 0) { - static const char error_fmt[] = "Error %.93s"; /* Truncate if too long */ - static const char warn_fmt[] = "Warning %.91s"; /* Truncate if too long */ - const char *fmt = error_number >= ZINT_ERROR ? error_fmt : warn_fmt; + const char *const error_arg = error_string ? error_string : symbol->errtxt; char error_buffer[100]; if (error_number < ZINT_ERROR && symbol->warn_level == WARN_FAIL_ALL) { @@ -230,9 +228,12 @@ static int error_tag(struct zint_symbol *symbol, int error_number, const char *e } else { /* ZINT_WARN_INVALID_OPTION */ error_number = ZINT_ERROR_INVALID_OPTION; } - fmt = error_fmt; } - sprintf(error_buffer, fmt, error_string ? error_string : symbol->errtxt); + if (error_number >= ZINT_ERROR) { + sprintf(error_buffer, "Error %.93s", error_arg); /* Truncate if too long */ + } else { + sprintf(error_buffer, "Warning %.91s", error_arg); /* Truncate if too long */ + } strcpy(symbol->errtxt, error_buffer); } @@ -1096,6 +1097,9 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ if ((symbol->guard_descent < 0.0f) || (symbol->guard_descent > 50.0f)) { return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "769: Guard bar descent out of range (0 to 50)"); } + if ((symbol->text_gap < 0.0f) || (symbol->text_gap > 5.0f)) { + return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "219: Text gap out of range (0 to 5)"); + } if ((symbol->whitespace_width < 0) || (symbol->whitespace_width > 100)) { return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "766: Whitespace width out of range (0 to 100)"); } @@ -1185,7 +1189,7 @@ int ZBarcode_Encode_Segs(struct zint_symbol *symbol, const struct zint_seg segs[ local_segs[0].length = (int) ustrlen(reduced); } } else { - return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "220: Selected symbology does not support GS1 mode"); + return error_tag(symbol, ZINT_ERROR_INVALID_OPTION, "210: Selected symbology does not support GS1 mode"); } } @@ -1445,7 +1449,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) { return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "239: Filename NULL"); } - if (!strcmp(filename, "-")) { + if (strcmp(filename, "-") == 0) { file = stdin; fileLen = ZINT_MAX_DATA_LEN; } else { diff --git a/backend/output.c b/backend/output.c index 76e907f5..458bd5e3 100644 --- a/backend/output.c +++ b/backend/output.c @@ -41,7 +41,6 @@ #endif #include "common.h" #include "output.h" -#include "font.h" #define OUT_SSET_F (IS_NUM_F | IS_UHX_F | IS_LHX_F) /* SSET "0123456789ABCDEFabcdef" */ @@ -53,11 +52,11 @@ static int out_check_colour(struct zint_symbol *symbol, const char *colour, cons if ((comma1 = strchr(colour, ',')) == NULL) { const int len = (int) strlen(colour); if ((len != 6) && (len != 8)) { - sprintf(symbol->errtxt, "690: Malformed %s RGB colour (6 or 8 characters only)", name); + sprintf(symbol->errtxt, "880: Malformed %s RGB colour (6 or 8 characters only)", name); return ZINT_ERROR_INVALID_OPTION; } if (!is_sane(OUT_SSET_F, (unsigned char *) colour, len)) { - sprintf(symbol->errtxt, "691: Malformed %s RGB colour '%s' (hexadecimal only)", name, colour); + sprintf(symbol->errtxt, "881: Malformed %s RGB colour '%s' (hexadecimal only)", name, colour); return ZINT_ERROR_INVALID_OPTION; } @@ -67,28 +66,28 @@ static int out_check_colour(struct zint_symbol *symbol, const char *colour, cons /* CMYK comma-separated percentages */ if ((comma2 = strchr(comma1 + 1, ',')) == NULL || (comma3 = strchr(comma2 + 1, ',')) == NULL || strchr(comma3 + 1, ',') != NULL) { - sprintf(symbol->errtxt, "692: Malformed %s CMYK colour (4 decimal numbers, comma-separated)", name); + sprintf(symbol->errtxt, "882: Malformed %s CMYK colour (4 decimal numbers, comma-separated)", name); return ZINT_ERROR_INVALID_OPTION; } if (comma1 - colour > 3 || comma2 - (comma1 + 1) > 3 || comma3 - (comma2 + 1) > 3 || strlen(comma3 + 1) > 3) { - sprintf(symbol->errtxt, "693: Malformed %s CMYK colour (3 digit maximum per number)", name); + sprintf(symbol->errtxt, "883: Malformed %s CMYK colour (3 digit maximum per number)", name); return ZINT_ERROR_INVALID_OPTION; } if ((val = to_int((const unsigned char *) colour, (int) (comma1 - colour))) == -1 || val > 100) { - sprintf(symbol->errtxt, "694: Malformed %s CMYK colour C (decimal 0-100 only)", name); + sprintf(symbol->errtxt, "884: Malformed %s CMYK colour C (decimal 0-100 only)", name); return ZINT_ERROR_INVALID_OPTION; } if ((val = to_int((const unsigned char *) (comma1 + 1), (int) (comma2 - (comma1 + 1)))) == -1 || val > 100) { - sprintf(symbol->errtxt, "695: Malformed %s CMYK colour M (decimal 0-100 only)", name); + sprintf(symbol->errtxt, "885: Malformed %s CMYK colour M (decimal 0-100 only)", name); return ZINT_ERROR_INVALID_OPTION; } if ((val = to_int((const unsigned char *) (comma2 + 1), (int) (comma3 - (comma2 + 1)))) == -1 || val > 100) { - sprintf(symbol->errtxt, "696: Malformed %s CMYK colour Y (decimal 0-100 only)", name); + sprintf(symbol->errtxt, "886: Malformed %s CMYK colour Y (decimal 0-100 only)", name); return ZINT_ERROR_INVALID_OPTION; } if ((val = to_int((const unsigned char *) (comma3 + 1), (int) strlen(comma3 + 1))) == -1 || val > 100) { - sprintf(symbol->errtxt, "697: Malformed %s CMYK colour K (decimal 0-100 only)", name); + sprintf(symbol->errtxt, "887: Malformed %s CMYK colour K (decimal 0-100 only)", name); return ZINT_ERROR_INVALID_OPTION; } @@ -741,7 +740,8 @@ INTERNAL int out_process_upcean(const struct zint_symbol *symbol, int *p_main_wi /* Calculate large bar height i.e. linear bars with zero row height that respond to the symbol height. If scaler `si` non-zero (raster), then large_bar_height if non-zero or else row heights will be rounded to nearest pixel and symbol height adjusted */ -INTERNAL float out_large_bar_height(struct zint_symbol *symbol, int si, int *row_heights_si, int *symbol_height_si) { +INTERNAL float out_large_bar_height(struct zint_symbol *symbol, const int si, int *row_heights_si, + int *symbol_height_si) { float fixed_height = 0.0f; int zero_count = 0; int round_rows = 0; @@ -812,64 +812,62 @@ INTERNAL float out_large_bar_height(struct zint_symbol *symbol, int si, int *row } /* Split UPC/EAN add-on text into various constituents */ -INTERNAL void out_upcean_split_text(int upceanflag, unsigned char text[], - unsigned char textpart1[5], unsigned char textpart2[7], unsigned char textpart3[7], - unsigned char textpart4[2]) { +INTERNAL void out_upcean_split_text(const int upceanflag, const unsigned char text[], unsigned char textparts[4][7]) { int i; if (upceanflag == 6) { /* UPC-E */ - textpart1[0] = text[0]; - textpart1[1] = '\0'; + textparts[0][0] = text[0]; + textparts[0][1] = '\0'; for (i = 0; i < 6; i++) { - textpart2[i] = text[i + 1]; + textparts[1][i] = text[i + 1]; } - textpart2[6] = '\0'; + textparts[1][6] = '\0'; - textpart3[0] = text[7]; - textpart3[1] = '\0'; + textparts[2][0] = text[7]; + textparts[2][1] = '\0'; } else if (upceanflag == 8) { /* EAN-8 */ for (i = 0; i < 4; i++) { - textpart1[i] = text[i]; + textparts[0][i] = text[i]; } - textpart1[4] = '\0'; + textparts[0][4] = '\0'; for (i = 0; i < 4; i++) { - textpart2[i] = text[i + 4]; + textparts[1][i] = text[i + 4]; } - textpart2[4] = '\0'; + textparts[1][4] = '\0'; } else if (upceanflag == 12) { /* UPC-A */ - textpart1[0] = text[0]; - textpart1[1] = '\0'; + textparts[0][0] = text[0]; + textparts[0][1] = '\0'; for (i = 0; i < 5; i++) { - textpart2[i] = text[i + 1]; + textparts[1][i] = text[i + 1]; } - textpart2[5] = '\0'; + textparts[1][5] = '\0'; for (i = 0; i < 5; i++) { - textpart3[i] = text[i + 6]; + textparts[2][i] = text[i + 6]; } - textpart3[5] = '\0'; + textparts[2][5] = '\0'; - textpart4[0] = text[11]; - textpart4[1] = '\0'; + textparts[3][0] = text[11]; + textparts[3][1] = '\0'; } else if (upceanflag == 13) { /* EAN-13 */ - textpart1[0] = text[0]; - textpart1[1] = '\0'; + textparts[0][0] = text[0]; + textparts[0][1] = '\0'; for (i = 0; i < 6; i++) { - textpart2[i] = text[i + 1]; + textparts[1][i] = text[i + 1]; } - textpart2[6] = '\0'; + textparts[1][6] = '\0'; for (i = 0; i < 6; i++) { - textpart3[i] = text[i + 7]; + textparts[2][i] = text[i + 7]; } - textpart3[6] = '\0'; + textparts[2][6] = '\0'; } } diff --git a/backend/output.h b/backend/output.h index b6804014..c8496676 100644 --- a/backend/output.h +++ b/backend/output.h @@ -62,12 +62,11 @@ INTERNAL int out_process_upcean(const struct zint_symbol *symbol, int *p_main_wi /* Calculate large bar height i.e. linear bars with zero row height that respond to the symbol height. If scaler `si` non-zero (raster), then large_bar_height if non-zero or else row heights will be rounded to nearest pixel and symbol height adjusted */ -INTERNAL float out_large_bar_height(struct zint_symbol *symbol, int si, int *row_heights_si, int *symbol_height_si); +INTERNAL float out_large_bar_height(struct zint_symbol *symbol, const int si, int *row_heights_si, + int *symbol_height_si); /* Split UPC/EAN add-on text into various constituents */ -INTERNAL void out_upcean_split_text(int upceanflag, unsigned char text[], - unsigned char textpart1[5], unsigned char textpart2[7], unsigned char textpart3[7], - unsigned char textpart4[2]); +INTERNAL void out_upcean_split_text(const int upceanflag, const unsigned char text[], unsigned char textparts[4][7]); /* Create output file, creating sub-directories if necessary. Returns `fopen()` FILE pointer */ INTERNAL FILE *out_fopen(const char filename[256], const char *mode); diff --git a/backend/postal.c b/backend/postal.c index 2e919c2b..5ca6dc61 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -1,7 +1,7 @@ /* postal.c - Handles POSTNET, PLANET, CEPNet, FIM. RM4SCC and Flattermarken */ /* libzint - the open source barcode library - Copyright (C) 2008-2022 Robin Stuart + Copyright (C) 2008-2023 Robin Stuart Including bug fixes by Bryan Hatton Redistribution and use in source and binary forms, with or without @@ -559,12 +559,12 @@ INTERNAL int kix(struct zint_symbol *symbol, unsigned char source[], int length) /* Handles DAFT Code symbols */ INTERNAL int daft(struct zint_symbol *symbol, unsigned char source[], int length) { - int posns[100]; + int posns[250]; int loopey; int writer; - if (length > 100) { - strcpy(symbol->errtxt, "492: Input too long (100 character maximum)"); + if (length > 250) { + strcpy(symbol->errtxt, "492: Input too long (250 character maximum)"); return ZINT_ERROR_TOO_LONG; } to_upper(source, length); diff --git a/backend/ps.c b/backend/ps.c index 3b5d13d8..61571a6d 100644 --- a/backend/ps.c +++ b/backend/ps.c @@ -427,8 +427,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) { string = symbol->vector->strings; if (string) { - if ((symbol->output_options & BOLD_TEXT) - && (!is_extendable(symbol->symbology) || (symbol->output_options & SMALL_TEXT))) { + if ((symbol->output_options & BOLD_TEXT) && !is_extendable(symbol->symbology)) { font = "Helvetica-Bold"; } else { font = "Helvetica"; diff --git a/backend/raster.c b/backend/raster.c index 38d68780..a664e09d 100644 --- a/backend/raster.c +++ b/backend/raster.c @@ -44,10 +44,10 @@ #include "font.h" /* Font for human readable text */ -#define DEFAULT_INK '1' -#define DEFAULT_PAPER '0' +#define DEFAULT_INK '1' /* Black */ +#define DEFAULT_PAPER '0' /* White */ -#define UPCEAN_TEXT 1 +#define UPCEAN_TEXT 1 /* Helper flag for `draw_string()`/`draw_letter()` to indicate dealing with UPC/EAN */ #ifndef ZINT_NO_PNG INTERNAL int png_pixel_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf); @@ -61,7 +61,7 @@ static const char ultra_colour[] = "0CBMRYGKW"; static int buffer_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf) { /* Place pixelbuffer into symbol */ - unsigned char fgalpha, bgalpha; + unsigned char alpha[2]; unsigned char map[91][3] = { {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, /* 0x00-0F */ {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}, /* 0x10-1F */ @@ -78,11 +78,11 @@ static int buffer_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf const size_t bm_bitmap_width = (size_t) symbol->bitmap_width * 3; if (out_colour_get_rgb(symbol->fgcolour, &map[DEFAULT_INK][0], &map[DEFAULT_INK][1], &map[DEFAULT_INK][2], - &fgalpha)) { + &alpha[0])) { plot_alpha = 1; } if (out_colour_get_rgb(symbol->bgcolour, &map[DEFAULT_PAPER][0], &map[DEFAULT_PAPER][1], &map[DEFAULT_PAPER][2], - &bgalpha)) { + &alpha[1])) { plot_alpha = 1; } @@ -119,7 +119,7 @@ static int buffer_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf const int pe = p + symbol->bitmap_width; for (; p < pe; p++, bitmap += 3) { memcpy(bitmap, map[pixelbuf[p]], 3); - symbol->alphamap[p] = pixelbuf[p] == DEFAULT_PAPER ? bgalpha : fgalpha; + symbol->alphamap[p] = alpha[pixelbuf[p] == DEFAULT_PAPER]; } } } @@ -318,7 +318,7 @@ static void draw_letter(unsigned char *pixelbuf, const unsigned char letter, int } /* Following should never happen (ISBN check digit "X" not printed) */ - if ((textflags & UPCEAN_TEXT) && (letter < '0' || letter > '9')) { + if ((textflags & UPCEAN_TEXT) && !z_isdigit(letter)) { return; /* Not reached */ } @@ -743,6 +743,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang image_width = (int) ceilf(hex_image_width + xoffset_si + roffset_si); image_height = (int) ceilf(hex_image_height + yoffset_si + boffset_si); + assert(image_width && image_height); if (!(pixelbuf = (unsigned char *) malloc((size_t) image_width * image_height))) { strcpy(symbol->errtxt, "655: Insufficient memory for pixel buffer"); @@ -865,7 +866,7 @@ static int plot_raster_dotty(struct zint_symbol *symbol, const int rotate_angle, return error_number; } -/* Convert UTF-8 to ISO 8859-1 for draw_string() human readable text */ +/* Convert UTF-8 to ISO/IEC 8859-1 for `draw_string()` human readable text */ static void to_iso8859_1(const unsigned char source[], unsigned char preprocessed[]) { int j, i, input_length; @@ -915,7 +916,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl float textoffset; int upceanflag = 0; int addon_latch = 0; - unsigned char textpart1[5], textpart2[7], textpart3[7], textpart4[2]; + unsigned char textparts[4][7]; int hide_text; int i, r; int block_width = 0; @@ -967,13 +968,13 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl if (upceanflag) { textflags = UPCEAN_TEXT | (symbol->output_options & SMALL_TEXT); /* Bold not available for UPC/EAN */ text_height = (UPCEAN_FONT_HEIGHT + 1) / 2; - text_gap = 1.0f; + text_gap = symbol->text_gap ? symbol->text_gap : 1.0f; /* Height of guard bar descent (none for EAN-2 and EAN-5) */ guard_descent = upceanflag != 2 && upceanflag != 5 ? symbol->guard_descent : 0.0f; } else { textflags = symbol->output_options & (SMALL_TEXT | BOLD_TEXT); text_height = textflags & SMALL_TEXT ? (SMALL_FONT_HEIGHT + 1) / 2 : (NORMAL_FONT_HEIGHT + 1) / 2; - text_gap = 1.0f; + text_gap = symbol->text_gap ? symbol->text_gap : 1.0f; guard_descent = 0.0f; } @@ -989,6 +990,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl image_width = symbol->width * si + xoffset_si + roffset_si; image_height = symbol_height_si + textoffset * si + yoffset_si + boffset_si; + assert(image_width && image_height); if (!(pixelbuf = (unsigned char *) malloc((size_t) image_width * image_height))) { strcpy(symbol->errtxt, "658: Insufficient memory for pixel buffer"); @@ -1145,99 +1147,72 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl } if (upceanflag >= 6) { /* UPC-E, EAN-8, UPC-A, EAN-13 */ + const int addon_len = (int) ustrlen(addon); /* Note font sizes halved as in pixels */ /* Halved again to get middle position that draw_string() expects */ const int upcea_width_adj = (UPCEAN_SMALL_FONT_WIDTH + 3) / 4; - const int upcea_height_adj = (UPCEAN_FONT_HEIGHT - UPCEAN_SMALL_FONT_HEIGHT) * si / 2; + const int upcea_height_adj = ((UPCEAN_FONT_HEIGHT - UPCEAN_SMALL_FONT_HEIGHT) * si + 1) / 2; /* Halved again to get middle position that draw_string() expects */ const int ean_width_adj = (UPCEAN_FONT_WIDTH + 3) / 4; - out_upcean_split_text(upceanflag, symbol->text, textpart1, textpart2, textpart3, textpart4); + out_upcean_split_text(upceanflag, symbol->text, textparts); if (upceanflag == 6) { /* UPC-E */ int text_xposn = -(5 + upcea_width_adj) * si + comp_xoffset_si; - draw_string(pixelbuf, textpart1, text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, + draw_string(pixelbuf, textparts[0], text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si); text_xposn = 24 * si + comp_xoffset_si; - draw_string(pixelbuf, textpart2, text_xposn, text_yposn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textparts[1], text_xposn, text_yposn, textflags, image_width, image_height, si); text_xposn = (51 + 3 + upcea_width_adj) * si + comp_xoffset_si; - draw_string(pixelbuf, textpart3, text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, + draw_string(pixelbuf, textparts[2], text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si); - switch (ustrlen(addon)) { - case 2: - text_xposn = (61 + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); - break; - case 5: - text_xposn = (75 + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); - break; + if (addon_len) { + text_xposn = ((addon_len == 2 ? 61 : 75) + addon_gap) * si + comp_xoffset_si; + draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, + image_width, image_height, si); } } else if (upceanflag == 8) { /* EAN-8 */ int text_xposn = 17 * si + comp_xoffset_si; - draw_string(pixelbuf, textpart1, text_xposn, text_yposn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textparts[0], text_xposn, text_yposn, textflags, image_width, image_height, si); text_xposn = 50 * si + comp_xoffset_si; - draw_string(pixelbuf, textpart2, text_xposn, text_yposn, textflags, image_width, image_height, si); - switch (ustrlen(addon)) { - case 2: - text_xposn = (77 + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); - break; - case 5: - text_xposn = (91 + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); - break; + draw_string(pixelbuf, textparts[1], text_xposn, text_yposn, textflags, image_width, image_height, si); + if (addon_len) { + text_xposn = ((addon_len == 2 ? 77 : 91) + addon_gap) * si + comp_xoffset_si; + draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, + image_width, image_height, si); } } else if (upceanflag == 12) { /* UPC-A */ int text_xposn = (-(5 + upcea_width_adj)) * si + comp_xoffset_si; - draw_string(pixelbuf, textpart1, text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, + draw_string(pixelbuf, textparts[0], text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si); text_xposn = 27 * si + comp_xoffset_si; - draw_string(pixelbuf, textpart2, text_xposn, text_yposn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textparts[1], text_xposn, text_yposn, textflags, image_width, image_height, si); text_xposn = 67 * si + comp_xoffset_si; - draw_string(pixelbuf, textpart3, text_xposn, text_yposn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textparts[2], text_xposn, text_yposn, textflags, image_width, image_height, si); text_xposn = (95 + 5 + upcea_width_adj) * si + comp_xoffset_si; - draw_string(pixelbuf, textpart4, text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, + draw_string(pixelbuf, textparts[3], text_xposn, text_yposn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si); - switch (ustrlen(addon)) { - case 2: - text_xposn = (105 + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); - break; - case 5: - text_xposn = (119 + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); - break; + if (addon_len) { + text_xposn = ((addon_len == 2 ? 105 : 119) + addon_gap) * si + comp_xoffset_si; + draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, + image_width, image_height, si); } } else { /* EAN-13 */ int text_xposn = (-(5 + ean_width_adj)) * si + comp_xoffset_si; - draw_string(pixelbuf, textpart1, text_xposn, text_yposn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textparts[0], text_xposn, text_yposn, textflags, image_width, image_height, si); text_xposn = 24 * si + comp_xoffset_si; - draw_string(pixelbuf, textpart2, text_xposn, text_yposn, textflags, image_width, image_height, si); + draw_string(pixelbuf, textparts[1], text_xposn, text_yposn, textflags, image_width, image_height, si); text_xposn = 71 * si + comp_xoffset_si; - draw_string(pixelbuf, textpart3, text_xposn, text_yposn, textflags, image_width, image_height, si); - switch (ustrlen(addon)) { - case 2: - text_xposn = (105 + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); - break; - case 5: - text_xposn = (119 + addon_gap) * si + comp_xoffset_si; - draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, - image_width, image_height, si); - break; + draw_string(pixelbuf, textparts[2], text_xposn, text_yposn, textflags, image_width, image_height, si); + if (addon_len) { + text_xposn = ((addon_len == 2 ? 105 : 119) + addon_gap) * si + comp_xoffset_si; + draw_string(pixelbuf, addon, text_xposn, addon_text_yposn, textflags, + image_width, image_height, si); } } } else { diff --git a/backend/svg.c b/backend/svg.c index 8e355bdc..ddb6d2b9 100644 --- a/backend/svg.c +++ b/backend/svg.c @@ -296,8 +296,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) { circle = circle->next; } - bold = (symbol->output_options & BOLD_TEXT) - && (!is_extendable(symbol->symbology) || (symbol->output_options & SMALL_TEXT)); + bold = (symbol->output_options & BOLD_TEXT) && !is_extendable(symbol->symbology); string = symbol->vector->strings; while (string) { const char *const halign = string->halign == 2 ? "end" : string->halign == 1 ? "start" : "middle"; diff --git a/backend/tests/data/emf/code128_egrave_bold.emf b/backend/tests/data/emf/code128_egrave_bold.emf index b6eb3759..95270b3b 100644 Binary files a/backend/tests/data/emf/code128_egrave_bold.emf and b/backend/tests/data/emf/code128_egrave_bold.emf differ diff --git a/backend/tests/data/emf/code128_egrave_bold_100dpi.emf b/backend/tests/data/emf/code128_egrave_bold_100dpi.emf index c52622db..f1cce5cb 100644 Binary files a/backend/tests/data/emf/code128_egrave_bold_100dpi.emf and b/backend/tests/data/emf/code128_egrave_bold_100dpi.emf differ diff --git a/backend/tests/data/emf/code128_egrave_bold_1200dpi.emf b/backend/tests/data/emf/code128_egrave_bold_1200dpi.emf index ce9a2e4c..284e2636 100644 Binary files a/backend/tests/data/emf/code128_egrave_bold_1200dpi.emf and b/backend/tests/data/emf/code128_egrave_bold_1200dpi.emf differ diff --git a/backend/tests/data/emf/code128_egrave_bold_150dpi.emf b/backend/tests/data/emf/code128_egrave_bold_150dpi.emf index a48f29bb..40743387 100644 Binary files a/backend/tests/data/emf/code128_egrave_bold_150dpi.emf and b/backend/tests/data/emf/code128_egrave_bold_150dpi.emf differ diff --git a/backend/tests/data/emf/code128_egrave_bold_300dpi.emf b/backend/tests/data/emf/code128_egrave_bold_300dpi.emf index 52e1579e..3b265579 100644 Binary files a/backend/tests/data/emf/code128_egrave_bold_300dpi.emf and b/backend/tests/data/emf/code128_egrave_bold_300dpi.emf differ diff --git a/backend/tests/data/emf/code128_egrave_bold_400dpi.emf b/backend/tests/data/emf/code128_egrave_bold_400dpi.emf index cf242c45..6471bf4a 100644 Binary files a/backend/tests/data/emf/code128_egrave_bold_400dpi.emf and b/backend/tests/data/emf/code128_egrave_bold_400dpi.emf differ diff --git a/backend/tests/data/emf/code39_rotate_180.emf b/backend/tests/data/emf/code39_rotate_180.emf index 8cf1dbb6..edb7a760 100644 Binary files a/backend/tests/data/emf/code39_rotate_180.emf and b/backend/tests/data/emf/code39_rotate_180.emf differ diff --git a/backend/tests/data/emf/code39_rotate_270.emf b/backend/tests/data/emf/code39_rotate_270.emf index 1600f02f..80509061 100644 Binary files a/backend/tests/data/emf/code39_rotate_270.emf and b/backend/tests/data/emf/code39_rotate_270.emf differ diff --git a/backend/tests/data/emf/code39_rotate_90.emf b/backend/tests/data/emf/code39_rotate_90.emf index c4edf199..41567751 100644 Binary files a/backend/tests/data/emf/code39_rotate_90.emf and b/backend/tests/data/emf/code39_rotate_90.emf differ diff --git a/backend/tests/data/emf/code39_rotate_90_300dpi.emf b/backend/tests/data/emf/code39_rotate_90_300dpi.emf index 2aaf8139..e526ed04 100644 Binary files a/backend/tests/data/emf/code39_rotate_90_300dpi.emf and b/backend/tests/data/emf/code39_rotate_90_300dpi.emf differ diff --git a/backend/tests/data/emf/ean13_5addon_#185.emf b/backend/tests/data/emf/ean13_5addon_#185.emf index 74433a19..8b88ca1f 100644 Binary files a/backend/tests/data/emf/ean13_5addon_#185.emf and b/backend/tests/data/emf/ean13_5addon_#185.emf differ diff --git a/backend/tests/data/emf/ean13_5addon_ggs_5.2.2.5.2-2.emf b/backend/tests/data/emf/ean13_5addon_ggs_5.2.2.5.2-2.emf index dd1d681c..54cc2ef5 100644 Binary files a/backend/tests/data/emf/ean13_5addon_ggs_5.2.2.5.2-2.emf and b/backend/tests/data/emf/ean13_5addon_ggs_5.2.2.5.2-2.emf differ diff --git a/backend/tests/data/emf/itf14_bold.emf b/backend/tests/data/emf/itf14_bold.emf index a505b69e..3d41d7c4 100644 Binary files a/backend/tests/data/emf/itf14_bold.emf and b/backend/tests/data/emf/itf14_bold.emf differ diff --git a/backend/tests/data/emf/itf14_bold_600dpi.emf b/backend/tests/data/emf/itf14_bold_600dpi.emf index fa9ce7ab..559917f0 100644 Binary files a/backend/tests/data/emf/itf14_bold_600dpi.emf and b/backend/tests/data/emf/itf14_bold_600dpi.emf differ diff --git a/backend/tests/data/emf/telenum_fg_bg.emf b/backend/tests/data/emf/telenum_fg_bg.emf index d3b113cc..93cf8d78 100644 Binary files a/backend/tests/data/emf/telenum_fg_bg.emf and b/backend/tests/data/emf/telenum_fg_bg.emf differ diff --git a/backend/tests/data/emf/telenum_fg_bg_150dpi.emf b/backend/tests/data/emf/telenum_fg_bg_150dpi.emf index 0ba548b8..0cca7cb1 100644 Binary files a/backend/tests/data/emf/telenum_fg_bg_150dpi.emf and b/backend/tests/data/emf/telenum_fg_bg_150dpi.emf differ diff --git a/backend/tests/data/emf/upca_2addon_ggs_5.2.6.6-5.emf b/backend/tests/data/emf/upca_2addon_ggs_5.2.6.6-5.emf index d80b7940..eaaab842 100644 Binary files a/backend/tests/data/emf/upca_2addon_ggs_5.2.6.6-5.emf and b/backend/tests/data/emf/upca_2addon_ggs_5.2.6.6-5.emf differ diff --git a/backend/tests/data/emf/upce_2addon.emf b/backend/tests/data/emf/upce_2addon.emf index 05069912..4a12e18e 100644 Binary files a/backend/tests/data/emf/upce_2addon.emf and b/backend/tests/data/emf/upce_2addon.emf differ diff --git a/backend/tests/data/emf/upce_2addon_150dpi.emf b/backend/tests/data/emf/upce_2addon_150dpi.emf index 06382bc4..bee31869 100644 Binary files a/backend/tests/data/emf/upce_2addon_150dpi.emf and b/backend/tests/data/emf/upce_2addon_150dpi.emf differ diff --git a/backend/tests/data/emf/upce_2addon_small_bold.emf b/backend/tests/data/emf/upce_2addon_small_bold.emf index b25e5ef6..3a9a1d06 100644 Binary files a/backend/tests/data/emf/upce_2addon_small_bold.emf and b/backend/tests/data/emf/upce_2addon_small_bold.emf differ diff --git a/backend/tests/data/emf/upu_s10_cmyk_nobg.emf b/backend/tests/data/emf/upu_s10_cmyk_nobg.emf index 5a04d534..26e5c6db 100644 Binary files a/backend/tests/data/emf/upu_s10_cmyk_nobg.emf and b/backend/tests/data/emf/upu_s10_cmyk_nobg.emf differ diff --git a/backend/tests/data/eps/code128_egrave_bold.eps b/backend/tests/data/eps/code128_egrave_bold.eps index 07547cc0..27ebb1b8 100644 --- a/backend/tests/data/eps/code128_egrave_bold.eps +++ b/backend/tests/data/eps/code128_egrave_bold.eps @@ -1,5 +1,5 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Creator: Zint 2.10.0.9 +%%Creator: Zint 2.12.0.9 %%Title: Zint Generated Symbol %%Pages: 0 %%BoundingBox: 0 0 224 119 @@ -84,7 +84,7 @@ end matrix currentmatrix /Helvetica-ISOLatin1 findfont 14.00 scalefont setfont - 0 0 moveto 112.00 3.50 translate 0.00 rotate 0 0 moveto + 0 0 moveto 112.00 4.90 translate 0.00 rotate 0 0 moveto (gjpqy) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/eps/code128_egrave_bold_rotate_90.eps b/backend/tests/data/eps/code128_egrave_bold_rotate_90.eps index d4075600..281cc11c 100644 --- a/backend/tests/data/eps/code128_egrave_bold_rotate_90.eps +++ b/backend/tests/data/eps/code128_egrave_bold_rotate_90.eps @@ -1,5 +1,5 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Creator: Zint 2.10.0.9 +%%Creator: Zint 2.12.0.9 %%Title: Zint Generated Symbol %%Pages: 0 %%BoundingBox: 0 0 119 224 @@ -84,7 +84,7 @@ end matrix currentmatrix /Helvetica-ISOLatin1 findfont 14.00 scalefont setfont - 0 0 moveto 3.50 112.00 translate 0.00 rotate 0 0 moveto + 0 0 moveto 4.90 112.00 translate 0.00 rotate 0 0 moveto (gjpqy) stringwidth gsave 270 rotate diff --git a/backend/tests/data/eps/code128_escape_latin1.eps b/backend/tests/data/eps/code128_escape_latin1.eps index 3e440eb8..5bd695d1 100644 --- a/backend/tests/data/eps/code128_escape_latin1.eps +++ b/backend/tests/data/eps/code128_escape_latin1.eps @@ -1,5 +1,5 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Creator: Zint 2.10.0.9 +%%Creator: Zint 2.12.0.9 %%Title: Zint Generated Symbol %%Pages: 0 %%BoundingBox: 0 0 246 119 @@ -90,7 +90,7 @@ end matrix currentmatrix /Helvetica-ISOLatin1 findfont 14.00 scalefont setfont - 0 0 moveto 123.00 3.50 translate 0.00 rotate 0 0 moveto + 0 0 moveto 123.00 4.90 translate 0.00 rotate 0 0 moveto (A\\B\)\(D) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/eps/code39_fg_bg.eps b/backend/tests/data/eps/code39_fg_bg.eps index 62f5cdff..f5a6785a 100644 --- a/backend/tests/data/eps/code39_fg_bg.eps +++ b/backend/tests/data/eps/code39_fg_bg.eps @@ -65,7 +65,7 @@ TE matrix currentmatrix /Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 64.00 3.50 translate 0.00 rotate 0 0 moveto + 0 0 moveto 64.00 4.90 translate 0.00 rotate 0 0 moveto (*123*) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/eps/code39_fgalpha_bg_cmyk.eps b/backend/tests/data/eps/code39_fgalpha_bg_cmyk.eps index d09689d4..c50d4c69 100644 --- a/backend/tests/data/eps/code39_fgalpha_bg_cmyk.eps +++ b/backend/tests/data/eps/code39_fgalpha_bg_cmyk.eps @@ -65,7 +65,7 @@ TE matrix currentmatrix /Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 64.00 3.50 translate 0.00 rotate 0 0 moveto + 0 0 moveto 64.00 4.90 translate 0.00 rotate 0 0 moveto (*123*) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/eps/code39_nobg_cmyk.eps b/backend/tests/data/eps/code39_nobg_cmyk.eps index af40aa6e..527d1203 100644 --- a/backend/tests/data/eps/code39_nobg_cmyk.eps +++ b/backend/tests/data/eps/code39_nobg_cmyk.eps @@ -62,7 +62,7 @@ TE matrix currentmatrix /Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 64.00 3.50 translate 0.00 rotate 0 0 moveto + 0 0 moveto 64.00 4.90 translate 0.00 rotate 0 0 moveto (*123*) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/eps/dbar_ltd_24724_fig7_bold.eps b/backend/tests/data/eps/dbar_ltd_24724_fig7_bold.eps index 906607cf..f470735d 100644 --- a/backend/tests/data/eps/dbar_ltd_24724_fig7_bold.eps +++ b/backend/tests/data/eps/dbar_ltd_24724_fig7_bold.eps @@ -1,5 +1,5 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Creator: Zint 2.10.0.9 +%%Creator: Zint 2.12.0.9 %%Title: Zint Generated Symbol %%Pages: 0 %%BoundingBox: 0 0 158 119 @@ -61,7 +61,7 @@ TE matrix currentmatrix /Helvetica-Bold findfont 14.00 scalefont setfont - 0 0 moveto 79.00 3.50 translate 0.00 rotate 0 0 moveto + 0 0 moveto 79.00 4.90 translate 0.00 rotate 0 0 moveto (\(01\)15012345678907) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/eps/ean13_2addon_ggs_5.2.2.5.1-2.eps b/backend/tests/data/eps/ean13_2addon_ggs_5.2.2.5.1-2.eps index 895af35d..1ee2cf51 100644 --- a/backend/tests/data/eps/ean13_2addon_ggs_5.2.2.5.1-2.eps +++ b/backend/tests/data/eps/ean13_2addon_ggs_5.2.2.5.1-2.eps @@ -1,5 +1,5 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Creator: Zint 2.10.0.9 +%%Creator: Zint 2.12.0.9 %%Title: Zint Generated Symbol %%Pages: 0 %%BoundingBox: 0 0 276 117 @@ -9,87 +9,87 @@ /TE { pop pop } bind def newpath 1.00 1.00 1.00 setrgbcolor -116.40 0.00 TB 0.00 276.00 TR +116.90 0.00 TB 0.00 276.00 TR TE 0.00 0.00 0.00 setrgbcolor -110.00 6.40 TB 22.00 2.00 TR +110.00 6.90 TB 22.00 2.00 TR TE -110.00 6.40 TB 26.00 2.00 TR +110.00 6.90 TB 26.00 2.00 TR TE -100.00 16.40 TB 30.00 6.00 TR +100.00 16.90 TB 30.00 6.00 TR TE -100.00 16.40 TB 38.00 4.00 TR +100.00 16.90 TB 38.00 4.00 TR TE -100.00 16.40 TB 46.00 2.00 TR +100.00 16.90 TB 46.00 2.00 TR TE -100.00 16.40 TB 54.00 2.00 TR +100.00 16.90 TB 54.00 2.00 TR TE -100.00 16.40 TB 58.00 4.00 TR +100.00 16.90 TB 58.00 4.00 TR TE -100.00 16.40 TB 66.00 4.00 TR +100.00 16.90 TB 66.00 4.00 TR TE -100.00 16.40 TB 72.00 8.00 TR +100.00 16.90 TB 72.00 8.00 TR TE -100.00 16.40 TB 82.00 2.00 TR +100.00 16.90 TB 82.00 2.00 TR TE -100.00 16.40 TB 90.00 2.00 TR +100.00 16.90 TB 90.00 2.00 TR TE -100.00 16.40 TB 96.00 2.00 TR +100.00 16.90 TB 96.00 2.00 TR TE -100.00 16.40 TB 100.00 2.00 TR +100.00 16.90 TB 100.00 2.00 TR TE -100.00 16.40 TB 108.00 4.00 TR +100.00 16.90 TB 108.00 4.00 TR TE -110.00 6.40 TB 114.00 2.00 TR +110.00 6.90 TB 114.00 2.00 TR TE -110.00 6.40 TB 118.00 2.00 TR +110.00 6.90 TB 118.00 2.00 TR TE -100.00 16.40 TB 122.00 2.00 TR +100.00 16.90 TB 122.00 2.00 TR TE -100.00 16.40 TB 128.00 6.00 TR +100.00 16.90 TB 128.00 6.00 TR TE -100.00 16.40 TB 136.00 4.00 TR +100.00 16.90 TB 136.00 4.00 TR TE -100.00 16.40 TB 142.00 4.00 TR +100.00 16.90 TB 142.00 4.00 TR TE -100.00 16.40 TB 150.00 2.00 TR +100.00 16.90 TB 150.00 2.00 TR TE -100.00 16.40 TB 154.00 6.00 TR +100.00 16.90 TB 154.00 6.00 TR TE -100.00 16.40 TB 164.00 6.00 TR +100.00 16.90 TB 164.00 6.00 TR TE -100.00 16.40 TB 174.00 2.00 TR +100.00 16.90 TB 174.00 2.00 TR TE -100.00 16.40 TB 178.00 4.00 TR +100.00 16.90 TB 178.00 4.00 TR TE -100.00 16.40 TB 186.00 4.00 TR +100.00 16.90 TB 186.00 4.00 TR TE -100.00 16.40 TB 192.00 2.00 TR +100.00 16.90 TB 192.00 2.00 TR TE -100.00 16.40 TB 200.00 2.00 TR +100.00 16.90 TB 200.00 2.00 TR TE -110.00 6.40 TB 206.00 2.00 TR +110.00 6.90 TB 206.00 2.00 TR TE -110.00 6.40 TB 210.00 2.00 TR +110.00 6.90 TB 210.00 2.00 TR TE -91.00 6.40 TB 226.00 2.00 TR +93.10 6.90 TB 226.00 2.00 TR TE -91.00 6.40 TB 230.00 4.00 TR +93.10 6.90 TB 230.00 4.00 TR TE -91.00 6.40 TB 238.00 4.00 TR +93.10 6.90 TB 238.00 4.00 TR TE -91.00 6.40 TB 246.00 2.00 TR +93.10 6.90 TB 246.00 2.00 TR TE -91.00 6.40 TB 250.00 2.00 TR +93.10 6.90 TB 250.00 2.00 TR TE -91.00 6.40 TB 256.00 2.00 TR +93.10 6.90 TB 256.00 2.00 TR TE -91.00 6.40 TB 262.00 4.00 TR +93.10 6.90 TB 262.00 4.00 TR TE matrix currentmatrix /Helvetica findfont 20.00 scalefont setfont - 0 0 moveto 12.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 12.20 0.80 translate 0.00 rotate 0 0 moveto (9) stringwidth pop neg 0 rmoveto @@ -98,7 +98,7 @@ setmatrix matrix currentmatrix /Helvetica findfont 20.00 scalefont setfont - 0 0 moveto 70.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 71.00 0.80 translate 0.00 rotate 0 0 moveto (771384) stringwidth pop -2 div 0 rmoveto @@ -107,7 +107,7 @@ setmatrix matrix currentmatrix /Helvetica findfont 20.00 scalefont setfont - 0 0 moveto 164.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 163.00 0.80 translate 0.00 rotate 0 0 moveto (524017) stringwidth pop -2 div 0 rmoveto @@ -116,7 +116,7 @@ setmatrix matrix currentmatrix /Helvetica findfont 20.00 scalefont setfont - 0 0 moveto 246.00 101.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 246.00 101.90 translate 0.00 rotate 0 0 moveto (12) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/eps/upca_2addon_ggs_5.2.6.6-5.eps b/backend/tests/data/eps/upca_2addon_ggs_5.2.6.6-5.eps index b2d1be99..2e7fc476 100644 --- a/backend/tests/data/eps/upca_2addon_ggs_5.2.6.6-5.eps +++ b/backend/tests/data/eps/upca_2addon_ggs_5.2.6.6-5.eps @@ -1,5 +1,5 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Creator: Zint 2.10.0.9 +%%Creator: Zint 2.12.0.9 %%Title: Zint Generated Symbol %%Pages: 0 %%BoundingBox: 0 0 276 117 @@ -9,87 +9,87 @@ /TE { pop pop } bind def newpath 1.00 1.00 1.00 setrgbcolor -116.40 0.00 TB 0.00 276.00 TR +116.90 0.00 TB 0.00 276.00 TR TE 0.00 0.00 0.00 setrgbcolor -110.00 6.40 TB 18.00 2.00 TR +110.00 6.90 TB 18.00 2.00 TR TE -110.00 6.40 TB 22.00 2.00 TR +110.00 6.90 TB 22.00 2.00 TR TE -110.00 6.40 TB 30.00 4.00 TR +110.00 6.90 TB 30.00 4.00 TR TE -110.00 6.40 TB 36.00 2.00 TR +110.00 6.90 TB 36.00 2.00 TR TE -100.00 16.40 TB 42.00 4.00 TR +100.00 16.90 TB 42.00 4.00 TR TE -100.00 16.40 TB 50.00 2.00 TR +100.00 16.90 TB 50.00 2.00 TR TE -100.00 16.40 TB 56.00 2.00 TR +100.00 16.90 TB 56.00 2.00 TR TE -100.00 16.40 TB 62.00 4.00 TR +100.00 16.90 TB 62.00 4.00 TR TE -100.00 16.40 TB 68.00 8.00 TR +100.00 16.90 TB 68.00 8.00 TR TE -100.00 16.40 TB 78.00 2.00 TR +100.00 16.90 TB 78.00 2.00 TR TE -100.00 16.40 TB 82.00 2.00 TR +100.00 16.90 TB 82.00 2.00 TR TE -100.00 16.40 TB 90.00 4.00 TR +100.00 16.90 TB 90.00 4.00 TR TE -100.00 16.40 TB 96.00 4.00 TR +100.00 16.90 TB 96.00 4.00 TR TE -100.00 16.40 TB 106.00 2.00 TR +100.00 16.90 TB 106.00 2.00 TR TE -110.00 6.40 TB 110.00 2.00 TR +110.00 6.90 TB 110.00 2.00 TR TE -110.00 6.40 TB 114.00 2.00 TR +110.00 6.90 TB 114.00 2.00 TR TE -100.00 16.40 TB 118.00 2.00 TR +100.00 16.90 TB 118.00 2.00 TR TE -100.00 16.40 TB 122.00 2.00 TR +100.00 16.90 TB 122.00 2.00 TR TE -100.00 16.40 TB 132.00 2.00 TR +100.00 16.90 TB 132.00 2.00 TR TE -100.00 16.40 TB 140.00 2.00 TR +100.00 16.90 TB 140.00 2.00 TR TE -100.00 16.40 TB 146.00 2.00 TR +100.00 16.90 TB 146.00 2.00 TR TE -100.00 16.40 TB 152.00 2.00 TR +100.00 16.90 TB 152.00 2.00 TR TE -100.00 16.40 TB 160.00 6.00 TR +100.00 16.90 TB 160.00 6.00 TR TE -100.00 16.40 TB 168.00 2.00 TR +100.00 16.90 TB 168.00 2.00 TR TE -100.00 16.40 TB 174.00 6.00 TR +100.00 16.90 TB 174.00 6.00 TR TE -100.00 16.40 TB 184.00 2.00 TR +100.00 16.90 TB 184.00 2.00 TR TE -110.00 6.40 TB 188.00 2.00 TR +110.00 6.90 TB 188.00 2.00 TR TE -110.00 6.40 TB 194.00 6.00 TR +110.00 6.90 TB 194.00 6.00 TR TE -110.00 6.40 TB 202.00 2.00 TR +110.00 6.90 TB 202.00 2.00 TR TE -110.00 6.40 TB 206.00 2.00 TR +110.00 6.90 TB 206.00 2.00 TR TE -81.00 16.40 TB 226.00 2.00 TR +83.10 16.90 TB 226.00 2.00 TR TE -81.00 16.40 TB 230.00 4.00 TR +83.10 16.90 TB 230.00 4.00 TR TE -81.00 16.40 TB 238.00 2.00 TR +83.10 16.90 TB 238.00 2.00 TR TE -81.00 16.40 TB 244.00 4.00 TR +83.10 16.90 TB 244.00 4.00 TR TE -81.00 16.40 TB 250.00 2.00 TR +83.10 16.90 TB 250.00 2.00 TR TE -81.00 16.40 TB 254.00 2.00 TR +83.10 16.90 TB 254.00 2.00 TR TE -81.00 16.40 TB 262.00 4.00 TR +83.10 16.90 TB 262.00 4.00 TR TE matrix currentmatrix /Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 8.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 8.70 0.80 translate 0.00 rotate 0 0 moveto (0) stringwidth pop neg 0 rmoveto @@ -98,7 +98,7 @@ setmatrix matrix currentmatrix /Helvetica findfont 20.00 scalefont setfont - 0 0 moveto 72.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 74.00 0.80 translate 0.00 rotate 0 0 moveto (12345) stringwidth pop -2 div 0 rmoveto @@ -107,7 +107,7 @@ setmatrix matrix currentmatrix /Helvetica findfont 20.00 scalefont setfont - 0 0 moveto 152.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 152.00 0.80 translate 0.00 rotate 0 0 moveto (67890) stringwidth pop -2 div 0 rmoveto @@ -116,13 +116,13 @@ setmatrix matrix currentmatrix /Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 218.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 217.30 0.80 translate 0.00 rotate 0 0 moveto (5) show setmatrix matrix currentmatrix /Helvetica findfont 20.00 scalefont setfont - 0 0 moveto 246.00 101.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 246.00 101.90 translate 0.00 rotate 0 0 moveto (24) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/eps/upce_5addon.eps b/backend/tests/data/eps/upce_5addon.eps index 79cc76b1..d5723cce 100644 --- a/backend/tests/data/eps/upce_5addon.eps +++ b/backend/tests/data/eps/upce_5addon.eps @@ -1,5 +1,5 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Creator: Zint 2.10.0.9 +%%Creator: Zint 2.12.0.9 %%Title: Zint Generated Symbol %%Pages: 0 %%BoundingBox: 0 0 238 117 @@ -9,79 +9,79 @@ /TE { pop pop } bind def newpath 1.00 1.00 1.00 setrgbcolor -116.40 0.00 TB 0.00 238.00 TR +116.90 0.00 TB 0.00 238.00 TR TE 0.00 0.00 0.00 setrgbcolor -110.00 6.40 TB 18.00 2.00 TR +110.00 6.90 TB 18.00 2.00 TR TE -110.00 6.40 TB 22.00 2.00 TR +110.00 6.90 TB 22.00 2.00 TR TE -100.00 16.40 TB 26.00 4.00 TR +100.00 16.90 TB 26.00 4.00 TR TE -100.00 16.40 TB 34.00 4.00 TR +100.00 16.90 TB 34.00 4.00 TR TE -100.00 16.40 TB 42.00 2.00 TR +100.00 16.90 TB 42.00 2.00 TR TE -100.00 16.40 TB 48.00 4.00 TR +100.00 16.90 TB 48.00 4.00 TR TE -100.00 16.40 TB 54.00 8.00 TR +100.00 16.90 TB 54.00 8.00 TR TE -100.00 16.40 TB 64.00 2.00 TR +100.00 16.90 TB 64.00 2.00 TR TE -100.00 16.40 TB 70.00 6.00 TR +100.00 16.90 TB 70.00 6.00 TR TE -100.00 16.40 TB 78.00 2.00 TR +100.00 16.90 TB 78.00 2.00 TR TE -100.00 16.40 TB 82.00 6.00 TR +100.00 16.90 TB 82.00 6.00 TR TE -100.00 16.40 TB 92.00 2.00 TR +100.00 16.90 TB 92.00 2.00 TR TE -100.00 16.40 TB 96.00 2.00 TR +100.00 16.90 TB 96.00 2.00 TR TE -100.00 16.40 TB 100.00 8.00 TR +100.00 16.90 TB 100.00 8.00 TR TE -110.00 6.40 TB 110.00 2.00 TR +110.00 6.90 TB 110.00 2.00 TR TE -110.00 6.40 TB 114.00 2.00 TR +110.00 6.90 TB 114.00 2.00 TR TE -110.00 6.40 TB 118.00 2.00 TR +110.00 6.90 TB 118.00 2.00 TR TE -81.00 16.40 TB 134.00 2.00 TR +83.10 16.90 TB 134.00 2.00 TR TE -81.00 16.40 TB 138.00 4.00 TR +83.10 16.90 TB 138.00 4.00 TR TE -81.00 16.40 TB 144.00 4.00 TR +83.10 16.90 TB 144.00 4.00 TR TE -81.00 16.40 TB 152.00 4.00 TR +83.10 16.90 TB 152.00 4.00 TR TE -81.00 16.40 TB 158.00 2.00 TR +83.10 16.90 TB 158.00 2.00 TR TE -81.00 16.40 TB 164.00 2.00 TR +83.10 16.90 TB 164.00 2.00 TR TE -81.00 16.40 TB 170.00 4.00 TR +83.10 16.90 TB 170.00 4.00 TR TE -81.00 16.40 TB 176.00 2.00 TR +83.10 16.90 TB 176.00 2.00 TR TE -81.00 16.40 TB 180.00 2.00 TR +83.10 16.90 TB 180.00 2.00 TR TE -81.00 16.40 TB 190.00 2.00 TR +83.10 16.90 TB 190.00 2.00 TR TE -81.00 16.40 TB 194.00 2.00 TR +83.10 16.90 TB 194.00 2.00 TR TE -81.00 16.40 TB 198.00 2.00 TR +83.10 16.90 TB 198.00 2.00 TR TE -81.00 16.40 TB 206.00 4.00 TR +83.10 16.90 TB 206.00 4.00 TR TE -81.00 16.40 TB 212.00 2.00 TR +83.10 16.90 TB 212.00 2.00 TR TE -81.00 16.40 TB 216.00 4.00 TR +83.10 16.90 TB 216.00 4.00 TR TE -81.00 16.40 TB 226.00 2.00 TR +83.10 16.90 TB 226.00 2.00 TR TE matrix currentmatrix /Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 8.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 8.70 0.80 translate 0.00 rotate 0 0 moveto (0) stringwidth pop neg 0 rmoveto @@ -90,7 +90,7 @@ setmatrix matrix currentmatrix /Helvetica findfont 20.00 scalefont setfont - 0 0 moveto 66.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 67.00 0.80 translate 0.00 rotate 0 0 moveto (123456) stringwidth pop -2 div 0 rmoveto @@ -99,13 +99,13 @@ setmatrix matrix currentmatrix /Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 126.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 125.30 0.80 translate 0.00 rotate 0 0 moveto (5) show setmatrix matrix currentmatrix /Helvetica findfont 20.00 scalefont setfont - 0 0 moveto 182.00 101.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 182.00 101.90 translate 0.00 rotate 0 0 moveto (12345) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/eps/upce_5addon_small_bold.eps b/backend/tests/data/eps/upce_5addon_small_bold.eps index 5cde3c39..7a191a58 100644 --- a/backend/tests/data/eps/upce_5addon_small_bold.eps +++ b/backend/tests/data/eps/upce_5addon_small_bold.eps @@ -1,111 +1,111 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Creator: Zint 2.10.0.9 +%%Creator: Zint 2.12.0.9 %%Title: Zint Generated Symbol %%Pages: 0 -%%BoundingBox: 0 0 238 112 +%%BoundingBox: 0 0 238 113 %%EndComments /TB { 2 copy } bind def /TR { newpath 4 1 roll exch moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto closepath fill } bind def /TE { pop pop } bind def newpath 1.00 1.00 1.00 setrgbcolor -111.90 0.00 TB 0.00 238.00 TR +112.28 0.00 TB 0.00 238.00 TR TE 0.00 0.00 0.00 setrgbcolor -110.00 1.90 TB 18.00 2.00 TR +110.00 2.28 TB 18.00 2.00 TR TE -110.00 1.90 TB 22.00 2.00 TR +110.00 2.28 TB 22.00 2.00 TR TE -100.00 11.90 TB 26.00 4.00 TR +100.00 12.28 TB 26.00 4.00 TR TE -100.00 11.90 TB 34.00 4.00 TR +100.00 12.28 TB 34.00 4.00 TR TE -100.00 11.90 TB 42.00 2.00 TR +100.00 12.28 TB 42.00 2.00 TR TE -100.00 11.90 TB 48.00 4.00 TR +100.00 12.28 TB 48.00 4.00 TR TE -100.00 11.90 TB 54.00 8.00 TR +100.00 12.28 TB 54.00 8.00 TR TE -100.00 11.90 TB 64.00 2.00 TR +100.00 12.28 TB 64.00 2.00 TR TE -100.00 11.90 TB 70.00 6.00 TR +100.00 12.28 TB 70.00 6.00 TR TE -100.00 11.90 TB 78.00 2.00 TR +100.00 12.28 TB 78.00 2.00 TR TE -100.00 11.90 TB 82.00 6.00 TR +100.00 12.28 TB 82.00 6.00 TR TE -100.00 11.90 TB 92.00 2.00 TR +100.00 12.28 TB 92.00 2.00 TR TE -100.00 11.90 TB 96.00 2.00 TR +100.00 12.28 TB 96.00 2.00 TR TE -100.00 11.90 TB 100.00 8.00 TR +100.00 12.28 TB 100.00 8.00 TR TE -110.00 1.90 TB 110.00 2.00 TR +110.00 2.28 TB 110.00 2.00 TR TE -110.00 1.90 TB 114.00 2.00 TR +110.00 2.28 TB 114.00 2.00 TR TE -110.00 1.90 TB 118.00 2.00 TR +110.00 2.28 TB 118.00 2.00 TR TE -87.00 11.90 TB 134.00 2.00 TR +87.72 12.28 TB 134.00 2.00 TR TE -87.00 11.90 TB 138.00 4.00 TR +87.72 12.28 TB 138.00 4.00 TR TE -87.00 11.90 TB 144.00 4.00 TR +87.72 12.28 TB 144.00 4.00 TR TE -87.00 11.90 TB 152.00 4.00 TR +87.72 12.28 TB 152.00 4.00 TR TE -87.00 11.90 TB 158.00 2.00 TR +87.72 12.28 TB 158.00 2.00 TR TE -87.00 11.90 TB 164.00 2.00 TR +87.72 12.28 TB 164.00 2.00 TR TE -87.00 11.90 TB 170.00 4.00 TR +87.72 12.28 TB 170.00 4.00 TR TE -87.00 11.90 TB 176.00 2.00 TR +87.72 12.28 TB 176.00 2.00 TR TE -87.00 11.90 TB 180.00 2.00 TR +87.72 12.28 TB 180.00 2.00 TR TE -87.00 11.90 TB 190.00 2.00 TR +87.72 12.28 TB 190.00 2.00 TR TE -87.00 11.90 TB 194.00 2.00 TR +87.72 12.28 TB 194.00 2.00 TR TE -87.00 11.90 TB 198.00 2.00 TR +87.72 12.28 TB 198.00 2.00 TR TE -87.00 11.90 TB 206.00 4.00 TR +87.72 12.28 TB 206.00 4.00 TR TE -87.00 11.90 TB 212.00 2.00 TR +87.72 12.28 TB 212.00 2.00 TR TE -87.00 11.90 TB 216.00 4.00 TR +87.72 12.28 TB 216.00 4.00 TR TE -87.00 11.90 TB 226.00 2.00 TR +87.72 12.28 TB 226.00 2.00 TR TE matrix currentmatrix -/Helvetica-Bold findfont +/Helvetica findfont 12.00 scalefont setfont - 0 0 moveto 8.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 8.70 0.56 translate 0.00 rotate 0 0 moveto (0) stringwidth pop neg 0 rmoveto (0) show setmatrix matrix currentmatrix -/Helvetica-Bold findfont +/Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 66.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 67.00 0.56 translate 0.00 rotate 0 0 moveto (123456) stringwidth pop -2 div 0 rmoveto (123456) show setmatrix matrix currentmatrix -/Helvetica-Bold findfont +/Helvetica findfont 12.00 scalefont setfont - 0 0 moveto 126.00 0.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 125.30 0.56 translate 0.00 rotate 0 0 moveto (5) show setmatrix matrix currentmatrix -/Helvetica-Bold findfont +/Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 182.00 101.40 translate 0.00 rotate 0 0 moveto + 0 0 moveto 182.00 101.78 translate 0.00 rotate 0 0 moveto (12345) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/print/emf/code128_aim.emf b/backend/tests/data/print/emf/code128_aim.emf index 512d6db2..b0f33736 100644 Binary files a/backend/tests/data/print/emf/code128_aim.emf and b/backend/tests/data/print/emf/code128_aim.emf differ diff --git a/backend/tests/data/print/eps/code128_aim.eps b/backend/tests/data/print/eps/code128_aim.eps index c44fc38b..d7ac0521 100644 --- a/backend/tests/data/print/eps/code128_aim.eps +++ b/backend/tests/data/print/eps/code128_aim.eps @@ -1,5 +1,5 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Creator: Zint 2.10.0.9 +%%Creator: Zint 2.12.0.9 %%Title: Zint Generated Symbol %%Pages: 0 %%BoundingBox: 0 0 136 119 @@ -53,7 +53,7 @@ TE matrix currentmatrix /Helvetica findfont 14.00 scalefont setfont - 0 0 moveto 68.00 3.50 translate 0.00 rotate 0 0 moveto + 0 0 moveto 68.00 4.90 translate 0.00 rotate 0 0 moveto (AIM) stringwidth pop -2 div 0 rmoveto diff --git a/backend/tests/data/print/svg/code128_aim.svg b/backend/tests/data/print/svg/code128_aim.svg index 4f20b887..65f65886 100644 --- a/backend/tests/data/print/svg/code128_aim.svg +++ b/backend/tests/data/print/svg/code128_aim.svg @@ -27,7 +27,7 @@ - AIM diff --git a/backend/tests/data/svg/channel_cmyk_nobg.svg b/backend/tests/data/svg/channel_cmyk_nobg.svg index 10e5561f..338c17f6 100644 --- a/backend/tests/data/svg/channel_cmyk_nobg.svg +++ b/backend/tests/data/svg/channel_cmyk_nobg.svg @@ -16,7 +16,7 @@ - 123 diff --git a/backend/tests/data/svg/code128_amperands.svg b/backend/tests/data/svg/code128_amperands.svg index 28c0ee97..1d9d15eb 100644 --- a/backend/tests/data/svg/code128_amperands.svg +++ b/backend/tests/data/svg/code128_amperands.svg @@ -33,7 +33,7 @@ - <>"&' diff --git a/backend/tests/data/svg/code128_egrave_bold.svg b/backend/tests/data/svg/code128_egrave_bold.svg index 0981b05f..ab2eb658 100644 --- a/backend/tests/data/svg/code128_egrave_bold.svg +++ b/backend/tests/data/svg/code128_egrave_bold.svg @@ -39,7 +39,7 @@ - Égjpqy diff --git a/backend/tests/data/svg/code128_egrave_bold_box3.svg b/backend/tests/data/svg/code128_egrave_bold_box3.svg index f592b81e..1da0b5d2 100644 --- a/backend/tests/data/svg/code128_egrave_bold_box3.svg +++ b/backend/tests/data/svg/code128_egrave_bold_box3.svg @@ -43,7 +43,7 @@ - Égjpqy diff --git a/backend/tests/data/svg/code128_egrave_bold_hvwsp2_box2.svg b/backend/tests/data/svg/code128_egrave_bold_hvwsp2_box2.svg index 45a78718..24ac99a1 100644 --- a/backend/tests/data/svg/code128_egrave_bold_hvwsp2_box2.svg +++ b/backend/tests/data/svg/code128_egrave_bold_hvwsp2_box2.svg @@ -43,7 +43,7 @@ - Égjpqy diff --git a/backend/tests/data/svg/code128_egrave_bold_hvwsp3.svg b/backend/tests/data/svg/code128_egrave_bold_hvwsp3.svg index e95f3ec6..f14c85f2 100644 --- a/backend/tests/data/svg/code128_egrave_bold_hvwsp3.svg +++ b/backend/tests/data/svg/code128_egrave_bold_hvwsp3.svg @@ -39,7 +39,7 @@ - Égjpqy diff --git a/backend/tests/data/svg/code39_small.svg b/backend/tests/data/svg/code39_small.svg index c93b6d41..d0660a8c 100644 --- a/backend/tests/data/svg/code39_small.svg +++ b/backend/tests/data/svg/code39_small.svg @@ -33,7 +33,7 @@ - *123* diff --git a/backend/tests/data/svg/dbar_ltd.svg b/backend/tests/data/svg/dbar_ltd.svg index 608c21d3..77c2ca6d 100644 --- a/backend/tests/data/svg/dbar_ltd.svg +++ b/backend/tests/data/svg/dbar_ltd.svg @@ -31,7 +31,7 @@ - (01)00123456789098 diff --git a/backend/tests/data/svg/dpd_compliant.svg b/backend/tests/data/svg/dpd_compliant.svg index 02207b63..3274c22f 100644 --- a/backend/tests/data/svg/dpd_compliant.svg +++ b/backend/tests/data/svg/dpd_compliant.svg @@ -67,7 +67,7 @@ - 0081 827 0998 0000 0200 28 101 276 B diff --git a/backend/tests/data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg b/backend/tests/data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg index f735e419..de87e6ba 100644 --- a/backend/tests/data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg +++ b/backend/tests/data/svg/ean13_2addon_ggs_5.2.2.5.1-2.svg @@ -38,22 +38,22 @@ - - - - - - - - + + + + + + + 9 - 771384 - 524017 diff --git a/backend/tests/data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg b/backend/tests/data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg index 9186e92c..25c5acec 100644 --- a/backend/tests/data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg +++ b/backend/tests/data/svg/ean13_5addon_ggs_5.2.2.5.2-2.svg @@ -38,31 +38,31 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 9 - 780877 - 799306 diff --git a/backend/tests/data/svg/ean13_cc_2addon_cca_4x4.svg b/backend/tests/data/svg/ean13_cc_2addon_cca_4x4.svg index 866b9d09..5d02b25d 100644 --- a/backend/tests/data/svg/ean13_cc_2addon_cca_4x4.svg +++ b/backend/tests/data/svg/ean13_cc_2addon_cca_4x4.svg @@ -120,22 +120,22 @@ - - - - - - - - + + + + + + + 1 - 234567 - 890128 diff --git a/backend/tests/data/svg/ean13_cc_5addon_ccb_3x4.svg b/backend/tests/data/svg/ean13_cc_5addon_ccb_3x4.svg index f57b25b4..468a3a3e 100644 --- a/backend/tests/data/svg/ean13_cc_5addon_ccb_3x4.svg +++ b/backend/tests/data/svg/ean13_cc_5addon_ccb_3x4.svg @@ -118,31 +118,31 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 1 - 234567 - 890128 diff --git a/backend/tests/data/svg/ean13_cc_5addon_ccb_3x4_notext.svg b/backend/tests/data/svg/ean13_cc_5addon_ccb_3x4_notext.svg index c56eeb39..2aa1e49d 100644 --- a/backend/tests/data/svg/ean13_cc_5addon_ccb_3x4_notext.svg +++ b/backend/tests/data/svg/ean13_cc_5addon_ccb_3x4_notext.svg @@ -118,21 +118,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/backend/tests/data/svg/ean2.svg b/backend/tests/data/svg/ean2.svg index ac209e03..e4dc03a4 100644 --- a/backend/tests/data/svg/ean2.svg +++ b/backend/tests/data/svg/ean2.svg @@ -15,7 +15,7 @@ - 12 diff --git a/backend/tests/data/svg/ean5.svg b/backend/tests/data/svg/ean5.svg index 4ced2d75..2c01ac0a 100644 --- a/backend/tests/data/svg/ean5.svg +++ b/backend/tests/data/svg/ean5.svg @@ -24,7 +24,7 @@ - 12345 diff --git a/backend/tests/data/svg/ean8_2addon.svg b/backend/tests/data/svg/ean8_2addon.svg index 1639f733..abdb9f42 100644 --- a/backend/tests/data/svg/ean8_2addon.svg +++ b/backend/tests/data/svg/ean8_2addon.svg @@ -30,18 +30,18 @@ - - - - - - - - + + + + + + + 1234 - 5670 diff --git a/backend/tests/data/svg/ean8_5addon.svg b/backend/tests/data/svg/ean8_5addon.svg index 01e82906..00cda891 100644 --- a/backend/tests/data/svg/ean8_5addon.svg +++ b/backend/tests/data/svg/ean8_5addon.svg @@ -30,27 +30,27 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 1234 - 5670 diff --git a/backend/tests/data/svg/ean8_cc_2addon_cca_4x3.svg b/backend/tests/data/svg/ean8_cc_2addon_cca_4x3.svg index f6c85896..e1fd6118 100644 --- a/backend/tests/data/svg/ean8_cc_2addon_cca_4x3.svg +++ b/backend/tests/data/svg/ean8_cc_2addon_cca_4x3.svg @@ -93,18 +93,18 @@ - - - - - - - - + + + + + + + 9876 - 5430 diff --git a/backend/tests/data/svg/ean8_cc_5addon_ccb_8x3.svg b/backend/tests/data/svg/ean8_cc_5addon_ccb_8x3.svg index 2807b850..b557acc1 100644 --- a/backend/tests/data/svg/ean8_cc_5addon_ccb_8x3.svg +++ b/backend/tests/data/svg/ean8_cc_5addon_ccb_8x3.svg @@ -150,27 +150,27 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 9876 - 5430 diff --git a/backend/tests/data/svg/gs1_128_cc_fig12.svg b/backend/tests/data/svg/gs1_128_cc_fig12.svg index 9ade7617..3fb65814 100644 --- a/backend/tests/data/svg/gs1_128_cc_fig12.svg +++ b/backend/tests/data/svg/gs1_128_cc_fig12.svg @@ -244,7 +244,7 @@ - (00)030123456789012340 diff --git a/backend/tests/data/svg/telepen_height0.4_rotate_180.svg b/backend/tests/data/svg/telepen_height0.4_rotate_180.svg index ad2687ea..04849e66 100644 --- a/backend/tests/data/svg/telepen_height0.4_rotate_180.svg +++ b/backend/tests/data/svg/telepen_height0.4_rotate_180.svg @@ -30,8 +30,8 @@ - + A diff --git a/backend/tests/data/svg/upca_2addon_ggs_5.2.6.6-5.svg b/backend/tests/data/svg/upca_2addon_ggs_5.2.6.6-5.svg index cd62aa7f..80ce272a 100644 --- a/backend/tests/data/svg/upca_2addon_ggs_5.2.6.6-5.svg +++ b/backend/tests/data/svg/upca_2addon_ggs_5.2.6.6-5.svg @@ -38,26 +38,26 @@ - - - - - - - - + + + + + + + 0 - 12345 - 67890 - 5 diff --git a/backend/tests/data/svg/upca_5addon.svg b/backend/tests/data/svg/upca_5addon.svg index e0d489f7..b1a4caf8 100644 --- a/backend/tests/data/svg/upca_5addon.svg +++ b/backend/tests/data/svg/upca_5addon.svg @@ -38,35 +38,35 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 6 - 14141 - 23441 - 7 diff --git a/backend/tests/data/svg/upca_5addon_bind3.svg b/backend/tests/data/svg/upca_5addon_bind3.svg index ade6f752..868a20ef 100644 --- a/backend/tests/data/svg/upca_5addon_bind3.svg +++ b/backend/tests/data/svg/upca_5addon_bind3.svg @@ -38,37 +38,37 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - 6 - 14141 - 23441 - 7 diff --git a/backend/tests/data/svg/upca_5addon_small_bold.svg b/backend/tests/data/svg/upca_5addon_small_bold.svg index 35d676f4..d401db48 100644 --- a/backend/tests/data/svg/upca_5addon_small_bold.svg +++ b/backend/tests/data/svg/upca_5addon_small_bold.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -38,40 +38,40 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + 6 - + 14141 - + 23441 - + 7 + font-family="Helvetica, sans-serif" font-size="14.0" > 12345 diff --git a/backend/tests/data/svg/upca_cc_2addon_cca_3x4.svg b/backend/tests/data/svg/upca_cc_2addon_cca_3x4.svg index d8b7d2e6..1844c6df 100644 --- a/backend/tests/data/svg/upca_cc_2addon_cca_3x4.svg +++ b/backend/tests/data/svg/upca_cc_2addon_cca_3x4.svg @@ -103,26 +103,26 @@ - - - - - - - - + + + + + + + 1 - 23456 - 78901 - 2 diff --git a/backend/tests/data/svg/upca_cc_5addon_ccb_4x4.svg b/backend/tests/data/svg/upca_cc_5addon_ccb_4x4.svg index 92a8abca..6b7fc944 100644 --- a/backend/tests/data/svg/upca_cc_5addon_ccb_4x4.svg +++ b/backend/tests/data/svg/upca_cc_5addon_ccb_4x4.svg @@ -118,35 +118,35 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 1 - 23456 - 78901 - 2 diff --git a/backend/tests/data/svg/upca_cc_5addon_ccb_4x4_bind3.svg b/backend/tests/data/svg/upca_cc_5addon_ccb_4x4_bind3.svg index 7d39e0ec..064f1f72 100644 --- a/backend/tests/data/svg/upca_cc_5addon_ccb_4x4_bind3.svg +++ b/backend/tests/data/svg/upca_cc_5addon_ccb_4x4_bind3.svg @@ -118,37 +118,37 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - 1 - 23456 - 78901 - 2 diff --git a/backend/tests/data/svg/upca_cc_5addon_ccb_4x4_notext.svg b/backend/tests/data/svg/upca_cc_5addon_ccb_4x4_notext.svg index 0fc3fda0..622f7acf 100644 --- a/backend/tests/data/svg/upca_cc_5addon_ccb_4x4_notext.svg +++ b/backend/tests/data/svg/upca_cc_5addon_ccb_4x4_notext.svg @@ -118,21 +118,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/backend/tests/data/svg/upce_2addon.svg b/backend/tests/data/svg/upce_2addon.svg index d41ddf07..34085aef 100644 --- a/backend/tests/data/svg/upce_2addon.svg +++ b/backend/tests/data/svg/upce_2addon.svg @@ -25,22 +25,22 @@ - - - - - - - - + + + + + + + 1 - 234567 - 0 diff --git a/backend/tests/data/svg/upce_5addon.svg b/backend/tests/data/svg/upce_5addon.svg index 545e6b0f..0d70f408 100644 --- a/backend/tests/data/svg/upce_5addon.svg +++ b/backend/tests/data/svg/upce_5addon.svg @@ -25,31 +25,31 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 1 - 234567 - 0 diff --git a/backend/tests/data/svg/upce_5addon_notext.svg b/backend/tests/data/svg/upce_5addon_notext.svg index 7c7f359d..c6fe09fc 100644 --- a/backend/tests/data/svg/upce_5addon_notext.svg +++ b/backend/tests/data/svg/upce_5addon_notext.svg @@ -25,21 +25,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/backend/tests/data/svg/upce_5addon_small.svg b/backend/tests/data/svg/upce_5addon_small.svg index e5469fa0..270facc7 100644 --- a/backend/tests/data/svg/upce_5addon_small.svg +++ b/backend/tests/data/svg/upce_5addon_small.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -25,31 +25,31 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 1 - 234567 - 0 diff --git a/backend/tests/data/svg/upce_cc_2addon_cca_5x2.svg b/backend/tests/data/svg/upce_cc_2addon_cca_5x2.svg index 8c8d334e..b60c1d62 100644 --- a/backend/tests/data/svg/upce_cc_2addon_cca_5x2.svg +++ b/backend/tests/data/svg/upce_cc_2addon_cca_5x2.svg @@ -80,22 +80,22 @@ - - - - - - - - + + + + + + + 0 - 654321 - 7 diff --git a/backend/tests/data/svg/upce_cc_2addon_cca_5x2_fgbgalpha.svg b/backend/tests/data/svg/upce_cc_2addon_cca_5x2_fgbgalpha.svg index f35125df..dbfd11a4 100644 --- a/backend/tests/data/svg/upce_cc_2addon_cca_5x2_fgbgalpha.svg +++ b/backend/tests/data/svg/upce_cc_2addon_cca_5x2_fgbgalpha.svg @@ -80,22 +80,22 @@ - - - - - - - - + + + + + + + 0 - 654321 - 7 diff --git a/backend/tests/data/svg/upce_cc_2addon_cca_5x2_nobg.svg b/backend/tests/data/svg/upce_cc_2addon_cca_5x2_nobg.svg index ce003fcb..eba80d57 100644 --- a/backend/tests/data/svg/upce_cc_2addon_cca_5x2_nobg.svg +++ b/backend/tests/data/svg/upce_cc_2addon_cca_5x2_nobg.svg @@ -79,22 +79,22 @@ - - - - - - - - + + + + + + + 0 - 654321 - 7 diff --git a/backend/tests/data/svg/upce_cc_2addon_cca_5x2_rotate_270.svg b/backend/tests/data/svg/upce_cc_2addon_cca_5x2_rotate_270.svg index de36a106..41a9fc0a 100644 --- a/backend/tests/data/svg/upce_cc_2addon_cca_5x2_rotate_270.svg +++ b/backend/tests/data/svg/upce_cc_2addon_cca_5x2_rotate_270.svg @@ -80,23 +80,23 @@ - - - - - - - - + + + + + + + + 0 - + 654321 - + 7 - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 1 - 876543 - 5 diff --git a/backend/tests/data/svg/upce_cc_5addon_ccb_8x2_notext.svg b/backend/tests/data/svg/upce_cc_5addon_ccb_8x2_notext.svg index 5a16d4cb..639033fc 100644 --- a/backend/tests/data/svg/upce_cc_5addon_ccb_8x2_notext.svg +++ b/backend/tests/data/svg/upce_cc_5addon_ccb_8x2_notext.svg @@ -106,21 +106,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/backend/tests/test_emf.c b/backend/tests/test_emf.c index 72d45fb2..bb815bac 100644 --- a/backend/tests/test_emf.c +++ b/backend/tests/test_emf.c @@ -158,7 +158,8 @@ static void test_print(const testCtx *const p_ctx) { /* Note this will fail (on Ubuntu anyway) if LibreOffice Base/Calc/Impress/Writer running (i.e. anything but LibreOffice Draw) Doesn't seem to be a way to force Draw invocation through the command line */ ret = testUtilVerifyLibreOffice(expected_file, debug); - assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret); + assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0 - check that LibreOffice is not running!\n", + i, testUtilBarcodeName(data[i].symbology), expected_file, ret); } } else { assert_nonzero(testUtilExists(symbol->outfile), "i:%d testUtilExists(%s) == 0\n", i, symbol->outfile); diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index f99e1edd..f38df8f9 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -52,6 +52,7 @@ static void test_checks(const testCtx *const p_ctx) { int border_width; float scale; float dot_size; + float text_gap; float guard_descent; int warn_level; int ret; @@ -61,155 +62,157 @@ static void test_checks(const testCtx *const p_ctx) { }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { BARCODE_CODE128, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", -1 }, - /* 1*/ { BARCODE_CODE128, -1, "1234", -1, -1, 0, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, - /* 2*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, - /* 3*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 999999 + 1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI code 1000000", -1 }, - /* 4*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 0.009, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01 to 200)", -1 }, - /* 5*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 200.01, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01 to 200)", -1 }, - /* 6*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, -1, 20.1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", -1 }, - /* 7*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 0.01, 0.009, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", -1 }, - /* 8*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, -0.1, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 765: Height out of range (0 to 2000)", -1 }, - /* 9*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 2000.01, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 765: Height out of range (0 to 2000)", -1 }, - /* 10*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, -1, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 766: Whitespace width out of range (0 to 100)", -1 }, - /* 11*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 101, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 766: Whitespace width out of range (0 to 100)", -1 }, - /* 12*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 767: Whitespace height out of range (0 to 100)", -1 }, - /* 13*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 101, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 767: Whitespace height out of range (0 to 100)", -1 }, - /* 14*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, -1, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 768: Border width out of range (0 to 100)", -1 }, - /* 15*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 101, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 768: Border width out of range (0 to 100)", -1 }, - /* 16*/ { BARCODE_CODE128, -1, "1234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode", -1 }, - /* 17*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, -0.5, -1, ZINT_ERROR_INVALID_OPTION, "Error 769: Guard bar descent out of range (0 to 50)", -1 }, - /* 18*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, 50.1, -1, ZINT_ERROR_INVALID_OPTION, "Error 769: Guard bar descent out of range (0 to 50)", -1 }, - /* 19*/ { BARCODE_GS1_128, -1, "[21]12\0004", 8, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 262: NUL characters not permitted in GS1 mode", -1 }, - /* 20*/ { BARCODE_GS1_128, -1, "[21]12é4", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1", -1 }, - /* 21*/ { BARCODE_GS1_128, -1, "[21]12\0074", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 251: Control characters are not supported by GS1", -1 }, - /* 22*/ { BARCODE_GS1_128, -1, "[21]1234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, - /* 23*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 }, - /* 24*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, - /* 25*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, /* Not supporting beats invalid ECI */ - /* 26*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, - /* 27*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", BARCODE_CODE128 }, - /* 28*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, - /* 29*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, 0.009, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, /* Invalid dot size no longer beats invalid ECI */ - /* 30*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, - /* 31*/ { 5, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_C25STANDARD }, - /* 32*/ { 5, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_C25STANDARD }, - /* 33*/ { 10, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_EANX }, - /* 34*/ { 10, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, - /* 35*/ { 11, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_EANX }, - /* 36*/ { 11, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, - /* 37*/ { 12, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_EANX }, - /* 38*/ { 12, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, - /* 39*/ { 15, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_EANX }, - /* 40*/ { 15, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, - /* 41*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_UPCA }, - /* 42*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA }, - /* 43*/ { 19, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input too short (3 character minimum)", BARCODE_CODABAR }, - /* 44*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 207: Codabar 18 not supported", BARCODE_CODABAR }, - /* 45*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 207: Codabar 18 not supported", -1 }, - /* 46*/ { 26, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_UPCA }, - /* 47*/ { 26, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA }, - /* 48*/ { 27, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 208: UPCD1 not supported", 27 }, - /* 49*/ { 33, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 }, - /* 50*/ { 33, -1, "[10]23", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_GS1_128 }, - /* 51*/ { 33, -1, "[10]23", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 }, - /* 52*/ { 36, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_UPCA }, - /* 53*/ { 36, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA }, - /* 54*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_UPCE }, - /* 55*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCE }, - /* 56*/ { 41, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 479: Input length is not standard (5, 9 or 11 characters)", BARCODE_POSTNET }, - /* 57*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET }, - /* 58*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, - /* 59*/ { 42, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET }, - /* 60*/ { 42, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, - /* 61*/ { 43, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET }, - /* 62*/ { 43, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, - /* 63*/ { 44, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET }, - /* 64*/ { 44, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, - /* 65*/ { 45, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_POSTNET }, - /* 66*/ { 45, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, - /* 67*/ { 46, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_PLESSEY }, - /* 68*/ { 46, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLESSEY }, - /* 69*/ { 48, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_NVE18 }, - /* 70*/ { 48, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_NVE18 }, - /* 71*/ { 59, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_CODE128 }, - /* 72*/ { 59, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 }, - /* 73*/ { 61, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_CODE128 }, - /* 74*/ { 61, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 }, - /* 75*/ { 62, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_CODE93 }, - /* 76*/ { 62, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE93 }, - /* 77*/ { 64, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_AUSPOST }, - /* 78*/ { 64, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST }, - /* 79*/ { 65, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_AUSPOST }, - /* 80*/ { 65, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST }, - /* 81*/ { 78, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_DBAR_OMN }, - /* 82*/ { 78, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_DBAR_OMN }, - /* 83*/ { 83, -1, "12345678901", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_PLANET }, - /* 84*/ { 83, -1, "12345678901", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLANET }, - /* 85*/ { 88, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 }, - /* 86*/ { 88, -1, "[10]12", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_GS1_128 }, - /* 87*/ { 88, -1, "[10]12", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 }, - /* 88*/ { 91, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 212: Symbology out of range", BARCODE_CODE128 }, - /* 89*/ { 91, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 212: Symbology out of range", -1 }, - /* 90*/ { 94, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 }, - /* 91*/ { 94, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 }, - /* 92*/ { 95, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 }, - /* 93*/ { 95, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 }, - /* 94*/ { 100, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_128 }, - /* 95*/ { 100, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_128 }, - /* 96*/ { 101, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_39 }, - /* 97*/ { 101, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_39 }, - /* 98*/ { 103, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_DM }, - /* 99*/ { 103, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_DM }, - /*100*/ { 105, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_QR }, - /*101*/ { 105, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_QR }, - /*102*/ { 107, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_PDF }, - /*103*/ { 107, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_PDF }, - /*104*/ { 109, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_MICPDF }, - /*105*/ { 109, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_MICPDF }, - /*106*/ { 111, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", BARCODE_HIBC_BLOCKF }, - /*107*/ { 111, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_BLOCKF }, - /*108*/ { 113, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 }, - /*109*/ { 113, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 }, - /*110*/ { 114, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 }, - /*111*/ { 114, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 }, - /*112*/ { 117, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, - /*113*/ { 117, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, - /*114*/ { 118, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, - /*115*/ { 118, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, - /*116*/ { 122, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, - /*117*/ { 122, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, - /*118*/ { 123, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, - /*119*/ { 123, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, - /*120*/ { 124, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, - /*121*/ { 124, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, - /*122*/ { 125, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, - /*123*/ { 125, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, - /*124*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, - /*125*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, - /*126*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, - /*127*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, - /*128*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 }, - /*129*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 }, - /*130*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 }, - /*131*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 }, - /*132*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 }, - /*133*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, - /*134*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, - /*135*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, - /*136*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, - /*137*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, - /*138*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, - /*139*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 }, - /*140*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /* Warning in encoder overrides library warnings */ - /*141*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /* But not errors */ - /*142*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, 0, "", -1 }, - /*143*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, - /*144*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, - /*145*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 }, - /*146*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, - /*147*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /* ECI warning trumps all other warnings */ - /*148*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, /* But not errors */ + /* 0*/ { BARCODE_CODE128, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", -1 }, + /* 1*/ { BARCODE_CODE128, -1, "1234", -1, -1, 0, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, + /* 2*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, + /* 3*/ { BARCODE_QRCODE, -1, "1234", -1, -1, 999999 + 1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 218: Invalid ECI code 1000000", -1 }, + /* 4*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 0.009, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01 to 200)", -1 }, + /* 5*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 200.01, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 227: Scale out of range (0.01 to 200)", -1 }, + /* 6*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, -1, 20.1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", -1 }, + /* 7*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 0, 0.01, 0.009, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", -1 }, + /* 8*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, -0.1, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 765: Height out of range (0 to 2000)", -1 }, + /* 9*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 2000.01, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 765: Height out of range (0 to 2000)", -1 }, + /* 10*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, -1, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 766: Whitespace width out of range (0 to 100)", -1 }, + /* 11*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 101, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 766: Whitespace width out of range (0 to 100)", -1 }, + /* 12*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 767: Whitespace height out of range (0 to 100)", -1 }, + /* 13*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 101, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 767: Whitespace height out of range (0 to 100)", -1 }, + /* 14*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, -1, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 768: Border width out of range (0 to 100)", -1 }, + /* 15*/ { BARCODE_CODE128, -1, "1234", -1, -1, -1, 0, 0, 0, 101, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 768: Border width out of range (0 to 100)", -1 }, + /* 16*/ { BARCODE_CODE128, -1, "1234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode", -1 }, + /* 17*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, -0.1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 219: Text gap out of range (0 to 5)", -1 }, + /* 18*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, 5.1, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 219: Text gap out of range (0 to 5)", -1 }, + /* 19*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, 0, -0.5, -1, ZINT_ERROR_INVALID_OPTION, "Error 769: Guard bar descent out of range (0 to 50)", -1 }, + /* 20*/ { BARCODE_EANX, -1, "123456789012", -1, -1, -1, 0, 0, 0, 101, -1, -1, 0, 50.1, -1, ZINT_ERROR_INVALID_OPTION, "Error 769: Guard bar descent out of range (0 to 50)", -1 }, + /* 21*/ { BARCODE_GS1_128, -1, "[21]12\0004", 8, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 262: NUL characters not permitted in GS1 mode", -1 }, + /* 22*/ { BARCODE_GS1_128, -1, "[21]12é4", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 250: Extended ASCII characters are not supported by GS1", -1 }, + /* 23*/ { BARCODE_GS1_128, -1, "[21]12\0074", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 251: Control characters are not supported by GS1", -1 }, + /* 24*/ { BARCODE_GS1_128, -1, "[21]1234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, + /* 25*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 206: Symbology out of range", BARCODE_CODE128 }, + /* 26*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, + /* 27*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, /* Not supporting beats invalid ECI */ + /* 28*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, + /* 29*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 221: Dot size out of range (0.01 to 20)", BARCODE_CODE128 }, + /* 30*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, + /* 31*/ { 0, -1, "1", -1, -1, 1, 0, 0, 0, 0, -1, 0.009, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 217: Symbology does not support ECI switching", BARCODE_CODE128 }, /* Invalid dot size no longer beats invalid ECI */ + /* 32*/ { 0, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, 0.009, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 206: Symbology out of range", -1 }, + /* 33*/ { 5, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_C25STANDARD }, + /* 34*/ { 5, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_C25STANDARD }, + /* 35*/ { 10, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_EANX }, + /* 36*/ { 10, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, + /* 37*/ { 11, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_EANX }, + /* 38*/ { 11, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, + /* 39*/ { 12, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_EANX }, + /* 40*/ { 12, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, + /* 41*/ { 15, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_EANX }, + /* 42*/ { 15, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_EANX }, + /* 43*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_UPCA }, + /* 44*/ { 17, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA }, + /* 45*/ { 19, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_TOO_LONG, "Error 362: Input too short (3 character minimum)", BARCODE_CODABAR }, + /* 46*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 207: Codabar 18 not supported", BARCODE_CODABAR }, + /* 47*/ { 19, -1, "A1B", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 207: Codabar 18 not supported", -1 }, + /* 48*/ { 26, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_UPCA }, + /* 49*/ { 26, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA }, + /* 50*/ { 27, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_OPTION, "Error 208: UPCD1 not supported", 27 }, + /* 51*/ { 33, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 }, + /* 52*/ { 33, -1, "[10]23", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_GS1_128 }, + /* 53*/ { 33, -1, "[10]23", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 }, + /* 54*/ { 36, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_UPCA }, + /* 55*/ { 36, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCA }, + /* 56*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_UPCE }, + /* 57*/ { 39, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_UPCE }, + /* 58*/ { 41, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 479: Input length is not standard (5, 9 or 11 characters)", BARCODE_POSTNET }, + /* 59*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_POSTNET }, + /* 60*/ { 41, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, + /* 61*/ { 42, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_POSTNET }, + /* 62*/ { 42, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, + /* 63*/ { 43, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_POSTNET }, + /* 64*/ { 43, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, + /* 65*/ { 44, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_POSTNET }, + /* 66*/ { 44, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, + /* 67*/ { 45, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_POSTNET }, + /* 68*/ { 45, -1, "12345", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_POSTNET }, + /* 69*/ { 46, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_PLESSEY }, + /* 70*/ { 46, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLESSEY }, + /* 71*/ { 48, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_NVE18 }, + /* 72*/ { 48, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_NVE18 }, + /* 73*/ { 59, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_CODE128 }, + /* 74*/ { 59, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 }, + /* 75*/ { 61, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_CODE128 }, + /* 76*/ { 61, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE128 }, + /* 77*/ { 62, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_CODE93 }, + /* 78*/ { 62, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_CODE93 }, + /* 79*/ { 64, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_AUSPOST }, + /* 80*/ { 64, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST }, + /* 81*/ { 65, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_AUSPOST }, + /* 82*/ { 65, -1, "12345678", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_AUSPOST }, + /* 83*/ { 78, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_DBAR_OMN }, + /* 84*/ { 78, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_DBAR_OMN }, + /* 85*/ { 83, -1, "12345678901", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_PLANET }, + /* 86*/ { 83, -1, "12345678901", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_PLANET }, + /* 87*/ { 88, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 252: Data does not start with an AI", BARCODE_GS1_128 }, + /* 88*/ { 88, -1, "[10]12", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_GS1_128 }, + /* 89*/ { 88, -1, "[10]12", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_GS1_128 }, + /* 90*/ { 91, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 212: Symbology out of range", BARCODE_CODE128 }, + /* 91*/ { 91, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 212: Symbology out of range", -1 }, + /* 92*/ { 94, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 }, + /* 93*/ { 94, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 }, + /* 94*/ { 95, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 213: Symbology out of range", BARCODE_CODE128 }, + /* 95*/ { 95, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 213: Symbology out of range", -1 }, + /* 96*/ { 100, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_HIBC_128 }, + /* 97*/ { 100, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_128 }, + /* 98*/ { 101, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_HIBC_39 }, + /* 99*/ { 101, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_39 }, + /*100*/ { 103, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_HIBC_DM }, + /*101*/ { 103, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_DM }, + /*102*/ { 105, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_HIBC_QR }, + /*103*/ { 105, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_QR }, + /*104*/ { 107, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_HIBC_PDF }, + /*105*/ { 107, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_PDF }, + /*106*/ { 109, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_HIBC_MICPDF }, + /*107*/ { 109, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_MICPDF }, + /*108*/ { 111, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", BARCODE_HIBC_BLOCKF }, + /*109*/ { 111, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, 0, "", BARCODE_HIBC_BLOCKF }, + /*110*/ { 113, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 }, + /*111*/ { 113, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 }, + /*112*/ { 114, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 214: Symbology out of range", BARCODE_CODE128 }, + /*113*/ { 114, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 214: Symbology out of range", -1 }, + /*114*/ { 117, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, + /*115*/ { 117, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, + /*116*/ { 118, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, + /*117*/ { 118, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, + /*118*/ { 122, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, + /*119*/ { 122, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, + /*120*/ { 123, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, + /*121*/ { 123, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, + /*122*/ { 124, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, + /*123*/ { 124, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, + /*124*/ { 125, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, + /*125*/ { 125, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, + /*126*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, + /*127*/ { 126, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, + /*128*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 215: Symbology out of range", BARCODE_CODE128 }, + /*129*/ { 127, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 215: Symbology out of range", -1 }, + /*130*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 }, + /*131*/ { 147, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 }, + /*132*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 216: Symbology out of range", BARCODE_CODE128 }, + /*133*/ { BARCODE_LAST + 1, -1, "1", -1, -1, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 216: Symbology out of range", -1 }, + /*134*/ { BARCODE_CODE128, -1, "\200", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_ERROR_INVALID_DATA, "Error 245: Invalid UTF-8 in input data", -1 }, + /*135*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_NONCOMPLIANT, "Warning 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, + /*136*/ { BARCODE_GS1_128, -1, "[01]12345678901234", -1, GS1_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, + /*137*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, + /*138*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, + /*139*/ { BARCODE_QRCODE, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, + /*140*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, + /*141*/ { BARCODE_CODEONE, -1, "[01]12345678901231", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 512: ECI ignored for GS1 mode", -1 }, + /*142*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 512: ECI ignored for GS1 mode", -1 }, /* Warning in encoder overrides library warnings */ + /*143*/ { BARCODE_CODEONE, -1, "[01]12345678901234", -1, GS1_MODE, 3, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_NONCOMPLIANT, "Error 261: AI (01) position 14: Bad checksum '4', expected '1'", -1 }, /* But not errors */ + /*144*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, 0, "", -1 }, + /*145*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, + /*146*/ { BARCODE_AZTEC, -1, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_USES_ECI, "Error 222: Encoded data includes ECI 13", -1 }, + /*147*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_INVALID_OPTION, "Warning 503: Invalid error correction level - using default instead", -1 }, + /*148*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, 13, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, + /*149*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, -1, ZINT_WARN_USES_ECI, "Warning 222: Encoded data includes ECI 13", -1 }, /* ECI warning trumps all other warnings */ + /*150*/ { BARCODE_AZTEC, 6, "ก", -1, UNICODE_MODE, -1, 0, 0, 0, 0, -1, -1, 0, -1, WARN_FAIL_ALL, ZINT_ERROR_INVALID_OPTION, "Error 503: Invalid error correction level - using default instead", -1 }, /* But not errors */ }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -243,6 +246,9 @@ static void test_checks(const testCtx *const p_ctx) { if (data[i].dot_size != -1) { symbol->dot_size = data[i].dot_size; } + if (data[i].text_gap) { + symbol->text_gap = data[i].text_gap; + } if (data[i].guard_descent != -1) { symbol->guard_descent = data[i].guard_descent; } diff --git a/backend/tests/test_output.c b/backend/tests/test_output.c index 2323caac..2cffdfea 100644 --- a/backend/tests/test_output.c +++ b/backend/tests/test_output.c @@ -48,23 +48,23 @@ static void test_check_colour_options(const testCtx *const p_ctx) { /* 0*/ { "FFFFFF", "000000", 0, "" }, /* 1*/ { "ffffff", "ffffff", 0, "" }, /* 2*/ { "77777777", "33333333", 0, "" }, - /* 3*/ { "FFFFF", "000000", ZINT_ERROR_INVALID_OPTION, "690: Malformed foreground RGB colour (6 or 8 characters only)" }, - /* 4*/ { "FFFFFFF", "000000", ZINT_ERROR_INVALID_OPTION, "690: Malformed foreground RGB colour (6 or 8 characters only)" }, - /* 5*/ { "FFFFFG", "000000", ZINT_ERROR_INVALID_OPTION, "691: Malformed foreground RGB colour 'FFFFFG' (hexadecimal only)" }, - /* 6*/ { "FFFFFF", "000000000", ZINT_ERROR_INVALID_OPTION, "690: Malformed background RGB colour (6 or 8 characters only)" }, - /* 7*/ { "FFFFFF", "0000000Z", ZINT_ERROR_INVALID_OPTION, "691: Malformed background RGB colour '0000000Z' (hexadecimal only)" }, + /* 3*/ { "FFFFF", "000000", ZINT_ERROR_INVALID_OPTION, "880: Malformed foreground RGB colour (6 or 8 characters only)" }, + /* 4*/ { "FFFFFFF", "000000", ZINT_ERROR_INVALID_OPTION, "880: Malformed foreground RGB colour (6 or 8 characters only)" }, + /* 5*/ { "FFFFFG", "000000", ZINT_ERROR_INVALID_OPTION, "881: Malformed foreground RGB colour 'FFFFFG' (hexadecimal only)" }, + /* 6*/ { "FFFFFF", "000000000", ZINT_ERROR_INVALID_OPTION, "880: Malformed background RGB colour (6 or 8 characters only)" }, + /* 7*/ { "FFFFFF", "0000000Z", ZINT_ERROR_INVALID_OPTION, "881: Malformed background RGB colour '0000000Z' (hexadecimal only)" }, /* 8*/ { "100,100,100,100", "0,1,2,3", 0, "" }, /* 9*/ { "100,,100,100", ",1,2,", 0, "" }, - /* 10*/ { "100,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "692: Malformed foreground CMYK colour (4 decimal numbers, comma-separated)" }, - /* 11*/ { "100,100,99,1001", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "693: Malformed foreground CMYK colour (3 digit maximum per number)" }, - /* 12*/ { "101,100,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "694: Malformed foreground CMYK colour C (decimal 0-100 only)" }, - /* 13*/ { "100,101,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "695: Malformed foreground CMYK colour M (decimal 0-100 only)" }, - /* 14*/ { "100,100,101,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "696: Malformed foreground CMYK colour Y (decimal 0-100 only)" }, - /* 15*/ { "100,100,100,101", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "697: Malformed foreground CMYK colour K (decimal 0-100 only)" }, - /* 16*/ { "100,100,100,100", "0,1,", ZINT_ERROR_INVALID_OPTION, "692: Malformed background CMYK colour (4 decimal numbers, comma-separated)" }, - /* 17*/ { "100,100,100,100", "0,0123,3,4", ZINT_ERROR_INVALID_OPTION, "693: Malformed background CMYK colour (3 digit maximum per number)" }, - /* 18*/ { "100,100,100,100", "0,1,2,101", ZINT_ERROR_INVALID_OPTION, "697: Malformed background CMYK colour K (decimal 0-100 only)" }, - /* 19*/ { "100,100,100,100", "0,1,2,3,", ZINT_ERROR_INVALID_OPTION, "692: Malformed background CMYK colour (4 decimal numbers, comma-separated)" }, + /* 10*/ { "100,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "882: Malformed foreground CMYK colour (4 decimal numbers, comma-separated)" }, + /* 11*/ { "100,100,99,1001", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "883: Malformed foreground CMYK colour (3 digit maximum per number)" }, + /* 12*/ { "101,100,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "884: Malformed foreground CMYK colour C (decimal 0-100 only)" }, + /* 13*/ { "100,101,100,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "885: Malformed foreground CMYK colour M (decimal 0-100 only)" }, + /* 14*/ { "100,100,101,100", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "886: Malformed foreground CMYK colour Y (decimal 0-100 only)" }, + /* 15*/ { "100,100,100,101", "0,1,2,3", ZINT_ERROR_INVALID_OPTION, "887: Malformed foreground CMYK colour K (decimal 0-100 only)" }, + /* 16*/ { "100,100,100,100", "0,1,", ZINT_ERROR_INVALID_OPTION, "882: Malformed background CMYK colour (4 decimal numbers, comma-separated)" }, + /* 17*/ { "100,100,100,100", "0,0123,3,4", ZINT_ERROR_INVALID_OPTION, "883: Malformed background CMYK colour (3 digit maximum per number)" }, + /* 18*/ { "100,100,100,100", "0,1,2,101", ZINT_ERROR_INVALID_OPTION, "887: Malformed background CMYK colour K (decimal 0-100 only)" }, + /* 19*/ { "100,100,100,100", "0,1,2,3,", ZINT_ERROR_INVALID_OPTION, "882: Malformed background CMYK colour (4 decimal numbers, comma-separated)" }, }; int data_size = ARRAY_SIZE(data); int i, ret; diff --git a/backend/tests/test_png.c b/backend/tests/test_png.c index 76786753..19c25cb6 100644 --- a/backend/tests/test_png.c +++ b/backend/tests/test_png.c @@ -136,6 +136,7 @@ static void test_print(const testCtx *const p_ctx) { struct zint_structapp structapp; char *fgcolour; char *bgcolour; + float text_gap; char *data; char *composite; int ret; @@ -143,66 +144,66 @@ static void test_print(const testCtx *const p_ctx) { char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "Égjpqy", "", 0, "code128_egrave_bold.png", "" }, - /* 1*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "Égjpqy", "", 0, "code128_egrave_bold_box3.png", "" }, - /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.png", "" }, - /* 3*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.png", "" }, - /* 4*/ { BARCODE_CODABLOCKF, -1, 3, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", "AAAAAAAAA", "", 0, "codablockf_3rows.png", "" }, - /* 5*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "AAAAAAAAA", "", 0, "codablockf_hvwsp2.png", "" }, - /* 6*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.png", "" }, - /* 7*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.png", "" }, - /* 8*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.png", "" }, - /* 9*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.png", "" }, - /* 10*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.png", "" }, - /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.png", "" }, - /* 12*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.png", "" }, - /* 13*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "614141234417+12345", "", 0, "upca_5addon.png", "" }, - /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, -1, -1, 0, 0, { 0, 0, "" }, "", "", "614141234417+12345", "", 0, "upca_5addon_notext.png", "" }, - /* 15*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "614141234417+12345", "", 0, "upca_5addon_bind3.png", "" }, - /* 16*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.png", "" }, - /* 17*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.png", "" }, - /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.png", "" }, - /* 19*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.png", "" }, - /* 20*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12", "", 0, "upce_2addon.png", "" }, - /* 21*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12345", "", 0, "upce_5addon.png", "" }, - /* 22*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12345", "", 0, "upce_5addon_small.png", "" }, - /* 23*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.png", "" }, - /* 24*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.png", "" }, - /* 25*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.png", "" }, - /* 26*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12", "", 0, "ean8_2addon.png", "" }, - /* 27*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "1234567+12345", "", 0, "ean8_5addon.png", "" }, - /* 28*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.png", "" }, - /* 29*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.png", "" }, - /* 30*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12345", "", 0, "ean5.png", "" }, - /* 31*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12", "", 0, "ean2.png", "" }, - /* 32*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "123", "", 0, "code39_small.png", "" }, - /* 33*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3.5, { 0, 0, "" }, "", "", "12345", "", 0, "postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" }, - /* 34*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "CFCECDCC", "12345", "", 0, "pdf417_bgalpha.png", "" }, - /* 35*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "30313233", "", "12345", "", 0, "pdf417_fgalpha.png", "" }, - /* 36*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "20212244", "CFCECDCC", "12345", "", 0, "pdf417_bgfgalpha.png", "" }, - /* 37*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF000033", "12345", "", 0, "ultra_bgfgalpha.png", "" }, - /* 38*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "FF000033", "12345", "", 0, "ultra_bgalpha.png", "" }, - /* 39*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF0000", "12345", "", 0, "ultra_fgalpha.png", "" }, - /* 40*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "", "12345", "", 0, "ultra_fgalpha_nobg.png", "" }, - /* 41*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12345", "", 0, "ultra_hvwsp1_box1.png", "" }, - /* 42*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", "12345", "", 0, "ultra_fgalpha_hvwsp1_box1.png", "" }, - /* 43*/ { BARCODE_ULTRA, -1, 1, BARCODE_BIND_TOP, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", "12345", "", 0, "ultra_fgalpha_hvwsp1_bindtop1.png", "" }, - /* 44*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", "1", "", 0, "ultra_odd.png", "" }, - /* 45*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.5.png", "6 dpmm, 150 dpi" }, - /* 46*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" }, - /* 47*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4, { 0, 0, "" }, "1111117F", "EEEEEEEE", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" }, - /* 48*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_2.1.png", "24 dpmm, 600 dpi" }, - /* 49*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_hvwsp1_box2.png", "" }, - /* 50*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.png", "" }, - /* 51*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", "1234", "", 0, "datamatrix_2.0_bind1_dotty.png", "" }, - /* 52*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", "1234", "", 0, "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" }, - /* 53*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "12345678909", "", 0, "dbar_ltd.png", "" }, - /* 54*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5.0, 0, { 0, 0, "" }, "", "", "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.png", "" }, - /* 55*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, 0, { 0, 0, "" }, "", "", "12345678901234567890", "", 0, "imail_height7.75.png", "" }, - /* 56*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 4, 7, "Z1.txt" }, "", "", "3456", "", 0, "aztec_z1_seq4of7.png", "" }, - /* 57*/ { BARCODE_PDF417, -1, -1, BARCODE_NO_QUIET_ZONES, -1, -1, -1, 5, 8, 16, 1.5, { 0, 0, "" }, "", "", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "", ZINT_WARN_NONCOMPLIANT, "pdf417_#204.png", "Ticket #204 Blank line in PDF417" }, - /* 58*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", "008182709980000020028101276", "", 0, "dpd_compliant.png", "Now with bind top 3X default" }, - /* 59*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "100,85,0,20", "FFFFFF00", "123", "", 0, "channel_cmyk_nobg.png", "" }, + /* 0*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold.png", "" }, + /* 1*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_box3.png", "" }, + /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.png", "" }, + /* 3*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", 0, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.png", "" }, + /* 4*/ { BARCODE_CODABLOCKF, -1, 3, -1, -1, -1, -1, 3, -1, 0, 0, { 0, 0, "" }, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_3rows.png", "" }, + /* 5*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2.png", "" }, + /* 6*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.png", "" }, + /* 7*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.png", "" }, + /* 8*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.png", "" }, + /* 9*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.png", "" }, + /* 10*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.png", "" }, + /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.png", "" }, + /* 12*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.png", "" }, + /* 13*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "614141234417+12345", "", 0, "upca_5addon.png", "" }, + /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, 0, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_notext.png", "" }, + /* 15*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_bind3.png", "" }, + /* 16*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.png", "" }, + /* 17*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.png", "" }, + /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.png", "" }, + /* 19*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.png", "" }, + /* 20*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12", "", 0, "upce_2addon.png", "" }, + /* 21*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12345", "", 0, "upce_5addon.png", "" }, + /* 22*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12345", "", 0, "upce_5addon_small.png", "" }, + /* 23*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.png", "" }, + /* 24*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.png", "" }, + /* 25*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.png", "" }, + /* 26*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12", "", 0, "ean8_2addon.png", "" }, + /* 27*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "1234567+12345", "", 0, "ean8_5addon.png", "" }, + /* 28*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.png", "" }, + /* 29*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.png", "" }, + /* 30*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345", "", 0, "ean5.png", "" }, + /* 31*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12", "", 0, "ean2.png", "" }, + /* 32*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "123", "", 0, "code39_small.png", "" }, + /* 33*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, 3.5, { 0, 0, "" }, "", "", 0, "12345", "", 0, "postnet_zip.png", "300 dpi, using 1/43in X, 300 / 43 / 2 = ~3.5 scale" }, + /* 34*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "CFCECDCC", 0, "12345", "", 0, "pdf417_bgalpha.png", "" }, + /* 35*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "30313233", "", 0, "12345", "", 0, "pdf417_fgalpha.png", "" }, + /* 36*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "20212244", "CFCECDCC", 0, "12345", "", 0, "pdf417_bgfgalpha.png", "" }, + /* 37*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF000033", 0, "12345", "", 0, "ultra_bgfgalpha.png", "" }, + /* 38*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "FF000033", 0, "12345", "", 0, "ultra_bgalpha.png", "" }, + /* 39*/ { BARCODE_ULTRA, -1, -1, -1, 2, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "FF0000", 0, "12345", "", 0, "ultra_fgalpha.png", "" }, + /* 40*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "0000007F", "", 0, "12345", "", 0, "ultra_fgalpha_nobg.png", "" }, + /* 41*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345", "", 0, "ultra_hvwsp1_box1.png", "" }, + /* 42*/ { BARCODE_ULTRA, -1, 1, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", 0, "12345", "", 0, "ultra_fgalpha_hvwsp1_box1.png", "" }, + /* 43*/ { BARCODE_ULTRA, -1, 1, BARCODE_BIND_TOP, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "00FF007F", "BABDB6", 0, "12345", "", 0, "ultra_fgalpha_hvwsp1_bindtop1.png", "" }, + /* 44*/ { BARCODE_ULTRA, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", 0, "1", "", 0, "ultra_odd.png", "" }, + /* 45*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0.5, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.5.png", "6 dpmm, 150 dpi" }, + /* 46*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BOX, 3, -1, -1, -1, -1, 0, 0.7, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_0.7_wsp3_box1.png", "8 dpmm, 200 dpi" }, + /* 47*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1.4, { 0, 0, "" }, "1111117F", "EEEEEEEE", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_1.4_bgfgalpha.png", "16 dpmm, 400 dpi" }, + /* 48*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, 2.1, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_2.1.png", "24 dpmm, 600 dpi" }, + /* 49*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, 1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_hvwsp1_box2.png", "" }, + /* 50*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.png", "" }, + /* 51*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, -1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", 0, "1234", "", 0, "datamatrix_2.0_bind1_dotty.png", "" }, + /* 52*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, 2.0f, { 0, 0, "" }, "", "", 0, "1234", "", 0, "datamatrix_2.0_hvwsp1_bind1_dotty.png", "" }, + /* 53*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "12345678909", "", 0, "dbar_ltd.png", "" }, + /* 54*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5.0, 0, { 0, 0, "" }, "", "", 0, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.png", "" }, + /* 55*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, 0, { 0, 0, "" }, "", "", 0, "12345678901234567890", "", 0, "imail_height7.75.png", "" }, + /* 56*/ { BARCODE_AZTEC, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, { 4, 7, "Z1.txt" }, "", "", 0, "3456", "", 0, "aztec_z1_seq4of7.png", "" }, + /* 57*/ { BARCODE_PDF417, -1, -1, BARCODE_NO_QUIET_ZONES, -1, -1, -1, 5, 8, 16, 1.5, { 0, 0, "" }, "", "", 0, "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "", ZINT_WARN_NONCOMPLIANT, "pdf417_#204.png", "Ticket #204 Blank line in PDF417" }, + /* 58*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "", "", 0, "008182709980000020028101276", "", 0, "dpd_compliant.png", "Now with bind top 3X default" }, + /* 59*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 0, 0, { 0, 0, "" }, "100,85,0,20", "FFFFFF00", 0, "123", "", 0, "channel_cmyk_nobg.png", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -264,6 +265,8 @@ static void test_print(const testCtx *const p_ctx) { if (*data[i].bgcolour) { strcpy(symbol->bgcolour, data[i].bgcolour); } + symbol->text_gap = data[i].text_gap; + if (strlen(data[i].composite)) { text = data[i].composite; strcpy(symbol->primary, data[i].data); diff --git a/backend/tests/test_postal.c b/backend/tests/test_postal.c index b3d218f5..c46add4d 100644 --- a/backend/tests/test_postal.c +++ b/backend/tests/test_postal.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -74,8 +74,8 @@ static void test_large(const testCtx *const p_ctx) { /* 23*/ { BARCODE_PLANET, "1", 39, ZINT_ERROR_TOO_LONG, -1, -1 }, /* 24*/ { BARCODE_KIX, "1", 18, 0, 3, 143 }, /* 25*/ { BARCODE_KIX, "1", 19, ZINT_ERROR_TOO_LONG, -1, -1 }, - /* 26*/ { BARCODE_DAFT, "D", 100, 0, 3, 199 }, - /* 27*/ { BARCODE_DAFT, "D", 101, ZINT_ERROR_TOO_LONG, -1, -1 }, + /* 26*/ { BARCODE_DAFT, "D", 250, 0, 3, 499 }, + /* 27*/ { BARCODE_DAFT, "D", 251, ZINT_ERROR_TOO_LONG, -1, -1 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_raster.c b/backend/tests/test_raster.c index 6cbab5c9..163c524e 100644 --- a/backend/tests/test_raster.c +++ b/backend/tests/test_raster.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -1237,7 +1237,6 @@ static void test_scale(const testCtx *const p_ctx) { symbol = ZBarcode_Create(); assert_nonnull(symbol, "Symbol not created\n"); - testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug); if (data[i].border_width != -1) { symbol->border_width = data[i].border_width; } @@ -1253,7 +1252,7 @@ static void test_scale(const testCtx *const p_ctx) { } else { text = data[i].data; } - length = (int) strlen(text); + length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, data[i].output_options, text, -1, debug); ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); assert_nonzero(ret < ZINT_ERROR, "i:%d ZBarcode_Encode(%d) ret %d >= ZINT_ERROR (%s)\n", i, data[i].symbology, ret, symbol->errtxt); @@ -1788,6 +1787,161 @@ static void test_quiet_zones(const testCtx *const p_ctx) { testFinish(); } +static void test_text_gap(const testCtx *const p_ctx) { + int debug = p_ctx->debug; + + struct item { + int symbology; + int output_options; + int option_2; + int show_hrt; + float text_gap; + float scale; + char *data; + char *composite; + + int ret; + float expected_height; + int expected_rows; + int expected_width; + int expected_bitmap_width; + int expected_bitmap_height; + + int expected_set; + int expected_set_row; + int expected_set_rows; /* Last row no. + 1 */ + int expected_set_col; + int expected_set_len; + }; + /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ + struct item data[] = { + /* 0*/ { BARCODE_CODE11, -1, -1, -1, 0, 0, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 104, 105, 55, 6 }, /* Default */ + /* 1*/ { BARCODE_CODE11, -1, -1, -1, 0, 0, "1234", "", 0, 50, 1, 62, 124, 116, 0 /*set*/, 103, 104, 0, 124 }, /* Default */ + /* 2*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 0, "1234", "", 0, 50, 1, 62, 124, 114, 1 /*set*/, 102, 103, 55, 6 }, + /* 3*/ { BARCODE_CODE11, -1, -1, -1, 0.4, 0, "1234", "", 0, 50, 1, 62, 124, 114, 1 /*set*/, 102, 103, 55, 6 }, + /* 4*/ { BARCODE_CODE11, -1, -1, -1, 0.5, 0, "1234", "", 0, 50, 1, 62, 124, 115, 1 /*set*/, 103, 104, 55, 6 }, + /* 5*/ { BARCODE_CODE11, -1, -1, -1, 0.5, 0, "1234", "", 0, 50, 1, 62, 124, 115, 0 /*set*/, 102, 103, 0, 124 }, + /* 6*/ { BARCODE_CODE11, -1, -1, -1, 0.6, 0, "1234", "", 0, 50, 1, 62, 124, 115, 1 /*set*/, 103, 104, 55, 6 }, + /* 7*/ { BARCODE_CODE11, -1, -1, -1, 1.0, 0, "1234", "", 0, 50, 1, 62, 124, 116, 1 /*set*/, 104, 105, 55, 6 }, /* Same as default */ + /* 8*/ { BARCODE_CODE11, -1, -1, -1, 1.0, 0, "1234", "", 0, 50, 1, 62, 124, 116, 0 /*set*/, 103, 104, 0, 124 }, /* Same as default */ + /* 9*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 0, "1234", "", 0, 50, 1, 62, 124, 117, 1 /*set*/, 105, 106, 55, 6 }, + /* 10*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 0, "1234", "", 0, 50, 1, 62, 124, 117, 0 /*set*/, 104, 105, 0, 124 }, + /* 11*/ { BARCODE_CODE11, -1, -1, -1, 2.0, 0, "1234", "", 0, 50, 1, 62, 124, 118, 1 /*set*/, 106, 107, 55, 6 }, + /* 12*/ { BARCODE_CODE11, -1, -1, -1, 2.0, 0, "1234", "", 0, 50, 1, 62, 124, 118, 0 /*set*/, 105, 106, 0, 124 }, + /* 13*/ { BARCODE_CODE11, -1, -1, -1, 3.0, 0, "1234", "", 0, 50, 1, 62, 124, 120, 1 /*set*/, 108, 109, 55, 6 }, + /* 14*/ { BARCODE_CODE11, -1, -1, -1, 3.0, 0, "1234", "", 0, 50, 1, 62, 124, 120, 0 /*set*/, 107, 108, 0, 124 }, + /* 15*/ { BARCODE_CODE11, -1, -1, -1, 4.0, 0, "1234", "", 0, 50, 1, 62, 124, 122, 1 /*set*/, 110, 111, 55, 6 }, + /* 16*/ { BARCODE_CODE11, -1, -1, -1, 4.0, 0, "1234", "", 0, 50, 1, 62, 124, 122, 0 /*set*/, 109, 110, 0, 124 }, + /* 17*/ { BARCODE_CODE11, -1, -1, -1, 5.0, 0, "1234", "", 0, 50, 1, 62, 124, 124, 1 /*set*/, 112, 113, 55, 6 }, + /* 18*/ { BARCODE_CODE11, -1, -1, -1, 5.0, 0, "1234", "", 0, 50, 1, 62, 124, 124, 0 /*set*/, 111, 112, 0, 124 }, + /* 19*/ { BARCODE_CODE11, -1, -1, -1, 0, 3.0, "1234", "", 0, 50, 1, 62, 372, 348, 1 /*set*/, 312, 315, 165, 18 }, /* Scale default */ + /* 20*/ { BARCODE_CODE11, -1, -1, -1, 0, 3.0, "1234", "", 0, 50, 1, 62, 372, 348, 0 /*set*/, 311, 312, 0, 372 }, /* Scale default */ + /* 21*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 3.0, "1234", "", 0, 50, 1, 62, 372, 351, 1 /*set*/, 315, 318, 165, 18 }, /* Scale */ + /* 22*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 3.0, "1234", "", 0, 50, 1, 62, 372, 351, 0 /*set*/, 314, 315, 0, 372 }, /* Scale */ + /* 23*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 1 /*set*/, 102, 104, 81, 9 }, /* Default */ + /* 24*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 0 /*set*/, 101, 102, 38, 72 }, /* Default */ + /* 25*/ { BARCODE_UPCA, -1, -1, -1, 0.5, 0, "01457130763", "", 0, 50, 1, 95, 226, 115, 1 /*set*/, 101, 103, 81, 9 }, + /* 26*/ { BARCODE_UPCA, -1, -1, -1, 0.75, 0, "01457130763", "", 0, 50, 1, 95, 226, 115, 1 /*set*/, 101, 103, 81, 9 }, + /* 27*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 1 /*set*/, 102, 104, 81, 9 }, /* Same as default */ + /* 28*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116, 0 /*set*/, 101, 102, 38, 72 }, /* Same as default */ + /* 29*/ { BARCODE_UPCA, -1, -1, -1, 2.0, 0, "01457130763", "", 0, 50, 1, 95, 226, 118, 1 /*set*/, 104, 106, 81, 9 }, + /* 30*/ { BARCODE_UPCA, -1, -1, -1, 2.0, 2.5, "01457130763", "", 0, 50, 1, 95, 565, 295, 1 /*set*/, 260, 265, 201, 22 }, /* Scale */ + /* 31*/ { BARCODE_UPCA, -1, -1, -1, 2.0, 2.5, "01457130763", "", 0, 50, 1, 95, 565, 295, 0 /*set*/, 259, 260, 95, 180 }, /* Scale */ + /* 32*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 0 /*set*/, 14, 16, 208, 68 }, /* Default */ + /* 33*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 1 /*set*/, 16, 100, 244, 4 }, /* Default */ + /* 34*/ { BARCODE_UPCA, -1, -1, -1, 0.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 115, 0 /*set*/, 14, 15, 208, 68 }, + /* 35*/ { BARCODE_UPCA, -1, -1, -1, 0.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 115, 1 /*set*/, 16, 100, 244, 4 }, + /* 36*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 0 /*set*/, 14, 16, 208, 68 }, /* Same as default */ + /* 37*/ { BARCODE_UPCA, -1, -1, -1, 1.0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116, 1 /*set*/, 16, 100, 244, 4 }, /* Same as default */ + /* 38*/ { BARCODE_UPCA, -1, -1, -1, 1.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117, 0 /*set*/, 14, 17, 208, 68 }, + /* 39*/ { BARCODE_UPCA, -1, -1, -1, 1.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117, 1 /*set*/, 17, 100, 244, 4 }, + /* 40*/ { BARCODE_UPCA, -1, -1, -1, 2.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 119, 0 /*set*/, 14, 19, 208, 68 }, + /* 41*/ { BARCODE_UPCA, -1, -1, -1, 2.5, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 119, 1 /*set*/, 19, 100, 244, 4 }, + /* 42*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 116, 0 /*set*/, 38, 40, 214, 70 }, /* Default */ + /* 43*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 116, 1 /*set*/, 40, 100, 250, 4 }, /* Default */ + /* 44*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 116, 0 /*set*/, 38, 40, 214, 70 }, /* Same as default */ + /* 45*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 116, 1 /*set*/, 40, 100, 250, 4 }, + /* 46*/ { BARCODE_UPCA_CC, -1, -1, -1, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 120, 0 /*set*/, 38, 44, 214, 70 }, + /* 47*/ { BARCODE_UPCA_CC, -1, -1, -1, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 120, 1 /*set*/, 44, 100, 250, 4 }, + /* 48*/ { BARCODE_UPCA_CC, -1, -1, 0, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 110, 0 /*set*/, 38, 40, 214, 70 }, /* Hide text default */ + /* 49*/ { BARCODE_UPCA_CC, -1, -1, 0, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 110, 1 /*set*/, 40, 100, 250, 4 }, /* Hide text default */ + /* 50*/ { BARCODE_UPCA_CC, -1, -1, 0, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 110, 0 /*set*/, 38, 44, 214, 70 }, /* Hide text */ + /* 51*/ { BARCODE_UPCA_CC, -1, -1, 0, 3.0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 110, 1 /*set*/, 44, 100, 250, 4 }, /* Hide text */ + }; + int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol; + + const char *text; + + testStart("test_text_gap"); + + for (i = 0; i < data_size; i++) { + int row, column; + + if (testContinue(p_ctx, i)) continue; + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + if (data[i].show_hrt != -1) { + symbol->show_hrt = data[i].show_hrt; + } + symbol->text_gap = data[i].text_gap; + if (data[i].scale != 0.0f) { + symbol->scale = data[i].scale; + } + + if (strlen(data[i].composite)) { + text = data[i].composite; + strcpy(symbol->primary, data[i].data); + } else { + text = data[i].data; + } + length = testUtilSetSymbol(symbol, data[i].symbology, UNICODE_MODE, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, data[i].output_options, text, -1, debug); + + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); + assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 (%s)\n", i, data[i].symbology, ret, symbol->errtxt); + + ret = ZBarcode_Buffer(symbol, 0); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Buffer(%d) ret %d != %d (%s)\n", i, data[i].symbology, ret, data[i].ret, symbol->errtxt); + assert_nonnull(symbol->bitmap, "i:%d (%d) symbol->bitmap NULL\n", i, data[i].symbology); + + if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) testUtilBitmapPrint(symbol, NULL, NULL); /* ZINT_DEBUG_TEST_PRINT 16 */ + + assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %.8g != %.8g\n", i, data[i].symbology, symbol->height, data[i].expected_height); + assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, data[i].symbology, symbol->rows, data[i].expected_rows); + assert_equal(symbol->width, data[i].expected_width, "i:%d (%d) symbol->width %d != %d\n", i, data[i].symbology, symbol->width, data[i].expected_width); + assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%d) symbol->bitmap_width %d != %d\n", i, data[i].symbology, symbol->bitmap_width, data[i].expected_bitmap_width); + assert_equal(symbol->bitmap_height, data[i].expected_bitmap_height, "i:%d (%d) symbol->bitmap_height %d != %d\n", i, data[i].symbology, symbol->bitmap_height, data[i].expected_bitmap_height); + + ret = ZBarcode_Print(symbol, 0); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Print(%d) ret %d != %d (%s)\n", i, data[i].symbology, ret, data[i].ret, symbol->errtxt); + assert_zero(remove(symbol->outfile), "i:%d remove(%s) != 0\n", i, symbol->outfile); + + assert_nonzero(symbol->bitmap_height >= data[i].expected_set_rows, "i:%d (%d) symbol->bitmap_height %d < expected_set_rows %d\n", + i, data[i].symbology, symbol->bitmap_height, data[i].expected_set_rows); + assert_nonzero(data[i].expected_set_rows > data[i].expected_set_row, "i:%d (%d) expected_set_rows %d < expected_set_row %d\n", + i, data[i].symbology, data[i].expected_set_rows, data[i].expected_set_row); + for (row = data[i].expected_set_row; row < data[i].expected_set_rows; row++) { + int bits_set = 0; + for (column = data[i].expected_set_col; column < data[i].expected_set_col + data[i].expected_set_len; column++) { + if (is_row_column_black(symbol, row, column)) { + bits_set++; + } + } + if (data[i].expected_set) { + assert_equal(bits_set, data[i].expected_set_len, "i:%d (%d) row %d bits_set %d != expected_set_len %d\n", i, data[i].symbology, row, bits_set, data[i].expected_set_len); + } else { + assert_zero(bits_set, "i:%d (%d) row %d bits_set %d != 0\n", i, data[i].symbology, row, bits_set); + } + } + ZBarcode_Delete(symbol); + } + + testFinish(); +} + static void test_buffer_plot(const testCtx *const p_ctx) { int debug = p_ctx->debug; @@ -1812,96 +1966,96 @@ static void test_buffer_plot(const testCtx *const p_ctx) { }; struct item data[] = { /* 0*/ { BARCODE_PDF417, 0, 1, -1, -1, 15, "", "", "1", 0, 16, 4, 86, 86, 16, - "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" - "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" - "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" - "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" - "11111111010101000111110101011000001111000001000101011111101010111000111111101000101001" - "11111111010101000111110101011000001111000001000101011111101010111000111111101000101001" - "11111111010101000111110101011000001111000001000101011111101010111000111111101000101001" - "11111111010101000111110101011000001111000001000101011111101010111000111111101000101001" - "11111111010101000110101011111000001111011111101011011010101111100000111111101000101001" - "11111111010101000110101011111000001111011111101011011010101111100000111111101000101001" - "11111111010101000110101011111000001111011111101011011010101111100000111111101000101001" - "11111111010101000110101011111000001111011111101011011010101111100000111111101000101001" - "11111111010101000101011110011110001010000010001000011010111101111100111111101000101001" - "11111111010101000101011110011110001010000010001000011010111101111100111111101000101001" - "11111111010101000101011110011110001010000010001000011010111101111100111111101000101001" - "11111111010101000101011110011110001010000010001000011010111101111100111111101000101001" - }, + "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" + "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" + "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" + "11111111010101000111101010111100001111101010111110011101010111000000111111101000101001" + "11111111010101000111110101011000001111000001000101011111101010111000111111101000101001" + "11111111010101000111110101011000001111000001000101011111101010111000111111101000101001" + "11111111010101000111110101011000001111000001000101011111101010111000111111101000101001" + "11111111010101000111110101011000001111000001000101011111101010111000111111101000101001" + "11111111010101000110101011111000001111011111101011011010101111100000111111101000101001" + "11111111010101000110101011111000001111011111101011011010101111100000111111101000101001" + "11111111010101000110101011111000001111011111101011011010101111100000111111101000101001" + "11111111010101000110101011111000001111011111101011011010101111100000111111101000101001" + "11111111010101000101011110011110001010000010001000011010111101111100111111101000101001" + "11111111010101000101011110011110001010000010001000011010111101111100111111101000101001" + "11111111010101000101011110011110001010000010001000011010111101111100111111101000101001" + "11111111010101000101011110011110001010000010001000011010111101111100111111101000101001" + }, /* 1*/ { BARCODE_PDF417, 0, 1, -1, -1, 15, "FF0000", "00FF0099", "1", 0, 16, 4, 86, 86, 16, - "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRRRGRGRGRRRRRGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRRRGRGRGRRRRRGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRRRGRGRGRRRRRGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRRRGRGRGRRRRRGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRRRRGRGRGRRGGGGGRRRRGGGGGRGGGRGRGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRRRRGRGRGRRGGGGGRRRRGGGGGRGGGRGRGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRRRRGRGRGRRGGGGGRRRRGGGGGRGGGRGRGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRRRRGRGRGRRGGGGGRRRRGGGGGRGGGRGRGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRGRRRRRRGRGRRGRRGRGRGRRRRRGGGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRGRRRRRRGRGRRGRRGRGRGRRRRRGGGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRGRRRRRRGRGRRGRRGRGRGRRRRRGGGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRGRRRRRRGRGRRGRRGRGRGRRRRRGGGGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRGRGGGGGRGGGRGGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRGRGGGGGRGGGRGGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRGRGGGGGRGGGRGGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR" - "RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRGRGGGGGRGGGRGGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR" - }, + "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRRRGRGRGRRRRRGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRRRGRGRGRRRRRGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRRRGRGRGRRRRRGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRRRGRGRGRRRRGGGGRRRRRGRGRGRRRRRGGRRRGRGRGRRRGGGGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRRRRGRGRGRRGGGGGRRRRGGGGGRGGGRGRGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRRRRGRGRGRRGGGGGRRRRGGGGGRGGGRGRGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRRRRGRGRGRRGGGGGRRRRGGGGGRGGGRGRGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRRRRGRGRGRRGGGGGRRRRGGGGGRGGGRGRGRRRRRRGRGRGRRRGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRGRRRRRRGRGRRGRRGRGRGRRRRRGGGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRGRRRRRRGRGRRGRRGRGRGRRRRRGGGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRGRRRRRRGRGRRGRRGRGRGRRRRRGGGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRRGRGRGRRRRRGGGGGRRRRGRRRRRRGRGRRGRRGRGRGRRRRRGGGGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRGRGGGGGRGGGRGGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRGRGGGGGRGGGRGGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRGRGGGGGRGGGRGGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR" + "RRRRRRRRGRGRGRGGGRGRGRRRRGGRRRRGGGRGRGGGGGRGGGRGGGGRRGRGRRRRGRRRRRGGRRRRRRRGRGGGRGRGGR" + }, /* 2*/ { BARCODE_PDF417, 0, 1, 1, -1, 15, "FFFF0033", "00FF00", "1", 0, 16, 4, 86, 88, 16, - "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYYYGYGYGYYYYYGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYYYGYGYGYYYYYGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYYYGYGYGYYYYYGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYYYGYGYGYYYYYGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYYYYGYGYGYYGGGGGYYYYGGGGGYGGGYGYGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYYYYGYGYGYYGGGGGYYYYGGGGGYGGGYGYGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYYYYGYGYGYYGGGGGYYYYGGGGGYGGGYGYGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYYYYGYGYGYYGGGGGYYYYGGGGGYGGGYGYGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYGYYYYYYGYGYYGYYGYGYGYYYYYGGGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYGYYYYYYGYGYYGYYGYGYGYYYYYGGGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYGYYYYYYGYGYYGYYGYGYGYYYYYGGGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYGYYYYYYGYGYYGYYGYGYGYYYYYGGGGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYGYGGGGGYGGGYGGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYGYGGGGGYGGGYGGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYGYGGGGGYGGGYGGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG" - "GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYGYGGGGGYGGGYGGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG" - }, + "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYYYGYGYGYYYYYGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYYYGYGYGYYYYYGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYYYGYGYGYYYYYGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYYYGYGYGYYYYGGGGYYYYYGYGYGYYYYYGGYYYGYGYGYYYGGGGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYYYYGYGYGYYGGGGGYYYYGGGGGYGGGYGYGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYYYYGYGYGYYGGGGGYYYYGGGGGYGGGYGYGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYYYYGYGYGYYGGGGGYYYYGGGGGYGGGYGYGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYYYYGYGYGYYGGGGGYYYYGGGGGYGGGYGYGYYYYYYGYGYGYYYGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYGYYYYYYGYGYYGYYGYGYGYYYYYGGGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYGYYYYYYGYGYYGYYGYGYGYYYYYGGGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYGYYYYYYGYGYYGYYGYGYGYYYYYGGGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYYGYGYGYYYYYGGGGGYYYYGYYYYYYGYGYYGYYGYGYGYYYYYGGGGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYGYGGGGGYGGGYGGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYGYGGGGGYGGGYGGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYGYGGGGGYGGGYGGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG" + "GYYYYYYYYGYGYGYGGGYGYGYYYYGGYYYYGGGYGYGGGGGYGGGYGGGGYYGYGYYYYGYYYYYGGYYYYYYYGYGGGYGYGGYG" + }, /* 3*/ { BARCODE_ULTRA, -1, -1, -1, -1, 13, "FF00007F", "00FF0000", "1", 0, 13, 13, 13, 13, 13, - "1111111111111" - "10Y10GYCGYYC1" - "11C10MGYCGGG1" - "10G10GYCMCYC1" - "11Y10YMMGYGY1" - "10M10CGGCMYM1" - "1101010101011" - "10G10CYMGCCC1" - "11C10MCGCMMM1" - "10Y10CGCGYCY1" - "11M10GMMMMGC1" - "10C10MYYYGMY1" - "1111111111111" - }, + "1111111111111" + "10Y10GYCGYYC1" + "11C10MGYCGGG1" + "10G10GYCMCYC1" + "11Y10YMMGYGY1" + "10M10CGGCMYM1" + "1101010101011" + "10G10CYMGCCC1" + "11C10MCGCMMM1" + "10Y10CGCGYCY1" + "11M10GMMMMGC1" + "10C10MYYYGMY1" + "1111111111111" + }, /* 4*/ { BARCODE_ULTRA, -1, -1, 1, -1, 13, "", "00FF0000", "1", 0, 13, 13, 13, 15, 13, - "G1111111111111G" - "G10Y10GYCGYYC1G" - "G11C10MGYCGGG1G" - "G10G10GYCMCYC1G" - "G11Y10YMMGYGY1G" - "G10M10CGGCMYM1G" - "G1101010101011G" - "G10G10CYMGCCC1G" - "G11C10MCGCMMM1G" - "G10Y10CGCGYCY1G" - "G11M10GMMMMGC1G" - "G10C10MYYYGMY1G" - "G1111111111111G" - }, + "G1111111111111G" + "G10Y10GYCGYYC1G" + "G11C10MGYCGGG1G" + "G10G10GYCMCYC1G" + "G11Y10YMMGYGY1G" + "G10M10CGGCMYM1G" + "G1101010101011G" + "G10G10CYMGCCC1G" + "G11C10MCGCMMM1G" + "G10Y10CGCGYCY1G" + "G11M10GMMMMGC1G" + "G10C10MYYYGMY1G" + "G1111111111111G" + }, /* 5*/ { BARCODE_CHANNEL, -1, -1, 1, -1, 5, "30313233", "CFCECDCC", "1", 0, 5, 1, 19, 21, 5, - "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" - "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" - "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" - "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" - "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" - }, + "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" + "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" + "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" + "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" + "CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132CFCECD303132303132CFCECD303132303132CFCECDCFCECDCFCECD303132CFCECD" + }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1957,9 +2111,9 @@ static void test_buffer_plot(const testCtx *const p_ctx) { assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); assert_equal(symbol->bitmap_width, data[i].expected_bitmap_width, "i:%d (%s) symbol->bitmap_width %d != %d\n", - i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_width, data[i].expected_bitmap_width); + 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); + i, testUtilBarcodeName(data[i].symbology), symbol->bitmap_height, data[i].expected_bitmap_height); ret = testUtilBitmapCmp(symbol, data[i].expected_bitmap, &row, &column); assert_zero(ret, "i:%d (%s) testUtilBitmapCmp ret %d != 0 column %d row %d (%s)\n", i, testUtilBarcodeName(data[i].symbology), ret, column, row, data[i].data); @@ -2979,6 +3133,7 @@ int main(int argc, char *argv[]) { { "test_scale", test_scale, }, { "test_guard_descent", test_guard_descent, }, { "test_quiet_zones", test_quiet_zones, }, + { "test_text_gap", test_text_gap, }, { "test_buffer_plot", test_buffer_plot, }, { "test_height", test_height, }, { "test_height_per_row", test_height_per_row, }, diff --git a/backend/tests/test_svg.c b/backend/tests/test_svg.c index fd43fac9..4874a663 100644 --- a/backend/tests/test_svg.c +++ b/backend/tests/test_svg.c @@ -54,62 +54,63 @@ static void test_print(const testCtx *const p_ctx) { char *composite; int ret; char *expected_file; + char *comment; }; struct item data[] = { - /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "<>\"&'", "", 0, "code128_amperands.svg" }, - /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold.svg" }, - /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_box3.svg" }, - /* 3*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.svg" }, - /* 4*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, 3, 3, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp3.svg" }, - /* 5*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, -1, 0, "", "", 0, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.svg" }, - /* 6*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, -1, -1, 3, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_3rows.svg" }, - /* 7*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, 3, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2.svg" }, - /* 8*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.svg" }, - /* 9*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.svg" }, - /* 10*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.svg" }, - /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.svg" }, - /* 12*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.svg" }, - /* 13*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.svg" }, - /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.svg" }, - /* 15*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon.svg" }, - /* 16*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_bind3.svg" }, - /* 17*/ { BARCODE_UPCA, -1, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_small_bold.svg" }, - /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.svg" }, - /* 19*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.svg" }, - /* 20*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.svg" }, - /* 21*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.svg" }, - /* 22*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "upce_2addon.svg" }, - /* 23*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon.svg" }, - /* 24*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon_small.svg" }, - /* 25*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon_notext.svg" }, - /* 26*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.svg" }, - /* 27*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "FF0000EE", "0000FF11", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_fgbgalpha.svg" }, - /* 28*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "FFFFFF00", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_nobg.svg" }, - /* 29*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 270, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_rotate_270.svg" }, - /* 30*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.svg" }, - /* 31*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.svg" }, - /* 32*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "ean8_2addon.svg" }, - /* 33*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "ean8_5addon.svg" }, - /* 34*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.svg" }, - /* 35*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.svg" }, - /* 36*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5.svg" }, - /* 37*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12", "", 0, "ean2.svg" }, - /* 38*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "123", "", 0, "code39_small.svg" }, - /* 39*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "postnet_zip.svg" }, - /* 40*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_box2.svg" }, - /* 41*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.svg" }, - /* 42*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "121212DD", "EEEEEE22", 90, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_fgbg_rotate_90.svg" }, - /* 43*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_vwsp1_bind1_dotty.svg" }, - /* 44*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_hvwsp1_bind1_dotty.svg" }, - /* 45*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345678909", "", 0, "dbar_ltd.svg" }, - /* 46*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, "", "", 0, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.svg" }, - /* 47*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, "", "", 0, "12345678901234567890", "", 0, "imail_height7.75.svg" }, - /* 48*/ { BARCODE_ULTRA, -1, 3, BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "FF0000", "0000FF", 0, "12345678901234567890", "", 0, "ultra_fgbg_hvwsp2_box3.svg" }, - /* 49*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0.4, "", "", 180, "A", "", 0, "telepen_height0.4_rotate_180.svg" }, - /* 50*/ { BARCODE_CODE49, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "FF11157F", "", 0, "A", "", 0, "code49_comph_fgalpha.svg" }, - /* 51*/ { BARCODE_CODABLOCKF, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 2, 0, "00000033", "FFFFFF66", 0, "1234567890123456789012345678901234", "", 0, "codablockf_comph_sep2_fgbgalpha.svg" }, - /* 52*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "008182709980000020028101276", "", 0, "dpd_compliant.svg" }, - /* 53*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "100,85,0,20", "FFFFFF00", 0, "123", "", 0, "channel_cmyk_nobg.svg" }, + /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "<>\"&'", "", 0, "code128_amperands.svg", "" }, + /* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold.svg", "" }, + /* 2*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_box3.svg", "" }, + /* 3*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.svg", "" }, + /* 4*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, 3, 3, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp3.svg", "" }, + /* 5*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, -1, 0, "", "", 0, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.svg", "" }, + /* 6*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, -1, -1, 3, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_3rows.svg", "" }, + /* 7*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, 3, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2.svg", "" }, + /* 8*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.svg", "" }, + /* 9*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.svg", "" }, + /* 10*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.svg", "" }, + /* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.svg", "" }, + /* 12*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.svg", "" }, + /* 13*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.svg", "" }, + /* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.svg", "" }, + /* 15*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon.svg", "" }, + /* 16*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_bind3.svg", "" }, + /* 17*/ { BARCODE_UPCA, -1, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_small_bold.svg", "Note BOLD_TEXT ignored for UPC/EAN" }, + /* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.svg", "" }, + /* 19*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.svg", "" }, + /* 20*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.svg", "" }, + /* 21*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.svg", "" }, + /* 22*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "upce_2addon.svg", "" }, + /* 23*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon.svg", "" }, + /* 24*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon_small.svg", "" }, + /* 25*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon_notext.svg", "" }, + /* 26*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.svg", "" }, + /* 27*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "FF0000EE", "0000FF11", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_fgbgalpha.svg", "" }, + /* 28*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "FFFFFF00", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_nobg.svg", "" }, + /* 29*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 270, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_rotate_270.svg", "" }, + /* 30*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.svg", "" }, + /* 31*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.svg", "" }, + /* 32*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "ean8_2addon.svg", "" }, + /* 33*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "ean8_5addon.svg", "" }, + /* 34*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.svg", "" }, + /* 35*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.svg", "" }, + /* 36*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5.svg", "" }, + /* 37*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12", "", 0, "ean2.svg", "" }, + /* 38*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "123", "", 0, "code39_small.svg", "" }, + /* 39*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "postnet_zip.svg", "" }, + /* 40*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_box2.svg", "" }, + /* 41*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.svg", "" }, + /* 42*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "121212DD", "EEEEEE22", 90, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_fgbg_rotate_90.svg", "" }, + /* 43*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_vwsp1_bind1_dotty.svg", "" }, + /* 44*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_hvwsp1_bind1_dotty.svg", "" }, + /* 45*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345678909", "", 0, "dbar_ltd.svg", "" }, + /* 46*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, "", "", 0, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.svg", "" }, + /* 47*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, "", "", 0, "12345678901234567890", "", 0, "imail_height7.75.svg", "" }, + /* 48*/ { BARCODE_ULTRA, -1, 3, BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "FF0000", "0000FF", 0, "12345678901234567890", "", 0, "ultra_fgbg_hvwsp2_box3.svg", "" }, + /* 49*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0.4, "", "", 180, "A", "", 0, "telepen_height0.4_rotate_180.svg", "" }, + /* 50*/ { BARCODE_CODE49, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "FF11157F", "", 0, "A", "", 0, "code49_comph_fgalpha.svg", "" }, + /* 51*/ { BARCODE_CODABLOCKF, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 2, 0, "00000033", "FFFFFF66", 0, "1234567890123456789012345678901234", "", 0, "codablockf_comph_sep2_fgbgalpha.svg", "" }, + /* 52*/ { BARCODE_DPD, -1, -1, BARCODE_QUIET_ZONES | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "008182709980000020028101276", "", 0, "dpd_compliant.svg", "" }, + /* 53*/ { BARCODE_CHANNEL, -1, -1, CMYK_COLOUR | COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "100,85,0,20", "FFFFFF00", 0, "123", "", 0, "channel_cmyk_nobg.svg", "" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -189,11 +190,11 @@ static void test_print(const testCtx *const p_ctx) { assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i); if (p_ctx->generate) { - printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.8g, \"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\" },\n", + printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.8g, \"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\", \"%s\" },\n", i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width, testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt, data[i].option_1, data[i].option_2, data[i].option_3, data[i].height, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle, - testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file); + testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file, data[i].comment); ret = testUtilRename(symbol->outfile, expected_file); assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret); if (have_libreoffice) { diff --git a/backend/tests/test_vector.c b/backend/tests/test_vector.c index 55cf9e73..6a56a0f0 100644 --- a/backend/tests/test_vector.c +++ b/backend/tests/test_vector.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -29,27 +29,35 @@ */ /* SPDX-License-Identifier: BSD-3-Clause */ +#include #include "testcommon.h" +/* Round to 3 decimal places (avoids rounding differences on various platforms) */ +#define rnd3dpf(m) stripf(roundf((m) * 1000) / 1000) + static struct zint_vector_rect *find_rect(struct zint_symbol *symbol, float x, float y, float width, float height) { struct zint_vector_rect *rect; if (symbol->vector == NULL) { return NULL; } + x = rnd3dpf(x); + y = rnd3dpf(y); + width = rnd3dpf(width); + height = rnd3dpf(height); for (rect = symbol->vector->rectangles; rect != NULL; rect = rect->next) { - /* printf("x %.8g, y %.8g, width %.8g, height %.8g\n", rect->x, rect->y, rect->width, rect->height); */ - if (rect->x == stripf(x) && rect->y == stripf(y)) { + /* printf("x %.9g, y %.9g, width %.9g, height %.9g\n", rect->x, rect->y, rect->width, rect->height); */ + if (rnd3dpf(rect->x) == x && rnd3dpf(rect->y) == y) { if (height && width) { - if (rect->height == stripf(height) && rect->width == stripf(width)) { + if (rnd3dpf(rect->height) == height && rnd3dpf(rect->width) == width) { break; } } else if (height) { - if (rect->height == stripf(height)) { + if (rnd3dpf(rect->height) == height) { break; } } else if (width) { - if (rect->width == stripf(width)) { + if (rnd3dpf(rect->width) == width) { break; } } else { @@ -67,11 +75,14 @@ static struct zint_vector_circle *find_circle(struct zint_symbol *symbol, float if (symbol->vector == NULL) { return NULL; } + x = rnd3dpf(x); + y = rnd3dpf(y); + diameter = rnd3dpf(diameter); for (circle = symbol->vector->circles; circle != NULL; circle = circle->next) { /* printf("x %.8g, y %.8g, diamter %.8g\n", circle->x, circle->y, circle->diameter); */ - if (circle->x == stripf(x) && circle->y == stripf(y)) { + if (rnd3dpf(circle->x) == x && rnd3dpf(circle->y) == y) { if (diameter) { - if (circle->diameter == stripf(diameter)) { + if (rnd3dpf(circle->diameter) == diameter) { break; } } else { @@ -83,6 +94,374 @@ static struct zint_vector_circle *find_circle(struct zint_symbol *symbol, float return circle; } +static struct zint_vector_string *find_string(struct zint_symbol *symbol, float x, float y) { + struct zint_vector_string *string; + + if (symbol->vector == NULL) { + return NULL; + } + x = rnd3dpf(x); + y = rnd3dpf(y); + for (string = symbol->vector->strings; string != NULL; string = string->next) { + /* printf("string->x %.9g, string->y %.9g\n", string->x, string->y); */ + if (rnd3dpf(string->x) == x && rnd3dpf(string->y) == y) { + break; + } + } + + return string; +} + +/* Helper to check string vectors */ +static int check_vector_strings(const struct zint_symbol *symbol, char errmsg[128]) { + const int has_hrt = ZBarcode_Cap(symbol->symbology, ZINT_CAP_HRT) == ZINT_CAP_HRT; + const struct zint_vector *vector = symbol->vector; + const struct zint_vector_string *string; + int i, length; + + if (!vector) { + strcpy(errmsg, "vector NULL"); + return 0; + } + if (symbol->show_hrt && has_hrt) { + if (!symbol->vector->strings) { + strcpy(errmsg, "vector->strings NULL"); + return 0; + } + for (string = symbol->vector->strings, i = 0; string; string = string->next, i++) { + if (string->x < 0.0f) { + sprintf(errmsg, "string[%d]->x %g negative", i, string->x); + return 0; + } + if (string->x >= vector->width) { + sprintf(errmsg, "string[%d]->x %g >= vector->width %g", i, string->x, vector->width); + return 0; + } + if (string->y < 0.0f) { + sprintf(errmsg, "string[%d]->y %g negative", i, string->y); + return 0; + } + if (string->y >= vector->height) { + sprintf(errmsg, "string[%d]->y %g >= vector->height %g", i, string->y, vector->height); + return 0; + } + if (string->fsize < 1.0f) { + sprintf(errmsg, "string[%d]->fsize %g < 1", i, string->fsize); + return 0; + } + if (string->width <= 0.0f) { + sprintf(errmsg, "string[%d]->width %g zero or negative", i, string->width); + return 0; + } + if (string->rotation != 0 && string->rotation != 90 && string->rotation != 180 && string->rotation != 270) { + sprintf(errmsg, "string[%d]->rotation %d not 0, 90, 180, 270", i, string->rotation); + return 0; + } + if (!string->text) { + sprintf(errmsg, "string[%d]->text NULL", i); + return 0; + } + length = (int) ustrlen(string->text); + if (string->length != length) { + sprintf(errmsg, "string[%d]->length != %d", string->length, length); + return 0; + } + } + if (is_extendable(symbol->symbology)) { + const unsigned char *addon = (const unsigned char *) strchr((const char *) symbol->text, '+'); + const int has_addon = addon != NULL; + const int text_len = has_addon ? (int) (addon - symbol->text) : (int) ustrlen(symbol->text); + int num = -1; + switch (symbol->symbology) { + case BARCODE_EANX: + case BARCODE_EANX_CHK: + case BARCODE_ISBNX: + case BARCODE_EANX_CC: + num = text_len <= 8 ? text_len <= 5 ? 1 : 2 : 3; + break; + case BARCODE_UPCA: + case BARCODE_UPCA_CHK: + case BARCODE_UPCA_CC: + num = 4; + break; + case BARCODE_UPCE: + case BARCODE_UPCE_CHK: + case BARCODE_UPCE_CC: + num = 3; + break; + default: + strcpy(errmsg, "unhandled EAN/UPC"); + return 0; + break; + } + if (i != num + has_addon) { + printf("num %d, text_len %d, has_addon %d\n", num, text_len, has_addon); + sprintf(errmsg, "no. of strings %d != %d", i, num + has_addon); + return 0; + } + } else { + if (i > 1) { + sprintf(errmsg, "no. of strings %d > 1", i); + return 0; + } + } + } else { + if (symbol->vector->strings) { + strcpy(errmsg, "vector->strings not NULL"); + return 0; + } + } + return 1; +} + +/* Helper to check rectangle vectors */ +static int check_vector_rectangles(const struct zint_symbol *symbol, char errmsg[128]) { + const struct zint_vector *vector = symbol->vector; + const struct zint_vector_rect *rect; + const int have_border = symbol->border_width && (symbol->output_options & (BARCODE_BIND | BARCODE_BOX | BARCODE_BIND_TOP)); + const int dotty = is_dotty(symbol->symbology) && (symbol->output_options & BARCODE_DOTTY_MODE); + int i; + + if (!vector) { + strcpy(errmsg, "vector NULL"); + return 0; + } + if (have_border) { + if (!vector->rectangles) { + strcpy(errmsg, "rectangles NULL"); + return 0; + } + } else { + if (symbol->symbology == BARCODE_DOTCODE || symbol->symbology == BARCODE_MAXICODE) { + if (vector->rectangles) { + strcpy(errmsg, "rectangles not NULL"); + return 0; + } + } else { + if (!dotty) { + if (!vector->rectangles) { + strcpy(errmsg, "rectangles NULL"); + return 0; + } + } + } + } + for (rect = vector->rectangles, i = 0; rect; rect = rect->next, i++) { + if (rect->x < 0.0f) { + sprintf(errmsg, "rect[%d]->x %g negative", i, rect->x); + return 0; + } + if (rect->x >= vector->width) { + sprintf(errmsg, "rect[%d]->x %g >= vector->width %g", i, rect->x, vector->width); + return 0; + } + if (rect->y < 0.0f) { + sprintf(errmsg, "rect[%d]->y %g negative", i, rect->y); + return 0; + } + if (rect->y >= vector->height) { + sprintf(errmsg, "rect[%d]->y %g >= vector->height %g", i, rect->y, vector->height); + return 0; + } + if (rect->width <= 0.0f) { + sprintf(errmsg, "rect[%d]->width %g <= 0", i, rect->width); + return 0; + } + if (rect->width > vector->width) { + sprintf(errmsg, "rect[%d]->width %g > vector->width %g", i, rect->width, vector->width); + return 0; + } + if (stripf(rect->x + rect->width) > vector->width) { + sprintf(errmsg, "rect[%d]->x + width %g > vector->width %g", i, rect->x + rect->width, vector->width); + return 0; + } + if (rect->height <= 0.0f) { + sprintf(errmsg, "rect[%d]->height %g <= 0", i, rect->height); + return 0; + } + if (rect->height > vector->height) { + sprintf(errmsg, "rect[%d]->height %g > vector->height %g", i, rect->height, vector->height); + return 0; + } + if (stripf(rect->y + rect->height) > vector->height) { + sprintf(errmsg, "rect[%d]->y + height %g > vector->height %g", i, rect->y + rect->height, vector->height); + return 0; + } + + if (symbol->symbology == BARCODE_ULTRA) { + if (rect->colour != -1 && (rect->colour < 1 || rect->colour > 8)) { + sprintf(errmsg, "rect[%d]->colour %d != -1 and not 1-8", i, rect->colour); + return 0; + } + } else { + if (rect->colour != -1) { + sprintf(errmsg, "rect[%d]->colour %d != -1", i, rect->colour); + return 0; + } + } + } + return 1; +} + +/* Helper to check circle vectors */ +static int check_vector_circles(const struct zint_symbol *symbol, char errmsg[128]) { + const struct zint_vector *vector = symbol->vector; + const struct zint_vector_circle *circle; + const int dotty = is_dotty(symbol->symbology) && (symbol->output_options & BARCODE_DOTTY_MODE); + int i; + + if (!vector) { + strcpy(errmsg, "vector NULL"); + return 0; + } + if (symbol->symbology == BARCODE_DOTCODE || symbol->symbology == BARCODE_MAXICODE) { + if (!vector->circles) { + strcpy(errmsg, "circles NULL"); + return 0; + } + } else { + if (vector->circles) { + if (!dotty) { + strcpy(errmsg, "circles not NULL"); + return 0; + } + } else { + if (dotty) { + strcpy(errmsg, "circles NULL"); + return 0; + } + } + } + for (circle = vector->circles, i = 0; circle; circle = circle->next, i++) { + if (circle->x < 0.0f) { + sprintf(errmsg, "circle[%d]->x %g negative", i, circle->x); + return 0; + } + if (circle->x >= vector->width) { + sprintf(errmsg, "circle[%d]->x %g >= vector->width %g", i, circle->x, vector->width); + return 0; + } + if (circle->y < 0.0f) { + sprintf(errmsg, "circle[%d]->y %g negative", i, circle->y); + return 0; + } + if (circle->y >= vector->height) { + sprintf(errmsg, "circle[%d]->y %g >= vector->height %g", i, circle->y, vector->height); + return 0; + } + if (circle->diameter <= 0.0f) { + sprintf(errmsg, "circle[%d]->diameter %g <= 0", i, circle->diameter); + return 0; + } + if (circle->diameter > vector->width) { + sprintf(errmsg, "circle[%d]->diameter %g > vector->diameter %g", i, circle->diameter, vector->width); + return 0; + } + if (circle->diameter > vector->height) { + sprintf(errmsg, "circle[%d]->diameter %g > vector->height %g", i, circle->diameter, vector->height); + return 0; + } + if (stripf(circle->x + circle->diameter / 2) > vector->width) { + sprintf(errmsg, "circle[%d]->x + diameter / 2 %g > vector->width %g", i, circle->x + circle->diameter / 2, vector->width); + return 0; + } + if (stripf(circle->y + circle->diameter / 2) > vector->height) { + sprintf(errmsg, "circle[%d]->y + diameter / 2 %g > vector->height %g", i, circle->y + circle->diameter / 2, vector->height); + return 0; + } + + if (circle->colour != 0) { + sprintf(errmsg, "circle[%d]->colour %d != 0", i, circle->colour); + return 0; + } + } + return 1; +} + +/* Helper to check hexagon vectors */ +static int check_vector_hexagons(const struct zint_symbol *symbol, char errmsg[128]) { + const struct zint_vector *vector = symbol->vector; + const struct zint_vector_hexagon *hex; + int i; + + if (!vector) { + strcpy(errmsg, "vector NULL"); + return 0; + } + if (symbol->symbology == BARCODE_MAXICODE) { + if (!vector->hexagons) { + strcpy(errmsg, "hexagons NULL"); + return 0; + } + } else { + if (vector->hexagons) { + strcpy(errmsg, "hexagons not NULL"); + return 0; + } + } + for (hex = vector->hexagons, i = 0; hex; hex = hex->next, i++) { + if (hex->x < 0.0f) { + sprintf(errmsg, "hex[%d]->x %g negative", i, hex->x); + return 0; + } + if (hex->x >= vector->width) { + sprintf(errmsg, "hex[%d]->x %g >= vector->width %g", i, hex->x, vector->width); + return 0; + } + if (hex->y < 0.0f) { + sprintf(errmsg, "hex[%d]->y %g negative", i, hex->y); + return 0; + } + if (hex->y >= vector->height) { + sprintf(errmsg, "hex[%d]->y %g >= vector->height %g", i, hex->y, vector->height); + return 0; + } + if (hex->diameter <= 0.0f) { + sprintf(errmsg, "hex[%d]->diameter %g <= 0", i, hex->diameter); + return 0; + } + if (hex->diameter > vector->width) { + sprintf(errmsg, "hex[%d]->diameter %g > vector->diameter %g", i, hex->diameter, vector->width); + return 0; + } + if (hex->diameter > vector->height) { + sprintf(errmsg, "hex[%d]->diameter %g > vector->height %g", i, hex->diameter, vector->height); + return 0; + } + if (stripf(hex->x + hex->diameter / 2) > vector->width) { + sprintf(errmsg, "hex[%d]->x + diameter / 2 %g > vector->width %g", i, hex->x + hex->diameter / 2, vector->width); + return 0; + } + if (stripf(hex->y + hex->diameter / 2) > vector->height) { + sprintf(errmsg, "hex[%d]->y + diameter / 2 %g > vector->height %g", i, hex->y + hex->diameter / 2, vector->height); + return 0; + } + + if (hex->rotation != 0 && hex->rotation != 90 && hex->rotation != 180 && hex->rotation != 270) { + sprintf(errmsg, "hex[%d]->rotation %d not 0, 90, 180, 270", i, hex->rotation); + return 0; + } + } + return 1; +} + +/* Helper to check vectors */ +static int check_vectors(const struct zint_symbol *symbol, char errmsg[128]) { + if (!check_vector_strings(symbol, errmsg)) { + return 0; + } + if (!check_vector_rectangles(symbol, errmsg)) { + return 0; + } + if (!check_vector_circles(symbol, errmsg)) { + return 0; + } + if (!check_vector_hexagons(symbol, errmsg)) { + return 0; + } + return 1; +} + static void test_options(const testCtx *const p_ctx) { int debug = p_ctx->debug; @@ -169,22 +548,22 @@ static void test_buffer_vector(const testCtx *const p_ctx) { /* 5*/ { BARCODE_C25IND, "1234567890", "", 50, 1, 159, 318, 118.900002 }, /* 6*/ { BARCODE_CODE39, "1234567890", "", 50, 1, 155, 310, 118.900002 }, /* 7*/ { BARCODE_EXCODE39, "1234567890", "", 50, 1, 155, 310, 118.900002 }, - /* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 226, 116.400002 }, - /* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 226, 116.400002 }, - /* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 122, 276, 116.400002 }, - /* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 50, 1, 122, 276, 116.400002 }, - /* 12*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 149, 330, 116.400002 }, - /* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 50, 1, 149, 330, 116.400002 }, - /* 14*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 162, 116.400002 }, - /* 15*/ { BARCODE_EANX_CHK, "12345670", "", 50, 1, 67, 162, 116.400002 }, - /* 16*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 94, 216, 116.400002 }, - /* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", 50, 1, 94, 216, 116.400002 }, - /* 18*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 121, 270, 116.400002 }, - /* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", 50, 1, 121, 270, 116.400002 }, - /* 20*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 118, 116.400002 }, - /* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 116.400002 }, - /* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 116.400002 }, - /* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 116.400002 }, + /* 8*/ { BARCODE_EANX, "123456789012", "", 50, 1, 95, 226, 116.9 }, + /* 9*/ { BARCODE_EANX_CHK, "1234567890128", "", 50, 1, 95, 226, 116.9 }, + /* 10*/ { BARCODE_EANX, "123456789012+12", "", 50, 1, 122, 276, 116.9 }, + /* 11*/ { BARCODE_EANX_CHK, "1234567890128+12", "", 50, 1, 122, 276, 116.9 }, + /* 12*/ { BARCODE_EANX, "123456789012+12345", "", 50, 1, 149, 330, 116.9 }, + /* 13*/ { BARCODE_EANX_CHK, "1234567890128+12345", "", 50, 1, 149, 330, 116.9 }, + /* 14*/ { BARCODE_EANX, "1234567", "", 50, 1, 67, 162, 116.9 }, + /* 15*/ { BARCODE_EANX_CHK, "12345670", "", 50, 1, 67, 162, 116.9 }, + /* 16*/ { BARCODE_EANX, "1234567+12", "", 50, 1, 94, 216, 116.9 }, + /* 17*/ { BARCODE_EANX_CHK, "12345670+12", "", 50, 1, 94, 216, 116.9 }, + /* 18*/ { BARCODE_EANX, "1234567+12345", "", 50, 1, 121, 270, 116.9 }, + /* 19*/ { BARCODE_EANX_CHK, "12345670+12345", "", 50, 1, 121, 270, 116.9 }, + /* 20*/ { BARCODE_EANX, "1234", "", 50, 1, 47, 118, 116.9 }, + /* 21*/ { BARCODE_EANX_CHK, "1234", "", 50, 1, 47, 118, 116.9 }, + /* 22*/ { BARCODE_EANX, "12", "", 50, 1, 20, 64, 116.9 }, + /* 23*/ { BARCODE_EANX_CHK, "12", "", 50, 1, 20, 64, 116.9 }, /* 24*/ { BARCODE_GS1_128, "[01]12345678901231", "", 50, 1, 134, 268, 118.900002 }, /* 25*/ { BARCODE_CODABAR, "A00000000B", "", 50, 1, 102, 204, 118.900002 }, /* 26*/ { BARCODE_CODE128, "1234567890", "", 50, 1, 90, 180, 118.900002 }, @@ -198,18 +577,18 @@ static void test_buffer_vector(const testCtx *const p_ctx) { /* 34*/ { BARCODE_DBAR_LTD, "1234567890123", "", 50, 1, 79, 158, 118.900002 }, /* 35*/ { BARCODE_DBAR_EXP, "[01]12345678901231", "", 34, 1, 134, 268, 86.9000015 }, /* 36*/ { BARCODE_TELEPEN, "1234567890", "", 50, 1, 208, 416, 118.900002 }, - /* 37*/ { BARCODE_UPCA, "12345678901", "", 50, 1, 95, 226, 116.400002 }, - /* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 50, 1, 95, 226, 116.400002 }, - /* 39*/ { BARCODE_UPCA, "12345678901+12", "", 50, 1, 124, 276, 116.400002 }, - /* 40*/ { BARCODE_UPCA_CHK, "123456789012+12", "", 50, 1, 124, 276, 116.400002 }, - /* 41*/ { BARCODE_UPCA, "12345678901+12345", "", 50, 1, 151, 330, 116.400002 }, - /* 42*/ { BARCODE_UPCA_CHK, "123456789012+12345", "", 50, 1, 151, 330, 116.400002 }, - /* 43*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 134, 116.400002 }, - /* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 134, 116.400002 }, - /* 45*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 78, 184, 116.400002 }, - /* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 50, 1, 78, 184, 116.400002 }, - /* 47*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 105, 238, 116.400002 }, - /* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 50, 1, 105, 238, 116.400002 }, + /* 37*/ { BARCODE_UPCA, "12345678901", "", 50, 1, 95, 226, 116.9 }, + /* 38*/ { BARCODE_UPCA_CHK, "123456789012", "", 50, 1, 95, 226, 116.9 }, + /* 39*/ { BARCODE_UPCA, "12345678901+12", "", 50, 1, 124, 276, 116.9 }, + /* 40*/ { BARCODE_UPCA_CHK, "123456789012+12", "", 50, 1, 124, 276, 116.9 }, + /* 41*/ { BARCODE_UPCA, "12345678901+12345", "", 50, 1, 151, 330, 116.9 }, + /* 42*/ { BARCODE_UPCA_CHK, "123456789012+12345", "", 50, 1, 151, 330, 116.9 }, + /* 43*/ { BARCODE_UPCE, "1234567", "", 50, 1, 51, 134, 116.9 }, + /* 44*/ { BARCODE_UPCE_CHK, "12345670", "", 50, 1, 51, 134, 116.9 }, + /* 45*/ { BARCODE_UPCE, "1234567+12", "", 50, 1, 78, 184, 116.9 }, + /* 46*/ { BARCODE_UPCE_CHK, "12345670+12", "", 50, 1, 78, 184, 116.9 }, + /* 47*/ { BARCODE_UPCE, "1234567+12345", "", 50, 1, 105, 238, 116.9 }, + /* 48*/ { BARCODE_UPCE_CHK, "12345670+12345", "", 50, 1, 105, 238, 116.9 }, /* 49*/ { BARCODE_POSTNET, "12345678901", "", 12, 2, 123, 246, 24 }, /* 50*/ { BARCODE_MSI_PLESSEY, "1234567890", "", 50, 1, 127, 254, 118.900002 }, /* 51*/ { BARCODE_FIM, "A", "", 50, 1, 17, 34, 100 }, @@ -227,9 +606,9 @@ static void test_buffer_vector(const testCtx *const p_ctx) { /* 63*/ { BARCODE_AUSREPLY, "12345678", "", 8, 3, 73, 146, 16 }, /* 64*/ { BARCODE_AUSROUTE, "12345678", "", 8, 3, 73, 146, 16 }, /* 65*/ { BARCODE_AUSREDIRECT, "12345678", "", 8, 3, 73, 146, 16 }, - /* 66*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 226, 116.400002 }, - /* 67*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 122, 276, 116.400002 }, - /* 68*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 149, 330, 116.400002 }, + /* 66*/ { BARCODE_ISBNX, "123456789", "", 50, 1, 95, 226, 116.9 }, + /* 67*/ { BARCODE_ISBNX, "123456789+12", "", 50, 1, 122, 276, 116.9 }, + /* 68*/ { BARCODE_ISBNX, "123456789+12345", "", 50, 1, 149, 330, 116.9 }, /* 69*/ { BARCODE_RM4SCC, "1234567890", "", 8, 3, 91, 182, 16 }, /* 70*/ { BARCODE_DATAMATRIX, "ABC", "", 10, 10, 10, 20, 20 }, /* 71*/ { BARCODE_EAN14, "1234567890123", "", 50, 1, 134, 268, 118.900002 }, @@ -267,22 +646,22 @@ static void test_buffer_vector(const testCtx *const p_ctx) { /*103*/ { BARCODE_MAILMARK_4S, "01000000000000000AA00AA0A", "", 10, 3, 155, 310, 20 }, /*104*/ { BARCODE_AZRUNE, "255", "", 11, 11, 11, 22, 22 }, /*105*/ { BARCODE_CODE32, "12345678", "", 50, 1, 103, 206, 118.900002 }, - /*106*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 234, 116.400002 }, - /*107*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 126, 284, 116.400002 }, - /*108*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 153, 338, 116.400002 }, - /*109*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 172, 116.400002 }, - /*110*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 99, 226, 116.400002 }, - /*111*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 126, 280, 116.400002 }, + /*106*/ { BARCODE_EANX_CC, "123456789012", "[20]01", 50, 7, 99, 234, 116.9 }, + /*107*/ { BARCODE_EANX_CC, "123456789012+12", "[20]01", 50, 7, 126, 284, 116.9 }, + /*108*/ { BARCODE_EANX_CC, "123456789012+12345", "[20]01", 50, 7, 153, 338, 116.9 }, + /*109*/ { BARCODE_EANX_CC, "1234567", "[20]01", 50, 8, 72, 172, 116.9 }, + /*110*/ { BARCODE_EANX_CC, "1234567+12", "[20]01", 50, 8, 99, 226, 116.9 }, + /*111*/ { BARCODE_EANX_CC, "1234567+12345", "[20]01", 50, 8, 126, 280, 116.9 }, /*112*/ { BARCODE_GS1_128_CC, "[01]12345678901231", "[20]01", 50, 5, 145, 290, 118.900002 }, /*113*/ { BARCODE_DBAR_OMN_CC, "1234567890123", "[20]01", 21, 5, 100, 200, 60.9000015 }, /*114*/ { BARCODE_DBAR_LTD_CC, "1234567890123", "[20]01", 19, 6, 79, 158, 56.9000015 }, /*115*/ { BARCODE_DBAR_EXP_CC, "[01]12345678901231", "[20]01", 41, 5, 134, 268, 100.900002 }, - /*116*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 116.400002 }, - /*117*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 116.400002 }, - /*118*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 116.400002 }, - /*119*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 142, 116.400002 }, - /*120*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 82, 192, 116.400002 }, - /*121*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 116.400002 }, + /*116*/ { BARCODE_UPCA_CC, "12345678901", "[20]01", 50, 7, 99, 234, 116.9 }, + /*117*/ { BARCODE_UPCA_CC, "12345678901+12", "[20]01", 50, 7, 128, 284, 116.9 }, + /*118*/ { BARCODE_UPCA_CC, "12345678901+12345", "[20]01", 50, 7, 155, 338, 116.9 }, + /*119*/ { BARCODE_UPCE_CC, "1234567", "[20]01", 50, 9, 55, 142, 116.9 }, + /*120*/ { BARCODE_UPCE_CC, "1234567+12", "[20]01", 50, 9, 82, 192, 116.9 }, + /*121*/ { BARCODE_UPCE_CC, "1234567+12345", "[20]01", 50, 9, 109, 246, 116.9 }, /*122*/ { BARCODE_DBAR_STK_CC, "1234567890123", "[20]01", 24, 9, 56, 112, 48 }, /*123*/ { BARCODE_DBAR_OMNSTK_CC, "1234567890123", "[20]01", 80, 11, 56, 112, 160 }, /*124*/ { BARCODE_DBAR_EXPSTK_CC, "[01]12345678901231", "[20]01", 78, 9, 102, 204, 156 }, @@ -299,6 +678,7 @@ static void test_buffer_vector(const testCtx *const p_ctx) { struct zint_symbol *symbol; char *text; + char errmsg[128]; testStart("test_buffer_vector"); @@ -333,13 +713,19 @@ static void test_buffer_vector(const testCtx *const p_ctx) { i, testUtilBarcodeName(data[i].symbology), data[i].data, data[i].composite, symbol->height, symbol->rows, symbol->width, symbol->vector->width, symbol->vector->height); } else { - assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n", i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); - assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); - assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); + assert_equal(symbol->height, data[i].expected_height, "i:%d (%s) symbol->height %.8g != %.8g\n", + i, testUtilBarcodeName(data[i].symbology), symbol->height, data[i].expected_height); + assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%s) symbol->rows %d != %d\n", + i, testUtilBarcodeName(data[i].symbology), symbol->rows, data[i].expected_rows); + assert_equal(symbol->width, data[i].expected_width, "i:%d (%s) symbol->width %d != %d\n", + i, testUtilBarcodeName(data[i].symbology), symbol->width, data[i].expected_width); assert_equal(symbol->vector->width, data[i].expected_vector_width, "i:%d (%s) symbol->vector->width %.8g != %.8g\n", i, testUtilBarcodeName(data[i].symbology), symbol->vector->width, data[i].expected_vector_width); assert_equal(symbol->vector->height, data[i].expected_vector_height, "i:%d (%s) symbol->vector->height %.8g != %.8g\n", i, testUtilBarcodeName(data[i].symbology), symbol->vector->height, data[i].expected_vector_height); + + assert_nonzero(check_vectors(symbol, errmsg), "i:%d (%s) %s\n", + i, testUtilBarcodeName(data[i].symbology), errmsg); } ZBarcode_Delete(symbol); @@ -461,7 +847,7 @@ static void test_has_hrt(const testCtx *const p_ctx) { struct zint_symbol *symbol; char *text; - unsigned int has_hrt; + char errmsg[128]; testStart("test_has_hrt"); @@ -488,12 +874,8 @@ static void test_has_hrt(const testCtx *const p_ctx) { assert_zero(ret, "i:%d ZBarcode_Encode_and_Buffer_Vector(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); assert_nonnull(symbol->vector, "i:%d ZBarcode_Encode_and_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology); - has_hrt = ZBarcode_Cap(symbol->symbology, ZINT_CAP_HRT) == ZINT_CAP_HRT; - if (has_hrt) { - assert_nonnull(symbol->vector->strings, "i:%d ZBarcode_Encode_and_Buffer_Vector(%d) vector->strings NULL\n", i, data[i].symbology); - } else { - assert_null(symbol->vector->strings, "i:%d ZBarcode_Encode_and_Buffer_Vector(%d) vector->strings not NULL\n", i, data[i].symbology); - } + assert_nonzero(check_vectors(symbol, errmsg), "i:%d ZBarcode_Encode_and_Buffer_Vector(%d) %s\n", + i, data[i].symbology, errmsg); ZBarcode_Delete(symbol); } @@ -520,45 +902,45 @@ static void test_upcean_hrt(const testCtx *const p_ctx) { }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 226, 116.4, 12, -1 }, /* EAN-13 */ + /* 0*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 226, 116.9, 12.2, -1 }, /* EAN-13 */ /* 1*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 226, 110, -1, -1 }, /* EAN-13 */ - /* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 226, 116.4, 12, -1 }, /* EAN-13 */ + /* 2*/ { BARCODE_EANX_CHK, -1, "1234567890128", 0, 50, 1, 95, 226, 116.9, 12.2, -1 }, /* EAN-13 */ /* 3*/ { BARCODE_EANX_CHK, 0, "1234567890128", 0, 50, 1, 95, 226, 110, -1, -1 }, /* EAN-13 */ - /* 4*/ { BARCODE_ISBNX, -1, "9784567890120", 0, 50, 1, 95, 226, 116.4, 12, -1 }, + /* 4*/ { BARCODE_ISBNX, -1, "9784567890120", 0, 50, 1, 95, 226, 116.9, 12.2, -1 }, /* 5*/ { BARCODE_ISBNX, 0, "9784567890120", 0, 50, 1, 95, 226, 110, -1, -1 }, - /* 6*/ { BARCODE_EANX, -1, "1234567", 0, 50, 1, 67, 162, 116.4, 48, -1 }, /* EAN-8 */ + /* 6*/ { BARCODE_EANX, -1, "1234567", 0, 50, 1, 67, 162, 116.9, 49, -1 }, /* EAN-8 */ /* 7*/ { BARCODE_EANX, 0, "1234567", 0, 50, 1, 67, 162, 110, -1, -1 }, /* EAN-8 */ - /* 8*/ { BARCODE_EANX, -1, "1234", 0, 50, 1, 47, 118, 116.4, 61, -1 }, /* EAN-5 */ + /* 8*/ { BARCODE_EANX, -1, "1234", 0, 50, 1, 47, 118, 116.9, 61, -1 }, /* EAN-5 */ /* 9*/ { BARCODE_EANX, 0, "1234", 0, 50, 1, 47, 118, 100, -1, -1 }, /* EAN-5 */ - /* 10*/ { BARCODE_EANX, -1, "12", 0, 50, 1, 20, 64, 116.4, 34, -1 }, /* EAN-2 */ + /* 10*/ { BARCODE_EANX, -1, "12", 0, 50, 1, 20, 64, 116.9, 34, -1 }, /* EAN-2 */ /* 11*/ { BARCODE_EANX, 0, "12", 0, 50, 1, 20, 64, 100, -1, -1 }, /* EAN-2 */ - /* 12*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 226, 116.4, 8, -1 }, + /* 12*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 226, 116.9, 8.7, -1 }, /* 13*/ { BARCODE_UPCA, 0, "12345678901", 0, 50, 1, 95, 226, 110, -1, -1 }, - /* 14*/ { BARCODE_UPCA_CHK, -1, "123456789012", 0, 50, 1, 95, 226, 116.4, 8, -1 }, + /* 14*/ { BARCODE_UPCA_CHK, -1, "123456789012", 0, 50, 1, 95, 226, 116.9, 8.7, -1 }, /* 15*/ { BARCODE_UPCA_CHK, 0, "123456789012", 0, 50, 1, 95, 226, 110, -1, -1 }, - /* 16*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 116.4, 8, -1 }, + /* 16*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 116.9, 8.7, -1 }, /* 17*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 134, 110, -1, -1 }, - /* 18*/ { BARCODE_UPCE_CHK, -1, "12345670", 0, 50, 1, 51, 134, 116.4, 8, -1 }, + /* 18*/ { BARCODE_UPCE_CHK, -1, "12345670", 0, 50, 1, 51, 134, 116.9, 8.7, -1 }, /* 19*/ { BARCODE_UPCE_CHK, 0, "12345670", 0, 50, 1, 51, 134, 110, -1, -1 }, - /* 20*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276.0, 116.4, 12, 70 }, /* EAN-13 + EAN-2 */ + /* 20*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276.0, 116.9, 12.2, 71 }, /* EAN-13 + EAN-2 */ /* 21*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 122, 276.0, 110, -1, -1 }, /* EAN-13 + EAN-2 */ - /* 22*/ { BARCODE_ISBNX, -1, "9784567890120+12", 0, 50, 1, 122, 276.0, 116.4, 12, 70 }, /* ISBN + EAN-2 */ + /* 22*/ { BARCODE_ISBNX, -1, "9784567890120+12", 0, 50, 1, 122, 276.0, 116.9, 12.2, 71 }, /* ISBN + EAN-2 */ /* 23*/ { BARCODE_ISBNX, 0, "9784567890120+12", 0, 50, 1, 122, 276.0, 110, -1, -1 }, /* ISBN + EAN-2 */ - /* 24*/ { BARCODE_EANX, -1, "123456789012+12345", 0, 50, 1, 149, 330.0, 116.4, 12, 70 }, /* EAN-13 + EAN-5 */ + /* 24*/ { BARCODE_EANX, -1, "123456789012+12345", 0, 50, 1, 149, 330.0, 116.9, 12.2, 71 }, /* EAN-13 + EAN-5 */ /* 25*/ { BARCODE_EANX, 0, "123456789012+12345", 0, 50, 1, 149, 330.0, 110, -1, -1 }, /* EAN-13 + EAN-5 */ - /* 26*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 149, 330.0, 116.4, 12, 70 }, /* ISBN + EAN-5 */ + /* 26*/ { BARCODE_ISBNX, -1, "9784567890120+12345", 0, 50, 1, 149, 330.0, 116.9, 12.2, 71 }, /* ISBN + EAN-5 */ /* 27*/ { BARCODE_ISBNX, 0, "9784567890120+12345", 0, 50, 1, 149, 330.0, 110, -1, -1 }, /* ISBN + EAN-5 */ - /* 28*/ { BARCODE_EANX, -1, "1234567+12", 0, 50, 1, 94, 216.0, 116.4, 48, 114 }, /* EAN-8 + EAN-2 */ + /* 28*/ { BARCODE_EANX, -1, "1234567+12", 0, 50, 1, 94, 216.0, 116.9, 49, 113 }, /* EAN-8 + EAN-2 */ /* 29*/ { BARCODE_EANX, 0, "1234567+12", 0, 50, 1, 94, 216.0, 110, -1, -1 }, /* EAN-8 + EAN-2 */ - /* 30*/ { BARCODE_EANX, -1, "1234567+12345", 0, 50, 1, 121, 270.0, 116.4, 48, 114 }, /* EAN-8 + EAN-5 */ + /* 30*/ { BARCODE_EANX, -1, "1234567+12345", 0, 50, 1, 121, 270.0, 116.9, 49, 113 }, /* EAN-8 + EAN-5 */ /* 31*/ { BARCODE_EANX, 0, "1234567+12345", 0, 50, 1, 121, 270.0, 110, -1, -1 }, /* EAN-8 + EAN-5 */ - /* 32*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116.4, 8, 72 }, + /* 32*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116.9, 8.7, 74 }, /* 33*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 276, 110, -1, -1 }, - /* 34*/ { BARCODE_UPCA, -1, "12345678901+12345", 0, 50, 1, 151, 330, 116.4, 8, 72 }, + /* 34*/ { BARCODE_UPCA, -1, "12345678901+12345", 0, 50, 1, 151, 330, 116.9, 8.7, 74 }, /* 35*/ { BARCODE_UPCA, 0, "12345678901+12345", 0, 50, 1, 151, 330, 110, -1, -1 }, - /* 36*/ { BARCODE_UPCE, -1, "1234567+12", 0, 50, 1, 78, 184.0, 116.4, 8, 66 }, + /* 36*/ { BARCODE_UPCE, -1, "1234567+12", 0, 50, 1, 78, 184.0, 116.9, 8.7, 67 }, /* 37*/ { BARCODE_UPCE, 0, "1234567+12", 0, 50, 1, 78, 184.0, 110, -1, -1 }, - /* 38*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238.0, 116.4, 8, 66 }, + /* 38*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238.0, 116.9, 8.7, 67 }, /* 39*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238.0, 110, -1, -1 }, }; int data_size = ARRAY_SIZE(data); @@ -1074,9 +1456,9 @@ static void test_scale(const testCtx *const p_ctx) { /* 1*/ { BARCODE_PDF417, -1, -1, -1, 0, 0.1, "1", "", 0, 15, 5, 103, 206 * 0.1, 3, 1, 5.2000003, 0, 8 * 0.1, 6 * 0.1 }, /* 2*/ { BARCODE_PDF417, -1, -1, -1, 0, 0.3, "1", "", 0, 15, 5, 103, 61.8000031, 30 * 0.3, 1, 52 * 0.3, 0, 2.4000001, 1.8000001 }, /* 3*/ { BARCODE_PDF417, -1, -1, -1, 0, 0.6, "1", "", 0, 15, 5, 103, 123.600006, 30 * 0.6, 1, 52 * 0.6, 0, 4.8000002, 3.6000001 }, - /* 4*/ { BARCODE_UPCE_CC, -1, -1, -1, 0, 0, "1234567", "[17]010615[10]A123456\"", 0, 50, 10, 55, 142, 116.400002, 1, 34, 36, 2, 64 }, /* With no scaling */ - /* 5*/ { BARCODE_UPCE_CC, -1, -1, -1, 0, 0.1, "1234567", "[17]010615[10]A123456\"", 0, 50, 10, 55, 142 * 0.1, 11.6400003, 1, 34 * 0.1, 3.6000001, 2 * 0.1, 64 * 0.1 }, - /* 6*/ { BARCODE_UPCE_CC, -1, -1, -1, 0.1, 0.1, "1234567", "[17]010615[10]A123456\"", 0, 18.5, 10, 55, 142 * 0.1, 5.34000015, 1, 34 * 0.1, 3.6000001, 2 * 0.1, 0.1 }, /* Height specified */ + /* 4*/ { BARCODE_UPCE_CC, -1, -1, -1, 0, 0, "1234567", "[17]010615[10]A123456\"", 0, 50, 10, 55, 142, 116.9, 1, 34, 36, 2, 64 }, /* With no scaling */ + /* 5*/ { BARCODE_UPCE_CC, -1, -1, -1, 0, 0.1, "1234567", "[17]010615[10]A123456\"", 0, 50, 10, 55, 142 * 0.1, 11.6900005, 1, 34 * 0.1, 3.6000001, 2 * 0.1, 64 * 0.1 }, + /* 6*/ { BARCODE_UPCE_CC, -1, -1, -1, 0.1, 0.1, "1234567", "[17]010615[10]A123456\"", 0, 18.5, 10, 55, 142 * 0.1, 5.39000034, 1, 34 * 0.1, 3.6000001, 2 * 0.1, 0.1 }, /* Height specified */ }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1171,40 +1553,40 @@ static void test_guard_descent(const testCtx *const p_ctx) { }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 110 }, - /* 1*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 100 }, - /* 2*/ { BARCODE_UPCE, 3, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 106 }, - /* 3*/ { BARCODE_UPCE, 8, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 116 }, - /* 4*/ { BARCODE_UPCE, 8.2, "1234567", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 116.4 }, - /* 5*/ { BARCODE_UPCE, 8.25, "1234567", 0, 50, 1, 51, 134, 116.5, 18, 0, 2, 116.5 }, - /* 6*/ { BARCODE_UPCE, 8.3, "1234567", 0, 50, 1, 51, 134, 116.6, 18, 0, 2, 116.6 }, + /* 0*/ { BARCODE_UPCE, -1, "1234567", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 110 }, + /* 1*/ { BARCODE_UPCE, 0, "1234567", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 100 }, + /* 2*/ { BARCODE_UPCE, 3, "1234567", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 106 }, + /* 3*/ { BARCODE_UPCE, 8, "1234567", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 116 }, + /* 4*/ { BARCODE_UPCE, 8.2, "1234567", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 116.4 }, + /* 5*/ { BARCODE_UPCE, 8.25, "1234567", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 116.5 }, + /* 6*/ { BARCODE_UPCE, 8.3, "1234567", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 116.6 }, /* 7*/ { BARCODE_UPCE, 19.6, "1234567", 0, 50, 1, 51, 134, 139.2, 18, 0, 2, 139.2 }, - /* 8*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 118, 0, 2, 110 }, - /* 9*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 134, 19, 2, 81 }, - /* 10*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 118, 0, 2, 100 }, - /* 11*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 134, 19, 2, 81 }, - /* 12*/ { BARCODE_UPCE, 4, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 118, 0, 2, 108 }, - /* 13*/ { BARCODE_UPCE, 4, "1234567+12345", 0, 50, 1, 105, 238, 116.4, 134, 19, 2, 81 }, - /* 14*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 226, 116.4, 188, 0, 4, 110 }, - /* 15*/ { BARCODE_UPCA, 0, "12345678901", 0, 50, 1, 95, 226, 116.4, 188, 0, 4, 100 }, - /* 16*/ { BARCODE_UPCA, 6, "12345678901", 0, 50, 1, 95, 226, 116.4, 188, 0, 4, 112 }, - /* 17*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116.4, 188, 0, 4, 110 }, - /* 18*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116.4, 262, 19, 4, 81 }, - /* 19*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 276, 116.4, 188, 0, 4, 100 }, - /* 20*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 276, 116.4, 262, 19, 4, 81 }, + /* 8*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238, 116.9, 118, 0, 2, 110 }, + /* 9*/ { BARCODE_UPCE, -1, "1234567+12345", 0, 50, 1, 105, 238, 116.9, 134, 16.9, 2, 83.1 }, + /* 10*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238, 116.9, 118, 0, 2, 100 }, + /* 11*/ { BARCODE_UPCE, 0, "1234567+12345", 0, 50, 1, 105, 238, 116.9, 134, 16.9, 2, 83.1 }, + /* 12*/ { BARCODE_UPCE, 4, "1234567+12345", 0, 50, 1, 105, 238, 116.9, 118, 0, 2, 108 }, + /* 13*/ { BARCODE_UPCE, 4, "1234567+12345", 0, 50, 1, 105, 238, 116.9, 134, 16.9, 2, 83.1 }, + /* 14*/ { BARCODE_UPCA, -1, "12345678901", 0, 50, 1, 95, 226, 116.9, 188, 0, 4, 110 }, + /* 15*/ { BARCODE_UPCA, 0, "12345678901", 0, 50, 1, 95, 226, 116.9, 188, 0, 4, 100 }, + /* 16*/ { BARCODE_UPCA, 6, "12345678901", 0, 50, 1, 95, 226, 116.9, 188, 0, 4, 112 }, + /* 17*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116.9, 188, 0, 4, 110 }, + /* 18*/ { BARCODE_UPCA, -1, "12345678901+12", 0, 50, 1, 124, 276, 116.9, 262, 16.9, 4, 83.1 }, + /* 19*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 276, 116.9, 188, 0, 4, 100 }, + /* 20*/ { BARCODE_UPCA, 0, "12345678901+12", 0, 50, 1, 124, 276, 116.9, 262, 16.9, 4, 83.1 }, /* 21*/ { BARCODE_UPCA, 9, "12345678901+12", 0, 50, 1, 124, 276, 118, 188, 0, 4, 118 }, - /* 22*/ { BARCODE_UPCA, 9, "12345678901+12", 0, 50, 1, 124, 276, 118, 262, 19, 4, 81 }, - /* 23*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 110 }, - /* 24*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 100 }, - /* 25*/ { BARCODE_EANX, 7, "123456789012", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 114 }, - /* 26*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276, 116.4, 22, 0, 2, 110 }, - /* 27*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276, 116.4, 262, 19, 4, 91 }, - /* 28*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 122, 276, 116.4, 22, 0, 2, 100 }, - /* 29*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 122, 276, 116.4, 262, 19, 4, 81 }, - /* 30*/ { BARCODE_EANX, 8.21, "123456789012+12", 0, 50, 1, 122, 276, 116.42, 22, 0, 2, 116.42 }, - /* 31*/ { BARCODE_EANX, 8.21, "123456789012+12", 0, 50, 1, 122, 276, 116.42, 262, 19, 4, 97.42 }, - /* 32*/ { BARCODE_ISBNX, -1, "123456789", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 110 }, - /* 33*/ { BARCODE_ISBNX, 0, "123456789", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 100 }, + /* 22*/ { BARCODE_UPCA, 9, "12345678901+12", 0, 50, 1, 124, 276, 118, 262, 16.9, 4, 83.1 }, + /* 23*/ { BARCODE_EANX, -1, "123456789012", 0, 50, 1, 95, 226, 116.9, 22, 0, 2, 110 }, + /* 24*/ { BARCODE_EANX, 0, "123456789012", 0, 50, 1, 95, 226, 116.9, 22, 0, 2, 100 }, + /* 25*/ { BARCODE_EANX, 7, "123456789012", 0, 50, 1, 95, 226, 116.9, 22, 0, 2, 114 }, + /* 26*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276, 116.9, 22, 0, 2, 110 }, + /* 27*/ { BARCODE_EANX, -1, "123456789012+12", 0, 50, 1, 122, 276, 116.9, 262, 16.9, 4, 93.1 }, + /* 28*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 122, 276, 116.9, 22, 0, 2, 100 }, + /* 29*/ { BARCODE_EANX, 0, "123456789012+12", 0, 50, 1, 122, 276, 116.9, 262, 16.9, 4, 83.1 }, + /* 30*/ { BARCODE_EANX, 8.21, "123456789012+12", 0, 50, 1, 122, 276, 116.9, 22, 0, 2, 116.42 }, + /* 31*/ { BARCODE_EANX, 8.21, "123456789012+12", 0, 50, 1, 122, 276, 116.9, 262, 16.9, 4, 99.52 }, + /* 32*/ { BARCODE_ISBNX, -1, "123456789", 0, 50, 1, 95, 226, 116.9, 22, 0, 2, 110 }, + /* 33*/ { BARCODE_ISBNX, 0, "123456789", 0, 50, 1, 95, 226, 116.9, 22, 0, 2, 100 }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -1300,30 +1682,30 @@ static void test_quiet_zones(const testCtx *const p_ctx) { /* 14*/ { BARCODE_CODE39, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 50, 1, 77, 194, 118.9, 20, 0, 2, 100 }, /* 15*/ { BARCODE_EXCODE39, -1, -1, -1, "1234", 0, 50, 1, 77, 154, 118.9, 0, 0, 2, 100 }, /* 16*/ { BARCODE_EXCODE39, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 50, 1, 77, 194, 118.9, 20, 0, 2, 100 }, - /* 17*/ { BARCODE_EANX, -1, -1, -1, "023456789012", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 110 }, - /* 18*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "023456789012", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 110 }, - /* 19*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "023456789012", 0, 50, 1, 95, 212, 116.4, 22, 0, 2, 110 }, + /* 17*/ { BARCODE_EANX, -1, -1, -1, "023456789012", 0, 50, 1, 95, 226, 116.9, 22, 0, 2, 110 }, + /* 18*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "023456789012", 0, 50, 1, 95, 226, 116.9, 22, 0, 2, 110 }, + /* 19*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "023456789012", 0, 50, 1, 95, 212, 116.9, 22, 0, 2, 110 }, /* 20*/ { BARCODE_EANX, -1, -1, 0, "023456789012", 0, 50, 1, 95, 226, 110, 22, 0, 2, 110 }, /* Hide text */ /* 21*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, 0, "023456789012", 0, 50, 1, 95, 226, 110, 22, 0, 2, 110 }, /* Hide text */ /* 22*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, 0, "023456789012", 0, 50, 1, 95, 190, 110, 0, 0, 2, 110 }, /* Hide text */ - /* 23*/ { BARCODE_EANX, -1, -1, -1, "023456789012+12", 0, 50, 1, 122, 276, 116.4, 262, 19, 4, 91 }, - /* 24*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "023456789012+12", 0, 50, 1, 122, 276, 116.4, 262, 19, 4, 91 }, - /* 25*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "023456789012+12", 0, 50, 1, 122, 266, 116.4, 262, 19, 4, 91 }, - /* 26*/ { BARCODE_EANX, -1, -1, 0, "023456789012+12", 0, 50, 1, 122, 276, 110, 262, 19, 4, 91 }, /* Hide text */ - /* 27*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, 0, "023456789012+12", 0, 50, 1, 122, 276, 110, 262, 19, 4, 91 }, /* Hide text */ - /* 28*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, 0, "023456789012+12", 0, 50, 1, 122, 244, 110, 240, 19, 4, 91 }, /* Hide text */ - /* 29*/ { BARCODE_EANX_CHK, -1, -1, -1, "0234567890129+12345", 0, 50, 1, 149, 330, 116.4, 318, 19, 2, 91 }, - /* 30*/ { BARCODE_EANX_CHK, BARCODE_QUIET_ZONES, -1, -1, "0234567890129+12345", 0, 50, 1, 149, 330, 116.4, 318, 19, 2, 91 }, - /* 31*/ { BARCODE_EANX_CHK, BARCODE_NO_QUIET_ZONES, -1, -1, "0234567890129+12345", 0, 50, 1, 149, 320, 116.4, 318, 19, 2, 91 }, - /* 32*/ { BARCODE_EANX, -1, -1, -1, "0234567", 0, 50, 1, 67, 162, 116.4, 14, 0, 2, 110 }, /* EAN-8 */ - /* 33*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "0234567", 0, 50, 1, 67, 162, 116.4, 14, 0, 2, 110 }, /* EAN-8 */ - /* 34*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "0234567", 0, 50, 1, 67, 134, 116.4, 0, 0, 2, 110 }, /* EAN-8 */ - /* 35*/ { BARCODE_EANX, -1, -1, -1, "02345", 0, 50, 1, 47, 118, 116.4, 14, 0, 2, 100 }, /* EAN-5 */ - /* 36*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "02345", 0, 50, 1, 47, 118, 116.4, 14, 0, 2, 100 }, /* EAN-5 */ - /* 37*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "02345", 0, 50, 1, 47, 94, 116.4, 0, 0, 2, 100 }, /* EAN-5 */ - /* 38*/ { BARCODE_EANX, -1, -1, -1, "02", 0, 50, 1, 20, 64, 116.4, 14, 0, 2, 100 }, /* EAN-2 */ - /* 39*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "02", 0, 50, 1, 20, 64, 116.4, 14, 0, 2, 100 }, /* EAN-2 */ - /* 40*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "02", 0, 50, 1, 20, 40, 116.4, 0, 0, 2, 100 }, /* EAN-2 */ + /* 23*/ { BARCODE_EANX, -1, -1, -1, "023456789012+12", 0, 50, 1, 122, 276, 116.9, 262, 16.9, 4, 93.1 }, + /* 24*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "023456789012+12", 0, 50, 1, 122, 276, 116.9, 262, 16.9, 4, 93.1 }, + /* 25*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "023456789012+12", 0, 50, 1, 122, 266, 116.9, 262, 16.9, 4, 93.1 }, + /* 26*/ { BARCODE_EANX, -1, -1, 0, "023456789012+12", 0, 50, 1, 122, 276, 110, 262, 16.9, 4, 93.1 }, /* Hide text */ + /* 27*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, 0, "023456789012+12", 0, 50, 1, 122, 276, 110, 262, 16.9, 4, 93.1 }, /* Hide text */ + /* 28*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, 0, "023456789012+12", 0, 50, 1, 122, 244, 110, 240, 16.9, 4, 93.1 }, /* Hide text */ + /* 29*/ { BARCODE_EANX_CHK, -1, -1, -1, "0234567890129+12345", 0, 50, 1, 149, 330, 116.9, 318, 16.9, 2, 93.1 }, + /* 30*/ { BARCODE_EANX_CHK, BARCODE_QUIET_ZONES, -1, -1, "0234567890129+12345", 0, 50, 1, 149, 330, 116.9, 318, 16.9, 2, 93.1 }, + /* 31*/ { BARCODE_EANX_CHK, BARCODE_NO_QUIET_ZONES, -1, -1, "0234567890129+12345", 0, 50, 1, 149, 320, 116.9, 318, 16.9, 2, 93.1 }, + /* 32*/ { BARCODE_EANX, -1, -1, -1, "0234567", 0, 50, 1, 67, 162, 116.9, 14, 0, 2, 110 }, /* EAN-8 */ + /* 33*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "0234567", 0, 50, 1, 67, 162, 116.9, 14, 0, 2, 110 }, /* EAN-8 */ + /* 34*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "0234567", 0, 50, 1, 67, 134, 116.9, 0, 0, 2, 110 }, /* EAN-8 */ + /* 35*/ { BARCODE_EANX, -1, -1, -1, "02345", 0, 50, 1, 47, 118, 116.9, 14, 0, 2, 100 }, /* EAN-5 */ + /* 36*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "02345", 0, 50, 1, 47, 118, 116.9, 14, 0, 2, 100 }, /* EAN-5 */ + /* 37*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "02345", 0, 50, 1, 47, 94, 116.9, 0, 0, 2, 100 }, /* EAN-5 */ + /* 38*/ { BARCODE_EANX, -1, -1, -1, "02", 0, 50, 1, 20, 64, 116.9, 14, 0, 2, 100 }, /* EAN-2 */ + /* 39*/ { BARCODE_EANX, BARCODE_QUIET_ZONES, -1, -1, "02", 0, 50, 1, 20, 64, 116.9, 14, 0, 2, 100 }, /* EAN-2 */ + /* 40*/ { BARCODE_EANX, BARCODE_NO_QUIET_ZONES, -1, -1, "02", 0, 50, 1, 20, 40, 116.9, 0, 0, 2, 100 }, /* EAN-2 */ /* 41*/ { BARCODE_GS1_128, -1, -1, -1, "[20]02", 0, 50, 1, 68, 136, 118.9, 0, 0, 4, 100 }, /* 42*/ { BARCODE_GS1_128, BARCODE_QUIET_ZONES, -1, -1, "[20]02", 0, 50, 1, 68, 176, 118.9, 20, 0, 4, 100 }, /* 43*/ { BARCODE_CODABAR, -1, -1, -1, "A0B", 0, 50, 1, 32, 64, 118.9, 0, 0, 2, 100 }, @@ -1356,42 +1738,42 @@ static void test_quiet_zones(const testCtx *const p_ctx) { /* 70*/ { BARCODE_DBAR_EXP, BARCODE_NO_QUIET_ZONES, -1, -1, "[20]02", 0, 34, 1, 102, 204, 86.900002, 2, 0, 2, 68 }, /* 71*/ { BARCODE_TELEPEN, -1, -1, -1, "1234", 0, 50, 1, 112, 224, 118.9, 0, 0, 2, 100 }, /* 72*/ { BARCODE_TELEPEN, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 50, 1, 112, 264, 118.9, 20, 0, 2, 100 }, - /* 73*/ { BARCODE_UPCA, -1, -1, -1, "01457137763", 0, 50, 1, 95, 226, 116.4, 18, 0, 2, 110 }, - /* 74*/ { BARCODE_UPCA, BARCODE_QUIET_ZONES, -1, -1, "01457137763", 0, 50, 1, 95, 226, 116.4, 18, 0, 2, 110 }, - /* 75*/ { BARCODE_UPCA, BARCODE_NO_QUIET_ZONES, -1, -1, "01457137763", 0, 50, 1, 95, 226, 116.4, 18, 0, 2, 110 }, + /* 73*/ { BARCODE_UPCA, -1, -1, -1, "01457137763", 0, 50, 1, 95, 226, 116.9, 18, 0, 2, 110 }, + /* 74*/ { BARCODE_UPCA, BARCODE_QUIET_ZONES, -1, -1, "01457137763", 0, 50, 1, 95, 226, 116.9, 18, 0, 2, 110 }, + /* 75*/ { BARCODE_UPCA, BARCODE_NO_QUIET_ZONES, -1, -1, "01457137763", 0, 50, 1, 95, 226, 116.9, 18, 0, 2, 110 }, /* 76*/ { BARCODE_UPCA, -1, -1, 0, "01457137763", 0, 50, 1, 95, 226, 110, 18, 0, 2, 110 }, /* Hide text */ /* 77*/ { BARCODE_UPCA, BARCODE_QUIET_ZONES, -1, 0, "01457137763", 0, 50, 1, 95, 226, 110, 18, 0, 2, 110 }, /* Hide text */ /* 78*/ { BARCODE_UPCA, BARCODE_NO_QUIET_ZONES, -1, 0, "01457137763", 0, 50, 1, 95, 190, 110, 0, 0, 2, 110 }, /* Hide text */ - /* 79*/ { BARCODE_UPCA, -1, -1, -1, "01457137763+12", 0, 50, 1, 124, 276, 116.4, 18, 0, 2, 110 }, - /* 80*/ { BARCODE_UPCA, BARCODE_QUIET_ZONES, -1, -1, "01457137763+12", 0, 50, 1, 124, 276, 116.4, 18, 0, 2, 110 }, - /* 81*/ { BARCODE_UPCA, BARCODE_NO_QUIET_ZONES, -1, -1, "01457137763+12", 0, 50, 1, 124, 266, 116.4, 18, 0, 2, 110 }, + /* 79*/ { BARCODE_UPCA, -1, -1, -1, "01457137763+12", 0, 50, 1, 124, 276, 116.9, 18, 0, 2, 110 }, + /* 80*/ { BARCODE_UPCA, BARCODE_QUIET_ZONES, -1, -1, "01457137763+12", 0, 50, 1, 124, 276, 116.9, 18, 0, 2, 110 }, + /* 81*/ { BARCODE_UPCA, BARCODE_NO_QUIET_ZONES, -1, -1, "01457137763+12", 0, 50, 1, 124, 266, 116.9, 18, 0, 2, 110 }, /* 82*/ { BARCODE_UPCA, -1, -1, 0, "01457137763+12", 0, 50, 1, 124, 276, 110, 18, 0, 2, 110 }, /* Hide text */ /* 83*/ { BARCODE_UPCA, BARCODE_QUIET_ZONES, -1, 0, "01457137763+12", 0, 50, 1, 124, 276, 110, 18, 0, 2, 110 }, /* Hide text */ /* 84*/ { BARCODE_UPCA, BARCODE_NO_QUIET_ZONES, -1, 0, "01457137763+12", 0, 50, 1, 124, 248, 110, 0, 0, 2, 110 }, /* Hide text */ - /* 85*/ { BARCODE_UPCA_CHK, -1, -1, -1, "014571377638+12345", 0, 50, 1, 151, 330, 116.4, 18, 0, 2, 110 }, - /* 86*/ { BARCODE_UPCA_CHK, BARCODE_QUIET_ZONES, -1, -1, "014571377638+12345", 0, 50, 1, 151, 330, 116.4, 18, 0, 2, 110 }, - /* 87*/ { BARCODE_UPCA_CHK, BARCODE_NO_QUIET_ZONES, -1, -1, "014571377638+12345", 0, 50, 1, 151, 320, 116.4, 18, 0, 2, 110 }, + /* 85*/ { BARCODE_UPCA_CHK, -1, -1, -1, "014571377638+12345", 0, 50, 1, 151, 330, 116.9, 18, 0, 2, 110 }, + /* 86*/ { BARCODE_UPCA_CHK, BARCODE_QUIET_ZONES, -1, -1, "014571377638+12345", 0, 50, 1, 151, 330, 116.9, 18, 0, 2, 110 }, + /* 87*/ { BARCODE_UPCA_CHK, BARCODE_NO_QUIET_ZONES, -1, -1, "014571377638+12345", 0, 50, 1, 151, 320, 116.9, 18, 0, 2, 110 }, /* 88*/ { BARCODE_UPCA_CHK, -1, -1, 0, "014571377638+12345", 0, 50, 1, 151, 330, 110, 18, 0, 2, 110 }, /* Hide text */ /* 89*/ { BARCODE_UPCA_CHK, BARCODE_QUIET_ZONES, -1, 0, "014571377638+12345", 0, 50, 1, 151, 330, 110, 18, 0, 2, 110 }, /* Hide text */ /* 90*/ { BARCODE_UPCA_CHK, BARCODE_NO_QUIET_ZONES, -1, 0, "014571377638+12345", 0, 50, 1, 151, 302, 110, 0, 0, 2, 110 }, /* Hide text */ - /* 91*/ { BARCODE_UPCE, -1, -1, -1, "8145713", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 110 }, - /* 92*/ { BARCODE_UPCE, BARCODE_QUIET_ZONES, -1, -1, "8145713", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 110 }, - /* 93*/ { BARCODE_UPCE, BARCODE_NO_QUIET_ZONES, -1, -1, "8145713", 0, 50, 1, 51, 134, 116.4, 18, 0, 2, 110 }, + /* 91*/ { BARCODE_UPCE, -1, -1, -1, "8145713", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 110 }, + /* 92*/ { BARCODE_UPCE, BARCODE_QUIET_ZONES, -1, -1, "8145713", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 110 }, + /* 93*/ { BARCODE_UPCE, BARCODE_NO_QUIET_ZONES, -1, -1, "8145713", 0, 50, 1, 51, 134, 116.9, 18, 0, 2, 110 }, /* 94*/ { BARCODE_UPCE, -1, -1, 0, "8145713", 0, 50, 1, 51, 134, 110, 18, 0, 2, 110 }, /* Hide text */ /* 95*/ { BARCODE_UPCE, BARCODE_QUIET_ZONES, -1, 0, "8145713", 0, 50, 1, 51, 134, 110, 18, 0, 2, 110 }, /* Hide text */ /* 96*/ { BARCODE_UPCE, BARCODE_NO_QUIET_ZONES, -1, 0, "8145713", 0, 50, 1, 51, 102, 110, 0, 0, 2, 110 }, /* Hide text */ - /* 97*/ { BARCODE_UPCE_CHK, -1, -1, -1, "81457132+12", 0, 50, 1, 78, 184, 116.4, 170, 19, 4, 81 }, - /* 98*/ { BARCODE_UPCE_CHK, BARCODE_QUIET_ZONES, -1, -1, "81457132+12", 0, 50, 1, 78, 184, 116.4, 170, 19, 4, 81 }, - /* 99*/ { BARCODE_UPCE_CHK, BARCODE_NO_QUIET_ZONES, -1, -1, "81457132+12", 0, 50, 1, 78, 174, 116.4, 170, 19, 4, 81 }, - /*100*/ { BARCODE_UPCE_CHK, -1, -1, 0, "81457132+12", 0, 50, 1, 78, 184, 110, 170, 19, 4, 81 }, /* Hide text */ - /*101*/ { BARCODE_UPCE_CHK, BARCODE_QUIET_ZONES, -1, 0, "81457132+12", 0, 50, 1, 78, 184, 110, 170, 19, 4, 81 }, /* Hide text */ - /*102*/ { BARCODE_UPCE_CHK, BARCODE_NO_QUIET_ZONES, -1, 0, "81457132+12", 0, 50, 1, 78, 156, 110, 152, 19, 4, 81 }, /* Hide text */ - /*103*/ { BARCODE_UPCE, -1, -1, -1, "8145713+12345", 0, 50, 1, 105, 238, 116.4, 226, 19, 2, 81 }, - /*104*/ { BARCODE_UPCE, BARCODE_QUIET_ZONES, -1, -1, "8145713+12345", 0, 50, 1, 105, 238, 116.4, 226, 19, 2, 81 }, - /*105*/ { BARCODE_UPCE, BARCODE_NO_QUIET_ZONES, -1, -1, "8145713+12345", 0, 50, 1, 105, 228, 116.4, 226, 19, 2, 81 }, - /*106*/ { BARCODE_UPCE, -1, -1, 0, "8145713+12345", 0, 50, 1, 105, 238, 110, 226, 19, 2, 81 }, /* Hide text */ - /*107*/ { BARCODE_UPCE, BARCODE_QUIET_ZONES, -1, 0, "8145713+12345", 0, 50, 1, 105, 238, 110, 226, 19, 2, 81 }, /* Hide text */ - /*108*/ { BARCODE_UPCE, BARCODE_NO_QUIET_ZONES, -1, 0, "8145713+12345", 0, 50, 1, 105, 210, 110, 208, 19, 2, 81 }, /* Hide text */ + /* 97*/ { BARCODE_UPCE_CHK, -1, -1, -1, "81457132+12", 0, 50, 1, 78, 184, 116.9, 170, 16.9, 4, 83.1 }, + /* 98*/ { BARCODE_UPCE_CHK, BARCODE_QUIET_ZONES, -1, -1, "81457132+12", 0, 50, 1, 78, 184, 116.9, 170, 16.9, 4, 83.1 }, + /* 99*/ { BARCODE_UPCE_CHK, BARCODE_NO_QUIET_ZONES, -1, -1, "81457132+12", 0, 50, 1, 78, 174, 116.9, 170, 16.9, 4, 83.1 }, + /*100*/ { BARCODE_UPCE_CHK, -1, -1, 0, "81457132+12", 0, 50, 1, 78, 184, 110, 170, 16.9, 4, 83.1 }, /* Hide text */ + /*101*/ { BARCODE_UPCE_CHK, BARCODE_QUIET_ZONES, -1, 0, "81457132+12", 0, 50, 1, 78, 184, 110, 170, 16.9, 4, 83.1 }, /* Hide text */ + /*102*/ { BARCODE_UPCE_CHK, BARCODE_NO_QUIET_ZONES, -1, 0, "81457132+12", 0, 50, 1, 78, 156, 110, 152, 16.9, 4, 83.1 }, /* Hide text */ + /*103*/ { BARCODE_UPCE, -1, -1, -1, "8145713+12345", 0, 50, 1, 105, 238, 116.9, 226, 16.9, 2, 83.1 }, + /*104*/ { BARCODE_UPCE, BARCODE_QUIET_ZONES, -1, -1, "8145713+12345", 0, 50, 1, 105, 238, 116.9, 226, 16.9, 2, 83.1 }, + /*105*/ { BARCODE_UPCE, BARCODE_NO_QUIET_ZONES, -1, -1, "8145713+12345", 0, 50, 1, 105, 228, 116.9, 226, 16.9, 2, 83.1 }, + /*106*/ { BARCODE_UPCE, -1, -1, 0, "8145713+12345", 0, 50, 1, 105, 238, 110, 226, 16.9, 2, 83.1 }, /* Hide text */ + /*107*/ { BARCODE_UPCE, BARCODE_QUIET_ZONES, -1, 0, "8145713+12345", 0, 50, 1, 105, 238, 110, 226, 16.9, 2, 83.1 }, /* Hide text */ + /*108*/ { BARCODE_UPCE, BARCODE_NO_QUIET_ZONES, -1, 0, "8145713+12345", 0, 50, 1, 105, 210, 110, 208, 16.9, 2, 83.1 }, /* Hide text */ /*109*/ { BARCODE_POSTNET, -1, -1, -1, "12345", 0, 12, 2, 63, 126, 24, 0, 0, 2, 24 }, /*110*/ { BARCODE_POSTNET, BARCODE_QUIET_ZONES, -1, -1, "12345", 0, 12, 2, 63, 146, 30.4, 10, 3.2, 2, 24 }, /*111*/ { BARCODE_MSI_PLESSEY, -1, -1, -1, "1234", 0, 50, 1, 55, 110, 118.9, 0, 0, 4, 100 }, @@ -1426,9 +1808,9 @@ static void test_quiet_zones(const testCtx *const p_ctx) { /*140*/ { BARCODE_AUSROUTE, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 8, 3, 73, 186, 29.333332, 20, 6.6666665, 2, 10 }, /*141*/ { BARCODE_AUSREDIRECT, -1, -1, -1, "1234", 0, 8, 3, 73, 146, 16, 0, 0, 2, 10 }, /*142*/ { BARCODE_AUSREDIRECT, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 8, 3, 73, 186, 29.333332, 20, 6.6666665, 2, 10 }, - /*143*/ { BARCODE_ISBNX, -1, -1, -1, "123456789X", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 110 }, - /*144*/ { BARCODE_ISBNX, BARCODE_QUIET_ZONES, -1, -1, "123456789X", 0, 50, 1, 95, 226, 116.4, 22, 0, 2, 110 }, - /*145*/ { BARCODE_ISBNX, BARCODE_NO_QUIET_ZONES, -1, -1, "123456789X", 0, 50, 1, 95, 212, 116.4, 22, 0, 2, 110 }, + /*143*/ { BARCODE_ISBNX, -1, -1, -1, "123456789X", 0, 50, 1, 95, 226, 116.9, 22, 0, 2, 110 }, + /*144*/ { BARCODE_ISBNX, BARCODE_QUIET_ZONES, -1, -1, "123456789X", 0, 50, 1, 95, 226, 116.9, 22, 0, 2, 110 }, + /*145*/ { BARCODE_ISBNX, BARCODE_NO_QUIET_ZONES, -1, -1, "123456789X", 0, 50, 1, 95, 212, 116.9, 22, 0, 2, 110 }, /*146*/ { BARCODE_RM4SCC, -1, -1, -1, "1234", 0, 8, 3, 43, 86, 16, 0, 0, 2, 10 }, /*147*/ { BARCODE_RM4SCC, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 8, 3, 43, 98.283463, 28.283464, 6.1417322, 6.1417322, 2, 10 }, /*148*/ { BARCODE_DATAMATRIX, -1, -1, -1, "1234", 0, 10, 10, 10, 20, 20, 0, 0, 2, 2 }, @@ -1513,9 +1895,9 @@ static void test_quiet_zones(const testCtx *const p_ctx) { /*227*/ { BARCODE_AZRUNE, BARCODE_NO_QUIET_ZONES, -1, -1, "123", 0, 11, 11, 11, 22, 22, 0, 0, 8, 2 }, /*228*/ { BARCODE_CODE32, -1, -1, -1, "1234", 0, 50, 1, 103, 206, 118.9, 0, 0, 2, 100 }, /*229*/ { BARCODE_CODE32, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 50, 1, 103, 246, 118.9, 20, 0, 2, 100 }, - /*230*/ { BARCODE_EANX_CC, -1, -1, -1, "023456789012", 0, 50, 7, 99, 234, 116.4, 32, 24, 2, 86 }, - /*231*/ { BARCODE_EANX_CC, BARCODE_QUIET_ZONES, -1, -1, "023456789012", 0, 50, 7, 99, 234, 116.4, 32, 24, 2, 86 }, - /*232*/ { BARCODE_EANX_CC, BARCODE_NO_QUIET_ZONES, -1, -1, "023456789012", 0, 50, 7, 99, 220, 116.4, 32, 24, 2, 86 }, + /*230*/ { BARCODE_EANX_CC, -1, -1, -1, "023456789012", 0, 50, 7, 99, 234, 116.9, 32, 24, 2, 86 }, + /*231*/ { BARCODE_EANX_CC, BARCODE_QUIET_ZONES, -1, -1, "023456789012", 0, 50, 7, 99, 234, 116.9, 32, 24, 2, 86 }, + /*232*/ { BARCODE_EANX_CC, BARCODE_NO_QUIET_ZONES, -1, -1, "023456789012", 0, 50, 7, 99, 220, 116.9, 32, 24, 2, 86 }, /*233*/ { BARCODE_EANX_CC, -1, -1, 0, "023456789012", 0, 50, 7, 99, 234, 110, 32, 24, 2, 86 }, /* Hide text */ /*234*/ { BARCODE_EANX_CC, BARCODE_QUIET_ZONES, -1, 0, "023456789012", 0, 50, 7, 99, 234, 110, 32, 24, 2, 86 }, /* Hide text */ /*235*/ { BARCODE_EANX_CC, BARCODE_NO_QUIET_ZONES, -1, 0, "023456789012", 0, 50, 7, 99, 198, 110, 10, 24, 2, 86 }, /* Hide text */ @@ -1527,15 +1909,15 @@ static void test_quiet_zones(const testCtx *const p_ctx) { /*241*/ { BARCODE_DBAR_LTD_CC, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 19, 6, 79, 162, 56.900002, 4, 18, 2, 20 }, /*242*/ { BARCODE_DBAR_EXP_CC, -1, -1, -1, "[20]12", 0, 41, 5, 102, 204, 100.9, 2, 14, 2, 68 }, /*243*/ { BARCODE_DBAR_EXP_CC, BARCODE_QUIET_ZONES, -1, -1, "[20]12", 0, 41, 5, 102, 208, 100.9, 4, 14, 2, 68 }, - /*244*/ { BARCODE_UPCA_CC, -1, -1, -1, "01457137763", 0, 50, 7, 99, 234, 116.4, 24, 20, 2, 90 }, - /*245*/ { BARCODE_UPCA_CC, BARCODE_QUIET_ZONES, -1, -1, "01457137763", 0, 50, 7, 99, 234, 116.4, 24, 20, 2, 90 }, - /*246*/ { BARCODE_UPCA_CC, BARCODE_NO_QUIET_ZONES, -1, -1, "01457137763", 0, 50, 7, 99, 234, 116.4, 24, 20, 2, 90 }, + /*244*/ { BARCODE_UPCA_CC, -1, -1, -1, "01457137763", 0, 50, 7, 99, 234, 116.9, 24, 20, 2, 90 }, + /*245*/ { BARCODE_UPCA_CC, BARCODE_QUIET_ZONES, -1, -1, "01457137763", 0, 50, 7, 99, 234, 116.9, 24, 20, 2, 90 }, + /*246*/ { BARCODE_UPCA_CC, BARCODE_NO_QUIET_ZONES, -1, -1, "01457137763", 0, 50, 7, 99, 234, 116.9, 24, 20, 2, 90 }, /*247*/ { BARCODE_UPCA_CC, -1, -1, 0, "01457137763", 0, 50, 7, 99, 234, 110, 24, 20, 2, 90 }, /* Hide text */ /*248*/ { BARCODE_UPCA_CC, BARCODE_QUIET_ZONES, -1, 0, "01457137763", 0, 50, 7, 99, 234, 110, 24, 20, 2, 90 }, /* Hide text */ /*249*/ { BARCODE_UPCA_CC, BARCODE_NO_QUIET_ZONES, -1, 0, "01457137763", 0, 50, 7, 99, 198, 110, 6, 20, 2, 90 }, /* Hide text */ - /*250*/ { BARCODE_UPCE_CC, -1, -1, -1, "8145713", 0, 50, 9, 55, 142, 116.4, 24, 28, 2, 82 }, - /*251*/ { BARCODE_UPCE_CC, BARCODE_QUIET_ZONES, -1, -1, "8145713", 0, 50, 9, 55, 142, 116.4, 24, 28, 2, 82 }, - /*252*/ { BARCODE_UPCE_CC, BARCODE_NO_QUIET_ZONES, -1, -1, "8145713", 0, 50, 9, 55, 142, 116.4, 24, 28, 2, 82 }, + /*250*/ { BARCODE_UPCE_CC, -1, -1, -1, "8145713", 0, 50, 9, 55, 142, 116.9, 24, 28, 2, 82 }, + /*251*/ { BARCODE_UPCE_CC, BARCODE_QUIET_ZONES, -1, -1, "8145713", 0, 50, 9, 55, 142, 116.9, 24, 28, 2, 82 }, + /*252*/ { BARCODE_UPCE_CC, BARCODE_NO_QUIET_ZONES, -1, -1, "8145713", 0, 50, 9, 55, 142, 116.9, 24, 28, 2, 82 }, /*253*/ { BARCODE_UPCE_CC, -1, -1, 0, "8145713", 0, 50, 9, 55, 142, 110, 24, 28, 2, 82 }, /* Hide text */ /*254*/ { BARCODE_UPCE_CC, BARCODE_QUIET_ZONES, -1, 0, "8145713", 0, 50, 9, 55, 142, 110, 24, 28, 2, 82 }, /* Hide text */ /*255*/ { BARCODE_UPCE_CC, BARCODE_NO_QUIET_ZONES, -1, 0, "8145713", 0, 50, 9, 55, 110, 110, 6, 28, 2, 82 }, /* Hide text */ @@ -1636,6 +2018,149 @@ static void test_quiet_zones(const testCtx *const p_ctx) { testFinish(); } +static void test_text_gap(const testCtx *const p_ctx) { + int debug = p_ctx->debug; + + struct item { + int symbology; + int output_options; + int option_2; + int show_hrt; + float text_gap; + float scale; + char *data; + char *composite; + int ret; + + float expected_height; + int expected_rows; + int expected_width; + float expected_vector_width; + float expected_vector_height; + float expected_set_x; + float expected_set_y; + float expected_set_width; + float expected_set_height; + }; + /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ + struct item data[] = { + /* 0*/ { BARCODE_CODE11, -1, -1, -1, 0, 0, "1234", "", 0, 50, 1, 62, 124, 118.9, 62.0, 114.0, -1, -1 }, /* Default */ + /* 1*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 0, "1234", "", 0, 50, 1, 62, 124, 117.7, 62.0, 112.8, -1, -1 }, + /* 2*/ { BARCODE_CODE11, -1, -1, -1, 0.2, 0, "1234", "", 0, 50, 1, 62, 124, 117.9, 62.0, 113, -1, -1 }, + /* 3*/ { BARCODE_CODE11, -1, -1, -1, 0.3, 0, "1234", "", 0, 50, 1, 62, 124, 118.1, 62.0, 113.2, -1, -1 }, + /* 4*/ { BARCODE_CODE11, -1, -1, -1, 0.4, 0, "1234", "", 0, 50, 1, 62, 124, 118.3, 62.0, 113.4, -1, -1 }, + /* 5*/ { BARCODE_CODE11, -1, -1, -1, 0.5, 0, "1234", "", 0, 50, 1, 62, 124, 118.5, 62.0, 113.6, -1, -1 }, + /* 6*/ { BARCODE_CODE11, -1, -1, -1, 0.6, 0, "1234", "", 0, 50, 1, 62, 124, 118.7, 62.0, 113.799995, -1, -1 }, + /* 7*/ { BARCODE_CODE11, -1, -1, -1, 0.7, 0, "1234", "", 0, 50, 1, 62, 124, 118.9, 62.0, 114, -1, -1 }, + /* 8*/ { BARCODE_CODE11, -1, -1, -1, 0.75, 0, "1234", "", 0, 50, 1, 62, 124, 119, 62.0, 114.1, -1, -1 }, /* Same as default */ + /* 9*/ { BARCODE_CODE11, -1, -1, -1, 0.8, 0, "1234", "", 0, 50, 1, 62, 124, 119.1, 62.0, 114.2, -1, -1 }, + /* 10*/ { BARCODE_CODE11, -1, -1, -1, 0.9, 0, "1234", "", 0, 50, 1, 62, 124, 119.3, 62.0, 114.4, -1, -1 }, + /* 11*/ { BARCODE_CODE11, -1, -1, -1, 1.0, 0, "1234", "", 0, 50, 1, 62, 124, 119.5, 62.0, 114.6, -1, -1 }, + /* 12*/ { BARCODE_CODE11, -1, -1, -1, 1.1, 0, "1234", "", 0, 50, 1, 62, 124, 119.7, 62.0, 114.799995, -1, -1 }, + /* 13*/ { BARCODE_CODE11, -1, -1, -1, 1.5, 0, "1234", "", 0, 50, 1, 62, 124, 120.5, 62.0, 115.6, -1, -1 }, + /* 14*/ { BARCODE_CODE11, -1, -1, -1, 2.0, 0, "1234", "", 0, 50, 1, 62, 124, 121.5, 62.0, 116.6, -1, -1 }, + /* 15*/ { BARCODE_CODE11, -1, -1, -1, 3.0, 0, "1234", "", 0, 50, 1, 62, 124, 123.5, 62.0, 118.6, -1, -1 }, + /* 16*/ { BARCODE_CODE11, -1, -1, -1, 4.0, 0, "1234", "", 0, 50, 1, 62, 124, 125.5, 62.0, 120.6, -1, -1 }, + /* 17*/ { BARCODE_CODE11, -1, -1, -1, 5.0, 0, "1234", "", 0, 50, 1, 62, 124, 127.5, 62.0, 122.6, -1, -1 }, + /* 18*/ { BARCODE_CODE11, -1, -1, -1, 0, 3.0, "1234", "", 0, 50, 1, 62, 372, 356.7, 186.0, 342.0, -1, -1 }, /* Scale default */ + /* 19*/ { BARCODE_CODE11, -1, -1, -1, 0.1, 3.0, "1234", "", 0, 50, 1, 62, 372, 353.09998, 186.0, 338.4, -1, -1 }, /* Scale */ + /* 20*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763", "", 0, 50, 1, 95, 226, 116.9, 74.0, 116.1, -1, -1 }, /* Default */ + /* 21*/ { BARCODE_UPCA, -1, -1, -1, 0.1, 0, "01457130763", "", 0, 50, 1, 95, 226, 115.6, 74.0, 114.799995, -1, -1 }, + /* 22*/ { BARCODE_UPCA, -1, -1, -1, 0.6, 0, "01457130763", "", 0, 50, 1, 95, 226, 116.6, 74.0, 115.799995, -1, -1 }, + /* 23*/ { BARCODE_UPCA, -1, -1, -1, 0.7, 0, "01457130763", "", 0, 50, 1, 95, 226, 116.8, 74.0, 116, -1, -1 }, + /* 24*/ { BARCODE_UPCA, -1, -1, -1, 0.75, 0, "01457130763", "", 0, 50, 1, 95, 226, 116.9, 74.0, 116.1, -1, -1 }, /* Same as default */ + /* 25*/ { BARCODE_UPCA, -1, -1, -1, 0.8, 0, "01457130763", "", 0, 50, 1, 95, 226, 117, 74.0, 116.2, -1, -1 }, + /* 26*/ { BARCODE_UPCA, -1, -1, -1, 1.6, 0, "01457130763", "", 0, 50, 1, 95, 226, 118.6, 74.0, 117.799995, -1, -1 }, + /* 27*/ { BARCODE_UPCA, -1, -1, -1, 1.6, 2.5, "01457130763", "", 0, 50, 1, 95, 565, 296.5, 185.0, 294.5, -1, -1 }, /* Scale */ + /* 28*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116.9, 74.0, 116.1, -1, -1 }, /* Default */ + /* 29*/ { BARCODE_UPCA, -1, -1, -1, 0, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116.9, 230.0, 16.9, 4.0, 83.1 }, /* Default */ + /* 30*/ { BARCODE_UPCA, -1, -1, -1, 0.1, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 115.6, 230.0, 15.5999994, 4.0, 84.4 }, + /* 31*/ { BARCODE_UPCA, -1, -1, -1, 0.75, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 116.9, 230.0, 16.9, 4.0, 83.1 }, /* Same as default */ + /* 32*/ { BARCODE_UPCA, -1, -1, -1, 0.9, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 117.2, 230.0, 17.1999989, 4.0, 82.8 }, + /* 33*/ { BARCODE_UPCA, -1, -1, -1, 4.2, 0, "01457130763+10", "", 0, 50, 1, 124, 276, 123.8, 230.0, 23.8, 4.0, 76.2 }, + /* 34*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 116.9, 80.0, 116.1, -1, -1 }, /* Default */ + /* 35*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.1, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 115.6, 80.0, 114.799995, -1, -1 }, + /* 36*/ { BARCODE_UPCA_CC, -1, -1, -1, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 116.9, 236.0, 40.9, 4.0, 59.1 }, /* Default */ + /* 37*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.1, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 115.6, 236.0, 39.6000023, 4.0, 60.3999977 }, + /* 38*/ { BARCODE_UPCA_CC, -1, -1, -1, 0.75, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 116.9, 236.0, 40.9, 4.0, 59.1 }, /* Same as default */ + /* 39*/ { BARCODE_UPCA_CC, -1, -1, -1, 1.5, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 118.4, 236.0, 42.4, 4.0, 57.6 }, + /* 40*/ { BARCODE_UPCA_CC, -1, -1, 0, 0, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 110, 236.0, 40.9, 4.0, 59.1 }, /* Hide text default */ + /* 41*/ { BARCODE_UPCA_CC, -1, -1, 0, 1.5, 0, "01457130763+10", "[91]12", 0, 50, 7, 128, 284, 110, 236.0, 42.4, 4.0, 57.6 }, /* Hide text */ + }; + int data_size = ARRAY_SIZE(data); + int i, length, ret; + struct zint_symbol *symbol; + + const char *text; + + struct zint_vector_string *string; + struct zint_vector_rect *rect; + + testStart("test_text_gap"); + + for (i = 0; i < data_size; i++) { + + if (testContinue(p_ctx, i)) continue; + + symbol = ZBarcode_Create(); + assert_nonnull(symbol, "Symbol not created\n"); + + if (data[i].show_hrt != -1) { + symbol->show_hrt = data[i].show_hrt; + } + symbol->text_gap = data[i].text_gap; + if (data[i].scale != 0.0f) { + symbol->scale = data[i].scale; + } + + if (strlen(data[i].composite)) { + text = data[i].composite; + strcpy(symbol->primary, data[i].data); + } else { + text = data[i].data; + } + length = testUtilSetSymbol(symbol, data[i].symbology, -1 /*input_mode*/, -1 /*eci*/, -1 /*option_1*/, data[i].option_2, -1, data[i].output_options, text, -1, debug); + + ret = ZBarcode_Encode(symbol, (unsigned char *) text, length); + assert_zero(ret, "i:%d ZBarcode_Encode(%d) ret %d != 0 %s\n", i, data[i].symbology, ret, symbol->errtxt); + + ret = ZBarcode_Buffer_Vector(symbol, 0); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Buffer_Vector(%d) ret %d != %d\n", i, data[i].symbology, ret, data[i].ret); + + if (ret < ZINT_ERROR) { + assert_nonnull(symbol->vector, "i:%d ZBarcode_Buffer_Vector(%d) vector NULL\n", i, data[i].symbology); + + if (p_ctx->index != -1 && (debug & ZINT_DEBUG_TEST_PRINT)) { /* ZINT_DEBUG_TEST_PRINT 16 */ + sprintf(symbol->outfile, "test_text_gap_%d.svg", i); + ZBarcode_Print(symbol, 0); + } + + assert_equal(symbol->height, data[i].expected_height, "i:%d (%d) symbol->height %.8g != %.8g\n", i, data[i].symbology, symbol->height, data[i].expected_height); + assert_equal(symbol->rows, data[i].expected_rows, "i:%d (%d) symbol->rows %d != %d\n", i, data[i].symbology, symbol->rows, data[i].expected_rows); + assert_equal(symbol->width, data[i].expected_width, "i:%d (%d) symbol->width %d != %d\n", i, data[i].symbology, symbol->width, data[i].expected_width); + + assert_equal(symbol->vector->width, data[i].expected_vector_width, "i:%d (%s) symbol->vector->width %.8g != %.8g\n", + i, testUtilBarcodeName(data[i].symbology), symbol->vector->width, data[i].expected_vector_width); + assert_equal(symbol->vector->height, data[i].expected_vector_height, "i:%d (%s) symbol->vector->height %.8g != %.8g\n", + i, testUtilBarcodeName(data[i].symbology), symbol->vector->height, data[i].expected_vector_height); + + if (data[i].expected_set_width == -1.0f) { + string = find_string(symbol, data[i].expected_set_x, data[i].expected_set_y); + assert_nonnull(string, "i:%d (%d) find_string(%g, %g) NULL\n", + i, data[i].symbology, data[i].expected_set_x, data[i].expected_set_y); + } else { + rect = find_rect(symbol, data[i].expected_set_x, data[i].expected_set_y, data[i].expected_set_width, data[i].expected_set_height); + assert_nonnull(rect, "i:%d (%d) find_rect(%g, %g, %g, %g) NULL\n", + i, data[i].symbology, data[i].expected_set_x, data[i].expected_set_y, data[i].expected_set_width, data[i].expected_set_height); + } + } + + ZBarcode_Delete(symbol); + } + + testFinish(); +} + static void test_height(const testCtx *const p_ctx) { int debug = p_ctx->debug; @@ -2511,6 +3036,7 @@ int main(int argc, char *argv[]) { { "test_scale", test_scale }, { "test_guard_descent", test_guard_descent }, { "test_quiet_zones", test_quiet_zones }, + { "test_text_gap", test_text_gap, }, { "test_height", test_height }, { "test_height_per_row", test_height_per_row }, }; diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 3288841a..1a8d9e25 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -364,7 +364,7 @@ int testContinue(const testCtx *const p_ctx, const int i) { /* Helper to set common symbol fields */ int testUtilSetSymbol(struct zint_symbol *symbol, int symbology, int input_mode, int eci, int option_1, int option_2, - int option_3, int output_options, char *data, int length, int debug) { + int option_3, int output_options, const char *data, int length, int debug) { symbol->symbology = symbology; if (input_mode != -1) { symbol->input_mode = input_mode; diff --git a/backend/tests/testcommon.h b/backend/tests/testcommon.h index 6e7f6327..2ff123dc 100644 --- a/backend/tests/testcommon.h +++ b/backend/tests/testcommon.h @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -129,7 +129,7 @@ void assert_notequal(int e1, int e2, const char *fmt, ...); INTERNAL void vector_free(struct zint_symbol *symbol); /* Free vector structures */ int testUtilSetSymbol(struct zint_symbol *symbol, int symbology, int input_mode, int eci, - int option_1, int option_2, int option_3, int output_options, char *data, int length, int debug); + int option_1, int option_2, int option_3, int output_options, const char *data, int length, int debug); const char *testUtilBarcodeName(int symbology); const char *testUtilErrorName(int error_number); diff --git a/backend/vector.c b/backend/vector.c index 012b261e..d572d861 100644 --- a/backend/vector.c +++ b/backend/vector.c @@ -1,7 +1,7 @@ /* vector.c - Creates vector image objects */ /* libzint - the open source barcode library - Copyright (C) 2018-2022 Robin Stuart + Copyright (C) 2018-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -126,7 +126,7 @@ static void vector_plot_add_circle(struct zint_symbol *symbol, struct zint_vecto *last_circle = circle; } -static int vector_plot_add_string(struct zint_symbol *symbol, const unsigned char *text, +static int vector_plot_add_string(struct zint_symbol *symbol, const unsigned char *text, const int length, const float x, const float y, const float fsize, const float width, const int halign, struct zint_vector_string **last_string) { struct zint_vector_string *string; @@ -141,7 +141,7 @@ static int vector_plot_add_string(struct zint_symbol *symbol, const unsigned cha string->y = y; string->width = width; string->fsize = fsize; - string->length = (int) ustrlen(text); + string->length = length == -1 ? (int) ustrlen(text) : length; string->rotation = 0; string->halign = halign; string->text = (unsigned char *) malloc(string->length + 1); @@ -150,7 +150,8 @@ static int vector_plot_add_string(struct zint_symbol *symbol, const unsigned cha strcpy(symbol->errtxt, "695: Insufficient memory for vector string text"); return 0; } - ustrcpy(string->text, text); + memcpy(string->text, text, string->length); + string->text[string->length] = '\0'; if (*last_string) (*last_string)->next = string; @@ -398,7 +399,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ float textoffset; int upceanflag = 0; int addon_latch = 0; - unsigned char textpart1[5], textpart2[7], textpart3[7], textpart4[2]; + unsigned char textparts[4][7]; int hide_text; int i, r; int block_width = 0; @@ -408,13 +409,22 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ const int is_codablockf = symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF; const int no_extend = is_codablockf || symbol->symbology == BARCODE_DPD; - float addon_row_height; float large_bar_height; + const float descent_factor = 0.1f; /* Assuming descent roughly 10% of font size */ + + /* For UPC/EAN only */ + float addon_row_yposn; + float addon_row_height; int upcae_outside_text_height = 0; /* UPC-A/E outside digits font size */ - float digit_ascent_factor = 0.25f; /* Assuming digit ascent roughly 25% less than font size */ + /* Note using "ascender" to mean height above digits as "ascent" usually measured from baseline */ + const float digit_ascender_factor = 0.25f; /* Assuming digit ascender height roughly 25% of font size */ + float digit_ascender = 0.0f; /* Avoid gcc -Wmaybe-uninitialized */ + const float antialias_fudge_factor = 0.02f; + float antialias_fudge = 0.0f; /* Avoid gcc -Wmaybe-uninitialized */ + int rect_count = 0, last_row_start = 0; /* For UPC/EAN guard bars */ + float dot_overspill = 0.0f; float dot_offset = 0.0f; - int rect_count = 0, last_row_start = 0; /* For UPC/EAN guard bars */ float yposn; struct zint_vector *vector; @@ -461,18 +471,21 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ out_set_whitespace_offsets(symbol, hide_text, &xoffset, &yoffset, &roffset, &boffset, 0 /*scaler*/, NULL, NULL, NULL, NULL); + /* Note font sizes scaled by 2 so really twice these values */ if (upceanflag) { /* Note BOLD_TEXT ignored for UPCEAN by svg/emf/ps/qzint */ text_height = symbol->output_options & SMALL_TEXT ? 7 : 10; + digit_ascender = text_height * digit_ascender_factor; /* Digit ascender is unused (empty) */ + antialias_fudge = text_height * antialias_fudge_factor; upcae_outside_text_height = symbol->output_options & SMALL_TEXT ? 6 : 7; - /* Negative to move close to barcode (less digit ascent, then add 0.5X) */ - text_gap = -text_height * digit_ascent_factor + 0.5f; + /* Note default 0.75 was 0.5 (minimum per standard) but that looks too close */ + text_gap = (symbol->text_gap ? symbol->text_gap : 0.75f) - digit_ascender; /* Guard bar height (none for EAN-2 and EAN-5) */ guard_descent = upceanflag != 2 && upceanflag != 5 ? symbol->guard_descent : 0.0f; } else { text_height = symbol->output_options & SMALL_TEXT ? 6 : 7; - text_gap = text_height * 0.1f; + text_gap = symbol->text_gap ? symbol->text_gap : text_height * 0.1f; guard_descent = 0.0f; } @@ -480,10 +493,9 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ textoffset = guard_descent; } else { if (upceanflag) { - /* Add fudge for anti-aliasing of digits */ - if (text_height + 0.2f + text_gap > guard_descent) { - textoffset = text_height + 0.2f + text_gap; - } else { + /* Add fudge for anti-aliasing of digit bottoms */ + textoffset = text_height + text_gap + antialias_fudge; + if (textoffset < guard_descent) { textoffset = guard_descent; } } else { @@ -601,11 +613,12 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ && module_is_set(symbol, r, i + block_width) == fill; block_width++); if ((r == (symbol->rows - 1)) && (i > main_width) && (addon_latch == 0)) { - addon_text_yposn = yposn + text_height - text_height * digit_ascent_factor; + addon_text_yposn = yposn + text_height - digit_ascender; if (addon_text_yposn < 0.0f) { addon_text_yposn = 0.0f; } - addon_row_height = row_height - (addon_text_yposn - yposn) + text_gap; + addon_row_yposn = yposn + text_height + text_gap + antialias_fudge; + addon_row_height = row_height - (addon_row_yposn - yposn); if (upceanflag != 12 && upceanflag != 6) { /* UPC-A/E add-ons don't descend */ addon_row_height += guard_descent; } @@ -617,8 +630,8 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ if (fill) { /* a bar */ if (addon_latch) { - rect = vector_plot_create_rect(symbol, i + xoffset, addon_text_yposn - text_gap, - block_width, addon_row_height); + rect = vector_plot_create_rect(symbol, i + xoffset, addon_row_yposn, block_width, + addon_row_height); } else { rect = vector_plot_create_rect(symbol, i + xoffset, yposn, block_width, row_height); } @@ -730,129 +743,107 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_ xoffset += comp_xoffset; text_yposn = yoffset + symbol->height + text_height + text_gap; /* Calculated to bottom of text */ + if (upceanflag) { /* Allow for anti-aliasing if UPC/EAN */ + text_yposn -= antialias_fudge; + } else { /* Else adjust to baseline */ + text_yposn -= text_height * descent_factor; + } if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) { text_yposn += symbol->border_width; /* Note not needed for BARCODE_BIND_TOP */ } if (upceanflag >= 6) { /* UPC-E, EAN-8, UPC-A, EAN-13 */ + const int addon_len = (int) ustrlen(addon); float textwidth; - out_upcean_split_text(upceanflag, symbol->text, textpart1, textpart2, textpart3, textpart4); + out_upcean_split_text(upceanflag, symbol->text, textparts); if (upceanflag == 6) { /* UPC-E */ - text_xposn = -5.0f + xoffset; + text_xposn = -(5.0f - 0.35f) + xoffset; textwidth = 6.2f; - if (!vector_plot_add_string(symbol, textpart1, text_xposn, text_yposn, upcae_outside_text_height, - textwidth, 2 /*right align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = 24.0f + xoffset; + if (!vector_plot_add_string(symbol, textparts[0], 1, text_xposn, text_yposn, + upcae_outside_text_height, textwidth, 2 /*right align*/, + &last_string)) return ZINT_ERROR_MEMORY; + text_xposn = (24.0f + 0.5f) + xoffset; textwidth = 6.0f * 8.5f; - if (!vector_plot_add_string(symbol, textpart2, text_xposn, text_yposn, text_height, - textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = 51.0f + 3.0f + xoffset; + if (!vector_plot_add_string(symbol, textparts[1], 6, text_xposn, text_yposn, text_height, + textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; + text_xposn = (51.0f - 0.35f) + 3.0f + xoffset; textwidth = 6.2f; - if (!vector_plot_add_string(symbol, textpart3, text_xposn, text_yposn, upcae_outside_text_height, - textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; - switch (ustrlen(addon)) { - case 2: - text_xposn = 61.0f + xoffset + addon_gap; - textwidth = 2.0f * 8.5f; - if (!vector_plot_add_string(symbol, addon, text_xposn, addon_text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - break; - case 5: - text_xposn = 75.0f + xoffset + addon_gap; - textwidth = 5.0f * 8.5f; - if (!vector_plot_add_string(symbol, addon, text_xposn, addon_text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - break; + if (!vector_plot_add_string(symbol, textparts[2], 1, text_xposn, text_yposn, + upcae_outside_text_height, textwidth, 1 /*left align*/, + &last_string)) return ZINT_ERROR_MEMORY; + if (addon_len) { + text_xposn = (addon_len == 2 ? 61.0f : 75.0f) + xoffset + addon_gap; + textwidth = addon_len * 8.5f; + if (!vector_plot_add_string(symbol, addon, addon_len, text_xposn, addon_text_yposn, + text_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; } } else if (upceanflag == 8) { /* EAN-8 */ - text_xposn = 17.0f + xoffset; + text_xposn = (17.0f + 0.5f) + xoffset; textwidth = 4.0f * 8.5f; - if (!vector_plot_add_string(symbol, textpart1, text_xposn, text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = 50.0f + xoffset; - if (!vector_plot_add_string(symbol, textpart2, text_xposn, text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - switch (ustrlen(addon)) { - case 2: - text_xposn = 77.0f + xoffset + addon_gap; - textwidth = 2.0f * 8.5f; - if (!vector_plot_add_string(symbol, addon, text_xposn, addon_text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - break; - case 5: - text_xposn = 91.0f + xoffset + addon_gap; - textwidth = 5.0f * 8.5f; - if (!vector_plot_add_string(symbol, addon, text_xposn, addon_text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - break; + if (!vector_plot_add_string(symbol, textparts[0], 4, text_xposn, text_yposn, + text_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; + text_xposn = (50.0f - 0.5f) + xoffset; + if (!vector_plot_add_string(symbol, textparts[1], 4, text_xposn, text_yposn, + text_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; + if (addon_len) { + text_xposn = (addon_len == 2 ? 77.0f : 91.0f) + xoffset + addon_gap; + textwidth = addon_len * 8.5f; + if (!vector_plot_add_string(symbol, addon, addon_len, text_xposn, addon_text_yposn, + text_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; } } else if (upceanflag == 12) { /* UPC-A */ - text_xposn = -5.0f + xoffset; + text_xposn = -(5.0f - 0.35f) + xoffset; textwidth = 6.2f; - if (!vector_plot_add_string(symbol, textpart1, text_xposn, text_yposn, upcae_outside_text_height, - textwidth, 2 /*right align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = 27.0f + xoffset; + if (!vector_plot_add_string(symbol, textparts[0], 1, text_xposn, text_yposn, + upcae_outside_text_height, textwidth, 2 /*right align*/, + &last_string)) return ZINT_ERROR_MEMORY; + text_xposn = (27.0f + 1.0f) + xoffset; textwidth = 5.0f * 8.5f; - if (!vector_plot_add_string(symbol, textpart2, text_xposn, text_yposn, text_height, - textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; + if (!vector_plot_add_string(symbol, textparts[1], 5, text_xposn, text_yposn, text_height, + textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; text_xposn = 67.0f + xoffset; - if (!vector_plot_add_string(symbol, textpart3, text_xposn, text_yposn, text_height, - textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = 95.0f + 5.0f + xoffset; + if (!vector_plot_add_string(symbol, textparts[2], 5, text_xposn, text_yposn, text_height, + textwidth, 0 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; + text_xposn = (95.0f - 0.35f) + 5.0f + xoffset; textwidth = 6.2f; - if (!vector_plot_add_string(symbol, textpart4, text_xposn, text_yposn, upcae_outside_text_height, - textwidth, 1 /*left align*/, &last_string)) return ZINT_ERROR_MEMORY; - switch (ustrlen(addon)) { - case 2: - text_xposn = 105.0f + xoffset + addon_gap; - textwidth = 2.0f * 8.5f; - if (!vector_plot_add_string(symbol, addon, text_xposn, addon_text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - break; - case 5: - text_xposn = 119.0f + xoffset + addon_gap; - textwidth = 5.0f * 8.5f; - if (!vector_plot_add_string(symbol, addon, text_xposn, addon_text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - break; + if (!vector_plot_add_string(symbol, textparts[3], 1, text_xposn, text_yposn, + upcae_outside_text_height, textwidth, 1 /*left align*/, + &last_string)) return ZINT_ERROR_MEMORY; + if (addon_len) { + text_xposn = (addon_len == 2 ? 105.0f : 119.0f) + xoffset + addon_gap; + textwidth = addon_len * 8.5f; + if (!vector_plot_add_string(symbol, addon, addon_len, text_xposn, addon_text_yposn, + text_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; } } else { /* EAN-13 */ - text_xposn = -5.0f + xoffset; + text_xposn = -(5.0f - 0.1f) + xoffset; textwidth = 8.5f; - if (!vector_plot_add_string(symbol, textpart1, text_xposn, text_yposn, + if (!vector_plot_add_string(symbol, textparts[0], 1, text_xposn, text_yposn, text_height, textwidth, 2 /*right align*/, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = 24.0f + xoffset; + text_xposn = (24.0f + 0.5f) + xoffset; textwidth = 6.0f * 8.5f; - if (!vector_plot_add_string(symbol, textpart2, text_xposn, text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - text_xposn = 71.0f + xoffset; - if (!vector_plot_add_string(symbol, textpart3, text_xposn, text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - switch (ustrlen(addon)) { - case 2: - text_xposn = 105.0f + xoffset + addon_gap; - textwidth = 2.0f * 8.5f; - if (!vector_plot_add_string(symbol, addon, text_xposn, addon_text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - break; - case 5: - text_xposn = 119.0f + xoffset + addon_gap; - textwidth = 5.0f * 8.5f; - if (!vector_plot_add_string(symbol, addon, text_xposn, addon_text_yposn, - text_height, textwidth, 0, &last_string)) return ZINT_ERROR_MEMORY; - break; + if (!vector_plot_add_string(symbol, textparts[1], 6, text_xposn, text_yposn, + text_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; + text_xposn = (71.0f - 0.5f) + xoffset; + if (!vector_plot_add_string(symbol, textparts[2], 6, text_xposn, text_yposn, + text_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; + if (addon_len) { + text_xposn = (addon_len == 2 ? 105.0f : 119.0f) + xoffset + addon_gap; + textwidth = addon_len * 8.5f; + if (!vector_plot_add_string(symbol, addon, addon_len, text_xposn, addon_text_yposn, + text_height, textwidth, 0 /*centre align*/, &last_string)) return ZINT_ERROR_MEMORY; } } } else { /* Put normal human readable text at the bottom (and centered) */ /* calculate start xoffset to center text */ text_xposn = main_width / 2.0f + xoffset; - if (!vector_plot_add_string(symbol, symbol->text, text_xposn, text_yposn, + if (!vector_plot_add_string(symbol, symbol->text, -1, text_xposn, text_yposn, text_height, symbol->width, 0, &last_string)) return ZINT_ERROR_MEMORY; } diff --git a/backend/zint.h b/backend/zint.h index 4f52c7a3..14bb38db 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -58,7 +58,7 @@ extern "C" { }; struct zint_vector_string { - float x, y; /* Top with x relative to halign (i.e. centre, left, right) */ + float x, y; /* x is relative to halign (i.e. centre, left, right), y is relative to baseline */ float fsize; /* Font size */ float width; /* Suggested string width, may be 0 if none recommended */ int length; /* Number of characters (bytes) */ @@ -116,6 +116,7 @@ extern "C" { int eci; /* Extended Channel Interpretation. Default 0 (none) */ float dpmm; /* Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none) */ float dot_size; /* Size of dots used in BARCODE_DOTTY_MODE. Default 0.8 */ + float text_gap; /* Gap between barcode and text (HRT). 0 means use default (font-specific) */ float guard_descent; /* Height in X-dimensions that EAN/UPC guard bars descend. Default 5 */ struct zint_structapp structapp; /* Structured Append info. Default structapp.count 0 (none) */ int warn_level; /* Affects error/warning value returned by Zint API (see WARN_XXX below) */ diff --git a/backend_qt/qzint.cpp b/backend_qt/qzint.cpp index 298803fc..5cdc57a5 100644 --- a/backend_qt/qzint.cpp +++ b/backend_qt/qzint.cpp @@ -35,8 +35,8 @@ #define QSL QStringLiteral namespace Zint { - static const char fontStyle[] = "Helvetica"; - static const char fontStyleError[] = "Helvetica"; + static const QString fontFamily = QSL("Helvetica"); + static const QString fontFamilyError = QSL("Helvetica"); static const int fontSizeError = 14; /* Point size */ static const int maxSegs = 256; @@ -130,6 +130,7 @@ namespace Zint { maxBottom = circle->y + circle->diameter + circle->width; } } + // TODO: Strings? } @@ -145,6 +146,7 @@ namespace Zint { m_scale(1.0f), m_dotty(false), m_dot_size(4.0f / 5.0f), m_guardDescent(5.0f), + m_textGap(0.0f), m_fgStr(QSL("000000")), m_bgStr(QSL("FFFFFF")), m_cmyk(false), m_borderType(0), m_borderWidth(0), m_whitespace(0), m_vwhitespace(0), @@ -229,6 +231,7 @@ namespace Zint { m_zintSymbol->dpmm = m_dpmm; m_zintSymbol->dot_size = m_dot_size; m_zintSymbol->guard_descent = m_guardDescent; + m_zintSymbol->text_gap = m_textGap; m_zintSymbol->structapp = m_structapp; m_zintSymbol->warn_level = m_warn_level; m_zintSymbol->debug = m_debug ? ZINT_DEBUG_PRINT : 0; @@ -566,6 +569,15 @@ namespace Zint { } } + /* Text gap */ + float QZint::textGap() const { + return m_textGap; + } + + void QZint::setTextGap(float textGap) { + m_textGap = textGap; + } + /* Show (true) or hide (false) Human Readable Text */ bool QZint::showText() const { return m_show_hrt; @@ -913,7 +925,7 @@ namespace Zint { if (m_error >= ZINT_ERROR) { painter.setRenderHint(QPainter::Antialiasing); - QFont font(fontStyleError, fontSizeError); + QFont font(fontFamilyError, fontSizeError); painter.setFont(font); painter.drawText(paintRect, Qt::AlignCenter | Qt::TextWordWrap, m_lastError); painter.restore(); @@ -1043,9 +1055,8 @@ namespace Zint { QPen p; p.setColor(fgColor); painter.setPen(p); - bool bold = (m_zintSymbol->output_options & BOLD_TEXT) - && (!isExtendable() || (m_zintSymbol->output_options & SMALL_TEXT)); - QFont font(fontStyle, -1 /*pointSize*/, bold ? QFont::Bold : -1); + bool bold = (m_zintSymbol->output_options & BOLD_TEXT) && !isExtendable(); + QFont font(fontFamily, -1 /*pointSize*/, bold ? QFont::Bold : -1); while (string) { font.setPixelSize(string->fsize); painter.setFont(font); @@ -1055,7 +1066,7 @@ namespace Zint { painter.drawText(QPointF(string->x, string->y), content); } else { QFontMetrics fm(painter.fontMetrics()); - int width = fm.boundingRect(content).width(); + int width = fm.horizontalAdvance(content); if (string->halign == 2) { /* Right align */ painter.drawText(QPointF(string->x - width, string->y), content); } else { /* Centre align */ @@ -1140,7 +1151,8 @@ namespace Zint { const bool autoHeight, const float heightPerRow, const QString& outfile, const QZintXdimDpVars *xdimdpVars) const { QString cmd(win && !noEXE ? QSL("zint.exe") : QSL("zint")); - bool nobackground = bgColor().alpha() == 0; + const bool nobackground = bgColor().alpha() == 0; + const bool notext = hasHRT() && !showText(); char name_buf[32]; if (barcodeNames && ZBarcode_BarcodeName(m_symbol, name_buf) == 0) { @@ -1181,7 +1193,7 @@ namespace Zint { if (!default_bind_top) { arg_bool(cmd, "--bindtop", borderType() & BARCODE_BIND_TOP); } - arg_bool(cmd, "--bold", fontSetting() & BOLD_TEXT); + arg_bool(cmd, "--bold", !notext && (fontSetting() & BOLD_TEXT) && !isExtendable()); if (!default_border) { arg_int(cmd, "--border=", borderWidth()); } @@ -1265,7 +1277,7 @@ namespace Zint { arg_bool(cmd, "--nobackground", nobackground); arg_bool(cmd, "--noquietzones", hasDefaultQuietZones() && noQuietZones()); - arg_bool(cmd, "--notext", hasHRT() && !showText()); + arg_bool(cmd, "--notext", notext); arg_data(cmd, longOptOnly ? "--output=" : "-o ", outfile, win); if (m_symbol == BARCODE_MAXICODE || isComposite()) { @@ -1306,7 +1318,7 @@ namespace Zint { arg_int(cmd, "--separator=", option3()); } - arg_bool(cmd, "--small", fontSetting() & SMALL_TEXT); + arg_bool(cmd, "--small", !notext && (fontSetting() & SMALL_TEXT)); if (m_symbol == BARCODE_DATAMATRIX || m_symbol == BARCODE_HIBC_DM) { arg_bool(cmd, "--square", option3() == DM_SQUARE); @@ -1316,6 +1328,10 @@ namespace Zint { arg_structapp(cmd, "--structapp=", structAppCount(), structAppIndex(), structAppID(), win); } + if (!notext && textGap() != 0.0f) { + arg_float(cmd, "--textgap=", textGap(), true /*allowZero*/); + } + arg_bool(cmd, "--verbose", debug()); if (m_symbol == BARCODE_AZTEC || m_symbol == BARCODE_HIBC_AZTEC diff --git a/backend_qt/qzint.h b/backend_qt/qzint.h index d8c0ba3f..4c209ef4 100644 --- a/backend_qt/qzint.h +++ b/backend_qt/qzint.h @@ -165,6 +165,10 @@ public: void setFontSetting(int fontSettingIndex); // Sets from comboBox index void setFontSettingValue(int fontSetting); // Sets literal value + /* Text gap */ + float textGap() const; // `symbol->text_gap` + void setTextGap(float textGap); + /* Show (true) or hide (false) Human Readable Text */ bool showText() const; // `symbol->show_hrt` void setShowText(bool showText); @@ -355,6 +359,7 @@ private: bool m_dotty; float m_dot_size; float m_guardDescent; + float m_textGap; struct zint_structapp m_structapp; QString m_fgStr; QString m_bgStr; diff --git a/backend_qt/tests/test_qzint.cpp b/backend_qt/tests/test_qzint.cpp index d6029831..079c5547 100644 --- a/backend_qt/tests/test_qzint.cpp +++ b/backend_qt/tests/test_qzint.cpp @@ -127,6 +127,10 @@ private slots: bc.setDotSize(dotSize); QCOMPARE(bc.dotSize(), dotSize); + float textGap = 4.321f; + bc.setTextGap(textGap); + QCOMPARE(bc.textGap(), textGap); + float guardDescent = 0.678f; bc.setGuardDescent(guardDescent); QCOMPARE(bc.guardDescent(), guardDescent); @@ -526,6 +530,7 @@ private slots: QTest::addColumn("dpmm"); QTest::addColumn("dotty"); QTest::addColumn("dotSize"); + QTest::addColumn("textGap"); QTest::addColumn("guardDescent"); QTest::addColumn("structAppCount"); @@ -558,8 +563,8 @@ private slots: QTest::addColumn("warnLevel"); QTest::addColumn("debug"); - QTest::addColumn("xdimdp_xdim"); - QTest::addColumn("xdimdp_xdim_units"); + QTest::addColumn("xdimdp_x_dim"); + QTest::addColumn("xdimdp_x_dim_units"); QTest::addColumn("xdimdp_resolution"); QTest::addColumn("xdimdp_resolution_units"); QTest::addColumn("xdimdp_filetype"); @@ -575,7 +580,7 @@ private slots: QTest::newRow("BARCODE_AUSPOST") << true << 0.0f << "" << BARCODE_AUSPOST << DATA_MODE // symbology-inputMode << "12345678" << "" // text-primary - << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -592,7 +597,7 @@ private slots: QTest::newRow("BARCODE_AZTEC") << false << 0.0f << "" << BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode << "12345678Ж0%var%" << "" // text-primary - << 0.0f << 1 << 0 << 0 << 4.0f << 0.0f << true << 0.9f // height-dotSize + << 0.0f << 1 << 0 << 0 << 4.0f << 0.0f << true << 0.9f << 0.0f // height-textGap << 5.0f << 2 << 1 << "as\"dfa'sdf" // guardDescent-structAppID << "" << "" << QColor(Qt::blue) << QColor(Qt::white) << true // fgStr-cmyk << 0 << 0 << 2 << 3 << 0 // borderTypeIndex-fontSetting @@ -608,7 +613,7 @@ private slots: QTest::newRow("BARCODE_AZTEC") << false << 0.0f << "" << BARCODE_AZTEC << UNICODE_MODE // symbology-inputMode << "12345678Ж0%var%" << "" // text-primary - << 0.0f << 1 << 0 << 0 << 4.0f << 0.0f << true << 0.9f // height-dotSize + << 0.0f << 1 << 0 << 0 << 4.0f << 0.0f << true << 0.9f << 0.0f // height-textGap << 5.0f << 2 << 1 << "as\"dfa'sdf" // guardDescent-structAppID << "71,0,40,44" << "0,0,0,0" << QColor(Qt::black) << QColor(Qt::white) << true // fgStr-cmyk << 0 << 0 << 2 << 3 << 0 // borderTypeIndex-fontSetting @@ -624,7 +629,7 @@ private slots: QTest::newRow("BARCODE_C25INTER") << true << 0.0f << "" << BARCODE_C25INTER << UNICODE_MODE // symbology-inputMode << "12345" << "" // text-primary - << 0.0f << -1 << 2 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 0.0f << -1 << 2 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << SMALL_TEXT // borderTypeIndex-fontSetting @@ -638,7 +643,7 @@ private slots: QTest::newRow("BARCODE_CHANNEL") << false << 0.0f << "" << BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode << "453678" << "" // text-primary - << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(255, 255, 255, 0) << false // fgStr-cmyk << 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting @@ -654,7 +659,7 @@ private slots: QTest::newRow("BARCODE_CHANNEL") << false << 0.0f << "" << BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode << "453678" << "" // text-primary - << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "FFFFFF00" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting @@ -670,7 +675,7 @@ private slots: QTest::newRow("BARCODE_CHANNEL") << false << 0.0f << "" << BARCODE_CHANNEL << UNICODE_MODE // symbology-inputMode << "453678" << "" // text-primary - << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 19.7f << -1 << 7 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "12345600" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 1 << 2 << 0 << 0 << BOLD_TEXT // borderTypeIndex-fontSetting @@ -686,7 +691,7 @@ private slots: QTest::newRow("BARCODE_CODE128") << false << 0.0f << "" << BARCODE_CODE128 << (UNICODE_MODE | EXTRA_ESCAPE_MODE) // symbology-inputMode << "1234\\^A56" << "" // text-primary - << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -700,7 +705,7 @@ private slots: QTest::newRow("BARCODE_GS1_128_CC") << false << 0.0f << "" << BARCODE_GS1_128_CC << UNICODE_MODE // symbology-inputMode << "[01]12345678901231[15]121212" << "[11]901222[99]ABCDE" // text-primary - << 71.142f << 3 << 0 << 0 << 3.5f << 0.0f << false << 0.8f // height-dotSize + << 71.142f << 3 << 0 << 0 << 3.5f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -716,7 +721,7 @@ private slots: QTest::newRow("BARCODE_CODE16K") << false << 11.7f << "" << BARCODE_CODE16K << (UNICODE_MODE | HEIGHTPERROW_MODE) // symbology-inputMode << "12345678901234567890123456789012" << "" // text-primary - << 0.0f << 4 << 0 << 2 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 0.0f << 4 << 0 << 2 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 1 << 1 << 0 << 0 << SMALL_TEXT // borderTypeIndex-fontSetting @@ -732,7 +737,7 @@ private slots: QTest::newRow("BARCODE_CODE49") << true << 0.0f << "" << BARCODE_CODE49 << UNICODE_MODE // symbology-inputMode << "12345678901234567890" << "" // text-primary - << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -746,7 +751,7 @@ private slots: QTest::newRow("BARCODE_CODABLOCKF") << true << 0.0f << "" << BARCODE_CODABLOCKF << (DATA_MODE | ESCAPE_MODE) // symbology-inputMode << "T\\n\\xA0t\\\"" << "" // text-primary - << 0.0f << 2 << 5 << 3 << 3.0f << 0.0f << false << 0.8f // height-dotSize + << 0.0f << 2 << 5 << 3 << 3.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 2 << 4 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -762,7 +767,7 @@ private slots: QTest::newRow("BARCODE_DAFT") << false << 0.0f << "" << BARCODE_DAFT << UNICODE_MODE // symbology-inputMode << "daft" << "" // text-primary - << 9.2f << -1 << 251 << 0 << 1.0f << 0.0f << false << 0.7f // height-dotSize + << 9.2f << -1 << 251 << 0 << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(0x30, 0x31, 0x32, 0x33) << QColor(0xBF, 0xBE, 0xBD, 0xBC) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -776,7 +781,7 @@ private slots: QTest::newRow("BARCODE_DATAMATRIX") << true << 0.0f << "" << BARCODE_DATAMATRIX << GS1_MODE // symbology-inputMode << "[20]12" << "" // text-primary - << 0.0f << -1 << 0 << DM_SQUARE << 1.0f << 0.0f << false << 0.7f // height-dotSize + << 0.0f << -1 << 0 << DM_SQUARE << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -790,7 +795,7 @@ private slots: QTest::newRow("BARCODE_DATAMATRIX") << false << 0.0f << "" << BARCODE_DATAMATRIX << (DATA_MODE | ESCAPE_MODE | FAST_MODE) // symbology-inputMode << "ABCDEFGH\\x01I" << "" // text-primary - << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.7f // height-dotSize + << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -804,7 +809,7 @@ private slots: QTest::newRow("BARCODE_DBAR_EXPSTK_CC") << false << 40.8f << "" << BARCODE_DBAR_EXPSTK_CC << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode << "[91]ABCDEFGHIJKL" << "[11]901222[99]ABCDE" // text-primary - << 0.0f << -1 << 0 << 2 << 1.0f << 0.0f << true << 0.9f // height-dotSize + << 0.0f << -1 << 0 << 2 << 1.0f << 0.0f << true << 0.9f << 0.0f // height-textGap << 3.0f << 2 << 1 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -820,7 +825,7 @@ private slots: QTest::newRow("BARCODE_DOTCODE") << false << 1.0f << "" << BARCODE_DOTCODE << GS1_MODE // symbology-inputMode << "[20]01" << "" // text-primary - << 30.0f << -1 << 8 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.7f // height-dotSize + << 30.0f << -1 << 8 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap << 0.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -834,7 +839,7 @@ private slots: QTest::newRow("BARCODE_DOTCODE") << false << 1.0f << "" << BARCODE_DOTCODE << GS1_MODE // symbology-inputMode << "[20]01" << "" // text-primary - << 30.0f << -1 << 8 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.7f // height-dotSize + << 30.0f << -1 << 8 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap << 0.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -848,7 +853,7 @@ private slots: QTest::newRow("BARCODE_DPD") << true << 0.0f << "" << BARCODE_DPD << UNICODE_MODE // symbology-inputMode << "1234567890123456789012345678" << "" // text-primary - << 0.0f << -1 << 0 << 0 << 4.5f << 24.0f << true << 0.8f // height-dotSize + << 0.0f << -1 << 0 << 0 << 4.5f << 24.0f << true << 0.8f << 0.0f // height-textGap << 0.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -863,7 +868,7 @@ private slots: QTest::newRow("BARCODE_EANX") << true << 0.0f << "" << BARCODE_EANX << UNICODE_MODE // symbology-inputMode << "123456789012+12" << "" // text-primary - << 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f // height-dotSize + << 0.0f << -1 << 8 << 0 << 1.0f << 0.0f << true << 0.8f << 0.0f // height-textGap << 0.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -877,7 +882,7 @@ private slots: QTest::newRow("BARCODE_GRIDMATRIX") << false << 0.0f << "" << BARCODE_GRIDMATRIX << UNICODE_MODE // symbology-inputMode << "Your Data Here!" << "" // text-primary - << 0.0f << 1 << 5 << 0 << 0.5f << 0.0f << false << 0.8f // height-dotSize + << 0.0f << 1 << 5 << 0 << 0.5f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -891,7 +896,7 @@ private slots: QTest::newRow("BARCODE_HANXIN") << false << 0.0f << "" << BARCODE_HANXIN << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode << "éβÿ啊\\e\"'" << "" // text-primary - << 30.0f << 2 << 5 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 30.0f << 2 << 5 << ((0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -905,7 +910,7 @@ private slots: QTest::newRow("BARCODE_HIBC_DM") << false << 10.0f << "" << BARCODE_HIBC_DM << UNICODE_MODE // symbology-inputMode << "1234" << "" // text-primary - << 0.0f << -1 << 8 << DM_DMRE << 1.0f << 0.0f << false << 0.7f // height-dotSize + << 0.0f << -1 << 8 << DM_DMRE << 1.0f << 0.0f << false << 0.7f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -919,7 +924,7 @@ private slots: QTest::newRow("BARCODE_HIBC_PDF") << false << 0.0f << "" << BARCODE_HIBC_PDF << (DATA_MODE | HEIGHTPERROW_MODE) // symbology-inputMode << "TEXT" << "" // text-primary - << 3.5f << 3 << 4 << 10 << 10.0f << 0.0f << false << 0.8f // height-dotSize + << 3.5f << 3 << 4 << 10 << 10.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 2 << 1 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -935,7 +940,7 @@ private slots: QTest::newRow("BARCODE_ITF14") << true << 0.0f << "" << BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode << "9212320967145" << "" // text-primary - << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -949,7 +954,7 @@ private slots: QTest::newRow("BARCODE_ITF14") << true << 0.0f << "" << BARCODE_ITF14 << UNICODE_MODE // symbology-inputMode << "9212320967145" << "" // text-primary - << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 30.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 1 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -964,7 +969,7 @@ private slots: << BARCODE_MAXICODE << (UNICODE_MODE | ESCAPE_MODE) // symbology-inputMode << "152382802840001" << "1Z00004951\\GUPSN\\G06X610\\G159\\G1234567\\G1/1\\G\\GY\\G1 MAIN ST\\GTOWN\\GNY\\R\\E" // text-primary - << 0.0f << -1 << (96 + 1) << 0 << 2.5f << 0.0f << false << 0.8f // height-dotSize + << 0.0f << -1 << (96 + 1) << 0 << 2.5f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -980,7 +985,7 @@ private slots: QTest::newRow("BARCODE_MICROQR") << false << 0.0f << "" << BARCODE_MICROQR << UNICODE_MODE // symbology-inputMode << "1234" << "" // text-primary - << 30.0f << 2 << 3 << (ZINT_FULL_MULTIBYTE | (3 + 1) << 8) << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 30.0f << 2 << 3 << (ZINT_FULL_MULTIBYTE | (3 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -994,7 +999,7 @@ private slots: QTest::newRow("BARCODE_QRCODE") << true << 0.0f << "" << BARCODE_QRCODE << GS1_MODE // symbology-inputMode << "(01)12" << "" // text-primary - << 0.0f << 1 << 5 << (ZINT_FULL_MULTIBYTE | (0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 0.0f << 1 << 5 << (ZINT_FULL_MULTIBYTE | (0 + 1) << 8) << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -1010,7 +1015,7 @@ private slots: QTest::newRow("BARCODE_RMQR") << true << 0.0f << "" << BARCODE_RMQR << UNICODE_MODE // symbology-inputMode << "テ" << "" // text-primary - << 30.0f << -1 << 8 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 30.0f << -1 << 8 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -1024,7 +1029,7 @@ private slots: QTest::newRow("BARCODE_ULTRA") << false << 0.0f << "" << BARCODE_ULTRA << (GS1_MODE | GS1PARENS_MODE | GS1NOCHECK_MODE) // symbology-inputMode << "(01)1" << "" // text-primary - << 0.0f << 6 << 2 << 0 << 1.0f << 0.0f << true << 0.8f // height-dotSize + << 0.0f << 6 << 2 << 0 << 1.0f << 0.0f << true << 0.8f << 0.0f // height-textGap << 5.0f << 2 << 1 << "4" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting @@ -1038,37 +1043,51 @@ private slots: QTest::newRow("BARCODE_UPCE_CC") << true << 0.0f << "out.svg" << BARCODE_UPCE_CC << UNICODE_MODE // symbology-inputMode << "12345670+1234" << "[11]901222[99]ABCDE" // text-primary - << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 0.0f << -1 << 0 << 0 << 1.0f << 0.0f << false << 0.8f << 0.0f // height-textGap << 6.5f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(0xEF, 0x29, 0x29) << QColor(Qt::white) << false // fgStr-cmyk << 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting << true << false << false << true << true << 0 // showText-rotateAngle << 0 << false << false << false << WARN_FAIL_ALL << false // eci-debug << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp - << "zint -b 136 --bold --compliantheight -d '[11]901222[99]ABCDE' --fg=EF2929 --guarddescent=6.5" + << "zint -b 136 --compliantheight -d '[11]901222[99]ABCDE' --fg=EF2929 --guarddescent=6.5" " --noquietzones -o 'out.svg' --primary='12345670+1234' --small --werror" - << "zint.exe -b 136 --bold --compliantheight -d \"[11]901222[99]ABCDE\" --fg=EF2929 --guarddescent=6.5" + << "zint.exe -b 136 --compliantheight -d \"[11]901222[99]ABCDE\" --fg=EF2929 --guarddescent=6.5" " --noquietzones -o \"out.svg\" --primary=\"12345670+1234\" --small --werror" - << "zint --barcode=136 --bold --compliantheight --data='[11]901222[99]ABCDE' --fg=EF2929" + << "zint --barcode=136 --compliantheight --data='[11]901222[99]ABCDE' --fg=EF2929" " --guarddescent=6.5 --noquietzones --output='out.svg' --primary='12345670+1234' --small --werror" - << "zint -b UPCE_CC --bold --compliantheight -d '[11]901222[99]ABCDE' --fg=EF2929 --guarddescent=6.5" + << "zint -b UPCE_CC --compliantheight -d '[11]901222[99]ABCDE' --fg=EF2929 --guarddescent=6.5" " --noquietzones -o 'out.svg' --primary='12345670+1234' --small --werror" - << "zint -b 136 --bold --compliantheight -d \"[11]901222[99]ABCDE\" --fg=EF2929 --guarddescent=6.5" + << "zint -b 136 --compliantheight -d \"[11]901222[99]ABCDE\" --fg=EF2929 --guarddescent=6.5" " --noquietzones -o \"out.svg\" --primary=\"12345670+1234\" --small --werror" << ""; QTest::newRow("BARCODE_VIN") << false << 2.0f << "" << BARCODE_VIN << UNICODE_MODE // symbology-inputMode << "12345678701234567" << "" // text-primary - << 20.0f << -1 << 1 << 0 << 1.0f << 0.0f << false << 0.8f // height-dotSize + << 20.0f << -1 << 1 << 0 << 1.0f << 0.0f << false << 0.8f << 1.2f // height-textGap << 5.0f << 0 << 0 << "" // guardDescent-structAppID << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk - << 0 << 0 << 0 << 0 << 0 // borderTypeIndex-fontSetting + << 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting << true << false << false << false << true << 0 // showText-rotateAngle << 0 << false << false << false << WARN_DEFAULT << false // eci-debug << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp - << "zint -b 73 -d '12345678701234567' --height=20 --vers=1" - << "zint.exe -b 73 -d \"12345678701234567\" --height=20 --vers=1" + << "zint -b 73 --bold -d '12345678701234567' --height=20 --small --textgap=1.2 --vers=1" + << "zint.exe -b 73 --bold -d \"12345678701234567\" --height=20 --small --textgap=1.2 --vers=1" + << "" << "" << "" << ""; + + QTest::newRow("BARCODE_VIN") << false << 2.0f << "" + << BARCODE_VIN << UNICODE_MODE // symbology-inputMode + << "12345678701234567" << "" // text-primary + << 20.0f << -1 << 1 << 0 << 1.0f << 0.0f << false << 0.8f << 1.2f // height-textGap + << 5.0f << 0 << 0 << "" // guardDescent-structAppID + << "" << "" << QColor(Qt::black) << QColor(Qt::white) << false // fgStr-cmyk + << 0 << 0 << 0 << 0 << (BOLD_TEXT | SMALL_TEXT) // borderTypeIndex-fontSetting + << false << false << false << false << true << 0 // showText-rotateAngle + << 0 << false << false << false << WARN_DEFAULT << false // eci-debug + << 0.0 << 0 << 0 << 0 << 0 << 0 // xdimdp + << "zint -b 73 -d '12345678701234567' --height=20 --notext --vers=1" + << "zint.exe -b 73 -d \"12345678701234567\" --height=20 --notext --vers=1" << "" << "" << "" << ""; } @@ -1094,6 +1113,7 @@ private slots: QFETCH(float, dpmm); QFETCH(bool, dotty); QFETCH(float, dotSize); + QFETCH(float, textGap); QFETCH(float, guardDescent); QFETCH(int, structAppCount); QFETCH(int, structAppIndex); @@ -1121,8 +1141,8 @@ private slots: QFETCH(int, warnLevel); QFETCH(bool, debug); - QFETCH(double, xdimdp_xdim); - QFETCH(int, xdimdp_xdim_units); + QFETCH(double, xdimdp_x_dim); + QFETCH(int, xdimdp_x_dim_units); QFETCH(int, xdimdp_resolution); QFETCH(int, xdimdp_resolution_units); QFETCH(int, xdimdp_filetype); @@ -1151,6 +1171,7 @@ private slots: bc.setDPMM(dpmm); bc.setDotty(dotty); bc.setDotSize(dotSize); + bc.setTextGap(textGap); bc.setGuardDescent(guardDescent); bc.setStructApp(structAppCount, structAppIndex, structAppID); if (fgStr.isEmpty()) { @@ -1208,11 +1229,16 @@ private slots: QCOMPARE(cmd, expected_noexe); } - if (xdimdp_xdim) { - struct Zint::QZintXdimDpVars vars = { - xdimdp_xdim, xdimdp_xdim_units, xdimdp_resolution, xdimdp_resolution_units, xdimdp_filetype, - xdimdp_filetype_maxicode, 1 /*set*/ - }; + if (xdimdp_x_dim) { + /* Avoid clang 14 error "no matching constructor for initialization" by initializing field-wise */ + struct Zint::QZintXdimDpVars vars; + vars.x_dim = xdimdp_x_dim; + vars.x_dim_units = xdimdp_x_dim_units; + vars.resolution = xdimdp_resolution; + vars.resolution_units = xdimdp_resolution_units; + vars.filetype = xdimdp_filetype; + vars.filetype_maxicode = xdimdp_filetype_maxicode; + vars.set = 1; cmd = bc.getAsCLI(false /*win*/, false /*longOptOnly*/, false /*barcodeNames*/, false /*noEXE*/, autoHeight, heightPerRow, outfile, &vars); QCOMPARE(cmd, expected_xdimdp); diff --git a/backend_tcl/zint.c b/backend_tcl/zint.c index 494d1fc3..916f47de 100644 --- a/backend_tcl/zint.c +++ b/backend_tcl/zint.c @@ -166,6 +166,8 @@ - Added UPU_S10 2023-01-15 GL - Added -esc and -extraesc options +2023-02-10 GL +- Added -textgap option */ #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32) @@ -502,7 +504,7 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n" " -bindtop bool: bar above the code, size set by -border\n" " -bold bool: use bold text\n" " -border integer: width of a border around the symbol. Use with -bind/-box/-bindtop 1\n" - " -box bool: box around bar code, size set be -border\n" + " -box bool: box around bar code, size set by -border\n" /* cli option --cmyk not supported as no corresponding output */ " -cols integer: Codablock F, DotCode, PDF417: number of columns\n" " -compliantheight bool: warn if height not compliant, and use standard default\n" @@ -551,6 +553,7 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n" " -smalltext bool: tiny interpretation line font\n" " -square bool: force Data Matrix symbols to be square\n" " -structapp {index count ?id?}: set Structured Append info\n" + " -textgap double: gap between barcode and text\n" /* cli option --types not supported */ " -vers integer: Symbology option\n" /* cli option --version not supported */ @@ -791,7 +794,7 @@ static int Encode(Tcl_Interp *interp, int objc, "-reverse", "-rotate", "-rows", "-scale", "-scalexdimdp", "-scmvv", "-secure", "-seg1", "-seg2", "-seg3", "-seg4", "-seg5", "-seg6", "-seg7", "-seg8", "-seg9", "-separator", "-smalltext", "-square", "-structapp", - "-to", "-vers", "-vwhitesp", "-werror", "-whitesp", + "-textgap", "-to", "-vers", "-vwhitesp", "-werror", "-whitesp", NULL}; enum iOption { iAddonGap, iBarcode, iBG, iBind, iBindTop, iBold, iBorder, iBox, @@ -803,7 +806,7 @@ static int Encode(Tcl_Interp *interp, int objc, iReverse, iRotate, iRows, iScale, iScaleXdimDp, iSCMvv, iSecure, iSeg1, iSeg2, iSeg3, iSeg4, iSeg5, iSeg6, iSeg7, iSeg8, iSeg9, iSeparator, iSmallText, iSquare, iStructApp, - iTo, iVers, iVWhiteSp, iWError, iWhiteSp + iTextGap, iTo, iVers, iVWhiteSp, iWError, iWhiteSp }; int optionIndex; int intValue; @@ -865,6 +868,7 @@ static int Encode(Tcl_Interp *interp, int objc, case iGuardDescent: case iDotSize: case iScale: + case iTextGap: /* >> Float */ if (TCL_OK != Tcl_GetDoubleFromObj(interp, objv[optionPos+1], &doubleValue)) @@ -1138,6 +1142,15 @@ static int Encode(Tcl_Interp *interp, int objc, my_symbol->scale = (float)doubleValue; } break; + case iTextGap: + if (doubleValue < 0.0 || doubleValue > 5.0) { + Tcl_SetObjResult(interp, + Tcl_NewStringObj("Text Gap out of range", -1)); + fError = 1; + } else { + my_symbol->text_gap = (float)doubleValue; + } + break; case iScaleXdimDp: /* >> Decode the -scalexdimdp parameter as list of xdim ?resolution? */ { diff --git a/docs/images/bc412.svg b/docs/images/bc412.svg index f8aae4e9..cae5391e 100644 --- a/docs/images/bc412.svg +++ b/docs/images/bc412.svg @@ -43,7 +43,7 @@ - AQQ45670 diff --git a/docs/images/c25iata.svg b/docs/images/c25iata.svg index 76e3b041..9944ce41 100644 --- a/docs/images/c25iata.svg +++ b/docs/images/c25iata.svg @@ -62,7 +62,7 @@ - 9212320967 diff --git a/docs/images/c25ind.svg b/docs/images/c25ind.svg index 407238c2..77899bf5 100644 --- a/docs/images/c25ind.svg +++ b/docs/images/c25ind.svg @@ -64,7 +64,7 @@ - 9212320967 diff --git a/docs/images/c25inter.svg b/docs/images/c25inter.svg index 825b1396..ded456b4 100644 --- a/docs/images/c25inter.svg +++ b/docs/images/c25inter.svg @@ -37,7 +37,7 @@ - 9212320967 diff --git a/docs/images/c25logic.svg b/docs/images/c25logic.svg index 06c60188..f9dc7843 100644 --- a/docs/images/c25logic.svg +++ b/docs/images/c25logic.svg @@ -42,7 +42,7 @@ - 9212320967 diff --git a/docs/images/c25standard.svg b/docs/images/c25standard.svg index d051ab0e..ea03c870 100644 --- a/docs/images/c25standard.svg +++ b/docs/images/c25standard.svg @@ -44,7 +44,7 @@ - 9212320967 diff --git a/docs/images/channel.svg b/docs/images/channel.svg index 51bf8693..c4e45f5b 100644 --- a/docs/images/channel.svg +++ b/docs/images/channel.svg @@ -20,7 +20,7 @@ - 453678 diff --git a/docs/images/codabar.svg b/docs/images/codabar.svg index b445f146..ec8f65d8 100644 --- a/docs/images/codabar.svg +++ b/docs/images/codabar.svg @@ -36,7 +36,7 @@ - A37859B diff --git a/docs/images/code11.svg b/docs/images/code11.svg index 09187d34..d345b175 100644 --- a/docs/images/code11.svg +++ b/docs/images/code11.svg @@ -50,7 +50,7 @@ - 921232096769 diff --git a/docs/images/code128.svg b/docs/images/code128.svg index c63c4a06..f11b23f5 100644 --- a/docs/images/code128.svg +++ b/docs/images/code128.svg @@ -42,7 +42,7 @@ - 130170X178 diff --git a/docs/images/code128_box.svg b/docs/images/code128_box.svg index 79e053af..19a075c8 100644 --- a/docs/images/code128_box.svg +++ b/docs/images/code128_box.svg @@ -49,7 +49,7 @@ - This Text diff --git a/docs/images/code128_green.svg b/docs/images/code128_green.svg index 42af4166..bbf71277 100644 --- a/docs/images/code128_green.svg +++ b/docs/images/code128_green.svg @@ -45,7 +45,7 @@ - This Text diff --git a/docs/images/code128_green_alpha.svg b/docs/images/code128_green_alpha.svg index f6309f39..451e13e4 100644 --- a/docs/images/code128_green_alpha.svg +++ b/docs/images/code128_green_alpha.svg @@ -45,7 +45,7 @@ - This Text diff --git a/docs/images/code128_rotate90.svg b/docs/images/code128_rotate90.svg index 00617992..c7752eea 100644 --- a/docs/images/code128_rotate90.svg +++ b/docs/images/code128_rotate90.svg @@ -45,8 +45,8 @@ - + This Text diff --git a/docs/images/code128_small_bold.svg b/docs/images/code128_small_bold.svg index 8679db53..b4b46301 100644 --- a/docs/images/code128_small_bold.svg +++ b/docs/images/code128_small_bold.svg @@ -45,7 +45,7 @@ - This Text diff --git a/docs/images/code128_stacked.svg b/docs/images/code128_stacked.svg index 7438924b..a29945db 100644 --- a/docs/images/code128_stacked.svg +++ b/docs/images/code128_stacked.svg @@ -34,7 +34,7 @@ - That diff --git a/docs/images/code128_textgap.svg b/docs/images/code128_textgap.svg new file mode 100644 index 00000000..57ecc716 --- /dev/null +++ b/docs/images/code128_textgap.svg @@ -0,0 +1,47 @@ + + + + Zint Generated Symbol + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Áccent + + + diff --git a/docs/images/code128ab.svg b/docs/images/code128ab.svg index 5c08c387..b4fbbba6 100644 --- a/docs/images/code128ab.svg +++ b/docs/images/code128ab.svg @@ -48,7 +48,7 @@ - 130170X178 diff --git a/docs/images/code32.svg b/docs/images/code32.svg index 1d992dc5..789a547a 100644 --- a/docs/images/code32.svg +++ b/docs/images/code32.svg @@ -48,7 +48,7 @@ - A143523126 diff --git a/docs/images/code39.svg b/docs/images/code39.svg index 40ce608b..662c4e77 100644 --- a/docs/images/code39.svg +++ b/docs/images/code39.svg @@ -33,7 +33,7 @@ - *1AB* diff --git a/docs/images/code93.svg b/docs/images/code93.svg index a70637c9..41e2cfff 100644 --- a/docs/images/code93.svg +++ b/docs/images/code93.svg @@ -30,7 +30,7 @@ - C93 diff --git a/docs/images/dbar_exp.svg b/docs/images/dbar_exp.svg index b5bbe347..9bf8bf72 100644 --- a/docs/images/dbar_exp.svg +++ b/docs/images/dbar_exp.svg @@ -52,7 +52,7 @@ - (01)98898765432106(3202)012345(15)991231 diff --git a/docs/images/dbar_ltd.svg b/docs/images/dbar_ltd.svg index edd3ffbf..64329f5b 100644 --- a/docs/images/dbar_ltd.svg +++ b/docs/images/dbar_ltd.svg @@ -31,7 +31,7 @@ - (01)09501101530010 diff --git a/docs/images/dbar_omn.svg b/docs/images/dbar_omn.svg index 34ed0acc..cd9ae514 100644 --- a/docs/images/dbar_omn.svg +++ b/docs/images/dbar_omn.svg @@ -31,7 +31,7 @@ - (01)09501101530010 diff --git a/docs/images/dbar_truncated.svg b/docs/images/dbar_truncated.svg index a05b1dcc..f4328436 100644 --- a/docs/images/dbar_truncated.svg +++ b/docs/images/dbar_truncated.svg @@ -31,7 +31,7 @@ - (01)09501101530010 diff --git a/docs/images/dpd.svg b/docs/images/dpd.svg index 22fc1009..67a25365 100644 --- a/docs/images/dpd.svg +++ b/docs/images/dpd.svg @@ -67,7 +67,7 @@ - 0003 932 0621 9912 3456 78 101 040 9 diff --git a/docs/images/dpident.svg b/docs/images/dpident.svg index 4dd360ce..ab1d233d 100644 --- a/docs/images/dpident.svg +++ b/docs/images/dpident.svg @@ -42,7 +42,7 @@ - 91.23 2.096.712 7 diff --git a/docs/images/dpleit.svg b/docs/images/dpleit.svg index 6f74ba3f..87604033 100644 --- a/docs/images/dpleit.svg +++ b/docs/images/dpleit.svg @@ -47,7 +47,7 @@ - 92123.209.671.456 diff --git a/docs/images/ean14.svg b/docs/images/ean14.svg index ca810b9c..faf3f000 100644 --- a/docs/images/ean14.svg +++ b/docs/images/ean14.svg @@ -45,7 +45,7 @@ - (01)98898765432106 diff --git a/docs/images/eanx13.svg b/docs/images/eanx13.svg index 46d470e5..e210ef2f 100644 --- a/docs/images/eanx13.svg +++ b/docs/images/eanx13.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -38,15 +38,15 @@ - 4 - 512345 - 678906 diff --git a/docs/images/eanx5.svg b/docs/images/eanx5.svg index 887d69fa..a0d19308 100644 --- a/docs/images/eanx5.svg +++ b/docs/images/eanx5.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -24,7 +24,7 @@ - 54321 diff --git a/docs/images/eanx8_5.svg b/docs/images/eanx8_5.svg index 0c342c73..b91cb7c9 100644 --- a/docs/images/eanx8_5.svg +++ b/docs/images/eanx8_5.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -30,27 +30,27 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 7432 - 3654 diff --git a/docs/images/eanx_cc_a.svg b/docs/images/eanx_cc_a.svg index cc9a9bed..1945d2a5 100644 --- a/docs/images/eanx_cc_a.svg +++ b/docs/images/eanx_cc_a.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -103,15 +103,15 @@ - 3 - 312345 - 678903 diff --git a/docs/images/eanx_cc_b.svg b/docs/images/eanx_cc_b.svg index 4b37d503..ce5060ef 100644 --- a/docs/images/eanx_cc_b.svg +++ b/docs/images/eanx_cc_b.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -152,15 +152,15 @@ - 3 - 312345 - 678903 diff --git a/docs/images/excode39.svg b/docs/images/excode39.svg index 4021ea29..25a7d8a2 100644 --- a/docs/images/excode39.svg +++ b/docs/images/excode39.svg @@ -68,7 +68,7 @@ - 123.45fd diff --git a/docs/images/gs1_128.svg b/docs/images/gs1_128.svg index cfe308aa..9009fbce 100644 --- a/docs/images/gs1_128.svg +++ b/docs/images/gs1_128.svg @@ -72,7 +72,7 @@ - (01)98898765432106(3202)012345(15)991231 diff --git a/docs/images/gs1_128_cc_c.svg b/docs/images/gs1_128_cc_c.svg index 2de251e5..068a0588 100644 --- a/docs/images/gs1_128_cc_c.svg +++ b/docs/images/gs1_128_cc_c.svg @@ -199,7 +199,7 @@ - (01)03312345678903 diff --git a/docs/images/gui_appearance.png b/docs/images/gui_appearance.png index 7bd475a8..a65caa5f 100644 Binary files a/docs/images/gui_appearance.png and b/docs/images/gui_appearance.png differ diff --git a/docs/images/hibc_128.svg b/docs/images/hibc_128.svg index bea29626..dd2cc5aa 100644 --- a/docs/images/hibc_128.svg +++ b/docs/images/hibc_128.svg @@ -63,7 +63,7 @@ - *+A123BJC5D6E71G* diff --git a/docs/images/hibc_39.svg b/docs/images/hibc_39.svg index f58c17b1..8779ba48 100644 --- a/docs/images/hibc_39.svg +++ b/docs/images/hibc_39.svg @@ -68,7 +68,7 @@ - *+14352312J* diff --git a/docs/images/isbnx.svg b/docs/images/isbnx.svg index bb498a6e..2f4b42dd 100644 --- a/docs/images/isbnx.svg +++ b/docs/images/isbnx.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -38,15 +38,15 @@ - 9 - 789295 - 055124 diff --git a/docs/images/itf14.svg b/docs/images/itf14.svg index ed2de626..6bf9e21b 100644 --- a/docs/images/itf14.svg +++ b/docs/images/itf14.svg @@ -51,7 +51,7 @@ - 92123209671459 diff --git a/docs/images/itf14_border0.svg b/docs/images/itf14_border0.svg index 260e19a8..4f0f5a7b 100644 --- a/docs/images/itf14_border0.svg +++ b/docs/images/itf14_border0.svg @@ -47,7 +47,7 @@ - 92123209671459 diff --git a/docs/images/koreapost.svg b/docs/images/koreapost.svg index 443fd370..59ee108b 100644 --- a/docs/images/koreapost.svg +++ b/docs/images/koreapost.svg @@ -36,7 +36,7 @@ - 9234570 diff --git a/docs/images/logmars.svg b/docs/images/logmars.svg index edd33616..754f22ca 100644 --- a/docs/images/logmars.svg +++ b/docs/images/logmars.svg @@ -78,7 +78,7 @@ - 12345/ABCDET diff --git a/docs/images/msi_plessey.svg b/docs/images/msi_plessey.svg index d83dfa03..72bc8b7e 100644 --- a/docs/images/msi_plessey.svg +++ b/docs/images/msi_plessey.svg @@ -35,7 +35,7 @@ - 650291 diff --git a/docs/images/nve18.svg b/docs/images/nve18.svg index 8fc1c858..5252437b 100644 --- a/docs/images/nve18.svg +++ b/docs/images/nve18.svg @@ -51,7 +51,7 @@ - (00)376123450000010039 diff --git a/docs/images/plessey.svg b/docs/images/plessey.svg index 4c640ed8..01c351d1 100644 --- a/docs/images/plessey.svg +++ b/docs/images/plessey.svg @@ -37,7 +37,7 @@ - C64 diff --git a/docs/images/pzn.svg b/docs/images/pzn.svg index 0b46f64e..5be7acb3 100644 --- a/docs/images/pzn.svg +++ b/docs/images/pzn.svg @@ -63,7 +63,7 @@ - PZN - 27580899 diff --git a/docs/images/telepen.svg b/docs/images/telepen.svg index c8d8ad3a..4b44244e 100644 --- a/docs/images/telepen.svg +++ b/docs/images/telepen.svg @@ -40,7 +40,7 @@ - Z80 diff --git a/docs/images/telepen_num.svg b/docs/images/telepen_num.svg index f0885beb..22e49947 100644 --- a/docs/images/telepen_num.svg +++ b/docs/images/telepen_num.svg @@ -42,7 +42,7 @@ - 466X33 diff --git a/docs/images/upca.svg b/docs/images/upca.svg index bc7010f4..82f2c888 100644 --- a/docs/images/upca.svg +++ b/docs/images/upca.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -38,19 +38,19 @@ - 7 - 25272 - 70270 - 3 diff --git a/docs/images/upca_5.svg b/docs/images/upca_5.svg index 92a2f9ab..5ad2411b 100644 --- a/docs/images/upca_5.svg +++ b/docs/images/upca_5.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -38,35 +38,35 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + 7 - 25272 - 70270 - 3 diff --git a/docs/images/upce.svg b/docs/images/upce.svg index 77d077ff..46a89233 100644 --- a/docs/images/upce.svg +++ b/docs/images/upce.svg @@ -1,13 +1,13 @@ - Zint Generated Symbol - + @@ -25,15 +25,15 @@ - 1 - 123456 - 2 diff --git a/docs/images/upu_s10.svg b/docs/images/upu_s10.svg index 35540ad1..8ff4d3bf 100644 --- a/docs/images/upu_s10.svg +++ b/docs/images/upu_s10.svg @@ -51,7 +51,7 @@ - EE 876 543 216 CA diff --git a/docs/images/vin.svg b/docs/images/vin.svg index 9dfa5d70..cb6b78aa 100644 --- a/docs/images/vin.svg +++ b/docs/images/vin.svg @@ -108,7 +108,7 @@ - 2FTPX28L0XCA15511 diff --git a/docs/manual.pmd b/docs/manual.pmd index a22276b8..fe7a4d3c 100644 --- a/docs/manual.pmd +++ b/docs/manual.pmd @@ -1,6 +1,6 @@ % Zint Barcode Generator and Zint Barcode Studio User Manual % Version 2.12.0.9 -% January 2023 +% February 2023 # 1. Introduction @@ -531,9 +531,11 @@ alternative mode is selected. This command replaces the use of the `-d` switch. zint -i somefile.txt ``` +To read from stdin specify a single hyphen `"-"` as the input file. + Note that except when batch processing (see [4.11 Batch Processing] below), the -file should not end with a newline (`LF` on Unix, `CR+LF` on Windows) unless you -want the newline to be encoded in the symbol. +file (or stdin) should not end with a newline (`LF` on Unix, `CR+LF` on Windows) +unless you want the newline to be encoded in the symbol. ## 4.2 Directing Output @@ -651,7 +653,7 @@ Value 52 `BARCODE_PZN` PZN 53 `BARCODE_PHARMA_TWO` Pharmacode Two-Track - + 54 `BARCODE_CEPNET` Brazilian CEPNet 55 `BARCODE_PDF417` PDF417 @@ -1371,7 +1373,7 @@ This command will output the symbol as a PCX file to stdout. The currently supported output file formats are shown in the following table. Abbreviation File format ------------- --------------------------- +------------ ------------------------------------ BMP Windows Bitmap EMF Enhanced Metafile Format EPS Encapsulated PostScript @@ -1380,7 +1382,7 @@ PCX ZSoft Paintbrush image PNG Portable Network Graphic SVG Scalable Vector Graphic TIF Tagged Image File Format -TXT Text file (see [4.18 Other Output Options]) +TXT Text file (see [4.19 Other Options]) Table: {#tbl:output_file_formats tag=": Output File Formats"} @@ -1469,7 +1471,24 @@ is the same for all symbols belonging to the same sequence. The index is 1-based and goes from 1 to count. Count must be 2 or more. See the individual symbologies for further details. -## 4.17 Help Options +## 4.17 Human Readable Text (HRT) Options + +For linear barcodes the text present in the output image can be removed by +using the `--notext` option. + +Text can be set to bold using the `--bold` option, or a smaller font can be +substituted using the `--small` option. The `--bold` and `--small` options can +be used together if required, but only for vector output. + +![`zint --bold -d "This Text" --small`](images/code128_small_bold.svg) + +The gap between the barcode and the text can be adjusted using the `--textgap` +option, where the gap is given as a multiple of the X-dimension (maximum 5X). A +zero value uses the default gap. + +![`zint -d "Áccent" --textgap=0.1`](images/code128_textgap.svg) + +## 4.18 Help Options There are three help options which give information about how to use the command line. The `-h` or `--help` option will display a list of all of the @@ -1481,16 +1500,7 @@ symbol ID numbers and names. The `-e` or `--ecinos` option gives a list of the ECI codes. -## 4.18 Other Output Options - -For linear barcodes the text present in the output image can be removed by -using the `--notext` option. - -The text can be set to bold using the `--bold` option, or a smaller font -can be substituted using the `--small` option. The `--bold` and `--small` -options can be used together if required, but only for vector output. - -![`zint --bold -d "This Text" --small`](images/code128_small_bold.svg) +## 4.19 Other Options Zint can output a representation of the symbol data as a set of hexadecimal values if asked to output to a text file (`"*.txt"`) or if given the option @@ -1615,7 +1625,8 @@ values are 0, 90, 180 and 270. The `ZBarcode_Encode_File()` and `ZBarcode_Encode_File_and_Print()` functions can be used to encode data read directly from a text file where the filename is -given in the `NUL`-terminated `filename` string. +given in the `NUL`-terminated `filename` string. The special filename `"-"` +(single hyphen) can be used to read from stdin. If printing more than one barcode, the `zint_symbol` structure may be re-used by calling the `ZBarcode_Clear()` function after each barcode to free any output @@ -1749,37 +1760,41 @@ Variable Name Type Meaning Default Value `symbology` integer Symbol to use (see [5.8 `BARCODE_CODE128` Specifying a Symbology]). -`height` float Symbol height, excluding Symbol dependent +`height` float Symbol height in Symbol dependent + X-dimensions, excluding fixed width-to-height symbols.[^7] `scale` float Scale factor for adjusting 1.0 - size of image. + size of image (sets + X-dimension). -`whitespace_width` integer Horizontal whitespace width. 0 +`whitespace_width` integer Horizontal whitespace width 0 + in X-dimensions. -`whitespace_height` integer Vertical whitespace height. 0 +`whitespace_height` integer Vertical whitespace height 0 + in X-dimensions. -`border_width` integer Border width. 0 +`border_width` integer Border width in 0 + X-dimensions. -`output_options` integer Set various output file 0 (none) +`output_options` integer Set various output 0 (none) parameters (see [5.9 - Adjusting Other Output - Options]). + Adjusting Output Options]). `fgcolour` character Foreground (ink) `"000000"` string colour as RGB/RGBA hexadecimal string or - `"C,M,Y,K"` decimal - percentages string, with a - terminating `NUL`. + `"C,M,Y,K"` decimal + percentages string, with a + terminating `NUL`. `bgcolour` character Background (paper) `"ffffff"` string colour as RGB/RGBA hexadecimal string or - `"C,M,Y,K"` decimal - percentages string, with a - terminating `NUL`. + `"C,M,Y,K"` decimal + percentages string, with a + terminating `NUL`. `fgcolor` pointer Points to fgcolour allowing alternate spelling. @@ -1806,7 +1821,8 @@ Variable Name Type Meaning Default Value `option_3` integer Symbol specific options. 0 -`show_hrt` integer Set to 0 to hide text. 1 +`show_hrt` integer Set to 0 to hide Human 1 + Readable Text (HRT). `input_mode` integer Set encoding of input `DATA_MODE` data (see [5.10 Setting the @@ -1820,10 +1836,15 @@ Variable Name Type Meaning Default Value only). `dot_size` float Diameter of dots used in 0.8 - dotty mode. + dotty mode (in + X-dimensions). + +`text_gap` float Gap between barcode and 0 (font-specific + text (HRT) in X-dimensions. default) `guard_descent` float Height of guard bar 5.0 - descent (EAN/UPC only). + descent (EAN/UPC only) in + X-dimensions. `structapp` Structured Mark a symbol as part of a count 0 Append sequence of symbols. (disabled) @@ -1852,7 +1873,7 @@ Variable Name Type Meaning Default Value arrays `row_height` array of Representation of the (output only) - floats height of a row. + floats height of rows. `errtxt` character Error message in the event (output only) string that an error occurred, @@ -2031,7 +2052,7 @@ means the same as symbol->symbology = 50; ``` -## 5.9 Adjusting Other Output Options +## 5.9 Adjusting Output Options The `output_options` variable can be used to adjust various aspects of the output file. To select more than one option from the table below simply `OR` diff --git a/docs/manual.txt b/docs/manual.txt index 77eaf397..df6f6c3c 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -1,6 +1,6 @@ Zint Barcode Generator and Zint Barcode Studio User Manual Version 2.12.0.9 -January 2023 +February 2023 ******************************************************************************* * For reference the following is a text-only version of the Zint manual, * @@ -51,8 +51,9 @@ January 2023 - 4.14 Working with Dots - 4.15 Multiple Segments - 4.16 Structured Append - - 4.17 Help Options - - 4.18 Other Output Options + - 4.17 Human Readable Text (HRT) Options + - 4.18 Help Options + - 4.19 Other Options - 5. Using the API - 5.1 Creating and Deleting Symbols - 5.2 Encoding and Saving to File @@ -62,7 +63,7 @@ January 2023 - 5.6 Setting Options - 5.7 Handling Errors - 5.8 Specifying a Symbology - - 5.9 Adjusting Other Output Options + - 5.9 Adjusting Output Options - 5.10 Setting the Input Mode - 5.11 Multiple Segments - 5.12 Scaling Helpers @@ -676,9 +677,11 @@ alternative mode is selected. This command replaces the use of the -d switch. zint -i somefile.txt +To read from stdin specify a single hyphen "-" as the input file. + Note that except when batch processing (see 4.11 Batch Processing below), the -file should not end with a newline (LF on Unix, CR+LF on Windows) unless you -want the newline to be encoded in the symbol. +file (or stdin) should not end with a newline (LF on Unix, CR+LF on Windows) +unless you want the newline to be encoded in the symbol. 4.2 Directing Output @@ -1430,7 +1433,7 @@ This command will output the symbol as a PCX file to stdout. The currently supported output file formats are shown in the following table. Abbreviation File format - -------------- ------------------------------------------- + -------------- ------------------------------------ BMP Windows Bitmap EMF Enhanced Metafile Format EPS Encapsulated PostScript @@ -1439,7 +1442,7 @@ supported output file formats are shown in the following table. PNG Portable Network Graphic SVG Scalable Vector Graphic TIF Tagged Image File Format - TXT Text file (see 4.18 Other Output Options) + TXT Text file (see 4.19 Other Options) : Table : Output File Formats: @@ -1522,7 +1525,24 @@ for all symbols belonging to the same sequence. The index is 1-based and goes from 1 to count. Count must be 2 or more. See the individual symbologies for further details. -4.17 Help Options +4.17 Human Readable Text (HRT) Options + +For linear barcodes the text present in the output image can be removed by using +the --notext option. + +Text can be set to bold using the --bold option, or a smaller font can be +substituted using the --small option. The --bold and --small options can be used +together if required, but only for vector output. + +[zint --bold -d "This Text" --small] + +The gap between the barcode and the text can be adjusted using the --textgap +option, where the gap is given as a multiple of the X-dimension (maximum 5X). A +zero value uses the default gap. + +[zint -d "Áccent" --textgap=0.1] + +4.18 Help Options There are three help options which give information about how to use the command line. The -h or --help option will display a list of all of the valid options @@ -1534,16 +1554,7 @@ numbers and names. The -e or --ecinos option gives a list of the ECI codes. -4.18 Other Output Options - -For linear barcodes the text present in the output image can be removed by using -the --notext option. - -The text can be set to bold using the --bold option, or a smaller font can be -substituted using the --small option. The --bold and --small options can be used -together if required, but only for vector output. - -[zint --bold -d "This Text" --small] +4.19 Other Options Zint can output a representation of the symbol data as a set of hexadecimal values if asked to output to a text file ("*.txt") or if given the option @@ -1656,7 +1667,8 @@ values are 0, 90, 180 and 270. The ZBarcode_Encode_File() and ZBarcode_Encode_File_and_Print() functions can be used to encode data read directly from a text file where the filename is given -in the NUL-terminated filename string. +in the NUL-terminated filename string. The special filename "-" (single hyphen) +can be used to read from stdin. If printing more than one barcode, the zint_symbol structure may be re-used by calling the ZBarcode_Clear() function after each barcode to free any output @@ -1778,23 +1790,27 @@ encoding stages. The zint_symbol structure consists of the following variables: symbology integer Symbol to use (see 5.8 BARCODE_CODE128 Specifying a Symbology). - height float Symbol height, excluding Symbol dependent + height float Symbol height in Symbol dependent + X-dimensions, excluding fixed width-to-height symbols.[7] scale float Scale factor for adjusting 1.0 - size of image. + size of image (sets + X-dimension). - whitespace_width integer Horizontal whitespace width. 0 + whitespace_width integer Horizontal whitespace width 0 + in X-dimensions. - whitespace_height integer Vertical whitespace height. 0 + whitespace_height integer Vertical whitespace height 0 + in X-dimensions. - border_width integer Border width. 0 + border_width integer Border width in 0 + X-dimensions. - output_options integer Set various output file 0 (none) + output_options integer Set various output 0 (none) parameters (see 5.9 - Adjusting Other Output - Options). + Adjusting Output Options). fgcolour character Foreground (ink) colour as "000000" string RGB/RGBA hexadecimal string @@ -1832,7 +1848,8 @@ encoding stages. The zint_symbol structure consists of the following variables: option_3 integer Symbol specific options. 0 - show_hrt integer Set to 0 to hide text. 1 + show_hrt integer Set to 0 to hide Human 1 + Readable Text (HRT). input_mode integer Set encoding of input data DATA_MODE (see 5.10 Setting the Input @@ -1846,10 +1863,15 @@ encoding stages. The zint_symbol structure consists of the following variables: only). dot_size float Diameter of dots used in 0.8 - dotty mode. + dotty mode (in + X-dimensions). + + text_gap float Gap between barcode and text 0 (font-specific + (HRT) in X-dimensions. default) guard_descent float Height of guard bar descent 5.0 - (EAN/UPC only). + (EAN/UPC only) in + X-dimensions. structapp Structured Mark a symbol as part of a count 0 Append sequence of symbols. (disabled) @@ -1878,7 +1900,7 @@ encoding stages. The zint_symbol structure consists of the following variables: arrays row_height array of Representation of the height (output only) - floats of a row. + floats of rows. errtxt character Error message in the event (output only) string that an error occurred, with @@ -2042,7 +2064,7 @@ means the same as symbol->symbology = 50; -5.9 Adjusting Other Output Options +5.9 Adjusting Output Options The output_options variable can be used to adjust various aspects of the output file. To select more than one option from the table below simply OR them @@ -4384,7 +4406,7 @@ defined. Annex B. Man Page ZINT(1) -% ZINT(1) Version 2.12.0.9 % % January 2023 +% ZINT(1) Version 2.12.0.9 % % February 2023 NAME @@ -4615,7 +4637,8 @@ OPTIONS -i, --input=FILE - Read the input data from FILE. + Read the input data from FILE. Specify a single hyphen (-) for FILE to read + from stdin. --init @@ -4778,6 +4801,12 @@ OPTIONS Display the table of barcode types (symbologies). The numbers or names can be used with -b | --barcode. +--textgap=NUMBER + + Adjust the gap between the barcode and the Human Readable Text (HRT). NUMBER + is in multiples of the X-dimension, and may be floating-point. Maximum is 5; + zero results in the default being used. + --vers=INTEGER Set the symbol version (size, check digits, other options) to INTEGER. The diff --git a/docs/zint.1 b/docs/zint.1 index 7e272e25..c948d9a2 100644 --- a/docs/zint.1 +++ b/docs/zint.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pandoc 2.19.2 +.\" Automatically generated by Pandoc 3.0.1 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. @@ -14,7 +14,7 @@ . ftr VB CB . ftr VBI CBI .\} -.TH "ZINT" "1" "January 2023" "Version 2.12.0.9" "" +.TH "ZINT" "1" "February 2023" "Version 2.12.0.9" "" .hy .SH NAME .PP @@ -259,6 +259,8 @@ Affects Codablock-F, Code 16K, Code 49, GS1 DataBar Expanded Stacked .TP \f[V]-i\f[R], \f[V]--input=FILE\f[R] Read the input data from \f[I]FILE\f[R]. +Specify a single hyphen (\f[V]-\f[R]) for \f[I]FILE\f[R] to read from +stdin. .TP \f[V]--init\f[R] Create a Reader Initialisation (Programming) symbol. @@ -444,6 +446,12 @@ Display the table of barcode types (symbologies). The numbers or names can be used with \f[V]-b\f[R] | \f[V]--barcode\f[R]. .TP +\f[V]--textgap=NUMBER\f[R] +Adjust the gap between the barcode and the Human Readable Text (HRT). +\f[I]NUMBER\f[R] is in multiples of the X-dimension, and may be +floating-point. +Maximum is 5; zero results in the default being used. +.TP \f[V]--vers=INTEGER\f[R] Set the symbol version (size, check digits, other options) to \f[I]INTEGER\f[R]. @@ -636,7 +644,7 @@ ISO/IEC 16390:2007, ISO/IEC 16023:2000, ISO/IEC 24728:2006, ISO/IEC (2022) .SH COPYRIGHT .PP -Copyright \[co] 2023 Robin Stuart. +Copyright © 2023 Robin Stuart. Released under GNU GPL 3.0 or later. .SH AUTHOR .PP diff --git a/docs/zint.1.pmd b/docs/zint.1.pmd index 0809a636..97984afa 100644 --- a/docs/zint.1.pmd +++ b/docs/zint.1.pmd @@ -1,6 +1,6 @@ % ZINT(1) Version 2.12.0.9 % -% January 2023 +% February 2023 # NAME @@ -206,7 +206,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S `-i`, `--input=FILE` -: Read the input data from *FILE*. +: Read the input data from *FILE*. Specify a single hyphen (`-`) for *FILE* to read from stdin. `--init` @@ -353,6 +353,11 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S : Display the table of barcode types (symbologies). The numbers or names can be used with `-b` | `--barcode`. +`--textgap=NUMBER` + +: Adjust the gap between the barcode and the Human Readable Text (HRT). *NUMBER* is in multiples of the X-dimension, + and may be floating-point. Maximum is 5; zero results in the default being used. + `--vers=INTEGER` : Set the symbol version (size, check digits, other options) to *INTEGER*. The meaning is symbol-specific. diff --git a/docs/zint_images.sh b/docs/zint_images.sh index 02f0c2fd..2e4020c2 100755 --- a/docs/zint_images.sh +++ b/docs/zint_images.sh @@ -34,6 +34,7 @@ zint -b CODEONE -d "123456789012345678" --dotty --vers=9 --scale=$SCALE_DOTTY -o zint -b AZTEC --eci=9 -d "Κείμενο" --seg1=7,"Текст" --seg2=20,"文章" --scale=$SCALE_2D -o images/aztec_segs.svg zint -b DATAMATRIX -d "2nd of 3" --structapp="2,3,5006" --scale=$SCALE_2D -o images/datamatrix_structapp.svg zint --bold -d "This Text" --small --scale=$SCALE_LINEAR -o images/code128_small_bold.svg +zint -d "Áccent" --textgap=0.1 --scale=$SCALE_LINEAR -o images/code128_textgap.svg zint -b CODE11 -d "9212320967" --scale=$SCALE_LINEAR -o images/code11.svg zint -b C25STANDARD -d "9212320967" --scale=$SCALE_LINEAR -o images/c25standard.svg zint -b C25IATA -d "9212320967" --scale=$SCALE_LINEAR -o images/c25iata.svg diff --git a/frontend/main.c b/frontend/main.c index 361b9cb6..764d9d60 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -115,7 +115,7 @@ static void types(void) { } /* Output version information */ -static void version(int no_png) { +static void version(const int no_png) { const char *no_png_lib = no_png ? " (no libpng)" : ""; const int zint_version = ZBarcode_Version(); const int version_major = zint_version / 10000; @@ -136,7 +136,7 @@ static void version(int no_png) { } /* Output usage information */ -static void usage(int no_png) { +static void usage(const int no_png) { const char *no_png_type = no_png ? "" : "/PNG"; const char *no_png_ext = no_png ? "gif" : "png"; @@ -202,11 +202,12 @@ static void usage(int no_png) { " --square Force Data Matrix symbols to be square\n" " --structapp=I,C[,ID] Set Structured Append info (I index, C count)\n" " -t, --types Display table of barcode types\n", stdout); - fputs( " --vers=NUMBER Set symbol version (size, check digits, other options)\n" + fputs( " --textgap=NUMBER Adjust gap between barcode and HRT in multiples of X-dim\n" + " --vers=NUMBER Set symbol version (size, check digits, other options)\n" " -v, --version Display Zint version\n" " --vwhitesp=NUMBER Set height of vertical whitespace in multiples of X-dim\n" - " -w, --whitesp=NUMBER Set width of horizontal whitespace in multiples of X-dim\n" - " --werror Convert all warnings into errors\n", stdout); + " -w, --whitesp=NUMBER Set width of horizontal whitespace in multiples of X-dim\n", stdout); + fputs( " --werror Convert all warnings into errors\n", stdout); } /* Display supported ECI codes */ @@ -880,7 +881,7 @@ static int batch_process(struct zint_symbol *symbol, const char *filename, const } } - if (!strcmp(filename, "-")) { + if (strcmp(filename, "-") == 0) { file = stdin; } else { file = fopen(filename, "rb"); @@ -1087,6 +1088,8 @@ static void win_free_args(void) { } /* For Windows replace args with UTF-8 versions */ +/* TODO: using `CommandLineToArgvW()` causes shell32.dll to be loaded - replace with own version, see + https://news.ycombinator.com/item?id=18596841 */ static void win_args(int *p_argc, char ***p_argv) { int i; LPWSTR *szArgList = CommandLineToArgvW(GetCommandLineW(), &win_argc); @@ -1148,7 +1151,6 @@ int main(int argc, char **argv) { int rows = 0; char filetype[4] = {0}; int output_given = 0; - int no_png; int png_refused; int val; int i; @@ -1162,18 +1164,18 @@ int main(int argc, char **argv) { arg_opt *arg_opts = (arg_opt *) z_alloca(sizeof(arg_opt) * argc); int no_getopt_error = 1; + const int no_png = ZBarcode_NoPng(); + + if (argc == 1) { + usage(no_png); + exit(ZINT_ERROR_INVALID_DATA); + } + my_symbol = ZBarcode_Create(); if (!my_symbol) { fprintf(stderr, "Error 151: Memory failure\n"); exit(ZINT_ERROR_MEMORY); } - no_png = ZBarcode_NoPng(); - - if (argc == 1) { - ZBarcode_Delete(my_symbol); - usage(no_png); - exit(ZINT_ERROR_INVALID_DATA); - } my_symbol->input_mode = UNICODE_MODE; #ifdef _WIN32 @@ -1191,7 +1193,7 @@ int main(int argc, char **argv) { OPT_NOBACKGROUND, OPT_NOQUIETZONES, OPT_NOTEXT, OPT_PRIMARY, OPT_QUIETZONES, OPT_ROTATE, OPT_ROWS, OPT_SCALE, OPT_SCALEXDIM, OPT_SCMVV, OPT_SECURE, OPT_SEG1, OPT_SEG2, OPT_SEG3, OPT_SEG4, OPT_SEG5, OPT_SEG6, OPT_SEG7, OPT_SEG8, OPT_SEG9, - OPT_SEPARATOR, OPT_SMALL, OPT_SQUARE, OPT_STRUCTAPP, + OPT_SEPARATOR, OPT_SMALL, OPT_SQUARE, OPT_STRUCTAPP, OPT_TEXTGAP, OPT_VERBOSE, OPT_VERS, OPT_VWHITESP, OPT_WERROR }; int option_index = 0; @@ -1267,6 +1269,7 @@ int main(int argc, char **argv) { {"small", 0, NULL, OPT_SMALL}, {"square", 0, NULL, OPT_SQUARE}, {"structapp", 1, NULL, OPT_STRUCTAPP}, + {"textgap", 1, NULL, OPT_TEXTGAP}, {"types", 0, NULL, 't'}, {"verbose", 0, NULL, OPT_VERBOSE}, /* Currently undocumented, output some debug info */ {"vers", 1, NULL, OPT_VERS}, @@ -1682,6 +1685,19 @@ int main(int argc, char **argv) { return do_exit(ZINT_ERROR_INVALID_OPTION); } break; + case OPT_TEXTGAP: + if (!validate_float(optarg, &float_opt, errbuf)) { + fprintf(stderr, "Error 194: Invalid text gap floating point (%s)\n", errbuf); + return do_exit(ZINT_ERROR_INVALID_OPTION); + } + if (float_opt >= 0.0f && float_opt <= 5.0f) { + my_symbol->text_gap = float_opt; + } else { + fprintf(stderr, "Warning 195: Text gap '%g' out of range (0 to 5), ignoring\n", float_opt); + fflush(stderr); + warn_number = ZINT_WARN_INVALID_OPTION; + } + break; case OPT_VERBOSE: my_symbol->debug = 1; break; @@ -1842,6 +1858,12 @@ int main(int argc, char **argv) { } } + if (output_given && (my_symbol->output_options & BARCODE_STDOUT)) { + my_symbol->output_options &= ~BARCODE_STDOUT; + fprintf(stderr, "Warning 193: Output file given, ignoring '--direct' option\n"); + fflush(stderr); + warn_number = ZINT_WARN_INVALID_OPTION; + } if (batch_mode) { /* Take each line of text as a separate data set */ if (data_arg_num > 1) { diff --git a/frontend/tests/test_args.c b/frontend/tests/test_args.c index 6da7ea16..b76a1adc 100644 --- a/frontend/tests/test_args.c +++ b/frontend/tests/test_args.c @@ -774,6 +774,7 @@ static void test_checks(const testCtx *const p_ctx) { int border; int cols; double dotsize; + double textgap; int eci; char *filetype; double height; @@ -794,44 +795,46 @@ static void test_checks(const testCtx *const p_ctx) { }; /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ struct item data[] = { - /* 0*/ { -2, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 139: Invalid add-on gap value (digits only)" }, - /* 1*/ { 6, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 140: Add-on gap out of range (7 to 12), ignoring" }, - /* 2*/ { 13, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 140: Add-on gap out of range (7 to 12), ignoring" }, - /* 3*/ { -1, -2, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 107: Invalid border width value (digits only)" }, - /* 4*/ { -1, 1001, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 108: Border width out of range (0 to 1000), ignoring" }, - /* 5*/ { -1, -1, -1, 12345678, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 181: Invalid dot radius floating point (integer part must be 7 digits maximum)" }, - /* 6*/ { -1, -1, -1, 0.009, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 106: Invalid dot radius value (less than 0.01), ignoring" }, - /* 7*/ { -1, -1, -2, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 131: Invalid columns value (digits only)" }, - /* 8*/ { -1, -1, 201, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 111: Number of columns out of range (1 to 200), ignoring" }, - /* 9*/ { -1, -1, -1, -1, -2, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 138: Invalid ECI value (digits only)" }, - /* 10*/ { -1, -1, -1, -1, 1000000, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 118: ECI code out of range (0 to 999999), ignoring" }, - /* 11*/ { -1, -1, -1, -1, -1, "jpg", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 142: File type 'jpg' not supported, ignoring" }, - /* 12*/ { -1, -1, -1, -1, -1, NULL, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 183: Invalid symbol height floating point (integer part must be digits only)" }, - /* 13*/ { -1, -1, -1, -1, -1, NULL, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '0' out of range (0.5 to 2000), ignoring" }, - /* 14*/ { -1, -1, -1, -1, -1, NULL, 2001, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '2001' out of range (0.5 to 2000), ignoring" }, - /* 15*/ { -1, -1, -1, -1, -1, NULL, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 182: Invalid guard bar descent floating point (integer part must be digits only)" }, - /* 16*/ { -1, -1, -1, -1, -1, NULL, -1, 50.1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 135: Guard bar descent '50.1' out of range (0 to 50), ignoring" }, - /* 17*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 148: Invalid mask value (digits only)" }, - /* 18*/ { -1, -1, -1, -1, -1, NULL, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 147: Mask value out of range (0 to 7), ignoring" }, - /* 19*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 116: Mode value out of range (0 to 6), ignoring" }, - /* 20*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, "Error 117: Invalid rotation value (digits only)" }, - /* 21*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 137: Invalid rotation parameter (0, 90, 180 or 270 only), ignoring" }, - /* 22*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, "Error 132: Invalid rows value (digits only)" }, - /* 23*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, -1, "Warning 112: Number of rows out of range (1 to 90), ignoring" }, - /* 24*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, "Error 184: Invalid scale floating point (integer part must be digits only)" }, - /* 25*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, 0.49, -1, -1, -1, -1, -1, -1, "Warning 146: Scaling less than 0.5 will be set to 0.5 for 'gif' output" }, - /* 26*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, "Error 149: Invalid Structured Carrier Message version value (digits only)" }, - /* 27*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, "Warning 150: Structured Carrier Message version out of range (0 to 99), ignoring" }, - /* 28*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, "Error 134: Invalid ECC value (digits only)" }, - /* 29*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, "Warning 114: ECC level out of range (0 to 8), ignoring" }, - /* 30*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, "Error 128: Invalid separator value (digits only)" }, - /* 31*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, "Warning 127: Separator value out of range (0 to 4), ignoring" }, - /* 32*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, "Error 133: Invalid version value (digits only)" }, - /* 33*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1000, -1, -1, "Warning 113: Version value out of range (1 to 999), ignoring" }, - /* 34*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, "Error 153: Invalid vertical whitespace value '-2' (digits only)" }, - /* 35*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1001, -1, "Warning 154: Vertical whitespace value out of range (0 to 1000), ignoring" }, - /* 36*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, "Error 120: Invalid horizontal whitespace value '-2' (digits only)" }, - /* 37*/ { -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1001, "Warning 121: Horizontal whitespace value out of range (0 to 1000), ignoring" }, + /* 0*/ { -2, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 139: Invalid add-on gap value (digits only)" }, + /* 1*/ { 6, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 140: Add-on gap out of range (7 to 12), ignoring" }, + /* 2*/ { 13, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 140: Add-on gap out of range (7 to 12), ignoring" }, + /* 3*/ { -1, -2, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 107: Invalid border width value (digits only)" }, + /* 4*/ { -1, 1001, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 108: Border width out of range (0 to 1000), ignoring" }, + /* 5*/ { -1, -1, -1, -1, -0.5, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 194: Invalid text gap floating point (integer part must be digits only)" }, + /* 6*/ { -1, -1, -1, -1, 5.01, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 195: Text gap '5.01' out of range (0 to 5), ignoring" }, + /* 7*/ { -1, -1, -1, 12345678, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 181: Invalid dot radius floating point (integer part must be 7 digits maximum)" }, + /* 8*/ { -1, -1, -1, 0.009, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 106: Invalid dot radius value (less than 0.01), ignoring" }, + /* 9*/ { -1, -1, -2, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 131: Invalid columns value (digits only)" }, + /* 10*/ { -1, -1, 201, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 111: Number of columns out of range (1 to 200), ignoring" }, + /* 11*/ { -1, -1, -1, -1, -1, -2, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 138: Invalid ECI value (digits only)" }, + /* 12*/ { -1, -1, -1, -1, -1, 1000000, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 118: ECI code out of range (0 to 999999), ignoring" }, + /* 13*/ { -1, -1, -1, -1, -1, -1, "jpg", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 142: File type 'jpg' not supported, ignoring" }, + /* 14*/ { -1, -1, -1, -1, -1, -1, NULL, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 183: Invalid symbol height floating point (integer part must be digits only)" }, + /* 15*/ { -1, -1, -1, -1, -1, -1, NULL, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '0' out of range (0.5 to 2000), ignoring" }, + /* 16*/ { -1, -1, -1, -1, -1, -1, NULL, 2001, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 110: Symbol height '2001' out of range (0.5 to 2000), ignoring" }, + /* 17*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 182: Invalid guard bar descent floating point (integer part must be digits only)" }, + /* 18*/ { -1, -1, -1, -1, -1, -1, NULL, -1, 50.1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 135: Guard bar descent '50.1' out of range (0 to 50), ignoring" }, + /* 19*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Error 148: Invalid mask value (digits only)" }, + /* 20*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 147: Mask value out of range (0 to 7), ignoring" }, + /* 21*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 116: Mode value out of range (0 to 6), ignoring" }, + /* 22*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, "Error 117: Invalid rotation value (digits only)" }, + /* 23*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, "Warning 137: Invalid rotation parameter (0, 90, 180 or 270 only), ignoring" }, + /* 24*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, "Error 132: Invalid rows value (digits only)" }, + /* 25*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, -1, "Warning 112: Number of rows out of range (1 to 90), ignoring" }, + /* 26*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, "Error 184: Invalid scale floating point (integer part must be digits only)" }, + /* 27*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, 0.49, -1, -1, -1, -1, -1, -1, "Warning 146: Scaling less than 0.5 will be set to 0.5 for 'gif' output" }, + /* 28*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, "Error 149: Invalid Structured Carrier Message version value (digits only)" }, + /* 29*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, "Warning 150: Structured Carrier Message version out of range (0 to 99), ignoring" }, + /* 30*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, "Error 134: Invalid ECC value (digits only)" }, + /* 31*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, "Warning 114: ECC level out of range (0 to 8), ignoring" }, + /* 32*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, "Error 128: Invalid separator value (digits only)" }, + /* 33*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, "Warning 127: Separator value out of range (0 to 4), ignoring" }, + /* 34*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, "Error 133: Invalid version value (digits only)" }, + /* 35*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1000, -1, -1, "Warning 113: Version value out of range (1 to 999), ignoring" }, + /* 36*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, "Error 153: Invalid vertical whitespace value '-2' (digits only)" }, + /* 37*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1001, -1, "Warning 154: Vertical whitespace value out of range (0 to 1000), ignoring" }, + /* 38*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, "Error 120: Invalid horizontal whitespace value '-2' (digits only)" }, + /* 39*/ { -1, -1, -1, -1, -1, -1, NULL, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1001, "Warning 121: Horizontal whitespace value out of range (0 to 1000), ignoring" }, }; int data_size = ARRAY_SIZE(data); int i; @@ -855,6 +858,7 @@ static void test_checks(const testCtx *const p_ctx) { arg_int(cmd, "--border=", data[i].border); arg_int(cmd, "--cols=", data[i].cols); arg_double(cmd, "--dotsize=", data[i].dotsize); + arg_double(cmd, "--textgap=", data[i].textgap); arg_int(cmd, "--eci=", data[i].eci); arg_data(cmd, "--filetype=", data[i].filetype); arg_double(cmd, "--height=", data[i].height); @@ -1150,13 +1154,13 @@ static void test_other_opts(const testCtx *const p_ctx) { /* 0*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900", "", 0 }, /* 1*/ { BARCODE_CODE128, "1", -1, " -bg=", "EF9900", "", 0 }, /* 2*/ { BARCODE_CODE128, "1", -1, " --bg=", "EF9900AA", "", 0 }, - /* 3*/ { BARCODE_CODE128, "1", -1, " --bg=", "GF9900", "Error 691: Malformed background RGB colour 'GF9900' (hexadecimal only)", 0 }, + /* 3*/ { BARCODE_CODE128, "1", -1, " --bg=", "GF9900", "Error 881: Malformed background RGB colour 'GF9900' (hexadecimal only)", 0 }, /* 4*/ { BARCODE_CODE128, "1", -1, " --bgcolor=", "EF9900", "", 0 }, /* 5*/ { BARCODE_CODE128, "1", -1, " --bgcolour=", "EF9900", "", 0 }, /* 6*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000", "", 0 }, /* 7*/ { BARCODE_CODE128, "1", -1, " --fg=", "00000000", "", 0 }, - /* 8*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000F", "Error 690: Malformed foreground RGB colour (6 or 8 characters only)", 0 }, - /* 9*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000FG", "Error 691: Malformed foreground RGB colour '000000FG' (hexadecimal only)", 0 }, + /* 8*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000F", "Error 880: Malformed foreground RGB colour (6 or 8 characters only)", 0 }, + /* 9*/ { BARCODE_CODE128, "1", -1, " --fg=", "000000FG", "Error 881: Malformed foreground RGB colour '000000FG' (hexadecimal only)", 0 }, /* 10*/ { BARCODE_CODE128, "1", -1, " --fg=", "0,0,0,100", "", 0 }, /* 11*/ { BARCODE_CODE128, "1", -1, " --fgcolor=", "111111", "", 0 }, /* 12*/ { BARCODE_CODE128, "1", -1, " --fgcolour=", "111111", "", 0 }, diff --git a/frontend_qt/mainWindow.ui b/frontend_qt/mainWindow.ui index b597d01d..46ec9818 100644 --- a/frontend_qt/mainWindow.ui +++ b/frontend_qt/mainWindow.ui @@ -1881,6 +1881,69 @@ the barcode in X-dimensions + + + Gap between barcode and text +(ignored if disabled) + + + Text Gap: + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + spnTextGap + + + + + + + Gap between barcode and text +(ignored if disabled) + + + X + + + + 2 + + + 0.000000000000000 + + + 5.000000000000000 + + + 0.100000000000000 + + + 0.000000000000000 + + + Default + + + + + + + + 22 + 26 + + + + Set text gap to zero (default) + + + + + + + Image scale when output to file @@ -1897,7 +1960,7 @@ the barcode in X-dimensions - + Image scale when output to file @@ -1923,7 +1986,7 @@ the barcode in X-dimensions - + @@ -1939,7 +2002,7 @@ the barcode in X-dimensions - + Image size (width x height) of barcode @@ -1953,7 +2016,7 @@ at given dot density - + Image size (width x height) of barcode diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 8e0c8bfb..d75bce81 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -316,6 +316,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl) btnClearDataSeg2->setIcon(clearIcon); btnClearDataSeg3->setIcon(clearIcon); btnClearComposite->setIcon(clearIcon); + btnClearTextGap->setIcon(clearIcon); btnZap->setIcon(QIcon(QSL(":res/zap.svg"))); change_options(); @@ -329,6 +330,9 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl) connect(bwidth, SIGNAL(valueChanged( int )), SLOT(update_preview())); connect(btype, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(cmbFontSetting, SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); + connect(spnTextGap, SIGNAL(valueChanged( double )), SLOT(text_gap_zero())); + connect(spnTextGap, SIGNAL(valueChanged( double )), SLOT(update_preview())); + connect(btnClearTextGap, SIGNAL(clicked( bool )), SLOT(clear_text_gap())); connect(txtData, SIGNAL(textChanged( const QString& )), SLOT(data_ui_set())); connect(txtData, SIGNAL(textChanged( const QString& )), SLOT(update_preview())); connect(txtDataSeg1, SIGNAL(textChanged( const QString& )), SLOT(data_ui_set())); @@ -463,6 +467,7 @@ MainWindow::~MainWindow() settings.setValue(QSL("studio/appearance/scale"), spnScale->value()); settings.setValue(QSL("studio/appearance/border_type"), btype->currentIndex()); settings.setValue(QSL("studio/appearance/font_setting"), cmbFontSetting->currentIndex()); + settings.setValue(QSL("studio/appearance/text_gap"), spnTextGap->value()); settings.setValue(QSL("studio/appearance/chk_hrt_show"), chkHRTShow->isChecked() ? 1 : 0); settings.setValue(QSL("studio/appearance/chk_cmyk"), chkCMYK->isChecked() ? 1 : 0); settings.setValue(QSL("studio/appearance/chk_quiet_zones"), chkQuietZones->isChecked() ? 1 : 0); @@ -528,6 +533,7 @@ void MainWindow::load_settings(QSettings &settings) spnScale->setValue(settings.value(QSL("studio/appearance/scale"), 1.0).toFloat()); btype->setCurrentIndex(settings.value(QSL("studio/appearance/border_type"), 0).toInt()); cmbFontSetting->setCurrentIndex(settings.value(QSL("studio/appearance/font_setting"), 0).toInt()); + spnTextGap->setValue(settings.value(QSL("studio/appearance/text_gap"), 0.0).toFloat()); chkHRTShow->setChecked(settings.value(QSL("studio/appearance/chk_hrt_show"), 1).toInt() ? true : false); chkCMYK->setChecked(settings.value(QSL("studio/appearance/chk_cmyk"), 0).toInt() ? true : false); chkQuietZones->setChecked(settings.value(QSL("studio/appearance/chk_quiet_zones"), 0).toInt() ? true : false); @@ -1141,6 +1147,15 @@ void MainWindow::HRTShow_ui_set() bool enabled = chkHRTShow->isEnabled() && chkHRTShow->isChecked(); lblFontSetting->setEnabled(enabled); cmbFontSetting->setEnabled(enabled); + lblTextGap->setEnabled(enabled); + spnTextGap->setEnabled(enabled); + text_gap_ui_set(); +} + +void MainWindow::text_gap_ui_set() +{ + bool hrtEnabled = chkHRTShow->isEnabled() && chkHRTShow->isChecked(); + btnClearTextGap->setEnabled(hrtEnabled && spnTextGap->value() != 0.0); } void MainWindow::dotty_ui_set() @@ -1244,6 +1259,23 @@ void MainWindow::structapp_ui_set() } } +void MainWindow::text_gap_zero() +{ + // Make sure special text "Default" triggered as QDoubleSpinBox can return values almost but not quite zero + double val = spnTextGap->value(); + if (val != 0.0 && val < 0.0001) { + spnTextGap->setValue(0.0); + } + text_gap_ui_set(); +} + +void MainWindow::clear_text_gap() +{ + spnTextGap->setValue(0.0); + spnTextGap->setFocus(); + update_preview(); +} + void MainWindow::on_encoded() { // Protect against encode in Sequence Export popup dialog @@ -2130,9 +2162,10 @@ void MainWindow::change_options() file.close(); load_sub_settings(settings, symbology); tabMain->insertTab(1, m_optionWidget, tr("UPC-&A")); - combobox_item_enabled(cmbFontSetting, 1, false); - if (cmbFontSetting->currentIndex() == 1) { - cmbFontSetting->setCurrentIndex(0); + combobox_item_enabled(cmbFontSetting, 1, false); // Disable bold options + combobox_item_enabled(cmbFontSetting, 3, false); + if (cmbFontSetting->currentIndex() == 1 || cmbFontSetting->currentIndex() == 3) { + cmbFontSetting->setCurrentIndex(cmbFontSetting->currentIndex() - 1); } connect(get_widget(QSL("cmbUPCAAddonGap")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("spnUPCAGuardDescent")), SIGNAL(valueChanged( double )), SLOT(update_preview())); @@ -2155,9 +2188,10 @@ void MainWindow::change_options() } else { tabMain->insertTab(1, m_optionWidget, tr("&EAN")); } - combobox_item_enabled(cmbFontSetting, 1, false); - if (cmbFontSetting->currentIndex() == 1) { - cmbFontSetting->setCurrentIndex(0); + combobox_item_enabled(cmbFontSetting, 1, false); // Disable bold options + combobox_item_enabled(cmbFontSetting, 3, false); + if (cmbFontSetting->currentIndex() == 1 || cmbFontSetting->currentIndex() == 3) { + cmbFontSetting->setCurrentIndex(cmbFontSetting->currentIndex() - 1); } connect(get_widget(QSL("cmbUPCEANAddonGap")), SIGNAL(currentIndexChanged( int )), SLOT(update_preview())); connect(get_widget(QSL("spnUPCEANGuardDescent")), SIGNAL(valueChanged( double )), SLOT(update_preview())); @@ -3166,6 +3200,7 @@ void MainWindow::update_preview() m_bc.bc.setVWhitespace(spnVWhitespace->value()); m_bc.bc.setQuietZones(chkQuietZones->isEnabled() && chkQuietZones->isChecked()); m_bc.bc.setFontSetting(cmbFontSetting->currentIndex()); + m_bc.bc.setTextGap(spnTextGap->value()); m_bc.bc.setRotateAngle(cmbRotate->currentIndex()); m_bc.bc.setDotty(chkDotty->isEnabled() && chkDotty->isChecked()); if (m_symbology == BARCODE_DOTCODE || (chkDotty->isEnabled() && chkDotty->isChecked())) { @@ -3940,6 +3975,7 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) settings.setValue(QSL("studio/bc/%1/appearance/border_type").arg(name), btype->currentIndex()); if (chkHRTShow->isEnabled()) { settings.setValue(QSL("studio/bc/%1/appearance/font_setting").arg(name), cmbFontSetting->currentIndex()); + settings.setValue(QSL("studio/bc/%1/appearance/text_gap").arg(name), spnTextGap->value()); settings.setValue(QSL("studio/bc/%1/appearance/chk_hrt_show").arg(name), chkHRTShow->isChecked() ? 1 : 0); } settings.setValue(QSL("studio/bc/%1/appearance/chk_cmyk").arg(name), chkCMYK->isChecked() ? 1 : 0); @@ -4334,6 +4370,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) if (chkHRTShow->isEnabled()) { cmbFontSetting->setCurrentIndex(settings.value( QSL("studio/bc/%1/appearance/font_setting").arg(name), 0).toInt()); + spnTextGap->setValue(settings.value(QSL("studio/bc/%1/appearance/text_gap").arg(name), 0.0).toFloat()); chkHRTShow->setChecked(settings.value( QSL("studio/bc/%1/appearance/chk_hrt_show").arg(name), 1).toInt() ? true : false); } diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index 7dda1fed..af5c70f0 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -69,9 +69,12 @@ public slots: void change_cmyk(); void autoheight_ui_set(); void HRTShow_ui_set(); + void text_gap_ui_set(); void dotty_ui_set(); void codeone_ui_set(); void structapp_ui_set(); + void text_gap_zero(); + void clear_text_gap(); void on_encoded(); void on_errored(); void on_dataChanged(const QString& text, bool escaped, int seg_no);