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)
This commit is contained in:
gitlost 2023-06-12 01:25:55 +01:00
parent 6d015d6a8f
commit 607e4ed33a
395 changed files with 11528 additions and 23016 deletions

View file

@ -60,7 +60,7 @@ extern "C" {
struct zint_vector_string {
float x, y; /* x is relative to halign (i.e. centre, left, right), y is relative to baseline */
float fsize; /* Font size */
float width; /* Suggested string width, may be 0 if none recommended */
float width; /* Rendered width estimate */
int length; /* Number of characters (bytes) */
int rotation; /* 0, 90, 180, 270 degrees */
int halign; /* Horizontal alignment: 0 for centre, 1 for left, 2 for right (end) */
@ -111,7 +111,6 @@ extern "C" {
int option_2; /* Symbol-specific options */
int option_3; /* Symbol-specific options */
int show_hrt; /* Show (1) or hide (0) Human Readable Text (HRT). Default 1 */
int fontsize; /* Unused */
int input_mode; /* Encoding of input data (see DATA_MODE etc below). Default DATA_MODE */
int eci; /* Extended Channel Interpretation. Default 0 (none) */
float dpmm; /* Resolution of output in dots per mm (BMP/EMF/PCX/PNG/TIF only). Default 0 (none) */
@ -121,7 +120,7 @@ extern "C" {
struct zint_structapp structapp; /* Structured Append info. Default structapp.count 0 (none) */
int warn_level; /* Affects error/warning value returned by Zint API (see WARN_XXX below) */
int debug; /* Debugging flags */
unsigned char text[128]; /* Human Readable Text (HRT) (if any), UTF-8, NUL-terminated (output only) */
unsigned char text[160]; /* Human Readable Text (HRT) (if any), UTF-8, NUL-terminated (output only) */
int rows; /* Number of rows used by the symbol (output only) */
int width; /* Width of the generated symbol (output only) */
unsigned char encoded_data[200][144]; /* Encoded data (output only). Allows for rows of 1152 modules */
@ -292,6 +291,8 @@ extern "C" {
*/
#define BARCODE_NO_QUIET_ZONES 0x1000 /* Disable quiet zones, notably those with defaults as listed above */
#define COMPLIANT_HEIGHT 0x2000 /* Warn if height not compliant and use standard height (if any) as default */
#define EANUPC_GUARD_WHITESPACE 0x4000 /* Add quiet zone indicators ("<"/">") to HRT whitespace (EAN/UPC) */
#define EMBED_VECTOR_FONT 0x8000 /* Embed font in vector output - currently only for SVG output of EAN/UPC */
/* Input data types (`symbol->input_mode`) */
#define DATA_MODE 0 /* Binary */
@ -318,6 +319,7 @@ extern "C" {
#define ULTRA_COMPRESSION 128 /* Enable Ultracode compression (experimental) */
/* Warning and error conditions (API return values) */
#define ZINT_WARN_HRT_TRUNCATED 1 /* Human Readable Text was truncated (max 159 bytes) */
#define ZINT_WARN_INVALID_OPTION 2 /* Invalid option given but overridden by Zint */
#define ZINT_WARN_USES_ECI 3 /* Automatic ECI inserted by Zint */
#define ZINT_WARN_NONCOMPLIANT 4 /* Symbol created not compliant with standards */
@ -332,6 +334,7 @@ extern "C" {
#define ZINT_ERROR_FILE_WRITE 12 /* Error writing to output file */
#define ZINT_ERROR_USES_ECI 13 /* Error counterpart of warning if WARN_FAIL_ALL set (see below) */
#define ZINT_ERROR_NONCOMPLIANT 14 /* Error counterpart of warning if WARN_FAIL_ALL set */
#define ZINT_ERROR_HRT_TRUNCATED 15 /* Error counterpart of warning if WARN_FAIL_ALL set */
/* Warning level (`symbol->warn_level`) */
#define WARN_DEFAULT 0 /* Default behaviour */