mirror of
https://git.code.sf.net/p/zint/code
synced 2025-12-21 11:57:04 +00:00
Add convenience API funcs ZBarcode_UTF8_To_ECI() and
`ZBarcode_Dest_Len_ECI()`, primarily for ZXingC++ but also useful in general
This commit is contained in:
@@ -2482,8 +2482,8 @@ being the number of elements it contains. The zint_seg structure is of the form:
|
||||
```c
|
||||
struct zint_seg {
|
||||
unsigned char *source; /* Data to encode */
|
||||
int length; /* Length of `source`. If 0, `source` must be
|
||||
NUL-terminated */
|
||||
int length; /* Length of `source`. If 0 or negative, `source`
|
||||
must be NUL-terminated */
|
||||
int eci; /* Extended Channel Interpretation */
|
||||
};
|
||||
```
|
||||
@@ -2669,7 +2669,34 @@ if (cap & ZINT_CAP_ECI) {
|
||||
}
|
||||
```
|
||||
|
||||
## 5.16 Zint Version
|
||||
## 5.16 UTF-8 to ECI convenience functions
|
||||
|
||||
As a convenience the conversion done by Zint from UTF-8 to ECIs is exposed in
|
||||
two helper functions (compatible with the `libzueci`[^18] functions
|
||||
`zueci_utf8_to_eci()` and `zueci_dest_len_eci()`):
|
||||
|
||||
|
||||
```c
|
||||
int ZBarcode_UTF8_To_ECI(int eci, const unsigned char *source, int length,
|
||||
unsigned char dest[], int *p_dest_length);
|
||||
|
||||
int ZBarcode_Dest_Len_ECI(int eci, const unsigned char *source, int length,
|
||||
int *p_dest_length);
|
||||
```
|
||||
|
||||
Call `ZBarcode_Dest_Len_ECI()` to get the size of buffer sufficient to
|
||||
accommodate the conversion, then call `ZBarcode_UTF8_To_ECI()` with an
|
||||
appropriately sized buffer to do the conversion. The final destination length,
|
||||
returned in `p_dest_length`, may be smaller than the estimate given by
|
||||
`ZBarcode_Dest_Len_ECI()`. If `length` is zero or less, `source` must be
|
||||
NUL-terminated. The destination buffer is not NUL-terminated. The obsolete ECIs
|
||||
0, 1 and 2 are supported.
|
||||
|
||||
[^18]: The library `libzueci`, which can convert both to and from UTF-8 and ECI,
|
||||
is available at [https://sourceforge.net/projects/libzueci/](
|
||||
https://sourceforge.net/projects/libzueci/).
|
||||
|
||||
## 5.17 Zint Version
|
||||
|
||||
Whether the Zint library linked to was built with PNG support may be determined
|
||||
with:
|
||||
@@ -3192,13 +3219,13 @@ alphanumerics) are not recommended.
|
||||
{.lin}
|
||||
|
||||
It is sometimes advantageous to stop Code 128 from using Code Set C which
|
||||
compresses numerical data. The `BARCODE_CODE128AB`[^18] variant (symbology 60)
|
||||
compresses numerical data. The `BARCODE_CODE128AB`[^19] variant (symbology 60)
|
||||
suppresses Code Set C in favour of Code Sets A and B.
|
||||
|
||||
Note that the special extra escapes mentioned above are not available for this
|
||||
variant (nor for any other).
|
||||
|
||||
[^18]: `BARCODE_CODE128AB` previously used the name `BARCODE_CODE128B`, which is
|
||||
[^19]: `BARCODE_CODE128AB` previously used the name `BARCODE_CODE128B`, which is
|
||||
still recognised.
|
||||
|
||||
#### 6.1.10.3 GS1-128
|
||||
@@ -3790,7 +3817,7 @@ first and last digit are ignored, leaving a 4-digit DX Extract number in any
|
||||
case, which must be in the range 16 to 2047. The second format `"NNN-NN"`
|
||||
represents the DX Extract as two numbers separated by a dash (`-`), the first
|
||||
number being 1 to 3 digits (range 1 to 127) and the second 1 to 2 digits (range
|
||||
0 to 15).[^19]
|
||||
0 to 15).[^20]
|
||||
|
||||
The optional frame number is a number in the range 0 to 63, and may have a half
|
||||
frame indicator `"A"` appended. Special character sequences (with or without a
|
||||
@@ -3800,7 +3827,7 @@ number 62, `"K"` or `"00"` means frame number 63, and `"F"` means frame number
|
||||
|
||||
A parity bit is automatically added by Zint.
|
||||
|
||||
[^19]: The DX number may be looked up in The (Modified) Big Film Database at
|
||||
[^20]: The DX number may be looked up in The (Modified) Big Film Database at
|
||||
[https://thebigfilmdatabase.merinorus.com](
|
||||
https://thebigfilmdatabase.merinorus.com).
|
||||
|
||||
@@ -4796,7 +4823,7 @@ maximum of 128 digits and does not include a check digit.
|
||||
|
||||
## 7.1 License
|
||||
|
||||
Zint, libzint and Zint Barcode Studio are Copyright © 2025 Robin Stuart. All
|
||||
Zint, `libzint` and Zint Barcode Studio are Copyright © 2025 Robin Stuart. All
|
||||
historical versions are distributed under the GNU General Public License version
|
||||
3 or later. Versions 2.5 and later are released under a dual license: the
|
||||
encoding library is released under the BSD (3 clause) license whereas the GUI,
|
||||
|
||||
Reference in New Issue
Block a user