mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-09 13:41:59 -04: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:
parent
64fd01c73f
commit
e12c5ed3ba
11 changed files with 56 additions and 38 deletions
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Makefile for generating "manual.txt" and "manual.pdf" from "manual.pmd" and "zint.1" from "zint.1.pmd" using pandoc
|
||||
# Copyright (C) 2022-2024 <rstuart114@gmail.com>
|
||||
# Copyright (C) 2022-2025 <rstuart114@gmail.com>
|
||||
# vim: set ts=4 sw=4 noet :
|
||||
#
|
||||
# Requires a recent version of pandoc, plus pandoc-tablenos, xelatex and various other packages - see "README"
|
||||
|
@ -8,6 +8,7 @@
|
|||
SOURCE = manual.pmd
|
||||
OUT_PDF = manual.pdf
|
||||
OUT_TXT = manual.txt
|
||||
OUT_HTML = manual.html
|
||||
INC_HEADER_PDF = inc_header_pdf.tex
|
||||
INC_BEFORE_BODY_PDF = inc_before_body_pdf.tex
|
||||
INC_PDF = --include-in-header $(INC_HEADER_PDF) --include-before-body $(INC_BEFORE_BODY_PDF)
|
||||
|
@ -149,7 +150,7 @@ TEX_MAN_PAGE = zint.1.tex
|
|||
TXT_OPTS = --filter pandoc-tablenos -M tablenos-warning-level=0 --columns 80 --eol=lf -t plain
|
||||
MAN_PAGE_OPTS = -s -t man
|
||||
|
||||
all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN_PAGE)
|
||||
all : $(OUT_PDF) $(OUT_TXT) $(OUT_MAN_PAGE) $(OUT_HTML)
|
||||
|
||||
$(OUT_PDF) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PDF) $(IMAGES) Makefile
|
||||
pandoc $(SOURCE_MAN_PAGE) -f markdown \
|
||||
|
@ -199,7 +200,6 @@ manual.tex : $(SOURCE) $(SOURCE_MAN_PAGE) $(INC_HEADER_PDF) $(INC_BEFORE_BODY_PD
|
|||
|
||||
# HTML one-page (uses modified "templates/styles.html", unchanged "templates/default.html")
|
||||
|
||||
OUT_HTML = manual.html
|
||||
HTML_OPTS = --filter pandoc-tablenos -M tablenos-warning-level=0 --highlight-style=haddock \
|
||||
--template=templates/default.html --eol=lf -s -t html
|
||||
INC_BEFORE_BODY_HTML = inc_before_body_html.html
|
||||
|
|
|
@ -3963,8 +3963,8 @@ class="footnote-ref" id="fnref14" role="doc-noteref"><sup>14</sup></a>
|
|||
complete with any control characters<a href="#fn15" class="footnote-ref"
|
||||
id="fnref15" role="doc-noteref"><sup>15</sup></a> and check
|
||||
characters,<a href="#fn16" class="footnote-ref" id="fnref16"
|
||||
role="doc-noteref"><sup>16</sup></a> and for all linear symbologies,
|
||||
including those that normally don’t set it.</td>
|
||||
role="doc-noteref"><sup>16</sup></a> and for all linear and DataBar
|
||||
Stacked symbologies, including those that normally don’t set it.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -2341,8 +2341,8 @@ Value Effect
|
|||
|
||||
`BARCODE_RAW_TEXT` Set HRT with no decoration,[^14] complete with any
|
||||
control characters[^15] and check characters,[^16]
|
||||
and for all linear symbologies, including those
|
||||
that normally don't set it.
|
||||
and for all linear and DataBar Stacked symbologies,
|
||||
including those that normally don't set it.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Table: API `output_options` Values {#tbl:api_output_options tag="$ $"}
|
||||
|
|
|
@ -2324,8 +2324,8 @@ together when adjusting this value:
|
|||
|
||||
BARCODE_RAW_TEXT Set HRT with no decoration,[14] complete with any
|
||||
control characters[15] and check characters,[16]
|
||||
and for all linear symbologies, including those
|
||||
that normally don’t set it.
|
||||
and for all linear and DataBar Stacked symbologies,
|
||||
including those that normally don’t set it.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
: Table : API output_options Values
|
||||
|
|
|
@ -564,55 +564,55 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
|
|||
`--version`).
|
||||
|
||||
`-1`
|
||||
: Human Readable Text was outputted as raw text (`ZINT_WARN_HRT_RAW_TEXT`)
|
||||
: Human Readable Text was outputted as raw text (`ZINT_WARN_HRT_RAW_TEXT`)
|
||||
|
||||
`1`
|
||||
: Human Readable Text was truncated (maximum 199 bytes) (`ZINT_WARN_HRT_TRUNCATED`)
|
||||
: Human Readable Text was truncated (maximum 199 bytes) (`ZINT_WARN_HRT_TRUNCATED`)
|
||||
|
||||
`2`
|
||||
: Invalid option given but overridden by Zint (`ZINT_WARN_INVALID_OPTION`)
|
||||
: Invalid option given but overridden by Zint (`ZINT_WARN_INVALID_OPTION`)
|
||||
|
||||
`3`
|
||||
: Automatic ECI inserted by Zint (`ZINT_WARN_USES_ECI`)
|
||||
: Automatic ECI inserted by Zint (`ZINT_WARN_USES_ECI`)
|
||||
|
||||
`4`
|
||||
: Symbol created not compliant with standards (`ZINT_WARN_NONCOMPLIANT`)
|
||||
: Symbol created not compliant with standards (`ZINT_WARN_NONCOMPLIANT`)
|
||||
|
||||
`5`
|
||||
: Input data wrong length (`ZINT_ERROR_TOO_LONG`)
|
||||
: Input data wrong length (`ZINT_ERROR_TOO_LONG`)
|
||||
|
||||
`6`
|
||||
: Input data incorrect (`ZINT_ERROR_INVALID_DATA`)
|
||||
: Input data incorrect (`ZINT_ERROR_INVALID_DATA`)
|
||||
|
||||
`7`
|
||||
: Input check digit incorrect (`ZINT_ERROR_INVALID_CHECK`)
|
||||
: Input check digit incorrect (`ZINT_ERROR_INVALID_CHECK`)
|
||||
|
||||
`8`
|
||||
: Incorrect option given (`ZINT_ERROR_INVALID_OPTION`)
|
||||
: Incorrect option given (`ZINT_ERROR_INVALID_OPTION`)
|
||||
|
||||
`9`
|
||||
: Internal error (should not happen) (`ZINT_ERROR_ENCODING_PROBLEM`)
|
||||
: Internal error (should not happen) (`ZINT_ERROR_ENCODING_PROBLEM`)
|
||||
|
||||
`10`
|
||||
: Error opening output file (`ZINT_ERROR_FILE_ACCESS`)
|
||||
: Error opening output file (`ZINT_ERROR_FILE_ACCESS`)
|
||||
|
||||
`11`
|
||||
: Memory allocation (malloc) failure (`ZINT_ERROR_MEMORY`)
|
||||
: Memory allocation (malloc) failure (`ZINT_ERROR_MEMORY`)
|
||||
|
||||
`12`
|
||||
: Error writing to output file (`ZINT_ERROR_FILE_WRITE`)
|
||||
: Error writing to output file (`ZINT_ERROR_FILE_WRITE`)
|
||||
|
||||
`13`
|
||||
: Error counterpart of warning if `--werror` given (`ZINT_ERROR_USES_ECI`)
|
||||
|
||||
`14`
|
||||
: Error counterpart of warning if `--werror` given (`ZINT_ERROR_NONCOMPLIANT`)
|
||||
: Error counterpart of warning if `--werror` given (`ZINT_ERROR_NONCOMPLIANT`)
|
||||
|
||||
`15`
|
||||
: Error counterpart of warning if `--werror` given (`ZINT_ERROR_HRT_TRUNCATED`)
|
||||
: Error counterpart of warning if `--werror` given (`ZINT_ERROR_HRT_TRUNCATED`)
|
||||
|
||||
`16`
|
||||
: Error counterpart of warning if `--werror` given (`ZINT_ERROR_HRT_RAW_TEXT`)
|
||||
: Error counterpart of warning if `--werror` given (`ZINT_ERROR_HRT_RAW_TEXT`)
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
|
|
|
@ -376,8 +376,8 @@ version_replace(2, $data_dirname . 'win32/vs2019/zint.vcxproj', '/ZINT_VERSION="
|
|||
|
||||
print PHP_EOL;
|
||||
print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' . PHP_EOL;
|
||||
print '!!! REMEMBER: update release date in manual and man page !!!' . PHP_EOL;
|
||||
print '!!! REMEMBER: cd docs; make; make manual.html !!!' . PHP_EOL;
|
||||
print '!!! REMEMBER: update release date in manual !!!' . PHP_EOL;
|
||||
print '!!! REMEMBER: cd docs; make !!!' . PHP_EOL;
|
||||
print '!!! REMEMBER: run "autoconf" and "./configure" in "backend_tcl/" !!!' . PHP_EOL;
|
||||
print '!!! REMEMBER: update version and date in "ChangeLog" !!!' . PHP_EOL;
|
||||
print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' . PHP_EOL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue