1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-05-01 19:55:29 +00:00

CODE128: optimize for extended ASCII as well using techniques from

BWIPP minimal encoding by Bue Jensen (BWIPP PR #278);
  new extra escape `\^@` to turn off manual switching
zint.h: increase `symbol->text` size 200 -> 256 (means that for
  the moment can no longer generate ZINT_WARN_HRT_TRUNCATED)
GS1_128/GS1_128_CC: warn if READER_INIT option used
CODE16K: move `c16k_set_a/b/c()` routines from "code128.c" and
  rename `c16k_` (also `C128_` defines to `C16K_`)
common: make `itoc()` simple macro which adds '0' (>= 10 now ':',
  ';' etc) and adjust `expand()` accordingly for slight speed-up
general: EXTRA_ESCAPE_MODE now implies ESCAPE_MODE
tests: update BWIPP to latest and enable CODE128AB ("suppressc");
  new test args '-n' (exclude func) and '-m' (match func)
This commit is contained in:
gitlost
2024-11-18 05:08:52 +00:00
parent c9909d3d91
commit 86b6a0553b
23 changed files with 1113 additions and 1017 deletions

View File

@@ -332,7 +332,7 @@
<h1 class="title">Zint Barcode Generator and Zint Barcode Studio User
Manual</h1>
<p class="author">Version 2.13.0.9</p>
<p class="date">October 2024</p>
<p class="date">November 2024</p>
</header>
<nav id="TOC" role="doc-toc">
<ul>
@@ -3679,7 +3679,7 @@ data-tag=": API Warning and Error Return Values">
<tr>
<td style="text-align: left;"><code>ZINT_WARN_HRT_TRUNCATED</code></td>
<td style="text-align: left;">The Human Readable Text returned in
<code>text</code> was truncated (maximum 199 bytes).</td>
<code>text</code> was truncated (maximum 255 bytes).</td>
</tr>
<tr>
<td style="text-align: left;"><code>ZINT_WARN_INVALID_OPTION</code></td>
@@ -4816,21 +4816,27 @@ aria-hidden="true"><code>zint -b CODE128 --bind -d "130170X178"</code></figcapti
128 was developed in 1981 by Computer Identics. This symbology supports
full ASCII text and uses a three-Code Set system to compress the data
into a smaller symbol. Zint automatically switches between Code Sets A,
B and C (but see following) and adds a hidden modulo-103 check
digit.</p>
B and C (but see below) and adds a hidden modulo-103 check digit.</p>
<p>Code 128 is the default barcode symbology used by Zint. In addition
Zint supports the encoding of ISO/IEC 8859-1 (non-English) characters in
Code 128 symbols. The ISO/IEC 8859-1 character set is shown in Annex <a
href="#a.2-latin-alphabet-no.-1-isoiec-8859-1">A.2 Latin Alphabet No. 1
(ISO/IEC 8859-1)</a>.</p>
<p>Manual switching of Code Sets is possible using the
<code>--extraesc</code> option (API
<code>input_mode |= EXTRA_ESCAPE_MODE</code>) and the Code 128-specific
escapes <code>\^A</code>, <code>\^B</code>, <code>\^C</code>. For
<code>input_mode |= EXTRA_ESCAPE_MODE</code>), which apart from
processing normal escape sequences also processes the Code 128-specific
escapes <code>\^A</code>, <code>\^B</code>, <code>\^C</code> and
<code>\^@</code> (the latter turns off manual Code Set selection). For
instance the following will force switching to Code Set B for the data
<code>"5678"</code> (normally Code Set C would be used throughout):</p>
<div class="sourceCode" id="cb99"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb99-1"><a href="#cb99-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> CODE128 <span class="at">-d</span> <span class="st">&quot;1234\^B5678&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
<p>The manually selected Code Set will apply until the next Code Set
escape sequence, with the exception that data that cannot be represented
in that Code Set will be switched as appropriate. If the data contains a
special code sequence, it can be escaped by doubling the caret
(<code>^</code>). For instance</p>
escape sequence or until a <code>\^@</code>, with the exception that
data that cannot be represented in that Code Set will be switched as
appropriate. If the data contains an extra escape sequence, it can be
escaped by doubling the caret (<code>^</code>). For instance</p>
<div class="sourceCode" id="cb100"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb100-1"><a href="#cb100-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> CODE128 <span class="at">-d</span> <span class="st">&quot;\^AABC\^^BDEF&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
<p>will encode the data <code>"ABC\^BDEF"</code> in Code Set A.</p>
@@ -4839,13 +4845,9 @@ special Function Code 1 character (FNC1) anywhere you chose in the data,
for instance</p>
<div class="sourceCode" id="cb101"><pre
class="sourceCode bash"><code class="sourceCode bash"><span id="cb101-1"><a href="#cb101-1" aria-hidden="true" tabindex="-1"></a><span class="ex">zint</span> <span class="at">-b</span> CODE128 <span class="at">-d</span> <span class="st">&quot;A\^1BC\^1DEF&quot;</span> <span class="at">--extraesc</span></span></code></pre></div>
<p>Code 128 is the default barcode symbology used by Zint. In addition
Zint supports the encoding of ISO/IEC 8859-1 (non-English) characters in
Code 128 symbols. The ISO/IEC 8859-1 character set is shown in Annex <a
href="#a.2-latin-alphabet-no.-1-isoiec-8859-1">A.2 Latin Alphabet No. 1
(ISO/IEC 8859-1)</a>.</p>
<p>Zint can encode a maximum of 99 symbol characters, which allows for
e.g. 198 all-numeric characters.</p>
<p>Zint can encode a maximum of 102 symbol characters, which allows for
e.g. 202 all-numeric or 101 all-uppercase characters. Sizes above 120
digits (60 alphanumerics) are not recommended.</p>
<h4 id="code-128-suppress-code-set-c-code-sets-a-and-b-only">6.1.10.2
Code 128 Suppress Code Set C (Code Sets A and B only)</h4>
<figure>
@@ -8900,12 +8902,14 @@ are:</p>
</dd>
<dt><code>--extraesc</code></dt>
<dd>
<p>For Code 128 only, process the special escape sequences
<code>\^A</code>, <code>\^B</code> and <code>\^C</code> that allow
<p>For Code 128 only, as well as processing the normal escape sequences
above, process the special escape sequences <code>\^A</code>,
<code>\^B</code>, <code>\^C</code> and <code>\^@</code> that allow
manual switching of Code Sets, and the special escape sequence
<code>\^1</code> that inserts an <code>FNC1</code> character. The
sequence <code>\^^</code> can be used to encode data that contains
special escape sequences.</p>
sequence <code>\@</code> turns off manual switching. The sequence
<code>\^^</code> can be used to encode data that contains special escape
sequences.</p>
</dd>
<dt><code>--fast</code></dt>
<dd>