CODE93: add option_2 = 1 to display check chars in HRT

This commit is contained in:
gitlost 2021-09-13 18:49:25 +01:00
parent 86c15741d8
commit bd06400a5b
7 changed files with 56 additions and 20 deletions

View file

@ -10,6 +10,7 @@ Changes
-------
- RMQR: add ECI support
- CODE93: don't display check characters in HRT (as per standard Figure B1)
unless option_2 = 1 or vers=1
- GUI: separate out MAXICODE Structured Carrier Message fields
Bugs

View file

@ -517,6 +517,12 @@ INTERNAL int c93(struct zint_symbol *symbol, unsigned char source[], int length)
(void) set_height(symbol, 0.0f, height, 0.0f, 1 /*no_errtxt*/);
#endif
if (symbol->option_2 == 1) {
symbol->text[length] = set_copy[c];
symbol->text[length + 1] = set_copy[k];
symbol->text[length + 2] = '\0';
}
return error_number;
}

View file

@ -132,16 +132,18 @@ static void test_hrt(int index, int debug) {
/* 14*/ { BARCODE_LOGMARS, 1, "abc1234", -1, "ABC12340" }, // With check digit
/* 15*/ { BARCODE_LOGMARS, 1, "12345/ABCDE", -1, "12345/ABCDET" }, // With check digit
/* 16*/ { BARCODE_CODE93, -1, "ABC1234", -1, "ABC1234" }, // No longer shows 2 check chars added (same as BWIPP and TEC-IT)
/* 17*/ { BARCODE_CODE93, -1, "abc1234", -1, "abc1234" },
/* 18*/ { BARCODE_CODE93, -1, "A\001a\000b\177d\037e", 9, "A a b d e" }, // NUL, ctrls and DEL replaced with spaces
/* 19*/ { BARCODE_PZN, -1, "12345", -1, "PZN -00123458" }, // Pads with zeroes if length < 7
/* 20*/ { BARCODE_PZN, -1, "123456", -1, "PZN -01234562" },
/* 21*/ { BARCODE_PZN, -1, "1234567", -1, "PZN -12345678" },
/* 22*/ { BARCODE_VIN, -1, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180" },
/* 23*/ { BARCODE_VIN, 1, "2FTPX28L0XCA15511", -1, "2FTPX28L0XCA15511" }, // Include Import char - no change
/* 24*/ { BARCODE_HIBC_39, -1, "ABC1234", -1, "*+ABC1234+*" },
/* 25*/ { BARCODE_HIBC_39, -1, "abc1234", -1, "*+ABC1234+*" }, // Converts to upper
/* 26*/ { BARCODE_HIBC_39, -1, "123456789", -1, "*+1234567890*" },
/* 17*/ { BARCODE_CODE93, 1, "ABC1234", -1, "ABC1234S5" }, // Unless requested
/* 18*/ { BARCODE_CODE93, -1, "abc1234", -1, "abc1234" },
/* 19*/ { BARCODE_CODE93, 1, "abc1234", -1, "abc1234ZG" },
/* 20*/ { BARCODE_CODE93, -1, "A\001a\000b\177d\037e", 9, "A a b d e" }, // NUL, ctrls and DEL replaced with spaces
/* 21*/ { BARCODE_PZN, -1, "12345", -1, "PZN -00123458" }, // Pads with zeroes if length < 7
/* 22*/ { BARCODE_PZN, -1, "123456", -1, "PZN -01234562" },
/* 23*/ { BARCODE_PZN, -1, "1234567", -1, "PZN -12345678" },
/* 24*/ { BARCODE_VIN, -1, "1FTCR10UXTPA78180", -1, "1FTCR10UXTPA78180" },
/* 25*/ { BARCODE_VIN, 1, "2FTPX28L0XCA15511", -1, "2FTPX28L0XCA15511" }, // Include Import char - no change
/* 26*/ { BARCODE_HIBC_39, -1, "ABC1234", -1, "*+ABC1234+*" },
/* 27*/ { BARCODE_HIBC_39, -1, "abc1234", -1, "*+ABC1234+*" }, // Converts to upper
/* 28*/ { BARCODE_HIBC_39, -1, "123456789", -1, "*+1234567890*" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;

View file

@ -1561,8 +1561,8 @@ the Human Readable Text, set option_2 = 2 or --vers=2.
Used for baggage handling in the air-transport industry by the International
Air Transport Agency, this self-checking code will encode any length numeric
input (digits 0-9). No check digit is added by default. To add a check digit,
set option_2 = 1 or --vers=1. To add a check digit but not show it in the human
readable text, set option_2 = 2 or --vers=2.
set option_2 = 1 or --vers=1. To add a check digit but not show it in the Human
Readable Text, set option_2 = 2 or --vers=2.
6.1.2.3 Industrial Code 2 of 5
------------------------------
@ -1576,8 +1576,8 @@ option_2 = 2 or --vers=2.
This self-checking symbology encodes pairs of numbers, and so can only encode
an even number of digits (0-9). If an odd number of digits is entered a leading
zero is added by Zint. No check digit is added by default. To add a check digit,
set option_2 = 1 or --vers=1. To add a check digit but not show it in the human
readable text, set option_2 = 2 or --vers=2.
set option_2 = 1 or --vers=1. To add a check digit but not show it in the Human
Readable Text, set option_2 = 2 or --vers=2.
6.1.2.5 Code 2 of 5 Data Logic
------------------------------
@ -1769,7 +1769,9 @@ setting option_2 = 1 or using --vers=1.
6.1.8.3 Code 93
---------------
A variation of Extended Code 39, Code 93 also supports full ASCII text. Two
check digits are added by Zint.
check characters are added by Zint. By default these check characters are not
shown in the Human Readable Text, but may be shown by setting option_2 = 1 or
using vers=1.
6.1.8.4 PZN (Pharmazentralnummer)
---------------------------------

View file

@ -16,11 +16,11 @@ else()
qt5_wrap_ui(zint-qt_SRCS mainWindow.ui extData.ui extSequence.ui extExport.ui)
endif()
# grpAztec.ui grpC39.ui grpCodeOne.ui grpGrid.ui grpMQR.ui grpUltra.ui
# grpC11.ui grpC49.ui grpDAFT.ui grpHX.ui grpMSICheck.ui grpUPCA.ui
# grpC128.ui grpChannel.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpUPCEAN.ui
# grpC16k.ui grpCodabar.ui grpDM.ui grpMaxicode.ui grpQR.ui grpVIN.ui
# grpC25.ui grpCodablockF.ui grpDotCode.ui grpMicroPDF.ui grpRMQR.ui
# grpAztec.ui grpC39.ui grpCodablockF.ui grpDotCode.ui grpMicroPDF.ui grpRMQR.ui
# grpC11.ui grpC49.ui grpCodeOne.ui grpGrid.ui grpMQR.ui grpUltra.ui
# grpC128.ui grpC93.ui grpDAFT.ui grpHX.ui grpMSICheck.ui grpUPCA.ui
# grpC16k.ui grpChannel.ui grpDBExtend.ui grpLOGMARS.ui grpPDF417.ui grpUPCEAN.ui
# grpC25.ui grpCodabar.ui grpDM.ui grpMaxicode.ui grpQR.ui grpVIN.ui
add_executable(${PROJECT_NAME} ${zint-qt_SRCS} resources.qrc)

View file

@ -933,6 +933,15 @@ void MainWindow::change_options()
connect(m_optionWidget->findChild<QObject*>("cmbC49RowSepHeight"), SIGNAL(currentIndexChanged( int )), SLOT(update_preview()));
connect(m_optionWidget->findChild<QObject*>("radC49GS1"), SIGNAL(toggled( bool )), SLOT(update_preview()));
} else if (symbology == BARCODE_CODE93) {
QFile file(":/grpC93.ui");
if (file.open(QIODevice::ReadOnly)) {
m_optionWidget = uiload.load(&file);
file.close();
tabMain->insertTab(1, m_optionWidget, tr("Cod&e 93"));
connect(m_optionWidget->findChild<QObject*>("chkC93ShowChecks"), SIGNAL(clicked( bool )), SLOT(update_preview()));
}
} else if (symbology == BARCODE_DBAR_EXPSTK) {
QFile file(":/grpDBExtend.ui");
if (!file.open(QIODevice::ReadOnly))
@ -1596,6 +1605,13 @@ void MainWindow::update_preview()
}
break;
case BARCODE_CODE93:
m_bc.bc.setSymbol(BARCODE_CODE93);
if (get_checkbox_val("chkC93ShowChecks")) {
m_bc.bc.setOption2(1);
}
break;
case BARCODE_HANXIN:
m_bc.bc.setSymbol(BARCODE_HANXIN);
item_val = m_optionWidget->findChild<QComboBox*>("cmbHXSize")->currentIndex();
@ -2154,6 +2170,10 @@ void MainWindow::save_sub_settings(QSettings &settings, int symbology) {
settings.setValue("studio/bc/code49/encoding_mode", get_button_group_index(QStringList() << "radC49Stand" << "radC49GS1"));
break;
case BARCODE_CODE93:
settings.setValue("studio/bc/code93/chk_show_checks", get_checkbox_val("chkC93ShowChecks"));
break;
case BARCODE_DBAR_EXPSTK:
case BARCODE_DBAR_EXPSTK_CC:
settings.setValue("studio/bc/dbar_expstk/cols", get_combobox_index("cmbCols"));
@ -2410,6 +2430,10 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology) {
set_radiobutton_from_setting(settings, "studio/bc/code49/encoding_mode", QStringList() << "radC49Stand" << "radC49GS1");
break;
case BARCODE_CODE93:
set_checkbox_from_setting(settings, "studio/bc/code93/chk_show_checks", "chkC93ShowChecks");
break;
case BARCODE_DBAR_EXPSTK:
set_combobox_from_setting(settings, "studio/bc/dbar_expstk/cols", "cmbCols");
break;

View file

@ -7,6 +7,7 @@
<file>grpC25.ui</file>
<file>grpC39.ui</file>
<file>grpC49.ui</file>
<file>grpC93.ui</file>
<file>grpChannel.ui</file>
<file>grpCodabar.ui</file>
<file>grpCodablockF.ui</file>