Commit graph

103 commits

Author SHA1 Message Date
gitlost
b42d5baf4c gs1: New AIs 7041 (GSCN 23-272) (packagetype) and 716 (GSCN-24-157)
CODE49: Better error message on ZINT_ERROR_TOO_LONG
manual: Use floating pt notation for floating pt args on options
backend/tools/data: Remove overlooked "GB2312.TXT" from git
raster: `size2` -> `prev_size`; one line `malloc()`s
C25/CODE128: some code fiddling
tests/PNG: Add some more text examples
2024-09-18 03:40:45 +01:00
gitlost
93c3e27fba CODE128: Add minimal encodation algorithm (non-extended ASCII only)
from ZXing (props Alex Geller) - about 25-60% slower depending on
  data & stack heavy but does improve some outcomes when FNC1s
  present (GS1_MODE or manual) although not much else it appears
  (the previous algorithm was very good), but has a logical clarity
  the other lacked - funcs `c128_dxsmooth()` etc shared with
  CODE16K now moved there and renamed as `c16k_`;
  also fix extended char latching when exactly 4 extended chars
  at end
  also manual code set switching now honoured exactly even if
  immediate shift required;
manual: make explicit that AI "(00)" and "(01)" prefixes added by
  Zint are HRT-only
general: add `extern "C"` wrappers to a few header files
2024-09-07 12:44:16 +01:00
gitlost
10747d6385 CODE128: Add new extra escape \^1 for manual insertion of FNC1s,
ticket #324, props Jim Shank;
  also improve encodation for a few limited cases;
  also some code fiddling
BWIPP: update to latest
raster: check for overflow on `size + size2` in `raster_malloc()`
vector: put `malloc()`s on one line for grep ease
docs: pandoc-3.3, clang-tidy-20
2024-09-03 11:55:55 +01:00
gitlost
fb3b3001aa - GS1: fix square brackets treated as FNC1 in GS1PARENS_MODE by
changing internal FNC1 marker '[' -> '\x1D' (GS), ticket #319,
  props Moli Sojet;
  also fix non-AI square brackets -> round brackets in GS1_128 HRT
- BWIPP: update to latest
2024-07-11 00:35:13 +01:00
gitlost
f0d8901d9e QRCODE: check fopen() return in ZINTLOG debugging code
(ticket #181, props Stf Ortm)
CODE128: suppress gcc -Wmaybe-uninitialized false positive (Release
  only)
CLI: add "isbn" synonym; save a few bytes using `char[]` rather
  than `char *`
2024-02-27 13:36:13 +00:00
gitlost
f312cdf630 CODE128: simplify bitmask in qr_add_version_info() (ticket #110,
props Daniel Gredler);
  check for next shift rather than next in `c128_dxsmooth()` to
  improve encodation on A/B shifting, props Daniel Gredler (Okapi)
2024-02-10 16:08:18 +00:00
gitlost
cf04ac15b0 general: use explicit float consts rather than calced ones
manual: remove extra tags from "manual.txt" and clean up table
  captions
2024-01-09 18:38:21 +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
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
6f7cdd660c - Add special symbology-specific escape sequences (Code 128 only)
for manual Code Set switching via `input_mode` flag
  `EXTRA_ESCAPE_MODE` (CLI `--extraesc`) (ticket #204)
- GUI: disable "Reset" colour if default; add "Unset" to Printing
  Scale dialog (allows unsetting of X-dim/resolution settings
  without having to zap)
- library: guard against out-of-bounds rows (negative)
- test suite: fix some clang-tidy warnings; slight coverage
  improvements
2023-01-15 00:22:43 +00:00
gitlost
ab7da62a3a UPU_S10/GS1: properly expose iso3166_alpha2(); add UPU_S10 to tcl 2022-12-09 15:56:13 +00:00
gitlost
53769c6ed1 - Add new symbology BARCODE_UPU_S10
- PZN: allow check digit to be given; add space after hyphen in
  HRT; PZN7 option
- backend_qt: add `encodedHeight()` read-only
2022-12-09 14:51:26 +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
fbfaabf004 CODE128: use int for glyph_count 2022-10-14 15:05:33 +01:00
gitlost
ada19fc079 CODE128: allow for extended latching (double FNC4) spanning
intermediate CodeC sequence by setting `f_state` only if in
  CodeA/B & checking before adding extended mode switch (cf
  OkapiBarcode commit [9ce6dcc], props Daniel Gredler)
DATAMATRIX: in FAST_MODE re-process any buffered X12 characters
  when mode changes from X12 (cf OkapiBarcode commit [fb7981e],
  props Daniel Gredler)
CODABLOCKF: allow for FNC4 when estimating no. of rows required
CODE16K: make sure row calculation accurate by dispensing with
  glyph estimate & using actual codeword count
CODE16K: ensure initial mode selection allows for extended
  characters
vector.c: add `z_alloca()` cast for `first_row_rects` (ticket
  #272)
MSVC project files: remove incorrect "CompileACpp" setting from
  libzint project files (ticket #272)
bwipp_dump.ps: fix 2/4-track processing; update to latest BWIPP
manual/man page/GUI: Code 16k -> Code 16K
2022-10-13 13:33:59 +01:00
gitlost
c0a5c7b125 manual: Deutshe -> Deutsche (#266) 2022-08-05 23:51:24 +01:00
gitlost
78bda3b359 test suite: update to latest BWIPP (add dontlint, rebase patch file)
common.h: remove TRUE/FALSE (barely used)
test suite: gs1: proper val for longitude test; some comments // -> /*
2022-07-18 20:30:31 +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
e30e1f9651 RMQR: update to ISO/IEC 23941:2022 - R13x77 numeric cclens change 8 -> 7
QRCODE: use stricter interpretation of ZINT_FULL_MULTIBYTE, excluding
  certain trailing bytes
libzint: fix some confusing error messages introduced by segment stuff
general: new escape chars \U, \d and \o
backend_qt: fudge rendering of border rectangles due to scaling/translation
  rounding errors TODO: better fudge
GUI: foreground/background colours -> text boxes and icon buttons, add swap
  button, independently movable picker (NULL parent), preview colour changes,
  preview Data Window changes, add clear data (del) buttons, add zap button
  and Factory Reset menu option, various other fixes
libzint: remove STATIC_UNLESS_ZINT_TEST, use wrappers
CMake: add find package QtSvg, remove QtXml
manual: split symbology and general specs and sort, move DAFT to 4-state,
  UPC/EAN -> EAN/UPC, DataBar -> GS1 DataBar always, expand MAILMARK info,
  various other fiddlings
man page: options or -> |, expand MSI Plessey check digit options
README.linux: add packages info
license: add SPDX-License-Identifier to touched files
2022-06-09 21:52:02 +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
caadc87f7e Add support for ZXing-C++ verification (zxingcppdecoder)
DMATAMATRIX: fix look ahead BASE256 use of dm_text_sp_cnt() on switching;
  simplify dm_add_tail()
GUI: check suffixes on save so don't go into error state;
  use native path for Save As clipboard message
CODE128: use gs1_check_digit() for NVE18 and EAN14
2021-12-08 18:12:20 +00:00
gitlost
9e4ecb638f CODE128/EAN14: fix debug printf bar spaces (not NUL-terminated) 2021-11-21 15:49:32 +00: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
eb6e5daa2d raster.c: need ceilf(large_bar_height * si) to avoid zero height rows;
also improve non-half-int interpolation performance
raster/vector.c: use new stripf() func in "common.c" to workaround gcc
  32-bit float calculation variations
gs1.c: allow dummy AI "[]" if GS1NOCHECK_MODE and has data (#204);
  also add note re TPX AI 235 and terminating FNC1
Remove trailing whitespace in various files
2021-09-26 23:55:16 +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
2e84fd5157 Replace WARN_ZPL_COMPAT with GS1NOCHECK_MODE 2021-07-13 17:39:03 +01:00
gitlost
e1f22e0e72 CODE128: make cppcheck out-of-bounds suppression clearer (#233), props Andre Maute 2021-07-07 15:46:02 +01:00
gitlost
f03da2f4ba CODE128: suppress cppcheck out-of-bounds warning; plus others (#233) 2021-07-07 13:58:04 +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
c693482aa1 Change height and row_height array to floats; DAFT tracker ratio 2021-06-19 13:11:23 +01:00
gitlost
79d3c1dc7a Add GS1PARENS_MODE (input_mode) to allow inputting GS1 AIs in parentheses 2021-05-15 12:23:46 +01:00
gitlost
6fb0d077bc EAN14, NVE18: fix checksum calc for zero-filled input 2021-05-14 16:04:34 +01:00
gitlost
f9300cb37e gs1_verify: validate AIs from BWIPP gs1-format-spec.txt 2021-01-18 20:10:52 +00:00
gitlost
bee5f08f50 #209 rss.c, composite.c; DBAR_EXP encodation methods; symbol NO_PNG out.gif 2020-12-21 19:30:07 +00:00
gitlost
4ddcfb3613 dpd/gif suppress warnings; tests refresh svgs, dpd examples 2020-08-04 00:36:27 +01:00
Robin Stuart
13f4a3547d New symbology: DPD Code (variation of Code 128) 2020-08-03 12:13:05 +01:00
Robin Stuart
0004cfb35a Change symbol names e.g. RSS > GS-1 DataBar
Preserves old names in zint.h to retain backwards compatability.
2020-07-29 20:43:08 +01:00
gitlost
dd2bdb4335 CODE128: hrt always UTF-8; CODE128/EXCODE39/CODE93: blank same NUL/ctrl/DEL chars 2020-07-19 00:13:03 +01:00
gitlost
2a19b883a5 UPC/EAN, ITF14: quiet zones, addongap; raster/vector: sync code, use double 2020-07-15 19:00:12 +01:00
gitlost
c1fb51ba42 rss.c: some fixes for separators, allow check digit, refactoring; bwipp_dump.ps 2020-07-10 19:39:32 +01:00
gitlost
7be63a00b6 CODE16K fixes; separator default 1; raster/vector.c quiet_zones, output.c; #191 2020-05-21 18:22:28 +01:00
gitlost
8dcd09406c CODABLOCKF and CODE128 fixes; row separator height option_3; #191 2020-05-16 10:22:33 +01:00
gitlost
dc56c5ed0f CODE128 Fix/suppress -Wextra warnings (signedness); tests 2020-04-02 21:55:58 +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
739793a215 Always parse input as GS1 for EAN128 and RSS_EXP 2019-10-17 10:06:21 +01:00
Robin Stuart
ff2ceea361 Allow selection of GS1 mode on GS1 symbols
Because some symbols require GS1 data, selecting GS1 mode for them would result in GS1 parsing being done twice, corrupting the data.
Fixes #165 reported by Gregory Van Vooren
2019-10-06 11:30:21 +01:00