Commit graph

132 commits

Author SHA1 Message Date
gitlost
fe56c030b0 QRCODE: refactor last commit to separate out GS1 branch in
`qr_in_alpha()`
2023-12-05 22:47:46 +00:00
gitlost
885cf0610d QRCODE: fix qr_in_alpha() uneven percent check to be gs1 only,
causing incorrect mode costings leading to version 40 `binlen`
  < lower version, triggering assert, ticket #300 (#15), props
  Andre Maute
2023-12-05 19:00:01 +00:00
gitlost
888db0bf00 QRCODE: fix out-of-bounds crash due to incorrect mode costings for
GS1 percents in `qr_in_alpha()`, ticket #300, props Andre Maute;
  also defensively re-calc version 40 mode to prevent possible
  further crashes
common: move `debug_print_escape()` from library to common
2023-11-30 09:12:11 +00:00
gitlost
323b34502b zint.h: increase symbol->text size 160 -> 200;
rename `ZINT_CAP_EXTENDABLE` -> `ZINT_CAP_EANUPC`
  (`ZINT_CAP_EXTENDABLE` marked as legacy)
CODE128: increase no. symbol chars max 60 -> 99
EAN-2/EAN-5: fix `BARCODE_BIND_TOP/BIND/BOX` output
GS1_128: warn if data > 48 (GS1 General Specifications max)
common: `is_extendable()` -> `is_ucpean()`
raster: add `ZFONT_HALIGN_CENTRE/LEFT/RIGHT` flags and process
  in `draw_string()` (for drawing EAN/UPC outside digits), and
  for `ZFONT_HALIGN_CENTRE` round when calculating centre
  (shifts some texts 1 pixel left)
raster/vector: use offsets into `symbol->text` for EAN/UPC
  instead of `out_upcean_split_text()` (removed)
BMP/EMF/GIF/PCX/PNG/PS/SVG/TIF: use new `out_colour_get_rgb()`
  routine (replaces `colour_to_XXX()`)
general: simplify/fix some `error_number` handling/returning
frontend: truncate overlong `--primary` instead of ignoring;
  negative floating pt option (for `--textgap`)
man page: list size detail for matrix symbols (`--vers`)
manual: further fiddling with scaling text; some typos
2023-11-19 19:39:54 +00:00
gitlost
32c9e6a98e Remove bitmap_byte_length member from zint_symbol
(was only set on BMP output to length of BMP pixel array)
EXCODE39: change to display check digit in HRT by default
CODE39/EXCODE39/LOGMARS: new hidden check digit option
  (`option_2 = 2`)
qr.c: suppress bogus gcc-13 warning (only appears on optimize)
GUI: move some symbology-specific options into Data Tab so
  separate tab unnecessary (those with few options and no
  Composite/ECI), namely: all C25XXX, CODE39/EXCODE39/LOGMARS,
  MSI_PLESSEY, CODABAR, DAFT, DPD, MAILMARK_2D, ITF-14, PZN,
  UPNQR, CHANNEL, CODE93 and VIN, adjusting grp uis.
  change Data dialog button (ellipsis) QToolButton -> QPushButton
  & vice versa zap/clear/eye/swap/scale buttons QPushButton ->
  QToolButton for better mac compat (also makes sense);
  remove some mac hacks that no longer seem necessary;
  use folder icon for Export dialog directory button
manual: document new Symbology-specific groupbox & CODE39/etc
  hidden check digit option; add annexes on Qt and Tcl backends;
  narrow some tables for better txt output;
  remove echoed image tags in txt (pandoc 3.1.5 regression?);
  add one-page HTML output to Makefile; also tex output (debug);
  add class attributes to images to aid HTML styling;
  various other fiddlings
2023-07-18 11:11:50 +01:00
gitlost
607e4ed33a EAN/UPC: add quiet zone indicators option (API output_options
`EANUPC_GUARD_WHITESPACE`, CLI `--guardwhitespace`) (ticket #287)
EAN-2/EAN-5: HRT now at top instead of at bottom for standalones,
  following BWIPP
CLI: batch mode: don't close input if stdin
EAN/UPC: fix excess 1X to right of add-ons
Composites: fix excess whitespace; fix quiet zone calcs to allow
  for linear shifting
CLI: use own (Wine) version of `CommandLineToArgvW()` to avoid
  loading "shell32.dll"
Move "font.h" -> "raster_font.h"
EPS/SVG: use new `out_putsf()` func to output floats, avoiding
  trailing zeroes & locale dependency
EPS: simplify "TR" formula
SVG: change font from "Helvetica, sans serif" to "OCR-B, monospace";
  use single "<path>" instead of multiple "<rect>"s to draw boxes
  (reduces file size)
Add `EMBED_VECTOR_FONT` to `output_options` (CLI `--embedfont`) to
  enable embedding of font in vector output - currently only for
  SVG output of EAN/UPC
GUI: use "OCR-B" font for EAN/UPC and "Arimo" for all others (was
  "Helvetica" for both); paint background of screen preview light
  grey so as contrasts with whitespace and quiet zones
EMF: prefix funcs with `emf_`; simplify string `halign` handling
large: rename `large_int` -> `large_uint`
CODE128/common: move `c128_hrt_cpy_iso8859_1()` to
  `hrt_cpy_iso8859_1()` and add `ZINT_WARN_HRT_TRUNCATED` warning
  (for future use)
Various symbologies: replace `printf()` with `fputs()`
  (symbol->debug)
QRCODE: better assert(), removing a NOLINT (2 left)
CLI: add some more barcode synonyms for DBAR
common: various fiddlings
CMake: don't include png.c unless ZINT_USE_PNG (avoids clang
  warning)
2023-06-12 01:25:55 +01:00
gitlost
268fdd7fc2 - BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT: check for errors on writing
to output file; ZBarcode_Encode_File: check `fseek()` for errors
  (ticket #275)
- man page: fix Code 11 check digit info
- manual/man page: document octal escape; Code 128 subset/mode ->
  Code Set
2022-12-19 16:28:15 +00:00
gitlost
ad1b091ed1 QROCDE/UPNQR: add FAST_MODE (try 4 not 8 masks automatically) 2022-12-05 10:11:36 +00:00
gitlost
c8033695d9 - API: add new zint_symbol dpmm field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
  with new option `--scalexdimdp` for CLI/Tcl & new API function
  `ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
  & `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
  following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
  `noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
  incl. new `QZintXdimDp` struct for passing around scale vars &
  use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
  output path using new function `out_fopen()` and use in BMP/EMF/
  EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
  documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
  re-loading settings without doing a sync no longer works);
  fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
  various default buttons; use new `takesGS1AIData()` to
  enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
  significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
  ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
  supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
  excludes
2022-12-02 21:39:01 +00:00
gitlost
2f8681b21a - API/CLI/Tcl/GUI: new output option BARCODE_BIND_TOP/--bindtop/
`-bindtop`/"Bind Top"
- DPD: add top boundary (width 3X) by default, using new
  BARCODE_BIND_TOP; "relabel" option; some compliance checks
- GUI: only skip encoded/errored signal processing if active modal
  ExportDialog (wasn't clearing/setting error text bar correctly
  for DataDialog)
- CODE128: debug print checksum
- CODE49/DATAMATRIX/QR/ULTRA: fix uniqueness of errtxt nos
- manual: fuller DPD doc; some spelling typos, formatting
2022-11-10 22:13:41 +00:00
gitlost
92a4a25ed2 - DOTCODE, QRCODE, RMQR: return warning if ECI or Structured Append used in
GS1 mode, ticket #271
- CLI: improve `getopt_long_only()` processing, printing own message if bad
  arg and returning error if so rather than continuing to process
- manual: MSE typo -> MSI, a few other changes; adjust SVG scaling for PDF
  manual; pandoc 2.19.2
2022-09-28 21:58:57 +01:00
gitlost
930f458979 backend: define z_alloca() and use for both Unix and Windows;
replace double-slash comments with old-skool slash asterisk ones;
  define uint16_t etc for Windows ourselves and remove ms_stdint.h &
  stdint_msvc.h as no longer used;
  (backend (excepting test suite) now C89 compatible)
LICENSE: move from backend to root and move COPYING to frontend, with
  copies in frontend_qt & backend_qt, so in where it applies;
  add LICENSE section from manual to root README
2022-07-14 16:01:30 +01:00
gitlost
0b3fe8db93 GUI: remove sizeConstraint so squashable again (sigh)
- make Sequence Format textbox bigger (on own line)
  - suppress question mark in Windows dialogs
AUSPOST: more standard error messages
backend: add & use z_isdigit/upper/lower() macros
docs: 20-bit Unicode -> 21-bit Unicode
2022-06-24 14:38:48 +01:00
gitlost
15b8024712 - library: check symbol->primary for escape sequences also
- GUI: error message GS1_MODE -> GS1 mode
- GUI: sequence window: fix initial clear button status
- GUI: make acceptable for macOS; add iconset for macOS, install
- manual: update macOS Homebrew install info; add README.macos
- GUI: export window: add no. of sequences to results label
2022-06-16 16:47:34 +01:00
gitlost
ab3cf4f395 eci.c: replace libiconv-adapted code with own implementations so
as to fully comply with BSD license (for why Library GPL 2+ not
  compatible see https://opensource.stackexchange.com/a/6701),
  ~3% slower (maybe), +~6K extra in data
  (gb18030.c, gb2313.c & sjis.c removed, mapping .TXT files moved
  to backend/tools/data & extra ones added, 2 new PHP generators)
GUI: CODE39/EXCODE39: show/hide HIBC check digit option in addition
  to enable/disable (less confusing)
CLI: batch: pedantic check for EOF using intChar in newline fgetc()
  loop
test_args.c: don't use WIFEXITED(), WEXITSTATUS() on Windows
manual: lessen some copy/paste verbiage by referring back, other
  small tweaks/typos
2022-06-02 20:32:25 +01:00
gitlost
719613d4c3 GRIDMATRIX: default char set is GB 2312 only, not Latin-1 with GB 2312 alt
HANXIN/QRCODE: use Hanzi/Kanji modes when compatible ECIs given
manual: one true source now manual.pmd from which manual.txt is generated
CLI: man page moved from frontend/zint.1.gz to docs/zint.1.gz, now
  generated from docs/zint.1.pmd
add README.linux to root dir
2022-05-19 10:17:51 +01:00
gitlost
9aae557cdc CLI/Tcl: fix version check (need <= 999 for DAFT permille)
UPNQR: fix required binary mode using mode_preset
UPNQR: allow mask to be manually specified
GUI: use non-native QColorDialog on Unix also; no noEXE for CLI equivalent;
  add shortcuts for copy-to-clipboard and CLI equivalent
CLI: new --version option to print Zint version
2022-05-12 20:35:06 +01:00
gitlost
f58c80e290 Add multiple segments support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, HANXIN, MAXICODE, MICROPDF417, PDF417, QRCODE, RMQR, ULTRA
RMQR: fix ECI encoding (wrong bit length for indicator)
MICROQR: check versions M1 and M2 for allowed characters so as to give
  better error messages
DOTCODE: some small optimizations
common.c: add is_chr(), segs_length(), segs_cpy()
CODEONE/CODE128/DOTCODE/GRIDMATRIX/HANXIN/MAXICODE/QRCODE/ULTRA: add
  namespace prefixes to static funcs/data
includes: use Z_ prefix, unuse double underscore prefixes (guard defines)
manual.txt: compress some tables using double/treble column sets
2022-05-09 19:50:50 +01:00
gitlost
624d40021e ECI: Update ECIs to AIM ITS/04-023:2022, adding UTF-16BE (was USC-2BE),
UTF-16LE, GBK, separate GB18030, UTF-32BE, UTF-32LE
  add examples to tests for DATAMATRIX, HANXIN, QRCODE
HANXIN: Remove alternating filler in function information;
  GB 18030 now ECI 32 (previously used ECI 29);
  fix gate-posts on codeword limits
  use new ZXing-C++ HanXin detector (diagnostics2 branch) for tests
  check against ISO/IEC 20830:2021 (no substantive changes)
backend_tcl: update ECIs; NOTE: changed names "unicode" -> "utf-16be",
  "euc-cn" -> "gb2312"
GRIDMATRIX/HANXIN/QRCODE/RMQR: warn if auto-conversion (i.e. no ECI given)
  occurs to resp. specialized char sets (GB 2312/GB 18030/Shift JIS)
2022-04-10 11:12:18 +01:00
gitlost
69876619dd clang-tidy-14: suppress some further warnings using asserts (removed remaining NOLINT) 2022-04-02 10:43:45 +01:00
gitlost
4e72a541f7 PDF417: fix cols/rows calculation to require multiple <= 928 codewords;
add specify rows option (option_3) (#204);
  warn if cols increased from specified (back-incompatible);
  move table definitions from "pdf417.h" to new "pdf417_tabs.h" and
  make INTERNAL_DATA and share with composite.c (saves ~10K);
  prefix routines and tables with "pdf_";
  some small performance improvements through if/elses, pdf_textprocess()
  & pdf_numbprocess() loop simplifications
MICROQR: fix debug access crash on printing non-NUL-terminating binary
DATAMATRIX: fix missing ++ from "[tp]" at C40/TEXT EOD processing of GS1
  (though probably never reached); use "[tp++]" throughout
Add const to static tables missing it and also to some variables
Change "debug" -> "debug_print" throughout
2021-10-30 22:00:31 +01:00
gitlost
fab7435fac Performance improvements for linear encoding and raster output
- use fixed-length string tables (mostly) instead of (char *) pointer ones
   (saves ~40K)
 - re-use C128Table for CODABLOCKF and CODE16K
   (required removal of Stop character and extra CODE16K-only entry)
 - use pointer to destination and copy (memcpy/strcpy(), bin_append_posn())
   instead of concatenating (strcat()) (mostly)
 - replace last remaining bin_append()s with bin_append_posn();
   bin_append() removed
 - add length arg to toupper() and expand() (avoids strlen())
 - change is_sane() to use table-based flags (avoids an iteration)
 - rename lookup() to is_sane_lookup() and change to check and return posns
   and use in pointer to destination loops (avoids strcat()s)
 - remove special case PHARMA in expand() (dealt with in pharma())
 - make #define SILVER/CALCIUM/TECHNETIUM/KRSET etc static strings
 - replace strchr() -> posn()
 - CODE128: populate destination once in checksum loop; re-use and export
   some more routines (c128_set_a/b/c(), c128_put_in_set()) for sharing;
   prefix defines (SHIFTA -> C128_SHIFTA etc) and existing exported routines
 - use factor XOR toggle trick in checksum calcs (avoids branch)
 - raster.c: fill out single 1-pixel row and copy using new draw_bar_line(),
   copy_bar_line() routines; similarly in buffer_plot compare previous line &
   copy if same (same technique as used to improve non-half-integer scaling,
   significant performance increase, (c) codemonkey82);
   also done for PNG (BMP/GIF/PCX/TIFF not done)
 - raster/vector/output.c: shorten "output_" prefix -> "out_";
   sync vector to other raster changes to try to keep source files similar
 - 2of5.c: prefix "c25_"
JAPANPOST: return error if input data truncated (backward incompatible)
DAFT: max chars 50 -> 100
common.c: istwodigit() -> is_twodigit()
common.c/emf.c/output.c: use some further stripf()s (MSVC6 float variations)
library.c: new check_output_args() helper
zint.h: add BARCODE_LAST marker and use in library.c
QRCODE: remove a NOLINT (requires clang-tidy-13), one remaining
CMake: separate no-optimize from ZINT_DEBUG into new ZINT_NOOPT option
2021-10-20 23:05:30 +01:00
gitlost
72eac41c34 Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility
Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
  static get_zint_version() method, use QStringLiteral (QSL shorthand),
  use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
  add saveAs shortcut, add main menu, context menus and actions, add help,
  reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
  lessen triggering of update_preview(), shorten names of getters/setters,
  simplify/shorten some update_preview() logic in switch,
  CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
2021-10-09 00:13:39 +01:00
gitlost
c0791ad85e Add Structured Append support for AZTEC, CODEONE, DATAMATRIX, DOTCODE,
GRIDMATRIX, MAXICODE, MICROPDF417, PDF417, QRCODE, ULTRA
DOTCODE: use pre-calculated generator poly coeffs in Reed-Solomon for
  performance improvement
PDF417/MICROPDF417: use common routine pdf417_initial()
GUI: code lines <= 118, shorthand widget_obj(),
  shorten calling upcean_addon_gap(), upcean_guard_descent()
various backend: var name debug -> debug_print
2021-09-28 21:42:44 +01:00
gitlost
b568201574 MICROQR: some debug output, test case for ticket #241 2021-08-26 17:49:05 +01:00
gitlost
3388f98c00 vector: Add width to struct zint_vector_circle & use for MaxiCode bullseye
**Incompatible change**
2021-08-22 13:59:01 +01:00
gitlost
67b2a9c99d RMQR: add ECI support; GUI/CLI: fix dev version test 2021-08-20 16:50:39 +01:00
gitlost
14d1140d09 CODABLOCKF: prevent cols > 62; fix pTestList buffer overflow
RMQR: update to new draft ISO/IEC JTC1/SC31N000 (Draft 2019-6-24);
  allow for righthand vertical timing pattern in populate_grid()
ULTRA: update max size and min cols based on BWIPP 2021-07-14 update
backend_tcl/zint_tcl.dsp: use /MD instead of /MT for tcl lib compat;
  change include/lib path to more standard one
manual.txt: highlight that rMQR is still in development
GUI: use cross-platform smaller font func instead of explicit values for notes
2021-08-10 12:04:25 +01:00
gitlost
b015e38da0 composite: fix buffer overflow for large linear, small composite (500 -> 1000)
composite: clear errtxt when bumping from CC-A -> CC-B -> CC-C
composite: CC-C adjustment 53 -> 52 (same as BWIPP) with proper explanation
composite: remove unneeded > 11805 length check
CODEONE: remove unneeded extended ASCII check in C40 count
GS1_128/CODE16K: remove unneeded initial GS1 mode '[' check
PDF417: remove unneeded second option_2 > 30 check
Document some "Not reached" lines (code coverage)
Update bwipp_dump.ps
GUI: window/tab height +5 so 2 full lines for composite edit box (Ubuntu)
manual: dash -> hyphen, PDF417 "check digit" -> "error correction", DMRE ref
tests: further test cases for CODEONE/CODE16K/common/composite/DATAMATRIX/
DOTCODE/gs1/MAXICODE/PDF417/postal/QRCODE
2021-08-05 16:34:45 +01:00
gitlost
3c1869b032 library: compat symbology 39 fix; ISBN: "X" check
WARN_FAIL_ALL: always return error: ZINT_ERROR_USES_ECI/NON_COMPLIANT
Fuller error messages; more comments zint.h
mainwindow.cpp: replace metaobject ENUM with array
  (suppresses virtual in constructor warning)
2021-07-06 19:53:31 +01:00
gitlost
4d3aae45d0 testcommon: fix sizeof bug; AZTEC/QR: suppress cppcheck warnings (#233) 2021-07-06 12:13:34 +01:00
gitlost
c693482aa1 Change height and row_height array to floats; DAFT tracker ratio 2021-06-19 13:11:23 +01:00
gitlost
4a8cac2a5a CODEONE/DATAMATRIX/MAILMARK/PLESSEY: fix some 32-bit/portability bugs
PLESSEY: add options NCR weighted mod-10, hide check digit(s) in HRT
test suite: now runnable under MSVC 2019, 2017, 2015, MinGW/MSYS
win32/README: update with MSVC 2019 and CMake instructions
2021-06-10 11:15:39 +01:00
gitlost
7fe930b4dc eci: Add support for all ECIs (Big5, Korean, UCS-2BE) 2021-01-11 18:11:41 +00:00
gitlost
fe70911ea3 QRCODE: fix dark mods count and percentage calc broken by [cd214a] 2020-12-10 19:48:52 +00:00
gitlost
cd214addba HANXIN: 0xFFE terminator; reedsol/AZTEC: stack-based; AZTEC/HANXIN/QR/GRIDMATRIX speedups; #209 2020-11-27 12:54:44 +00:00
gitlost
90012ab23f EANX_CC: allow for check digit + buffer overflow for too long add-on; GUI text colour; cmake 3.0 2020-10-05 23:22:06 +01:00
gitlost
36c19053d7 vector.c: string halign; POSTNET/PLANET: 1 module space; ZBarcode_Cap(); GUI settings 2020-09-30 12:19:12 +01:00
gitlost
52d08fd9b9 #191 clang-tidy reduce NOLINTs using asserts, remove DeadStores 2020-07-19 10:31:12 +01:00
gitlost
34d3319cc6 Windows: cast _allocas/mallocs, update DLL version, props Pierre Y. 2020-06-15 16:06:11 +01:00
gitlost
74beb5c50a QRCODE: #191 suppress clang-tidy warnings 2020-04-28 21:10:54 +01:00
gitlost
61cd413fe4 Full multibyte option_3 for QR, HANXIN, GRIDMATRIX 2020-04-02 14:41:13 +01:00
gitlost
22354a81f1 HANXIN fix wrong func call gb2312_utf8tosb() -> gb18030_utf8tosb() 2020-03-30 11:59:16 +01:00
gitlost
bca82ecc0d libzint.so: suppress exporting INTERNAL functions to the shared library; ZINT_TEST 2019-12-19 00:37:55 +00:00
gitlost
3209b32087 QR optimize encoding mode: remove extraneous newlines 2019-12-16 17:50:58 +00:00
gitlost
e331fd1e90 QR optimize encoding modes 2019-12-16 17:31:52 +00:00
Harald Oehlmann
34c33b45b5 Correct mistake of last commit: restore order of blocks 2019-12-05 19:36:00 +01:00
Harald Oehlmann
045a9e3b00 Make zint compile on MS-VC6. Adopt makefiles to new file list. 2019-12-05 19:19:37 +01:00
gitlost
b1f4a12c78 GRIDMATRIX codeword fixes, Project Nayuki optimized encoding modes 2019-12-04 13:45:01 +00:00
Robin Stuart
8295883987 Merge rMQR support in to master 2019-12-01 15:17:08 +00:00