Skip to content

Commit c093b1b

Browse files
committed
feat(code-one): add general versions A through H
1 parent aa6404f commit c093b1b

3 files changed

Lines changed: 435 additions & 4 deletions

File tree

docs/formats/code-one.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ The first reviewed slice implements the numeric Version S family: S-10 (up to 6
66

77
The second slice adds the 16-row Version T family (T-16, T-32 and T-48), GF(256) Reed-Solomon error correction, exact recognition patterns, automatic or forced T sizing, Latin-1 ASCII/digit-pair encoding, compact C40 symbols at exact capacity, and the full 90-digit T-48 Decimal payload. Other payloads always use valid ASCII codewords instead of an external encoder.
88

9+
The general family now covers Versions A through H, including all fixed geometries, interleaved GF(256) error-correction blocks, and automatic or forced sizing. Its high-level encoder supports ASCII, the basic C40 and Text character sets, EDI, Decimal, and Byte as explicit whole-payload modes. Automatic mode compares every compatible whole-payload encoding and uses the shortest one that fits. Shifted C40/Text characters and mixed mode switching inside one payload are the remaining optimizations; ASCII fallback keeps supported Latin-1 payloads valid in the meantime.
10+
911
```js
1012
import { CodeOneCore } from '../../libs/CodeOneCore.js'
1113
import { CodeOneSvgRenderer } from '../../libs/CodeOneSvg.js'
@@ -14,6 +16,19 @@ const symbol = new CodeOneCore('123456789012').generate()
1416
const svg = new CodeOneSvgRenderer(symbol).render()
1517

1618
const compact = new CodeOneCore('ABCDEFGHIJKLM', { version: 'T' }).generate()
19+
20+
const general = new CodeOneCore('gosgos', {
21+
version: 'A-H',
22+
mode: 'text',
23+
}).generate()
24+
25+
const unicode = new CodeOneCore('Grüße', {
26+
version: 'A-H',
27+
encoding: 'utf-8',
28+
eci: 26,
29+
}).generate()
1730
```
1831

19-
Versions A through H and the remaining Text/EDI/Byte high-level paths, GS1, ECI, and Structured Append remain the next implementation stages. Non-Latin-1 input is rejected until the ECI/Byte path is implemented; it is not silently converted or substituted.
32+
For GS1, pass the normalized element string and ASCII GS (`\x1D`) separators with `gs1: true`; parsing bracketed or parenthesized application identifiers belongs to a separate GS1 parser. Structured Append accepts `{ index, count }` with a count from 2 through 128 and cannot be combined with GS1. UTF-8 requires an explicit ECI assignment.
33+
34+
The remaining work is optimal mixed-mode segmentation and sharing the new control/high-level layer with Version T. Versions S deliberately reject GS1, ECI, and Structured Append, as required by their restricted numeric design. No production path loads Zint, BWIPP, or another barcode encoder.

0 commit comments

Comments
 (0)