Merge branch 'cepnet'

This commit is contained in:
gitlost 2022-08-20 17:37:26 +01:00
commit 400f124a04
8 changed files with 106 additions and 19 deletions

View file

@ -521,7 +521,7 @@ static const void *barcode_funcs[BARCODE_LAST + 1] = {
eanx, NULL, eanx, eanx, NULL, /*35-39*/
postnet, NULL, NULL, NULL, NULL, /*40-44*/
NULL, NULL, msi_plessey, NULL, fim, /*45-49*/
code39, pharma, pzn, pharma_two, NULL, /*50-54*/
code39, pharma, pzn, pharma_two, postnet, /*50-54*/
pdf417, pdf417, maxicode, qrcode, NULL, /*55-59*/
code128, NULL, NULL, auspost, NULL, /*60-64*/
NULL, auspost, auspost, auspost, eanx, /*65-69*/

View file

@ -132,6 +132,10 @@ static int usps_set_height(struct zint_symbol *symbol, const int no_errtxt) {
}
/* Handles the PostNet system used for Zip codes in the US */
/* Also handles Brazilian CEPNet - more information at
* https://silo.tips/download/sumario-4-regras-de-endereamento
* https://barcodeguide.seagullscientific.com/Content/Symbologies/CEPNet.htm
* TODO: Check compliant symbol sizes */
static int postnet_enc(struct zint_symbol *symbol, const unsigned char source[], char *d, const int length) {
int i, sum, check_digit;
int error_number = 0;
@ -140,9 +144,17 @@ static int postnet_enc(struct zint_symbol *symbol, const unsigned char source[],
strcpy(symbol->errtxt, "480: Input too long (38 character maximum)");
return ZINT_ERROR_TOO_LONG;
}
if (length != 5 && length != 9 && length != 11) {
strcpy(symbol->errtxt, "479: Input length is not standard (5, 9 or 11 characters)");
error_number = ZINT_WARN_NONCOMPLIANT;
if (symbol->symbology == BARCODE_CEPNET) {
if (length != 8) {
strcpy(symbol->errtxt, "499: Input is wrong length (should be 8 digits)");
error_number = ZINT_WARN_NONCOMPLIANT;
}
} else {
if (length != 5 && length != 9 && length != 11) {
strcpy(symbol->errtxt, "479: Input length is not standard (5, 9 or 11 characters)");
error_number = ZINT_WARN_NONCOMPLIANT;
}
}
if (!is_sane(NEON_F, source, length)) {
strcpy(symbol->errtxt, "481: Invalid character in data (digits only)");

View file

@ -178,6 +178,7 @@ extern "C" {
#define BARCODE_PHARMA 51 /* Pharmacode One-Track */
#define BARCODE_PZN 52 /* Pharmazentralnummer */
#define BARCODE_PHARMA_TWO 53 /* Pharmacode Two-Track */
#define BARCODE_CEPNET 54 /* Brazilian CEPNet Postal Code */
#define BARCODE_PDF417 55 /* PDF417 */
#define BARCODE_PDF417COMP 56 /* Compact PDF417 (Truncated PDF417) */
#define BARCODE_PDF417TRUNC 56 /* Legacy */

59
docs/images/cepnet.svg Normal file
View file

@ -0,0 +1,59 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="186" height="11" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="186" height="11" fill="#FFFFFF" />
<rect x="0.00" y="0.00" width="2.00" height="10.75" />
<rect x="16.00" y="0.00" width="2.00" height="10.75" />
<rect x="20.00" y="0.00" width="2.00" height="10.75" />
<rect x="32.00" y="0.00" width="2.00" height="10.75" />
<rect x="40.00" y="0.00" width="2.00" height="10.75" />
<rect x="52.00" y="0.00" width="2.00" height="10.75" />
<rect x="56.00" y="0.00" width="2.00" height="10.75" />
<rect x="68.00" y="0.00" width="2.00" height="10.75" />
<rect x="80.00" y="0.00" width="2.00" height="10.75" />
<rect x="88.00" y="0.00" width="2.00" height="10.75" />
<rect x="96.00" y="0.00" width="2.00" height="10.75" />
<rect x="108.00" y="0.00" width="2.00" height="10.75" />
<rect x="112.00" y="0.00" width="2.00" height="10.75" />
<rect x="124.00" y="0.00" width="2.00" height="10.75" />
<rect x="140.00" y="0.00" width="2.00" height="10.75" />
<rect x="144.00" y="0.00" width="2.00" height="10.75" />
<rect x="156.00" y="0.00" width="2.00" height="10.75" />
<rect x="168.00" y="0.00" width="2.00" height="10.75" />
<rect x="180.00" y="0.00" width="2.00" height="10.75" />
<rect x="184.00" y="0.00" width="2.00" height="10.75" />
<rect x="4.00" y="6.45" width="2.00" height="4.30" />
<rect x="8.00" y="6.45" width="2.00" height="4.30" />
<rect x="12.00" y="6.45" width="2.00" height="4.30" />
<rect x="24.00" y="6.45" width="2.00" height="4.30" />
<rect x="28.00" y="6.45" width="2.00" height="4.30" />
<rect x="36.00" y="6.45" width="2.00" height="4.30" />
<rect x="44.00" y="6.45" width="2.00" height="4.30" />
<rect x="48.00" y="6.45" width="2.00" height="4.30" />
<rect x="60.00" y="6.45" width="2.00" height="4.30" />
<rect x="64.00" y="6.45" width="2.00" height="4.30" />
<rect x="72.00" y="6.45" width="2.00" height="4.30" />
<rect x="76.00" y="6.45" width="2.00" height="4.30" />
<rect x="84.00" y="6.45" width="2.00" height="4.30" />
<rect x="92.00" y="6.45" width="2.00" height="4.30" />
<rect x="100.00" y="6.45" width="2.00" height="4.30" />
<rect x="104.00" y="6.45" width="2.00" height="4.30" />
<rect x="116.00" y="6.45" width="2.00" height="4.30" />
<rect x="120.00" y="6.45" width="2.00" height="4.30" />
<rect x="128.00" y="6.45" width="2.00" height="4.30" />
<rect x="132.00" y="6.45" width="2.00" height="4.30" />
<rect x="136.00" y="6.45" width="2.00" height="4.30" />
<rect x="148.00" y="6.45" width="2.00" height="4.30" />
<rect x="152.00" y="6.45" width="2.00" height="4.30" />
<rect x="160.00" y="6.45" width="2.00" height="4.30" />
<rect x="164.00" y="6.45" width="2.00" height="4.30" />
<rect x="172.00" y="6.45" width="2.00" height="4.30" />
<rect x="176.00" y="6.45" width="2.00" height="4.30" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.2 KiB

View file

@ -601,6 +601,8 @@ Value
52 `BARCODE_PZN` PZN
53 `BARCODE_PHARMA_TWO` Pharmacode Two-Track
54 `BARCODE_CEPNET` Brazilian CEPNet
55 `BARCODE_PDF417` PDF417
@ -3147,6 +3149,15 @@ lengths used by USPS were `Planet12` (11-digit input) and `Planet14` (13-digit
input), and as with POSTNET a warning will be issued if the length is not one of
these.
### 6.4.4 Brazilian CEPNet
![`zint -b CEPNET --compliantheight -d "12345678"`](images/cepnet.svg)
Based on POSTNET, the CEPNet symbol is used by Correios, the Brazilian postal
service, to encode CEP (Código de Endereçamento Postal) numbers on mail items.
Input should consist of eight digits with the check digit being automattically
added by Zint.
\clearpage
## 6.5 4-State Postal Codes

View file

@ -75,6 +75,7 @@ zint -b GS1_128_CC --compliantheight -d "[99]1234-abcd" --mode=3 --primary="[01]
zint -b PHARMA_TWO --compliantheight -d "29876543" --scale=1 -o images/pharma_two.svg
zint -b POSTNET --compliantheight -d "12345678901" --scale=1 -o images/postnet.svg
zint -b PLANET --compliantheight -d "4012345235636" --scale=1 -o images/planet.svg
zint -b CEPNET --compliantheight -d "12345678" --scale=1 -o images/cepnet.svg
zint -b AUSPOST --compliantheight -d "96184209" --scale=1 -o images/auspost.svg
zint -b AUSROUTE --compliantheight -d "34567890" --scale=1 -o images/ausroute.svg
zint -b AUSREPLY --compliantheight -d "12345678" --scale=1 -o images/ausreply.svg

View file

@ -81,20 +81,21 @@ static void types(void) {
"51 PHARMA Pharmacode One-Track 130 EANX_CC Composite EAN\n"
"52 PZN Pharmazentralnummer 131 GS1_128_CC Composite GS1-128\n"
"53 PHARMA_TWO Pharmacode Two-Track 132 DBAR_OMN_CC Comp DataBar Omni\n"
"55 PDF417 PDF417 133 DBAR_LTD_CC Comp DataBar Limited\n"
"56 PDF417COMP Compact PDF417 134 DBAR_EXP_CC Comp DataBar Expanded\n"
"57 MAXICODE MaxiCode 135 UPCA_CC Composite UPC-A\n"
"58 QRCODE QR Code 136 UPCE_CC Composite UPC-E\n"
"60 CODE128B Code 128 (Subset B) 137 DBAR_STK_CC Comp DataBar Stacked\n"
"63 AUSPOST AP Standard Customer 138 DBAR_OMNSTK_CC Comp DataBar Stack Omn\n"
"66 AUSREPLY AP Reply Paid 139 DBAR_EXPSTK_CC Comp DataBar Exp Stack\n"
"67 AUSROUTE AP Routing 140 CHANNEL Channel Code\n"
"68 AUSREDIRECT AP Redirection 141 CODEONE Code One\n"
"69 ISBNX ISBN 142 GRIDMATRIX Grid Matrix\n"
"70 RM4SCC Royal Mail 4SCC 143 UPNQR UPN QR Code\n"
"71 DATAMATRIX Data Matrix 144 ULTRA Ultracode\n"
"72 EAN14 EAN-14 145 RMQR Rectangular Micro QR\n"
"73 VIN Vehicle Information No. 146 BC412 BC412\n"
"54 CEPNET Brazilian CEPNet 133 DBAR_LTD_CC Comp DataBar Limited\n"
"55 PDF417 PDF417 134 DBAR_EXP_CC Comp DataBar Expanded\n"
"56 PDF417COMP Compact PDF417 135 UPCA_CC Composite UPC-A\n"
"57 MAXICODE MaxiCode 136 UPCE_CC Composite UPC-E\n"
"58 QRCODE QR Code 137 DBAR_STK_CC Comp DataBar Stacked\n"
"60 CODE128B Code 128 (Subset B) 138 DBAR_OMNSTK_CC Comp DataBar Stack Omn\n"
"63 AUSPOST AP Standard Customer 139 DBAR_EXPSTK_CC Comp DataBar Exp Stack\n"
"66 AUSREPLY AP Reply Paid 140 CHANNEL Channel Code\n"
"67 AUSROUTE AP Routing 141 CODEONE Code One\n"
"68 AUSREDIRECT AP Redirection 142 GRIDMATRIX Grid Matrix\n"
"69 ISBNX ISBN 143 UPNQR UPN QR Code\n"
"70 RM4SCC Royal Mail 4SCC 144 ULTRA Ultracode\n"
"71 DATAMATRIX Data Matrix 145 RMQR Rectangular Micro QR\n"
"72 EAN14 EAN-14 146 BC412 BC412\n"
"73 VIN Vehicle Information No.\n"
);
}
@ -303,6 +304,7 @@ static int get_barcode_name(const char *barcode_name) {
{ BARCODE_C25LOGIC, "c25logic" },
{ BARCODE_C25STANDARD, "c25matrix" },
{ BARCODE_C25STANDARD, "c25standard" },
{ BARCODE_CEPNET, "cepnet" },
{ BARCODE_CHANNEL, "channel" },
{ BARCODE_CHANNEL, "channelcode" }, /* Synonym */
{ BARCODE_CODABAR, "codabar" },

View file

@ -73,6 +73,7 @@ static const struct bstyle_item bstyle_items[] = {
{ QSL("Aztec Code (ISO 24778) (and HIBC)"), BARCODE_AZTEC },
{ QSL("Aztec Runes (ISO 24778)"), BARCODE_AZRUNE },
{ QSL("BC412 (SEMI T1-95)"), BARCODE_BC412 },
{ QSL("Brazilian Postal Code (CEPNet)"), BARCODE_CEPNET },
{ QSL("Channel Code"), BARCODE_CHANNEL },
{ QSL("Codabar (EN 798)"), BARCODE_CODABAR },
{ QSL("Codablock-F (and HIBC)"), BARCODE_CODABLOCKF },
@ -259,7 +260,7 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags fl)
filter_bstyle->hide();
#endif
bstyle->setCurrentIndex(settings.value(QSL("studio/symbology"), 11).toInt());
bstyle->setCurrentIndex(settings.value(QSL("studio/symbology"), 12).toInt());
load_settings(settings);