diff --git a/backend/library.c b/backend/library.c
index a60618dd..b06080d9 100644
--- a/backend/library.c
+++ b/backend/library.c
@@ -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*/
diff --git a/backend/postal.c b/backend/postal.c
index e83cb61a..95c9eee7 100644
--- a/backend/postal.c
+++ b/backend/postal.c
@@ -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)");
diff --git a/backend/zint.h b/backend/zint.h
index 9d2b1355..16c1ee8e 100644
--- a/backend/zint.h
+++ b/backend/zint.h
@@ -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 */
diff --git a/docs/images/bc412.svg b/docs/images/bc412.svg
new file mode 100644
index 00000000..440d1a8e
--- /dev/null
+++ b/docs/images/bc412.svg
@@ -0,0 +1,51 @@
+
+
+
diff --git a/docs/images/cepnet.svg b/docs/images/cepnet.svg
new file mode 100644
index 00000000..7b3036ea
--- /dev/null
+++ b/docs/images/cepnet.svg
@@ -0,0 +1,59 @@
+
+
+
diff --git a/docs/images/codablockf.svg b/docs/images/codablockf.svg
index 91cbcc49..a302a3fa 100644
--- a/docs/images/codablockf.svg
+++ b/docs/images/codablockf.svg
@@ -11,89 +11,109 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/images/code16k.svg b/docs/images/code16k.svg
index c45fea36..c86e81f6 100644
--- a/docs/images/code16k.svg
+++ b/docs/images/code16k.svg
@@ -8,40 +8,46 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/images/code49.svg b/docs/images/code49.svg
index b8044f51..bfdabac8 100644
--- a/docs/images/code49.svg
+++ b/docs/images/code49.svg
@@ -8,81 +8,96 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/manual.pmd b/docs/manual.pmd
index f20fd01b..c306bec7 100644
--- a/docs/manual.pmd
+++ b/docs/manual.pmd
@@ -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
diff --git a/docs/zint_images.sh b/docs/zint_images.sh
index eacabdb5..563231d1 100755
--- a/docs/zint_images.sh
+++ b/docs/zint_images.sh
@@ -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
diff --git a/frontend/main.c b/frontend/main.c
index 5c2f5eba..70f072d0 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -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" },
diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp
index b1b64c6d..9a8ef10b 100644
--- a/frontend_qt/mainwindow.cpp
+++ b/frontend_qt/mainwindow.cpp
@@ -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);