From 389bcce10f9612488ff690fcf57c88e89d46488a Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Fri, 9 Feb 2018 20:55:17 +0000 Subject: [PATCH] Add Royal Mail Mailmark to front end --- backend/mailmark.c | 20 ++++++++++---------- docs/manual.txt | 17 +++++++++++++---- frontend/main.c | 34 +++++++++++++++++----------------- frontend_qt/mainwindow.cpp | 3 ++- frontend_qt/mainwindow.h | 1 + 5 files changed, 43 insertions(+), 32 deletions(-) diff --git a/backend/mailmark.c b/backend/mailmark.c index cbace0d2..c5f11c15 100644 --- a/backend/mailmark.c +++ b/backend/mailmark.c @@ -147,7 +147,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { int i, j; if ((length != 22) && (length != 26)) { - strcpy(symbol->errtxt, "Invalid length input"); + strcpy(symbol->errtxt, "580: Invalid length input"); return ZINT_ERROR_INVALID_DATA; } @@ -159,28 +159,28 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { } if (is_sane(RUBIDIUM, (unsigned char *) local_source, length) != 0) { - strcpy(symbol->errtxt, "Invalid characters or format in input data"); + strcpy(symbol->errtxt, "581: Invalid characters or format in input data"); return ZINT_ERROR_INVALID_DATA; } // Format is in the range 0-4 format = ctoi(local_source[0]); if ((format < 0) || (format > 4)) { - strcpy(symbol->errtxt, "Invalid format"); + strcpy(symbol->errtxt, "582: Invalid format"); return ZINT_ERROR_INVALID_DATA; } // Version ID is in the range 1-4 version_id = ctoi(local_source[1]) - 1; if ((version_id < 0) || (version_id > 3)) { - strcpy(symbol->errtxt, "Invalid Version ID"); + strcpy(symbol->errtxt, "583: Invalid Version ID"); return ZINT_ERROR_INVALID_DATA; } // Class is in the range 0-9,A-E class = ctoi(local_source[2]); if ((class < 0) || (class > 14)) { - strcpy(symbol->errtxt, "Invalid Class"); + strcpy(symbol->errtxt, "584: Invalid Class"); return ZINT_ERROR_INVALID_DATA; } @@ -191,7 +191,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { supply_chain_id *= 10; supply_chain_id += ctoi(local_source[i]); } else { - strcpy(symbol->errtxt, "Invalid Supply Chain ID"); + strcpy(symbol->errtxt, "585: Invalid Supply Chain ID"); return ZINT_ERROR_INVALID_DATA; } } @@ -203,7 +203,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { item_id *= 10; item_id += (long) ctoi(local_source[i]); } else { - strcpy(symbol->errtxt, "Invalid Item ID"); + strcpy(symbol->errtxt, "586: Invalid Item ID"); return ZINT_ERROR_INVALID_DATA; } } @@ -258,7 +258,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { // Verify postcode type if (postcode_type != 7) { if (verify_postcode(postcode, postcode_type) != 0) { - strcpy(symbol->errtxt, "Invalid postcode"); + strcpy(symbol->errtxt, "587: Invalid postcode"); return ZINT_ERROR_INVALID_DATA; } } @@ -624,9 +624,9 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { j += 2; } - symbol->row_height[0] = 3; + symbol->row_height[0] = 4; symbol->row_height[1] = 2; - symbol->row_height[2] = 3; + symbol->row_height[2] = 4; symbol->rows = 3; symbol->width = j - 1; diff --git a/docs/manual.txt b/docs/manual.txt index 07a89809..4e1dcef5 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -307,6 +307,7 @@ Numeric Value | Barcode Name 112 | HIBC Aztec Code 115 | DotCode 116 | Han Xin (Chinese Sensible) Code +121 | Royal Mail 4-state Mailmark 128 | Aztec Runes 129 | Code 32 130 | Composite Symbol with EAN linear component @@ -982,6 +983,7 @@ Value | 112 | BARCODE_HIBC_AZTEC | HIBC Aztec Code 115 | BARCODE_DOTCODE | DotCode 116 | BARCODE_HANXIN | Han Xin (Chinese Sensible) Code +121 | BARCODE_MAILMARK | Royal Mail 4-state Mailmark 128 | BARCODE_AZRUNE | Aztec Runes 129 | BARCODE_CODE32 | Code 32 130 | BARCODE_EANX_CC | Composite Symbol with EAN linear component @@ -1312,8 +1314,8 @@ This option adds a leading '+' character and a trailing modulo-49 check digit to a standard Code 39 symbol as required by the Health Industry Barcode standards. -6.1.8.8 Vehicle Identification Number -------------------------------------- +6.1.8.8 Vehicle Identification Number (VIN) +------------------------------------------- This option includes a verification stage for vehicle identification numbers used in North America which include a check digit. For European vehicle identification numbers use Standard Code 39. @@ -1719,7 +1721,14 @@ A-Z and usually includes delivery postcode followed by house number. For example "W1J0TR01" for 1 Picadilly Circus in London. Check digit data is generated by Zint. -6.5.4 USPS OneCode +6.5.4 Royal Mail 4-State Mailmark +--------------------------------- +Developed in 2014 as a replacement for RM4SCC this 4-state symbol includes +Reed Solomon error correction. Input is a pre-formatted alpanumeric string of +22 (for Barcode C) or 26 (for Barcode L) characters, producing a symbol with +66 or 78 bars respectively. + +6.5.5 USPS OneCode ------------------ Also known as the Intelligent Mail Barcode and used in the US by the United States Postal Service (USPS), the OneCode system replaced the PostNet and @@ -1737,7 +1746,7 @@ example all of the following inputs are valid data entries: "01234567094987654321-01234567891" -6.5.5 Japanese Postal Code +6.5.6 Japanese Postal Code -------------------------- Used for address data on mail items for Japan Post. Accepted values are 0-9, A-Z and Dash (-). A modulo 19 check digit is added by Zint. diff --git a/frontend/main.c b/frontend/main.c index be6a8b19..862647c6 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -50,23 +50,23 @@ void types(void) { "16: GS1-128 67: AP Routing 112: HIBC Aztec Code\n" "18: Codabar 68: AP Redirection 115: DotCode\n" "20: Code 128 69: ISBN 116: Han Xin Code\n" - "21: Leitcode 70: RM4SCC 128: Aztec Runes\n" - "22: Identcode 71: Data Matrix 129: Code 32\n" - "23: Code 16k 72: EAN-14 130: Comp EAN\n" - "24: Code 49 73: VIN (North America) 131: Comp GS1-128\n" - "25: Code 93 74: Codablock-F 132: Comp DataBar Omni\n" - "28: Flattermarken 75: NVE-18 133: Comp DataBar Ltd\n" - "29: GS1 DataBar Omni 76: Japanese Post 134: Comp DataBar ExpOm\n" - "30: GS1 DataBar Ltd 77: Korea Post 135: Comp UPC-A\n" - "31: GS1 DataBar ExpOm 79: GS1 DataBar Stack 136: Comp UPC-E\n" - "32: Telepen Alpha 80: GS1 DataBar Stack Omni 137: Comp DataBar Stack\n" - "34: UPC-A 81: GS1 DataBar ESO 138: Comp DataBar Stack Omni\n" - "35: UPC-A + Check 82: Planet 139: Comp DataBar ESO\n" - "37: UPC-E 84: MicroPDF 140: Channel Code\n" - "38: UPC-E + Check 85: USPS OneCode 141: Code One\n" - "40: Postnet 86: UK Plessey 142: Grid Matrix\n" - "47: MSI Plessey 87: Telepen Numeric 143: UPNQR\n" - "49: FIM 89: ITF-14\n" + "21: Leitcode 70: RM4SCC 121: RM Mailmark\n" + "22: Identcode 71: Data Matrix 128: Aztec Runes\n" + "23: Code 16k 72: EAN-14 129: Code 32\n" + "24: Code 49 73: VIN (North America) 130: Comp EAN\n" + "25: Code 93 74: Codablock-F 131: Comp GS1-128\n" + "28: Flattermarken 75: NVE-18 132: Comp DataBar Omni\n" + "29: GS1 DataBar Omni 76: Japanese Post 133: Comp DataBar Ltd\n" + "30: GS1 DataBar Ltd 77: Korea Post 134: Comp DataBar ExpOm\n" + "31: GS1 DataBar ExpOm 79: GS1 DataBar Stack 135: Comp UPC-A\n" + "32: Telepen Alpha 80: GS1 DataBar Stack Omni 136: Comp UPC-E\n" + "34: UPC-A 81: GS1 DataBar ESO 137: Comp DataBar Stack\n" + "35: UPC-A + Check 82: Planet 138: Comp DataBar Stack Omni\n" + "37: UPC-E 84: MicroPDF 139: Comp DataBar ESO\n" + "38: UPC-E + Check 85: USPS OneCode 140: Channel Code\n" + "40: Postnet 86: UK Plessey 141: Code One\n" + "47: MSI Plessey 87: Telepen Numeric 142: Grid Matrix\n" + "49: FIM 89: ITF-14 143: UPNQR\n" "50: Logmars 90: KIX Code\n" ); } diff --git a/frontend_qt/mainwindow.cpp b/frontend_qt/mainwindow.cpp index 60c34beb..e81ad348 100644 --- a/frontend_qt/mainwindow.cpp +++ b/frontend_qt/mainwindow.cpp @@ -102,6 +102,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags fl) "Postnet", "QR Code (ISO 18004)", "Royal Mail 4-state Barcode", + "Royal Mail 4-state Mailmark", "Telepen", "Telepen Numeric", "UK Plessey", @@ -268,7 +269,7 @@ void MainWindow::about() "

A free barcode generator" "

Instruction manual is available at the project homepage:
" "http://www.zint.org.uk" - "

Copyright © 2006-2017 Robin Stuart and others.
" + "

Copyright © 2006-2018 Robin Stuart and others.
" "Qt back end by BogDan Vatra
" "Windows port by Harald Oehlmann

" "

Qt version " QT_VERSION_STR diff --git a/frontend_qt/mainwindow.h b/frontend_qt/mainwindow.h index 7ce617a9..dbb2c6c7 100644 --- a/frontend_qt/mainwindow.h +++ b/frontend_qt/mainwindow.h @@ -97,6 +97,7 @@ public: POSTNET =40, QRCODE =58, RM4SCC =70, + MAILMARK =121, TELEPEN =32, TELEPEN_NUM =87, PLESSEY =86,