- Add new symbologies BARCODE_EAN8, BARCODE_EAN_2ADDON,

`BARCODE_EAN_5ADDON`, `BARCODE_EAN13`, `BARCODE_EAN8_CC` and
  `BARCODE_EAN13_CC` as replacements for `BARCODE_EANX`,
  `BARCODE_EANX_CHK` and `BARCODE_EANX_CC` and use in CLI/GUI
  (`BARCODE_EANX` etc. marked as legacy)
- For EAN/UPC accept space as alternative add-on separator to '+',
  and accept GTIN-13 format with & without 2-digit or 5-digit
  add-on (no separator)
- Buffer length of member `errtxt` in `zint_symbol` extended 100
  -> 160 (will be sufficient for eventual translation and
  gs1-syntax-dictionary errors hopefully)
- UPC-E: warn if first digit of 7 (or 8 if check digit given) not
  '0' or '1'
- manual: update for new EAN symbologies and mention EANX now
  legacy but still supported
This commit is contained in:
gitlost 2025-04-16 22:26:43 +01:00
parent 9265abd9e1
commit 3592edd64e
51 changed files with 6995 additions and 4949 deletions

View file

@ -566,18 +566,37 @@ INTERNAL int is_bindable(const int symbology) {
return 0;
}
/* Whether `symbology` is EAN/UPC */
INTERNAL int is_upcean(const int symbology) {
/* Whether `symbology` is EAN */
INTERNAL int is_ean(const int symbology) {
switch (symbology) {
case BARCODE_EAN8:
case BARCODE_EAN_2ADDON:
case BARCODE_EAN_5ADDON:
case BARCODE_EANX:
case BARCODE_EANX_CHK:
case BARCODE_EAN13:
case BARCODE_ISBNX:
case BARCODE_EANX_CC:
case BARCODE_EAN8_CC:
case BARCODE_EAN13_CC:
return 1;
break;
}
return 0;
}
/* Whether `symbology` is EAN/UPC */
INTERNAL int is_upcean(const int symbology) {
if (is_ean(symbology)) {
return 1;
}
switch (symbology) {
case BARCODE_UPCA:
case BARCODE_UPCA_CHK:
case BARCODE_UPCE:
case BARCODE_UPCE_CHK:
case BARCODE_ISBNX:
case BARCODE_EANX_CC:
case BARCODE_UPCA_CC:
case BARCODE_UPCE_CC:
return 1;
@ -589,7 +608,9 @@ INTERNAL int is_upcean(const int symbology) {
/* Whether `symbology` can have composite 2D component data */
INTERNAL int is_composite(const int symbology) {
return symbology >= BARCODE_EANX_CC && symbology <= BARCODE_DBAR_EXPSTK_CC;
/* Note if change this must change "backend_qt/qzint.cpp" `takesGS1AIData()` also */
return (symbology >= BARCODE_EANX_CC && symbology <= BARCODE_DBAR_EXPSTK_CC)
|| symbology == BARCODE_EAN8_CC || symbology == BARCODE_EAN13_CC;
}
/* Whether `symbology` is a matrix design renderable as dots */