From 1f57c58e0c3dad48f341f3fa2e702d02e81a4ac1 Mon Sep 17 00:00:00 2001 From: Robin Stuart Date: Thu, 30 Jul 2020 10:09:17 +0100 Subject: [PATCH] Allow explicit bind option for ITF-14 Allows for 'printing methods that do not require printing plates' as highlighted by Adham Elrayyes (Ticket #201) --- backend/2of5.c | 11 +++++++---- docs/manual.txt | 17 ++++++++++++++--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/backend/2of5.c b/backend/2of5.c index 26ef5e4e..1fd5fc16 100644 --- a/backend/2of5.c +++ b/backend/2of5.c @@ -280,10 +280,13 @@ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int lengt error_number = interleaved_two_of_five(symbol, (unsigned char *) localstr, strlen(localstr)); ustrcpy(symbol->text, localstr); - symbol->output_options |= BARCODE_BOX; - if (symbol->border_width == 0) { /* Allow override if non-zero */ - /* GS1 General Specifications 20.0 Sections 5.3.2.4 & 5.3.6 (4.83 / 1.016 ~ 4.75) */ - symbol->border_width = 5; /* Note change from previous value 8 */ + if (!((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND))) { + // If no option has been selected then uses default box option + symbol->output_options |= BARCODE_BOX; + if (symbol->border_width == 0) { /* Allow override if non-zero */ + /* GS1 General Specifications 20.0 Sections 5.3.2.4 & 5.3.6 (4.83 / 1.016 ~ 4.75) */ + symbol->border_width = 5; /* Note change from previous value 8 */ + } } return error_number; diff --git a/docs/manual.txt b/docs/manual.txt index 7f561ed4..df7a659c 100644 --- a/docs/manual.txt +++ b/docs/manual.txt @@ -369,7 +369,7 @@ Zint allows the symbol to be bound with 'boundary bars' using the option --bind. These bars help to prevent misreading of the symbol by corrupting a scan if the scanning beam strays off the top or bottom of the symbol. Zint can also put a border right around the symbol and its whitespace with the --box -option. This option is automatically selected for ITF-14 symbols. +option. The width of the boundary or box can be specified using the --border switch. For example: @@ -378,6 +378,9 @@ zint --box --border=10 -d "This" gives a box with a width 10 times the X-dimension of the symbol. +These options are ignored for Code 16k and Codablock-F. Special considerations +apply to ITF-14 - see the specific section for that symbology. + 4.7 Using colour ---------------- The default colours of a symbol are a black symbol on a white background. Zint @@ -1092,7 +1095,7 @@ Value | -------------------------------------------------------------------------------- Note: Symbologies marked with an asterisk (*) in the above table used different -enumeration in Zint before version 2.9.0. For example, symbology 29 used the name +names in Zint before version 2.9.0. For example, symbology 29 used the name "BARCODE_RSS14". These names are now depreciated but are still recognised by Zint and will continue to be supported in future versions. @@ -1168,7 +1171,8 @@ if (ZBarcode_ValidID(BARCODE_PDF417) != 0) { USPS Intelligent Mail, RM4SCC, PDF417, Data Matrix, Maxicode, QR Code, GS1 DataBar Stacked, PDF417 and MicroPDF417 - all of which have a fixed height. -[2] This value is ignored for Code 16k, Codablock-F and ITF-14 symbols. +[2] This value is ignored for Code 16k and Codablock-F. Special considerations +apply to ITF-14 - see the specific section for that symbology. 6. Types of Symbology ===================== @@ -1226,6 +1230,13 @@ ITF-14, also known as UPC Shipping Container Symbol or Case Code is based on Interleaved Code 2 of 5 and requires a 13 digit numeric input (digits 0-9). One modulo-10 check digit is added by Zint. +If no border option is specified Zint defaults to adding a bounding box with a +border width of 5. This behaviour can be overridden by using the --bind otion +(or adding BARCODE_BIND to symbol->output_options). Similarly the border width +can be overriden using --border= (or by setting symbol->border_width). If a +symbol with no border is explicitly required this can be achieved by setting +the border type to box or bind and setting the border width to 0. + 6.1.2.7 Deutsche Post Leitcode ------------------------------ Leitcode is based on Interleaved Code 2 of 5 and is used by Deutsche Post for