mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Add new symbology: Han Xin Code
This commit is contained in:
parent
0fcf4cc1ab
commit
0230426b0f
@ -7,7 +7,7 @@ find_package(PNG)
|
|||||||
set(zint_COMMON_SRCS common.c library.c render.c ps.c large.c reedsol.c gs1.c svg.c png.c)
|
set(zint_COMMON_SRCS common.c library.c render.c ps.c large.c reedsol.c gs1.c svg.c png.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 dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c)
|
set(zint_TWODIM_SRCS code16k.c dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c hanxin.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)
|
||||||
|
47
backend/hanxin.c
Normal file
47
backend/hanxin.c
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/* hanxin.c - Han Xin Code
|
||||||
|
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2009-2016 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
3. Neither the name of the project nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This code attempts to implement Han Xin Code according to AIMD-015:2010 (Rev 0.8) */
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
#include "common.h"
|
||||||
|
#include "reedsol.h"
|
||||||
|
#include "hanxin.h"
|
||||||
|
|
||||||
|
int han_xin(struct zint_symbol *symbol, const unsigned char source[], int length) {
|
||||||
|
printf("Sucessfully init HAN XIN\n");
|
||||||
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
|
}
|
49
backend/hanxin.h
Normal file
49
backend/hanxin.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/* hanxin.h - definitions for Han Xin code
|
||||||
|
|
||||||
|
libzint - the open source barcode library
|
||||||
|
Copyright (C) 2009-2016 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
3. Neither the name of the project nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HANXIN_H
|
||||||
|
#define HANXIN_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* NEWFILE_H */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -181,6 +181,7 @@ extern int code_49(struct zint_symbol *symbol, unsigned char source[], const int
|
|||||||
extern int channel_code(struct zint_symbol *symbol, unsigned char source[], int length); /* Channel Code */
|
extern int channel_code(struct zint_symbol *symbol, unsigned char source[], int length); /* Channel Code */
|
||||||
extern int code_one(struct zint_symbol *symbol, unsigned char source[], int length); /* Code One */
|
extern int code_one(struct zint_symbol *symbol, unsigned char source[], int length); /* Code One */
|
||||||
extern int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int length); /* Grid Matrix */
|
extern int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int length); /* Grid Matrix */
|
||||||
|
extern int han_xin(struct zint_symbol * symbol, const unsigned char source[], int length); /* Han Xin */
|
||||||
|
|
||||||
#ifndef NO_PNG
|
#ifndef NO_PNG
|
||||||
extern int png_handle(struct zint_symbol *symbol, int rotate_angle);
|
extern int png_handle(struct zint_symbol *symbol, int rotate_angle);
|
||||||
@ -473,6 +474,7 @@ int ZBarcode_ValidID(int symbol_id) {
|
|||||||
case BARCODE_CHANNEL:
|
case BARCODE_CHANNEL:
|
||||||
case BARCODE_CODEONE:
|
case BARCODE_CODEONE:
|
||||||
case BARCODE_GRIDMATRIX:
|
case BARCODE_GRIDMATRIX:
|
||||||
|
case BARCODE_HANXIN:
|
||||||
result = 1;
|
result = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -491,6 +493,8 @@ static int extended_charset(struct zint_symbol *symbol, const unsigned char *sou
|
|||||||
break;
|
break;
|
||||||
case BARCODE_GRIDMATRIX: error_number = grid_matrix(symbol, source, length);
|
case BARCODE_GRIDMATRIX: error_number = grid_matrix(symbol, source, length);
|
||||||
break;
|
break;
|
||||||
|
case BARCODE_HANXIN: error_number = han_xin(symbol, source, length);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return error_number;
|
return error_number;
|
||||||
@ -829,7 +833,17 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
if (symbol->symbology == 111) {
|
if (symbol->symbology == 111) {
|
||||||
symbol->symbology = BARCODE_HIBC_BLOCKF;
|
symbol->symbology = BARCODE_HIBC_BLOCKF;
|
||||||
}
|
}
|
||||||
if ((symbol->symbology >= 113) && (symbol->symbology <= 127)) {
|
if ((symbol->symbology == 113) || (symbol->symbology == 114)) {
|
||||||
|
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
||||||
|
symbol->symbology = BARCODE_CODE128;
|
||||||
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
|
}
|
||||||
|
if (symbol->symbology == 115) {
|
||||||
|
strcpy(symbol->errtxt, "Dot Code not supported");
|
||||||
|
symbol->symbology = BARCODE_CODE128;
|
||||||
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
|
}
|
||||||
|
if ((symbol->symbology >= 117) && (symbol->symbology <= 127)) {
|
||||||
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
strcpy(symbol->errtxt, "Symbology out of range, using Code 128");
|
||||||
symbol->symbology = BARCODE_CODE128;
|
symbol->symbology = BARCODE_CODE128;
|
||||||
error_number = ZINT_WARN_INVALID_OPTION;
|
error_number = ZINT_WARN_INVALID_OPTION;
|
||||||
@ -882,6 +896,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
|
|||||||
case BARCODE_QRCODE:
|
case BARCODE_QRCODE:
|
||||||
case BARCODE_MICROQR:
|
case BARCODE_MICROQR:
|
||||||
case BARCODE_GRIDMATRIX:
|
case BARCODE_GRIDMATRIX:
|
||||||
|
case BARCODE_HANXIN:
|
||||||
error_number = extended_charset(symbol, local_source, length);
|
error_number = extended_charset(symbol, local_source, length);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -171,6 +171,10 @@ extern "C" {
|
|||||||
#define BARCODE_HIBC_BLOCKF 110
|
#define BARCODE_HIBC_BLOCKF 110
|
||||||
#define BARCODE_HIBC_AZTEC 112
|
#define BARCODE_HIBC_AZTEC 112
|
||||||
|
|
||||||
|
/* Tbarcode 10 codes */
|
||||||
|
#define BARCODE_DOTCODE 115
|
||||||
|
#define BARCODE_HANXIN 116
|
||||||
|
|
||||||
/* Zint specific */
|
/* Zint specific */
|
||||||
#define BARCODE_AZRUNE 128
|
#define BARCODE_AZRUNE 128
|
||||||
#define BARCODE_CODE32 129
|
#define BARCODE_CODE32 129
|
||||||
|
@ -48,22 +48,22 @@ void types(void) {
|
|||||||
"13: EAN 63: AP Standard Customer 106: HIBC PDF417\n"
|
"13: EAN 63: AP Standard Customer 106: HIBC PDF417\n"
|
||||||
"16: GS1-128 66: AP Reply Paid 108: HIBC MicroPDF417\n"
|
"16: GS1-128 66: AP Reply Paid 108: HIBC MicroPDF417\n"
|
||||||
"18: Codabar 67: AP Routing 112: HIBC Aztec Code\n"
|
"18: Codabar 67: AP Routing 112: HIBC Aztec Code\n"
|
||||||
"20: Code 128 68: AP Redirection 128: Aztec Runes\n"
|
"20: Code 128 68: AP Redirection 116: Han Xin Code\n"
|
||||||
"21: Leitcode 69: ISBN 129: Code 23\n"
|
"21: Leitcode 69: ISBN 128: Aztec Runes\n"
|
||||||
"22: Identcode 70: RM4SCC 130: Comp EAN\n"
|
"22: Identcode 70: RM4SCC 129: Code 32\n"
|
||||||
"23: Code 16k 71: Data Matrix 131: Comp GS1-128\n"
|
"23: Code 16k 71: Data Matrix 130: Comp EAN\n"
|
||||||
"24: Code 49 72: EAN-14 132: Comp DataBar Omni\n"
|
"24: Code 49 72: EAN-14 131: Comp GS1-128\n"
|
||||||
"25: Code 93 75: NVE-18 133: Comp DataBar Ltd\n"
|
"25: Code 93 75: NVE-18 132: Comp DataBar Omni\n"
|
||||||
"28: Flattermarken 76: Japanese Post 134: Comp DataBar ExpOm\n"
|
"28: Flattermarken 76: Japanese Post 133: Comp DataBar Ltd\n"
|
||||||
"29: GS1 DataBar Omni 77: Korea Post 135: Comp UPC-A\n"
|
"29: GS1 DataBar Omni 77: Korea Post 134: Comp DataBar ExpOm\n"
|
||||||
"30: GS1 DataBar Ltd 79: GS1 DataBar Stack 136: Comp UPC-E\n"
|
"30: GS1 DataBar Ltd 79: GS1 DataBar Stack 135: Comp UPC-A\n"
|
||||||
"31: GS1 DataBar ExpOm 80: GS1 DataBar Stack Omni 137: Comp DataBar Stack\n"
|
"31: GS1 DataBar ExpOm 80: GS1 DataBar Stack Omni 136: Comp UPC-E\n"
|
||||||
"32: Telepen Alpha 81: GS1 DataBar ESO 138: Comp DataBar Stack Omni\n"
|
"32: Telepen Alpha 81: GS1 DataBar ESO 137: Comp DataBar Stack\n"
|
||||||
"34: UPC-A 82: Planet 139: Comp DataBar ESO\n"
|
"34: UPC-A 82: Planet 138: Comp DataBar Stack Omni\n"
|
||||||
"37: UPC-E 84: MicroPDF 140: Channel Code\n"
|
"37: UPC-E 84: MicroPDF 139: Comp DataBar ESO\n"
|
||||||
"40: Postnet 85: USPS OneCode 141: Code One\n"
|
"40: Postnet 85: USPS OneCode 140: Channel Code\n"
|
||||||
"47: MSI Plessey 86: UK Plessey 142: Grid Matrix\n"
|
"47: MSI Plessey 86: UK Plessey 141: Code One\n"
|
||||||
"49: FIM 87: Telepen Numeric\n"
|
"49: FIM 87: Telepen Numeric 142: Grid Matrix\n"
|
||||||
"50: Logmars 89: ITF-14\n"
|
"50: Logmars 89: ITF-14\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,8 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags fl)
|
|||||||
"GS1 DataBar Omnidirectional",
|
"GS1 DataBar Omnidirectional",
|
||||||
"GS1 DataBar Stacked",
|
"GS1 DataBar Stacked",
|
||||||
"GS1 DataBar Stacked Omnidirectional",
|
"GS1 DataBar Stacked Omnidirectional",
|
||||||
"ITF-14",
|
"Han Xin Code",
|
||||||
|
"ITF-14",
|
||||||
"International Standard Book Number (ISBN)",
|
"International Standard Book Number (ISBN)",
|
||||||
"Japanese Postal Barcode",
|
"Japanese Postal Barcode",
|
||||||
"Korean Postal Barcode",
|
"Korean Postal Barcode",
|
||||||
@ -676,7 +677,7 @@ void MainWindow::update_preview()
|
|||||||
m_bc.bc.setSymbol(BARCODE_HIBC_AZTEC);
|
m_bc.bc.setSymbol(BARCODE_HIBC_AZTEC);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MSI_PLESSEY:
|
case BARCODE_MSI_PLESSEY:
|
||||||
m_bc.bc.setSymbol(BARCODE_MSI_PLESSEY);
|
m_bc.bc.setSymbol(BARCODE_MSI_PLESSEY);
|
||||||
m_bc.bc.setWidth(m_optionWidget->findChild<QComboBox*>("cmbMSICheck")->currentIndex());
|
m_bc.bc.setWidth(m_optionWidget->findChild<QComboBox*>("cmbMSICheck")->currentIndex());
|
||||||
break;
|
break;
|
||||||
@ -792,7 +793,10 @@ void MainWindow::update_preview()
|
|||||||
if(m_optionWidget->findChild<QRadioButton*>("radC49GS1")->isChecked())
|
if(m_optionWidget->findChild<QRadioButton*>("radC49GS1")->isChecked())
|
||||||
m_bc.bc.setInputMode(GS1_MODE);
|
m_bc.bc.setInputMode(GS1_MODE);
|
||||||
break;
|
break;
|
||||||
|
case BARCODE_HANXIN:
|
||||||
|
m_bc.bc.setSymbol(BARCODE_HANXIN);
|
||||||
|
// Space reserved for more options!
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex()));
|
m_bc.bc.setSymbol(metaObject()->enumerator(0).value(bstyle->currentIndex()));
|
||||||
break;
|
break;
|
||||||
|
@ -75,6 +75,7 @@ public:
|
|||||||
RSS14 =29,
|
RSS14 =29,
|
||||||
RSS14STACK =79,
|
RSS14STACK =79,
|
||||||
RSS14STACK_OMNI =80,
|
RSS14STACK_OMNI =80,
|
||||||
|
HANXIN =116,
|
||||||
ITF14 =89,
|
ITF14 =89,
|
||||||
ISBNX =69,
|
ISBNX =69,
|
||||||
JAPANPOST =76,
|
JAPANPOST =76,
|
||||||
|
Loading…
Reference in New Issue
Block a user