From 24f175b6f6fee7c23c8624c92e94ee9cbbe4bd7b Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Wed, 26 Jul 2017 11:16:54 +0100 Subject: [PATCH] Flag if DM_SQUARE is used at the same time as symbol size selection --- backend/dmatrix.c | 4 ++++ docs/manual.txt | 6 +++--- frontend/main.c | 12 ++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/backend/dmatrix.c b/backend/dmatrix.c index 78df9398..a65ab761 100644 --- a/backend/dmatrix.c +++ b/backend/dmatrix.c @@ -1181,6 +1181,10 @@ int data_matrix_200(struct zint_symbol *symbol,const unsigned char source[], con while (matrixH[calcsize] != matrixW[calcsize]) { calcsize++; } + if (optionsize != -1) { + strcpy(symbol->errtxt, "Can not force square symbols when symbol size is selected"); + error_number = ZINT_WARN_INVALID_OPTION; + } } else if (symbol->option_3 != DM_DMRE) { /* Skip DMRE symbols */ while (isDMRE[calcsize]) { diff --git a/docs/manual.txt b/docs/manual.txt index ca885878..fbaf3b4c 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -1771,9 +1771,9 @@ Input | Symbol Size 30 | 16 x 48 --------------------- -To force Zint only to use square symbols (versions 1-24) at the command line -use the option --square and when using the API set the value option_3 = -DM_SQUARE. +When using automatic symbol sizes you can force Zint to use square symbols +(versions 1-24) at the command line by using the option --square and when +using the API by setting the value option_3 = DM_SQUARE. Data Matrix Rectangular Extension (DMRE) codes may be generated with the following values as before: diff --git a/frontend/main.c b/frontend/main.c index 7697884b..9115995b 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -744,7 +744,11 @@ int main(int argc, char **argv) { strcat(my_symbol->outfile, filetype); } error_number = escape_char_process(my_symbol, (unsigned char*) optarg, strlen(optarg)); - if (error_number == 0) { + if (error_number < 5) { + if (error_number != 0) { + fprintf(stderr, "%s\n", my_symbol->errtxt); + fflush(stderr); + } error_number = ZBarcode_Print(my_symbol, rotate_angle); } generated = 1; @@ -763,7 +767,11 @@ int main(int argc, char **argv) { case 'i': /* Take data from file */ if (batch_mode == 0) { error_number = ZBarcode_Encode_File(my_symbol, optarg); - if (error_number == 0) { + if (error_number < 5) { + if (error_number != 0) { + fprintf(stderr, "%s\n", my_symbol->errtxt); + fflush(stderr); + } error_number = ZBarcode_Print(my_symbol, rotate_angle); } generated = 1;