Add Code 49

This commit is contained in:
hooper114 2009-05-10 11:47:20 +00:00
parent 0cdf2f0e52
commit b62a0ca33a
8 changed files with 1512 additions and 21 deletions

View File

@ -8,7 +8,7 @@ find_package(Qr)
set(zint_COMMON_SRCS common.c library.c ps.c large.c reedsol.c gs1.c svg.c) set(zint_COMMON_SRCS common.c library.c ps.c large.c reedsol.c gs1.c svg.c)
set(zint_ONEDIM_SRCS code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c) set(zint_ONEDIM_SRCS code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c)
set(zint_POSTAL_SRCS postal.c auspost.c imail.c) set(zint_POSTAL_SRCS postal.c auspost.c imail.c)
set(zint_TWODIM_SRCS code16k.c blockf.c dmatrix.c dm200.c pdf417.c qr.c micqr.c maxicode.c composite.c aztec.c) set(zint_TWODIM_SRCS code16k.c blockf.c dmatrix.c dm200.c pdf417.c qr.c micqr.c maxicode.c composite.c aztec.c code49.c)
set(zint_SRCS ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS} ) set(zint_SRCS ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS} )
if(PNG_FOUND) if(PNG_FOUND)

View File

@ -25,8 +25,8 @@ ONEDIM:= code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c
ONEDIM_OBJ:= code.o code128.o 2of5.o upcean.o telepen.o medical.o plessey.o rss.o ONEDIM_OBJ:= code.o code128.o 2of5.o upcean.o telepen.o medical.o plessey.o rss.o
POSTAL:= postal.c auspost.c imail.c POSTAL:= postal.c auspost.c imail.c
POSTAL_OBJ:= postal.o auspost.o imail.o POSTAL_OBJ:= postal.o auspost.o imail.o
TWODIM:= code16k.c blockf.c dmatrix.c dm200.c pdf417.c qr.c maxicode.c composite.c aztec.c micqr.c TWODIM:= code16k.c blockf.c dmatrix.c dm200.c pdf417.c qr.c maxicode.c composite.c aztec.c micqr.c code49.c
TWODIM_OBJ:= code16k.o blockf.o dmatrix.o dm200.o pdf417.o qr.o maxicode.o composite.o aztec.o micqr.o TWODIM_OBJ:= code16k.o blockf.o dmatrix.o dm200.o pdf417.o qr.o maxicode.o composite.o aztec.o micqr.o code49.o
LIBS:= `libpng12-config --I_opts --L_opts --ldflags` -lz -lm LIBS:= `libpng12-config --I_opts --L_opts --ldflags` -lz -lm
ifeq ($(NO_QR),true) ifeq ($(NO_QR),true)
@ -36,7 +36,7 @@ DEFINES:=
LIBS+= -lqrencode LIBS+= -lqrencode
endif endif
libzint: code.c code128.c 2of5.c upcean.c medical.c telepen.c plessey.c postal.c auspost.c imail.c code16k.c dmatrix.c dm200.c reedsol.c pdf417.c maxicode.c rss.c common.c png.c library.c ps.c qr.c large.c composite.c aztec.c blockf.c micqr.c gs1.c svg.c libzint: code.c code128.c 2of5.c upcean.c medical.c telepen.c plessey.c postal.c auspost.c imail.c code16k.c dmatrix.c dm200.c reedsol.c pdf417.c maxicode.c rss.c common.c png.c library.c ps.c qr.c large.c composite.c aztec.c blockf.c micqr.c gs1.c svg.c code49.c
$(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c $(ONEDIM) $(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c $(ONEDIM)
$(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c $(POSTAL) $(CC) -Wall -fPIC $(CFLAGS) $(ZINT_VERSION) -c $(POSTAL)
$(CC) -Wall -fPIC $(DEFINES) $(CFLAGS) $(ZINT_VERSION) -c $(TWODIM) $(CC) -Wall -fPIC $(DEFINES) $(CFLAGS) $(ZINT_VERSION) -c $(TWODIM)

313
backend/code49.c Normal file
View File

@ -0,0 +1,313 @@
/* code49.c - Handles Code 49 */
/*
libzint - the open source barcode library
Copyright (C) 2009 Robin Stuart <robin@zint.org.uk>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "common.h"
#include "code49.h"
#define INSET "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%!&"
/* "!" represents Shift 1 and "&" represents Shift 2 */
int code_49(struct zint_symbol *symbol, unsigned char source[])
{
int i, j, rows, M, x_count, y_count, z_count, posn_val, local_value;
char intermediate[170];
int codewords[170], codeword_count;
int c_grid[8][8]; /* Refers to table 3 */
int w_grid[8][4]; /* Refets to table 2 */
int pad_count = 0;
char pattern[40];
if(ustrlen(source) > 81) {
strcpy(symbol->errtxt, "Input too long");
return ERROR_TOO_LONG;
}
strcpy(intermediate, "");
for(i = 0; i < ustrlen(source); i++) {
if(source[i] > 127) {
strcpy(symbol->errtxt, "Invalid characters in input data");
return ERROR_INVALID_DATA;
}
if(source[i] == symbol->nullchar) {
concat(intermediate, c49_table7[0]);
} else {
concat(intermediate, c49_table7[source[i]]);
}
}
codeword_count = 0;
i = 0;
do {
if((intermediate[i] >= '0') && (intermediate[i] <= '9')) {
/* Numeric data */
for(j = 0; (intermediate[i + j] >= '0') && (intermediate[i + j] <= '9'); j++);
if(j >= 5) {
/* Use Numeric Encodation Method */
int block_count, c;
int block_remain;
int block_value;
codewords[codeword_count] = 48; /* Numeric Shift */
codeword_count++;
block_count = j / 5;
block_remain = j % 5;
for(c = 0; c < block_count; c++) {
if((c == block_count - 1) && (block_remain == 2)) {
/* Rule (d) */
block_value = 100000;
block_value += ctoi(intermediate[i]) * 1000;
block_value += ctoi(intermediate[i + 1]) * 100;
block_value += ctoi(intermediate[i + 2]) * 10;
block_value += ctoi(intermediate[i + 3]);
codewords[codeword_count] = block_value / (48 * 48);
block_value = block_value - (48 * 48) * codewords[codeword_count];
codeword_count++;
codewords[codeword_count] = block_value / 48;
block_value = block_value - 48 * codewords[codeword_count];
codeword_count++;
codewords[codeword_count] = block_value;
codeword_count++;
i += 4;
block_value = ctoi(intermediate[i]) * 100;
block_value += ctoi(intermediate[i + 1]) * 10;
block_value += ctoi(intermediate[i + 2]);
codewords[codeword_count] = block_value / 48;
block_value = block_value - 48 * codewords[codeword_count];
codeword_count++;
codewords[codeword_count] = block_value;
codeword_count++;
i += 3;
} else {
block_value = ctoi(intermediate[i]) * 10000;
block_value += ctoi(intermediate[i + 1]) * 1000;
block_value += ctoi(intermediate[i + 2]) * 100;
block_value += ctoi(intermediate[i + 3]) * 10;
block_value += ctoi(intermediate[i + 4]);
codewords[codeword_count] = block_value / (48 * 48);
block_value = block_value - (48 * 48) * codewords[codeword_count];
codeword_count++;
codewords[codeword_count] = block_value / 48;
block_value = block_value - 48 * codewords[codeword_count];
codeword_count++;
codewords[codeword_count] = block_value;
codeword_count++;
i += 5;
}
}
switch(block_remain) {
case 1:
/* Rule (a) */
codewords[codeword_count] = posn(INSET, intermediate[i]);
codeword_count++;
i++;
break;
case 3:
/* Rule (b) */
block_value = ctoi(intermediate[i]) * 100;
block_value += ctoi(intermediate[i + 1]) * 10;
block_value += ctoi(intermediate[i + 2]);
codewords[codeword_count] = block_value / 48;
block_value = block_value - 48 * codewords[codeword_count];
codeword_count++;
codewords[codeword_count] = block_value;
codeword_count++;
i += 3;
break;
case 4:
/* Rule (c) */
block_value = 100000;
block_value += ctoi(intermediate[i]) * 1000;
block_value += ctoi(intermediate[i + 1]) * 100;
block_value += ctoi(intermediate[i + 2]) * 10;
block_value += ctoi(intermediate[i + 3]);
codewords[codeword_count] = block_value / (48 * 48);
block_value = block_value - (48 * 48) * codewords[codeword_count];
codeword_count++;
codewords[codeword_count] = block_value / 48;
block_value = block_value - 48 * codewords[codeword_count];
codeword_count++;
codewords[codeword_count] = block_value;
codeword_count++;
i += 4;
break;
}
if(i < strlen(intermediate)) {
/* There is more to add */
codewords[codeword_count] = 48; /* Numeric Shift */
codeword_count++;
}
} else {
codewords[codeword_count] = posn(INSET, intermediate[i]);
codeword_count++;
i++;
}
} else {
codewords[codeword_count] = posn(INSET, intermediate[i]);
codeword_count++;
i++;
}
} while(i < strlen(intermediate));
switch(codewords[0]) { /* Set starting mode value */
case 48: M = 2;
case 43: M = 4;
case 44: M = 5;
default: M = 0;
}
if(M != 0) {
for(i = 0; i < codeword_count; i++) {
codewords[i] = codewords[i + 1];
}
codeword_count--;
}
if(codeword_count > 49) {
strcpy(symbol->errtxt, "Input too long");
return ERROR_TOO_LONG;
}
/* Place codewords in code character array (c grid) */
rows = 0;
do{
for(i = 0; i < 7; i++) {
if(((rows * 7) + i) < codeword_count) {
c_grid[rows][i] = codewords[(rows * 7) + i];
} else {
c_grid[rows][i] = 48; /* Pad */
pad_count++;
}
}
rows++;
} while ((rows * 7) < codeword_count);
if((((rows <= 6) && (pad_count < 5))) || (rows > 6) || (rows == 1)) {
/* Add a row */
for(i = 0; i < 7; i++) {
c_grid[rows][i] = 48; /* Pad */
}
rows++;
}
/* Add row count and mode character */
c_grid[rows - 1][6] = (7 * (rows - 2)) + M;
/* Add row check character */
for(i = 0; i < rows - 1; i++) {
int row_sum = 0;
for(j = 0; j < 7; j++) {
row_sum += c_grid[i][j];
}
c_grid[i][7] = row_sum % 49;
}
/* Calculate Symbol Check Characters */
posn_val = 0;
x_count = c_grid[rows - 1][6] * 20;
y_count = c_grid[rows - 1][6] * 16;
z_count = c_grid[rows - 1][6] * 38;
for(i = 0; i < rows - 1; i++) {
for(j = 0; j < 4; j++) {
local_value = (c_grid[i][2 * j] * 49) + c_grid[i][(2 * j) + 1];
x_count += c49_x_weight[posn_val] * local_value;
y_count += c49_y_weight[posn_val] * local_value;
z_count += c49_z_weight[posn_val] * local_value;
posn_val++;
}
}
if(rows > 6) {
/* Add Z Symbol Check */
c_grid[rows - 1][0] = (z_count % 2401) / 49;
c_grid[rows - 1][1] = (z_count % 2401) % 49;
}
local_value = (c_grid[rows - 1][0] * 49) + c_grid[rows - 1][1];
x_count += c49_x_weight[posn_val] * local_value;
y_count += c49_y_weight[posn_val] * local_value;
posn_val++;
/* Add Y Symbol Check */
c_grid[rows - 1][2] = (y_count % 2401) / 49;
c_grid[rows - 1][3] = (y_count % 2401) % 49;
local_value = (c_grid[rows - 1][2] * 49) + c_grid[rows - 1][3];
x_count += c49_x_weight[posn_val] * local_value;
/* Add X Symbol Check */
c_grid[rows - 1][4] = (x_count % 2401) / 49;
c_grid[rows - 1][5] = (x_count % 2401) % 49;
/* Add last row check character */
j = 0;
for(i = 0; i < 7; i++) {
j += c_grid[rows - 1][i];
}
c_grid[rows - 1][7] = j % 49;
/* Transfer data to symbol character array (w grid) */
for(i = 0; i < rows; i++) {
for(j = 0; j < 4; j ++) {
w_grid[i][j] = (c_grid[i][2 * j] * 49) + c_grid[i][(2 * j) + 1];
}
}
for(i = 0; i < rows; i++) {
strcpy(pattern, "11"); /* Start character */
for(j = 0; j < 4; j++) {
if(i != (rows - 1)) {
if(c49_table4[i][j] == 'E') {
/* Even Parity */
concat(pattern, c49_appxe_even[w_grid[i][j]]);
} else {
/* Odd Parity */
concat(pattern, c49_appxe_odd[w_grid[i][j]]);
}
} else {
/* Last row uses all even parity */
concat(pattern, c49_appxe_even[w_grid[i][j]]);
}
}
concat(pattern, "4"); /* Stop character */
/* Expand into symbol */
symbol->row_height[i] = 10;
expand(symbol, pattern);
}
symbol->whitespace_width = 10;
symbol->output_options = BARCODE_BIND;
symbol->border_width = 2;
return 0;
}

1175
backend/code49.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/* library.c - external functions of libzint /* library.c - external functions of libzint
libzint - the open source barcode library libzint - the open source barcode library
Copyright (C) 2008 Robin Stuart <robin@zint.org.uk> Copyright (C) 2009 Robin Stuart <robin@zint.org.uk>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -120,6 +120,7 @@ extern int microqr(struct zint_symbol *symbol, unsigned char source[]); /* Micro
extern int aztec_runes(struct zint_symbol *symbol, unsigned char source[]); /* Aztec Runes */ extern int aztec_runes(struct zint_symbol *symbol, unsigned char source[]); /* Aztec Runes */
extern int korea_post(struct zint_symbol *symbol, unsigned char source[]); /* Korea Post */ extern int korea_post(struct zint_symbol *symbol, unsigned char source[]); /* Korea Post */
extern int japan_post(struct zint_symbol *symbol, unsigned char source[]); /* Japanese Post */ extern int japan_post(struct zint_symbol *symbol, unsigned char source[]); /* Japanese Post */
extern int code_49(struct zint_symbol *symbol, unsigned char source[]); /* Code 49 */
#ifndef NO_PNG #ifndef NO_PNG
int png_handle(struct zint_symbol *symbol, int rotate_angle); int png_handle(struct zint_symbol *symbol, int rotate_angle);
@ -160,7 +161,7 @@ int hibc(struct zint_symbol *symbol, unsigned char source[])
} }
error_number = is_sane(HIBCSET , source); error_number = is_sane(HIBCSET , source);
if(error_number == ERROR_INVALID_DATA) { if(error_number == ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "Invalid characters in data [082]"); strcpy(symbol->errtxt, "Invalid characters in data");
return error_number; return error_number;
} }
@ -393,33 +394,32 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source)
} }
/* First check the symbology field */ /* First check the symbology field */
if(symbol->symbology < 1) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z01]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if(symbol->symbology < 1) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
/* symbol->symbologys 1 to 86 are defined by tbarcode */ /* symbol->symbologys 1 to 86 are defined by tbarcode */
if(symbol->symbology == 5) { symbol->symbology = BARCODE_C25MATRIX; } if(symbol->symbology == 5) { symbol->symbology = BARCODE_C25MATRIX; }
if((symbol->symbology >= 10) && (symbol->symbology <= 12)) { symbol->symbology = BARCODE_EANX; } if((symbol->symbology >= 10) && (symbol->symbology <= 12)) { symbol->symbology = BARCODE_EANX; }
if((symbol->symbology == 14) || (symbol->symbology == 15)) { symbol->symbology = BARCODE_EANX; } if((symbol->symbology == 14) || (symbol->symbology == 15)) { symbol->symbology = BARCODE_EANX; }
if(symbol->symbology == 17) { symbol->symbology = BARCODE_UPCA; } if(symbol->symbology == 17) { symbol->symbology = BARCODE_UPCA; }
if(symbol->symbology == 19) { strcpy(symbol->errtxt, "Codabar 18 not supported, using Codabar [Z02]"); symbol->symbology = BARCODE_CODABAR; error_number = WARN_INVALID_OPTION; } if(symbol->symbology == 19) { strcpy(symbol->errtxt, "Codabar 18 not supported, using Codabar"); symbol->symbology = BARCODE_CODABAR; error_number = WARN_INVALID_OPTION; }
if(symbol->symbology == 24) { strcpy(symbol->errtxt, "Code 49 not supported, using Code 93 [Z03]"); symbol->symbology = BARCODE_CODE93; error_number = WARN_INVALID_OPTION; }
if(symbol->symbology == 26) { symbol->symbology = BARCODE_UPCA; } if(symbol->symbology == 26) { symbol->symbology = BARCODE_UPCA; }
if(symbol->symbology == 27) { strcpy(symbol->errtxt, "UPCD1 not supported [Z04]"); error_number = ERROR_INVALID_OPTION; } if(symbol->symbology == 27) { strcpy(symbol->errtxt, "UPCD1 not supported"); error_number = ERROR_INVALID_OPTION; }
if(symbol->symbology == 33) { symbol->symbology = BARCODE_EAN128; } if(symbol->symbology == 33) { symbol->symbology = BARCODE_EAN128; }
if((symbol->symbology == 35) || (symbol->symbology == 36)) { symbol->symbology = BARCODE_UPCA; } if((symbol->symbology == 35) || (symbol->symbology == 36)) { symbol->symbology = BARCODE_UPCA; }
if((symbol->symbology == 38) || (symbol->symbology == 39)) { symbol->symbology = BARCODE_UPCE; } if((symbol->symbology == 38) || (symbol->symbology == 39)) { symbol->symbology = BARCODE_UPCE; }
if((symbol->symbology >= 41) && (symbol->symbology <= 45)) { symbol->symbology = BARCODE_POSTNET; } if((symbol->symbology >= 41) && (symbol->symbology <= 45)) { symbol->symbology = BARCODE_POSTNET; }
if(symbol->symbology == 46) { symbol->symbology = BARCODE_PLESSEY; } if(symbol->symbology == 46) { symbol->symbology = BARCODE_PLESSEY; }
if(symbol->symbology == 48) { symbol->symbology = BARCODE_NVE18; } if(symbol->symbology == 48) { symbol->symbology = BARCODE_NVE18; }
if(symbol->symbology == 54) { strcpy(symbol->errtxt, "General Parcel Code not supported, using Code 128 [Z05]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if(symbol->symbology == 54) { strcpy(symbol->errtxt, "General Parcel Code not supported, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
if((symbol->symbology == 59) || (symbol->symbology == 61)) { symbol->symbology = BARCODE_CODE128; } if((symbol->symbology == 59) || (symbol->symbology == 61)) { symbol->symbology = BARCODE_CODE128; }
if(symbol->symbology == 62) { symbol->symbology = BARCODE_CODE93; } if(symbol->symbology == 62) { symbol->symbology = BARCODE_CODE93; }
if((symbol->symbology == 64) || (symbol->symbology == 65)) { symbol->symbology = BARCODE_AUSPOST; } if((symbol->symbology == 64) || (symbol->symbology == 65)) { symbol->symbology = BARCODE_AUSPOST; }
if(symbol->symbology == 73) { strcpy(symbol->errtxt, "Codablock E not supported [Z06]"); error_number = ERROR_INVALID_OPTION; } if(symbol->symbology == 73) { strcpy(symbol->errtxt, "Codablock E not supported"); error_number = ERROR_INVALID_OPTION; }
if(symbol->symbology == 78) { symbol->symbology = BARCODE_RSS14; } if(symbol->symbology == 78) { symbol->symbology = BARCODE_RSS14; }
if(symbol->symbology == 83) { symbol->symbology = BARCODE_PLANET; } if(symbol->symbology == 83) { symbol->symbology = BARCODE_PLANET; }
if(symbol->symbology == 88) { symbol->symbology = BARCODE_EAN128; } if(symbol->symbology == 88) { symbol->symbology = BARCODE_EAN128; }
if(symbol->symbology == 91) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z09]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if(symbol->symbology == 91) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
if((symbol->symbology >= 94) && (symbol->symbology <= 96)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z10]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if((symbol->symbology >= 94) && (symbol->symbology <= 96)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
if(symbol->symbology == 100) { symbol->symbology = BARCODE_HIBC_128; } if(symbol->symbology == 100) { symbol->symbology = BARCODE_HIBC_128; }
if(symbol->symbology == 101) { symbol->symbology = BARCODE_HIBC_39; } if(symbol->symbology == 101) { symbol->symbology = BARCODE_HIBC_39; }
if(symbol->symbology == 103) { symbol->symbology = BARCODE_HIBC_DM; } if(symbol->symbology == 103) { symbol->symbology = BARCODE_HIBC_DM; }
@ -427,9 +427,9 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source)
if(symbol->symbology == 107) { symbol->symbology = BARCODE_HIBC_PDF; } if(symbol->symbology == 107) { symbol->symbology = BARCODE_HIBC_PDF; }
if(symbol->symbology == 109) { symbol->symbology = BARCODE_HIBC_MICPDF; } if(symbol->symbology == 109) { symbol->symbology = BARCODE_HIBC_MICPDF; }
if(symbol->symbology == 111) { symbol->symbology = BARCODE_HIBC_BLOCKF; } if(symbol->symbology == 111) { symbol->symbology = BARCODE_HIBC_BLOCKF; }
if((symbol->symbology >= 112) && (symbol->symbology <= 127)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z10]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if((symbol->symbology >= 112) && (symbol->symbology <= 127)) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
/* Everything from 128 up is Zint-specific */ /* Everything from 128 up is Zint-specific */
if(symbol->symbology >= 140) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128 [Z11]"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; } if(symbol->symbology >= 140) { strcpy(symbol->errtxt, "Symbology out of range, using Code 128"); symbol->symbology = BARCODE_CODE128; error_number = WARN_INVALID_OPTION; }
if(error_number > 4) { if(error_number > 4) {
error_tag(symbol->errtxt, error_number); error_tag(symbol->errtxt, error_number);
@ -564,6 +564,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source)
case BARCODE_HIBC_MICPDF: error_number = hibc(symbol, preprocessed); break; case BARCODE_HIBC_MICPDF: error_number = hibc(symbol, preprocessed); break;
case BARCODE_HIBC_BLOCKF: error_number = hibc(symbol, preprocessed); break; case BARCODE_HIBC_BLOCKF: error_number = hibc(symbol, preprocessed); break;
case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed); break; case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed); break;
case BARCODE_CODE49: error_number = code_49(symbol, preprocessed); break;
} }
if((symbol->symbology == BARCODE_CODE128) || (symbol->symbology == BARCODE_CODE128B)) { if((symbol->symbology == BARCODE_CODE128) || (symbol->symbology == BARCODE_CODE128B)) {
@ -599,7 +600,7 @@ int ZBarcode_Print(struct zint_symbol *symbol)
if(!(strcmp(output, "SVG"))) { if(!(strcmp(output, "SVG"))) {
error_number = svg_plot(symbol); error_number = svg_plot(symbol);
} else { } else {
strcpy(symbol->errtxt, "Unknown output format [Z20]"); strcpy(symbol->errtxt, "Unknown output format");
error_tag(symbol->errtxt, ERROR_INVALID_OPTION); error_tag(symbol->errtxt, ERROR_INVALID_OPTION);
return ERROR_INVALID_OPTION; return ERROR_INVALID_OPTION;
} }
@ -608,7 +609,7 @@ int ZBarcode_Print(struct zint_symbol *symbol)
} }
#endif #endif
} else { } else {
strcpy(symbol->errtxt, "Unknown output format [Z21]"); strcpy(symbol->errtxt, "Unknown output format");
error_tag(symbol->errtxt, ERROR_INVALID_OPTION); error_tag(symbol->errtxt, ERROR_INVALID_OPTION);
return ERROR_INVALID_OPTION; return ERROR_INVALID_OPTION;
} }
@ -637,7 +638,7 @@ int ZBarcode_Print_Rotated(struct zint_symbol *symbol, int rotate_angle)
if(!(strcmp(output, "EPS"))) { if(!(strcmp(output, "EPS"))) {
error_number = ps_plot(symbol); error_number = ps_plot(symbol);
} else { } else {
strcpy(symbol->errtxt, "Unknown output format [Z23]"); strcpy(symbol->errtxt, "Unknown output format");
error_tag(symbol->errtxt, ERROR_INVALID_OPTION); error_tag(symbol->errtxt, ERROR_INVALID_OPTION);
return ERROR_INVALID_OPTION; return ERROR_INVALID_OPTION;
} }
@ -645,7 +646,7 @@ int ZBarcode_Print_Rotated(struct zint_symbol *symbol, int rotate_angle)
} }
#endif #endif
} else { } else {
strcpy(symbol->errtxt, "Unknown output format [Z24]"); strcpy(symbol->errtxt, "Unknown output format");
error_tag(symbol->errtxt, ERROR_INVALID_OPTION); error_tag(symbol->errtxt, ERROR_INVALID_OPTION);
return ERROR_INVALID_OPTION; return ERROR_INVALID_OPTION;
} }

View File

@ -452,7 +452,7 @@ void QZint::render(QPainter & painter, const QRectF & paintRect, AspectRatioMode
} }
} }
/* Add row binding */ /* Add row binding */
if((m_zintSymbol->symbology == BARCODE_CODE16K) && (row != 0)) { if(((m_zintSymbol->symbology == BARCODE_CODE16K) || (m_zintSymbol->symbology == BARCODE_CODE49)) && (row != 0)) {
painter.fillRect(0,y - 1,m_zintSymbol->width,2,QBrush(m_fgColor)); painter.fillRect(0,y - 1,m_zintSymbol->width,2,QBrush(m_fgColor));
} }
if(((m_zintSymbol->symbology == BARCODE_CODABLOCKF) || (m_zintSymbol->symbology == BARCODE_HIBC_BLOCKF)) && (row != 0)) { if(((m_zintSymbol->symbology == BARCODE_CODABLOCKF) || (m_zintSymbol->symbology == BARCODE_HIBC_BLOCKF)) && (row != 0)) {

View File

@ -44,6 +44,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
"Code 32 (Italian Pharmacode)", "Code 32 (Italian Pharmacode)",
"Code 39", "Code 39",
"Code 39 Extended", "Code 39 Extended",
"Code 49",
"Code 93", "Code 93",
"Codabar", "Codabar",
"Codablock-F", "Codablock-F",

View File

@ -49,6 +49,7 @@ public:
CODE32 =129, CODE32 =129,
CODE39 =8, CODE39 =8,
EXCODE39 =9, EXCODE39 =9,
CODE49 =24,
CODE93 =25, CODE93 =25,
CODABAR =18, CODABAR =18,
CODABLOCKF =74, CODABLOCKF =74,