1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! Codablock F (AIM ISS-X-24): a stacked Code 128 symbology. Each row is a Code 128
//! line carrying row-count/row-number indicator columns; the whole symbol is protected
//! by the K1/K2 data check characters.
//!
//! Layout:
//! - `tables` — the Code 128 symbol patterns and Stop pattern.
//! - `encode` — [`Symbol`] -> [`BitMatrix`], plus the fresh-input `build` path.
//! - `decode` — [`BitMatrix`] -> [`Symbol`].
//!
//! ## Symbol structure
//!
//! Every row is `columns` Code 128 symbols wide: Start Code A, a code-set selector, a
//! row indicator (the total row count in row 0, the row number elsewhere), `columns-5`
//! data symbols, a modulo-103 Code 128 row check, and the Stop pattern. The two K1/K2
//! data check characters (Annex F, computed over the whole payload) occupy the last two
//! data positions of the final row.
//!
//! ## Lossless round-trip
//!
//! [`CodablockFMeta`] stores the exact Code 128 codeword grid (`rows * columns`).
//! Re-encoding renders straight from that grid, so `encode(decode(x)) == x`. The payload
//! [`Segment`](crate::Segment) carried alongside is the decoded bytes and is not
//! consulted when re-encoding.
//!
//! ## Deviations
//!
//! The fresh-input layout ([`CodablockFEncoder::build`]) uses Code 128 sets A and B
//! (no Code C numeric compression, no extended-ASCII FNC4) for bytes `0..=127`, chooses
//! a roughly-square column count automatically, and always appends a dedicated final row
//! for the K1/K2 checks. The decoder is more general: it validates any A/B/C row layout,
//! so it can read symbols (e.g. zint's) that pack the checks into a data row.
//!
//! [`Symbol`]: crate::Symbol
//! [`BitMatrix`]: crate::output::BitMatrix
pub use CodablockFDecoder;
pub use CodablockFEncoder;
/// Parameters required to re-encode a Codablock F symbol identically (lossless
/// round-trip).
///
/// [`CodablockFMeta::codewords`] is the full row-major grid of Code 128 symbol values
/// (`rows * columns` entries), including the per-row start/selector/indicator columns,
/// the K1/K2 checks, the per-row modulo-103 check and the Stop value.