- 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

@ -1164,6 +1164,8 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
switch (symbol->symbology) {
/* Determine width of 2D component according to ISO/IEC 24723 Table 1 */
case BARCODE_EANX_CC:
case BARCODE_EAN8_CC:
case BARCODE_EAN13_CC:
if (pri_len < 20) {
int padded_pri_len;
int with_addon;
@ -1173,7 +1175,7 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
return errtxt_adj(ZINT_ERROR_TOO_LONG, symbol, "%1$s%2$s", " (linear component)");
}
padded_pri_len = (int) ustrlen(padded_pri);
if (padded_pri_len <= 7) { /* EAN-8 */
if (padded_pri_len <= 7 || symbol->symbology == BARCODE_EAN8_CC) { /* EAN-8 */
cc_width = 3;
} else {
switch (padded_pri_len) {
@ -1283,6 +1285,8 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
switch (symbol->symbology) {
case BARCODE_EANX_CC:
case BARCODE_EAN8_CC:
case BARCODE_EAN13_CC:
error_number = eanx_cc(linear, (unsigned char *) symbol->primary, pri_len, symbol->rows);
break;
case BARCODE_GS1_128_CC:
@ -1331,6 +1335,8 @@ INTERNAL int composite(struct zint_symbol *symbol, unsigned char source[], int l
switch (symbol->symbology) {
/* Determine horizontal alignment (according to section 12.3) */
case BARCODE_EANX_CC:
case BARCODE_EAN8_CC:
case BARCODE_EAN13_CC:
switch (linear->text_length) { /* Use zero-padded length */
case 8: /* EAN-8 */
case 11: /* EAN-8 + 2 */