1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-07-31 10:29:52 +00:00

DBAR_STK/DBAR_OMNSTK/DBAR_EXPSTK (including composites): output HRT

if `BARCODE_RAW_TEXT`
manual: default to always making html
This commit is contained in:
gitlost
2025-03-10 01:22:52 +00:00
parent 64fd01c73f
commit e12c5ed3ba
11 changed files with 56 additions and 38 deletions
+13
View File
@@ -291,6 +291,7 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
int latch;
int separator_row;
int widths[4];
const int raw_text = symbol->output_options & BARCODE_RAW_TEXT;
separator_row = 0;
@@ -547,6 +548,10 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
symbol->width = 50;
}
if (raw_text) {
dbar_set_gtin14_hrt(symbol, source, length);
}
if (symbol->symbology != BARCODE_DBAR_STK_CC) { /* Composite calls dbar_omnstk_set_height() itself */
error_number = dbar_omnstk_set_height(symbol, 0 /*first_row*/);
}
@@ -595,6 +600,10 @@ INTERNAL int dbar_omn_cc(struct zint_symbol *symbol, unsigned char source[], int
}
symbol->rows = symbol->rows + 1;
if (raw_text) {
dbar_set_gtin14_hrt(symbol, source, length);
}
/* ISO/IEC 24724:2011 5.3.2.2 minimum 33X height per row */
if (symbol->symbology == BARCODE_DBAR_OMNSTK_CC) {
symbol->height = symbol->height ? 33.0f : 66.0f; /* Pass back min row or default height */
@@ -1583,6 +1592,10 @@ INTERNAL int dbar_exp_cc(struct zint_symbol *symbol, unsigned char source[], int
symbol->rows = symbol->rows + 4;
}
symbol->rows = symbol->rows - 3;
if (raw_text) {
hrt_cpy_nochk(symbol, reduced, reduced_length);
}
}
if (symbol->symbology == BARCODE_DBAR_EXP_CC || symbol->symbology == BARCODE_DBAR_EXPSTK_CC) {
+2 -2
View File
@@ -3275,9 +3275,9 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 43*/ { BARCODE_UPCE_CC, -1, -1, "1234567+2", "[20]12", 0, "12345670+02" },
/* 44*/ { BARCODE_UPCE_CC, -1, BARCODE_RAW_TEXT, "1234567+2", "[20]12", 0, "12345670+02" },
/* 45*/ { BARCODE_DBAR_STK_CC, -1, -1, "12345678901231", "[20]12", 0, "" }, /* No HRT for stacked symbologies */
/* 46*/ { BARCODE_DBAR_STK_CC, -1, BARCODE_RAW_TEXT, "12345678901231", "[20]12", 0, "" },
/* 46*/ { BARCODE_DBAR_STK_CC, -1, BARCODE_RAW_TEXT, "12345678901231", "[20]12", 0, "0112345678901231" }, /* Unless RAW_TEXT */
/* 47*/ { BARCODE_DBAR_OMNSTK_CC, -1, -1, "12345678901231", "[20]12", 0, "" },
/* 48*/ { BARCODE_DBAR_OMNSTK_CC, -1, BARCODE_RAW_TEXT, "12345678901231", "[20]12", 0, "" },
/* 48*/ { BARCODE_DBAR_OMNSTK_CC, -1, BARCODE_RAW_TEXT, "12345678901231", "[20]12", 0, "0112345678901231" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, composite_length, ret;
+9 -5
View File
@@ -353,12 +353,16 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 76*/ { BARCODE_DBAR_EXP_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[20]12[21]12345", "[21]12345", 0, "011234567890123120122112345" },
/* 77*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "" },
/* 78*/ { BARCODE_DBAR_EXPSTK, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "", 0, "" },
/* 79*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "" },
/* 79*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "", ZINT_WARN_NONCOMPLIANT, "01123456789012342012" },
/* 80*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[20]12", "", 0, "" },
/* 81*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "" },
/* 82*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "" },
/* 83*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "" },
/* 84*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "" },
/* 81*/ { BARCODE_DBAR_EXPSTK, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "" },
/* 82*/ { BARCODE_DBAR_EXPSTK, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "", 0, "011234567890123110AB\035201290ABC20)12" },
/* 83*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "" },
/* 84*/ { BARCODE_DBAR_EXPSTK_CC, GS1NOCHECK_MODE, -1, "[01]12345678901234[20]12", "[21]12345", 0, "" },
/* 85*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901234[20]12", "[21]12345", ZINT_WARN_NONCOMPLIANT, "01123456789012342012" },
/* 86*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[20]12", "[21]12345", 0, "" },
/* 87*/ { BARCODE_DBAR_EXPSTK_CC, -1, -1, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "" },
/* 88*/ { BARCODE_DBAR_EXPSTK_CC, -1, BARCODE_RAW_TEXT, "[01]12345678901231[10]AB[20]12[90]ABC20)12", "[21]12345", 0, "011234567890123110AB\035201290ABC20)12" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
+3 -3
View File
@@ -1322,11 +1322,11 @@ static void test_hrt(const testCtx *const p_ctx) {
/* 10*/ { BARCODE_DBAR_EXP, -1, "[01]12345678901231", 0, "(01)12345678901231" }, /* See test_hrt() in "test_gs1.c" for full HRT tests */
/* 11*/ { BARCODE_DBAR_EXP, BARCODE_RAW_TEXT, "[01]12345678901231", 0, "0112345678901231" },
/* 12*/ { BARCODE_DBAR_STK, -1, "12345678901231", 0, "" }, /* No HRT for stacked */
/* 13*/ { BARCODE_DBAR_STK, BARCODE_RAW_TEXT, "12345678901231", 0, "" },
/* 13*/ { BARCODE_DBAR_STK, BARCODE_RAW_TEXT, "12345678901231", 0, "0112345678901231" }, /* Unless RAW_TEXT */
/* 14*/ { BARCODE_DBAR_OMNSTK, -1, "10000000000090", 0, "" },
/* 15*/ { BARCODE_DBAR_OMNSTK, BARCODE_RAW_TEXT, "10000000000090", 0, "" },
/* 15*/ { BARCODE_DBAR_OMNSTK, BARCODE_RAW_TEXT, "10000000000090", 0, "0110000000000090" },
/* 16*/ { BARCODE_DBAR_EXPSTK, -1, "[01]12345678901231", 0, "" },
/* 17*/ { BARCODE_DBAR_EXPSTK, BARCODE_RAW_TEXT, "[01]12345678901231", 0, "" },
/* 17*/ { BARCODE_DBAR_EXPSTK, BARCODE_RAW_TEXT, "[01]12345678901231", 0, "0112345678901231" },
};
const int data_size = ARRAY_SIZE(data);
int i, length, ret;
+2 -1
View File
@@ -301,7 +301,8 @@ extern "C" {
#define BARCODE_MEMORY_FILE 0x10000 /* Write output to in-memory buffer `memfile` instead of to `outfile` */
#define BARCODE_RAW_TEXT 0x20000 /* Set HRT with no decoration (GS1 data will not have parentheses but GS
separators as needed), complete with any control chars and check chars, and
for all linear symbologies, including those that normally don't set it */
for all linear and DataBar Stacked symbologies, including those that
normally don't set it */
/* Input data types (`symbol->input_mode`) */
#define DATA_MODE 0 /* Binary */