GUI: settings: fix embed_vector_font default 1 -> 0

manual: expand size/alpha details in Section "5.4 Buffering Symbols
  in Memory (raster)" (cf ticket #291);
  add BSD info (TODO: NetBSD);
  variable -> member (struct zint_symbol)
frontend: fix missing static on `validate_structapp()`
test suite: update to latest BWIPP (PDF417 needed adjusting)
Changelog: trim some more uninteresting changes
This commit is contained in:
gitlost 2023-07-12 19:00:17 +01:00
parent bbad6d3d83
commit d05373e7fc
10 changed files with 217 additions and 74 deletions

View File

@ -15,7 +15,7 @@ Version 2.12.0.9 (dev) not released yet
- Text height (font size) for SMALL_TEXT vector output reduced
- For Windows, filenames are now assumed to be UTF-8 encoded. Affects `outfile`
in `zint_symbol` and all API filename arguments
- Never used `fontsize` field removed from `zint_symbol`
- Never-used `fontsize` field removed from `zint_symbol`
- Buffer length of field `text` (HRT) in `zint_symbol` extended 128 -> 160
(client buffers may need checking/extending)
- Font of text of SVG vector output now "OCRB, monospace" (EAN/UPC) or
@ -51,7 +51,6 @@ Changes
`EANUPC_GUARD_WHITESPACE`, CLI `--guardwhitespace`) (ticket #287)
- EAN-2/EAN-5: HRT now at top instead of at bottom for standalones, following
BWIPP
- Move "font.h" -> "raster_font.h"
- EPS/SVG: use new `out_putsf()` func to output floats, avoiding trailing zeroes
& locale dependency
- EPS: simplify "TR" formula
@ -64,19 +63,16 @@ Changes
- GUI: use "OCRB" font for EAN/UPC and "Arimo" for all others (was "Helvetica"
for both); add preview background colour option (default light grey) so as
whitespace will show up in contrast (access via preview context menu)
- EMF: prefix funcs with `emf_`; simplify string `halign` handling
- large: rename `large_int` -> `large_uint`
- CODE128/common: move `c128_hrt_cpy_iso8859_1()` to `hrt_cpy_iso8859_1()` and
add `ZINT_WARN_HRT_TRUNCATED` warning (for future use)
- Various symbologies: replace `printf()` with `fputs()` (symbol->debug)
- QRCODE: better assert(), removing a NOLINT (2 left)
- CLI: add some more barcode synonyms for DBAR
- common: various fiddlings
- CMake: don't include png.c unless ZINT_USE_PNG (avoids clang warning)
- vector: reduce SMALL_TEXT font height 6 -> 5 to be more like raster;
reduce antialiasing allowance for `textoffset`;
adjust text to baseline using values for Arimo rather than percentage
- raster/vector: rename `text_height` -> `font_height`
- manual: expand size/alpha details in Section "5.4 Buffering Symbols in Memory
(raster)" (cf ticket #291); add BSD info
Bugs
----
@ -86,7 +82,7 @@ Bugs
LD_LIBRARY_PATH and PATH (ticket #279, props Alexey Dokuchaev)
- GUI: fg/bgcolor text edit: fix right-click context menu not working properly
by checking for it on FocusOut
- GUI: fix fg/gbcolor icon background not being reset on zap
- GUI: fix fg/bgcolor icon background not being reset on zap
- EMF/EPS/SVG/GUI: ignore BOLD_TEXT for EAN/UPC
- EMF/EPS/SVG: fix addon bars placement/length when text hidden
- For Windows, assume `outfile` & API filename args are in UTF-8,

71
README.bsd Normal file
View File

@ -0,0 +1,71 @@
% Tested on FreeBSD 13.2-RELEASE (with X11 + GNOME installed) and OpenBSD 7.3 (with X11)
1. Prerequisites for building zint
==================================
Prerequisites are git, cmake, make, gcc (or clang) and, for PNG support, libpng, e.g. FreeBSD
su
pkg install git cmake gmake gcc graphics/png
exit
or OpenBSD (make and clang should already be installed):
su
pkg_add git cmake png
exit
Then clone the latest source
git clone https://git.code.sf.net/p/zint/code zint
cd zint
2. Prerequisites for building zint-qt
=====================================
On FreeBSD:
su
pkg install qt5-core qt5-uitools qt5-buildtools qt5-qmake qt5-svg
exit
On OpenBSD:
su
pkg_add qtbase qttools qtsvg
exit
3. Build
========
The rest is standard CMake (allowing for absence of sudo)
mkdir build
cd build
cmake ..
make
su
make install
exit
except that on OpenBSD you need to use
cmake -DCMAKE_PREFIX_PATH=/usr/local/lib/qt5/cmake ..
instead.
3. CMake options
================
See "README.linux". Note for running the test suite on FreeBSD, if using the default csh, to set LD_LIBRARY_PATH use:
setenv LD_LIBRARY_PATH ${PWD}/backend
Also, for Qt5 test on FreeBSD, need:
su
pkg install qt5-testlib
exit

View File

@ -43,7 +43,7 @@
# elif defined(__GNUC__)
# pragma GCC diagnostic ignored "-Wformat" /* Unfortunately doesn't seem to be way to only avoid non-ISO warnings */
# endif
#elif defined(_MSC_VER) || defined(__APPLE__) || __WORDSIZE == 32
#elif defined(_MSC_VER) || defined(__APPLE__) || defined(__OpenBSD__) || __WORDSIZE == 32
# define LX_FMT "ll"
#else
# define LX_FMT "l"

View File

@ -2778,7 +2778,8 @@ int testUtilBwipp(int index, const struct zint_symbol *symbol, int option_1, int
}
} else if (symbology == BARCODE_PDF417 || symbology == BARCODE_PDF417COMP || symbology == BARCODE_HIBC_PDF
|| symbology == BARCODE_MICROPDF417 || symbology == BARCODE_HIBC_MICPDF) {
for (r = 0; r < symbol->rows; r++) bwipp_row_height[r] = 1; /* Change from 3 */
const int row_height = symbology == BARCODE_MICROPDF417 || symbology == BARCODE_HIBC_MICPDF ? 2 : 3;
for (r = 0; r < symbol->rows; r++) bwipp_row_height[r] = row_height;
if (option_1 >= 0) {
sprintf(bwipp_opts_buf + strlen(bwipp_opts_buf), "%seclevel=%d",
strlen(bwipp_opts_buf) ? " " : "", option_1);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 KiB

After

Width:  |  Height:  |  Size: 332 KiB

View File

@ -169,7 +169,28 @@ the `"frontend"` sub-directory. To run the test type
This should create numerous files in the sub-directory `"frontend/test_sh_out"`
showing the many modes of operation which are available from Zint.
## 2.2 Microsoft Windows
## 2.2 BSD
The latest Zint CLI, `libzint` and GUI can be installed from the `zint` package on
FreeBSD:
```bash
su
pkg install zint
exit
```
and on OpenBSD (where the GUI is in a separate `zint-gui` package):
```bash
su
pkg_add zint zint-gui
exit
```
To build from source see `"README.bsd"` in the project root directory.
## 2.3 Microsoft Windows
For Microsoft Windows, Zint is distributed as a binary executable. Simply
download the ZIP file, then right-click on the ZIP file and `"Extract All"`. A
@ -186,7 +207,7 @@ application digitally signed by Microsoft.
To build Zint on Windows from source, see `"win32/README"`.
## 2.3 Apple macOS
## 2.4 Apple macOS
The latest Zint CLI and `libzint` can be installed using Homebrew.[^1] To
install Homebrew input the following line into the macOS terminal
@ -208,7 +229,7 @@ root directory.
[^1]: See the Homebrew website [https://brew.sh](https://brew.sh).
## 2.4 Zint Tcl Backend
## 2.5 Zint Tcl Backend
The Tcl backend in the `"backend_tcl"` sub-directory may be built using the
provided TEA (Tcl Extension Architecture) build on Linux, Windows, macOS and
@ -230,7 +251,7 @@ or on Windows
qtZint.exe
```
See the note in section [2.2 Microsoft Windows] about Microsoft Defender
See the note in section [2.3 Microsoft Windows] about Microsoft Defender
SmartScreen.
Below is a brief guide to Zint Barcode Studio.
@ -302,9 +323,9 @@ For a number of symbologies extra options are available to fine-tune the format,
appearance and content of the symbol generated. These are given in a second tab.
Here the method is shown for adjusting the size or error correction level of an
Aztec Code symbol (see [6.6.8 Aztec Code (ISO 24778)]), selecting how its data is
to be treated (see [4.10 Input Modes]), and setting it as part of a Structured
Append sequence of symbols (see [4.16 Structured Append]).
Aztec Code symbol (see [6.6.8 Aztec Code (ISO 24778)]), selecting how its data
is to be treated (see [4.10 Input Modes]), and setting it as part of a
Structured Append sequence of symbols (see [4.16 Structured Append]).
## 3.5 Appearance Tab
@ -1628,7 +1649,7 @@ int main(int argc, char **argv)
```
Note that when using the API, the input data is assumed to be 8-bit binary
unless the `input_mode` variable in the `zint_symbol` structure is set - see
unless the `input_mode` member of the `zint_symbol` structure is set - see
[5.10 Setting the Input Mode] for details.
## 5.3 Encoding and Printing Functions in Depth
@ -1668,7 +1689,7 @@ are assumed to be UTF-8 encoded.
If printing more than one barcode, the `zint_symbol` structure may be re-used by
calling the `ZBarcode_Clear()` function after each barcode to free any output
buffers allocated. The `zint_symbol` input variables must be reset.
buffers allocated. The `zint_symbol` input members must be reset.
## 5.4 Buffering Symbols in Memory (raster)
@ -1686,26 +1707,43 @@ int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol,
const char *filename, int rotate_angle);
```
The arguments here are the same as above. The difference is that instead of
saving the image to a file it is placed in an unsigned character array. The
`bitmap` pointer is set to the first memory location in the array and the values
`barcode_width` and `barcode_height` indicate the size of the resulting image
in pixels. Rotation and colour options can be used with the buffer functions in
the same way as when saving to a file. The pixel data can be extracted from the
array by the method shown in the example below where `render_pixel()` is assumed
to be a function for drawing a pixel on the screen implemented by the external
application:
The arguments here are the same as above, and rotation and colour options can be
used with the buffer functions in the same way as when saving to a file. The
difference is that instead of saving the image to a file it is placed in a byte
(`unsigned char`) array pointed to by the `bitmap` member, with `bitmap_width`
set to the number of columns and `bitmap_height` set to the number of rows.
(Note that the `bitmap_byte_length` member is not relevant here, being set only
on outputting to a Windows BMP file.)
The RGB channels are split into 3 consecutive red, green, blue bytes per pixel,
and there are `bitmap_width` pixels per row and `bitmap_height` rows, so the
total size of the `bitmap` array is `3 * bitmap_width * bitmap_height`.
If the background or foreground are RGBA then the byte array `alphamap` will
also be set, with a single alpha value for each pixel. Its total size will be
`bitmap_width * bitmap_height`.
The pixel data can be extracted from the array (or arrays) by the method shown
in the example below, where `render_rgb()` and `render_rgba()` are assumed to be
functions for drawing an RGB and RGBA pixel on the screen implemented by the
client application:
```c
int row, col, i = 0;
int red, blue, green;
int row, col, i = 0, j = 0;
int red, blue, green, alpha;
for (row = 0; row < my_symbol->bitmap_height; row++) {
for (col = 0; col < my_symbol->bitmap_width; col++) {
red = (int) my_symbol->bitmap[i];
green = (int) my_symbol->bitmap[i + 1];
blue = (int) my_symbol->bitmap[i + 2];
render_pixel(row, col, red, green, blue);
if (my_symbol->alphamap) {
alpha = (int) my_symbol->alphamap[j];
render_rgba(row, col, red, green, blue, alpha);
j++;
} else {
render_rgb(row, col, red, green, blue);
}
i += 3;
}
}
@ -1716,8 +1754,8 @@ intermediate form using the output option `OUT_BUFFER_INTERMEDIATE`. Here each
byte is an ASCII value: `'1'` for foreground colour and `'0'` for background
colour, except for Ultracode, which also uses colour codes: `'W'` for white,
`'C'` for cyan, `'B'` for blue, `'M'` for magenta, `'R'` for red, `'Y'` for
yellow, `'G'` for green, and `'K'` for black. The loop for accessing the data is
then:
yellow, `'G'` for green, and `'K'` for black. Alpha values are not reported
(`alphamap` will always be `NULL`). The loop for accessing the data is then:
```c
int row, col, i = 0;
@ -1789,10 +1827,10 @@ symbols and we don't mind that they only save to `"out.png"`. As with the CLI
program, of course, these options can be altered. The way this is done is by
altering the contents of the `zint_symbol` structure between the creation and
encoding stages. The `zint_symbol` structure consists of the following
variables:
members:
--------------------------------------------------------------------------------
Variable Name Type Meaning Default Value
Member Name Type Meaning Default Value
-------------------- ---------- --------------------------- -----------------
`symbology` integer Symbol to use (see [5.8 `BARCODE_CODE128`
Specifying a Symbology]).
@ -1978,7 +2016,7 @@ background alpha to `"00"` where the values for R, G and B will be ignored:
## 5.7 Handling Errors
If errors occur during encoding a non-zero integer value is passed back to the
calling application. In addition the `errtxt` variable is set to a message
calling application. In addition the `errtxt` member is set to a message
detailing the nature of the error. The errors generated by Zint are:
--------------------------------------------------------------------------------
@ -2098,9 +2136,9 @@ symbol->symbology = 50;
## 5.9 Adjusting Output Options
The `output_options` variable can be used to adjust various aspects of the
output file. To select more than one option from the table below simply `OR`
them together when adjusting this value:
The `output_options` member can be used to adjust various aspects of the output
file. To select more than one option from the table below simply `OR` them
together when adjusting this value:
```c
my_symbol->output_options |= BARCODE_BIND | READER_INIT;
@ -2191,7 +2229,7 @@ Value Effect
characters, extended ASCII characters) are still checked
for.
`HEIGHTPERROW_MODE` Interpret the `height` variable as per-row rather than as
`HEIGHTPERROW_MODE` Interpret the `height` member as per-row rather than as
overall height.
`FAST_MODE` Use faster if less optimal encodation or other shortcuts if
@ -2241,8 +2279,8 @@ as is the validity of GS1 data specified without AIs (e.g. linear data for GS1
DataBar Omnidirectional/Limited/etc.).
For `HEIGHTPERROW_MODE`, see `--heightperrow` in section [4.4 Adjusting Height].
The `height` variable should be set to the desired per-row value on input (it
will be set to the overall height on output).
The `height` member should be set to the desired per-row value on input (it will
be set to the overall height on output).
`FAST_MODE` causes a less optimal encodation scheme to be used for Data Matrix,
MicroPDF417 and PDF417. For QR Code and UPNQR, it affects Zint's automatic mask

View File

@ -13,9 +13,10 @@ July 2023
- 1.1 Glossary
- 2. Installing Zint
- 2.1 Linux
- 2.2 Microsoft Windows
- 2.3 Apple macOS
- 2.4 Zint Tcl Backend
- 2.2 BSD
- 2.3 Microsoft Windows
- 2.4 Apple macOS
- 2.5 Zint Tcl Backend
- 3. Using Zint Barcode Studio
- 3.1 Main Window and Data Tab
- 3.2 GS1 Composite Groupbox
@ -348,7 +349,24 @@ the "frontend" sub-directory. To run the test type
This should create numerous files in the sub-directory "frontend/test_sh_out"
showing the many modes of operation which are available from Zint.
2.2 Microsoft Windows
2.2 BSD
The latest Zint CLI, libzint and GUI can be installed from the zint package on
FreeBSD:
su
pkg install zint
exit
and on OpenBSD (where the GUI is in a separate zint-gui package):
su
pkg_add zint zint-gui
exit
To build from source see "README.bsd" in the project root directory.
2.3 Microsoft Windows
For Microsoft Windows, Zint is distributed as a binary executable. Simply
download the ZIP file, then right-click on the ZIP file and "Extract All". A new
@ -365,7 +383,7 @@ digitally signed by Microsoft.
To build Zint on Windows from source, see "win32/README".
2.3 Apple macOS
2.4 Apple macOS
The latest Zint CLI and libzint can be installed using Homebrew.[1] To install
Homebrew input the following line into the macOS terminal
@ -381,7 +399,7 @@ library
To build from source (and install the GUI) see "README.macos" in the project
root directory.
2.4 Zint Tcl Backend
2.5 Zint Tcl Backend
The Tcl backend in the "backend_tcl" sub-directory may be built using the
provided TEA (Tcl Extension Architecture) build on Linux, Windows, macOS and
@ -398,7 +416,7 @@ or on Windows
qtZint.exe
See the note in section 2.2 Microsoft Windows about Microsoft Defender
See the note in section 2.3 Microsoft Windows about Microsoft Defender
SmartScreen.
Below is a brief guide to Zint Barcode Studio.
@ -1667,7 +1685,7 @@ function as shown in the next example:
}
Note that when using the API, the input data is assumed to be 8-bit binary
unless the input_mode variable in the zint_symbol structure is set - see 5.10
unless the input_mode member of the zint_symbol structure is set - see 5.10
Setting the Input Mode for details.
5.3 Encoding and Printing Functions in Depth
@ -1705,7 +1723,7 @@ be UTF-8 encoded.
If printing more than one barcode, the zint_symbol structure may be re-used by
calling the ZBarcode_Clear() function after each barcode to free any output
buffers allocated. The zint_symbol input variables must be reset.
buffers allocated. The zint_symbol input members must be reset.
5.4 Buffering Symbols in Memory (raster)
@ -1721,25 +1739,42 @@ allow you to do this:
int ZBarcode_Encode_File_and_Buffer(struct zint_symbol *symbol,
const char *filename, int rotate_angle);
The arguments here are the same as above. The difference is that instead of
saving the image to a file it is placed in an unsigned character array. The
bitmap pointer is set to the first memory location in the array and the values
barcode_width and barcode_height indicate the size of the resulting image in
pixels. Rotation and colour options can be used with the buffer functions in the
same way as when saving to a file. The pixel data can be extracted from the
array by the method shown in the example below where render_pixel() is assumed
to be a function for drawing a pixel on the screen implemented by the external
application:
The arguments here are the same as above, and rotation and colour options can be
used with the buffer functions in the same way as when saving to a file. The
difference is that instead of saving the image to a file it is placed in a byte
(unsigned char) array pointed to by the bitmap member, with bitmap_width set to
the number of columns and bitmap_height set to the number of rows. (Note that
the bitmap_byte_length member is not relevant here, being set only on outputting
to a Windows BMP file.)
int row, col, i = 0;
int red, blue, green;
The RGB channels are split into 3 consecutive red, green, blue bytes per pixel,
and there are bitmap_width pixels per row and bitmap_height rows, so the total
size of the bitmap array is 3 * bitmap_width * bitmap_height.
If the background or foreground are RGBA then the byte array alphamap will also
be set, with a single alpha value for each pixel. Its total size will be
bitmap_width * bitmap_height.
The pixel data can be extracted from the array (or arrays) by the method shown
in the example below, where render_rgb() and render_rgba() are assumed to be
functions for drawing an RGB and RGBA pixel on the screen implemented by the
client application:
int row, col, i = 0, j = 0;
int red, blue, green, alpha;
for (row = 0; row < my_symbol->bitmap_height; row++) {
for (col = 0; col < my_symbol->bitmap_width; col++) {
red = (int) my_symbol->bitmap[i];
green = (int) my_symbol->bitmap[i + 1];
blue = (int) my_symbol->bitmap[i + 2];
render_pixel(row, col, red, green, blue);
if (my_symbol->alphamap) {
alpha = (int) my_symbol->alphamap[j];
render_rgba(row, col, red, green, blue, alpha);
j++;
} else {
render_rgb(row, col, red, green, blue);
}
i += 3;
}
}
@ -1749,7 +1784,8 @@ intermediate form using the output option OUT_BUFFER_INTERMEDIATE. Here each
byte is an ASCII value: '1' for foreground colour and '0' for background colour,
except for Ultracode, which also uses colour codes: 'W' for white, 'C' for cyan,
'B' for blue, 'M' for magenta, 'R' for red, 'Y' for yellow, 'G' for green, and
'K' for black. The loop for accessing the data is then:
'K' for black. Alpha values are not reported (alphamap will always be NULL). The
loop for accessing the data is then:
int row, col, i = 0;
@ -1814,10 +1850,10 @@ So far our application is not very useful unless we plan to only make Code 128
symbols and we dont mind that they only save to "out.png". As with the CLI
program, of course, these options can be altered. The way this is done is by
altering the contents of the zint_symbol structure between the creation and
encoding stages. The zint_symbol structure consists of the following variables:
encoding stages. The zint_symbol structure consists of the following members:
---------------------------------------------------------------------------------
Variable Name Type Meaning Default Value
Member Name Type Meaning Default Value
--------------------- ------------ ---------------------------- -----------------
symbology integer Symbol to use (see 5.8 BARCODE_CODE128
Specifying a Symbology).
@ -1988,8 +2024,8 @@ background alpha to "00" where the values for R, G and B will be ignored:
5.7 Handling Errors
If errors occur during encoding a non-zero integer value is passed back to the
calling application. In addition the errtxt variable is set to a message
detailing the nature of the error. The errors generated by Zint are:
calling application. In addition the errtxt member is set to a message detailing
the nature of the error. The errors generated by Zint are:
-------------------------------------------------------------------------------
Return Value Meaning
@ -2103,7 +2139,7 @@ means the same as
5.9 Adjusting Output Options
The output_options variable can be used to adjust various aspects of the output
The output_options member can be used to adjust various aspects of the output
file. To select more than one option from the table below simply OR them
together when adjusting this value:
@ -2185,7 +2221,7 @@ property. Valid values are shown in the table below.
(e.g. control characters, extended ASCII characters) are
still checked for.
HEIGHTPERROW_MODE Interpret the height variable as per-row rather than as
HEIGHTPERROW_MODE Interpret the height member as per-row rather than as
overall height.
FAST_MODE Use faster if less optimal encodation or other shortcuts if
@ -2228,7 +2264,7 @@ as is the validity of GS1 data specified without AIs (e.g. linear data for GS1
DataBar Omnidirectional/Limited/etc.).
For HEIGHTPERROW_MODE, see --heightperrow in section 4.4 Adjusting Height. The
height variable should be set to the desired per-row value on input (it will be
height member should be set to the desired per-row value on input (it will be
set to the overall height on output).
FAST_MODE causes a less optimal encodation scheme to be used for Data Matrix,

View File

@ -777,7 +777,7 @@ static int validate_scalexdimdp(const char *optarg, float *p_x_dim_mm, float *p_
}
/* Parse and validate Structured Append argument "index,count[,ID]" to "--structapp" */
int validate_structapp(const char *optarg, struct zint_structapp *structapp) {
static int validate_structapp(const char *optarg, struct zint_structapp *structapp) {
char index[10] = {0}, count[10] = {0};
const char *comma = strchr(optarg, ',');
const char *comma2;
@ -1083,7 +1083,8 @@ static int batch_process(struct zint_symbol *symbol, const char *filename, const
if (file != stdin) {
if (fclose(file) != 0) {
fprintf(stderr, "Warning 196: Failure on closing input file '%s' (%d: %s)\n", filename, errno, strerror(errno));
fprintf(stderr, "Warning 196: Failure on closing input file '%s' (%d: %s)\n", filename, errno,
strerror(errno));
fflush(stderr);
warn_number = ZINT_WARN_INVALID_OPTION; /* TODO: maybe new warning e.g. ZINT_WARN_INVALID_INPUT? */
}

View File

@ -4514,7 +4514,7 @@ void MainWindow::load_sub_settings(QSettings &settings, int symbology)
QSL("studio/bc/%1/appearance/font_setting").arg(name), 0).toInt());
spnTextGap->setValue(settings.value(QSL("studio/bc/%1/appearance/text_gap").arg(name), 0.0).toFloat());
chkEmbedVectorFont->setChecked(settings.value(
QSL("studio/bc/%1/appearance/chk_embed_vector_font").arg(name), 1).toInt() ? true : false);
QSL("studio/bc/%1/appearance/chk_embed_vector_font").arg(name), 0).toInt() ? true : false);
chkHRTShow->setChecked(settings.value(
QSL("studio/bc/%1/appearance/chk_hrt_show").arg(name), 1).toInt() ? true : false);
}