diff --git a/ChangeLog b/ChangeLog index e6042e3a..8d449a6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Version 2.16.0.9 (dev) not released yet (2026-03-11) +Version 2.16.0.9 (dev) not released yet (2026-03-18) ==================================================== **Incompatible changes** @@ -212,7 +212,7 @@ Changes outside digit to be 4X/2X instead of 5X/3X away from main symbol so as not to touch add-on TODO: revisit when standard clarified - manual: make explicit that AI "(00)" and "(01)" prefixes added by Zint are - HRT-only; clarify Codablock-F length maximum & add examples + HRT-only; clarify Codablock F length maximum & add examples - add DXFILMEDGE (MR #159, props Antoine Mérino) Bugs @@ -1062,7 +1062,7 @@ by brunt@SF Version 2.5 2016-11-13 ====================== Support for DotCode and Han Xin code. ECI code processing. Output to BMP, GIF -and PCX. Added bold and small text options. Reintroduction of Codablock-F. +and PCX. Added bold and small text options. Reintroduction of Codablock F. Many minor fixes and improvements. @@ -1096,7 +1096,7 @@ minor bugfixes for ISBN and Aztec Code, and added some small features like a Version 2.3.1 2010-04-07 ======================== -Removed Codablock-F. Redesigned scale function so that human readable +Removed Codablock F. Redesigned scale function so that human readable text and Maxicode symbols can be scaled consistently. Corrected encoding bugs with Code 128/Code 16k and Data Matrix ECC200 ECC 050. Added --notext option to CLI. @@ -1155,7 +1155,7 @@ Version 2.1.2 2009-03-01 ======================== Added SVG output option. Improved Japanese character support including Unicode > Shift-JIS capability. Bugfixes for Data Matrix ECC200 (missing -characters at end of string) and Codablock-F (K1/K2 check digit and row +characters at end of string) and Codablock F (K1/K2 check digit and row indicators above row 6). @@ -1168,9 +1168,9 @@ Version 2.1 2009-01-31 ====================== Reinstated Korea Post barcodes, harmonised bind and box options, moved Unicode handling into backend and added input_mode option, added size options -to Data Matrix ECC200, added NULL character handling for Codablock-F, Code 128, +to Data Matrix ECC200, added NULL character handling for Codablock F, Code 128, Code 16k, Extended Code 39, Code 93, Telepen, Maxicode, Data Matrix ECC200 ECC -200, PDF417 and MicroPDF417. Added GS1 support for Code 16k, Codablock-F and +200, PDF417 and MicroPDF417. Added GS1 support for Code 16k, Codablock F and Aztec Code. Added scale and direct to stdout options. Rebuilt Data Matrix ECC200 ECC 200 encoding algorithms to support NULL encoding and GS1 data encoding. @@ -1185,13 +1185,13 @@ information. Version 2.0 beta r2 2008-10-19 ============================== Many corrections and bugfixes. (Code 11, Code 128, EAN-128, -Aztec Code, Codablock-F, Code 16k, POSTNET, PLANET, NVE-18, PZN, Data Matrix +Aztec Code, Codablock F, Code 16k, POSTNET, PLANET, NVE-18, PZN, Data Matrix ECC200, Maxicode and QR Code) Version 2.0 beta 2008-09-29 =========================== -Added support for Aztec Code, Codablock-F, Code 32, EAN-14 and DAFT +Added support for Aztec Code, Codablock F, Code 32, EAN-14 and DAFT Code. Rearranged symbology numbers to match Tbarcode v8. Corrected a never ending loop bug in EAN-128. diff --git a/README b/README index 2e37a661..08184952 100644 --- a/README +++ b/README @@ -16,7 +16,7 @@ BC412 (SEMI T1-95) Han Xin (Chinese Sensible) Code Brazilian Postal Code (CEPNet) ISBN Channel Code ITF-14 Codabar Japanese Postal Barcode -Codablock-F (and HIBC) Korean Postal Barcode +Codablock F (and HIBC) Korean Postal Barcode Code 11 LOGMARS Code 128 (and GS1-128 and HIBC) MaxiCode Code 16K MicroPDF417 (and HIBC) @@ -63,7 +63,7 @@ Please see "ChangeLog" in the project root directory. LICENSE ------- -Zint, libzint and Zint Barcode Studio are Copyright © 2025 Robin Stuart. All +Zint, libzint and Zint Barcode Studio are Copyright © 2026 Robin Stuart. All historical versions are distributed under the GNU General Public License version 3 or later. Versions 2.5 and later are released under a dual license: the encoding library is released under the BSD (3 clause) license whereas the diff --git a/README.deb b/README.deb new file mode 100644 index 00000000..bf5c3016 --- /dev/null +++ b/README.deb @@ -0,0 +1,58 @@ +% README.deb 2026-03-18 +% Tested on Ubuntu 24.04 LTS +% vim: set ts=4 sw=4 et : + +The "debian" directory is included to enable creating a local Debian dpkg ".deb" file. + +(The official Debian package is at https://salsa.debian.org/debian/zint) + +Prerequisites are being on a Debian-based Linux system and the usual stuff for building zint (see "README.linux"). + +To create a local package, first clone the latest source: + + git clone https://git.code.sf.net/p/zint/code zint + +Then create an archive: + + cd zint + git archive -o /tmp/zint.tar.gz HEAD + cd .. + +Create a new directory (it doesn't matter where): + + mkdir zint-deb + +Then untar the source archive into a sub-directory of the new directory: + + cd zint-deb + mkdir zint-2.16.0.9-src + cd zint-2.16.0.9-src + tar xf /tmp/zint.tar.gz + cd .. + tar cvzf zint_2.16.0.9.orig.tar.gz zint-2.16.0.9-src + +Note the very specific naming of the tarball and the use of an underscore: "zint_.orig.tar.gz". + +Then run dpkg-buildpackage in the source sub-directory: + + cd zint-2.16.0.9-src + dpkg-buildpackage -us -uc + cd .. + +If this works, there should be four ".deb" files (amongst other stuff) in the zint-deb directory, namely: + +libzint2.16_2.16.0.9-1_.deb +libzint-dev_2.16.0.9-1_.deb +zint_2.16.0.9-1_.deb +zint-qt_2.16.0.9-1_.deb + +where "" is e.g. "amd64" on an Intel system. + +The ".deb" files can then be installed on "" systems, starting with the "libzint" ones first, e.g. + + sudo dpkg -i libzint2.16_2.16.0.9-1_amd64.deb + +You may be prompted by dpkg to add other packages first. + +Note that the GS1 Syntax Engine is not yet supported by the included "debian" directory (nor by the official +Debian package for that matter), which is an issue. diff --git a/README.linux b/README.linux index cac5f1d6..3cde2245 100644 --- a/README.linux +++ b/README.linux @@ -1,11 +1,12 @@ % README.linux 2026-01-01 % Tested on Ubuntu 20.04.4 LTS, Ubuntu 22.04 LTS, Ubuntu 24.04 LTS and % Fedora Linux 43 (Workstation Edition) +% vim: set ts=4 sw=4 et : 1. Prerequisites for building zint ================================== -Prerequisites are git, cmake, make, gcc and gcc-c++, e.g. Ubuntu/Debian +Prerequisites are git, cmake, make, cc and c++, e.g. Ubuntu/Debian sudo apt install git cmake build-essential diff --git a/backend/DEVELOPER b/backend/DEVELOPER index 7c0c8190..9e66e741 100644 --- a/backend/DEVELOPER +++ b/backend/DEVELOPER @@ -1,10 +1,10 @@ -Contents --------- - -2025-01-21 +2026-03-18 Here is a guide to which bit of source code does what. +library.c: + API entry points + 2of5.c: Code 2 of 5 Standard (Matrix) Code 2 of 5 Industrial @@ -40,7 +40,7 @@ codabar.c: Codabar codablock.c: - Codablock-F + Codablock F code11.c: Code 11 diff --git a/backend/aztec.c b/backend/aztec.c index 4be3eebd..0cfc7472 100644 --- a/backend/aztec.c +++ b/backend/aztec.c @@ -96,9 +96,9 @@ static int az_reduce(char *modes, unsigned char *source, const int length) { modes[j] = modes[i]; if ((modes[i] == AZ_P || (modes[i] & AZ_PS)) && AZ_DOUBLE_PUNCT_NO_LEN_CHECK(source, i)) { if (source[i] == '\r') { - source[j] = 'a'; /* "\r\n" */ + source[j] = 'a'; /* (CR LF) */ } else { - source[j] = 'b' + 7 - ((source[i] & 0x0F) >> 1); /* ". " -> 'b', ", " -> 'c', ": " -> 'd' */ + source[j] = 'b' + 7 - ((source[i] & 0x0F) >> 1); /* (. SP) -> 'b', (, SP) -> 'c', (: SP) -> 'd' */ } i += 2; } else { @@ -124,7 +124,7 @@ static char az_mode_char(const char mode) { if (mode & AZ_US) { assert(AZ_MASK(mode) == AZ_L || AZ_MASK(mode) == AZ_D); - return AZ_MASK(mode) == AZ_L ? 'r' : 't'; + return AZ_MASK(mode) == AZ_L ? 'K' : 'C'; } assert(AZ_MASK(mode) < ARRAY_SIZE(mode_chars)); @@ -164,7 +164,7 @@ static int az_text_modes(char modes[], unsigned char source[], int length, const } } - /* Deal first with letter combinations which can be combined to one codeword + /* Deal first with letter combinations which can be combined to one codeword. Combinations are (CR LF) (. SP) (, SP) (: SP) in Punct mode */ current_mode = initial_mode; for (i = 0; i + 1 < length; i++) { @@ -182,26 +182,14 @@ static int az_text_modes(char modes[], unsigned char source[], int length, const count = az_count_doubles(source, length, i); next_mode = az_get_next_mode(modes, length, i); - if (current_mode == AZ_U) { - if (next_mode == AZ_D && count <= 5) { + if (next_mode == AZ_D) { + if ((current_mode == AZ_U && count <= 5) || (current_mode == AZ_L && count <= 4) + || (current_mode == AZ_M && count == 1) || (current_mode == AZ_D && count <= 7)) { memset(modes + i, AZ_D, 2 * count); } - } else if (current_mode == AZ_L) { - if (next_mode == AZ_D && count <= 4) { - memset(modes + i, AZ_D, 2 * count); - } - - } else if (current_mode == AZ_M) { - if (next_mode == AZ_D && count == 1) { - modes[i] = AZ_D; - modes[i + 1] = AZ_D; - } - - } else if (current_mode == AZ_D) { - if ((next_mode != AZ_D && count <= 4) || (next_mode == AZ_D && count <= 7)) { - memset(modes + i, AZ_D, 2 * count); - } + } else if (current_mode == AZ_D && count <= 4) { + memset(modes + i, AZ_D, 2 * count); } /* Default is Punct mode */ @@ -976,6 +964,8 @@ static int az_UpdateStateListForChar(struct az_state_list *list, const unsigned /* Default, optimized encodation algorithm by Frank Yellin and Rustam Abdullaev, adapted from ZXing via zxing-cpp's `HighLevelEncoder::Encode()` & slightly improved */ +/* Copyright 2013 ZXing authors */ /* ZXing */ +/* Copyright 2016 Huy Cuong Nguyen */ /* zxing-cpp */ /* SPDX-License-Identifier: Apache-2.0 */ /* Note that a bitstream that is encoded to be shortest based on mode choices may not be so after bit-stuffing */ static int az_binary_string(unsigned char source[], const int length, int bp, @@ -1002,7 +992,7 @@ static int az_binary_string(unsigned char source[], const int length, int bp, fprintf(stderr, "index %d\n", (int) i); #endif if (AZ_DOUBLE_PUNCT(source, length, i)) { - /* "\r\n" -> 2, ". " -> 3, ", " -> 4, ": " -> 5 */ + /* (CR LF) -> 2, (. SP) -> 3, (, SP) -> 4, (: SP) -> 5 */ const int pairCode = source[i] == '\r' ? 2 : 3 + 7 - ((source[i] & 0x0F) >> 1); if (!az_UpdateStateListForPair(list, i, pairCode)) { az_state_list_free(list); diff --git a/backend/big5.h b/backend/big5.h index 58ece87a..7d23171f 100644 --- a/backend/big5.h +++ b/backend/big5.h @@ -30,6 +30,7 @@ SUCH DAMAGE. */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* SPDX-License-Identifier: Unicode-3.0 */ #ifndef Z_BIG5_H #define Z_BIG5_H diff --git a/backend/codablock.c b/backend/codablock.c index 543310e7..ff7fe429 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -1,4 +1,4 @@ -/* codablock.c - Handles Codablock-F */ +/* codablock.c - Handles Codablock F */ /* libzint - the open source barcode library Copyright (C) 2016-2026 Harald Oehlmann @@ -50,7 +50,7 @@ #define ZTNum (CodeA | CodeB | CodeC) #define ZTFNC1 (CodeA | CodeB | CodeC | CodeFNC1) -/* ASCII-Extension for Codablock-F */ +/* ASCII-Extension for Codablock F */ #define aFNC1 ((uchar) 128) #define aFNC2 ((uchar) 129) #define aFNC3 ((uchar) 130) @@ -513,7 +513,7 @@ static void ASCIIZ128(uchar **ppOutPos, const int CharacterSet, const uchar c1, A2C128_C(ppOutPos, c1, c2); } -/* XLate Tables D.2, D.3 and F.1 of Codablock-F Specification and call output +/* XLate Tables D.2, D.3 and F.1 of Codablock F Specification and call output */ static void SumASCII(uchar **ppOutPos, const int Sum, const int CharacterSet) { switch (CharacterSet) { diff --git a/backend/common.c b/backend/common.c index d1cb326d..9d9d61d8 100644 --- a/backend/common.c +++ b/backend/common.c @@ -697,6 +697,7 @@ INTERNAL unsigned int z_decode_utf8(unsigned int *state, unsigned int *codep, co See https://bjoern.hoehrmann.de/utf-8/decoder/dfa/ for details. */ + /* SPDX-License-Identifier: Apache-2.0 */ static const unsigned char utf8d[] = { /* The first part of the table maps bytes to character classes that diff --git a/backend/composite.c b/backend/composite.c index 202b2f79..90a3c48d 100644 --- a/backend/composite.c +++ b/backend/composite.c @@ -1,7 +1,7 @@ /* composite.c - Handles GS1 Composite Symbols */ /* libzint - the open source barcode library - Copyright (C) 2008-2025 Robin Stuart + Copyright (C) 2008-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -809,6 +809,7 @@ static int cc_binary_string(struct zint_symbol *symbol, const unsigned char sour /* So still need FNC1 character but can't do single FNC1 in numeric mode, so insert alphanumeric latch "0000" and alphanumeric FNC1 "01111" (this implementation detail taken from BWIPP https://github.com/bwipp/postscriptbarcode Copyright (c) 2004-2019 Terry Burton) */ + /* SPDX-License-Identifier: MIT */ bp = z_bin_append_posn(15, 9, binary_string, bp); /* "000001111" */ /* Note an alphanumeric FNC1 is also a numeric latch, so now in numeric mode */ } diff --git a/backend/dmatrix.c b/backend/dmatrix.c index 4af2a7bf..8ef9e255 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -8,8 +8,8 @@ Adrian Kennard, Andrews & Arnold Ltd with help from Cliff Hones on the RS coding - (c) 2004 Adrian Kennard, Andrews & Arnold Ltd - (c) 2006 Stefan Schmidt + Copyright (c) 2004 Adrian Kennard, Andrews & Arnold Ltd + Copyright (c) 2006 Stefan Schmidt Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/backend/eci_sb.h b/backend/eci_sb.h index 7dcdc7c7..e4960020 100644 --- a/backend/eci_sb.h +++ b/backend/eci_sb.h @@ -4,7 +4,7 @@ "https://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP125*.TXT" */ /* libzint - the open source barcode library - Copyright (C) 2021-2025 Robin Stuart + Copyright (C) 2021-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -32,6 +32,7 @@ SUCH DAMAGE. */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* SPDX-License-Identifier: Unicode-3.0 */ #ifndef Z_ECI_SB_H #define Z_ECI_SB_H diff --git a/backend/gb18030.h b/backend/gb18030.h index 3f2779f2..b9d2c5ff 100644 --- a/backend/gb18030.h +++ b/backend/gb18030.h @@ -1,5 +1,5 @@ /* gb18030.h - tables for Unicode to GB 18030-2005, generated by "backend/tools/gen_eci_mb_h.php" - from "jdk-1.4.2/GB18030.TXT" + from "libiconv-1.11/GB18030.TXT" (see https://haible.de/bruno/charsets/conversion-tables/GB18030.tar.bz2) */ /* libzint - the open source barcode library @@ -31,6 +31,7 @@ SUCH DAMAGE. */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* SPDX-License-Identifier: Unicode-3.0 */ #ifndef Z_GB18030_H #define Z_GB18030_H diff --git a/backend/gb2312.h b/backend/gb2312.h index f5134e97..1c02779b 100644 --- a/backend/gb2312.h +++ b/backend/gb2312.h @@ -31,6 +31,7 @@ SUCH DAMAGE. */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* SPDX-License-Identifier: Unicode-3.0 */ #ifndef Z_GB2312_H #define Z_GB2312_H diff --git a/backend/gbk.h b/backend/gbk.h index d0cf5c44..792cc5d0 100644 --- a/backend/gbk.h +++ b/backend/gbk.h @@ -30,6 +30,7 @@ SUCH DAMAGE. */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* SPDX-License-Identifier: Unicode-3.0 */ #ifndef Z_GBK_H #define Z_GBK_H diff --git a/backend/gridmtx.c b/backend/gridmtx.c index b6a97947..66f1a9ec 100644 --- a/backend/gridmtx.c +++ b/backend/gridmtx.c @@ -1,7 +1,7 @@ /* gridmtx.c - Grid Matrix */ /* libzint - the open source barcode library - Copyright (C) 2009-2025 Robin Stuart + Copyright (C) 2009-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -127,6 +127,7 @@ static int gm_in_numeral(const unsigned int ddata[], const int length, const int /* Calculate optimized encoding modes. Adapted from Project Nayuki */ /* Copyright (c) Project Nayuki. (MIT License) See qr.c for detailed notice */ +/* SPDX-License-Identifier: MIT */ static void gm_define_modes(char *modes, const unsigned int ddata[], const int length, const int debug_print) { /* Must be in same order as GM_H etc */ static const char mode_types[] = { GM_CHINESE, GM_NUMBER, GM_LOWER, GM_UPPER, GM_MIXED, GM_BYTE, '\0' }; diff --git a/backend/gs1.c b/backend/gs1.c index 93a31fc9..2b26224a 100644 --- a/backend/gs1.c +++ b/backend/gs1.c @@ -1758,7 +1758,7 @@ static int gs1se_verify(struct zint_symbol *symbol, const unsigned char source[] } else if (gs1raw_mode && !is_digital_link) { if (symbol->symbology == BARCODE_GS1_128 || symbol->symbology == BARCODE_DBAR_EXP || symbol->symbology == BARCODE_DBAR_EXPSTK || z_is_fixed_ratio(symbol->symbology) - || symbol->symbology == BARCODE_CODABLOCKF) { /* Codablock-F will be GS1-enabled in the future */ + || symbol->symbology == BARCODE_CODABLOCKF) { /* Codablock F will be GS1-enabled in the future */ /* Prefix caret */ local_source_buf[0] = '^'; if (source[0] == '\x1D') { /* Allow initial GS */ diff --git a/backend/hanxin.c b/backend/hanxin.c index 14134cc3..ecd0c250 100644 --- a/backend/hanxin.c +++ b/backend/hanxin.c @@ -1,7 +1,7 @@ /* hanxin.c - Han Xin Code */ /* libzint - the open source barcode library - Copyright (C) 2009-2025 Robin Stuart + Copyright (C) 2009-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -353,6 +353,7 @@ static int hx_in_fourbyte(const unsigned int ddata[], const int length, const in /* Calculate optimized encoding modes. Adapted from Project Nayuki */ /* Copyright (c) Project Nayuki. (MIT License) See qr.c for detailed notice */ +/* SPDX-License-Identifier: MIT */ static void hx_define_modes(char *modes, const unsigned int ddata[], const int length, const int debug_print) { /* Must be in same order as HX_N etc */ static const char mode_types[] = { 'n', 't', 'b', '1', '2', 'd', 'f', '\0' }; diff --git a/backend/ksx1001.h b/backend/ksx1001.h index e2987f72..56a685d1 100644 --- a/backend/ksx1001.h +++ b/backend/ksx1001.h @@ -30,6 +30,7 @@ SUCH DAMAGE. */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* SPDX-License-Identifier: Unicode-3.0 */ #ifndef Z_KSX1001_H #define Z_KSX1001_H diff --git a/backend/library.c b/backend/library.c index 67f19412..f5b2f41c 100644 --- a/backend/library.c +++ b/backend/library.c @@ -457,7 +457,7 @@ static int hibc(struct zint_symbol *symbol, struct zint_seg segs[], const int se if (symbol->debug & ZINT_DEBUG_PRINT) printf("HIBC processed source: %s\n", to_process); - /* Code 128, Code 39 & Codablock-F set `content_segs` themselves, but the others don't, so do it now */ + /* Code 128, Code 39 & Codablock F set `content_segs` themselves, but the others don't, so do it now */ assert(!symbol->content_segs); /* HIBC symbologies don't satisfy `supports_non_iso8859_1()` */ if (content_segs && symbol->symbology != BARCODE_HIBC_128 && symbol->symbology != BARCODE_HIBC_39 && symbol->symbology != BARCODE_HIBC_BLOCKF) { diff --git a/backend/pcx.c b/backend/pcx.c index 79e0921e..c30b529b 100644 --- a/backend/pcx.c +++ b/backend/pcx.c @@ -1,7 +1,7 @@ /* pcx.c - Handles output to ZSoft PCX file */ /* libzint - the open source barcode library - Copyright (C) 2009-2025 Robin Stuart + Copyright (C) 2009-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -126,6 +126,7 @@ INTERNAL int zint_pcx_pixel_plot(struct zint_symbol *symbol, const unsigned char /* Based on ImageMagick/coders/pcx.c PCXWritePixels() * Copyright 1999-2020 ImageMagick Studio LLC */ + /* SPDX-License-Identifier: ImageMagick */ previous = rle_row[0]; run_count = 1; for (column = 1; column < bytes_per_line; column++) { /* Note going up to bytes_per_line */ diff --git a/backend/pdf417.c b/backend/pdf417.c index 7c1848a0..8a752bff 100644 --- a/backend/pdf417.c +++ b/backend/pdf417.c @@ -32,9 +32,16 @@ */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* + ********************************************************************************************* + * TODO: Replace all code adapted from "pdf417.frm" as it was released under GPL v2.0 or later + ********************************************************************************************* + */ + /* This code is adapted from "Code barre PDF 417 / PDF 417 barcode" v2.5.0 which is Copyright (C) 2004 (Grandzebu). The original code (file pdf417.frm) can be downloaded from https://grandzebu.net/informatique/codbar/pdf417.zip */ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* NOTE: symbol->option_1 is used to specify the security level (i.e. control the number of check codewords) @@ -1432,13 +1439,11 @@ static int pdf_enc(struct zint_symbol *symbol, struct zint_seg segs[], const int bp = z_bin_append_posn(0x1FEA8, 17, pattern, bp); /* Row start */ for (j = 0; j <= cols; j++) { - bp = z_bin_append_posn(zint_pdf_bitpattern[offset + dummy[j]], 16, pattern, bp); - pattern[bp++] = '0'; + bp = z_bin_append_posn(((int) zint_pdf_bitpattern[offset + dummy[j]]) << 1, 17, pattern, bp); } if (symbol->symbology != BARCODE_PDF417COMP) { - bp = z_bin_append_posn(zint_pdf_bitpattern[offset + dummy[j]], 16, pattern, bp); - pattern[bp++] = '0'; + bp = z_bin_append_posn(((int) zint_pdf_bitpattern[offset + dummy[j]]) << 1, 17, pattern, bp); bp = z_bin_append_posn(0x3FA29, 18, pattern, bp); /* Row Stop */ } else { pattern[bp++] = '1'; /* Compact PDF417 Stop pattern */ @@ -1761,23 +1766,19 @@ INTERNAL int zint_micropdf417(struct zint_symbol *symbol, struct zint_seg segs[] /* Copy the data into codebarre */ bp = z_bin_append_posn(zint_pdf_rap_side[LeftRAP - 1], 10, pattern, bp); - bp = z_bin_append_posn(zint_pdf_bitpattern[offset + chainemc[k]], 16, pattern, bp); - pattern[bp++] = '0'; + bp = z_bin_append_posn(((int) zint_pdf_bitpattern[offset + chainemc[k]]) << 1, 17, pattern, bp); if (symbol->option_2 >= 2) { if (symbol->option_2 == 3) { bp = z_bin_append_posn(zint_pdf_rap_centre[CentreRAP - 1], 10, pattern, bp); } - bp = z_bin_append_posn(zint_pdf_bitpattern[offset + chainemc[k + 1]], 16, pattern, bp); - pattern[bp++] = '0'; + bp = z_bin_append_posn(((int) zint_pdf_bitpattern[offset + chainemc[k + 1]]) << 1, 17, pattern, bp); if (symbol->option_2 >= 3) { if (symbol->option_2 == 4) { bp = z_bin_append_posn(zint_pdf_rap_centre[CentreRAP - 1], 10, pattern, bp); } - bp = z_bin_append_posn(zint_pdf_bitpattern[offset + chainemc[k + 2]], 16, pattern, bp); - pattern[bp++] = '0'; + bp = z_bin_append_posn(((int) zint_pdf_bitpattern[offset + chainemc[k + 2]]) << 1, 17, pattern, bp); if (symbol->option_2 == 4) { - bp = z_bin_append_posn(zint_pdf_bitpattern[offset + chainemc[k + 3]], 16, pattern, bp); - pattern[bp++] = '0'; + bp = z_bin_append_posn(((int) zint_pdf_bitpattern[offset + chainemc[k + 3]]) << 1, 17, pattern, bp); } } } diff --git a/backend/pdf417_tabs.h b/backend/pdf417_tabs.h index 8c6fd447..c877cc63 100644 --- a/backend/pdf417_tabs.h +++ b/backend/pdf417_tabs.h @@ -1,7 +1,7 @@ /* pdf417_tabs.h - PDF417 tables and coefficients */ /* libzint - the open source barcode library - Copyright (C) 2008-2025 Robin Stuart + Copyright (C) 2008-2026 Robin Stuart Portions Copyright (C) 2004 Grandzebu Redistribution and use in source and binary forms, with or without @@ -31,9 +31,6 @@ */ /* SPDX-License-Identifier: BSD-3-Clause */ -/* this file contains the character table, the pre-calculated coefficients and the - codeword patterns taken from lines 416 to 454 of pdf417.frm */ - /* See "pdf417.h" for declarations */ #ifndef Z_PDF417_TABS_H @@ -43,31 +40,32 @@ extern "C" { #endif /* __cplusplus */ -/* PDF417 error correction coefficients from Grand Zebu */ +/* PDF417 error correction coefficients from ISO/IEC 15438:2015 Annex F, Tables F.1 to F.9 + k is no. of EC codewords */ INTERNAL_DATA const unsigned short zint_pdf_coefrs[1022] = { - /* k = 2 */ + /* Table F.1, k = 2 */ 27, 917, - /* k = 4 */ + /* Table F.2, k = 4 */ 522, 568, 723, 809, - /* k = 8 */ + /* Table F.3, k = 8 */ 237, 308, 436, 284, 646, 653, 428, 379, - /* k = 16 */ + /* Table F.4, k = 16 */ 274, 562, 232, 755, 599, 524, 801, 132, 295, 116, 442, 428, 295, 42, 176, 65, - /* k = 32 */ + /* Table F.5, k = 32 */ 361, 575, 922, 525, 176, 586, 640, 321, 536, 742, 677, 742, 687, 284, 193, 517, 273, 494, 263, 147, 593, 800, 571, 320, 803, 133, 231, 390, 685, 330, 63, 410, - /* k = 64 */ + /* Table F.6, k = 64 */ 539, 422, 6, 93, 862, 771, 453, 106, 610, 287, 107, 505, 733, 877, 381, 612, 723, 476, 462, 172, 430, 609, 858, 822, 543, 376, 511, 400, 672, 762, 283, 184, 440, 35, 519, 31, 460, 594, 225, 535, 517, 352, 605, 158, 651, 201, 488, 502, 648, 733, 717, 83, 404, 97, 280, 771, 840, 629, 4, 381, 843, 623, 264, 543, - /* k = 128 */ + /* Table F.7, k = 128 */ 521, 310, 864, 547, 858, 580, 296, 379, 53, 779, 897, 444, 400, 925, 749, 415, 822, 93, 217, 208, 928, 244, 583, 620, 246, 148, 447, 631, 292, 908, 490, 704, 516, 258, 457, 907, 594, 723, 674, 292, 272, 96, 684, 432, 686, 606, 860, 569, @@ -77,7 +75,7 @@ INTERNAL_DATA const unsigned short zint_pdf_coefrs[1022] = { 157, 374, 242, 726, 600, 269, 375, 898, 845, 454, 354, 130, 814, 587, 804, 34, 211, 330, 539, 297, 827, 865, 37, 517, 834, 315, 550, 86, 801, 4, 108, 539, - /* k = 256 */ + /* Table F.8, k = 256 */ 524, 894, 75, 766, 882, 857, 74, 204, 82, 586, 708, 250, 905, 786, 138, 720, 858, 194, 311, 913, 275, 190, 375, 850, 438, 733, 194, 280, 201, 280, 828, 757, 710, 814, 919, 89, 68, 569, 11, 204, 796, 605, 540, 913, 801, 700, 799, 137, @@ -95,7 +93,7 @@ INTERNAL_DATA const unsigned short zint_pdf_coefrs[1022] = { 609, 829, 189, 20, 167, 29, 872, 449, 83, 402, 41, 656, 505, 579, 481, 173, 404, 251, 688, 95, 497, 555, 642, 543, 307, 159, 924, 558, 648, 55, 497, 10, - /* k = 512 */ + /* Table F.9, k = 512 */ 352, 77, 373, 504, 35, 599, 428, 207, 409, 574, 118, 498, 285, 380, 350, 492, 197, 265, 920, 155, 914, 299, 229, 643, 294, 871, 306, 88, 87, 193, 352, 781, 846, 75, 327, 520, 435, 543, 203, 666, 249, 346, 781, 621, 640, 268, 794, 534, @@ -130,7 +128,11 @@ INTERNAL_DATA const unsigned short zint_pdf_coefrs[1022] = { 63, 310, 863, 251, 366, 304, 282, 738, 675, 410, 389, 244, 31, 121, 303, 263 }; -INTERNAL_DATA const unsigned short zint_pdf_bitpattern[2787] = { +/* Encoding/decoding table of PDF417 symbol character bar-space sequences from ISO/IEC 15438:2015 Annex A + e.g. 1st entry B SBSBSB S + 3 111113 6 + 11101010111000000 = 1110 1010 1110 0000 with last space implied = 0xEAE0 */ +INTERNAL_DATA const unsigned short zint_pdf_bitpattern[2787] = { /* 2787 = 929 * 3 */ 0xEAE0, 0xF578, 0xFABE, 0xEA70, 0xF53C, 0xFA9F, 0xD460, 0xEA38, 0xD430, 0xA820, 0xD418, 0xA810, 0xD6E0, 0xEB78, 0xF5BE, 0xD670, 0xEB3C, 0xF59F, 0xAC60, 0xD638, 0xAC30, 0xAEE0, 0xD778, 0xEBBE, 0xAE70, 0xD73C, 0xEB9F, 0xAE38, 0xD71E, 0xAF78, @@ -412,7 +414,8 @@ INTERNAL_DATA const unsigned short zint_pdf_bitpattern[2787] = { 0xC3EA, 0xC3E9, 0x83CA, 0x87DA, 0x83C9, 0x87D9, 0xE3F5 }; -/* MicroPDF417 coefficients from ISO/IEC 24728:2006 Annex F */ +/* MicroPDF417 coefficients from ISO/IEC 24728:2006 Annex F + Note from Table 1 minimum no. of EC codewords (k) is 7, so don't need the entries for 3 to 6 */ INTERNAL_DATA const unsigned short zint_pdf_Microcoeffs[344] = { /* k = 7 */ 76, 925, 537, 597, 784, 691, 437, @@ -486,7 +489,7 @@ INTERNAL_DATA const unsigned short zint_pdf_MicroVariants[136] = { /*34*4*/ }; /* rows, columns, error codewords, k-offset */ -/* following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24728:2006 tables 10, 11 and 12 */ +/* Following is Left RAP, Centre RAP, Right RAP and Start Cluster from ISO/IEC 24728:2006 Tables 10, 11 and 12 */ INTERNAL_DATA const char zint_pdf_RAPTable[136] = { /*34*4*/ 1, 8, 36, 19, 9, 25, 1, 1, 8, 36, 19, 9, 27, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 47, 1, 7, 15, 25, 37, 1, 1, 21, 15, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, 19, 1, 7, 15, 25, 37, 17, 9, 29, 31, 25, diff --git a/backend/qr.c b/backend/qr.c index dd61ce1f..14e10257 100644 --- a/backend/qr.c +++ b/backend/qr.c @@ -230,6 +230,7 @@ static void qr_define_modes(char modes[], const unsigned int ddata[], const int * - The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. */ + /* SPDX-License-Identifier: MIT */ unsigned int state[11] = { 0 /*N*/, 0 /*A*/, 0 /*B*/, 0 /*K*/, /* Head/switch costs */ 0 /*version*/, diff --git a/backend/reedsol.c b/backend/reedsol.c index 73e2c0e0..8336444f 100644 --- a/backend/reedsol.c +++ b/backend/reedsol.c @@ -1,10 +1,10 @@ /* This is a simple Reed-Solomon encoder - (C) Cliff Hones 2004 + Copyright (C) Cliff Hones 2004 */ /* libzint - the open source barcode library - Copyright (C) 2009-2025 Robin Stuart + Copyright (C) 2009-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -251,17 +251,17 @@ INTERNAL void zint_rs_encode_uint(const rs_t *rs, const int datalen, const unsig /* `logmod` (field characteristic) will be 2**bitlength - 1, eg 1023 for bitlength 10, 4095 for bitlength 12 */ INTERNAL int zint_rs_uint_init_gf(rs_uint_t *rs_uint, const unsigned int prime_poly, const int logmod) { int b, p, v; - unsigned int *logt, *alog; + unsigned short *logt, *alog; b = logmod + 1; rs_uint->logt = NULL; rs_uint->alog = NULL; - if (!(logt = (unsigned int *) calloc(b, sizeof(unsigned int)))) { + if (!(logt = (unsigned short *) calloc(b, sizeof(unsigned short)))) { return 0; } - if (!(alog = (unsigned int *) calloc(b * 2, sizeof(unsigned int)))) { + if (!(alog = (unsigned short *) calloc(b * 2, sizeof(unsigned short)))) { free(logt); return 0; } @@ -282,8 +282,8 @@ INTERNAL int zint_rs_uint_init_gf(rs_uint_t *rs_uint, const unsigned int prime_p INTERNAL void zint_rs_uint_init_code(rs_uint_t *rs_uint, const int nsym, int index) { int i, k; - const unsigned int *const logt = rs_uint->logt; - const unsigned int *const alog = rs_uint->alog; + const unsigned short *const logt = rs_uint->logt; + const unsigned short *const alog = rs_uint->alog; unsigned short *rspoly = rs_uint->rspoly; unsigned int *log_rspoly = rs_uint->log_rspoly; @@ -315,8 +315,8 @@ INTERNAL void zint_rs_uint_init_code(rs_uint_t *rs_uint, const int nsym, int ind INTERNAL void zint_rs_uint_encode(const rs_uint_t *rs_uint, const int datalen, const unsigned int *data, unsigned int *res) { int i, k; - const unsigned int *const logt = rs_uint->logt; - const unsigned int *const alog = rs_uint->alog; + const unsigned short *const logt = rs_uint->logt; + const unsigned short *const alog = rs_uint->alog; const unsigned short *const rspoly = rs_uint->rspoly; const unsigned int *const log_rspoly = rs_uint->log_rspoly; const int nsym = rs_uint->nsym; diff --git a/backend/reedsol.h b/backend/reedsol.h index 5b4c5488..07130215 100644 --- a/backend/reedsol.h +++ b/backend/reedsol.h @@ -4,7 +4,7 @@ */ /* libzint - the open source barcode library - Copyright (C) 2009-2025 Robin Stuart + Copyright (C) 2009-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -51,8 +51,8 @@ typedef struct { } rs_t; typedef struct { - unsigned int *logt; /* These are malloced */ - unsigned int *alog; + unsigned short *logt; /* These are malloced */ + unsigned short *alog; unsigned short rspoly[4096]; /* Generated poly, 12-bit max - needs to be enlarged if > 12-bit used */ unsigned int log_rspoly[4096]; /* Logs of poly */ int nsym; /* Degree of poly */ diff --git a/backend/sjis.h b/backend/sjis.h index da3da2bc..30610478 100644 --- a/backend/sjis.h +++ b/backend/sjis.h @@ -30,6 +30,7 @@ SUCH DAMAGE. */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* SPDX-License-Identifier: Unicode-3.0 */ #ifndef Z_SJIS_H #define Z_SJIS_H diff --git a/backend/tests/test_gb18030.c b/backend/tests/test_gb18030.c index 5193e5d6..71947ee9 100644 --- a/backend/tests/test_gb18030.c +++ b/backend/tests/test_gb18030.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2019-2025 Robin Stuart + Copyright (C) 2019-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -45,7 +45,7 @@ INTERNAL int zint_test_u_gb18030_int(const unsigned int u, unsigned int *dest1, unsigned int *dest2); /* As control convert to GB 18030 using table generated from GB18030.TXT plus simple processing. - The version of GB18030.TXT is jdk-1.4.2/GB18030.TXT taken from + The version of GB18030.TXT is libiconv-1.11/GB18030.TXT taken from https://haible.de/bruno/charsets/conversion-tables/GB18030.html The generated file backend/tests/test_gb18030_tab.h does not include U+10000..10FFFF codepoints to save space. See also backend/tests/tools/data/GB18030.TXT.README and backend/tests/tools/gen_test_tab.php. diff --git a/backend/tests/test_gs1.c b/backend/tests/test_gs1.c index 62d6bbb1..5e9760e1 100644 --- a/backend/tests/test_gs1.c +++ b/backend/tests/test_gs1.c @@ -2712,7 +2712,7 @@ static void test_input_mode(const testCtx *const p_ctx) { /* 40*/ { BARCODE_AZTEC, "^1234", GS1_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, /* 41*/ { BARCODE_AZTEC, "1234", GS1_MODE | GS1RAW_MODE, -1, ZINT_ERROR_INVALID_DATA, 0 }, /* 42*/ { BARCODE_AZTEC, "https://example.com/01/12345678901231", GS1_MODE, -1, 0, 0 }, - /* 43*/ { BARCODE_CODABLOCKF, "[01]12345678901231", GS1_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, /* Codablock-F does not support GS1 */ + /* 43*/ { BARCODE_CODABLOCKF, "[01]12345678901231", GS1_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, /* Codablock F does not support GS1 */ /* 44*/ { BARCODE_CODABLOCKF, "^0112345678901231", GS1_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, /* 45*/ { BARCODE_CODABLOCKF, "0112345678901231", GS1_MODE | GS1RAW_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, /* 46*/ { BARCODE_CODABLOCKF, "[01]12345678901231", GS1_MODE | ESCAPE_MODE, -1, ZINT_ERROR_INVALID_OPTION, 0 }, diff --git a/backend/tests/test_gs1se.c b/backend/tests/test_gs1se.c index c47b13c0..178a42f3 100644 --- a/backend/tests/test_gs1se.c +++ b/backend/tests/test_gs1se.c @@ -1036,7 +1036,7 @@ static void test_non_forced(const testCtx *const p_ctx) { /* 32*/ { BARCODE_AZTEC, GS1_MODE | GS1NOCHECK_MODE, -1, "[02]12345678901231[10]()[37]12345678[00]123456789012345675", 0, "" }, /* 33*/ { BARCODE_AZTEC, GS1_MODE | GS1NOCHECK_MODE, -1, "^021234567890123110()^3712345678^00123456789012345675", 0, "" }, /* 34*/ { BARCODE_AZTEC, GS1_MODE | GS1NOCHECK_MODE | GS1RAW_MODE, -1, "021234567890123110()\0353712345678\03500123456789012345675", 0, "" }, - /* 35*/ { BARCODE_CODABLOCKF, GS1_MODE, -1, "[01]12345678901231", ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode" }, /* Codablock-F does not support GS1 */ + /* 35*/ { BARCODE_CODABLOCKF, GS1_MODE, -1, "[01]12345678901231", ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode" }, /* Codablock F does not support GS1 */ /* 36*/ { BARCODE_CODABLOCKF, GS1_MODE | GS1NOCHECK_MODE, -1, "[01]12345678901231", ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode" }, /* 37*/ { BARCODE_CODABLOCKF, GS1_MODE, -1, "1234", ZINT_ERROR_INVALID_OPTION, "Error 220: Selected symbology does not support GS1 mode" }, /* 38*/ { BARCODE_CODEONE, GS1_MODE, -1, "[01]12345678901231", 0, "" }, diff --git a/backend/tests/test_pdf417.c b/backend/tests/test_pdf417.c index 319529a0..2721cde1 100644 --- a/backend/tests/test_pdf417.c +++ b/backend/tests/test_pdf417.c @@ -280,9 +280,12 @@ static void test_reader_init(const testCtx *const p_ctx) { const char *expected; const char *comment; }; + /* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */ static const struct item data[] = { - /* 0*/ { BARCODE_PDF417, UNICODE_MODE, READER_INIT, "A", 0, 6, 103, "(12) 4 921 29 900 209 917 46 891 522 472 822 385", "Outputs Test Alpha flag 900" }, - /* 1*/ { BARCODE_MICROPDF417, UNICODE_MODE, READER_INIT, "A", 0, 11, 38, "(11) 921 900 29 900 179 499 922 262 777 478 300", "Outputs Test Alpha flag 900" }, + /* 0*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, READER_INIT, "A", 0, 6, 103, "(12) 4 921 29 900 209 917 46 891 522 472 822 385", "Outputs Test Alpha flag 900" }, + /* 1*/ { BARCODE_PDF417, UNICODE_MODE, READER_INIT, "A", 0, 6, 103, "(12) 4 921 29 900 209 917 46 891 522 472 822 385", "Outputs Test Alpha flag 900" }, + /* 2*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, READER_INIT, "A", 0, 11, 38, "(11) 921 900 29 900 179 499 922 262 777 478 300", "Outputs Test Alpha flag 900" }, + /* 3*/ { BARCODE_MICROPDF417, UNICODE_MODE, READER_INIT, "A", 0, 11, 38, "(11) 921 900 29 900 179 499 922 262 777 478 300", "Outputs Test Alpha flag 900" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; @@ -434,33 +437,40 @@ static void test_input(const testCtx *const p_ctx) { /* 54*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 1, -1, { 0, 0, "" }, "A", 0, 0, 6, 86, "(6) 2 29 752 533 551 139", 0, "BWIPP BYTE1" }, /* 55*/ { BARCODE_PDF417, UNICODE_MODE, -1, 1, -1, { 0, 0, "" }, "A", 0, 0, 6, 86, "(6) 2 29 752 533 551 139", 0, "BWIPP BYTE1" }, /* 56*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 2, -1, { 0, 0, "" }, "A", 0, 0, 5, 103, "(10) 2 29 478 509 903 637 74 490 760 21", 0, "BWIPP BYTE1" }, - /* 57*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 3, -1, { 0, 0, "" }, "A", 0, 0, 9, 103, "(18) 2 29 290 888 64 789 390 182 22 197 347 41 298 467 387 917 455 196", 0, "BWIPP BYTE1" }, - /* 58*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 4, -1, { 0, 0, "" }, "A", 0, 0, 12, 120, "(36) 4 29 900 900 702 212 753 721 695 584 222 459 110 594 813 465 718 912 667 349 852 602", 0, "BWIPP BYTE1" }, - /* 59*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 5, -1, { 0, 0, "" }, "A", 0, 0, 14, 154, "(70) 6 29 900 900 900 900 774 599 527 418 850 374 921 763 922 772 572 661 584 902 578 696", 0, "BWIPP BYTE1" }, - /* 60*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 6, -1, { 0, 0, "" }, "A", 0, 0, 19, 188, "(133) 5 29 900 900 900 113 261 822 368 600 652 404 869 860 902 184 702 611 323 195 794 566", 0, "BWIPP BYTE1" }, - /* 61*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 7, -1, { 0, 0, "" }, "A", 0, 0, 29, 222, "(261) 5 29 900 900 900 384 614 456 20 422 177 78 492 215 859 765 864 755 572 621 891 97 538", 0, "BWIPP BYTE1" }, - /* 62*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 0, 0, "" }, "A", 0, 0, 40, 290, "(520) 8 29 900 900 900 900 900 900 255 576 871 499 885 500 866 196 784 681 589 448 428 108", 0, "BWIPP BYTE1" }, - /* 63*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 1, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 111 100 17 53 923 1 111 104 903 71", 1, "H.4 example" }, - /* 64*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 1, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 111 100 17 53 923 1 111 104 903 71", 1, "H.4 example" }, - /* 65*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 4, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 928 111 103 17 53 923 1 111 104 922 772 754", 1, "H.4 example last segment" }, - /* 66*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 4, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 928 111 103 17 53 923 1 111 104 922 772 754", 1, "H.4 example last segment" }, - /* 67*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 2, 4, "" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 900 900 928 111 101 923 1 111 104 583", 1, "No ID" }, - /* 68*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 2, 4, "" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 900 900 928 111 101 923 1 111 104 583", 1, "No ID" }, - /* 69*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 99998, 99999, "12345" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 222 197 123 45 923 1 222 199 198", 1, "IDs '123', '045'" }, - /* 70*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 99998, 99999, "12345" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 222 197 123 45 923 1 222 199 198", 1, "IDs '123', '045'" }, - /* 71*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 1, 4, "017053" }, "A", 0, 0, 6, 99, "(24) 900 29 900 928 111 100 17 53 923 1 111 104 430 136 328 218 796 853 32 421 712 477 363", 1, "H.4 example" }, - /* 72*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 1, 4, "017053" }, "A", 0, 0, 6, 99, "(24) 900 29 900 928 111 100 17 53 923 1 111 104 430 136 328 218 796 853 32 421 712 477 363", 1, "H.4 example" }, - /* 73*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 4, 4, "017053" }, "A", 0, 0, 6, 99, "(24) 900 29 928 111 103 17 53 923 1 111 104 922 837 837 774 835 701 445 926 428 285 851 334", 1, "H.4 example last segment" }, - /* 74*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 3, 4, "" }, "A", 0, 0, 17, 38, "(17) 900 29 900 928 111 102 923 1 111 104 343 717 634 693 618 860 618", 1, "No ID" }, - /* 75*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 3, 4, "" }, "A", 0, 0, 17, 38, "(17) 900 29 900 928 111 102 923 1 111 104 343 717 634 693 618 860 618", 1, "No ID" }, - /* 76*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 99999, 99999, "100200300" }, "A", 0, 0, 11, 55, "(22) 900 29 928 222 198 100 200 300 923 1 222 199 922 693 699 895 719 637 154 478 399 638", 1, "IDs '100', '200', '300'" }, - /* 77*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 99999, 99999, "100200300" }, "A", 0, 0, 11, 55, "(22) 900 29 928 222 198 100 200 300 923 1 222 199 922 693 699 895 719 637 154 478 399 638", 1, "IDs '100', '200', '300'" }, - /* 78*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "123456", 0, 0, 7, 103, "(14) 6 902 1 348 256 900 759 577 359 263 64 409 852 154", 0, "BWIPP BYTE" }, - /* 79*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, { 0, 0, "" }, "123456", 0, 0, 7, 103, "(14) 6 841 63 125 209 900 889 730 746 451 470 371 667 636", 1, "" }, - /* 80*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "12345678901234567890", 0, 0, 9, 103, "(18) 10 902 211 358 354 304 269 753 190 900 327 902 163 367 231 586 808 731", 1, "" }, - /* 81*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, { 0, 0, "" }, "12345678901234567890", 0, 0, 9, 103, "(18) 10 902 211 358 354 304 269 753 190 900 327 902 163 367 231 586 808 731", 1, "" }, - /* 82*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 0, 12, 137, "(48) 40 902 491 81 137 450 302 67 15 174 492 862 667 475 869 12 434 685 326 422 57 117 339", 1, "" }, - /* 83*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 0, 12, 137, "(48) 40 902 491 81 137 450 302 67 15 174 492 862 667 475 869 12 434 685 326 422 57 117 339", 1, "" }, + /* 57*/ { BARCODE_PDF417, UNICODE_MODE, -1, 2, -1, { 0, 0, "" }, "A", 0, 0, 5, 103, "(10) 2 29 478 509 903 637 74 490 760 21", 0, "BWIPP BYTE1" }, + /* 58*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 3, -1, { 0, 0, "" }, "A", 0, 0, 9, 103, "(18) 2 29 290 888 64 789 390 182 22 197 347 41 298 467 387 917 455 196", 0, "BWIPP BYTE1" }, + /* 59*/ { BARCODE_PDF417, UNICODE_MODE, -1, 3, -1, { 0, 0, "" }, "A", 0, 0, 9, 103, "(18) 2 29 290 888 64 789 390 182 22 197 347 41 298 467 387 917 455 196", 0, "BWIPP BYTE1" }, + /* 60*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 4, -1, { 0, 0, "" }, "A", 0, 0, 12, 120, "(36) 4 29 900 900 702 212 753 721 695 584 222 459 110 594 813 465 718 912 667 349 852 602", 0, "BWIPP BYTE1" }, + /* 61*/ { BARCODE_PDF417, UNICODE_MODE, -1, 4, -1, { 0, 0, "" }, "A", 0, 0, 12, 120, "(36) 4 29 900 900 702 212 753 721 695 584 222 459 110 594 813 465 718 912 667 349 852 602", 0, "BWIPP BYTE1" }, + /* 62*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 5, -1, { 0, 0, "" }, "A", 0, 0, 14, 154, "(70) 6 29 900 900 900 900 774 599 527 418 850 374 921 763 922 772 572 661 584 902 578 696", 0, "BWIPP BYTE1" }, + /* 63*/ { BARCODE_PDF417, UNICODE_MODE, -1, 5, -1, { 0, 0, "" }, "A", 0, 0, 14, 154, "(70) 6 29 900 900 900 900 774 599 527 418 850 374 921 763 922 772 572 661 584 902 578 696", 0, "BWIPP BYTE1" }, + /* 64*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 6, -1, { 0, 0, "" }, "A", 0, 0, 19, 188, "(133) 5 29 900 900 900 113 261 822 368 600 652 404 869 860 902 184 702 611 323 195 794 566", 0, "BWIPP BYTE1" }, + /* 65*/ { BARCODE_PDF417, UNICODE_MODE, -1, 6, -1, { 0, 0, "" }, "A", 0, 0, 19, 188, "(133) 5 29 900 900 900 113 261 822 368 600 652 404 869 860 902 184 702 611 323 195 794 566", 0, "BWIPP BYTE1" }, + /* 66*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 7, -1, { 0, 0, "" }, "A", 0, 0, 29, 222, "(261) 5 29 900 900 900 384 614 456 20 422 177 78 492 215 859 765 864 755 572 621 891 97 538", 0, "BWIPP BYTE1" }, + /* 67*/ { BARCODE_PDF417, UNICODE_MODE, -1, 7, -1, { 0, 0, "" }, "A", 0, 0, 29, 222, "(261) 5 29 900 900 900 384 614 456 20 422 177 78 492 215 859 765 864 755 572 621 891 97 538", 0, "BWIPP BYTE1" }, + /* 68*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 0, 0, "" }, "A", 0, 0, 40, 290, "(520) 8 29 900 900 900 900 900 900 255 576 871 499 885 500 866 196 784 681 589 448 428 108", 0, "BWIPP BYTE1" }, + /* 69*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 0, 0, "" }, "A", 0, 0, 40, 290, "(520) 8 29 900 900 900 900 900 900 255 576 871 499 885 500 866 196 784 681 589 448 428 108", 0, "BWIPP BYTE1" }, + /* 70*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 1, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 111 100 17 53 923 1 111 104 903 71", 1, "H.4 example" }, + /* 71*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 1, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 111 100 17 53 923 1 111 104 903 71", 1, "H.4 example" }, + /* 72*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 4, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 928 111 103 17 53 923 1 111 104 922 772 754", 1, "H.4 example last segment" }, + /* 73*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 4, 4, "017053" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 928 111 103 17 53 923 1 111 104 922 772 754", 1, "H.4 example last segment" }, + /* 74*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 2, 4, "" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 900 900 928 111 101 923 1 111 104 583", 1, "No ID" }, + /* 75*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 2, 4, "" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 900 900 928 111 101 923 1 111 104 583", 1, "No ID" }, + /* 76*/ { BARCODE_PDF417, UNICODE_MODE | FAST_MODE, -1, 8, -1, { 99998, 99999, "12345" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 222 197 123 45 923 1 222 199 198", 1, "IDs '123', '045'" }, + /* 77*/ { BARCODE_PDF417, UNICODE_MODE, -1, 8, -1, { 99998, 99999, "12345" }, "A", 0, 0, 41, 290, "(533) 21 29 900 900 900 900 900 900 900 900 900 900 928 222 197 123 45 923 1 222 199 198", 1, "IDs '123', '045'" }, + /* 78*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 1, 4, "017053" }, "A", 0, 0, 6, 99, "(24) 900 29 900 928 111 100 17 53 923 1 111 104 430 136 328 218 796 853 32 421 712 477 363", 1, "H.4 example" }, + /* 79*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 1, 4, "017053" }, "A", 0, 0, 6, 99, "(24) 900 29 900 928 111 100 17 53 923 1 111 104 430 136 328 218 796 853 32 421 712 477 363", 1, "H.4 example" }, + /* 80*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 4, 4, "017053" }, "A", 0, 0, 6, 99, "(24) 900 29 928 111 103 17 53 923 1 111 104 922 837 837 774 835 701 445 926 428 285 851 334", 1, "H.4 example last segment" }, + /* 81*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 3, 4, "" }, "A", 0, 0, 17, 38, "(17) 900 29 900 928 111 102 923 1 111 104 343 717 634 693 618 860 618", 1, "No ID" }, + /* 82*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 3, 4, "" }, "A", 0, 0, 17, 38, "(17) 900 29 900 928 111 102 923 1 111 104 343 717 634 693 618 860 618", 1, "No ID" }, + /* 83*/ { BARCODE_MICROPDF417, UNICODE_MODE | FAST_MODE, -1, -1, -1, { 99999, 99999, "100200300" }, "A", 0, 0, 11, 55, "(22) 900 29 928 222 198 100 200 300 923 1 222 199 922 693 699 895 719 637 154 478 399 638", 1, "IDs '100', '200', '300'" }, + /* 84*/ { BARCODE_MICROPDF417, UNICODE_MODE, -1, -1, -1, { 99999, 99999, "100200300" }, "A", 0, 0, 11, 55, "(22) 900 29 928 222 198 100 200 300 923 1 222 199 922 693 699 895 719 637 154 478 399 638", 1, "IDs '100', '200', '300'" }, + /* 85*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "123456", 0, 0, 7, 103, "(14) 6 902 1 348 256 900 759 577 359 263 64 409 852 154", 0, "BWIPP BYTE" }, + /* 86*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, { 0, 0, "" }, "123456", 0, 0, 7, 103, "(14) 6 841 63 125 209 900 889 730 746 451 470 371 667 636", 1, "" }, + /* 87*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "12345678901234567890", 0, 0, 9, 103, "(18) 10 902 211 358 354 304 269 753 190 900 327 902 163 367 231 586 808 731", 1, "" }, + /* 88*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, { 0, 0, "" }, "12345678901234567890", 0, 0, 9, 103, "(18) 10 902 211 358 354 304 269 753 190 900 327 902 163 367 231 586 808 731", 1, "" }, + /* 89*/ { BARCODE_PDF417, DATA_MODE | FAST_MODE, -1, -1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 0, 12, 137, "(48) 40 902 491 81 137 450 302 67 15 174 492 862 667 475 869 12 434 685 326 422 57 117 339", 1, "" }, + /* 90*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, { 0, 0, "" }, "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 0, 0, 12, 137, "(48) 40 902 491 81 137 450 302 67 15 174 492 862 667 475 869 12 434 685 326 422 57 117 339", 1, "" }, }; const int data_size = ARRAY_SIZE(data); int i, length, ret; diff --git a/backend/tests/test_perf.c b/backend/tests/test_perf.c index e5610786..ac9a0dea 100644 --- a/backend/tests/test_perf.c +++ b/backend/tests/test_perf.c @@ -51,15 +51,23 @@ struct perf_item { }; static void test_perf(const testCtx *const p_ctx, const int default_iterations, const struct perf_item *data, - const int data_size) { - int debug = p_ctx->debug; + const int data_size, const char *const outfile) { + int debug = p_ctx->debug & 0xFFFF; + /* Hack (use "-d $((256 + (flg << 16)))") to select whether to time (`ZBarcode_Create()` always timed): + 1. `ZBarcode_Encode()` + 2. `ZBarcode_Buffer()` + 4. `ZBarcode_Buffer()` with `OUT_BUFFER_INTERMEDIATE` + 8. `ZBarcode_Print()` + 16. `ZBarcode_Print()` with `BARCODE_MEMORY_FILE` + with 0 meaning all */ + int flg = (p_ctx->debug >> 16) & 0xFF; int i, length, ret; struct zint_symbol *symbol = NULL; clock_t start; - clock_t total_create = 0, total_encode = 0, total_buffer = 0, total_buf_inter = 0, total_print = 0; - clock_t diff_create, diff_encode, diff_buffer, diff_buf_inter, diff_print; + clock_t total_create = 0, total_encode = 0, total_buffer = 0, total_buf_inter = 0, total_print = 0, total_memfile = 0; + clock_t diff_create, diff_encode, diff_buffer, diff_buf_inter, diff_print, diff_memfile; int comment_max = 0; const int iterations = p_ctx->arg ? p_ctx->arg : default_iterations; /* Use "-a N" to set iterations */ @@ -83,9 +91,10 @@ static void test_perf(const testCtx *const p_ctx, const int default_iterations, if (testContinue(p_ctx, i)) continue; - diff_create = diff_encode = diff_buffer = diff_buf_inter = diff_print = 0; + diff_create = diff_encode = diff_buffer = diff_buf_inter = diff_print = 0, diff_memfile = 0; for (j = 0; j < iterations; j++) { + int have_encoded = 0; start = clock(); symbol = ZBarcode_Create(); diff_create += clock() - start; @@ -113,55 +122,104 @@ static void test_perf(const testCtx *const p_ctx, const int default_iterations, data[i].option_1, data[i].option_2, data[i].option_3, -1 /*output_options*/, text, -1, debug); - start = clock(); - ret = ZBarcode_Encode(symbol, TCU(text), length); - diff_encode += clock() - start; - assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", - i, ret, data[i].ret, symbol->errtxt); + if (!flg || (flg & 1)) { + start = clock(); + ret = ZBarcode_Encode(symbol, TCU(text), length); + diff_encode += clock() - start; + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", + i, ret, data[i].ret, symbol->errtxt); + have_encoded = 1; + } + + if (!flg || (flg & 2)) { + if (!have_encoded) { + ret = ZBarcode_Encode(symbol, TCU(text), length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", + i, ret, data[i].ret, symbol->errtxt); + have_encoded = 1; + } + start = clock(); + ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/); + diff_buffer += clock() - start; + assert_zero(ret, "i:%d ZBarcode_Buffer ret %d != 0 (%s)\n", i, ret, symbol->errtxt); + } + + if (!flg || (flg & 4)) { + if (!have_encoded) { + ret = ZBarcode_Encode(symbol, TCU(text), length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", + i, ret, data[i].ret, symbol->errtxt); + have_encoded = 1; + } + symbol->output_options |= OUT_BUFFER_INTERMEDIATE; + start = clock(); + ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/); + diff_buf_inter += clock() - start; + assert_zero(ret, "i:%d ZBarcode_Buffer OUT_BUFFER_INTERMEDIATE ret %d != 0 (%s)\n", + i, ret, symbol->errtxt); + symbol->output_options &= ~OUT_BUFFER_INTERMEDIATE; /* Undo */ + } + + if (!flg || (flg & 8)) { + if (!have_encoded) { + ret = ZBarcode_Encode(symbol, TCU(text), length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", + i, ret, data[i].ret, symbol->errtxt); + have_encoded = 1; + } + if (outfile && strlen(outfile) < 256) { + strcpy(symbol->outfile, outfile); + } + start = clock(); + ret = ZBarcode_Print(symbol, 0 /*rotate_angle*/); + diff_print += clock() - start; + assert_zero(ret, "i:%d ZBarcode_Print ret %d != 0 (%s)\n", i, ret, symbol->errtxt); + assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); + } + + if (!flg || (flg & 16)) { + if (!have_encoded) { + ret = ZBarcode_Encode(symbol, TCU(text), length); + assert_equal(ret, data[i].ret, "i:%d ZBarcode_Encode ret %d != %d (%s)\n", + i, ret, data[i].ret, symbol->errtxt); + /*have_encoded = 1;*/ + } + symbol->output_options |= BARCODE_MEMORY_FILE; + if (outfile && strlen(outfile) < 256) { + strcpy(symbol->outfile, outfile); + } + start = clock(); + ret = ZBarcode_Print(symbol, 0 /*rotate_angle*/); + diff_memfile += clock() - start; + assert_zero(ret, "i:%d ZBarcode_Print BARCODE_MEMORY_FILE ret %d != 0 (%s)\n", i, ret, symbol->errtxt); + symbol->output_options &= ~BARCODE_MEMORY_FILE; /* Undo */ + } assert_equal(symbol->rows, data[i].expected_rows, "i:%d symbol->rows %d != %d (%s)\n", i, symbol->rows, data[i].expected_rows, data[i].data); assert_equal(symbol->width, data[i].expected_width, "i:%d symbol->width %d != %d (%s)\n", i, symbol->width, data[i].expected_width, data[i].data); - start = clock(); - ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/); - diff_buffer += clock() - start; - assert_zero(ret, "i:%d ZBarcode_Buffer ret %d != 0 (%s)\n", i, ret, symbol->errtxt); - - symbol->output_options |= OUT_BUFFER_INTERMEDIATE; - start = clock(); - ret = ZBarcode_Buffer(symbol, 0 /*rotate_angle*/); - diff_buf_inter += clock() - start; - assert_zero(ret, "i:%d ZBarcode_Buffer OUT_BUFFER_INTERMEDIATE ret %d != 0 (%s)\n", - i, ret, symbol->errtxt); - symbol->output_options &= ~OUT_BUFFER_INTERMEDIATE; /* Undo */ - - start = clock(); - ret = ZBarcode_Print(symbol, 0 /*rotate_angle*/); - diff_print += clock() - start; - assert_zero(ret, "i:%d ZBarcode_Print ret %d != 0 (%s)\n", i, ret, symbol->errtxt); - assert_zero(testUtilRemove(symbol->outfile), "i:%d testUtilRemove(%s) != 0\n", i, symbol->outfile); - ZBarcode_Delete(symbol); } - printf(" %*s: encode % 8gms, buffer % 8gms, buf_inter % 8gms, print % 8gms, create % 8gms\n", + printf(" %*s: encode % 8gms, buffer % 8gms, buf_inter % 8gms, print % 8gms, memfile % 8gms, create % 8gms\n", comment_max, data[i].comment, TEST_PERF_TIME(diff_encode), TEST_PERF_TIME(diff_buffer), TEST_PERF_TIME(diff_buf_inter), - TEST_PERF_TIME(diff_print), TEST_PERF_TIME(diff_create)); + TEST_PERF_TIME(diff_print), TEST_PERF_TIME(diff_memfile), TEST_PERF_TIME(diff_create)); total_create += diff_create; total_encode += diff_encode; total_buffer += diff_buffer; total_buf_inter += diff_buf_inter; total_print += diff_print; + total_memfile += diff_memfile; } if (p_ctx->index == -1) { - printf(" %*s: encode % 8gms, buffer % 8gms, buf_inter % 8gms, print % 8gms, create % 8gms\n", + printf(" %*s: encode % 8gms, buffer % 8gms, buf_inter % 8gms, print % 8gms, memfile % 8gms, create % 8gms\n", comment_max, "totals", TEST_PERF_TIME(total_encode), TEST_PERF_TIME(total_buffer), TEST_PERF_TIME(total_buf_inter), - TEST_PERF_TIME(total_print), TEST_PERF_TIME(total_create)); + TEST_PERF_TIME(total_print), TEST_PERF_TIME(total_memfile), TEST_PERF_TIME(total_create)); } testFinish(); @@ -178,7 +236,7 @@ static void test_2of5(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 5 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_aztec(const testCtx *const p_ctx) { @@ -235,7 +293,7 @@ static void test_aztec(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 1 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_aztec_fast(const testCtx *const p_ctx) { @@ -292,7 +350,7 @@ static void test_aztec_fast(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 1 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_code11(const testCtx *const p_ctx) { @@ -304,7 +362,7 @@ static void test_code11(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 5 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_code128(const testCtx *const p_ctx) { @@ -317,7 +375,7 @@ static void test_code128(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 5 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_composite(const testCtx *const p_ctx) { @@ -344,7 +402,7 @@ static void test_composite(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 1 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_dmatrix(const testCtx *const p_ctx) { @@ -424,7 +482,7 @@ static void test_dmatrix(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 5 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_dotcode(const testCtx *const p_ctx) { @@ -442,7 +500,7 @@ static void test_dotcode(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 1 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_gridmtx(const testCtx *const p_ctx) { @@ -467,7 +525,7 @@ static void test_gridmtx(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 1 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_hanxin(const testCtx *const p_ctx) { @@ -509,7 +567,7 @@ static void test_hanxin(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 1 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_maxicode(const testCtx *const p_ctx) { @@ -532,7 +590,7 @@ static void test_maxicode(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 10 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_pdf417(const testCtx *const p_ctx) { @@ -582,7 +640,57 @@ static void test_pdf417(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 5 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); +} + +static void test_pdf417_fast(const testCtx *const p_ctx) { + + static const struct perf_item data[] = { + /* 0*/ { BARCODE_PDF417, FAST_MODE, -1, -1, -1, "1234567890", "", 0, 7, 103, "10 numerics" }, + /* 1*/ { BARCODE_PDF417, FAST_MODE, -1, -1, -1, + "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz&,:#-.$/+%*=^ABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLM" + "NOPQRSTUVWXYZ;<>@[]_`~!||()?{}'123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJK" + "LMNOPQRSTUVWXYZ12345678912345678912345678912345678900001234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFG" + "HIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ12345678901234567" + "890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcde" + "fghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO", + "", 0, 43, 290, "960 chars, text/numeric" }, + /* 2*/ { BARCODE_PDF417, DATA_MODE, -1, -1, -1, + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240" + "\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240\240", + "", 0, 51, 358, "960 chars, byte" }, + /* 3*/ { BARCODE_PDF417, FAST_MODE, -1, -1, -1, + "BP2D+1.00+0005+FLE ESC BV+1.00+3.60*BX2D+1.00+0001+Casual shoes & apparel+90044030118100801265*D_2D+1.02+31351440315981+C910332+02032018+KXXXX CXXXX+UNIT 4 HXXX" + "XXXXX BUSINESS PARK++ST ALBANS+ST ALBANS++AL2 3TA+0001+000001+001+00000000+00++N+N+N+0000++++++N+++N*DS2D+1.01+0001+0001+90044030118100801265+++++07852389322+" + "+E*F_2D+1.00+0005*", + "", 0, 26, 222, "338 chars, text/numeric/byte" }, + }; + const int data_size = ARRAY_SIZE(data); + const int default_iterations = 5 * 1000; + + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_plessey(const testCtx *const p_ctx) { @@ -596,7 +704,7 @@ static void test_plessey(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 5 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_postal(const testCtx *const p_ctx) { @@ -609,7 +717,7 @@ static void test_postal(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 10 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_qr(const testCtx *const p_ctx) { @@ -662,7 +770,7 @@ static void test_qr(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 5 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_qr_fast(const testCtx *const p_ctx) { @@ -715,7 +823,7 @@ static void test_qr_fast(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 5 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_microqr(const testCtx *const p_ctx) { @@ -729,7 +837,7 @@ static void test_microqr(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 5 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); } static void test_upcean(const testCtx *const p_ctx) { @@ -749,7 +857,29 @@ static void test_upcean(const testCtx *const p_ctx) { const int data_size = ARRAY_SIZE(data); const int default_iterations = 10 * 1000; - test_perf(p_ctx, default_iterations, data, data_size); + test_perf(p_ctx, default_iterations, data, data_size, NULL /*outfile*/); +} + +static void test_gif(const testCtx *const p_ctx) { + + static const struct perf_item data[] = { + /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, "123456ABCD", "", 0, 1, 123, "CODE128 10" }, + }; + const int data_size = ARRAY_SIZE(data); + const int default_iterations = 10 * 1000; + + test_perf(p_ctx, default_iterations, data, data_size, "out.gif"); +} + +static void test_tif(const testCtx *const p_ctx) { + + static const struct perf_item data[] = { + /* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, "123456ABCD", "", 0, 1, 123, "CODE128 10" }, + }; + const int data_size = ARRAY_SIZE(data); + const int default_iterations = 10 * 1000; + + test_perf(p_ctx, default_iterations, data, data_size, "out.tif"); } int main(int argc, char *argv[]) { @@ -767,12 +897,16 @@ int main(int argc, char *argv[]) { { "test_hanxin", test_hanxin }, { "test_maxicode", test_maxicode }, { "test_pdf417", test_pdf417 }, + { "test_pdf417_fast", test_pdf417_fast }, { "test_plessey", test_plessey }, { "test_postal", test_postal }, { "test_qr", test_qr }, { "test_qr_fast", test_qr_fast }, { "test_microqr", test_microqr }, { "test_upcean", test_upcean }, + + { "test_gif", test_gif }, + { "test_tif", test_tif }, }; testRun(argc, argv, funcs, ARRAY_SIZE(funcs)); diff --git a/backend/tests/test_tif.c b/backend/tests/test_tif.c index 33047610..ccd0e82a 100644 --- a/backend/tests/test_tif.c +++ b/backend/tests/test_tif.c @@ -1,6 +1,6 @@ /* libzint - the open source barcode library - Copyright (C) 2020-2025 Robin Stuart + Copyright (C) 2020-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -34,7 +34,7 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf); -/* For overview when debugging: ./test_tiff -f pixel_plot -d 5 */ +/* For overview when debugging: ./test_tif -f pixel_plot -d 5 */ static void test_pixel_plot(const testCtx *const p_ctx) { int debug = p_ctx->debug; diff --git a/backend/tests/testcommon.c b/backend/tests/testcommon.c index 42e7095b..8ef2989e 100644 --- a/backend/tests/testcommon.c +++ b/backend/tests/testcommon.c @@ -32,7 +32,7 @@ * Copyright (C) 2006-2017 Kentaro Fukuchi */ /* Due to above: */ -/* SPDX-License-Identifier: LGPL-2.1+ */ +/* SPDX-License-Identifier: LGPL-2.0-or-later */ #ifdef _WIN32 #include diff --git a/backend/tests/tools/bwipp_dump.ps.tar.xz b/backend/tests/tools/bwipp_dump.ps.tar.xz index 530a05e6..8b468780 100644 Binary files a/backend/tests/tools/bwipp_dump.ps.tar.xz and b/backend/tests/tools/bwipp_dump.ps.tar.xz differ diff --git a/backend/tests/tools/gen_test_tab.php b/backend/tests/tools/gen_test_tab.php index 07922f35..7a2b238e 100644 --- a/backend/tests/tools/gen_test_tab.php +++ b/backend/tests/tools/gen_test_tab.php @@ -2,7 +2,7 @@ /* Generate lookup table from unicode.org mapping file (SHIFTJIS.TXT by default). */ /* libzint - the open source barcode library - Copyright (C) 2019-2022 Robin Stuart + Copyright (C) 2019-2026 Robin Stuart */ /* To create backend/tests/test_sjis_tab.h (from the project root directory): * @@ -18,7 +18,7 @@ * * To create backend/tests/test_gb18030_tab.h (note that backend/tests/tools/data/GB18030.TXT * will have to be downloaded first from https://haible.de/bruno/charsets/conversion-tables/GB18030.html - * using the version jdk-1.4.2/GB18030.TXT): + * using the version libiconv-1.11/GB18030.TXT): * * php backend/tests/tools/gen_test_tab.php -f GB18030.TXT -s gb18030_tab * diff --git a/backend/tif.c b/backend/tif.c index 8bc6c209..4e49a27c 100644 --- a/backend/tif.c +++ b/backend/tif.c @@ -38,7 +38,6 @@ #include "filemem.h" #include "output.h" #include "tif.h" -#include "tif_lzw.h" /* PhotometricInterpretation */ #define TIF_PMI_WHITEISZERO 0 @@ -51,13 +50,13 @@ #define TIF_NO_COMPRESSION 1 #define TIF_LZW 5 -static void to_color_map(const unsigned char rgb[4], tiff_color_t *color_map_entry) { +static void tif_to_color_map(const unsigned char rgb[4], tiff_color_t *color_map_entry) { color_map_entry->red = (rgb[0] << 8) | rgb[0]; color_map_entry->green = (rgb[1] << 8) | rgb[1]; color_map_entry->blue = (rgb[2] << 8) | rgb[2]; } -static void to_cmyk(const char *colour, unsigned char *cmyk) { +static void tif_to_cmyk(const char *colour, unsigned char *cmyk) { int cyan, magenta, yellow, black; unsigned char alpha; @@ -69,6 +68,134 @@ static void to_cmyk(const char *colour, unsigned char *cmyk) { cmyk[4] = alpha; } +/* LZW stuff - see `tif_lzw_compress()` below */ + +#define TIF_LZW_CLEAR_CODE 256 +#define TIF_LZW_EOI_CODE 257 /* EndOfInformation */ +#define TIF_LZW_MIN_BITS 9 +#define TIF_LZW_MAX_BITS 12 +#define TIF_LZW_TABLE_SIZE 4096 /* (1 << TIF_LZW_MAX_BITS) */ + +/* Write `code` to output `fmp` in 8-bit batches, returning updated `bytes_put` */ +static int tif_lzw_putCode(struct filemem *fmp, const int code, const int bitsPerCode, int *p_bits, int bytes_put) { + int bits = *p_bits & 0x0FFF; /* Actual bits in buffer */ + int num_bits = (*p_bits >> 16) & 0x0FFF; /* No. of bits in buffer */ + + bits = (bits << bitsPerCode) | code; + + for (num_bits += bitsPerCode; num_bits >= 8; num_bits -= 8) { + zint_fm_putc((bits >> (num_bits - 8)) & 0xFF, fmp); + bytes_put++; + } + + bits &= (1 << num_bits) - 1; + + *p_bits = (num_bits << 16) | bits; + + return bytes_put; +} + +/* LZW compression adapted from TwelveMonkeys ImageIO's `LZWEncoder::encode()`, returns no. of bytes written */ +/* Copyright (c) 2015, Harald Kuhr */ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* Tree algorithm from "LZW Compression Used to Encode/Decode a GIF File", Bob Montgomery, 1988, see + https://gingko.homeip.net/docs/file_formats/lzwgif.html#bob + "manuscript in public domain" according to "Encyclopedia of Graphics File Formats" (2nd edition, 1996) + by James D. Murray and William vanRyper, Chapter 9 "Data Compression", p.178 +*/ +static int tif_lzw_compress(struct filemem *fmp, const unsigned char *bp, const unsigned int blen) { + short suffixes[TIF_LZW_TABLE_SIZE] = {0}; /* "shade[]" in Montgomery diagram */ + /* A child is made up of a parent (or prefix) code plus a suffix byte + and siblings are strings with a common parent (or prefix) and different suffix bytes */ + short children[TIF_LZW_TABLE_SIZE] = {0}; /* "child[]" in Montgomery diagram */ + short siblings[TIF_LZW_TABLE_SIZE] = {0}; /* "sib[]" in Montgomery diagram */ + + int parent; + int bitsPerCode = TIF_LZW_MIN_BITS; /* "codesize" in Montgomery diagram, goes from 9 to 12 */ + int nextValidCode = TIF_LZW_EOI_CODE + 1; /* "nvc" - next available slot in `suffixes` */ + int maxCode = (1 << bitsPerCode) - 1; /* If `nextValidCode` hits this, `bitsPerCode` will have to be adjusted */ + + int bits = 0; /* Buffer for partial codes, top 16-bits no. of bits, bottom the bits */ + int bytes_put = 0; /* No. of bytes output */ + + const unsigned char *const be = bp + blen; + + assert(blen != 0); + + /* Init */ + bytes_put = tif_lzw_putCode(fmp, TIF_LZW_CLEAR_CODE & maxCode, bitsPerCode, &bits, bytes_put); + parent = *bp++; /* Parent is 1st code */ + + while (bp < be) { + const int value = *bp++; /* "color" in Montgomery diagram */ + int child = children[parent]; + + /* Does parent have a child? */ + if (child) { + /* Is child right value? */ + if (suffixes[child] == value) { + parent = child; /* Make new parent */ + } else { + int sibling = child; /* Makes loop easier */ + /* Try siblings */ + for (;;) { + /* Does sibling have a sibling? */ + if (siblings[sibling]) { + sibling = siblings[sibling]; + /* Is sibling right value? */ + if (suffixes[sibling] == value) { + parent = sibling; /* Make new parent */ + break; + } + } else { + /* Create one */ + siblings[sibling] = (short) nextValidCode; + goto update_child; /* Hack to avoid having func with large no. of args */ + } + } + } + /* Parent does not have a child */ + } else { + /* Create one */ + children[parent] = (short) nextValidCode; +update_child: + suffixes[nextValidCode] = (short) value; + bytes_put = tif_lzw_putCode(fmp, parent & maxCode, bitsPerCode, &bits, bytes_put); /* Put the code */ + parent = value; + if (++nextValidCode > maxCode) { + /* Adjust `bitsPerCode` (code size) if required */ + if (bitsPerCode == TIF_LZW_MAX_BITS) { + /* Signal reset by writing Clear code */ + bytes_put = tif_lzw_putCode(fmp, TIF_LZW_CLEAR_CODE & maxCode, bitsPerCode, &bits, bytes_put); + + /* Reset tables */ + memset(children, 0, sizeof(short) * TIF_LZW_TABLE_SIZE); + memset(siblings, 0, sizeof(short) * TIF_LZW_TABLE_SIZE); + bitsPerCode = TIF_LZW_MIN_BITS; + nextValidCode = TIF_LZW_EOI_CODE + 1; + } else { + /* Increase code size */ + bitsPerCode++; + } + maxCode = (1 << bitsPerCode) - 1; + } + } + } + + /* Write EOI when we are done */ + bytes_put = tif_lzw_putCode(fmp, parent & maxCode, bitsPerCode, &bits, bytes_put); + bytes_put = tif_lzw_putCode(fmp, TIF_LZW_EOI_CODE & maxCode, bitsPerCode, &bits, bytes_put); + + /* Flush partial codes */ + if (bits) { + const int num_bits = (bits >> 16) & 0x0FFF; + zint_fm_putc((bits << (8 - num_bits)) & 0xFF, fmp); /* Zero pad */ + bytes_put++; + } + + return bytes_put; +} + /* TIFF Revision 6.0 https://www.adobe.io/content/dam/udp/en/open/standards/tiff/TIFF6.pdf */ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char *pixelbuf) { unsigned char fg[4], bg[4]; @@ -94,7 +221,6 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char struct filemem *const fmp = &fm; const unsigned char *pb; int compression = TIF_NO_COMPRESSION; - tif_lzw_state lzw_state; long file_pos; const int output_to_stdout = symbol->output_options & BARCODE_STDOUT; uint32_t *strip_offset; @@ -134,9 +260,9 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char palette[i][4] = fg[3]; } map['0'] = 8; - to_cmyk(symbol->bgcolour, palette[8]); + tif_to_cmyk(symbol->bgcolour, palette[8]); map['1'] = 9; - to_cmyk(symbol->fgcolour, palette[9]); + tif_to_cmyk(symbol->fgcolour, palette[9]); pmi = TIF_PMI_SEPARATED; bits_per_sample = 8; @@ -171,7 +297,7 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char if (fg[3] == 0xff && bg[3] == 0xff) { /* If no alpha */ pmi = TIF_PMI_PALETTE_COLOR; for (i = 0; i < 10; i++) { - to_color_map(palette[i], &color_map[i]); + tif_to_color_map(palette[i], &color_map[i]); } bits_per_sample = 4; samples_per_pixel = 1; @@ -188,9 +314,9 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char } else { /* fg/bg only */ if (symbol->output_options & CMYK_COLOUR) { map['0'] = 0; - to_cmyk(symbol->bgcolour, palette[0]); + tif_to_cmyk(symbol->bgcolour, palette[0]); map['1'] = 1; - to_cmyk(symbol->fgcolour, palette[1]); + tif_to_cmyk(symbol->fgcolour, palette[1]); pmi = TIF_PMI_SEPARATED; bits_per_sample = 8; @@ -227,7 +353,7 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char pmi = TIF_PMI_PALETTE_COLOR; for (i = 0; i < 2; i++) { - to_color_map(palette[i], &color_map[i]); + tif_to_color_map(palette[i], &color_map[i]); } if (fg[3] == 0xff && bg[3] == 0xff) { /* If no alpha */ bits_per_sample = 4; @@ -316,7 +442,6 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char } if (!output_to_stdout) { compression = TIF_LZW; - tif_lzw_init(&lzw_state); } /* Header */ @@ -370,13 +495,13 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char if (strip_row == rows_per_strip || (strip == strip_count - 1 && strip_row == rows_last_strip)) { /* End of strip */ if (compression == TIF_LZW) { + #ifndef NDEBUG file_pos = zint_fm_tell(fmp); - if (!tif_lzw_encode(&lzw_state, fmp, strip_buf, bytes_put)) { /* Only fails if can't malloc */ - tif_lzw_cleanup(&lzw_state); - (void) zint_fm_close(fmp, symbol); - return z_errtxt(ZINT_ERROR_MEMORY, symbol, 673, "Insufficient memory for TIF LZW hash table"); - } - bytes_put = (unsigned int) (zint_fm_tell(fmp) - file_pos); + #endif + bytes_put = tif_lzw_compress(fmp, strip_buf, bytes_put); + #ifndef NDEBUG + assert(bytes_put == (unsigned int) (zint_fm_tell(fmp) - file_pos)); + #endif if (bytes_put != strip_bytes[strip]) { const int diff = bytes_put - strip_bytes[strip]; strip_bytes[strip] = bytes_put; @@ -402,8 +527,6 @@ INTERNAL int zint_tif_pixel_plot(struct zint_symbol *symbol, const unsigned char } if (compression == TIF_LZW) { - tif_lzw_cleanup(&lzw_state); - file_pos = zint_fm_tell(fmp); zint_fm_seek(fmp, 4, SEEK_SET); free_memory = file_pos; diff --git a/backend/tif_lzw.h b/backend/tif_lzw.h deleted file mode 100644 index 02e74615..00000000 --- a/backend/tif_lzw.h +++ /dev/null @@ -1,382 +0,0 @@ -/* tif_lzw.h - LZW compression for TIFF */ -/* - libzint - the open source barcode library - Copyright (C) 2021-2025 Robin Stuart - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the project nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - SUCH DAMAGE. - */ -/* SPDX-License-Identifier: BSD-3-Clause */ - -#ifndef Z_TIF_LZW_H -#define Z_TIF_LZW_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * Adapted from TIFF Library 4.2.0 libtiff/tif_lzw.c */ -/* - * Copyright (c) 1988-1997 Sam Leffler - * Copyright (c) 1991-1997 Silicon Graphics, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and - * its documentation for any purpose is hereby granted without fee, provided - * that (i) the above copyright notices and this permission notice appear in - * all copies of the software and related documentation, and (ii) the names of - * Sam Leffler and Silicon Graphics may not be used in any advertising or - * publicity relating to the software without the specific, prior written - * permission of Sam Leffler and Silicon Graphics. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR - * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, - * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF - * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ -/* - * TIFF Library. - * Rev 5.0 Lempel-Ziv & Welch Compression Support - * - * This code is derived from the compress program whose code is - * derived from software contributed to Berkeley by James A. Woods, - * derived from original work by Spencer Thomas and Joseph Orost. - * - * The original Berkeley copyright notice appears below in its entirety. - */ -/* - * Copyright (c) 1985, 1986 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * James A. Woods, derived from original work by Spencer Thomas - * and Joseph Orost. - * - * Redistribution and use in source and binary forms are permitted - * provided that the above copyright notice and this paragraph are - * duplicated in all such forms and that any documentation, - * advertising materials, and other materials related to such - * distribution and use acknowledge that the software was developed - * by the University of California, Berkeley. The name of the - * University may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - */ - -#define MAXCODE(n) ((1L << (n)) - 1) - -/* - * The TIFF spec specifies that encoded bit - * strings range from 9 to 12 bits. - */ -#define BITS_MIN 9 /* start with 9 bits */ -#define BITS_MAX 12 /* max of 12 bit strings */ -/* predefined codes */ -#define CODE_CLEAR 256 /* code to clear string table */ -#define CODE_EOI 257 /* end-of-information code */ -#define CODE_FIRST 258 /* first free code entry */ -#define CODE_MAX MAXCODE(BITS_MAX) -#define HSIZE 9001L /* 91% occupancy */ -#define HSHIFT (13 - 8) - -/* - * Encoding-specific state. - */ -typedef uint16_t tif_lzw_hcode; /* codes fit in 16 bits */ -typedef struct { - long hash; - tif_lzw_hcode code; -} tif_lzw_hash; - -#define CHECK_GAP 10000 /* ratio check interval */ - -/* - * State block. - */ -typedef struct { - tif_lzw_hash *enc_hashtab; /* kept separate for small machines */ -} tif_lzw_state; - -/* - * LZW Encoding. - */ - -/* - * Reset encoding hash table. - */ -static void tif_lzw_cl_hash(tif_lzw_state *sp) { - register tif_lzw_hash *hp = &sp->enc_hashtab[HSIZE - 1]; - register long i = HSIZE - 8; - - do { - i -= 8; - hp[-7].hash = -1; - hp[-6].hash = -1; - hp[-5].hash = -1; - hp[-4].hash = -1; - hp[-3].hash = -1; - hp[-2].hash = -1; - hp[-1].hash = -1; - hp[ 0].hash = -1; - hp -= 8; - } while (i >= 0); - - for (i += 8; i > 0; i--, hp--) { - hp->hash = -1; - } -} - -#define CALCRATIO(sp, rat) { \ - if (incount > 0x007fffff) { /* NB: shift will overflow */ \ - rat = outcount >> 8; \ - rat = (rat == 0 ? 0x7fffffff : incount / rat); \ - } else \ - rat = (incount << 8) / outcount; \ -} - -/* Explicit 0xff masking to make icc -check=conversions happy */ -#define PutNextCode(op_fmp, c) { \ - nextdata = (nextdata << nbits) | c; \ - nextbits += nbits; \ - zint_fm_putc((nextdata >> (nextbits - 8)) & 0xff, op_fmp); \ - nextbits -= 8; \ - if (nextbits >= 8) { \ - zint_fm_putc((nextdata >> (nextbits - 8)) & 0xff, op_fmp); \ - nextbits -= 8; \ - } \ - outcount += nbits; \ -} - -/* - * Encode a chunk of pixels. - * - * Uses an open addressing double hashing (no chaining) on the - * prefix code/next character combination. We do a variant of - * Knuth's algorithm D (vol. 3, sec. 6.4) along with G. Knott's - * relatively-prime secondary probe. Here, the modular division - * first probe is gives way to a faster exclusive-or manipulation. - * Also do block compression with an adaptive reset, whereby the - * code table is cleared when the compression ratio decreases, - * but after the table fills. The variable-length output codes - * are re-sized at this point, and a CODE_CLEAR is generated - * for the decoder. - */ -static int tif_lzw_encode(tif_lzw_state *sp, struct filemem *op_fmp, const unsigned char *bp, int cc) { - register long fcode; - register tif_lzw_hash *hp; - register int h, c; - tif_lzw_hcode ent; - long disp; - - int nbits; /* # of bits/code */ - int maxcode; /* maximum code for nbits */ - int free_ent; /* next free entry in hash table */ - unsigned long nextdata; /* next bits of i/o */ - long nextbits; /* # of valid bits in nextdata */ - long checkpoint; /* point at which to clear table */ - long ratio; /* current compression ratio */ - long incount; /* (input) data bytes encoded */ - long outcount; /* encoded (output) bytes */ - - /* - * Reset encoding state at the start of a strip. - */ - if (sp->enc_hashtab == NULL) { - sp->enc_hashtab = (tif_lzw_hash *) malloc(HSIZE * sizeof(tif_lzw_hash)); - if (sp->enc_hashtab == NULL) { - return 0; - } - } - - tif_lzw_cl_hash(sp); /* clear hash table */ - - nbits = BITS_MIN; - maxcode = MAXCODE(BITS_MIN); - free_ent = CODE_FIRST; - nextdata = 0; - nextbits = 0; - checkpoint = CHECK_GAP; - ratio = 0; - incount = 0; - outcount = 0; - - ent = (tif_lzw_hcode) -1; - - if (cc > 0) { - PutNextCode(op_fmp, CODE_CLEAR); - ent = *bp++; cc--; incount++; - } - while (cc > 0) { - c = *bp++; cc--; incount++; - fcode = ((long)c << BITS_MAX) + ent; - h = (c << HSHIFT) ^ ent; /* xor hashing */ -#ifdef _WINDOWS - /* - * Check hash index for an overflow. - */ - if (h >= HSIZE) { - h -= HSIZE; - } -#endif - hp = &sp->enc_hashtab[h]; - if (hp->hash == fcode) { - ent = hp->code; - continue; - } - if (hp->hash >= 0) { - /* - * Primary hash failed, check secondary hash. - */ - disp = HSIZE - h; - if (h == 0) { - disp = 1; - } - do { - /* - * Avoid pointer arithmetic because of - * wraparound problems with segments. - */ - if ((h -= disp) < 0) { - h += HSIZE; - } - hp = &sp->enc_hashtab[h]; - if (hp->hash == fcode) { - ent = hp->code; - goto hit; - } - } while (hp->hash >= 0); - } - /* - * New entry, emit code and add to table. - */ - PutNextCode(op_fmp, ent); - ent = (tif_lzw_hcode) c; - hp->code = (tif_lzw_hcode) (free_ent++); - hp->hash = fcode; - if (free_ent == CODE_MAX - 1) { - /* table is full, emit clear code and reset */ - tif_lzw_cl_hash(sp); - ratio = 0; - incount = 0; - outcount = 0; - free_ent = CODE_FIRST; - PutNextCode(op_fmp, CODE_CLEAR); - nbits = BITS_MIN; - maxcode = MAXCODE(BITS_MIN); - } else { - /* - * If the next entry is going to be too big for - * the code size, then increase it, if possible. - */ - if (free_ent > maxcode) { - nbits++; - assert(nbits <= BITS_MAX); - maxcode = (int) MAXCODE(nbits); - } else if (incount >= checkpoint) { - long rat; - /* - * Check compression ratio and, if things seem - * to be slipping, clear the hash table and - * reset state. The compression ratio is a - * 24+8-bit fractional number. - */ - checkpoint = incount + CHECK_GAP; - CALCRATIO(sp, rat); - if (rat <= ratio) { - tif_lzw_cl_hash(sp); - ratio = 0; - incount = 0; - outcount = 0; - free_ent = CODE_FIRST; - PutNextCode(op_fmp, CODE_CLEAR); - nbits = BITS_MIN; - maxcode = MAXCODE(BITS_MIN); - } else { - ratio = rat; - } - } - } - hit: - ; - } - - /* - * Finish off an encoded strip by flushing the last - * string and tacking on an End Of Information code. - */ - if (ent != (tif_lzw_hcode) -1) { - - PutNextCode(op_fmp, ent); - free_ent++; - - if (free_ent == CODE_MAX - 1) { - /* table is full, emit clear code and reset */ - outcount = 0; - PutNextCode(op_fmp, CODE_CLEAR); - nbits = BITS_MIN; - } else { - /* - * If the next entry is going to be too big for - * the code size, then increase it, if possible. - */ - if (free_ent > maxcode) { - nbits++; - assert(nbits <= BITS_MAX); - } - } - } - PutNextCode(op_fmp, CODE_EOI); - /* Explicit 0xff masking to make icc -check=conversions happy */ - if (nextbits > 0) { - zint_fm_putc((nextdata << (8 - nextbits)) & 0xff, op_fmp); - } - - return 1; -} - -static void tif_lzw_cleanup(tif_lzw_state *sp) { - if (sp->enc_hashtab) { - free(sp->enc_hashtab); - } -} - -static void tif_lzw_init(tif_lzw_state *sp) { - sp->enc_hashtab = NULL; -} - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -/* vim: set ts=4 sw=4 et : */ -#endif /* Z_TIF_LZW_H */ diff --git a/backend/tools/gen_eci_mb_h.php b/backend/tools/gen_eci_mb_h.php index 20909671..844f578c 100644 --- a/backend/tools/gen_eci_mb_h.php +++ b/backend/tools/gen_eci_mb_h.php @@ -2,7 +2,7 @@ /* Generate ECI multibyte tables from unicode.org mapping files */ /* libzint - the open source barcode library - Copyright (C) 2022-2025 Robin Stuart + Copyright (C) 2022-2026 Robin Stuart */ /* SPDX-License-Identifier: BSD-3-Clause */ /* @@ -12,7 +12,7 @@ * * NOTE: backend/tools/data/GB18030.TXT will have to be downloaded first from the tarball * https://haible.de/bruno/charsets/conversion-tables/GB18030.tar.bz2 - * using the version jdk-1.4.2/GB18030.TXT + * using the version libiconv-1.11/GB18030.TXT * * NOTE: tools/data/GB2312.TXT will have to be downloaded first from the tarball * https://haible.de/bruno/charsets/conversion-tables/GB2312.tar.bz2 @@ -48,6 +48,7 @@ $copyright_text = <<<'EOD' SUCH DAMAGE. */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* SPDX-License-Identifier: Unicode-3.0 */ EOD; @@ -573,7 +574,7 @@ file_put_contents($out_dirname . '/gbk.h', implode("\n", $out) . "\n"); $out = array(); -out_header($out, 'gb18030', 'GB 18030-2005', 'jdk-1.4.2/GB18030.TXT', 2016, +out_header($out, 'gb18030', 'GB 18030-2005', 'libiconv-1.11/GB18030.TXT', 2016, '(see https://haible.de/bruno/charsets/conversion-tables/GB18030.tar.bz2)'); $file = $data_dirname . '/' . 'GB18030.TXT'; diff --git a/backend/tools/gen_eci_sb_h.php b/backend/tools/gen_eci_sb_h.php index f7c24a12..489cf178 100644 --- a/backend/tools/gen_eci_sb_h.php +++ b/backend/tools/gen_eci_sb_h.php @@ -2,7 +2,7 @@ /* Generate ECI single-byte tables & routines from unicode.org mapping files */ /* libzint - the open source barcode library - Copyright (C) 2022-2025 Robin Stuart + Copyright (C) 2022-2026 Robin Stuart */ /* SPDX-License-Identifier: BSD-3-Clause */ /* @@ -26,7 +26,7 @@ $head = <<<'EOD' "https://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP125*.TXT" */ /* libzint - the open source barcode library - Copyright (C) 2021-2025 Robin Stuart + Copyright (C) 2021-2026 Robin Stuart Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions @@ -54,6 +54,7 @@ $head = <<<'EOD' SUCH DAMAGE. */ /* SPDX-License-Identifier: BSD-3-Clause */ +/* SPDX-License-Identifier: Unicode-3.0 */ #ifndef Z_ECI_SB_H #define Z_ECI_SB_H diff --git a/backend/zint.h b/backend/zint.h index a4974159..30f3f790 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -212,7 +212,7 @@ extern "C" { #define BARCODE_DATAMATRIX 71 /* Data Matrix (ECC200) */ #define BARCODE_EAN14 72 /* EAN-14 */ #define BARCODE_VIN 73 /* Vehicle Identification Number */ -#define BARCODE_CODABLOCKF 74 /* Codablock-F */ +#define BARCODE_CODABLOCKF 74 /* Codablock F */ #define BARCODE_NVE18 75 /* NVE-18 (SSCC-18) */ #define BARCODE_JAPANPOST 76 /* Japanese Postal Code */ #define BARCODE_KOREAPOST 77 /* Korea Post */ @@ -244,7 +244,7 @@ extern "C" { #define BARCODE_HIBC_QR 104 /* HIBC QR Code */ #define BARCODE_HIBC_PDF 106 /* HIBC PDF417 */ #define BARCODE_HIBC_MICPDF 108 /* HIBC MicroPDF417 */ -#define BARCODE_HIBC_BLOCKF 110 /* HIBC Codablock-F */ +#define BARCODE_HIBC_BLOCKF 110 /* HIBC Codablock F */ #define BARCODE_HIBC_AZTEC 112 /* HIBC Aztec Code */ /* Tbarcode 10 codes */ diff --git a/debian/changelog b/debian/changelog index e3e78c38..156fc34a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,19 +1,29 @@ -zint (2.6.0) stable; urgency=medium +zint (2.16.0.9-1) unstable; urgency=low + + * Updated using https://salsa.debian.org/debian/zint as template, props + Dmitry Smirnov + * Ticket #147, props John Crisp + * TODO: enable building with the GS1 Syntax Engine + * TODO: "libzint2.16.symbols" file? + + -- Robin Stuart Wed, 18 Mar 2026 13:00:00 +0000 + +zint (2.6.0-1) stable; urgency=medium * Update to Qt5 * Output to EMF and TIF - + -- Robin Stuart Fri, 12 May 2017 09:00:00 +0000 zint (2.5.1) UNRELEASED; urgency=medium * Include support for DotCode * Include support for Han Xin (Chinese Sensible) code. - * Reinstate Codablock-F support. + * Reinstate Codablock F support. * Automated ECI pre-processing. * Output to BMP, GIF and PCX. * Huge code review and numerous bugfixes - * DMRE support and DataMatrix bugfixes + * DMRE support and DataMatrix bugfixes -- Robin Stuart Fri, 13 Jan 2017 20:33:54 +0000 @@ -21,7 +31,7 @@ zint (2.4.1) unstable; urgency=low * Update and review of files required by Debian including changelog. - -- Robin Stuart Sat, 02 Oct 2010 09:26:00 +0000 + -- Robin Stuart Sat, 02 Oct 2010 09:26:00 +0000 zint (2.4) unstable; urgency=low @@ -32,7 +42,7 @@ zint (2.4) unstable; urgency=low * Reinstated escape character input. * Simplification of Barcode Studio. - -- Robin Stuart Sat, 02 Oct 2010 05:00:00 +0000 + -- Robin Stuart Sat, 02 Oct 2010 05:00:00 +0000 zint (2.3.2) unstable; urgency=low @@ -43,18 +53,18 @@ zint (2.3.2) unstable; urgency=low * Also minor bugfixes for ISBN and Aztec Code, and added some small features like a --square option in the CLI. - -- Robin Stuart Sat, 02 Oct 2010 04:00:00 +0000 + -- Robin Stuart Sat, 02 Oct 2010 04:00:00 +0000 zint (2.3.1) unstable; urgency=low - * Removed Codablock-F. + * Removed Codablock F. * Redesigned scale function so that human readable text and Maxicode symbols can be scaled consistently. * Corrected encoding bugs with Code 128/Code 16k and Data Matrix ECC 050. * Added --notext option to CLI. - -- Robin Stuart Sat, 02 Oct 2010 03:00:00 +0000 + -- Robin Stuart Sat, 02 Oct 2010 03:00:00 +0000 zint (2.3) unstable; urgency=low @@ -68,7 +78,7 @@ zint (2.3) unstable; urgency=low * Advanced Barcode Studio version number to match library version number. - -- Robin Stuart Sat, 02 Oct 2010 02:00:00 +0000 + -- Robin Stuart Sat, 02 Oct 2010 02:00:00 +0000 zint (2.2.2) unstable; urgency=low @@ -86,8 +96,8 @@ zint (2.2.1-1) unstable; urgency=low zint (2.2.1) unstable; urgency=low - * bug fixes. Affected symbologies are Data Matrix, - USPS One Code, Aztec Code, PDF417, MicroPDF and Composite symbols. + * bug fixes. Affected symbologies are Data Matrix, + USPS One Code, Aztec Code, PDF417, MicroPDF and Composite symbols. If you use any of these then please update. -- BogDan Vatra Fri, 07 Aug 2009 15:04:12 +0300 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index f11c82a4..00000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 \ No newline at end of file diff --git a/debian/control b/debian/control index 0b1d6bd2..74e4d2a7 100644 --- a/debian/control +++ b/debian/control @@ -1,42 +1,119 @@ Source: zint -Section: libs +Section: graphics Priority: optional Maintainer: Robin Stuart -Build-Depends: debhelper (>= 9), cmake, libpng12-dev, libqt4-dev -Standards-Version: 3.9.1 -Homepage: http://www.zint.org.uk/ +Build-Depends: debhelper-compat (= 12) + ,cmake + ,libpng-dev + ,libqt5svg5-dev + ,qtbase5-dev + ,qttools5-dev +Standards-Version: 4.6.2 +Homepage: https://www.zint.org.uk/ +Rules-Requires-Root: no Package: zint -Section: libs Architecture: any -Description: A library for encoding data in barcode symbols. - Zint is an Open Source barcode encoding and image generating library. - It currently features support for over 50 symbologies including - QR Code, Data Matrix, Aztec Code, Code 128, UPC/EAN, HIBC, GS1 DataBar and many others. - Also included are Unicode translation for symbologies which support Latin-1 and Kanji character sets, - full GS1 data support including verification and automated insertion of FNC1 characters and - support for encoding binary data including NULL (ASCII 0) characters. - -Package: zint-devel -Section: libdevel -Architecture: any -Depends: zint (= ${binary:Version}) -Description: Zint development files - This package contains development files for the Zint barcode encoding - library. +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: command line utility for encoding data in barcode symbols + Zint is a barcode generator library. It features support for over 50 + symbologies, including Australian Post, Aztec Code & Runes, BC412, + Channel, Codabar, Codablock F, Code 11, Code 128, Code 16K, Code 2 of + 5 (IATA, Interleaved, Data Logic, ITF-14, Deutsche Post Leitcode & + Identcode), Code 32 (Italian Pharmacode), Code 39 & Code 39 Extended, + Code 49, Code 93, Code One, DAFT, Data Matrix (incl. DMRE), DotCode, + DPD, Dutch Post KIX, EAN, FIM, Flattermarken, Grid Matrix, GS1 DataBar + (incl. stacked & GS1 Composite symbols), GS1-128, Han Xin, HIBC, ISBN, + Japan Post, Korea Post, LOGMARS, MaxiCode, NVE-18 (SSCC-18), PDF417 & + MicroPDF417, Pharmacode, PLANET, POSTNET, Plessey (MSI & UK), PZN, QR + Code, Micro QR & rMQR, Royal Mail RM4SCC & Mailmark, Telepen, + Ultracode, UPC-A, UPC-E, UPNQR, UPU S10, USPS Intelligent Mail and + VIN. + . + Also included are Unicode translation for all ECI character sets, full + GS1 data support including verification and automated insertion of + FNC1 characters and support for encoding binary data. Output can be + saved as BMP, EMF, EPS, GIF, PCX, PNG, SVG and TIFF. + . + This package contains Zint Barcode Generator (command line utility). Package: zint-qt +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Zint Barcode Studio, a Qt frontend to zint + Zint is a barcode generator library. It features support for over 50 + symbologies, including Australian Post, Aztec Code & Runes, BC412, + Channel, Codabar, Codablock F, Code 11, Code 128, Code 16K, Code 2 of + 5 (IATA, Interleaved, Data Logic, ITF-14, Deutsche Post Leitcode & + Identcode), Code 32 (Italian Pharmacode), Code 39 & Code 39 Extended, + Code 49, Code 93, Code One, DAFT, Data Matrix (incl. DMRE), DotCode, + DPD, Dutch Post KIX, EAN, FIM, Flattermarken, Grid Matrix, GS1 DataBar + (incl. stacked & GS1 Composite symbols), GS1-128, Han Xin, HIBC, ISBN, + Japan Post, Korea Post, LOGMARS, MaxiCode, NVE-18 (SSCC-18), PDF417 & + MicroPDF417, Pharmacode, PLANET, POSTNET, Plessey (MSI & UK), PZN, QR + Code, Micro QR & rMQR, Royal Mail RM4SCC & Mailmark, Telepen, + Ultracode, UPC-A, UPC-E, UPNQR, UPU S10, USPS Intelligent Mail and + VIN. + . + Also included are Unicode translation for all ECI character sets, full + GS1 data support including verification and automated insertion of + FNC1 characters and support for encoding binary data. Output can be + saved as BMP, EMF, EPS, GIF, PCX, PNG, SVG and TIFF. + . + This package contains Zint Barcode Studio, a Qt frontend for the Zint + barcode generator library. + +Package: libzint2.16 Section: libs Architecture: any -Depends: zint (= ${binary:Version}) -Description: Zint Barcode Studio. - This package contains Zint Barcode Studio, a QT frontend for the Zint - barcode encoding library. +Multi-Arch: same +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: library for encoding data in barcode symbols + Zint is a barcode generator library. It features support for over 50 + symbologies, including Australian Post, Aztec Code & Runes, BC412, + Channel, Codabar, Codablock F, Code 11, Code 128, Code 16K, Code 2 of + 5 (IATA, Interleaved, Data Logic, ITF-14, Deutsche Post Leitcode & + Identcode), Code 32 (Italian Pharmacode), Code 39 & Code 39 Extended, + Code 49, Code 93, Code One, DAFT, Data Matrix (incl. DMRE), DotCode, + DPD, Dutch Post KIX, EAN, FIM, Flattermarken, Grid Matrix, GS1 DataBar + (incl. stacked & GS1 Composite symbols), GS1-128, Han Xin, HIBC, ISBN, + Japan Post, Korea Post, LOGMARS, MaxiCode, NVE-18 (SSCC-18), PDF417 & + MicroPDF417, Pharmacode, PLANET, POSTNET, Plessey (MSI & UK), PZN, QR + Code, Micro QR & rMQR, Royal Mail RM4SCC & Mailmark, Telepen, + Ultracode, UPC-A, UPC-E, UPNQR, UPU S10, USPS Intelligent Mail and + VIN. + . + Also included are Unicode translation for all ECI character sets, full + GS1 data support including verification and automated insertion of + FNC1 characters and support for encoding binary data. Output can be + saved as BMP, EMF, EPS, GIF, PCX, PNG, SVG and TIFF. + . + This package provides the Zint barcode generator library. -Package: zint-qt-devel +Package: libzint-dev Section: libdevel Architecture: any -Depends: zint (= ${binary:Version}), zint-qt (= ${source:Version}), libqt4-dev -Description: QZint development files. - This package contains development files for the Qt wrapper over the Zint - library. \ No newline at end of file +Depends: libzint2.16 (= ${binary:Version}), ${misc:Depends} +Multi-Arch: same +Description: Zint development files + Zint is a barcode generator library. It features support for over 50 + symbologies, including Australian Post, Aztec Code & Runes, BC412, + Channel, Codabar, Codablock F, Code 11, Code 128, Code 16K, Code 2 of + 5 (IATA, Interleaved, Data Logic, ITF-14, Deutsche Post Leitcode & + Identcode), Code 32 (Italian Pharmacode), Code 39 & Code 39 Extended, + Code 49, Code 93, Code One, DAFT, Data Matrix (incl. DMRE), DotCode, + DPD, Dutch Post KIX, EAN, FIM, Flattermarken, Grid Matrix, GS1 DataBar + (incl. stacked & GS1 Composite symbols), GS1-128, Han Xin, HIBC, ISBN, + Japan Post, Korea Post, LOGMARS, MaxiCode, NVE-18 (SSCC-18), PDF417 & + MicroPDF417, Pharmacode, PLANET, POSTNET, Plessey (MSI & UK), PZN, QR + Code, Micro QR & rMQR, Royal Mail RM4SCC & Mailmark, Telepen, + Ultracode, UPC-A, UPC-E, UPNQR, UPU S10, USPS Intelligent Mail and + VIN. + . + Also included are Unicode translation for all ECI character sets, full + GS1 data support including verification and automated insertion of + FNC1 characters and support for encoding binary data. Output can be + saved as BMP, EMF, EPS, GIF, PCX, PNG, SVG and TIFF. + . + This package contains development files for the Zint barcode generator + library and for the Qt wrapper over the Zint library. diff --git a/debian/copyright b/debian/copyright index dbab6579..54c60f3d 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,40 +1,462 @@ -This package was debianized by: - - BogDan Vatra on Sat, 11 Apr 2009 23:45:53 +0300 - Modified by Robin Stuart on Fri, 13 Jan 2017 21:12:00 +0000 - -It was downloaded from: - - - -Upstream Author(s): - - Robin Stuart +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Zint Barcode Generator +Upstream-Contact: Robin Stuart +Source: https://sourceforge.net/projects/zint/ +Files: * Copyright: + Copyright (C) 2006-2026 Robin Stuart + Copyright (C) 2014-2026 Harald Oehlmann + Copyright (C) 2008 by BogDan Vatra < bogdan@licentia.eu > + Copyright (C) 2006-2017 Kentaro Fukuchi +License: GPL-3.0-or-later - +Files: backend/* +Copyright: + Copyright (C) 2017-2026 Robin Stuart + Copyright (C) 2014-2026 Harald Oehlmann + Copyright (C) Cliff Hones 2004 + Copyright (c) 2004 Adrian Kennard, Andrews & Arnold Ltd + Copyright (c) 2006 Stefan Schmidt + Copyright (C) 2016 Zoe Stuart + Copyright (C) 2006-2009 United States Postal Service +License: BSD-3-Clause -License: +Files: + backend/aztec.c + backend/gs1.c + backend/fonts/normal_ttf.h + backend/fonts/normal_woff2.h +Copyright: + Copyright (C) 2017-2026 Robin Stuart + Copyright 2013 ZXing authors + Copyright 2016 Huy Cuong Nguyen + Copyright (c) 2024 GS1 AISBL. + Copyright 2013 Steve Matteson +License: BSD-3-Clause and Apache-2.0 - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. +Files: + backend/fonts/upcean_ttf.h + backend/fonts/upcean_woff2.h +Copyright: + Copyright (C) 2023 Robin Stuart + Copyright Matthew Skala (2011) +License: BSD-3-Clause and Metafont-deriv + You may freely use, modify, and/or distribute any of these files or the + resulting fonts, without limitation. - This package is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. +Files: + backend/fonts/OCRB-16.bdf + backend/fonts/OCRB-18.bdf +Copyright: + Copyright Matthew Skala (2011) +License: Metafont-permissive + As far as the digitization in METAFONT input which I have developed, you + may freely use, modify, and/or distribute any of these files or the + resulting fonts, without limitation. - You should have received a copy of the GNU General Public License - along with this program. If not, see . +Files: + backend/big5.h + backend/eci_sb.h + backend/gb18030.h + backend/gb2312.h + backend/gbk.h + backend/ksx1001.h + backend/sjis.h +Copyright: + Copyright (C) 2017-2026 Robin Stuart + Copyright © 1991-2023 Unicode, Inc. +License: BSD-3-Clause and Unicode-3.0 -On Debian systems, the complete text of the GNU General -Public License version 3 can be found in `/usr/share/common-licenses/GPL-3'. +Files: + backend/channel.c + backend/composite.c + backend/common.c + backend/gridmtx.c + backend/hanxin.c + backend/qr.* +Copyright: + Copyright (C) 2017-2026 Robin Stuart + Copyright (c) AIM 1997 + Copyright (c) 2004-2026 Terry Burton + Copyright (c) 2008-2009 Bjoern Hoehrmann + Copyright (c) Project Nayuki +License: BSD-3-Clause and MIT -The Debian packaging is: +Files: + backend/pcx.c +Copyright: + Copyright (C) 2017-2026 Robin Stuart + Copyright 1999-2013 ImageMagick Studio LLC +License: BSD-3-Clause and ImageMagick - Copyright (C) 2010-2017 Robin Stuart +Files: + backend/pdf417.c +Copyright: + Copyright (C) 2017-2026 Robin Stuart + Copyright (C) 2004 (Grandzebu). +License: BSD-3-Clause and GPL-2.0-or-later -and is licensed under the GPL version 3, see above. +Files: + docs/lua-crossrefs/lua-crossrefs.lua + getopt/* +Copyright: + Copyright (C) 2025-2026 Robin Stuart + Copyright © 2025 R. N. West. + Copyright (C) 1987-2003 Free Software Foundation, Inc. +License: GPL-2.0-or-later + +Files: + backend/tests/testcommon.* +Copyright: + Copyright (C) 2019-2026 Robin Stuart + Copyright (C) 2006-2017 Kentaro Fukuchi +License: LGPL-2.0-or-later + +Files: + frontend/main.c +Copyright: + Copyright (C) 2008-2026 Robin Stuart + Copyright 2002 Jon Griffiths + Copyright 2016 Sebastian Lackner +License: GPL-3.0-or-later and LGPL-2.1-or-later + +Files: + frontend_qt/res/black-eye.svg + frontend_qt/res/check.svg + frontend_qt/res/copy.svg + frontend_qt/res/delete.svg + frontend_qt/res/download.svg + frontend_qt/res/help-circle.svg + frontend_qt/res/menu.svg + frontend_qt/res/shuffle.svg + frontend_qt/res/white-eye.svg + frontend_qt/res/x.svg + frontend_qt/res/zap.svg +Copyright: + Copyright (c) 2013-2022 Cole Bemis +License: MIT + +Files: + frontend_qt/res/folder.svg + frontend_qt/res/monitor-bg.svg + frontend_qt/res/scaling.svg +Copyright: + Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022. +License: ISC + +Files: debian/* +Copyright: + 2013-2025 Dmitry Smirnov +License: GPL-3.0-or-later + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + ․ + http://www.apache.org/licenses/LICENSE-2.0 + ․ + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ․ + On Debian systems, the complete text of the Apache License, + Version 2.0 can be found in "/usr/share/common-licenses/Apache-2.0". + +License: BSD-3-Clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + ․ + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + ․ + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + ․ + 3. Neither the name of the project nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + ․ + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: GPL-2.0-or-later + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + ․ + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + ․ + On Debian systems, the complete text of the GNU General Public + License Version 2 can be found in "/usr/share/common-licenses/GPL-2". + +License: GPL-3.0-or-later + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + ․ + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + ․ + On Debian systems, the complete text of the GNU General Public + License Version 3 can be found in "/usr/share/common-licenses/GPL-3". + +License: ImageMagick + 1. Definitions. + License shall mean the terms and conditions for use, reproduction, and + distribution as defined by Sections 1 through 9 of this document. + . + Licensor shall mean the copyright owner or entity authorized by the copyright + owner that is granting the License. + . + Legal Entity shall mean the union of the acting entity and all other entities + that control, are controlled by, or are under common control with that entity. + For the purposes of this definition, control means (i) the power, direct or + indirect, to cause the direction or management of such entity, whether by + contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + . + You (or Your) shall mean an individual or Legal Entity exercising permissions + granted by this License. + . + Source form shall mean the preferred form for making modifications, including + but not limited to software source code, documentation source, and + configuration files. + . + Object form shall mean any form resulting from mechanical transformation or + translation of a Source form, including but not limited to compiled object + code, generated documentation, and conversions to other media types. + . + Work shall mean the work of authorship, whether in Source or Object form, made + available under the License, as indicated by a copyright notice that is + included in or attached to the work (an example is provided in the Appendix + below). + . + Derivative Works shall mean any work, whether in Source or Object form, that is + based on (or derived from) the Work and for which the editorial revisions, + annotations, elaborations, or other modifications represent, as a whole, an + original work of authorship. For the purposes of this License, Derivative Works + shall not include works that remain separable from, or merely link (or bind by + name) to the interfaces of, the Work and Derivative Works thereof. + . + Contribution shall mean any work of authorship, including the original version + of the Work and any modifications or additions to that Work or Derivative Works + thereof, that is intentionally submitted to Licensor for inclusion in the Work + by the copyright owner or by an individual or Legal Entity authorized to submit + on behalf of the copyright owner. For the purposes of this definition, + "submitted" means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, and + issue tracking systems that are managed by, or on behalf of, the Licensor for + the purpose of discussing and improving the Work, but excluding communication + that is conspicuously marked or otherwise designated in writing by the + copyright owner as Not a Contribution. + . + Contributor shall mean Licensor and any individual or Legal Entity on behalf + of whom a Contribution has been received by Licensor and subsequently + incorporated within the Work. + . + 2. Grant of Copyright License. Subject to the terms and conditions of this + License, each Contributor hereby grants to You a perpetual, worldwide, + non-exclusive, no-charge, royalty-free, irrevocable copyright license to + reproduce, prepare Derivative Works of, publicly display, publicly perform, + sublicense, and distribute the Work and such Derivative Works in Source or + Object form. + . + 3. Grant of Patent License. Subject to the terms and conditions of this + License, each Contributor hereby grants to You a perpetual, worldwide, + non-exclusive, no-charge, royalty-free, irrevocable patent license to make, + have made, use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable by such + Contributor that are necessarily infringed by their Contribution(s) alone or by + combination of their Contribution(s) with the Work to which such + Contribution(s) was submitted. If You institute patent litigation against any + entity (including a cross-claim or counterclaim in a lawsuit) alleging that the + Work or a Contribution incorporated within the Work constitutes direct or + contributory patent infringement, then any patent licenses granted to You under + this License for that Work shall terminate as of the date such litigation is + filed. + . + 4. Redistribution. You may reproduce and distribute copies of the Work or + Derivative Works thereof in any medium, with or without modifications, and in + Source or Object form, provided that You meet the following conditions: + . + a. You must give any other recipients of the Work or Derivative Works a + copy of this License; and + . + b. You must cause any modified files to carry prominent notices stating + that You changed the files; and + . + c. You must retain, in the Source form of any Derivative Works that You + distribute, all copyright, patent, trademark, and attribution notices from + the Source form of the Work, excluding those notices that do not pertain to + any part of the Derivative Works; and + . + d. If the Work includes a "NOTICE" text file as part of its distribution, + then any Derivative Works that You distribute must include a readable copy + of the attribution notices contained within such NOTICE file, excluding + those notices that do not pertain to any part of the Derivative Works, in + at least one of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or documentation, + if provided along with the Derivative Works; or, within a display generated + by the Derivative Works, if and wherever such third-party notices normally + appear. The contents of the NOTICE file are for informational purposes only + and do not modify the License. You may add Your own attribution notices + within Derivative Works that You distribute, alongside or as an addendum to + the NOTICE text from the Work, provided that such additional attribution + notices cannot be construed as modifying the License. + . + You may add Your own copyright statement to Your modifications and may provide + additional or different license terms and conditions for use, reproduction, or + distribution of Your modifications, or for any such Derivative Works as a + whole, provided Your use, reproduction, and distribution of the Work otherwise + complies with the conditions stated in this License. + . + 5. Submission of Contributions. Unless You explicitly state otherwise, any + Contribution intentionally submitted for inclusion in the Work by You to the + Licensor shall be under the terms and conditions of this License, without any + additional terms or conditions. Notwithstanding the above, nothing herein shall + supersede or modify the terms of any separate license agreement you may have + executed with Licensor regarding such Contributions. + . + 6. Trademarks. This License does not grant permission to use the trade names, + trademarks, service marks, or product names of the Licensor, except as required + for reasonable and customary use in describing the origin of the Work and + reproducing the content of the NOTICE file. + . + 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in + writing, Licensor provides the Work (and each Contributor provides its + Contributions) on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + either express or implied, including, without limitation, any warranties or + conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any risks + associated with Your exercise of permissions under this License. + . + 8. Limitation of Liability. In no event and under no legal theory, whether in + tort (including negligence), contract, or otherwise, unless required by + applicable law (such as deliberate and grossly negligent acts) or agreed to in + writing, shall any Contributor be liable to You for damages, including any + direct, indirect, special, incidental, or consequential damages of any + character arising as a result of this License or out of the use or inability to + use the Work (including but not limited to damages for loss of goodwill, work + stoppage, computer failure or malfunction, or any and all other commercial + damages or losses), even if such Contributor has been advised of the + possibility of such damages. + . + 9. Accepting Warranty or Additional Liability. While redistributing the Work or + Derivative Works thereof, You may choose to offer, and charge a fee for, + acceptance of support, warranty, indemnity, or other liability obligations + and/or rights consistent with this License. However, in accepting such + obligations, You may act only on Your own behalf and on Your sole + responsibility, not on behalf of any other Contributor, and only if You agree + to indemnify, defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason of your + accepting any such warranty or additional liability. + +License: ISC + Permission to use, copy, modify, and /or distribute this software for any + purpose with or without fee is hereby granted, provided that the above + copyright notice and this permission notice appear in all copies. + . + THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + PERFORMANCE OF THIS SOFTWARE. + +License: MIT + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + ․ + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + +License: LGPL-2.0-or-later + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + ․ + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + ․ + On Debian systems, the complete text of the GNU Library General Public + License Version 2 can be found in "/usr/share/common-licenses/LGPL-2". + +License: LGPL-2.1-or-later + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + ․ + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Library General Public License for more details. + ․ + On Debian systems, the complete text of the GNU Library General Public + License Version 2 can be found in "/usr/share/common-licenses/LGPL-2.1". + +License: Unicode-3.0 + NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING, + INSTALLING, COPYING OR OTHERWISE USING DATA FILES, AND/OR SOFTWARE, YOU + UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS + OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, + DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE. + . + Permission is hereby granted, free of charge, to any person obtaining a copy of + data files and any associated documentation (the "Data Files") or software and + any associated documentation (the "Software") to deal in the Data Files or + Software without restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, and/or sell copies of the Data Files + or Software, and to permit persons to whom the Data Files or Software are + furnished to do so, provided that either (a) this copyright and permission + notice appear with all copies of the Data Files or Software, or (b) this + copyright and permission notice appear in associated Documentation. + . + THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD + PARTY RIGHTS. + . + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE + LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY + DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE. + . + Except as contained in this notice, the name of a copyright holder shall not be + used in advertising or otherwise to promote the sale, use or other dealings in + these Data Files or Software without prior written authorization of the + copyright holder. diff --git a/debian/libzint-dev.install b/debian/libzint-dev.install new file mode 100644 index 00000000..fc258174 --- /dev/null +++ b/debian/libzint-dev.install @@ -0,0 +1,4 @@ +usr/include +usr/lib/*/*.so +usr/lib/*/cmake/zint/*.cmake usr/share/zint/ +cmake/modules/FindZint.cmake usr/share/apps/cmake/modules/ diff --git a/debian/libzint2.16.install b/debian/libzint2.16.install new file mode 100644 index 00000000..af70f1d6 --- /dev/null +++ b/debian/libzint2.16.install @@ -0,0 +1 @@ +/usr/lib/*/libzint.so.* diff --git a/debian/not-installed b/debian/not-installed new file mode 100644 index 00000000..089a12f8 --- /dev/null +++ b/debian/not-installed @@ -0,0 +1 @@ +usr/lib/*/libQZint.a diff --git a/debian/rules b/debian/rules index cbe925d7..92701de7 100755 --- a/debian/rules +++ b/debian/rules @@ -1,3 +1,12 @@ #!/usr/bin/make -f +# vim: set ts=4 sw=4 noet : + %: - dh $@ + dh $@ --buildsystem=cmake + +# https://bugs-devel.debian.org/cgi-bin/bugreport.cgi?bug=1016936 +override_dh_dwz: + +# This is just to avoid a "no dependency information" error if have local non-package lib builds +override_dh_shlibdeps: + dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info diff --git a/debian/zint-devel.install b/debian/zint-devel.install deleted file mode 100644 index 4c8a20a2..00000000 --- a/debian/zint-devel.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/include/zint.h -usr/lib/libzint.so diff --git a/debian/zint-qt-devel.install b/debian/zint-qt-devel.install deleted file mode 100644 index 63169a18..00000000 --- a/debian/zint-qt-devel.install +++ /dev/null @@ -1,2 +0,0 @@ -usr/include/qzint.h -usr/lib/libQZint.so diff --git a/debian/zint-qt.install b/debian/zint-qt.install index de70f44d..a390c11a 100644 --- a/debian/zint-qt.install +++ b/debian/zint-qt.install @@ -1,2 +1,4 @@ -usr/lib/libQZint.so.* usr/bin/zint-qt +usr/share/man/man1/zint-qt.1 +*.desktop /usr/share/applications +zint-qt.png /usr/share/pixmaps diff --git a/debian/zint.install b/debian/zint.install index d0ca3895..36c8b0a4 100644 --- a/debian/zint.install +++ b/debian/zint.install @@ -1,2 +1,2 @@ -usr/lib/libzint.so.* usr/bin/zint +usr/share/man/man1/zint.1 diff --git a/docs/Makefile b/docs/Makefile index f37becc2..390e3a9a 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,9 +1,13 @@ -# Makefile for generating "manual.txt" and "manual.pdf" from "manual.pmd" and "zint.1" from "zint.1.pmd" using pandoc -# Copyright (C) 2022-2025 +# Makefile for generating: +# "manual.html", "manual.pdf" and "manual.txt" from "manual.pmd" +# "zint.1" from "zint.1.pmd" +# "zint-qt.1" from "zint-qt.1.pmd" +# using pandoc +# Copyright (C) 2022-2026 # vim: set ts=4 sw=4 noet : # # Requires pandoc >= 3.8.2, plus xelatex and various other packages - see "README" -# .svg images generated by "zint_images.sh" +# "images/*.svg" generated by "zint_images.sh" SOURCE = manual.pmd OUT_PDF = manual.pdf @@ -17,6 +21,8 @@ INCLUDES_TXT = inc_header_txt.tex INC_TXT = --include-in-header $(INCLUDES_TXT) SOURCE_MAN_PAGE = zint.1.pmd OUT_MAN_PAGE = zint.1 +SOURCE_QT_MAN_PAGE = zint-qt.1.pmd +OUT_QT_MAN_PAGE = zint-qt.1 LUA_FILTER = lua-crossrefs/lua-crossrefs.lua INFRASTRUCTURE = Makefile $(LUA_FILTER) $(HIGHLIGHT_THEME) IMAGES = \ @@ -160,7 +166,7 @@ TXT_OPTS = --lua-filter=$(LUA_FILTER) \ --columns 80 --eol=lf -t plain MAN_PAGE_OPTS = -s -t man -all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN_PAGE) $(OUT_HTML) +all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN_PAGE) $(OUT_QT_MAN_PAGE) $(OUT_HTML) $(OUT_PDF) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) $(INFRASTRUCTURE) pandoc $(SOURCE_MAN_PAGE) -f markdown \ @@ -195,6 +201,11 @@ $(OUT_MAN_PAGE) : $(SOURCE_MAN_PAGE) $(INFRASTRUCTURE) $(MAN_PAGE_OPTS) \ -o $(OUT_MAN_PAGE) +$(OUT_QT_MAN_PAGE) : $(SOURCE_QT_MAN_PAGE) $(INFRASTRUCTURE) + pandoc $(SOURCE_QT_MAN_PAGE) -f markdown \ + $(MAN_PAGE_OPTS) \ + -o $(OUT_QT_MAN_PAGE) + # For debugging manual.tex : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) $(INFRASTRUCTURE) diff --git a/docs/README b/docs/README index 09531081..89e061c6 100644 --- a/docs/README +++ b/docs/README @@ -1,7 +1,8 @@ -% docs/README 2026-03-11 +% docs/README 2026-03-17 For generation of "docs/manual.html", "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" -and man page "docs/zint.1" from "docs/zint.1.pmd" using pandoc >= 3.8.2. +and man pages "docs/zint.1" from "docs/zint.1.pmd" and "docs/zint-qt.1" from "docs/zint-qt.1.pmd" +using pandoc >= 3.8.2. On Ubuntu/Debian (tested on Ubuntu 22.04 and Ubuntu 24.04) diff --git a/docs/lua-crossrefs/lua-crossrefs.lua b/docs/lua-crossrefs/lua-crossrefs.lua index 2fe6174e..4bfea632 100644 --- a/docs/lua-crossrefs/lua-crossrefs.lua +++ b/docs/lua-crossrefs/lua-crossrefs.lua @@ -1,8 +1,8 @@ -- libzint - the open source barcode library --- Copyright (C) 2025 Robin Stuart +-- Copyright (C) 2025-2026 Robin Stuart -- Hacked from https://github.com/rnwst/pandoc-lua-crossrefs --- © 2025 R. N. West. Released under the GPL version 2 or greater. +-- Copyright © 2025 R. N. West. Released under the GPL version 2 or greater. -- SPDX-License-Identifier: GPL-2.0-or-later PANDOC_VERSION:must_be_at_least '3.8.2' diff --git a/docs/manual.html b/docs/manual.html index 4b35e6af..f381fe03 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -504,6 +504,7 @@ id="toc-utf-8-to-eci-convenience-functions">5.17 UTF-8 to ECI convenience functions
  • 5.18 Zint Version
  • +
  • 5.19 Debug Info
  • 6. Types of Symbology @@ -631,8 +632,8 @@ Stacked Symbologies
    • 6.2.1 Basic Symbol Stacking
    • -
    • 6.2.2 -Codablock-F
    • +
    • 6.2.2 Codablock +F
    • 6.2.3 Code 16K (EN 12323)
    • 6.2.4 PDF417 @@ -1866,7 +1867,7 @@ DataBar Truncated) 74 BARCODE_CODABLOCKF -Codablock-F +Codablock F 75 @@ -1986,7 +1987,7 @@ DataBar Truncated) 110 BARCODE_HIBC_BLOCKF -HIBC Codablock-F +HIBC Codablock F 112 @@ -2154,7 +2155,7 @@ class="sourceCode bash">Warning 247: Height not compliant with standards

      Another switch is --heightperrow, which can be useful for symbologies that have a variable number of linear rows, namely -Codablock-F, Code 16K, Code 49, GS1 DataBar Expanded Stacked, +Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked, MicroPDF417 and PDF417, as it changes the treatment of the height value from overall height to per-row height, allowing you to specify a consistent height for each linear row without having to know how many @@ -2193,7 +2194,7 @@ class="sourceCode bash">--whitesp or --vwhitesp switches.

      -

      Note that Codablock-F, Code 16K, Code 49, ITF-14, EAN-13, EAN-8, +

      Note that Codablock F, Code 16K, Code 49, ITF-14, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, UPC-A and UPC-E have compliant quiet zones added by default. This can be disabled with the option --noquietzones.

      @@ -2231,7 +2232,7 @@ alt="zint -b QRCODE --border=1 --box -d "This Text" --quietzones" />
      Figure 16: zint -b QRCODE --border=1 --box -d "This Text" --quietzones
      -

      Codablock-F, Code 16K and Code 49 always have boundary bars, and +

      Codablock F, Code 16K and Code 49 always have boundary bars, and default to particular horizontal whitespace values. Special considerations apply to ITF-14 and DPD - see 6.1.2.6 ITF-14 and 6.1.10.7 DPD Code for those @@ -2506,7 +2507,7 @@ Sets None -Codablock-F +Codablock F Latin-1 None @@ -2602,7 +2603,7 @@ Modes and ECI below.

      href="#gs1-data-entry-and-options">4.11.3 GS1 Data Entry and Options.

      Health Industry Barcode (HIBC) data may be encoded in the symbologies -Aztec Code, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417, +Aztec Code, Codablock F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR Code. Within this mode, the leading '+' and the check character are automatically added by Zint, conforming to HIBC Labeler Identification Code (HIBC LIC). For HIBC Provider Applications @@ -3298,6 +3299,8 @@ hexadecimal values if asked to output to a text file ("*.txt") or if given the option --filetype=txt or the option --dump. This can be used for test and diagnostic purposes.

      +

      Also there’s the --verbose option which will output +debug information to stdout.

      Additional options are available which are specific to certain symbologies. These may, for example, control the amount of error correction data or the size of the symbol. These options are discussed @@ -4411,7 +4414,7 @@ For instance:

      if (ZBarcode_BarcodeName(BARCODE_PDF417, name) == 0) { printf("%s\n", name); } -

      will print BARCODE_PDF417.

      +

      will print “BARCODE_PDF417”.

      5.15 Checking Symbology Capabilities

      It can be useful for frontend programs to know the capabilities of a @@ -4607,6 +4610,11 @@ available, else zero.

      int ZBarcode_Version(void);

      The version parts are separated by hundreds. For instance, version "2.9.1" is returned as "20901".

      +

      5.19 Debug Info

      +

      Debugging information can be output to stdout by setting +the debug member to ZINT_DEBUG_PRINT +(1). Other values are used internally by the test suite and +shouldn’t be set.

      6. Types of Symbology

      6.1 One-Dimensional Symbols

      One-dimensional or linear symbols are what most people associate with @@ -5581,7 +5589,7 @@ alt="zint --notext --bind --separator=2 -d "This" -d "That""

      A more sophisticated method is to use some type of line indexing which indicates to the barcode reader which order the stacked symbols should be read in. This is demonstrated by the symbologies below.

      -

      6.2.2 Codablock-F

      +

      6.2.2 Codablock F

      This is a stacked symbology based on Code 128 which can encode Latin-1 data up to a maximum length of 2726 symbol characters, meaning for instance up to 2726 all ASCII characters, or 5452 all numeric, or up @@ -5592,12 +5600,12 @@ alt="zint -b CODABLOCKF -d "CODABLOCK F Symbology" --rows=3" />

      Figure 84: zint -b CODABLOCKF -d "CODABLOCK F Symbology" --rows=3
      -

      The width of the Codablock-F symbol can be set using the +

      The width of the Codablock F symbol can be set using the --cols option (API option_2), to a value between 9 and 67. The height (number of rows) can be set using the --rows option (API option_1), with a maximum -of 44. Zint does not currently support encoding of GS1 data in -Codablock-F symbols.

      +of 44. Zint does not currently support encoding of GS1 data in Codablock +F symbols.

      A separate symbology ID (BARCODE_HIBC_BLOCKF) can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 check digit to the encoded @@ -8543,7 +8551,7 @@ Silicon Wafers (BC412) (1996)

    • Code
    • BS EN 798:1996 Bar coding - Symbology specifications - ‘Codabar’
    • -
    • AIM Europe ISS-X-24 - Uniform Symbology Specification Codablock-F +
    • AIM Europe ISS-X-24 - Uniform Symbology Specification Codablock F (1995)
    • ISO/IEC 15417:2007 Information technology - Automatic identification and data capture techniques - Code 128 bar code symbology @@ -9217,7 +9225,7 @@ the --border option.

      --cols=INTEGER

      Set the number of data columns in the symbol to INTEGER. -Affects Codablock-F, DotCode, GS1 DataBar Expanded Stacked +Affects Codablock F, DotCode, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417 symbols.

      --compliantheight
      @@ -9413,7 +9421,7 @@ floating-point.

      --heightperrow
      -

      Treat height as per-row. Affects Codablock-F, Code 16K, Code 49, GS1 +

      Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417.

      -i, --input=FILE
      @@ -9502,7 +9510,7 @@ can be 0, 90, 270 or 360.

      --rows=INTEGER
      -

      Set the number of rows for Codablock-F or PDF417 to INTEGER. +

      Set the number of rows for Codablock F or PDF417 to INTEGER. It will also set the minimum number of rows for Code 16K or Code 49, and the maximum number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK).

      @@ -9594,6 +9602,10 @@ names can be used with -b | --barcode.

      NUMBER is in X-dimensions, and may be floating-point. Maximum is 10 and minimum is -5. The default is 1.

      +
      --verbose
      +
      +

      Output debug information to stdout.

      +
      --vers=INTEGER

      Set the symbol version (size, check digits, other options) to @@ -9967,10 +9979,10 @@ role="doc-backlink">↩︎

    • default for DPD - see 6.1.10.7 DPD Code.↩︎

    • The BARCODE_BIND flag is always set for -Codablock-F, Code 16K and Code 49. Special considerations apply to +Codablock F, Code 16K and Code 49. Special considerations apply to ITF-14 - see 6.1.2.6 ITF-14.↩︎

    • -
    • Codablock-F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC +

    • Codablock F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, ITF-14, UPC-A and UPC-E have compliant quiet zones added by default.↩︎

    • diff --git a/docs/manual.pmd b/docs/manual.pmd index 8299a1e4..d592329a 100644 --- a/docs/manual.pmd +++ b/docs/manual.pmd @@ -2,6 +2,8 @@ % Version 2.16.0.9 % March 2026 +[//]: # ( vim: set ts=4 sw=4 et : ) + # 1. Introduction The Zint project aims to provide a complete cross-platform open source barcode @@ -781,7 +783,7 @@ Value 73 `BARCODE_VIN` Vehicle Identification Number - 74 `BARCODE_CODABLOCKF` Codablock-F + 74 `BARCODE_CODABLOCKF` Codablock F 75 `BARCODE_NVE18` NVE-18 (SSCC-18) @@ -829,7 +831,7 @@ Value 108 `BARCODE_HIBC_MICPDF` HIBC MicroPDF417 - 110 `BARCODE_HIBC_BLOCKF` HIBC Codablock-F + 110 `BARCODE_HIBC_BLOCKF` HIBC Codablock F 112 `BARCODE_HIBC_AZTEC` HIBC Aztec Code @@ -934,7 +936,7 @@ Warning 247: Height not compliant with standards ``` Another switch is `--heightperrow`, which can be useful for symbologies that -have a variable number of linear rows, namely Codablock-F, Code 16K, Code 49, +have a variable number of linear rows, namely Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked, MicroPDF417 and PDF417, as it changes the treatment of the height value from overall height to per-row height, allowing you to specify a consistent height for each linear row without having to know @@ -982,7 +984,7 @@ A `--quietzones` option is also available which adds quiet zones compliant with the symbology's specification. This is in addition to any whitespace specified with the `--whitesp` or `--vwhitesp` switches. -Note that Codablock-F, Code 16K, Code 49, ITF-14, EAN-13, EAN-8, EAN/UPC +Note that Codablock F, Code 16K, Code 49, ITF-14, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, UPC-A and UPC-E have compliant quiet zones added by default. This can be disabled with the option `--noquietzones`. @@ -1016,7 +1018,7 @@ whitespace. ![`zint -b QRCODE --border=1 --box -d "This Text" --quietzones`](images/qrcode_box.svg){.i2d} -Codablock-F, Code 16K and Code 49 always have boundary bars, and default to +Codablock F, Code 16K and Code 49 always have boundary bars, and default to particular horizontal whitespace values. Special considerations apply to ITF-14 and DPD - see [6.1.2.6 ITF-14] and [6.1.10.7 DPD Code] for those symbologies. @@ -1258,7 +1260,7 @@ Latin-2 (ISO/IEC 8859-2 plus ASCII). Symbology Default character sets Alternate if input not Latin-1 ------------- ------------------------ ------------------------------ Aztec Code Latin-1 None -Codablock-F Latin-1 None +Codablock F Latin-1 None Code 128 Latin-1 None Code 16K Latin-1 None Code One Latin-1 None @@ -1290,7 +1292,7 @@ GS1 data can be encoded in a number of symbologies - see [4.11.3 GS1 Data Entry and Options]. Health Industry Barcode (HIBC) data may be encoded in the symbologies Aztec -Code, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR +Code, Codablock F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR Code. Within this mode, the leading `'+'` and the check character are automatically added by Zint, conforming to HIBC Labeler Identification Code (HIBC LIC). For HIBC Provider Applications Standard (HIBC PAS), preface the data @@ -1769,6 +1771,9 @@ values if asked to output to a text file (`"*.txt"`) or if given the option `--filetype=txt` or the option `--dump`. This can be used for test and diagnostic purposes. +Also there's the `--verbose` option which will output debug information to +`stdout`. + Additional options are available which are specific to certain symbologies. These may, for example, control the amount of error correction data or the size of the symbol. These options are discussed in section [6. Types of Symbology] of @@ -2479,10 +2484,10 @@ Table: API `output_options` Values {#tbl:api_output_options} [^15]: The `BARCODE_BIND_TOP` flag is set by default for DPD - see [6.1.10.7 DPD Code]. -[^16]: The `BARCODE_BIND` flag is always set for Codablock-F, Code 16K and Code +[^16]: The `BARCODE_BIND` flag is always set for Codablock F, Code 16K and Code 49. Special considerations apply to ITF-14 - see [6.1.2.6 ITF-14]. -[^17]: Codablock-F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, +[^17]: Codablock F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, ITF-14, UPC-A and UPC-E have compliant quiet zones added by default. ## 5.11 Setting the Input Mode @@ -2719,7 +2724,7 @@ if (ZBarcode_BarcodeName(BARCODE_PDF417, name) == 0) { } ``` -will print `BARCODE_PDF417`. +will print "BARCODE_PDF417". ## 5.15 Checking Symbology Capabilities @@ -2896,6 +2901,12 @@ int ZBarcode_Version(void); The version parts are separated by hundreds. For instance, version `"2.9.1"` is returned as `"20901"`. +## 5.19 Debug Info + +Debugging information can be output to `stdout` by setting the `debug` member to +`ZINT_DEBUG_PRINT` (`1`). Other values are used internally by the test suite and +shouldn't be set. + # 6. Types of Symbology @@ -3733,7 +3744,7 @@ A more sophisticated method is to use some type of line indexing which indicates to the barcode reader which order the stacked symbols should be read in. This is demonstrated by the symbologies below. -### 6.2.2 Codablock-F +### 6.2.2 Codablock F This is a stacked symbology based on Code 128 which can encode Latin-1 data up to a maximum length of 2726 symbol characters, meaning for instance up to 2726 @@ -3743,10 +3754,10 @@ all ASCII characters, or 5452 all numeric, or up to 1363 all extended ASCII ![`zint -b CODABLOCKF -d "CODABLOCK F Symbology" --rows=3`](images/codablockf.svg){.lin} -The width of the Codablock-F symbol can be set using the `--cols` option (API +The width of the Codablock F symbol can be set using the `--cols` option (API `option_2`), to a value between 9 and 67. The height (number of rows) can be set using the `--rows` option (API `option_1`), with a maximum of 44. Zint does not -currently support encoding of GS1 data in Codablock-F symbols. +currently support encoding of GS1 data in Codablock F symbols. A separate symbology ID (`BARCODE_HIBC_BLOCKF`) can be used to encode Health Industry Barcode (HIBC) data which adds a leading `'+'` character and a @@ -5200,7 +5211,7 @@ international standards: (BC412) (1996) - ANSI/AIM BC12-1998 - Uniform Symbology Specification Channel Code - BS EN 798:1996 Bar coding - Symbology specifications - 'Codabar' -- AIM Europe ISS-X-24 - Uniform Symbology Specification Codablock-F (1995) +- AIM Europe ISS-X-24 - Uniform Symbology Specification Codablock F (1995) - ISO/IEC 15417:2007 Information technology - Automatic identification and data capture techniques - Code 128 bar code symbology specification - BS EN 12323:2005 AIDC technologies - Symbology specifications - Code 16K diff --git a/docs/manual.txt b/docs/manual.txt index 130c9c13..b2e18b19 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -78,6 +78,7 @@ March 2026 - 5.16 Feedback - 5.17 UTF-8 to ECI convenience functions - 5.18 Zint Version + - 5.19 Debug Info - 6. Types of Symbology - 6.1 One-Dimensional Symbols - 6.1.1 Code 11 @@ -133,7 +134,7 @@ March 2026 - 6.1.14 BC412 (SEMI T1-95) - 6.2 Stacked Symbologies - 6.2.1 Basic Symbol Stacking - - 6.2.2 Codablock-F + - 6.2.2 Codablock F - 6.2.3 Code 16K (EN 12323) - 6.2.4 PDF417 (ISO 15438) - 6.2.5 Compact PDF417 (ISO 15438) @@ -922,7 +923,7 @@ underscores are optional. 73 BARCODE_VIN Vehicle Identification Number - 74 BARCODE_CODABLOCKF Codablock-F + 74 BARCODE_CODABLOCKF Codablock F 75 BARCODE_NVE18 NVE-18 (SSCC-18) @@ -970,7 +971,7 @@ underscores are optional. 108 BARCODE_HIBC_MICPDF HIBC MicroPDF417 - 110 BARCODE_HIBC_BLOCKF HIBC Codablock-F + 110 BARCODE_HIBC_BLOCKF HIBC Codablock F 112 BARCODE_HIBC_AZTEC HIBC Aztec Code @@ -1063,7 +1064,7 @@ given: Warning 247: Height not compliant with standards Another switch is --heightperrow, which can be useful for symbologies that have -a variable number of linear rows, namely Codablock-F, Code 16K, Code 49, GS1 +a variable number of linear rows, namely Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked, MicroPDF417 and PDF417, as it changes the treatment of the height value from overall height to per-row height, allowing you to specify a consistent height for each linear row without having to know how many there @@ -1102,7 +1103,7 @@ A --quietzones option is also available which adds quiet zones compliant with the symbology’s specification. This is in addition to any whitespace specified with the --whitesp or --vwhitesp switches. -Note that Codablock-F, Code 16K, Code 49, ITF-14, EAN-13, EAN-8, EAN/UPC +Note that Codablock F, Code 16K, Code 49, ITF-14, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, UPC-A and UPC-E have compliant quiet zones added by default. This can be disabled with the option --noquietzones. @@ -1133,7 +1134,7 @@ whitespace. [zint -b QRCODE --border=1 --box -d "This Text" --quietzones] -Codablock-F, Code 16K and Code 49 always have boundary bars, and default to +Codablock F, Code 16K and Code 49 always have boundary bars, and default to particular horizontal whitespace values. Special considerations apply to ITF-14 and DPD - see 6.1.2.6 ITF-14 and 6.1.10.7 DPD Code for those symbologies. @@ -1342,7 +1343,7 @@ Latin-2 (ISO/IEC 8859-2 plus ASCII). Symbology Default character sets Alternate if input not Latin-1 --------------- -------------------------- -------------------------------- Aztec Code Latin-1 None - Codablock-F Latin-1 None + Codablock F Latin-1 None Code 128 Latin-1 None Code 16K Latin-1 None Code One Latin-1 None @@ -1371,7 +1372,7 @@ GS1 data can be encoded in a number of symbologies - see 4.11.3 GS1 Data Entry and Options. Health Industry Barcode (HIBC) data may be encoded in the symbologies Aztec -Code, Codablock-F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR +Code, Codablock F, Code 128, Code 39, Data Matrix, MicroPDF417, PDF417 and QR Code. Within this mode, the leading '+' and the check character are automatically added by Zint, conforming to HIBC Labeler Identification Code (HIBC LIC). For HIBC Provider Applications Standard (HIBC PAS), preface the data @@ -1791,6 +1792,8 @@ values if asked to output to a text file ("*.txt") or if given the option --filetype=txt or the option --dump. This can be used for test and diagnostic purposes. +Also there’s the --verbose option which will output debug information to stdout. + Additional options are available which are specific to certain symbologies. These may, for example, control the amount of error correction data or the size of the symbol. These options are discussed in section 6. Types of Symbology of @@ -2653,7 +2656,7 @@ success. For instance: printf("%s\n", name); } -will print BARCODE_PDF417. +will print “BARCODE_PDF417”. 5.15 Checking Symbology Capabilities @@ -2802,6 +2805,12 @@ Lastly, the version of the Zint library linked to is returned by: The version parts are separated by hundreds. For instance, version "2.9.1" is returned as "20901". +5.19 Debug Info + +Debugging information can be output to stdout by setting the debug member to +ZINT_DEBUG_PRINT (1). Other values are used internally by the test suite and +shouldn’t be set. + 6. Types of Symbology 6.1 One-Dimensional Symbols @@ -3566,7 +3575,7 @@ A more sophisticated method is to use some type of line indexing which indicates to the barcode reader which order the stacked symbols should be read in. This is demonstrated by the symbologies below. -6.2.2 Codablock-F +6.2.2 Codablock F This is a stacked symbology based on Code 128 which can encode Latin-1 data up to a maximum length of 2726 symbol characters, meaning for instance up to 2726 @@ -3575,10 +3584,10 @@ all ASCII characters, or 5452 all numeric, or up to 1363 all extended ASCII [zint -b CODABLOCKF -d "CODABLOCK F Symbology" --rows=3] -The width of the Codablock-F symbol can be set using the --cols option (API +The width of the Codablock F symbol can be set using the --cols option (API option_2), to a value between 9 and 67. The height (number of rows) can be set using the --rows option (API option_1), with a maximum of 44. Zint does not -currently support encoding of GS1 data in Codablock-F symbols. +currently support encoding of GS1 data in Codablock F symbols. A separate symbology ID (BARCODE_HIBC_BLOCKF) can be used to encode Health Industry Barcode (HIBC) data which adds a leading '+' character and a modulo-49 @@ -4976,7 +4985,7 @@ international standards: (BC412) (1996) - ANSI/AIM BC12-1998 - Uniform Symbology Specification Channel Code - BS EN 798:1996 Bar coding - Symbology specifications - ‘Codabar’ -- AIM Europe ISS-X-24 - Uniform Symbology Specification Codablock-F (1995) +- AIM Europe ISS-X-24 - Uniform Symbology Specification Codablock F (1995) - ISO/IEC 15417:2007 Information technology - Automatic identification and data capture techniques - Code 128 bar code symbology specification - BS EN 12323:2005 AIDC technologies - Symbology specifications - Code 16K @@ -5291,9 +5300,9 @@ OPTIONS --cols=INTEGER - Set the number of data columns in the symbol to INTEGER. Affects - Codablock-F, DotCode, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), - MicroPDF417 and PDF417 symbols. + Set the number of data columns in the symbol to INTEGER. Affects Codablock + F, DotCode, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and + PDF417 symbols. --compliantheight @@ -5466,7 +5475,7 @@ OPTIONS --heightperrow - Treat height as per-row. Affects Codablock-F, Code 16K, Code 49, GS1 DataBar + Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417. -i, --input=FILE @@ -5554,7 +5563,7 @@ OPTIONS --rows=INTEGER - Set the number of rows for Codablock-F or PDF417 to INTEGER. It will also + Set the number of rows for Codablock F or PDF417 to INTEGER. It will also set the minimum number of rows for Code 16K or Code 49, and the maximum number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK). @@ -5643,6 +5652,10 @@ OPTIONS is in X-dimensions, and may be floating-point. Maximum is 10 and minimum is -5. The default is 1. +--verbose + + Output debug information to stdout. + --vers=INTEGER Set the symbol version (size, check digits, other options) to INTEGER. The @@ -5981,10 +5994,10 @@ height). [15] The BARCODE_BIND_TOP flag is set by default for DPD - see 6.1.10.7 DPD Code. -[16] The BARCODE_BIND flag is always set for Codablock-F, Code 16K and Code 49. +[16] The BARCODE_BIND flag is always set for Codablock F, Code 16K and Code 49. Special considerations apply to ITF-14 - see 6.1.2.6 ITF-14. -[17] Codablock-F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, +[17] Codablock F, Code 16K, Code 49, EAN-13, EAN-8, EAN/UPC add-ons, ISBN, ITF-14, UPC-A and UPC-E have compliant quiet zones added by default. [18] ZINT_CAP_EANUPC was previously named ZINT_CAP_EXTENDABLE, which is still diff --git a/docs/zint-qt.1 b/docs/zint-qt.1 new file mode 100644 index 00000000..cfeaec01 --- /dev/null +++ b/docs/zint-qt.1 @@ -0,0 +1,50 @@ +.\" Automatically generated by Pandoc 3.9 +.\" +.TH "ZINT\-QT" "1" "March 2026" "Version 2.16.0.9" +.SH NAME +\f[CR]zint\-qt\f[R] \- Zint Barcode Studio, a Qt frontend to the Zint +Barcode Generator +.SH SYNOPSIS +.PP +\f[CR]zint\-qt\f[R] [\f[CR]\-\-verbose\f[R]] +.SH DESCRIPTION +zint\-qt encodes input data in a barcode which can then be saved to an +image file or to the clipboard. +.PP +Input data is UTF\-8, unless the \(lqBinary Mode\(rq checkbox is +checked. +.PP +Output may be in one of these formats: Windows Bitmap (\f[CR]BMP\f[R]), +Enhanced Metafile Format (\f[CR]EMF\f[R]), Encapsulated PostScript +(\f[CR]EPS\f[R]), Graphics Interchange Format (\f[CR]GIF\f[R]), ZSoft +Paintbrush (\f[CR]PCX\f[R]), Portable Network Format (\f[CR]PNG\f[R]), +Scalable Vector Graphic (\f[CR]SVG\f[R]), or Tagged Image File Format +(\f[CR]TIF\f[R]). +.SH OPTIONS +.TP +\f[CR]\-\-verbose\f[R] +Output debug information to stdout. +.SH EXIT STATUS +\f[CR]0\f[R] +.SH BUGS +Please send bug reports to https://sourceforge.net/p/zint/tickets/. +.SH SEE ALSO +Documentation for \f[CR]zint\-qt\f[R] (and the API \f[CR]libzint\f[R] +and the CLI \f[CR]zint\f[R]) is available from +.IP +.EX + https://zint.org.uk/manual/ +.EE +.PP +and at +.IP +.EX + https://sourceforge.net/p/zint/docs/manual.txt +.EE +.SH COPYRIGHT +Copyright © 2026 Robin Stuart. +Released under GNU GPL 3.0 or later. +.SH AUTHOR +Robin Stuart \c +.MT robin@zint.org.uk +.ME \c diff --git a/docs/zint-qt.1.pmd b/docs/zint-qt.1.pmd new file mode 100644 index 00000000..68d16dd7 --- /dev/null +++ b/docs/zint-qt.1.pmd @@ -0,0 +1,55 @@ +% ZINT-QT(1) Version 2.16.0.9 +% +% March 2026 + +[//]: # ( vim: set ts=4 sw=4 et : ) + +# NAME + +`zint-qt` - Zint Barcode Studio, a Qt frontend to the Zint Barcode Generator + +# SYNOPSIS + +| `zint-qt` [`--verbose`] + +# DESCRIPTION + +zint-qt encodes input data in a barcode which can then be saved to an image file or to the clipboard. + +Input data is UTF-8, unless the "Binary Mode" checkbox is checked. + +Output may be in one of these formats: Windows Bitmap (`BMP`), Enhanced Metafile Format (`EMF`), Encapsulated +PostScript (`EPS`), Graphics Interchange Format (`GIF`), ZSoft Paintbrush (`PCX`), Portable Network Format (`PNG`), +Scalable Vector Graphic (`SVG`), or Tagged Image File Format (`TIF`). + +# OPTIONS + +`--verbose` + +: Output debug information to stdout. + +# EXIT STATUS + +`0` + +# BUGS + +Please send bug reports to https://sourceforge.net/p/zint/tickets/. + +# SEE ALSO + +Documentation for `zint-qt` (and the API `libzint` and the CLI `zint`) is available from + + https://zint.org.uk/manual/ + +and at + + https://sourceforge.net/p/zint/docs/manual.txt + +# COPYRIGHT + +Copyright © 2026 Robin Stuart. Released under GNU GPL 3.0 or later. + +# AUTHOR + +Robin Stuart diff --git a/docs/zint.1 b/docs/zint.1 index d11bb994..208296d1 100644 --- a/docs/zint.1 +++ b/docs/zint.1 @@ -103,7 +103,7 @@ Use the CMYK colour space when outputting to Encapsulated PostScript .TP \f[CR]\-\-cols=INTEGER\f[R] Set the number of data columns in the symbol to \f[I]INTEGER\f[R]. -Affects Codablock\-F, DotCode, GS1 DataBar Expanded Stacked +Affects Codablock F, DotCode, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417 symbols. .TP \f[CR]\-\-compliantheight\f[R] @@ -283,7 +283,7 @@ Set the height of the symbol in X\-dimensions. .TP \f[CR]\-\-heightperrow\f[R] Treat height as per\-row. -Affects Codablock\-F, Code 16K, Code 49, GS1 DataBar Expanded Stacked +Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417. .TP \f[CR]\-i\f[R], \f[CR]\-\-input=FILE\f[R] @@ -374,7 +374,7 @@ Rotate the symbol by \f[I]INTEGER\f[R] degrees, where \f[I]INTEGER\f[R] can be 0, 90, 270 or 360. .TP \f[CR]\-\-rows=INTEGER\f[R] -Set the number of rows for Codablock\-F or PDF417 to \f[I]INTEGER\f[R]. +Set the number of rows for Codablock F or PDF417 to \f[I]INTEGER\f[R]. It will also set the minimum number of rows for Code 16K or Code 49, and the maximum number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK). @@ -477,6 +477,9 @@ Adjust the gap between the barcode and the Human Readable Text (HRT). Maximum is 10 and minimum is \-5. The default is 1. .TP +\f[CR]\-\-verbose\f[R] +Output debug information to stdout. +.TP \f[CR]\-\-vers=INTEGER\f[R] Set the symbol version (size, check digits, other options) to \f[I]INTEGER\f[R]. diff --git a/docs/zint.1.pmd b/docs/zint.1.pmd index 1d31a52d..ce1c884a 100644 --- a/docs/zint.1.pmd +++ b/docs/zint.1.pmd @@ -2,6 +2,8 @@ % % March 2026 +[//]: # ( vim: set ts=4 sw=4 et : ) + # NAME `zint` - encode data as a barcode image @@ -93,7 +95,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S `--cols=INTEGER` -: Set the number of data columns in the symbol to *INTEGER*. Affects Codablock-F, DotCode, GS1 DataBar Expanded +: Set the number of data columns in the symbol to *INTEGER*. Affects Codablock F, DotCode, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417 symbols. `--compliantheight` @@ -250,7 +252,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S `--heightperrow` -: Treat height as per-row. Affects Codablock-F, Code 16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), +: Treat height as per-row. Affects Codablock F, Code 16K, Code 49, GS1 DataBar Expanded Stacked (DBAR_EXPSTK), MicroPDF417 and PDF417. `-i`, `--input=FILE` @@ -332,7 +334,7 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S `--rows=INTEGER` -: Set the number of rows for Codablock-F or PDF417 to *INTEGER*. It will also set the minimum number of rows for +: Set the number of rows for Codablock F or PDF417 to *INTEGER*. It will also set the minimum number of rows for Code 16K or Code 49, and the maximum number of rows for GS1 DataBar Expanded Stacked (DBAR_EXPSTK). `--scale=NUMBER` @@ -409,6 +411,10 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S : Adjust the gap between the barcode and the Human Readable Text (HRT). *NUMBER* is in X-dimensions, and may be floating-point. Maximum is 10 and minimum is -5. The default is 1. +`--verbose` + +: Output debug information to stdout. + `--vers=INTEGER` : Set the symbol version (size, check digits, other options) to *INTEGER*. The meaning is symbol-specific. diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt index e04ae088..9dd3fe40 100644 --- a/frontend/CMakeLists.txt +++ b/frontend/CMakeLists.txt @@ -24,8 +24,10 @@ if(NOT HAVE_GETOPT_LONG_ONLY) target_link_libraries(${PROJECT_NAME} zint_bundled_getopt) endif() -get_property(libdir GLOBAL PROPERTY ZINT_LIBDIR) -set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${libdir}") +if(APPLE AND NOT CMAKE_INSTALL_RPATH) + get_property(libdir GLOBAL PROPERTY ZINT_LIBDIR) + set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${libdir}") +endif() install(TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_BINDIR}" RUNTIME) if(UNIX) diff --git a/frontend/main.c b/frontend/main.c index 86187751..5cb9ba00 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -106,7 +106,7 @@ static void types(void) { "28 FLAT Flattermarken 104 HIBC_QR HIBC QR Code\n" "29 DBAR_OMN GS1 DataBar Omni 106 HIBC_PDF HIBC PDF417\n" "30 DBAR_LTD GS1 DataBar Limited 108 HIBC_MICPDF HIBC MicroPDF417\n" - "31 DBAR_EXP GS1 DataBar Expanded 110 HIBC_BLOCKF HIBC Codablock-F\n", stdout); + "31 DBAR_EXP GS1 DataBar Expanded 110 HIBC_BLOCKF HIBC Codablock F\n", stdout); fputs("32 TELEPEN Telepen Alpha 112 HIBC_AZTEC HIBC Aztec Code\n" "34 UPCA UPC-A 115 DOTCODE DotCode\n" "35 UPCA_CHK UPC-A + Check Digit 116 HANXIN Han Xin Code\n" @@ -134,7 +134,7 @@ static void types(void) { "71 DATAMATRIX Data Matrix 147 DXFILMEDGE DX Film Edge Barcode\n", stdout); fputs("72 EAN14 EAN-14 (GS1-128 based) 148 EAN8_CC Composite EAN-8\n" "73 VIN Vehicle Information No. 149 EAN13_CC Composite EAN-13\n" - "74 CODABLOCKF Codablock-F\n", stdout); + "74 CODABLOCKF Codablock F\n", stdout); } /* Output version information */ @@ -224,7 +224,7 @@ if (have_gs1syntaxengine) { " --quietzones Add compliant quiet zones\n" " -r, --reverse Reverse colours (white on black)\n" " --rotate=INTEGER Rotate symbol by INTEGER (0, 90, 180, 270) degrees\n" - " --rows=INTEGER Set number of rows (Codablock-F/PDF417)\n", stdout); + " --rows=INTEGER Set number of rows (Codablock F/PDF417)\n", stdout); fputs( " --scale=NUMBER Adjust size of X-dimension\n" " --scalexdimdp=X[,R] Adjust size to X-dimension X at resolution R\n" " --scmvv=INTEGER Prefix SCM with \"[)>\\R01\\Gvv\" (vv is INTEGER) (MaxiCode)\n" @@ -236,11 +236,12 @@ if (have_gs1syntaxengine) { " --structapp=I,C[,ID] Set Structured Append info (I index, C count)\n" " -t, --types Display table of barcode types\n", stdout); fputs( " --textgap=NUMBER Adjust gap between barcode and HRT in multiples of X-dim\n" + " --verbose Output debug info to stdout\n" " --vers=INTEGER Set symbol version (size, check digits, other options)\n" " -v, --version Display Zint version\n" - " --vwhitesp=INTEGER Set height of vertical whitespace in multiples of X-dim\n" - " -w, --whitesp=INTEGER Set width of horizontal whitespace in multiples of X-dim\n", stdout); - fputs( " --werror Convert all warnings into errors\n", stdout); + " --vwhitesp=INTEGER Set height of vertical whitespace in multiples of X-dim\n", stdout); + fputs( " -w, --whitesp=INTEGER Set width of horizontal whitespace in multiples of X-dim\n" + " --werror Convert all warnings into errors\n", stdout); } /* Display supported ECI codes */ @@ -1255,6 +1256,7 @@ static void win_free_args(void) { * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ static WCHAR **win_CommandLineToArgvW(const WCHAR *cmdline, int *numargs) { int qcount, bcount; const WCHAR *s; @@ -1640,7 +1642,7 @@ int main(int argc, char **argv) { #endif {"textgap", 1, NULL, OPT_TEXTGAP}, {"types", 0, NULL, 't'}, - {"verbose", 0, NULL, OPT_VERBOSE}, /* Currently undocumented, output some debug info */ + {"verbose", 0, NULL, OPT_VERBOSE}, {"vers", 1, NULL, OPT_VERS}, {"version", 0, NULL, 'v'}, {"vwhitesp", 1, NULL, OPT_VWHITESP}, diff --git a/frontend/test.sh b/frontend/test.sh index 4b5c4aad..7a190457 100755 --- a/frontend/test.sh +++ b/frontend/test.sh @@ -239,10 +239,10 @@ echo testing EAN-14 zint -o bar72.txt -b 72 -d 3210987654321 zint -o bar72.gif -b 72 --height=50 --border=10 -d 3210987654321 zint -o bar72.svg -b 72 --height=50 --border=10 -d 3210987654321 -echo testing Codablock-F -zint -o bar74.txt -b 74 -d "Demonstration Codablock-F symbol generated by libzint" -zint -o bar74.gif -b 74 -d "Demonstration Codablock-F symbol generated by libzint" -zint -o bar74.svg -b 74 -d "Demonstration Codablock-F symbol generated by libzint" +echo testing Codablock F +zint -o bar74.txt -b 74 -d "Demonstration Codablock F symbol generated by libzint" +zint -o bar74.gif -b 74 -d "Demonstration Codablock F symbol generated by libzint" +zint -o bar74.svg -b 74 -d "Demonstration Codablock F symbol generated by libzint" echo testing NVE-18 zint -o bar75.txt -b 75 -d 76543210987654321 zint -o bar75.gif -b 75 --height=50 --border=10 -d 76543210987654321 diff --git a/frontend_qt/CMakeLists.txt b/frontend_qt/CMakeLists.txt index a6fd902c..f8693103 100644 --- a/frontend_qt/CMakeLists.txt +++ b/frontend_qt/CMakeLists.txt @@ -52,7 +52,12 @@ target_link_libraries(${PROJECT_NAME} QZint Qt${QT_VERSION_MAJOR}::UiTools Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::Core) -get_property(libdir GLOBAL PROPERTY ZINT_LIBDIR) -set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${libdir}") +if(APPLE AND NOT CMAKE_INSTALL_RPATH) + get_property(libdir GLOBAL PROPERTY ZINT_LIBDIR) + set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${libdir}") +endif() install(TARGETS ${PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_BINDIR}" RUNTIME) +if(UNIX) + install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/../docs/zint-qt.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1" COMPONENT doc) +endif() diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index c1424a3b..ed357e86 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -127,7 +127,7 @@ static const struct bstyle_item bstyle_items[] = { { QSL("Brazilian Postal Code (CEPNet)"), BARCODE_CEPNET }, { QSL("Channel Code"), BARCODE_CHANNEL }, { QSL("Codabar (EN 798)"), BARCODE_CODABAR }, - { QSL("Codablock-F (and HIBC)"), BARCODE_CODABLOCKF }, + { QSL("Codablock F (and HIBC)"), BARCODE_CODABLOCKF }, { QSL("Code 11"), BARCODE_CODE11 }, { QSL("Code 128 (ISO 15417) (and GS1-128 and HIBC)"), BARCODE_CODE128 }, { QSL("Code 16K (EN 12323)"), BARCODE_CODE16K }, @@ -236,7 +236,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl) m_btnHeightPerRowDisable(nullptr), m_btnHeightPerRowDefault(nullptr), m_scaleWindow(nullptr) { - // Undocumented command line debug flag + // Command line debug flag m_bc.bc.setDebug(QCoreApplication::arguments().contains(QSL("--verbose"))); QCoreApplication::setOrganizationName(QSL("zint")); @@ -817,7 +817,7 @@ void MainWindow::about() "

      A free barcode generator

      " "

      Instruction manual is available at the project homepage:
      " "https://www.zint.org.uk.

      " - "

      Copyright © 2006-2025 Robin Stuart and others.
      " + "

      Copyright © 2006-2026 Robin Stuart and others.
      " "Qt backend by BogDan Vatra.
      " "Released under GNU GPL 3.0 or later.

      " "

      Qt version %2. Qt settings:
      %3

      " @@ -1960,7 +1960,7 @@ void MainWindow::change_options() m_optionWidget = uiload.load(&file); file.close(); load_sub_settings(settings, symbology); - tabMain->insertTab(1, m_optionWidget, tr("Codablock&-F")); + tabMain->insertTab(1, m_optionWidget, tr("Cod&ablock F")); btype->setItemText(0, tr("Default (bind)")); connect(get_widget(QSL("cmbCbfWidth")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); connect(get_widget(QSL("cmbCbfHeight")), SIGNAL(currentIndexChanged(int)), SLOT(update_preview())); diff --git a/frontend_qt/res/LICENSE_feathericons b/frontend_qt/res/LICENSE_feathericons index c2f512f4..06487d5d 100644 --- a/frontend_qt/res/LICENSE_feathericons +++ b/frontend_qt/res/LICENSE_feathericons @@ -19,3 +19,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +SPDX-License-Identifier: MIT diff --git a/frontend_qt/res/LICENSE_lucide b/frontend_qt/res/LICENSE_lucide index 325e8ff0..7f14a48f 100644 --- a/frontend_qt/res/LICENSE_lucide +++ b/frontend_qt/res/LICENSE_lucide @@ -13,3 +13,5 @@ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +SPDX-License-Identifier: ISC