diff --git a/backend/dm200.c b/backend/dm200.c index 994e7f7e..db3387b5 100644 --- a/backend/dm200.c +++ b/backend/dm200.c @@ -799,7 +799,7 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[]) } } calcsize++; - + if(calcsize <= optionsize) { symbolsize = optionsize; } else { @@ -810,6 +810,19 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[]) strcpy(symbol->errtxt, "Data does not fit in selected symbol size"); } } + + if(symbol->option_3 == DM_SQUARE) { + /* Force to use square symbol */ + switch(symbolsize) { + case 2: + case 4: + case 6: + case 9: + case 11: + case 14: + symbolsize++; + } + } H = matrixH[symbolsize]; W = matrixW[symbolsize]; diff --git a/backend/zint.h b/backend/zint.h index 03fb5528..a0b02c8d 100644 --- a/backend/zint.h +++ b/backend/zint.h @@ -151,6 +151,8 @@ struct zint_symbol { #define KANJI_MODE 3 #define SJIS_MODE 4 +#define DM_SQUARE 100 + #define WARN_INVALID_OPTION 2 #define ERROR_TOO_LONG 5 #define ERROR_INVALID_DATA 6