2018-08-30 HaO Implemented GS separator for Datamatrix (--gssep option). Ticket #139

This commit is contained in:
Harald Oehlmann 2019-08-30 16:14:17 +02:00
parent 128a6f43d6
commit cb3eea2ba0
4 changed files with 836 additions and 803 deletions

View File

@ -435,12 +435,14 @@ static int look_ahead_test(const unsigned char inputData[], const size_t sourcel
edf_count += 13.0F; // (p)(3) > Value changed from ISO edf_count += 13.0F; // (p)(3) > Value changed from ISO
} }
} }
if ((gs1 == 1) && (inputData[sp] == '[')) { if (gs1 && (inputData[sp] == '[')) {
/* fnc1 and gs have the same weight of 13.0f */
edf_count += 13.0F; // > Value changed from ISO edf_count += 13.0F; // > Value changed from ISO
} }
/* base 256 ... step (q) */ /* base 256 ... step (q) */
if ((gs1 == 1) && (inputData[sp] == '[')) { if ((gs1 == 1) && (inputData[sp] == '[')) {
/* FNC1 separator */
b256_count += 4.0F; // (q)(1) b256_count += 4.0F; // (q)(1)
} else { } else {
b256_count += 1.0F; // (q)(2) b256_count += 1.0F; // (q)(2)
@ -549,8 +551,13 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
current_mode = DM_ASCII; current_mode = DM_ASCII;
next_mode = DM_ASCII; next_mode = DM_ASCII;
/* gs1 flag values: 0: no gs1, 1: gs1 with FNC1 serparator, 2: GS separator */
if (symbol->input_mode == GS1_MODE) { if (symbol->input_mode == GS1_MODE) {
gs1 = 1; if (symbol->output_options & GS1_GS_SEPARATOR) {
gs1 = 2;
} else {
gs1 = 1;
}
} else { } else {
gs1 = 0; gs1 = 0;
} }
@ -684,8 +691,13 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
strcat(binary, " "); strcat(binary, " ");
} else { } else {
if (gs1 && (source[sp] == '[')) { if (gs1 && (source[sp] == '[')) {
target[tp] = 232; /* FNC1 */ if (gs1==2) {
if (debug) printf("FN1 "); target[tp] = 29+1; /* GS */
if (debug) printf("GS ");
} else {
target[tp] = 232; /* FNC1 */
if (debug) printf("FN1 ");
}
} else { } else {
target[tp] = source[sp] + 1; target[tp] = source[sp] + 1;
if (debug) printf("A%02X ", target[tp] - 1); if (debug) printf("A%02X ", target[tp] - 1);
@ -728,8 +740,13 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
} }
if (gs1 && (source[sp] == '[')) { if (gs1 && (source[sp] == '[')) {
shift_set = 2; if (gs1 == 2) {
value = 27; /* FNC1 */ shift_set = c40_shift[29];
value = c40_value[29]; /* GS */
} else {
shift_set = 2;
value = 27; /* FNC1 */
}
} }
if (shift_set != 0) { if (shift_set != 0) {
@ -791,8 +808,13 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
} }
if (gs1 && (source[sp] == '[')) { if (gs1 && (source[sp] == '[')) {
shift_set = 2; if (gs1 == 2) {
value = 27; /* FNC1 */ shift_set = text_shift[29];
value = text_value[29]; /* GS */
} else {
shift_set = 2;
value = 27; /* FNC1 */
}
} }
if (shift_set != 0) { if (shift_set != 0) {

View File

@ -253,6 +253,7 @@ extern "C" {
#define BOLD_TEXT 64 #define BOLD_TEXT 64
#define CMYK_COLOUR 128 #define CMYK_COLOUR 128
#define BARCODE_DOTTY_MODE 256 #define BARCODE_DOTTY_MODE 256
#define GS1_GS_SEPARATOR 512
// Input data types // Input data types
#define DATA_MODE 0 #define DATA_MODE 0

View File

@ -418,7 +418,7 @@ GS1 data can be encoded in a number of symbologies. Application identifiers
should be enclosed in [square brackets] followed by the data to be encoded (see should be enclosed in [square brackets] followed by the data to be encoded (see
5.1.12.3). To encode GS1 data use the --gs1 option. GS1 mode is assumed (and 5.1.12.3). To encode GS1 data use the --gs1 option. GS1 mode is assumed (and
doesn't need to be set) for EAN-128, DataBar and Composite symbologies but is doesn't need to be set) for EAN-128, DataBar and Composite symbologies but is
also available for Code 16k, Data Matrix, Aztec Code, DotCode and QR Code. also available for Code 16k, Data Matrix, Aztec Code, DotCode and QR Code.
HIBC data may also be encoded in the symbologies Code 39, Code128, Codablock-F, HIBC data may also be encoded in the symbologies Code 39, Code128, Codablock-F,
Datamatrix, QR-Code, PDF417 and Aztec-Code. Within this mode, the leading '+' and the Datamatrix, QR-Code, PDF417 and Aztec-Code. Within this mode, the leading '+' and the
@ -1052,6 +1052,7 @@ BOLD_TEXT | Embolden the human readable text.
CMYK_COLOUR | Select the CMYK colour space option for encapsulated CMYK_COLOUR | Select the CMYK colour space option for encapsulated
| PostScript files. | PostScript files.
BARCODE_DOTTY_MODE | Plot a matrix symbol using dots rather than squares. BARCODE_DOTTY_MODE | Plot a matrix symbol using dots rather than squares.
GS1_GS_SEPARATOR | Use GS instead FNC1 as GS1 separator.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
5.9 Setting the Input Mode 5.9 Setting the Input Mode
@ -1847,6 +1848,10 @@ Input | Symbol Size
DMRE symbol sizes may be activated in automatic size mode using the option DMRE symbol sizes may be activated in automatic size mode using the option
--dmre or by the API option_3 = DM_DMRE --dmre or by the API option_3 = DM_DMRE
GS1 symbology may use FNC1 (prefered) or GS as separator.
Use the option --gssep to change to GS or use the API
output_options+=GS1_GS_SEPARATOR
6.6.2 QR Code (ISO 18004) 6.6.2 QR Code (ISO 18004)
------------------------- -------------------------
Also known as Quick Response Code this symbology was developed by Denso. Four Also known as Quick Response Code this symbology was developed by Denso. Four

File diff suppressed because it is too large Load Diff