Tweak Mode C blocks a bit more!

This commit is contained in:
hooper114 2009-07-10 08:19:22 +00:00
parent 2c5e7332e9
commit 2f09c8f938
2 changed files with 32 additions and 5 deletions

View File

@ -704,6 +704,11 @@ int ean_128(struct zint_symbol *symbol, unsigned char source[])
set[i - 1] = 'B'; set[i - 1] = 'B';
} }
} }
for(i = 1; i < read - 1; i++) {
if((set[i] == 'C') && ((set[i - 1] == 'B') && (set[i + 1] == 'B'))) {
set[i] = 'B';
}
}
/* for(i = 0; i < read; i++) { /* for(i = 0; i < read; i++) {
printf("char %c mode %c\n", reduced[i], set[i]); printf("char %c mode %c\n", reduced[i], set[i]);

View File

@ -305,19 +305,41 @@ int code16k(struct zint_symbol *symbol, unsigned char source[])
c_count = 0; c_count = 0;
for(i = 0; i < read; i++) { for(i = 0; i < read; i++) {
if(set[i] == 'C') { if(set[i] == 'C') {
if((source[i] == '[') && gs1) { if(reduced[i] == '[') {
if(c_count % 2) { set[i - c_count] = 'B'; } if(c_count % 2) {
if((i - c_count) != 0) {
set[i - c_count] = 'B';
} else {
set[i - 1] = 'B';
}
}
c_count = 0; c_count = 0;
} else { } else {
c_count++; c_count++;
} }
} else { } else {
if(c_count % 2) { set[i - c_count] = 'B'; } if(c_count % 2) {
if((i - c_count) != 0) {
set[i - c_count] = 'B';
} else {
set[i - 1] = 'B';
}
}
c_count = 0; c_count = 0;
} }
} }
if(c_count % 2) { set[i - c_count] = 'B'; } if(c_count % 2) {
if((i - c_count) != 0) {
set[i - c_count] = 'B';
} else {
set[i - 1] = 'B';
}
}
for(i = 1; i < read - 1; i++) {
if((set[i] == 'C') && ((set[i - 1] == 'B') && (set[i + 1] == 'B'))) {
set[i] = 'B';
}
}
/* Make sure the data will fit in the symbol */ /* Make sure the data will fit in the symbol */
last_set = ' '; last_set = ' ';