From 0d5c7cf9d3e8e9e79f45b4e60e58e4d809424dd5 Mon Sep 17 00:00:00 2001 From: hooper114 Date: Fri, 14 Aug 2009 16:52:08 +0000 Subject: [PATCH] Add 'force Data Matrix to square symbol' option. --- backend/dm200.c | 15 ++++++++++++++- backend/zint.h | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) 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