From 32c9e6a98e731c19ea1a19ba34f056c06056d50b Mon Sep 17 00:00:00 2001 From: gitlost Date: Tue, 18 Jul 2023 11:11:50 +0100 Subject: [PATCH] Remove `bitmap_byte_length` member from `zint_symbol` (was only set on BMP output to length of BMP pixel array) EXCODE39: change to display check digit in HRT by default CODE39/EXCODE39/LOGMARS: new hidden check digit option (`option_2 = 2`) qr.c: suppress bogus gcc-13 warning (only appears on optimize) GUI: move some symbology-specific options into Data Tab so separate tab unnecessary (those with few options and no Composite/ECI), namely: all C25XXX, CODE39/EXCODE39/LOGMARS, MSI_PLESSEY, CODABAR, DAFT, DPD, MAILMARK_2D, ITF-14, PZN, UPNQR, CHANNEL, CODE93 and VIN, adjusting grp uis. change Data dialog button (ellipsis) QToolButton -> QPushButton & vice versa zap/clear/eye/swap/scale buttons QPushButton -> QToolButton for better mac compat (also makes sense); remove some mac hacks that no longer seem necessary; use folder icon for Export dialog directory button manual: document new Symbology-specific groupbox & CODE39/etc hidden check digit option; add annexes on Qt and Tcl backends; narrow some tables for better txt output; remove echoed image tags in txt (pandoc 3.1.5 regression?); add one-page HTML output to Makefile; also tex output (debug); add class attributes to images to aid HTML styling; various other fiddlings --- ChangeLog | 14 +- README.linux | 4 +- backend/bmp.c | 2 - backend/code.c | 26 +- backend/library.c | 1 - backend/qr.c | 10 + backend/tests/test_code.c | 141 +-- backend/tests/test_library.c | 4 - backend/zint.h | 3 +- docs/Makefile | 50 +- docs/README | 10 +- docs/images/gui_appearance.png | Bin 340031 -> 339141 bytes docs/images/gui_aztec.png | Bin 232751 -> 232378 bytes docs/images/gui_c25inter.png | Bin 0 -> 216368 bytes docs/images/gui_composite.png | Bin 282641 -> 278257 bytes docs/images/gui_export.png | Bin 122337 -> 122226 bytes docs/images/gui_main.png | Bin 240724 -> 240339 bytes docs/images/gui_segs.png | Bin 262395 -> 261670 bytes docs/images/tcl_demo.png | Bin 0 -> 36025 bytes docs/inc_before_body_html.html | 4 + docs/inc_header_pdf.tex | 1 - docs/manual.pmd | 1481 ++++++++++++++++++-------------- docs/manual.txt | 865 +++++++++++-------- docs/templates/default.html | 76 ++ docs/templates/styles.html | 291 +++++++ docs/zint.1 | 8 +- docs/zint.1.pmd | 19 +- frontend_qt/exportwindow.cpp | 4 +- frontend_qt/extData.ui | 4 +- frontend_qt/grpC11.ui | 33 +- frontend_qt/grpC25.ui | 30 +- frontend_qt/grpC39.ui | 63 +- frontend_qt/grpC93.ui | 30 +- frontend_qt/grpChannel.ui | 68 +- frontend_qt/grpCodabar.ui | 30 +- frontend_qt/grpCodeOne.ui | 10 +- frontend_qt/grpDAFT.ui | 49 +- frontend_qt/grpDPD.ui | 30 +- frontend_qt/grpDotCode.ui | 10 +- frontend_qt/grpGrid.ui | 8 +- frontend_qt/grpHX.ui | 6 +- frontend_qt/grpITF14.ui | 30 +- frontend_qt/grpMQR.ui | 54 +- frontend_qt/grpMSICheck.ui | 64 +- frontend_qt/grpMailmark2D.ui | 30 +- frontend_qt/grpMaxicode.ui | 14 +- frontend_qt/grpPZN.ui | 30 +- frontend_qt/grpRMQR.ui | 6 +- frontend_qt/grpUPNQR.ui | 33 +- frontend_qt/grpUltra.ui | 10 +- frontend_qt/grpVIN.ui | 32 +- frontend_qt/mainWindow.ui | 97 ++- frontend_qt/mainwindow.cpp | 131 ++- frontend_qt/mainwindow.h | 8 +- frontend_qt/res/folder.svg | 1 + frontend_qt/resources.qrc | 1 + 56 files changed, 2419 insertions(+), 1507 deletions(-) create mode 100644 docs/images/gui_c25inter.png create mode 100644 docs/images/tcl_demo.png create mode 100644 docs/inc_before_body_html.html create mode 100644 docs/templates/default.html create mode 100644 docs/templates/styles.html create mode 100644 frontend_qt/res/folder.svg diff --git a/ChangeLog b/ChangeLog index fc9047f0..850b2ac8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,7 +3,7 @@ Version 2.12.0.9 (dev) not released yet **Incompatible changes** ------------------------ -- Buffer lengths of fields `fgcolour` and `bgcolour` in `zint_symbol` extended +- Buffer lengths of members `fgcolour` and `bgcolour` in `zint_symbol` extended 10 -> 16 to allow 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 @@ -15,8 +15,8 @@ Version 2.12.0.9 (dev) not released yet - Text height (font size) for SMALL_TEXT vector output reduced - For Windows, filenames are now assumed to be UTF-8 encoded. Affects `outfile` in `zint_symbol` and all API filename arguments -- Never-used `fontsize` field removed from `zint_symbol` -- Buffer length of field `text` (HRT) in `zint_symbol` extended 128 -> 160 +- Never-used `fontsize` member removed from `zint_symbol` +- Buffer length of member `text` (HRT) in `zint_symbol` extended 128 -> 160 (client buffers may need checking/extending) - Font of text of SVG vector output now "OCRB, monospace" (EAN/UPC) or "Arimo, Arial, sans-serif" (all others) @@ -24,6 +24,9 @@ Version 2.12.0.9 (dev) not released yet - Unintended excess horizontal whitespace of Composite symbols removed, and quiet zone settings respected exactly, and centring of HRT (if any) now relative to linear part of symbol only rather than whole symbol +- Unlikely-to-be-used `bitmap_byte_length` member removed from `zint_symbol` + (was only set on BMP output to length of BMP pixel array) +- EXCODE39 now defaults to displaying check digit in Human Readable Text (HRT) Changes ------- @@ -73,6 +76,11 @@ Changes adjust text to baseline using values for Arimo rather than percentage - manual: expand size/alpha details in Section "5.4 Buffering Symbols in Memory (raster)" (cf ticket #291); add BSD info +- EXCODE39: change to display check digit in HRT by default +- CODE39/EXCODE39/LOGMARS: new hidden check digit option +- GUI: move some symbology-specific options into Data Tab so separate tab + unnecessary +- manual: add annexes on Qt and Tcl backends Bugs ---- diff --git a/README.linux b/README.linux index ee0fb1bf..3576039f 100644 --- a/README.linux +++ b/README.linux @@ -1,4 +1,4 @@ -% Tested on Ubuntu 20.04.4 LTS, Ubuntu 22.04 LTS and Fedora Linux 36 (Workstation Edition) +% Tested on Ubuntu 20.04.4 LTS, Ubuntu 22.04 LTS and Fedora Linux 38 (Workstation Edition) 1. Prerequisites for building zint ================================== @@ -60,7 +60,7 @@ or Ubuntu 20.04 sudo apt install qt5-default qt5-uitools -or Fedora 36 (not recommended) +or Fedora 38 (not recommended) sudo dnf install qt5-qtbase-devel qt5-qttools-devel qt5-qttools-static qt5-qtsvg-devel diff --git a/backend/bmp.c b/backend/bmp.c index ae06c66c..28855061 100644 --- a/backend/bmp.c +++ b/backend/bmp.c @@ -122,8 +122,6 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, const unsigned char *pix } } - symbol->bitmap_byte_length = data_size; - file_header.header_field = 0x4d42; /* "BM" */ file_header.file_size = file_size; file_header.reserved = 0; diff --git a/backend/code.c b/backend/code.c index 05f49171..e06b6897 100644 --- a/backend/code.c +++ b/backend/code.c @@ -248,7 +248,7 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng counter = 0; - if ((symbol->option_2 < 0) || (symbol->option_2 > 1)) { + if ((symbol->option_2 < 0) || (symbol->option_2 > 2)) { symbol->option_2 = 0; } @@ -281,7 +281,7 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng counter += posns[i]; } - if (symbol->option_2 == 1) { + if (symbol->option_2 == 1 || symbol->option_2 == 2) { /* Visible or hidden check digit */ char check_digit; counter %= 43; @@ -294,8 +294,10 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng check_digit = '_'; } - localstr[0] = check_digit; - localstr[1] = '\0'; + if (symbol->option_2 == 1) { /* Visible check digit */ + localstr[0] = check_digit; + localstr[1] = '\0'; + } if (symbol->debug & ZINT_DEBUG_PRINT) printf("Check digit: %c\n", check_digit); } @@ -442,6 +444,7 @@ INTERNAL int excode39(struct zint_symbol *symbol, unsigned char source[], int le unsigned char buffer[85 * 2 + 1] = {0}; unsigned char *b = buffer; + unsigned char check_digit = '\0'; int i; int error_number; @@ -469,9 +472,22 @@ INTERNAL int excode39(struct zint_symbol *symbol, unsigned char source[], int le /* Then sends the buffer to the C39 function */ error_number = code39(symbol, buffer, b - buffer); + /* Save visible check digit */ + if (symbol->option_2 == 1) { + const int len = (int) ustrlen(symbol->text); + if (len > 0) { + check_digit = symbol->text[len - 1]; + } + } + + /* Copy over source to HRT, subbing space for unprintables */ for (i = 0; i < length; i++) symbol->text[i] = source[i] >= ' ' && source[i] != 0x7F ? source[i] : ' '; - symbol->text[length] = '\0'; /* Chops off check digit */ + + if (check_digit) { + symbol->text[i++] = check_digit; + } + symbol->text[i] = '\0'; return error_number; } diff --git a/backend/library.c b/backend/library.c index de2ca3da..1181f4c9 100644 --- a/backend/library.c +++ b/backend/library.c @@ -108,7 +108,6 @@ void ZBarcode_Clear(struct zint_symbol *symbol) { } symbol->bitmap_width = 0; symbol->bitmap_height = 0; - symbol->bitmap_byte_length = 0; /* If there is a rendered version, ensure its memory is released */ vector_free(symbol); diff --git a/backend/qr.c b/backend/qr.c index 15e596cf..bc70c1aa 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -871,6 +871,12 @@ static void qr_place_align(unsigned char grid[], const int size, int x, int y) { static void qr_setup_grid(unsigned char *grid, const int size, const int version) { int i, toggle = 1; +/* Suppress false positive gcc-13 warning (when optimizing only) "writing 1 byte into a region of size 0" */ +#if defined(__GNUC__) && __GNUC__ == 13 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif + /* Add timing patterns */ for (i = 0; i < size; i++) { if (toggle == 1) { @@ -902,6 +908,10 @@ static void qr_setup_grid(unsigned char *grid, const int size, const int version grid[(7 * size) + (size - 8)] = 0x10; grid[((size - 8) * size) + 7] = 0x10; +#if defined(__GNUC__) && __GNUC__ == 13 +#pragma GCC diagnostic pop +#endif + /* Add alignment patterns */ if (version != 1) { /* Version 1 does not have alignment patterns */ diff --git a/backend/tests/test_code.c b/backend/tests/test_code.c index 2ce8ed61..79fdf4a4 100644 --- a/backend/tests/test_code.c +++ b/backend/tests/test_code.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2022 Robin Stuart + Copyright (C) 2020-2023 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -124,35 +124,43 @@ static void test_hrt(const testCtx *const p_ctx) { /* 2*/ { BARCODE_CODE11, 2, "123-45", -1, "123-45" }, /* No checksums */ /* 3*/ { BARCODE_CODE11, -1, "123456789012", -1, "123456789012-8" }, /* First check digit 10 (A) goes to hyphen */ /* 4*/ { BARCODE_CODE39, -1, "ABC1234", -1, "*ABC1234*" }, - /* 5*/ { BARCODE_CODE39, -1, "abc1234", -1, "*ABC1234*" }, /* Converts to upper */ - /* 6*/ { BARCODE_CODE39, -1, "123456789", -1, "*123456789*" }, - /* 7*/ { BARCODE_CODE39, 1, "123456789", -1, "*1234567892*" }, /* With check digit */ - /* 8*/ { BARCODE_EXCODE39, -1, "ABC1234", -1, "ABC1234" }, - /* 9*/ { BARCODE_EXCODE39, -1, "abc1234", -1, "abc1234" }, - /* 10*/ { BARCODE_EXCODE39, 1, "abc1234", -1, "abc1234" }, /* With check digit (not displayed) */ - /* 11*/ { BARCODE_EXCODE39, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~" }, /* NUL, ctrls and DEL replaced with spaces */ - /* 12*/ { BARCODE_LOGMARS, -1, "ABC1234", -1, "ABC1234" }, - /* 13*/ { BARCODE_LOGMARS, -1, "abc1234", -1, "ABC1234" }, /* Converts to upper */ - /* 14*/ { BARCODE_LOGMARS, 1, "abc1234", -1, "ABC12340" }, /* With check digit */ - /* 15*/ { BARCODE_LOGMARS, 1, "12345/ABCDE", -1, "12345/ABCDET" }, /* With check digit */ - /* 16*/ { BARCODE_CODE93, -1, "ABC1234", -1, "ABC1234" }, /* No longer shows 2 check chars added (same as BWIPP and TEC-IT) */ - /* 17*/ { BARCODE_CODE93, 1, "ABC1234", -1, "ABC1234S5" }, /* Unless requested */ - /* 18*/ { BARCODE_CODE93, -1, "abc1234", -1, "abc1234" }, - /* 19*/ { BARCODE_CODE93, 1, "abc1234", -1, "abc1234ZG" }, - /* 20*/ { BARCODE_CODE93, -1, "A\001a\000b\177d\037e", 9, "A a b d e" }, /* NUL, ctrls and DEL replaced with spaces */ - /* 21*/ { BARCODE_PZN, -1, "12345", -1, "PZN - 00123458" }, /* Pads with zeroes if length < 7 */ - /* 22*/ { BARCODE_PZN, -1, "123456", -1, "PZN - 01234562" }, - /* 23*/ { BARCODE_PZN, -1, "1234567", -1, "PZN - 12345678" }, - /* 24*/ { BARCODE_PZN, -1, "12345678", -1, "PZN - 12345678" }, - /* 25*/ { BARCODE_PZN, 1, "1234", -1, "PZN - 0012345" }, /* PZN7, pads with zeroes if length < 6 */ - /* 26*/ { BARCODE_PZN, 1, "12345", -1, "PZN - 0123458" }, - /* 27*/ { BARCODE_PZN, 1, "123456", -1, "PZN - 1234562" }, - /* 28*/ { BARCODE_PZN, 1, "1234562", -1, "PZN - 1234562" }, - /* 29*/ { BARCODE_VIN, -1, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180" }, - /* 30*/ { BARCODE_VIN, 1, "2FTPX28L0XCA15511", -1, "2FTPX28L0XCA15511" }, /* Include Import char - no change */ - /* 31*/ { BARCODE_HIBC_39, -1, "ABC1234", -1, "*+ABC1234+*" }, - /* 32*/ { BARCODE_HIBC_39, -1, "abc1234", -1, "*+ABC1234+*" }, /* Converts to upper */ - /* 33*/ { BARCODE_HIBC_39, -1, "123456789", -1, "*+1234567890*" }, + /* 5*/ { BARCODE_CODE39, 1, "ABC1234", -1, "*ABC12340*" }, /* With visible check digit */ + /* 6*/ { BARCODE_CODE39, -1, "abc1234", -1, "*ABC1234*" }, /* Converts to upper */ + /* 7*/ { BARCODE_CODE39, 1, "abc1234", -1, "*ABC12340*" }, /* Converts to upper */ + /* 8*/ { BARCODE_CODE39, -1, "123456789", -1, "*123456789*" }, + /* 9*/ { BARCODE_CODE39, 1, "123456789", -1, "*1234567892*" }, /* With visible check digit */ + /* 10*/ { BARCODE_CODE39, 2, "123456789", -1, "*123456789*" }, /* With hidden check digit */ + /* 11*/ { BARCODE_EXCODE39, -1, "ABC1234", -1, "ABC1234" }, + /* 12*/ { BARCODE_EXCODE39, 1, "ABC1234", -1, "ABC12340" }, /* With visible check digit */ + /* 13*/ { BARCODE_EXCODE39, -1, "abc1234", -1, "abc1234" }, + /* 14*/ { BARCODE_EXCODE39, 1, "abc1234", -1, "abc1234." }, /* With visible check digit (previously was hidden) */ + /* 15*/ { BARCODE_EXCODE39, 2, "abc1234", -1, "abc1234" }, /* With hidden check digit */ + /* 16*/ { BARCODE_EXCODE39, -1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~" }, /* NUL, ctrls and DEL replaced with spaces */ + /* 17*/ { BARCODE_EXCODE39, 1, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~L" }, /* With visible check digit */ + /* 18*/ { BARCODE_EXCODE39, 2, "a%\000\001$\177z\033\037!+/\\@A~", 16, "a% $ z !+/\\@A~" }, /* With hidden check digit */ + /* 19*/ { BARCODE_LOGMARS, -1, "ABC1234", -1, "ABC1234" }, + /* 20*/ { BARCODE_LOGMARS, -1, "abc1234", -1, "ABC1234" }, /* Converts to upper */ + /* 21*/ { BARCODE_LOGMARS, 1, "abc1234", -1, "ABC12340" }, /* With check digit */ + /* 22*/ { BARCODE_LOGMARS, 1, "12345/ABCDE", -1, "12345/ABCDET" }, /* With visible check digit */ + /* 23*/ { BARCODE_LOGMARS, 2, "12345/ABCDE", -1, "12345/ABCDE" }, /* With hidden check digit */ + /* 24*/ { BARCODE_CODE93, -1, "ABC1234", -1, "ABC1234" }, /* No longer shows 2 check chars added (same as BWIPP and TEC-IT) */ + /* 25*/ { BARCODE_CODE93, 1, "ABC1234", -1, "ABC1234S5" }, /* Unless requested */ + /* 26*/ { BARCODE_CODE93, -1, "abc1234", -1, "abc1234" }, + /* 27*/ { BARCODE_CODE93, 1, "abc1234", -1, "abc1234ZG" }, + /* 28*/ { BARCODE_CODE93, -1, "A\001a\000b\177d\037e", 9, "A a b d e" }, /* NUL, ctrls and DEL replaced with spaces */ + /* 29*/ { BARCODE_PZN, -1, "12345", -1, "PZN - 00123458" }, /* Pads with zeroes if length < 7 */ + /* 30*/ { BARCODE_PZN, -1, "123456", -1, "PZN - 01234562" }, + /* 31*/ { BARCODE_PZN, -1, "1234567", -1, "PZN - 12345678" }, + /* 32*/ { BARCODE_PZN, -1, "12345678", -1, "PZN - 12345678" }, + /* 33*/ { BARCODE_PZN, 1, "1234", -1, "PZN - 0012345" }, /* PZN7, pads with zeroes if length < 6 */ + /* 34*/ { BARCODE_PZN, 1, "12345", -1, "PZN - 0123458" }, + /* 35*/ { BARCODE_PZN, 1, "123456", -1, "PZN - 1234562" }, + /* 36*/ { BARCODE_PZN, 1, "1234562", -1, "PZN - 1234562" }, + /* 37*/ { BARCODE_VIN, -1, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180" }, + /* 38*/ { BARCODE_VIN, 1, "2FTPX28L0XCA15511", -1, "2FTPX28L0XCA15511" }, /* Include Import char - no change */ + /* 39*/ { BARCODE_HIBC_39, -1, "ABC1234", -1, "*+ABC1234+*" }, + /* 40*/ { BARCODE_HIBC_39, -1, "abc1234", -1, "*+ABC1234+*" }, /* Converts to upper */ + /* 41*/ { BARCODE_HIBC_39, -1, "123456789", -1, "*+1234567890*" }, }; int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -222,40 +230,45 @@ static void test_input(const testCtx *const p_ctx) { /* 25*/ { BARCODE_CODE39, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* 26*/ { BARCODE_CODE39, 0, "1", -1, 0, 1, 38 }, /* 27*/ { BARCODE_CODE39, 1, "1", -1, 0, 1, 51 }, /* Check digit */ - /* 28*/ { BARCODE_CODE39, 2, "1", -1, 0, 1, 38 }, /* option_2 > 1 gnored */ - /* 29*/ { BARCODE_EXCODE39, -1, "A", -1, 0, 1, 38 }, - /* 30*/ { BARCODE_EXCODE39, -1, "a", -1, 0, 1, 51 }, - /* 31*/ { BARCODE_EXCODE39, -1, ",", -1, 0, 1, 51 }, - /* 32*/ { BARCODE_EXCODE39, -1, "\000", 1, 0, 1, 51 }, - /* 33*/ { BARCODE_EXCODE39, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 34*/ { BARCODE_EXCODE39, -1, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, }, - /* 35*/ { BARCODE_LOGMARS, -1, "A", -1, 0, 1, 47 }, - /* 36*/ { BARCODE_LOGMARS, -1, "a", -1, 0, 1, 47 }, - /* 37*/ { BARCODE_LOGMARS, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1, }, - /* 38*/ { BARCODE_LOGMARS, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1, }, - /* 39*/ { BARCODE_LOGMARS, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1, }, - /* 40*/ { BARCODE_CODE93, -1, "A", -1, 0, 1, 46 }, - /* 41*/ { BARCODE_CODE93, -1, "a", -1, 0, 1, 55 }, - /* 42*/ { BARCODE_CODE93, -1, ",", -1, 0, 1, 55 }, - /* 43*/ { BARCODE_CODE93, -1, "\000", 1, 0, 1, 55 }, - /* 44*/ { BARCODE_CODE93, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 45*/ { BARCODE_CODE93, -1, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 46*/ { BARCODE_PZN, -1, "1", -1, 0, 1, 142 }, - /* 47*/ { BARCODE_PZN, -1, "A", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 48*/ { BARCODE_PZN, -1, "1000006", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Check digit == 10 so can't be used */ - /* 49*/ { BARCODE_PZN, -1, "00000011", -1, ZINT_ERROR_INVALID_CHECK, -1, -1 }, - /* 50*/ { BARCODE_PZN, 1, "100009", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Check digit == 10 so can't be used */ - /* 51*/ { BARCODE_PZN, 1, "0000011", -1, ZINT_ERROR_INVALID_CHECK, -1, -1 }, - /* 52*/ { BARCODE_VIN, -1, "5GZCZ43D13S812715", -1, 0, 1, 246 }, - /* 53*/ { BARCODE_VIN, -1, "5GZCZ43D23S812715", -1, ZINT_ERROR_INVALID_CHECK, -1, -1 }, /* North American with invalid check character */ - /* 54*/ { BARCODE_VIN, -1, "WP0ZZZ99ZTS392124", -1, 0, 1, 246 }, /* Not North American so no check */ - /* 55*/ { BARCODE_VIN, -1, "WP0ZZZ99ZTS392I24", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* I not allowed */ - /* 56*/ { BARCODE_VIN, -1, "WPOZZZ99ZTS392124", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* O not allowed */ - /* 57*/ { BARCODE_VIN, -1, "WPQZZZ99ZTS392124", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Q not allowed */ - /* 58*/ { BARCODE_HIBC_39, -1, "a", -1, 0, 1, 79 }, /* Converts to upper */ - /* 59*/ { BARCODE_HIBC_39, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 60*/ { BARCODE_HIBC_39, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1 }, - /* 61*/ { BARCODE_HIBC_39, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 28*/ { BARCODE_CODE39, 2, "1", -1, 0, 1, 51 }, /* Hidden check digit */ + /* 29*/ { BARCODE_CODE39, 3, "1", -1, 0, 1, 38 }, /* option_2 > 2 ignored */ + /* 30*/ { BARCODE_EXCODE39, -1, "A", -1, 0, 1, 38 }, + /* 31*/ { BARCODE_EXCODE39, 3, "A", -1, 0, 1, 38 }, /* option_2 > 2 ignored */ + /* 32*/ { BARCODE_EXCODE39, -1, "a", -1, 0, 1, 51 }, + /* 33*/ { BARCODE_EXCODE39, -1, ",", -1, 0, 1, 51 }, + /* 34*/ { BARCODE_EXCODE39, -1, "\000", 1, 0, 1, 51 }, + /* 35*/ { BARCODE_EXCODE39, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 36*/ { BARCODE_EXCODE39, -1, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1, }, + /* 37*/ { BARCODE_LOGMARS, -1, "A", -1, 0, 1, 47 }, + /* 38*/ { BARCODE_LOGMARS, -1, "a", -1, 0, 1, 47 }, + /* 39*/ { BARCODE_LOGMARS, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1, }, + /* 40*/ { BARCODE_LOGMARS, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1, }, + /* 41*/ { BARCODE_LOGMARS, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1, }, + /* 42*/ { BARCODE_LOGMARS, 3, "A", -1, 0, 1, 47 }, /* option_2 > 2 ignored */ + /* 43*/ { BARCODE_CODE93, -1, "A", -1, 0, 1, 46 }, + /* 44*/ { BARCODE_CODE93, -1, "a", -1, 0, 1, 55 }, + /* 45*/ { BARCODE_CODE93, -1, ",", -1, 0, 1, 55 }, + /* 46*/ { BARCODE_CODE93, -1, "\000", 1, 0, 1, 55 }, + /* 47*/ { BARCODE_CODE93, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 48*/ { BARCODE_CODE93, -1, "é", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 49*/ { BARCODE_PZN, -1, "1", -1, 0, 1, 142 }, + /* 50*/ { BARCODE_PZN, -1, "A", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 51*/ { BARCODE_PZN, -1, "1000006", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Check digit == 10 so can't be used */ + /* 52*/ { BARCODE_PZN, -1, "00000011", -1, ZINT_ERROR_INVALID_CHECK, -1, -1 }, + /* 53*/ { BARCODE_PZN, 1, "100009", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Check digit == 10 so can't be used */ + /* 54*/ { BARCODE_PZN, 1, "0000011", -1, ZINT_ERROR_INVALID_CHECK, -1, -1 }, + /* 55*/ { BARCODE_VIN, -1, "5GZCZ43D13S812715", -1, 0, 1, 246 }, + /* 56*/ { BARCODE_VIN, -1, "5GZCZ43D23S812715", -1, ZINT_ERROR_INVALID_CHECK, -1, -1 }, /* North American with invalid check character */ + /* 57*/ { BARCODE_VIN, -1, "WP0ZZZ99ZTS392124", -1, 0, 1, 246 }, /* Not North American so no check */ + /* 58*/ { BARCODE_VIN, -1, "WP0ZZZ99ZTS392I24", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* I not allowed */ + /* 59*/ { BARCODE_VIN, -1, "WPOZZZ99ZTS392124", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* O not allowed */ + /* 60*/ { BARCODE_VIN, -1, "WPQZZZ99ZTS392124", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, /* Q not allowed */ + /* 61*/ { BARCODE_HIBC_39, -1, "a", -1, 0, 1, 79 }, /* Converts to upper */ + /* 62*/ { BARCODE_HIBC_39, -1, ",", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 63*/ { BARCODE_HIBC_39, -1, "\000", 1, ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 64*/ { BARCODE_HIBC_39, -1, "\300", -1, ZINT_ERROR_INVALID_DATA, -1, -1 }, + /* 65*/ { BARCODE_HIBC_39, 1, "a", -1, 0, 1, 79 }, /* option_2 ignored */ + /* 66*/ { BARCODE_HIBC_39, 2, "a", -1, 0, 1, 79 }, /* option_2 ignored */ }; int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_library.c b/backend/tests/test_library.c index 4a58530b..078b9e5f 100644 --- a/backend/tests/test_library.c +++ b/backend/tests/test_library.c @@ -1335,7 +1335,6 @@ static void test_clear(const testCtx *const p_ctx) { assert_nonzero(symbol->rows, "ZBarcode_Buffer() rows 0\n"); assert_nonzero(symbol->width, "ZBarcode_Buffer() width 0\n"); - assert_zero(symbol->bitmap_byte_length, "ZBarcode_Buffer() bitmap_byte_length %d != 0\n", (int) symbol->bitmap_byte_length); assert_null(symbol->vector, "ZBarcode_Buffer() vector != NULL\n"); ZBarcode_Clear(symbol); @@ -1347,7 +1346,6 @@ static void test_clear(const testCtx *const p_ctx) { assert_zero(symbol->rows, "ZBarcode_Buffer() rows %d != 0\n", symbol->rows); assert_zero(symbol->width, "ZBarcode_Buffer() width %d != 0\n", symbol->width); - assert_zero(symbol->bitmap_byte_length, "ZBarcode_Buffer() bitmap_byte_length %d != 0\n", (int) symbol->bitmap_byte_length); assert_null(symbol->vector, "ZBarcode_Buffer() vector != NULL\n"); /* Vector */ @@ -1371,7 +1369,6 @@ static void test_clear(const testCtx *const p_ctx) { assert_nonzero(symbol->width, "ZBarcode_Buffer_Vector() width 0\n"); assert_null(symbol->bitmap, "ZBarcode_Buffer_Vector() bitmap != NULL\n"); assert_null(symbol->alphamap, "ZBarcode_Buffer_Vector() alphamap != NULL\n"); - assert_zero(symbol->bitmap_byte_length, "ZBarcode_Buffer_Vector() bitmap_byte_length %d != 0\n", (int) symbol->bitmap_byte_length); ZBarcode_Clear(symbol); @@ -1379,7 +1376,6 @@ static void test_clear(const testCtx *const p_ctx) { assert_zero(symbol->rows, "ZBarcode_Buffer_Vector() rows %d != 0\n", symbol->rows); assert_zero(symbol->width, "ZBarcode_Buffer_Vector() width %d != 0\n", symbol->width); - assert_zero(symbol->bitmap_byte_length, "ZBarcode_Buffer_Vector() bitmap_byte_length %d != 0\n", (int) symbol->bitmap_byte_length); assert_null(symbol->bitmap, "ZBarcode_Buffer_Vector() bitmap != NULL\n"); assert_null(symbol->alphamap, "ZBarcode_Buffer_Vector() alphamap != NULL\n"); assert_zero(symbol->bitmap_width, "ZBarcode_Buffer_Vector() bitmap_width %d != 0\n", symbol->bitmap_width); diff --git a/backend/zint.h b/backend/zint.h index a46a4924..6cbebba1 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -130,7 +130,6 @@ extern "C" { int bitmap_width; /* Width of bitmap image (raster output only) */ int bitmap_height; /* Height of bitmap image (raster output only) */ unsigned char *alphamap; /* Array of alpha values used (raster output only) */ - unsigned int bitmap_byte_length; /* Size of BMP bitmap data (raster output only) */ struct zint_vector *vector; /* Pointer to vector header (vector output only) */ }; @@ -290,7 +289,7 @@ extern "C" { /* Note: CODE16K, CODE49, CODABLOCKF, ITF14, EAN/UPC have default quiet zones */ #define BARCODE_NO_QUIET_ZONES 0x1000 /* Disable quiet zones, notably those with defaults as listed above */ -#define COMPLIANT_HEIGHT 0x2000 /* Warn if height not compliant and use standard height (if any) as default */ +#define COMPLIANT_HEIGHT 0x2000 /* Warn if height not compliant, or use standard height (if any) as default */ #define EANUPC_GUARD_WHITESPACE 0x4000 /* Add quiet zone indicators ("<"/">") to HRT whitespace (EAN/UPC) */ #define EMBED_VECTOR_FONT 0x8000 /* Embed font in vector output - currently only for SVG output */ diff --git a/docs/Makefile b/docs/Makefile index 0a63dabb..b7031bf0 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,5 +1,5 @@ -# Makefile for generating "manual.txt" and "manual.pdf" from "manual.pmd" using pandoc -# Copyright (C) 2022 +# Makefile for generating "manual.txt" and "manual.pdf" from "manual.pmd" and "zint.1" from "zint.1.pmd" using pandoc +# Copyright (C) 2022-2023 # # Requires a recent version of pandoc, plus pandoc-tablenos, xelatex and various other packages - see "README" # .svg images generated by "zint_images.sh" @@ -9,7 +9,6 @@ OUT_PDF = manual.pdf OUT_TXT = manual.txt INC_HEADER_PDF = inc_header_pdf.tex INC_BEFORE_BODY_PDF = inc_before_body_pdf.tex -INCLUDES_PDF = $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) INC_PDF = --include-in-header $(INC_HEADER_PDF) --include-before-body $(INC_BEFORE_BODY_PDF) INCLUDES_TXT = inc_header_txt.tex INC_TXT = --include-in-header $(INCLUDES_TXT) @@ -24,6 +23,7 @@ IMAGES = \ images/gui_menus.png \ images/gui_composite.png \ images/gui_segs.png \ + images/gui_c25inter.png \ images/gui_aztec.png \ images/gui_appearance.png \ images/gui_scaling.png \ @@ -36,6 +36,7 @@ IMAGES = \ images/gui_sequence.png \ images/gui_export.png \ images/gui_cli_equivalent.png \ + images/tcl_demo.png \ images/pdf417_heightperrow.svg \ images/code128_box.svg \ images/qrcode_box.svg \ @@ -149,7 +150,7 @@ MAN_PAGE_OPTS = -s -t man all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN_PAGE) -$(OUT_PDF) : $(SOURCE) $(SOURCE_MAN_PAGE) $(HIGHLIGHT_THEME) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile +$(OUT_PDF) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile pandoc $(SOURCE_MAN_PAGE) -f markdown \ $(PDF_OPTS) \ -o $(TEX_MAN_PAGE) @@ -165,13 +166,52 @@ $(OUT_TXT) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INCLUDES_TXT) Makefile -V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \ $(TXT_OPTS) \ -o $(OUT_TXT) - # Indent Man Page sections in TOC and remove trailing spaces + # Indent Man Page sections in TOC, remove trailing spaces and echoed image tags sed -i \ -e 's/^\(- [A-Z][A-Z ]*\)$$/ \1/' \ -e 's/ *$$//' \ + -e '/^\[.*\]$$/{N;N;s/\[\(.*\)\]\n\n\1/[\1]/;p;d}' \ $(OUT_TXT) + # Wrap + sed -i '/.\{81\}/{s/.\{80\}/&\n/}' $(OUT_TXT) $(OUT_MAN_PAGE) : $(SOURCE_MAN_PAGE) Makefile pandoc $(SOURCE_MAN_PAGE) -f markdown \ $(MAN_PAGE_OPTS) \ -o $(OUT_MAN_PAGE) + +# For debugging + +manual.tex : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile + pandoc $(SOURCE_MAN_PAGE) -f markdown \ + $(PDF_OPTS) \ + -o $(TEX_MAN_PAGE) + sed -i -e 's/section{/subsection{/' $(TEX_MAN_PAGE) # Convert man page sections to subsections + pandoc $(SOURCE) -f markdown $(INC_PDF) --toc --toc-depth=4 \ + -V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) -V block-headings \ + $(PDF_OPTS) \ + --include-after-body $(TEX_MAN_PAGE) \ + -s -o manual.tex + +# HTML one-page (uses modified "templates/styles.html", unchanged "templates/default.html") + +OUT_HTML = manual.html +HTML_OPTS = --filter pandoc-tablenos -M tablenos-warning-level=0 --highlight-style=haddock \ + --template=templates/default.html --eol=lf -s -t html +INC_BEFORE_BODY_HTML = inc_before_body_html.html +INC_HTML = --include-before-body $(INC_BEFORE_BODY_HTML) +TEMPLATES_HTML = templates/default.html templates/styles.html + +$(OUT_HTML) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_BEFORE_BODY_HTML) $(TEMPLATES_HTML) Makefile + pandoc $(SOURCE) $(SOURCE_MAN_PAGE) -f markdown+link_attributes $(INC_HTML) --toc --toc-depth=4 \ + -V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \ + $(HTML_OPTS) \ + -o $(OUT_HTML) + # Indent Man Page sections in TOC, change Man Page sections h1 -> h2, remove Man Page meta, fix Table captions + sed -i \ + -e 's/\(Man Page ZINT(1)<\/a>\)<\/li>/\1