add KIX code

This commit is contained in:
hooper114 2008-09-02 19:47:26 +00:00
parent e1db5bfca0
commit 73a51d6813

View File

@ -313,6 +313,59 @@ int royal_plot(struct zint_symbol *symbol, unsigned char source[])
return errno; return errno;
} }
int kix_code(struct zint_symbol *symbol, unsigned char source[])
{
/* Handles Dutch Post TNT KIX symbols */
/* The same as RM4SCC but without check digit */
/* Specification at http://www.tntpost.nl/zakelijk/klantenservice/downloads/kIX_code/download.aspx */
char height_pattern[50];
unsigned int loopey;
int writer, i;
int errno;
strcpy(height_pattern, "");
errno = 0;
to_upper(source);
if(strlen(source) != 11) {
strcpy(symbol->errtxt, "error: input too long");
return ERROR_TOO_LONG;
}
errno = is_sane(KRSET, source);
if(errno == ERROR_INVALID_DATA) {
strcpy(symbol->errtxt, "error: invalid characters in data");
return errno;
}
for (i = 0; i < strlen(source); i++) {
lookup(KRSET, RoyalTable, source[i], height_pattern);
}
writer = 0;
for(loopey = 0; loopey < strlen(height_pattern); loopey++)
{
if((height_pattern[loopey] == '1') || (height_pattern[loopey] == '0'))
{
symbol->encoded_data[0][writer] = '1';
}
symbol->encoded_data[1][writer] = '1';
if((height_pattern[loopey] == '2') || (height_pattern[loopey] == '0'))
{
symbol->encoded_data[2][writer] = '1';
}
writer += 2;
}
symbol->row_height[0] = 4;
symbol->row_height[1] = 2;
symbol->row_height[2] = 4;
symbol->rows = 3;
symbol->width = writer - 1;
strcpy(symbol->text, "");
return errno;
}
int flattermarken(struct zint_symbol *symbol, unsigned char source[]) int flattermarken(struct zint_symbol *symbol, unsigned char source[])
{ /* Flattermarken - Not really a barcode symbology and (in my opinion) probably not much use { /* Flattermarken - Not really a barcode symbology and (in my opinion) probably not much use
but it's supported by TBarCode so it's supported by Zint! */ but it's supported by TBarCode so it's supported by Zint! */