- CODABLOCKF: fix misencodation of extended ASCII 0xB0-0xB9 when

followed by digit (ignore 2nd byte of FNC4 when categorizing
  Code C characters)
- New `ZBarcode_Cap()` flag `ZINT_CAP_BINDABLE`, differentiated
  from `ZINT_CAP_STACKABLE`, and new Qt Backend method
  `isBindable()`
- CLI: fix `separator` check to use new `ZINT_CAP_BINDABLE` instead
  of `ZINT_CAP_STACKABLE`
- ZBarcode_Cap: add missing symbologies to `ZINT_CAP_BINDABLE` (was
  `ZINT_CAP_STACKABLE`)
- DOTCODE: pad rows if given number of columns instead of failing
  if rows below min (5)
- DBAR/composites: ensure stacked symbologies and composites are
  not stacked (set `symbol->rows` to 0)
- test suite: move `test_perf` routines into single test
  "test_perf";
  new "test_random" (based on "test_bwipp") to test various
  symbologies with random binary - discovered CODABLOCKF bug;
  expand "test_bwipp"
manual: Feeback: mention AZTEC -1 meaning min & MICROPDF417:
  doc new `ZINT_CAP_BINDABLE`
general: various code fiddlings and re-formattings
This commit is contained in:
gitlost 2025-04-03 16:08:15 +01:00
parent 2370fbfbb7
commit a74871a7de
60 changed files with 3509 additions and 3267 deletions

View file

@ -1219,7 +1219,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i
int jc, n_dots;
int data_length, ecc_length;
int min_dots, min_area;
int height, width;
int height, width = 0;
int mask_score[8];
int user_mask;
int dot_stream_length;
@ -1243,6 +1243,14 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i
symbol->eci);
}
if (symbol->option_2 > 0) {
if (symbol->option_2 < 5 || symbol->option_2 > 200) {
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 527,
"Number of columns '%d' is out of range (5 to 200)", symbol->option_2);
}
width = symbol->option_2;
}
user_mask = (symbol->option_3 >> 8) & 0x0F; /* User mask is mask + 1, so >= 1 and <= 8 */
if (user_mask > 8) {
user_mask = 0; /* Ignore */
@ -1293,7 +1301,7 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i
min_dots = 9 * (data_length + 3 + (data_length / 2)) + 2;
min_area = min_dots * 2;
if (symbol->option_2 == 0) {
if (width == 0) {
/* Automatic sizing */
/* Following Rule 3 (Section 5.2.2) and applying a recommended width to height ratio 3:2 */
/* Eliminates undersized symbols */
@ -1334,8 +1342,9 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i
} else {
/* User defined width */
width = symbol->option_2;
height = (min_area + (width - 1)) / width;
if ((height = (min_area + (width - 1)) / width) < 5) {
height = 5;
}
if (!((width + height) & 1)) {
height++;
@ -1359,9 +1368,9 @@ INTERNAL int dotcode(struct zint_symbol *symbol, struct zint_seg segs[], const i
if ((height < 5) || (width < 5)) {
assert(height >= 5 || width >= 5); /* If width < 5, min height is 19 */
ZEXT errtxtf(0, symbol, 529, "Resulting symbol %1$s '%2$d' is too small (minimum 5)",
width < 5 ? "width" : "height", width < 5 ? width : height);
return ZINT_ERROR_INVALID_OPTION;
return ZEXT errtxtf(ZINT_ERROR_INVALID_OPTION, symbol, 529,
"Resulting symbol %1$s '%2$d' is too small (minimum 5)",
width < 5 ? "width" : "height", width < 5 ? width : height);
}
n_dots = (height * width) / 2;