mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
2018-08-30 HaO Implemented GS separator for Datamatrix (--gssep option). Ticket #139
This commit is contained in:
parent
128a6f43d6
commit
cb3eea2ba0
@ -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) {
|
||||||
|
if (symbol->output_options & GS1_GS_SEPARATOR) {
|
||||||
|
gs1 = 2;
|
||||||
|
} else {
|
||||||
gs1 = 1;
|
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] == '[')) {
|
||||||
|
if (gs1==2) {
|
||||||
|
target[tp] = 29+1; /* GS */
|
||||||
|
if (debug) printf("GS ");
|
||||||
|
} else {
|
||||||
target[tp] = 232; /* FNC1 */
|
target[tp] = 232; /* FNC1 */
|
||||||
if (debug) printf("FN1 ");
|
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,9 +740,14 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gs1 && (source[sp] == '[')) {
|
if (gs1 && (source[sp] == '[')) {
|
||||||
|
if (gs1 == 2) {
|
||||||
|
shift_set = c40_shift[29];
|
||||||
|
value = c40_value[29]; /* GS */
|
||||||
|
} else {
|
||||||
shift_set = 2;
|
shift_set = 2;
|
||||||
value = 27; /* FNC1 */
|
value = 27; /* FNC1 */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (shift_set != 0) {
|
if (shift_set != 0) {
|
||||||
process_buffer[*process_p] = shift_set - 1;
|
process_buffer[*process_p] = shift_set - 1;
|
||||||
@ -791,9 +808,14 @@ static int dm200encode(struct zint_symbol *symbol, const unsigned char source[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (gs1 && (source[sp] == '[')) {
|
if (gs1 && (source[sp] == '[')) {
|
||||||
|
if (gs1 == 2) {
|
||||||
|
shift_set = text_shift[29];
|
||||||
|
value = text_value[29]; /* GS */
|
||||||
|
} else {
|
||||||
shift_set = 2;
|
shift_set = 2;
|
||||||
value = 27; /* FNC1 */
|
value = 27; /* FNC1 */
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (shift_set != 0) {
|
if (shift_set != 0) {
|
||||||
process_buffer[*process_p] = shift_set - 1;
|
process_buffer[*process_p] = shift_set - 1;
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -97,6 +97,7 @@ void usage(void) {
|
|||||||
" --filetype=TYPE Set output file type (PNG/EPS/SVG/PNG/EPS/GIF/TXT)\n"
|
" --filetype=TYPE Set output file type (PNG/EPS/SVG/PNG/EPS/GIF/TXT)\n"
|
||||||
" --fg=COLOUR Specify a foreground colour (in hex)\n"
|
" --fg=COLOUR Specify a foreground colour (in hex)\n"
|
||||||
" --gs1 Treat input as GS1 compatible data\n"
|
" --gs1 Treat input as GS1 compatible data\n"
|
||||||
|
" --gssep Use separator GS for GS1\n"
|
||||||
" -h, --help Display help message\n"
|
" -h, --help Display help message\n"
|
||||||
" --height=NUMBER Set height of symbol in multiples of x-dimension\n"
|
" --height=NUMBER Set height of symbol in multiples of x-dimension\n"
|
||||||
" -i, --input=FILE Read input data from FILE\n"
|
" -i, --input=FILE Read input data from FILE\n"
|
||||||
@ -432,6 +433,7 @@ int main(int argc, char **argv) {
|
|||||||
{"primary", 1, 0, 0},
|
{"primary", 1, 0, 0},
|
||||||
{"scale", 1, 0, 0},
|
{"scale", 1, 0, 0},
|
||||||
{"gs1", 0, 0, 0},
|
{"gs1", 0, 0, 0},
|
||||||
|
{"gssep", 0, 0, 0},
|
||||||
{"binary", 0, 0, 0},
|
{"binary", 0, 0, 0},
|
||||||
{"notext", 0, 0, 0},
|
{"notext", 0, 0, 0},
|
||||||
{"square", 0, 0, 0},
|
{"square", 0, 0, 0},
|
||||||
@ -477,6 +479,9 @@ int main(int argc, char **argv) {
|
|||||||
if (!strcmp(long_options[option_index].name, "dotty")) {
|
if (!strcmp(long_options[option_index].name, "dotty")) {
|
||||||
my_symbol->output_options += BARCODE_DOTTY_MODE;
|
my_symbol->output_options += BARCODE_DOTTY_MODE;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(long_options[option_index].name, "gssep")) {
|
||||||
|
my_symbol->output_options += GS1_GS_SEPARATOR;
|
||||||
|
}
|
||||||
if (!strcmp(long_options[option_index].name, "direct")) {
|
if (!strcmp(long_options[option_index].name, "direct")) {
|
||||||
my_symbol->output_options += BARCODE_STDOUT;
|
my_symbol->output_options += BARCODE_STDOUT;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user