Corrected DMRE direct creation with -vers

This commit is contained in:
Harald Oehlmann 2015-08-18 14:49:35 +02:00
parent 30c8df3269
commit 4dc096cd67
2 changed files with 43 additions and 16 deletions

View File

@ -927,14 +927,14 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int leng
return ERROR_TOO_LONG; return ERROR_TOO_LONG;
} }
if((symbol->option_2 >= 1) && (symbol->option_2 <= 30)) { if((symbol->option_2 >= 1) && (symbol->option_2 <= DMSIZESCOUNT)) {
optionsize = intsymbol[symbol->option_2 - 1]; optionsize = intsymbol[symbol->option_2 - 1];
} else { } else {
optionsize = -1; optionsize = -1;
} }
calcsize = 29; calcsize = DMSIZESCOUNT-1;
for(i = 29; i > -1; i--) { for(i = DMSIZESCOUNT-1; i > -1; i--) {
if(matrixbytes[i] >= (binlen + process_p)) // Allow for the remaining data characters. if(matrixbytes[i] >= (binlen + process_p)) // Allow for the remaining data characters.
{ {
calcsize = i; calcsize = i;
@ -944,12 +944,34 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int leng
if(symbol->option_3 == DM_SQUARE) { if(symbol->option_3 == DM_SQUARE) {
/* Force to use square symbol */ /* Force to use square symbol */
switch(calcsize) { switch(calcsize) {
/* Without DMRE
case 2: case 2:
case 4: case 4:
case 6: case 6:
case 9: case 9:
case 11: case 11:
case 14: case 14:
*/
case 2:
case 4:
case 6:
case 8:
case 9:
case 10:
case 11:
case 13:
case 14:
case 16:
case 18:
case 19:
case 20:
case 21:
case 23:
case 24:
case 25:
case 27:
case 28:
case 30:
calcsize++; calcsize++;
} }
} }
@ -983,7 +1005,7 @@ int data_matrix_200(struct zint_symbol *symbol, unsigned char source[], int leng
} }
// ecc code // ecc code
if(symbolsize == 29) { skew = 1; } if(symbolsize == INTSYMBOL144) { skew = 1; }
ecc200(binary, bytes, datablock, rsblock, skew); ecc200(binary, bytes, datablock, rsblock, skew);
{ // placement { // placement
int x, y, NC, NR, *places; int x, y, NC, NR, *places;

View File

@ -90,19 +90,24 @@ static const int text_value[] = {
// The position in the option array is by increasing total data codewords with square first // The position in the option array is by increasing total data codewords with square first
static const int intsymbol[] = { static const int intsymbol[] = {
0, /* 1: 10x10 */ 1, /* 2: 12x12 */ 3, /* 3: 14x14 */ 5, // 4: 16x16 0, /* 1: 10x10 , 3*/ 1, /* 2: 12x12 , 5*/ 3, /* 3: 14x14 , 8*/ 5, // 4: 16x16 , 12
7, /* 5: 18x18 */ 9, /* 6: 24x24 */ 12, /* 7: 22x22 */ 15, // 8: 24x24 7, /* 5: 18x18 , 18*/ 9, /* 6: 20x20 , 22*/ 12, /* 7: 22x22 , 30*/ 15, // 8: 24x24 , 36
17, /* 9: 26x26 */ 22, /* 10: 32x32 */ 26, /* 11: 36x36 */ 29, // 12: 40x40 17, /* 9: 26x26 , 44*/ 22, /* 10: 32x32 , 62*/ 26, /* 11: 36x36 , 86*/ 29, // 12: 40x40 ,114
31, /* 13: 44x44 */ 32, /* 14: 48x48 */ 33, /* 15: 52x52 */ 34, // 16: 64x64 31, /* 13: 44x44 ,144*/ 32, /* 14: 48x48 ,174*/ 33, /* 15: 52x52 ,204*/ 34, // 16: 64x64 ,280
37, /* 17: 72x72 */ 38, /* 18: 80x80 */ 39, /* 19: 88x88 */ 41, // 20: 96x96 35, /* 17: 72x72 ,368*/ 36, /* 18: 80x80 ,456*/ 37, /* 19: 88x88 ,576*/ 38, // 20: 96x96 ,696
42, /* 21:104x104*/ 43, /* 22:120x120*/ 44, /* 23:132x132*/ 45, // 24:144x144 39, /* 21:104x104,816*/ 40, /* 22:120x120,1050*/41, /* 23:132x132,1304*/42, // 24:144x144,1558
2, /* 25: 8x18 */ 4, /* 26: 8x32 */ 6, /* 27: 12x26 */ 10, // 28: 12x36 2, /* 25: 8x18 , 5*/ 4, /* 26: 8x32 , 10*/ 6, /* 27: 12x26 , 16*/ 10, // 28: 12x36 , 22
13, /* 29: 16x36 */ 18, /* 30: 16x48 */ 8, /* 31: 8x48 */ 11, /* 32: 8x64 */ 13, /* 29: 16x36 , 32*/ 18, /* 30: 16x48 , 49*/ 8, /* 31: 8x48 , 18*/ 11, // 32: 8x64 , 24
14, /* 33: 12x48 */ 16, /* 34: 12x64 */ 23, /* 35: 16x64 */ 19, /* 36: 24x32 */ 14, /* 33: 12x48 , 32*/ 16, /* 34: 12x64 , 43*/ 23, /* 35: 16x64 , 62*/ 19, // 36: 24x32 , 49
21, /* 37: 24x36 */ 25, /* 38: 24x48 */ 28, /* 39: 24x64 */ 20, /* 40: 26x32 */ 21, /* 37: 24x36 , 55*/ 25, /* 38: 24x48 , 80*/ 28, /* 39: 24x64 ,108*/ 20, // 40: 26x32 , 52
24, /* 41: 26x40 */ 27, /* 42: 26x48 */ 30, /* 43: 26x64 */ 24, /* 41: 26x40 , 70*/ 27, /* 42: 26x48 , 90*/ 30, /* 43: 26x64 ,118*/
0 }; 0 };
// Number of DM Sizes
#define DMSIZESCOUNT 44
// Number of 144x144 for special interlace
#define INTSYMBOL144 42
// Horizontal matrix size // Horizontal matrix size
static const int matrixH[] = { static const int matrixH[] = {
@ -114,7 +119,7 @@ static const int matrixH[] = {
/*20*/ 26, /* 26x32 ,52 */ 24, /* 24x36 ,55 */ 32, /* 32x32 ,62 */ 16, /* 16x64 ,62 */ /*20*/ 26, /* 26x32 ,52 */ 24, /* 24x36 ,55 */ 32, /* 32x32 ,62 */ 16, /* 16x64 ,62 */
/*24*/ 26, /* 26x40 ,70 */ 24, /* 24x48 ,80 */ 36, /* 36x36 ,86 */ 26, /* 26x48 ,90 */ /*24*/ 26, /* 26x40 ,70 */ 24, /* 24x48 ,80 */ 36, /* 36x36 ,86 */ 26, /* 26x48 ,90 */
/*28*/ 24, /* 24x64 ,108*/ 40, /* 40x40 ,114*/ 26, /* 26x64 ,118*/ 44, /* 44x44 ,144*/ /*28*/ 24, /* 24x64 ,108*/ 40, /* 40x40 ,114*/ 26, /* 26x64 ,118*/ 44, /* 44x44 ,144*/
/*32*/ 48, /* 48x48,174 */ 52, /* 62x52,204 */ 64, /* 64x64,280 */ 72, /* 72x72,368 */ /*32*/ 48, /* 48x48,174 */ 52, /* 52x52,204 */ 64, /* 64x64,280 */ 72, /* 72x72,368 */
/*36*/ 80, /* 80x80,456 */ 88, /* 88x88,576 */ 96, /* 96x96,696 */ 104,/*104x104,816*/ /*36*/ 80, /* 80x80,456 */ 88, /* 88x88,576 */ 96, /* 96x96,696 */ 104,/*104x104,816*/
/*40*/ 120,/*120x120,1050*/132,/*132x132,1304*/144/*144x144,1558*/ /*40*/ 120,/*120x120,1050*/132,/*132x132,1304*/144/*144x144,1558*/
}; };