- vector: ensure separators don't overlap with other rectangles so that

they render correctly when have RGBA alpha channel
- GUI: update_preview() after Data Dialog return to ensure preview in sync
- GUI: add automatic info feedback to "Automatic" combo item of size/row/height
  comboboxes
- backend_qt: always call getMaxRectsRightBottom() for render fudge; use
  ZBarcode_Clear() instead of ZBarcode_Delete() after 1st call
- update BWIPP to latest & add some MICROQR tests to exercise optimize change
This commit is contained in:
gitlost 2022-08-07 22:43:49 +01:00
parent c0a5c7b125
commit c0ec67f99e
18 changed files with 2115 additions and 809 deletions

View file

@ -1,6 +1,10 @@
Version 2.11.0.9 (dev) not released yet
=======================================
**Incompatible changes**
------------------------
- None yet
Changes
-------
- GUI: sequence export dialog: add Postfix field for filename (#252)
@ -22,6 +26,8 @@ Changes
- Add new symbology BC412 (SEMI T1-95)
- backend: use alloca() (z_alloca()) for both Unix and Windows
- GS1: new AI 4309 with latlong checker, new currency code 925
- GUI: add automatic info feedback to "Automatic" combo item of size/row/height
comboboxes
Bugs
----
@ -34,6 +40,9 @@ Bugs
- GUI: sequence window: fix initial clear button status
- GUI: NO_PNG: allow for Qt not parsing #if's in slots
- frontend: batch mode: fix default "~~~~~" output (github issue #65)
- vector: ensure separators don't overlap with other rectangles so that
they render correctly when have RGBA alpha channel
- GUI: update_preview() after Data Dialog return to ensure preview in sync
Version 2.11.0 (2022-05-24)

View file

@ -666,6 +666,7 @@ static void draw_bind_box(const struct zint_symbol *symbol, unsigned char *pixel
const int xoffset_si, const int yoffset_si, const int symbol_height_si, const int dot_overspill_si,
const int image_width, const int image_height, const int si) {
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) {
const int is_codablockf = symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF;
const int horz_outside = is_fixed_ratio(symbol->symbology);
const int bwidth_si = symbol->border_width * si;
int ybind_top = yoffset_si - bwidth_si;
@ -675,8 +676,7 @@ static void draw_bind_box(const struct zint_symbol *symbol, unsigned char *pixel
ybind_bot = image_height - bwidth_si;
}
/* Horizontal boundary bars */
if ((symbol->output_options & BARCODE_BOX)
|| (symbol->symbology != BARCODE_CODABLOCKF && symbol->symbology != BARCODE_HIBC_BLOCKF)) {
if ((symbol->output_options & BARCODE_BOX) || !is_codablockf) {
/* Box or not CodaBlockF */
draw_bar(pixelbuf, 0, image_width, ybind_top, bwidth_si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, 0, image_width, ybind_bot, bwidth_si, image_width, image_height, DEFAULT_INK);
@ -928,6 +928,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
int text_height; /* Font pixel size (so whole integers) */
float text_gap; /* Gap between barcode and text */
float guard_descent;
const int is_codablockf = symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF;
int textflags = 0;
int xoffset_si, yoffset_si, roffset_si, boffset_si;
@ -1266,7 +1267,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
}
sep_height_si = (int) (sep_height * si);
sep_yoffset_si = yoffset_si + row_heights_si[0] - sep_height_si / 2;
if (symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF) {
if (is_codablockf) {
/* Avoid 11-module start and 13-module stop chars */
sep_xoffset_si += 11 * si;
sep_width_si -= (11 + 13) * si;

View file

@ -11,50 +11,73 @@
<rect x="20.00" y="2.00" width="4.00" height="60.00" />
<rect x="26.00" y="2.00" width="2.00" height="60.00" />
<rect x="36.00" y="2.00" width="2.00" height="60.00" />
<rect x="42.00" y="2.00" width="2.00" height="60.00" />
<rect x="46.00" y="2.00" width="8.00" height="60.00" />
<rect x="56.00" y="2.00" width="6.00" height="60.00" />
<rect x="64.00" y="2.00" width="2.00" height="20.00" />
<rect x="70.00" y="2.00" width="2.00" height="20.00" />
<rect x="74.00" y="2.00" width="4.00" height="20.00" />
<rect x="86.00" y="2.00" width="2.00" height="60.00" />
<rect x="90.00" y="2.00" width="2.00" height="60.00" />
<rect x="98.00" y="2.00" width="4.00" height="60.00" />
<rect x="108.00" y="2.00" width="2.00" height="60.00" />
<rect x="112.00" y="2.00" width="2.00" height="40.00" />
<rect x="120.00" y="2.00" width="4.00" height="40.00" />
<rect x="130.00" y="2.00" width="2.00" height="40.00" />
<rect x="134.00" y="2.00" width="2.00" height="40.00" />
<rect x="142.00" y="2.00" width="4.00" height="40.00" />
<rect x="152.00" y="2.00" width="2.00" height="40.00" />
<rect x="156.00" y="2.00" width="2.00" height="40.00" />
<rect x="164.00" y="2.00" width="4.00" height="40.00" />
<rect x="174.00" y="2.00" width="4.00" height="20.00" />
<rect x="180.00" y="2.00" width="4.00" height="20.00" />
<rect x="188.00" y="2.00" width="4.00" height="20.00" />
<rect x="42.00" y="2.00" width="2.00" height="19.00" />
<rect x="46.00" y="2.00" width="8.00" height="19.00" />
<rect x="56.00" y="2.00" width="6.00" height="19.00" />
<rect x="64.00" y="2.00" width="2.00" height="19.00" />
<rect x="70.00" y="2.00" width="2.00" height="19.00" />
<rect x="74.00" y="2.00" width="4.00" height="19.00" />
<rect x="86.00" y="2.00" width="2.00" height="19.00" />
<rect x="90.00" y="2.00" width="2.00" height="19.00" />
<rect x="98.00" y="2.00" width="4.00" height="19.00" />
<rect x="108.00" y="2.00" width="2.00" height="19.00" />
<rect x="112.00" y="2.00" width="2.00" height="19.00" />
<rect x="120.00" y="2.00" width="4.00" height="19.00" />
<rect x="130.00" y="2.00" width="2.00" height="19.00" />
<rect x="134.00" y="2.00" width="2.00" height="19.00" />
<rect x="142.00" y="2.00" width="4.00" height="19.00" />
<rect x="152.00" y="2.00" width="2.00" height="19.00" />
<rect x="156.00" y="2.00" width="2.00" height="19.00" />
<rect x="164.00" y="2.00" width="4.00" height="19.00" />
<rect x="174.00" y="2.00" width="4.00" height="19.00" />
<rect x="180.00" y="2.00" width="4.00" height="19.00" />
<rect x="188.00" y="2.00" width="4.00" height="19.00" />
<rect x="196.00" y="2.00" width="4.00" height="60.00" />
<rect x="206.00" y="2.00" width="6.00" height="60.00" />
<rect x="214.00" y="2.00" width="2.00" height="60.00" />
<rect x="218.00" y="2.00" width="4.00" height="60.00" />
<rect x="64.00" y="22.00" width="4.00" height="20.00" />
<rect x="74.00" y="22.00" width="2.00" height="20.00" />
<rect x="80.00" y="22.00" width="2.00" height="20.00" />
<rect x="174.00" y="22.00" width="8.00" height="20.00" />
<rect x="184.00" y="22.00" width="2.00" height="40.00" />
<rect x="192.00" y="22.00" width="2.00" height="20.00" />
<rect x="64.00" y="42.00" width="2.00" height="20.00" />
<rect x="68.00" y="42.00" width="4.00" height="20.00" />
<rect x="76.00" y="42.00" width="6.00" height="20.00" />
<rect x="112.00" y="42.00" width="6.00" height="20.00" />
<rect x="120.00" y="42.00" width="8.00" height="20.00" />
<rect x="130.00" y="42.00" width="4.00" height="20.00" />
<rect x="138.00" y="42.00" width="4.00" height="20.00" />
<rect x="144.00" y="42.00" width="4.00" height="20.00" />
<rect x="152.00" y="42.00" width="4.00" height="20.00" />
<rect x="160.00" y="42.00" width="6.00" height="20.00" />
<rect x="170.00" y="42.00" width="2.00" height="20.00" />
<rect x="174.00" y="42.00" width="4.00" height="20.00" />
<rect x="190.00" y="42.00" width="2.00" height="20.00" />
<rect x="42.00" y="23.00" width="2.00" height="18.00" />
<rect x="46.00" y="23.00" width="8.00" height="18.00" />
<rect x="56.00" y="23.00" width="6.00" height="18.00" />
<rect x="64.00" y="23.00" width="4.00" height="18.00" />
<rect x="74.00" y="23.00" width="2.00" height="18.00" />
<rect x="80.00" y="23.00" width="2.00" height="18.00" />
<rect x="86.00" y="23.00" width="2.00" height="18.00" />
<rect x="90.00" y="23.00" width="2.00" height="18.00" />
<rect x="98.00" y="23.00" width="4.00" height="18.00" />
<rect x="108.00" y="23.00" width="2.00" height="18.00" />
<rect x="112.00" y="23.00" width="2.00" height="18.00" />
<rect x="120.00" y="23.00" width="4.00" height="18.00" />
<rect x="130.00" y="23.00" width="2.00" height="18.00" />
<rect x="134.00" y="23.00" width="2.00" height="18.00" />
<rect x="142.00" y="23.00" width="4.00" height="18.00" />
<rect x="152.00" y="23.00" width="2.00" height="18.00" />
<rect x="156.00" y="23.00" width="2.00" height="18.00" />
<rect x="164.00" y="23.00" width="4.00" height="18.00" />
<rect x="174.00" y="23.00" width="8.00" height="18.00" />
<rect x="184.00" y="23.00" width="2.00" height="18.00" />
<rect x="192.00" y="23.00" width="2.00" height="18.00" />
<rect x="42.00" y="43.00" width="2.00" height="19.00" />
<rect x="46.00" y="43.00" width="8.00" height="19.00" />
<rect x="56.00" y="43.00" width="6.00" height="19.00" />
<rect x="64.00" y="43.00" width="2.00" height="19.00" />
<rect x="68.00" y="43.00" width="4.00" height="19.00" />
<rect x="76.00" y="43.00" width="6.00" height="19.00" />
<rect x="86.00" y="43.00" width="2.00" height="19.00" />
<rect x="90.00" y="43.00" width="2.00" height="19.00" />
<rect x="98.00" y="43.00" width="4.00" height="19.00" />
<rect x="108.00" y="43.00" width="2.00" height="19.00" />
<rect x="112.00" y="43.00" width="6.00" height="19.00" />
<rect x="120.00" y="43.00" width="8.00" height="19.00" />
<rect x="130.00" y="43.00" width="4.00" height="19.00" />
<rect x="138.00" y="43.00" width="4.00" height="19.00" />
<rect x="144.00" y="43.00" width="4.00" height="19.00" />
<rect x="152.00" y="43.00" width="4.00" height="19.00" />
<rect x="160.00" y="43.00" width="6.00" height="19.00" />
<rect x="170.00" y="43.00" width="2.00" height="19.00" />
<rect x="174.00" y="43.00" width="4.00" height="19.00" />
<rect x="184.00" y="43.00" width="2.00" height="19.00" />
<rect x="190.00" y="43.00" width="2.00" height="19.00" />
<rect x="42.00" y="21.00" width="154.00" height="2.00" />
<rect x="42.00" y="41.00" width="154.00" height="2.00" />
<rect x="20.00" y="0.00" width="202.00" height="2.00" />

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -0,0 +1,120 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="264" height="84" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#000000">
<rect x="0" y="0" width="264" height="84" fill="#FFFFFF" opacity="0.400" />
<rect x="20.00" y="2.00" width="4.00" height="80.00" opacity="0.200" />
<rect x="26.00" y="2.00" width="2.00" height="80.00" opacity="0.200" />
<rect x="36.00" y="2.00" width="2.00" height="80.00" opacity="0.200" />
<rect x="42.00" y="2.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="46.00" y="2.00" width="6.00" height="18.00" opacity="0.200" />
<rect x="54.00" y="2.00" width="8.00" height="18.00" opacity="0.200" />
<rect x="64.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="72.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="80.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="86.00" y="2.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="90.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="98.00" y="2.00" width="6.00" height="18.00" opacity="0.200" />
<rect x="108.00" y="2.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="116.00" y="2.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="120.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="130.00" y="2.00" width="6.00" height="18.00" opacity="0.200" />
<rect x="142.00" y="2.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="146.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="152.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="164.00" y="2.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="168.00" y="2.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="174.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="180.00" y="2.00" width="8.00" height="18.00" opacity="0.200" />
<rect x="190.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="196.00" y="2.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="204.00" y="2.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="210.00" y="2.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="218.00" y="2.00" width="4.00" height="80.00" opacity="0.200" />
<rect x="228.00" y="2.00" width="6.00" height="80.00" opacity="0.200" />
<rect x="236.00" y="2.00" width="2.00" height="80.00" opacity="0.200" />
<rect x="240.00" y="2.00" width="4.00" height="80.00" opacity="0.200" />
<rect x="42.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="46.00" y="24.00" width="6.00" height="16.00" opacity="0.200" />
<rect x="54.00" y="24.00" width="8.00" height="16.00" opacity="0.200" />
<rect x="64.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="68.00" y="24.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="78.00" y="24.00" width="6.00" height="16.00" opacity="0.200" />
<rect x="86.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="90.00" y="24.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="98.00" y="24.00" width="6.00" height="16.00" opacity="0.200" />
<rect x="108.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="116.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="120.00" y="24.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="130.00" y="24.00" width="6.00" height="16.00" opacity="0.200" />
<rect x="142.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="146.00" y="24.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="152.00" y="24.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="164.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="168.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="174.00" y="24.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="180.00" y="24.00" width="8.00" height="16.00" opacity="0.200" />
<rect x="190.00" y="24.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="196.00" y="24.00" width="8.00" height="16.00" opacity="0.200" />
<rect x="208.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="212.00" y="24.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="42.00" y="44.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="46.00" y="44.00" width="6.00" height="16.00" opacity="0.200" />
<rect x="54.00" y="44.00" width="8.00" height="16.00" opacity="0.200" />
<rect x="64.00" y="44.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="72.00" y="44.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="78.00" y="44.00" width="6.00" height="16.00" opacity="0.200" />
<rect x="86.00" y="44.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="90.00" y="44.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="98.00" y="44.00" width="6.00" height="16.00" opacity="0.200" />
<rect x="108.00" y="44.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="116.00" y="44.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="120.00" y="44.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="130.00" y="44.00" width="6.00" height="16.00" opacity="0.200" />
<rect x="142.00" y="44.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="146.00" y="44.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="152.00" y="44.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="164.00" y="44.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="168.00" y="44.00" width="2.00" height="16.00" opacity="0.200" />
<rect x="174.00" y="44.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="180.00" y="44.00" width="8.00" height="16.00" opacity="0.200" />
<rect x="190.00" y="44.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="196.00" y="44.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="202.00" y="44.00" width="4.00" height="16.00" opacity="0.200" />
<rect x="208.00" y="44.00" width="8.00" height="16.00" opacity="0.200" />
<rect x="42.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="46.00" y="64.00" width="6.00" height="18.00" opacity="0.200" />
<rect x="54.00" y="64.00" width="8.00" height="18.00" opacity="0.200" />
<rect x="64.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="68.00" y="64.00" width="6.00" height="18.00" opacity="0.200" />
<rect x="76.00" y="64.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="86.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="90.00" y="64.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="98.00" y="64.00" width="6.00" height="18.00" opacity="0.200" />
<rect x="108.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="116.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="120.00" y="64.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="130.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="134.00" y="64.00" width="8.00" height="18.00" opacity="0.200" />
<rect x="144.00" y="64.00" width="6.00" height="18.00" opacity="0.200" />
<rect x="152.00" y="64.00" width="6.00" height="18.00" opacity="0.200" />
<rect x="160.00" y="64.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="168.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="174.00" y="64.00" width="6.00" height="18.00" opacity="0.200" />
<rect x="186.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="190.00" y="64.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="196.00" y="64.00" width="4.00" height="18.00" opacity="0.200" />
<rect x="204.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="208.00" y="64.00" width="2.00" height="18.00" opacity="0.200" />
<rect x="42.00" y="20.00" width="176.00" height="4.00" opacity="0.200" />
<rect x="42.00" y="40.00" width="176.00" height="4.00" opacity="0.200" />
<rect x="42.00" y="60.00" width="176.00" height="4.00" opacity="0.200" />
<rect x="20.00" y="0.00" width="224.00" height="2.00" opacity="0.200" />
<rect x="20.00" y="82.00" width="224.00" height="2.00" opacity="0.200" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 8.8 KiB

View file

@ -11,50 +11,73 @@
<rect x="24.00" y="6.00" width="4.00" height="60.00" />
<rect x="30.00" y="6.00" width="2.00" height="60.00" />
<rect x="40.00" y="6.00" width="2.00" height="60.00" />
<rect x="46.00" y="6.00" width="2.00" height="60.00" />
<rect x="50.00" y="6.00" width="8.00" height="60.00" />
<rect x="60.00" y="6.00" width="6.00" height="60.00" />
<rect x="68.00" y="6.00" width="2.00" height="20.00" />
<rect x="74.00" y="6.00" width="2.00" height="20.00" />
<rect x="78.00" y="6.00" width="4.00" height="20.00" />
<rect x="90.00" y="6.00" width="2.00" height="60.00" />
<rect x="94.00" y="6.00" width="2.00" height="60.00" />
<rect x="102.00" y="6.00" width="4.00" height="60.00" />
<rect x="112.00" y="6.00" width="2.00" height="60.00" />
<rect x="116.00" y="6.00" width="2.00" height="40.00" />
<rect x="124.00" y="6.00" width="4.00" height="40.00" />
<rect x="134.00" y="6.00" width="2.00" height="40.00" />
<rect x="138.00" y="6.00" width="2.00" height="40.00" />
<rect x="146.00" y="6.00" width="4.00" height="40.00" />
<rect x="156.00" y="6.00" width="2.00" height="40.00" />
<rect x="160.00" y="6.00" width="2.00" height="40.00" />
<rect x="168.00" y="6.00" width="4.00" height="40.00" />
<rect x="178.00" y="6.00" width="4.00" height="20.00" />
<rect x="184.00" y="6.00" width="4.00" height="20.00" />
<rect x="192.00" y="6.00" width="4.00" height="20.00" />
<rect x="46.00" y="6.00" width="2.00" height="19.00" />
<rect x="50.00" y="6.00" width="8.00" height="19.00" />
<rect x="60.00" y="6.00" width="6.00" height="19.00" />
<rect x="68.00" y="6.00" width="2.00" height="19.00" />
<rect x="74.00" y="6.00" width="2.00" height="19.00" />
<rect x="78.00" y="6.00" width="4.00" height="19.00" />
<rect x="90.00" y="6.00" width="2.00" height="19.00" />
<rect x="94.00" y="6.00" width="2.00" height="19.00" />
<rect x="102.00" y="6.00" width="4.00" height="19.00" />
<rect x="112.00" y="6.00" width="2.00" height="19.00" />
<rect x="116.00" y="6.00" width="2.00" height="19.00" />
<rect x="124.00" y="6.00" width="4.00" height="19.00" />
<rect x="134.00" y="6.00" width="2.00" height="19.00" />
<rect x="138.00" y="6.00" width="2.00" height="19.00" />
<rect x="146.00" y="6.00" width="4.00" height="19.00" />
<rect x="156.00" y="6.00" width="2.00" height="19.00" />
<rect x="160.00" y="6.00" width="2.00" height="19.00" />
<rect x="168.00" y="6.00" width="4.00" height="19.00" />
<rect x="178.00" y="6.00" width="4.00" height="19.00" />
<rect x="184.00" y="6.00" width="4.00" height="19.00" />
<rect x="192.00" y="6.00" width="4.00" height="19.00" />
<rect x="200.00" y="6.00" width="4.00" height="60.00" />
<rect x="210.00" y="6.00" width="6.00" height="60.00" />
<rect x="218.00" y="6.00" width="2.00" height="60.00" />
<rect x="222.00" y="6.00" width="4.00" height="60.00" />
<rect x="68.00" y="26.00" width="4.00" height="20.00" />
<rect x="78.00" y="26.00" width="2.00" height="20.00" />
<rect x="84.00" y="26.00" width="2.00" height="20.00" />
<rect x="178.00" y="26.00" width="8.00" height="20.00" />
<rect x="188.00" y="26.00" width="2.00" height="40.00" />
<rect x="196.00" y="26.00" width="2.00" height="20.00" />
<rect x="68.00" y="46.00" width="2.00" height="20.00" />
<rect x="72.00" y="46.00" width="4.00" height="20.00" />
<rect x="80.00" y="46.00" width="6.00" height="20.00" />
<rect x="116.00" y="46.00" width="6.00" height="20.00" />
<rect x="124.00" y="46.00" width="8.00" height="20.00" />
<rect x="134.00" y="46.00" width="4.00" height="20.00" />
<rect x="142.00" y="46.00" width="4.00" height="20.00" />
<rect x="148.00" y="46.00" width="4.00" height="20.00" />
<rect x="156.00" y="46.00" width="4.00" height="20.00" />
<rect x="164.00" y="46.00" width="6.00" height="20.00" />
<rect x="174.00" y="46.00" width="2.00" height="20.00" />
<rect x="178.00" y="46.00" width="4.00" height="20.00" />
<rect x="194.00" y="46.00" width="2.00" height="20.00" />
<rect x="46.00" y="27.00" width="2.00" height="18.00" />
<rect x="50.00" y="27.00" width="8.00" height="18.00" />
<rect x="60.00" y="27.00" width="6.00" height="18.00" />
<rect x="68.00" y="27.00" width="4.00" height="18.00" />
<rect x="78.00" y="27.00" width="2.00" height="18.00" />
<rect x="84.00" y="27.00" width="2.00" height="18.00" />
<rect x="90.00" y="27.00" width="2.00" height="18.00" />
<rect x="94.00" y="27.00" width="2.00" height="18.00" />
<rect x="102.00" y="27.00" width="4.00" height="18.00" />
<rect x="112.00" y="27.00" width="2.00" height="18.00" />
<rect x="116.00" y="27.00" width="2.00" height="18.00" />
<rect x="124.00" y="27.00" width="4.00" height="18.00" />
<rect x="134.00" y="27.00" width="2.00" height="18.00" />
<rect x="138.00" y="27.00" width="2.00" height="18.00" />
<rect x="146.00" y="27.00" width="4.00" height="18.00" />
<rect x="156.00" y="27.00" width="2.00" height="18.00" />
<rect x="160.00" y="27.00" width="2.00" height="18.00" />
<rect x="168.00" y="27.00" width="4.00" height="18.00" />
<rect x="178.00" y="27.00" width="8.00" height="18.00" />
<rect x="188.00" y="27.00" width="2.00" height="18.00" />
<rect x="196.00" y="27.00" width="2.00" height="18.00" />
<rect x="46.00" y="47.00" width="2.00" height="19.00" />
<rect x="50.00" y="47.00" width="8.00" height="19.00" />
<rect x="60.00" y="47.00" width="6.00" height="19.00" />
<rect x="68.00" y="47.00" width="2.00" height="19.00" />
<rect x="72.00" y="47.00" width="4.00" height="19.00" />
<rect x="80.00" y="47.00" width="6.00" height="19.00" />
<rect x="90.00" y="47.00" width="2.00" height="19.00" />
<rect x="94.00" y="47.00" width="2.00" height="19.00" />
<rect x="102.00" y="47.00" width="4.00" height="19.00" />
<rect x="112.00" y="47.00" width="2.00" height="19.00" />
<rect x="116.00" y="47.00" width="6.00" height="19.00" />
<rect x="124.00" y="47.00" width="8.00" height="19.00" />
<rect x="134.00" y="47.00" width="4.00" height="19.00" />
<rect x="142.00" y="47.00" width="4.00" height="19.00" />
<rect x="148.00" y="47.00" width="4.00" height="19.00" />
<rect x="156.00" y="47.00" width="4.00" height="19.00" />
<rect x="164.00" y="47.00" width="6.00" height="19.00" />
<rect x="174.00" y="47.00" width="2.00" height="19.00" />
<rect x="178.00" y="47.00" width="4.00" height="19.00" />
<rect x="188.00" y="47.00" width="2.00" height="19.00" />
<rect x="194.00" y="47.00" width="2.00" height="19.00" />
<rect x="46.00" y="25.00" width="154.00" height="2.00" />
<rect x="46.00" y="45.00" width="154.00" height="2.00" />
<rect x="24.00" y="4.00" width="202.00" height="2.00" />

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -11,50 +11,73 @@
<rect x="28.00" y="8.00" width="4.00" height="60.00" />
<rect x="34.00" y="8.00" width="2.00" height="60.00" />
<rect x="44.00" y="8.00" width="2.00" height="60.00" />
<rect x="50.00" y="8.00" width="2.00" height="60.00" />
<rect x="54.00" y="8.00" width="8.00" height="60.00" />
<rect x="64.00" y="8.00" width="6.00" height="60.00" />
<rect x="72.00" y="8.00" width="2.00" height="20.00" />
<rect x="78.00" y="8.00" width="2.00" height="20.00" />
<rect x="82.00" y="8.00" width="4.00" height="20.00" />
<rect x="94.00" y="8.00" width="2.00" height="60.00" />
<rect x="98.00" y="8.00" width="2.00" height="60.00" />
<rect x="106.00" y="8.00" width="4.00" height="60.00" />
<rect x="116.00" y="8.00" width="2.00" height="60.00" />
<rect x="120.00" y="8.00" width="2.00" height="40.00" />
<rect x="128.00" y="8.00" width="4.00" height="40.00" />
<rect x="138.00" y="8.00" width="2.00" height="40.00" />
<rect x="142.00" y="8.00" width="2.00" height="40.00" />
<rect x="150.00" y="8.00" width="4.00" height="40.00" />
<rect x="160.00" y="8.00" width="2.00" height="40.00" />
<rect x="164.00" y="8.00" width="2.00" height="40.00" />
<rect x="172.00" y="8.00" width="4.00" height="40.00" />
<rect x="182.00" y="8.00" width="4.00" height="20.00" />
<rect x="188.00" y="8.00" width="4.00" height="20.00" />
<rect x="196.00" y="8.00" width="4.00" height="20.00" />
<rect x="50.00" y="8.00" width="2.00" height="19.00" />
<rect x="54.00" y="8.00" width="8.00" height="19.00" />
<rect x="64.00" y="8.00" width="6.00" height="19.00" />
<rect x="72.00" y="8.00" width="2.00" height="19.00" />
<rect x="78.00" y="8.00" width="2.00" height="19.00" />
<rect x="82.00" y="8.00" width="4.00" height="19.00" />
<rect x="94.00" y="8.00" width="2.00" height="19.00" />
<rect x="98.00" y="8.00" width="2.00" height="19.00" />
<rect x="106.00" y="8.00" width="4.00" height="19.00" />
<rect x="116.00" y="8.00" width="2.00" height="19.00" />
<rect x="120.00" y="8.00" width="2.00" height="19.00" />
<rect x="128.00" y="8.00" width="4.00" height="19.00" />
<rect x="138.00" y="8.00" width="2.00" height="19.00" />
<rect x="142.00" y="8.00" width="2.00" height="19.00" />
<rect x="150.00" y="8.00" width="4.00" height="19.00" />
<rect x="160.00" y="8.00" width="2.00" height="19.00" />
<rect x="164.00" y="8.00" width="2.00" height="19.00" />
<rect x="172.00" y="8.00" width="4.00" height="19.00" />
<rect x="182.00" y="8.00" width="4.00" height="19.00" />
<rect x="188.00" y="8.00" width="4.00" height="19.00" />
<rect x="196.00" y="8.00" width="4.00" height="19.00" />
<rect x="204.00" y="8.00" width="4.00" height="60.00" />
<rect x="214.00" y="8.00" width="6.00" height="60.00" />
<rect x="222.00" y="8.00" width="2.00" height="60.00" />
<rect x="226.00" y="8.00" width="4.00" height="60.00" />
<rect x="72.00" y="28.00" width="4.00" height="20.00" />
<rect x="82.00" y="28.00" width="2.00" height="20.00" />
<rect x="88.00" y="28.00" width="2.00" height="20.00" />
<rect x="182.00" y="28.00" width="8.00" height="20.00" />
<rect x="192.00" y="28.00" width="2.00" height="40.00" />
<rect x="200.00" y="28.00" width="2.00" height="20.00" />
<rect x="72.00" y="48.00" width="2.00" height="20.00" />
<rect x="76.00" y="48.00" width="4.00" height="20.00" />
<rect x="84.00" y="48.00" width="6.00" height="20.00" />
<rect x="120.00" y="48.00" width="6.00" height="20.00" />
<rect x="128.00" y="48.00" width="8.00" height="20.00" />
<rect x="138.00" y="48.00" width="4.00" height="20.00" />
<rect x="146.00" y="48.00" width="4.00" height="20.00" />
<rect x="152.00" y="48.00" width="4.00" height="20.00" />
<rect x="160.00" y="48.00" width="4.00" height="20.00" />
<rect x="168.00" y="48.00" width="6.00" height="20.00" />
<rect x="178.00" y="48.00" width="2.00" height="20.00" />
<rect x="182.00" y="48.00" width="4.00" height="20.00" />
<rect x="198.00" y="48.00" width="2.00" height="20.00" />
<rect x="50.00" y="29.00" width="2.00" height="18.00" />
<rect x="54.00" y="29.00" width="8.00" height="18.00" />
<rect x="64.00" y="29.00" width="6.00" height="18.00" />
<rect x="72.00" y="29.00" width="4.00" height="18.00" />
<rect x="82.00" y="29.00" width="2.00" height="18.00" />
<rect x="88.00" y="29.00" width="2.00" height="18.00" />
<rect x="94.00" y="29.00" width="2.00" height="18.00" />
<rect x="98.00" y="29.00" width="2.00" height="18.00" />
<rect x="106.00" y="29.00" width="4.00" height="18.00" />
<rect x="116.00" y="29.00" width="2.00" height="18.00" />
<rect x="120.00" y="29.00" width="2.00" height="18.00" />
<rect x="128.00" y="29.00" width="4.00" height="18.00" />
<rect x="138.00" y="29.00" width="2.00" height="18.00" />
<rect x="142.00" y="29.00" width="2.00" height="18.00" />
<rect x="150.00" y="29.00" width="4.00" height="18.00" />
<rect x="160.00" y="29.00" width="2.00" height="18.00" />
<rect x="164.00" y="29.00" width="2.00" height="18.00" />
<rect x="172.00" y="29.00" width="4.00" height="18.00" />
<rect x="182.00" y="29.00" width="8.00" height="18.00" />
<rect x="192.00" y="29.00" width="2.00" height="18.00" />
<rect x="200.00" y="29.00" width="2.00" height="18.00" />
<rect x="50.00" y="49.00" width="2.00" height="19.00" />
<rect x="54.00" y="49.00" width="8.00" height="19.00" />
<rect x="64.00" y="49.00" width="6.00" height="19.00" />
<rect x="72.00" y="49.00" width="2.00" height="19.00" />
<rect x="76.00" y="49.00" width="4.00" height="19.00" />
<rect x="84.00" y="49.00" width="6.00" height="19.00" />
<rect x="94.00" y="49.00" width="2.00" height="19.00" />
<rect x="98.00" y="49.00" width="2.00" height="19.00" />
<rect x="106.00" y="49.00" width="4.00" height="19.00" />
<rect x="116.00" y="49.00" width="2.00" height="19.00" />
<rect x="120.00" y="49.00" width="6.00" height="19.00" />
<rect x="128.00" y="49.00" width="8.00" height="19.00" />
<rect x="138.00" y="49.00" width="4.00" height="19.00" />
<rect x="146.00" y="49.00" width="4.00" height="19.00" />
<rect x="152.00" y="49.00" width="4.00" height="19.00" />
<rect x="160.00" y="49.00" width="4.00" height="19.00" />
<rect x="168.00" y="49.00" width="6.00" height="19.00" />
<rect x="178.00" y="49.00" width="2.00" height="19.00" />
<rect x="182.00" y="49.00" width="4.00" height="19.00" />
<rect x="192.00" y="49.00" width="2.00" height="19.00" />
<rect x="198.00" y="49.00" width="2.00" height="19.00" />
<rect x="50.00" y="27.00" width="154.00" height="2.00" />
<rect x="50.00" y="47.00" width="154.00" height="2.00" />
<rect x="0.00" y="4.00" width="258.00" height="4.00" />

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

@ -0,0 +1,51 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="162" height="46" version="1.1"
xmlns="http://www.w3.org/2000/svg">
<desc>Zint Generated Symbol
</desc>
<g id="barcode" fill="#FF1115">
<rect x="0" y="0" width="162" height="46" fill="#FFFFFF" />
<rect x="20.00" y="2.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="24.00" y="2.00" width="6.00" height="20.00" opacity="0.498" />
<rect x="36.00" y="2.00" width="4.00" height="20.00" opacity="0.498" />
<rect x="44.00" y="2.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="50.00" y="2.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="56.00" y="2.00" width="4.00" height="20.00" opacity="0.498" />
<rect x="64.00" y="2.00" width="8.00" height="20.00" opacity="0.498" />
<rect x="76.00" y="2.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="80.00" y="2.00" width="6.00" height="20.00" opacity="0.498" />
<rect x="88.00" y="2.00" width="4.00" height="20.00" opacity="0.498" />
<rect x="96.00" y="2.00" width="8.00" height="20.00" opacity="0.498" />
<rect x="108.00" y="2.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="112.00" y="2.00" width="6.00" height="20.00" opacity="0.498" />
<rect x="120.00" y="2.00" width="6.00" height="20.00" opacity="0.498" />
<rect x="128.00" y="2.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="132.00" y="2.00" width="4.00" height="20.00" opacity="0.498" />
<rect x="144.00" y="2.00" width="6.00" height="20.00" opacity="0.498" />
<rect x="152.00" y="2.00" width="8.00" height="20.00" opacity="0.498" />
<rect x="20.00" y="24.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="24.00" y="24.00" width="4.00" height="20.00" opacity="0.498" />
<rect x="32.00" y="24.00" width="8.00" height="20.00" opacity="0.498" />
<rect x="44.00" y="24.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="48.00" y="24.00" width="6.00" height="20.00" opacity="0.498" />
<rect x="56.00" y="24.00" width="4.00" height="20.00" opacity="0.498" />
<rect x="62.00" y="24.00" width="12.00" height="20.00" opacity="0.498" />
<rect x="76.00" y="24.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="80.00" y="24.00" width="6.00" height="20.00" opacity="0.498" />
<rect x="88.00" y="24.00" width="6.00" height="20.00" opacity="0.498" />
<rect x="96.00" y="24.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="102.00" y="24.00" width="8.00" height="20.00" opacity="0.498" />
<rect x="114.00" y="24.00" width="4.00" height="20.00" opacity="0.498" />
<rect x="120.00" y="24.00" width="2.00" height="20.00" opacity="0.498" />
<rect x="126.00" y="24.00" width="10.00" height="20.00" opacity="0.498" />
<rect x="138.00" y="24.00" width="4.00" height="20.00" opacity="0.498" />
<rect x="146.00" y="24.00" width="4.00" height="20.00" opacity="0.498" />
<rect x="152.00" y="24.00" width="8.00" height="20.00" opacity="0.498" />
<rect x="20.00" y="22.00" width="140.00" height="2.00" opacity="0.498" />
<rect x="0.00" y="0.00" width="162.00" height="2.00" opacity="0.498" />
<rect x="0.00" y="44.00" width="162.00" height="2.00" opacity="0.498" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2020 - 2021 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2022 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -27,7 +27,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* vim: set ts=4 sw=4 et : */
/* SPDX-License-Identifier: BSD-3-Clause */
#include "testcommon.h"
#include <sys/stat.h>
@ -44,6 +44,7 @@ static void test_print(int index, int generate, int debug) {
int show_hrt;
int option_1;
int option_2;
int option_3;
float height;
char *fgcolour;
char *bgcolour;
@ -54,56 +55,58 @@ static void test_print(int index, int generate, int debug) {
char *expected_file;
};
struct item data[] = {
/* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "<>\"&'", "", 0, "code128_amperands.svg" },
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold.svg" },
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_box3.svg" },
/* 3*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.svg" },
/* 4*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, 3, 3, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp3.svg" },
/* 5*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, 0, "", "", 0, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.svg" },
/* 6*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, -1, -1, 3, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_3rows.svg" },
/* 7*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, 3, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2.svg" },
/* 8*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.svg" },
/* 9*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.svg" },
/* 10*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.svg" },
/* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "", "", 0, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.svg" },
/* 12*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.svg" },
/* 13*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.svg" },
/* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.svg" },
/* 15*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon.svg" },
/* 16*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_bind3.svg" },
/* 17*/ { BARCODE_UPCA, -1, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_small_bold.svg" },
/* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "", "", 0, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.svg" },
/* 19*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.svg" },
/* 20*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.svg" },
/* 21*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.svg" },
/* 22*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "upce_2addon.svg" },
/* 23*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon.svg" },
/* 24*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon_small.svg" },
/* 25*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, 0, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon_notext.svg" },
/* 26*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "", "", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.svg" },
/* 27*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "FF0000EE", "0000FF11", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_fgbgalpha.svg" },
/* 28*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "", "FFFFFF00", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_nobg.svg" },
/* 29*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "", "", 270, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_rotate_270.svg" },
/* 30*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.svg" },
/* 31*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.svg" },
/* 32*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "ean8_2addon.svg" },
/* 33*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "ean8_5addon.svg" },
/* 34*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, 0, "", "", 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.svg" },
/* 35*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, 0, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.svg" },
/* 36*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5.svg" },
/* 37*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12", "", 0, "ean2.svg" },
/* 38*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, 0, "", "", 0, "123", "", 0, "code39_small.svg" },
/* 39*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "postnet_zip.svg" },
/* 40*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, -1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_box2.svg" },
/* 41*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.svg" },
/* 42*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, 0, "121212DD", "EEEEEE22", 90, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_fgbg_rotate_90.svg" },
/* 43*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, 1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_vwsp1_bind1_dotty.svg" },
/* 44*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_hvwsp1_bind1_dotty.svg" },
/* 45*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345678909", "", 0, "dbar_ltd.svg" },
/* 46*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, 5, "", "", 0, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.svg" },
/* 47*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, "", "", 0, "12345678901234567890", "", 0, "imail_height7.75.svg" },
/* 48*/ { BARCODE_ULTRA, -1, 3, BARCODE_BOX, 2, 2, -1, -1, -1, 0, "FF0000", "0000FF", 0, "12345678901234567890", "", 0, "ultra_fgbg_hvwsp2_box3.svg" },
/* 49*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, -1, 0.4, "", "", 180, "A", "", 0, "telepen_height0.4_rotate_180.svg" },
/* 0*/ { BARCODE_CODE128, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "<>\"&'", "", 0, "code128_amperands.svg" },
/* 1*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold.svg" },
/* 2*/ { BARCODE_CODE128, UNICODE_MODE, 3, BOLD_TEXT | BARCODE_BOX, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_box3.svg" },
/* 3*/ { BARCODE_CODE128, UNICODE_MODE, 2, BOLD_TEXT | BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp2_box2.svg" },
/* 4*/ { BARCODE_CODE128, UNICODE_MODE, -1, BOLD_TEXT, 3, 3, -1, -1, -1, -1, 0, "", "", 0, "Égjpqy", "", 0, "code128_egrave_bold_hvwsp3.svg" },
/* 5*/ { BARCODE_GS1_128_CC, -1, -1, -1, -1, -1, -1, 3, -1, -1, 0, "", "", 0, "[00]030123456789012340", "[02]13012345678909[37]24[10]1234567ABCDEFG", 0, "gs1_128_cc_fig12.svg" },
/* 6*/ { BARCODE_CODABLOCKF, -1, -1, -1, -1, -1, -1, 3, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_3rows.svg" },
/* 7*/ { BARCODE_CODABLOCKF, -1, -1, -1, 2, 2, -1, 3, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2.svg" },
/* 8*/ { BARCODE_CODABLOCKF, -1, 2, BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "", "", 0, "AAAAAAAAA", "", 0, "codablockf_hvwsp2_box2.svg" },
/* 9*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9771384524017+12", "", 0, "ean13_2addon_ggs_5.2.2.5.1-2.svg" },
/* 10*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "9780877799306+54321", "", 0, "ean13_5addon_ggs_5.2.2.5.2-2.svg" },
/* 11*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "123456789012+12", "[91]123456789012345678901", 0, "ean13_cc_2addon_cca_4x4.svg" },
/* 12*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4.svg" },
/* 13*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "123456789012+54321", "[91]1234567890", 0, "ean13_cc_5addon_ccb_3x4_notext.svg" },
/* 14*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "012345678905+24", "", 0, "upca_2addon_ggs_5.2.6.6-5.svg" },
/* 15*/ { BARCODE_UPCA, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon.svg" },
/* 16*/ { BARCODE_UPCA, -1, 3, BARCODE_BIND, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_bind3.svg" },
/* 17*/ { BARCODE_UPCA, -1, -1, SMALL_TEXT | BOLD_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "614141234417+12345", "", 0, "upca_5addon_small_bold.svg" },
/* 18*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "12345678901+12", "[91]123456789", 0, "upca_cc_2addon_cca_3x4.svg" },
/* 19*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4.svg" },
/* 20*/ { BARCODE_UPCA_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_notext.svg" },
/* 21*/ { BARCODE_UPCA_CC, -1, 3, BARCODE_BIND, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "12345678901+12121", "[91]1234567890123", 0, "upca_cc_5addon_ccb_4x4_bind3.svg" },
/* 22*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "upce_2addon.svg" },
/* 23*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon.svg" },
/* 24*/ { BARCODE_UPCE, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon_small.svg" },
/* 25*/ { BARCODE_UPCE, -1, -1, -1, -1, -1, 0, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "upce_5addon_notext.svg" },
/* 26*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2.svg" },
/* 27*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "FF0000EE", "0000FF11", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_fgbgalpha.svg" },
/* 28*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "FFFFFF00", 0, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_nobg.svg" },
/* 29*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 270, "0654321+89", "[91]1", 0, "upce_cc_2addon_cca_5x2_rotate_270.svg" },
/* 30*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2.svg" },
/* 31*/ { BARCODE_UPCE_CC, -1, -1, -1, -1, -1, 0, 2, -1, -1, 0, "", "", 0, "1876543+56789", "[91]12345", 0, "upce_cc_5addon_ccb_8x2_notext.svg" },
/* 32*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12", "", 0, "ean8_2addon.svg" },
/* 33*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "1234567+12345", "", 0, "ean8_5addon.svg" },
/* 34*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 1, -1, -1, 0, "", "", 0, "9876543+65", "[91]1234567", 0, "ean8_cc_2addon_cca_4x3.svg" },
/* 35*/ { BARCODE_EANX_CC, -1, -1, -1, -1, -1, -1, 2, -1, -1, 0, "", "", 0, "9876543+74083", "[91]123456789012345678", 0, "ean8_cc_5addon_ccb_8x3.svg" },
/* 36*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "ean5.svg" },
/* 37*/ { BARCODE_EANX, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12", "", 0, "ean2.svg" },
/* 38*/ { BARCODE_CODE39, -1, -1, SMALL_TEXT, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "123", "", 0, "code39_small.svg" },
/* 39*/ { BARCODE_POSTNET, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345", "", 0, "postnet_zip.svg" },
/* 40*/ { BARCODE_MAXICODE, -1, 2, BARCODE_BOX, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_box2.svg" },
/* 41*/ { BARCODE_MAXICODE, -1, 1, BARCODE_BIND, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_vwsp1_bind1.svg" },
/* 42*/ { BARCODE_MAXICODE, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "121212DD", "EEEEEE22", 90, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "maxicode_fgbg_rotate_90.svg" },
/* 43*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, -1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_vwsp1_bind1_dotty.svg" },
/* 44*/ { BARCODE_DATAMATRIX, -1, 1, BARCODE_BIND | BARCODE_DOTTY_MODE, 1, 1, -1, -1, -1, -1, 0, "", "", 0, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "", 0, "datamatrix_hvwsp1_bind1_dotty.svg" },
/* 45*/ { BARCODE_DBAR_LTD, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, "", "", 0, "12345678909", "", 0, "dbar_ltd.svg" },
/* 46*/ { BARCODE_PDF417, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, "", "", 0, "Your Data Here!", "", ZINT_WARN_NONCOMPLIANT, "pdf417_height5.svg" },
/* 47*/ { BARCODE_USPS_IMAIL, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7.75, "", "", 0, "12345678901234567890", "", 0, "imail_height7.75.svg" },
/* 48*/ { BARCODE_ULTRA, -1, 3, BARCODE_BOX, 2, 2, -1, -1, -1, -1, 0, "FF0000", "0000FF", 0, "12345678901234567890", "", 0, "ultra_fgbg_hvwsp2_box3.svg" },
/* 49*/ { BARCODE_TELEPEN, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0.4, "", "", 180, "A", "", 0, "telepen_height0.4_rotate_180.svg" },
/* 50*/ { BARCODE_CODE49, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, -1, 0, "FF11157F", "", 0, "A", "", 0, "code49_comph_fgalpha.svg" },
/* 51*/ { BARCODE_CODABLOCKF, -1, -1, COMPLIANT_HEIGHT, -1, -1, -1, -1, -1, 2, 0, "00000033", "FFFFFF66", 0, "1234567890123456789012345678901234", "", 0, "codablockf_comph_sep2_fgbgalpha.svg" },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -138,12 +141,12 @@ static void test_print(int index, int generate, int debug) {
int text_length;
if (index != -1 && i != index) continue;
if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); // ZINT_DEBUG_TEST_PRINT 16
if ((debug & ZINT_DEBUG_TEST_PRINT) && !(debug & ZINT_DEBUG_TEST_LESS_NOISY)) printf("i:%d\n", i); /* ZINT_DEBUG_TEST_PRINT 16 */
symbol = ZBarcode_Create();
assert_nonnull(symbol, "Symbol not created\n");
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, -1, data[i].output_options, data[i].data, -1, debug);
length = testUtilSetSymbol(symbol, data[i].symbology, data[i].input_mode, -1 /*eci*/, data[i].option_1, data[i].option_2, data[i].option_3, data[i].output_options, data[i].data, -1, debug);
if (data[i].show_hrt != -1) {
symbol->show_hrt = data[i].show_hrt;
}
@ -184,10 +187,10 @@ static void test_print(int index, int generate, int debug) {
assert_nonzero(testUtilDataPath(expected_file, sizeof(expected_file), data_dir, data[i].expected_file), "i:%d testUtilDataPath == 0\n", i);
if (generate) {
printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %.8g, \"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\" },\n",
printf(" /*%3d*/ { %s, %s, %d, %s, %d, %d, %d, %d, %d, %d, %.8g, \"%s\", \"%s\", %d, \"%s\", \"%s\", \"%s\" },\n",
i, testUtilBarcodeName(data[i].symbology), testUtilInputModeName(data[i].input_mode), data[i].border_width,
testUtilOutputOptionsName(data[i].output_options), data[i].whitespace_width, data[i].whitespace_height, data[i].show_hrt,
data[i].option_1, data[i].option_2, data[i].height, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle,
data[i].option_1, data[i].option_2, data[i].option_3, data[i].height, data[i].fgcolour, data[i].bgcolour, data[i].rotate_angle,
testUtilEscape(data[i].data, length, escaped, escaped_size), data[i].composite, data[i].expected_file);
ret = testUtilRename(symbol->outfile, expected_file);
assert_zero(ret, "i:%d testUtilRename(%s, %s) ret %d != 0\n", i, symbol->outfile, expected_file, ret);
@ -196,7 +199,7 @@ static void test_print(int index, int generate, int debug) {
assert_zero(ret, "i:%d %s libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
}
if (have_vnu) {
ret = testUtilVerifyVnu(expected_file, debug); // Very slow
ret = testUtilVerifyVnu(expected_file, debug); /* Very slow */
assert_zero(ret, "i:%d %s vnu libreoffice %s ret %d != 0\n", i, testUtilBarcodeName(data[i].symbology), expected_file, ret);
}
} else {
@ -257,3 +260,5 @@ int main(int argc, char *argv[]) {
return 0;
}
/* vim: set ts=4 sw=4 et : */

View file

@ -1167,12 +1167,12 @@ static void test_quiet_zones(int index, int debug) {
/* 48*/ { BARCODE_DPLEIT, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 50, 1, 135, 310, 118.9, 20, 0, 2, 100 },
/* 49*/ { BARCODE_DPIDENT, -1, -1, -1, "1234", 0, 50, 1, 117, 234, 118.9, 0, 0, 2, 100 },
/* 50*/ { BARCODE_DPIDENT, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 50, 1, 117, 274, 118.9, 20, 0, 2, 100 },
/* 51*/ { BARCODE_CODE16K, -1, -1, -1, "1234", 0, 20, 2, 70, 162, 44, 20, 2, 6, 20 },
/* 52*/ { BARCODE_CODE16K, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 20, 2, 70, 162, 44, 20, 2, 6, 20 },
/* 53*/ { BARCODE_CODE16K, BARCODE_NO_QUIET_ZONES, -1, -1, "1234", 0, 20, 2, 70, 140, 44, 0, 2, 6, 20 },
/* 54*/ { BARCODE_CODE49, -1, -1, -1, "1234", 0, 20, 2, 70, 162, 44, 20, 2, 2, 40 },
/* 55*/ { BARCODE_CODE49, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 20, 2, 70, 162, 44, 20, 2, 2, 40 },
/* 56*/ { BARCODE_CODE49, BARCODE_NO_QUIET_ZONES, -1, -1, "1234", 0, 20, 2, 70, 140, 44, 0, 2, 2, 40 },
/* 51*/ { BARCODE_CODE16K, -1, -1, -1, "1234", 0, 20, 2, 70, 162, 44, 20, 2, 6, 19 },
/* 52*/ { BARCODE_CODE16K, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 20, 2, 70, 162, 44, 20, 2, 6, 19 },
/* 53*/ { BARCODE_CODE16K, BARCODE_NO_QUIET_ZONES, -1, -1, "1234", 0, 20, 2, 70, 140, 44, 0, 2, 6, 19 },
/* 54*/ { BARCODE_CODE49, -1, -1, -1, "1234", 0, 20, 2, 70, 162, 44, 20, 2, 2, 19 },
/* 55*/ { BARCODE_CODE49, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 20, 2, 70, 162, 44, 20, 2, 2, 19 },
/* 56*/ { BARCODE_CODE49, BARCODE_NO_QUIET_ZONES, -1, -1, "1234", 0, 20, 2, 70, 140, 44, 0, 2, 2, 19 },
/* 57*/ { BARCODE_CODE93, -1, -1, -1, "1234", 0, 50, 1, 73, 146, 118.9, 0, 0, 2, 100 },
/* 58*/ { BARCODE_CODE93, BARCODE_QUIET_ZONES, -1, -1, "1234", 0, 50, 1, 73, 186, 118.9, 20, 0, 2, 100 },
/* 59*/ { BARCODE_FLAT, -1, -1, -1, "1234", 0, 50, 1, 36, 72, 100, 0, 0, 2, 100 },

View file

@ -1,6 +1,6 @@
--- /home/mburke/code/gitlost/postscriptbarcode/build/monolithic/barcode.ps 2022-07-25 02:58:57.291864362 +0100
+++ backend/tests/tools/bwipp_dump.ps 2022-07-25 03:00:12.937844813 +0100
@@ -16909,8 +16909,8 @@
--- /home/mburke/code/gitlost/postscriptbarcode/build/monolithic/barcode.ps 2022-08-07 21:25:25.243853138 +0100
+++ backend/tests/tools/bwipp_dump.ps 2022-08-07 21:28:28.580645899 +0100
@@ -16846,8 +16846,8 @@
} bind
/fime {
/sbs [2.25 6.75 2.25 15.75 2.25 6.75 2.25] def
@ -11,7 +11,7 @@
} bind
>> def
@@ -28403,7 +28403,7 @@
@@ -28303,7 +28303,7 @@
pop
} ifelse
@ -20,8 +20,8 @@
options (lintype) (ean13) put
options (inkspread) (0) put
@@ -28443,27 +28443,73 @@
} if
@@ -28317,27 +28317,73 @@
/ai //gs1process exec pop pop pop
% Plot the linear part
- linear options //ean13 exec //renlinear exec
@ -112,7 +112,7 @@
end
@@ -28528,7 +28574,7 @@
@@ -28401,7 +28447,7 @@
pop
} ifelse
@ -121,8 +121,8 @@
% Get the result of encoding with ean8 and gs1-cc
options (lintype) (ean8) put
@@ -28569,29 +28615,75 @@
} if
@@ -28416,29 +28462,75 @@
/ai //gs1process exec pop pop pop
% Plot the linear part
- linear options //ean8 exec //renlinear exec
@ -217,7 +217,7 @@
end
@@ -28656,7 +28748,7 @@
@@ -28502,7 +28594,7 @@
pop
} ifelse
@ -226,8 +226,8 @@
options (lintype) (ean13) put
options (inkspread) (0) put
@@ -28696,27 +28788,73 @@
} if
@@ -28516,27 +28608,73 @@
/ai //gs1process exec pop pop pop
% Plot the linear part
- linear options //upca exec //renlinear exec
@ -318,7 +318,7 @@
end
@@ -28796,7 +28934,7 @@
@@ -28615,7 +28753,7 @@
/opt options
>> def
@ -327,8 +327,8 @@
options (lintype) (upce) put
options (inkspread) (0) put
@@ -28836,27 +28974,73 @@
} if
@@ -28629,27 +28767,73 @@
/ai //gs1process exec pop pop pop
% Plot the linear part
- linear options //upce exec //renlinear exec
@ -419,7 +419,7 @@
end
@@ -28921,7 +29105,7 @@
@@ -28713,7 +28897,7 @@
pop
} ifelse
@ -428,7 +428,7 @@
options (lintype) (databaromni) put
options (linkage) true put
@@ -28965,7 +29149,7 @@
@@ -28731,7 +28915,7 @@
linear options //databaromni exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -437,7 +437,7 @@
% Plot the separator
/sepfinder {
@@ -28996,20 +29180,66 @@
@@ -28762,20 +28946,66 @@
sep 0 [0 0 0] putinterval
sep sep length 4 sub [0 0 0 0] putinterval
18 sepfinder 64 sepfinder
@ -516,7 +516,7 @@
end
@@ -29073,7 +29303,7 @@
@@ -28838,7 +29068,7 @@
pop
} ifelse
@ -525,7 +525,7 @@
options (lintype) (databarstacked) put
options (linkage) true put
@@ -29117,7 +29347,7 @@
@@ -28856,7 +29086,7 @@
linear options //databarstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -534,7 +534,7 @@
% Plot the separator
/sepfinder {
@@ -29145,20 +29375,52 @@
@@ -28884,20 +29114,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -599,7 +599,7 @@
end
@@ -29222,7 +29484,7 @@
@@ -28960,7 +29222,7 @@
pop
} ifelse
@ -608,7 +608,7 @@
options (lintype) (databarstackedomni) put
options (linkage) true put
@@ -29266,7 +29528,7 @@
@@ -28978,7 +29240,7 @@
linear options //databarstackedomni exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -617,7 +617,7 @@
% Plot the separator
/sepfinder {
@@ -29294,20 +29556,52 @@
@@ -29006,20 +29268,52 @@
sep 0 [ 0 0 0 0 ] putinterval
sep sep length 4 sub [ 0 0 0 0 ] putinterval
18 sepfinder
@ -682,7 +682,7 @@
end
@@ -29525,7 +29819,7 @@
@@ -29209,7 +29503,7 @@
pop
} ifelse
@ -691,7 +691,7 @@
options (lintype) (databarlimited) put
options (linkage) true put
@@ -29569,7 +29863,7 @@
@@ -29227,7 +29521,7 @@
linear options //databarlimited exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -700,7 +700,7 @@
% Plot the separator
mark
@@ -29577,22 +29871,68 @@
@@ -29235,22 +29529,68 @@
counttomark 1 sub array astore /sep exch def pop pop
sep 0 [0 0 0] putinterval
sep sep length 9 sub [0 0 0 0 0 0 0 0 0] putinterval % 4 + 5 right guard spaces
@ -783,7 +783,7 @@
end
@@ -29657,7 +29997,7 @@
@@ -29314,7 +29654,7 @@
pop
} ifelse
@ -792,7 +792,7 @@
options (lintype) (databarexpanded) put
options (linkage) true put
@@ -29701,7 +30041,7 @@
@@ -29332,7 +29672,7 @@
linear options //databarexpanded exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -801,7 +801,7 @@
% Plot the separator
/sepfinder {
@@ -29730,20 +30070,60 @@
@@ -29361,20 +29701,60 @@
18 98 bot length 13 sub {} for
69 98 bot length 13 sub {} for
] {sepfinder} forall
@ -874,7 +874,7 @@
end
@@ -29807,7 +30187,7 @@
@@ -29437,7 +29817,7 @@
pop
} ifelse
@ -883,7 +883,7 @@
options (lintype) (databarexpandedstacked) put
options (linkage) true put
@@ -29851,7 +30231,7 @@
@@ -29455,7 +29835,7 @@
linear options //databarexpandedstacked exec
dup (pixs) get 0 2 index (pixx) get getinterval /bot exch def
dup (pixy) get /linheight exch def
@ -892,7 +892,7 @@
% Plot the separator
/sepfinder {
@@ -29877,21 +30257,49 @@
@@ -29481,21 +29861,49 @@
19 98 bot length 13 sub {} for
70 98 bot length 13 sub {} for
] {sepfinder} forall
@ -955,7 +955,7 @@
end
@@ -29956,7 +30364,7 @@
@@ -29559,7 +29967,7 @@
pop
} ifelse
@ -964,7 +964,7 @@
options (inkspread) (0) put
options (dontdraw) true put
@@ -30016,35 +30424,87 @@
@@ -29593,35 +30001,87 @@
linear << options {} forall >> //gs1-128 exec
dup (sbs) get /linsbs exch def
dup (bhs) get 0 get 72 mul /linheight exch def
@ -1066,7 +1066,7 @@
end
@@ -31752,3 +32212,189 @@
@@ -31105,3 +31565,189 @@
% --END ENCODER hibcazteccode--
% --END TEMPLATE--

View file

@ -405,8 +405,9 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
int text_height; /* Font pixel size (so whole integers) */
float text_gap; /* Gap between barcode and text */
float guard_descent;
float addon_row_height;
const int is_codablockf = symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF;
float addon_row_height;
float large_bar_height;
int upcae_outside_text_height = 0; /* UPC-A/E outside digits font size */
float digit_ascent_factor = 0.25f; /* Assuming digit ascent roughly 25% less than font size */
@ -420,6 +421,9 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
struct zint_vector_hexagon *hexagon, *last_hexagon = NULL;
struct zint_vector_string *last_string = NULL;
struct zint_vector_circle *circle, *last_circle = NULL;
struct zint_vector_rect **first_row_rects = z_alloca(sizeof(struct zint_vector_rect *) * (symbol->rows + 1));
memset(first_row_rects, 0, sizeof(struct zint_vector_rect *) * (symbol->rows + 1));
/* Free any previous rendering structures */
vector_free(symbol);
@ -638,6 +642,9 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
rect = vector_plot_create_rect(symbol, i + xoffset, yposn, block_width, row_height);
if (!rect) return ZINT_ERROR_MEMORY;
vector_plot_add_rect(symbol, rect, &last_rectangle);
if (i == 0) {
first_row_rects[r] = rect;
}
}
}
yposn += row_height;
@ -854,16 +861,40 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
if ((symbol->output_options & BARCODE_BIND) && (symbol->rows > 1) && is_stackable(symbol->symbology)) {
float sep_xoffset = xoffset;
float sep_width = symbol->width;
float sep_height = 1.0f, sep_yoffset;
float sep_height = 1.0f, sep_yoffset, sep_half_height;
if (symbol->option_3 > 0 && symbol->option_3 <= 4) {
sep_height = symbol->option_3;
}
sep_yoffset = yoffset - sep_height / 2;
if (symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF) {
sep_half_height = sep_height / 2.0f;
sep_yoffset = yoffset - sep_half_height;
if (is_codablockf) {
/* Avoid 11-module start and 13-module stop chars */
sep_xoffset += 11;
sep_width -= 11 + 13;
}
/* Adjust original rectangles so don't overlap with separator(s) (important for RGBA) */
for (r = 0; r < symbol->rows; r++) {
for (rect = first_row_rects[r], i = 0; rect && rect != first_row_rects[r + 1]; rect = rect->next, i++) {
if (is_codablockf) { /* Skip start and stop chars */
if (i < 3) {
continue;
}
if ((i / 3) * 11 + 13 >= symbol->width) { /* 3 bars and 11 modules per char */
break;
}
}
if (r != 0) {
rect->y += sep_height - sep_half_height;
rect->height -= r + 1 == symbol->rows ? sep_half_height : sep_height;
} else {
rect->height -= sep_half_height;
}
if (rect->height < 0) {
rect->height = 0.0f;
/* TODO: warn? */
}
}
}
for (r = 1; r < symbol->rows; r++) {
const float row_height = symbol->row_height[r - 1] ? symbol->row_height[r - 1] : large_bar_height;
rect = vector_plot_create_rect(symbol, sep_xoffset, (r * row_height) + sep_yoffset,
@ -886,8 +917,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
/* Top */
rect = vector_plot_create_rect(symbol, 0.0f, ybind_top, vector->width, symbol->border_width);
if (!rect) return ZINT_ERROR_MEMORY;
if (!(symbol->output_options & BARCODE_BOX)
&& (symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF)) {
if (!(symbol->output_options & BARCODE_BOX) && is_codablockf) {
/* CodaBlockF bind - does not extend over horizontal whitespace */
rect->x = xoffset;
rect->width -= xoffset + roffset;
@ -896,8 +926,7 @@ INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_
/* Bottom */
rect = vector_plot_create_rect(symbol, 0.0f, ybind_bot, vector->width, symbol->border_width);
if (!rect) return ZINT_ERROR_MEMORY;
if (!(symbol->output_options & BARCODE_BOX)
&& (symbol->symbology == BARCODE_CODABLOCKF || symbol->symbology == BARCODE_HIBC_BLOCKF)) {
if (!(symbol->output_options & BARCODE_BOX) && is_codablockf) {
/* CodaBlockF bind - does not extend over horizontal whitespace */
rect->x = xoffset;
rect->width -= xoffset + roffset;

View file

@ -24,11 +24,10 @@
//#include <QDebug>
#include "qzint.h"
#include <stdio.h>
#include <math.h>
#include <stdio.h>
#include <QFontMetrics>
/* the following include was necessary to compile with Qt 5.15 on Windows */
/* Qt 5.7 did not require it. */
/* The following include is necessary to compile with Qt 5.15 on Windows; Qt 5.7 did not require it */
#include <QPainterPath>
// Shorthand
@ -61,49 +60,49 @@ namespace Zint {
return ret;
}
/* Helper to calculate max right and bottom of elements for fudging render() */
static void getMaxRectsRightBottom(struct zint_vector *vector, int &maxRight, int &maxBottom) {
/* Helper to calculate max right and bottom of elements for fudging render() */
static void getMaxRectsRightBottom(struct zint_vector *vector, int &maxRight, int &maxBottom) {
struct zint_vector_rect *rect;
struct zint_vector_hexagon *hex;
struct zint_vector_circle *circle;
maxRight = maxBottom = -1;
maxRight = maxBottom = -1;
for (rect = vector->rectangles; rect; rect = rect->next) {
if (rect->x + rect->width > maxRight) {
maxRight = rect->x + rect->width;
}
if (rect->y + rect->height > maxBottom) {
maxBottom = rect->y + rect->height;
}
}
for (rect = vector->rectangles; rect; rect = rect->next) {
if (rect->x + rect->width > maxRight) {
maxRight = rect->x + rect->width;
}
if (rect->y + rect->height > maxBottom) {
maxBottom = rect->y + rect->height;
}
}
for (hex = vector->hexagons; hex; hex = hex->next) {
if (hex->x + hex->diameter > maxRight) {
maxRight = hex->x + hex->diameter;
}
if (hex->y + hex->diameter > maxBottom) {
maxBottom = hex->y + hex->diameter;
}
}
for (hex = vector->hexagons; hex; hex = hex->next) {
if (hex->x + hex->diameter > maxRight) {
maxRight = hex->x + hex->diameter;
}
if (hex->y + hex->diameter > maxBottom) {
maxBottom = hex->y + hex->diameter;
}
}
for (circle = vector->circles; circle; circle = circle->next) {
if (circle->x + circle->diameter + circle->width > maxRight) {
maxRight = circle->x + circle->diameter + circle->width;
}
if (circle->y + circle->diameter + circle->width > maxBottom) {
maxBottom = circle->y + circle->diameter + circle->width;
}
}
// TODO: Strings?
}
for (circle = vector->circles; circle; circle = circle->next) {
if (circle->x + circle->diameter + circle->width > maxRight) {
maxRight = circle->x + circle->diameter + circle->width;
}
if (circle->y + circle->diameter + circle->width > maxBottom) {
maxBottom = circle->y + circle->diameter + circle->width;
}
}
// TODO: Strings?
}
/* Segment constructors */
QZintSeg::QZintSeg() : m_eci(0) {}
QZintSeg::QZintSeg(const QString& text, const int ECIIndex) : m_text(text), m_eci(ECIIndexToECI(ECIIndex)) {}
QZint::QZint()
: m_zintSymbol(NULL), m_symbol(BARCODE_CODE128), m_input_mode(UNICODE_MODE),
: m_zintSymbol(nullptr), m_symbol(BARCODE_CODE128), m_input_mode(UNICODE_MODE),
m_height(0.0f),
m_option_1(-1), m_option_2(0), m_option_3(0),
m_scale(1.0f),
@ -135,16 +134,33 @@ namespace Zint {
}
void QZint::resetSymbol() {
if (m_zintSymbol)
ZBarcode_Delete(m_zintSymbol);
m_error = 0;
m_lastError.clear();
m_zintSymbol = ZBarcode_Create();
m_zintSymbol->output_options |= m_borderType | m_fontSetting;
if (m_zintSymbol) {
ZBarcode_Clear(m_zintSymbol);
} else if (!(m_zintSymbol = ZBarcode_Create())) {
m_error = ZINT_ERROR_MEMORY;
m_lastError = QSL("Insufficient memory for Zint structure");
return;
}
m_zintSymbol->symbology = m_symbol;
m_zintSymbol->height = m_height;
m_zintSymbol->scale = m_scale;
m_zintSymbol->whitespace_width = m_whitespace;
m_zintSymbol->whitespace_height = m_vwhitespace;
m_zintSymbol->border_width = m_borderWidth;
m_zintSymbol->output_options = m_borderType | m_fontSetting;
if (m_dotty) {
m_zintSymbol->output_options |= BARCODE_DOTTY_MODE;
}
if (m_cmyk) {
m_zintSymbol->output_options |= CMYK_COLOUR;
}
if (m_gssep) {
m_zintSymbol->output_options |= GS1_GS_SEPARATOR;
}
if (m_quiet_zones) {
m_zintSymbol->output_options |= BARCODE_QUIET_ZONES;
}
@ -154,39 +170,9 @@ namespace Zint {
if (m_compliant_height) {
m_zintSymbol->output_options |= COMPLIANT_HEIGHT;
}
m_zintSymbol->border_width = m_borderWidth;
m_zintSymbol->option_1 = m_option_1;
m_zintSymbol->option_2 = m_option_2;
m_zintSymbol->option_3 = m_option_3;
m_zintSymbol->input_mode = m_input_mode;
if (m_dotty) {
m_zintSymbol->output_options |= BARCODE_DOTTY_MODE;
}
m_zintSymbol->dot_size = m_dot_size;
m_zintSymbol->guard_descent = m_guardDescent;
m_zintSymbol->structapp = m_structapp;
m_zintSymbol->show_hrt = m_show_hrt ? 1 : 0;
m_zintSymbol->eci = m_eci;
m_zintSymbol->scale = m_scale;
if (m_gs1parens) {
m_zintSymbol->input_mode |= GS1PARENS_MODE;
}
if (m_gs1nocheck) {
m_zintSymbol->input_mode |= GS1NOCHECK_MODE;
}
if (m_gssep) {
m_zintSymbol->output_options |= GS1_GS_SEPARATOR;
}
if (m_reader_init) {
m_zintSymbol->output_options |= READER_INIT;
}
if (m_warn_level) {
m_zintSymbol->warn_level = m_warn_level;
}
if (m_debug) {
m_zintSymbol->debug |= ZINT_DEBUG_PRINT;
}
strcpy(m_zintSymbol->fgcolour, m_fgColor.name().toLatin1().right(6));
if (m_fgColor.alpha() != 0xFF) {
strcat(m_zintSymbol->fgcolour, m_fgColor.name(QColor::HexArgb).toLatin1().mid(1,2));
@ -195,10 +181,24 @@ namespace Zint {
if (m_bgColor.alpha() != 0xFF) {
strcat(m_zintSymbol->bgcolour, m_bgColor.name(QColor::HexArgb).toLatin1().mid(1,2));
}
if (m_cmyk) {
m_zintSymbol->output_options |= CMYK_COLOUR;
}
strcpy(m_zintSymbol->primary, m_primaryMessage.toLatin1().left(127));
m_zintSymbol->option_1 = m_option_1;
m_zintSymbol->option_2 = m_option_2;
m_zintSymbol->option_3 = m_option_3;
m_zintSymbol->show_hrt = m_show_hrt ? 1 : 0;
m_zintSymbol->input_mode = m_input_mode;
if (m_gs1parens) {
m_zintSymbol->input_mode |= GS1PARENS_MODE;
}
if (m_gs1nocheck) {
m_zintSymbol->input_mode |= GS1NOCHECK_MODE;
}
m_zintSymbol->eci = m_eci;
m_zintSymbol->dot_size = m_dot_size;
m_zintSymbol->guard_descent = m_guardDescent;
m_zintSymbol->structapp = m_structapp;
m_zintSymbol->warn_level = m_warn_level;
m_zintSymbol->debug = m_debug ? ZINT_DEBUG_PRINT : 0;
}
void QZint::encode() {
@ -811,10 +811,8 @@ namespace Zint {
// Plot rectangles
rect = m_zintSymbol->vector->rectangles;
if (rect) {
int maxRight = -1, maxBottom = -1; // Used for fudging below
if (borderWidth() && (borderType() & (BARCODE_BIND | BARCODE_BOX))) {
getMaxRectsRightBottom(m_zintSymbol->vector, maxRight, maxBottom);
}
int maxRight = -1, maxBottom = -1; // Used for fudging below
getMaxRectsRightBottom(m_zintSymbol->vector, maxRight, maxBottom);
QBrush brush(Qt::SolidPattern);
while (rect) {
if (rect->colour == -1) {
@ -822,10 +820,10 @@ namespace Zint {
} else {
brush.setColor(colourToQtColor(rect->colour));
}
// Allow for rounding errors on translation/scaling TODO: proper calc
float fudgeW = rect->x + rect->width == maxRight ? 0.1f : 0.0f;
float fudgeH = rect->y + rect->height == maxBottom ? 0.1f : 0.0f;
painter.fillRect(QRectF(rect->x, rect->y, rect->width + fudgeW, rect->height + fudgeH), brush);
// Allow for rounding errors on translation/scaling TODO: proper calc
float fudgeW = rect->x + rect->width == maxRight ? 0.1f : 0.0f;
float fudgeH = rect->y + rect->height == maxBottom ? 0.1f : 0.0f;
painter.fillRect(QRectF(rect->x, rect->y, rect->width + fudgeW, rect->height + fudgeH), brush);
rect = rect->next;
}
}

View file

@ -39,6 +39,16 @@ be set based on data</string>
</attribute>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtAztecAutoInfo">
<property name="frame">
<bool>false</bool>
</property>
<property name="readonly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radAztecSize">
<property name="text">

View file

@ -39,6 +39,16 @@ based on data</string>
</attribute>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtUltraAutoInfo">
<property name="frame">
<bool>false</bool>
</property>
<property name="readonly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="radUltraEcc">
<property name="text">

View file

@ -860,6 +860,7 @@ void MainWindow::open_data_dialog_seg(const int seg_no)
}
disconnect(&dlg, SIGNAL(dataChanged(const QString&, bool, int)), this,
SLOT(on_dataChanged(const QString&, bool, int)));
update_preview();
}
void MainWindow::open_data_dialog()
@ -1155,14 +1156,18 @@ void MainWindow::on_encoded()
if (QApplication::activeModalWidget() != nullptr) { // Protect against encode in popup dialog
return;
}
enableActions(true);
errtxtBar_set(false /*isError*/);
enableActions();
errtxtBar_set();
if (!chkAutoHeight->isEnabled() || chkAutoHeight->isChecked() || !heightb->isEnabled()) {
/* setValue() rounds up/down to precision (decimals 3), we want round up only */
float height = (float) (ceil(m_bc.bc.height() * 1000.0f) / 1000.0f);
heightb->setValue(height);
}
if (m_optionWidget) {
automatic_info_set();
}
}
void MainWindow::on_errored()
@ -1170,8 +1175,11 @@ void MainWindow::on_errored()
if (QApplication::activeModalWidget() != nullptr) { // Protect against error in popup dialog (Sequence Export)
return;
}
enableActions(false);
errtxtBar_set(true /*isError*/);
enableActions();
errtxtBar_set();
if (m_optionWidget) {
automatic_info_set();
}
}
void MainWindow::filter_symbologies()
@ -3026,8 +3034,9 @@ void MainWindow::createMenu()
m_menu->addAction(m_quitAct);
}
void MainWindow::enableActions(bool enabled)
void MainWindow::enableActions()
{
const bool enabled = m_bc.bc.getError() < ZINT_ERROR;
btnCopyBMP->setEnabled(enabled);
btnCopySVG->setEnabled(enabled);
btnSave->setEnabled(enabled);
@ -3101,8 +3110,9 @@ void MainWindow::errtxtBar_clear()
}
}
void MainWindow::errtxtBar_set(bool isError)
void MainWindow::errtxtBar_set()
{
const bool isError = m_bc.bc.getError() >= ZINT_ERROR;
if (!m_bc.bc.hasErrors()) {
errtxtBar_clear();
view->setMinimumSize(QSize(0, 35));
@ -3120,6 +3130,267 @@ void MainWindow::errtxtBar_set(bool isError)
}
}
void MainWindow::automatic_info_set()
{
if (!m_optionWidget) {
return;
}
const int symbology = bstyle_items[bstyle->currentIndex()].symbology;
const bool isError = m_bc.bc.getError() >= ZINT_ERROR;
QLineEdit *txt;
QComboBox *cmb;
if (symbology == BARCODE_AZTEC || symbology == BARCODE_HIBC_AZTEC) {
if ((txt = m_optionWidget->findChild<QLineEdit*>(QSL("txtAztecAutoInfo")))) {
if (!isError && !get_rad_val(QSL("radAztecSize"))) {
const int w = m_bc.bc.encodedWidth();
if (w <= 27) { // Note Zint always favours Compact on automatic
txt->setText(QString::asprintf("(%d X %d Compact)", w, w));
} else {
txt->setText(QString::asprintf("(%d X %d (%d Layers))", w, w, (w - 15) / 4));
}
} else {
txt->setText(QSL(""));
}
}
} else if (symbology == BARCODE_CHANNEL) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbChannel")))) {
if (!isError && cmb->currentIndex() == 0) {
const int channels = (m_bc.bc.encodedWidth() - 7) / 4;
cmb->setItemText(0, QString::asprintf("Automatic (%d)", channels));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_CODABLOCKF || symbology == BARCODE_HIBC_BLOCKF) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbCbfWidth")))) {
if (!isError && cmb->currentIndex() == 0) {
const int data = (m_bc.bc.encodedWidth() - 57) / 11;
cmb->setItemText(0, QString::asprintf("Automatic (%d (%d data))", data + 5, data));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbCbfHeight")))) {
if (!isError && cmb->currentIndex() == 0) {
cmb->setItemText(0, QString::asprintf("Automatic (%d)", m_bc.bc.encodedRows()));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_CODE16K) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbC16kRows")))) {
if (!isError && cmb->currentIndex() == 0) {
cmb->setItemText(0, QString::asprintf("Automatic (%d)", m_bc.bc.encodedRows()));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_CODE49) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbC49Rows")))) {
if (!isError && cmb->currentIndex() == 0) {
cmb->setItemText(0, QString::asprintf("Automatic (%d)", m_bc.bc.encodedRows()));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_CODEONE) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbC1Size")))) {
if (!isError && cmb->currentIndex() == 0) {
const int r = m_bc.bc.encodedRows();
const int w = m_bc.bc.encodedWidth();
// Note Versions S & T not used by Zint in automatic mode
static const char vers[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' };
int idx;
if (r <= 40) {
idx = (r == 22) + (r == 28) * 2 + (r == 40) * 3;
} else {
idx = (r == 70) + (r == 104) * 2 + (r == 148) * 3 + 4;
}
cmb->setItemText(0, QString::asprintf("Automatic (%d X %d (Version %c))", r, w, vers[idx]));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_DATAMATRIX || symbology == BARCODE_HIBC_DM) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbDM200Size")))) {
if (!isError && cmb->currentIndex() == 0) {
const int r = m_bc.bc.encodedRows();
const int w = m_bc.bc.encodedWidth();
int z = 0;
if (r == w) {
if (r <= 26) {
z = (r - 8) / 2;
} else if (r <= 52) {
z = 10 + (r - 32) / 4;
} else if (r <= 104) {
z = 16 + (r - 64) / 8;
} else {
z = 22 + (r - 120) / 12;
}
cmb->setItemText(0, QString::asprintf("Automatic (%d x %d (Zint %d))", r, w, z));
} else if ((r == 8 && (w == 18 || w == 32)) || (r == 12 && (w == 26 || w == 36))
|| (r == 16 && (w == 36 || w == 48))) {
z = 25 + (w == 32) + (w == 26) * 2 + (r == 12 && w == 36) * 3
+ (r == 16 && w == 36) * 4 + (w == 48) * 5;
cmb->setItemText(0, QString::asprintf("Automatic (%d x %d (Zint %d))", r, w, z));
} else { // DMRE
if (r == 8) {
z = 31 + (w == 64) + (w == 80) * 2 + (w == 96) * 3 + (w == 120) * 4 + (w == 144) * 5;
} else if (r == 12) {
z = 37 + (w == 88);
} else if (r == 16) {
z = 39;
} else if (r == 20) {
z = 40 + (w == 44) + (w == 64) * 2;
} else if (r == 22) {
z = 43;
} else if (r == 24) {
z = 44 + (w == 64);
} else { /* if (r == 26) */
z = 46 + (w == 48) + (w == 64) * 2;
}
cmb->setItemText(0, QString::asprintf("Automatic (%d x %d (DMRE) (Zint %d))", r, w, z));
}
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_DOTCODE) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbDotCols")))) {
if (!isError && cmb->currentIndex() == 0) {
cmb->setItemText(0, QString::asprintf("Automatic (%d)", m_bc.bc.encodedWidth()));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_GRIDMATRIX) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbGridSize")))) {
if (!isError && cmb->currentIndex() == 0) {
const int r = m_bc.bc.encodedRows();
cmb->setItemText(0, QString::asprintf("Automatic (%d x %d (Version %d))", r, r, (r - 6) / 12));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_HANXIN) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbHXSize")))) {
if (!isError && cmb->currentIndex() == 0) {
const int r = m_bc.bc.encodedRows();
cmb->setItemText(0, QString::asprintf("Automatic (%d x %d (Version %d))", r, r, (r - 21) / 2));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_MICROPDF417 || symbology == BARCODE_HIBC_MICPDF) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbMPDFCols")))) {
if (!isError && cmb->currentIndex() == 0) {
const int w = m_bc.bc.encodedWidth();
int cols;
if (w == 38) {
cols = 1;
} else if (w == 55) {
cols = 2;
} else if (w == 82) {
cols = 3;
} else { /* if (w == 99) */
cols = 4;
}
cmb->setItemText(0, QString::asprintf("Automatic (%d)", cols));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_MICROQR) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbMQRSize")))) {
if (!isError && cmb->currentIndex() == 0) {
const int r = m_bc.bc.encodedRows();
cmb->setItemText(0, QString::asprintf("Automatic (%d x %d (Version M%d))", r, r, (r - 9) / 2));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_PDF417 || symbology == BARCODE_PDF417COMP || symbology == BARCODE_HIBC_PDF) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbPDFCols")))) {
if (!isError && cmb->currentIndex() == 0) {
const int w = m_bc.bc.encodedWidth();
const int overhead = get_rad_val(QSL("radPDFTruncated")) || symbology == BARCODE_PDF417COMP ? 35 : 69;
cmb->setItemText(0, QString::asprintf("Automatic (%d)", (w - overhead) / 17));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbPDFRows")))) {
if (!isError && cmb->currentIndex() == 0) {
const int r = m_bc.bc.encodedRows();
cmb->setItemText(0, QString::asprintf("Automatic (%d)", r));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_QRCODE || symbology == BARCODE_HIBC_QR) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbQRSize")))) {
if (!isError && cmb->currentIndex() == 0) {
const int r = m_bc.bc.encodedRows();
cmb->setItemText(0, QString::asprintf("Automatic (%d x %d (Version %d))", r, r, (r - 17) / 4));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_RMQR) {
if ((cmb = m_optionWidget->findChild<QComboBox*>(QSL("cmbRMQRSize")))) {
if (!isError && cmb->currentIndex() == 0) {
const int r = m_bc.bc.encodedRows();
const int w = m_bc.bc.encodedWidth();
int z;
if (r == 11 || r == 13) {
z = 11 + (r == 13) * 6 + (w == 43) + (w == 59) * 2 + (w == 77) * 3 + (w == 99) * 4
+ (w == 139) * 5;
} else {
z = (w == 59) + (w == 77) * 2 + (w == 99) * 3 + (w == 139) * 4;
if (r == 7) {
z += 1;
} else if (r == 9) {
z += 6;
} else if (r == 15) {
z += 23;
} else { /* if (r == 17) */
z += 28;
}
}
cmb->setItemText(0, QString::asprintf("Automatic (R%dx%d (Zint %d))", r, w, z));
} else {
cmb->setItemText(0, QSL("Automatic"));
}
}
} else if (symbology == BARCODE_ULTRA) {
if ((txt = m_optionWidget->findChild<QLineEdit*>(QSL("txtUltraAutoInfo")))) {
if (!isError) {
const int w = m_bc.bc.encodedWidth();
const int r = m_bc.bc.encodedRows();
txt->setText(QString::asprintf("(%d X %d)", w, r));
} else {
txt->setText(QSL(""));
}
}
}
}
QPoint MainWindow::get_context_menu_pos(const QPoint &pos, QWidget *widget)
{
QPoint menuPos(pos);

View file

@ -144,12 +144,14 @@ protected:
void createActions();
void createMenu();
void enableActions(bool enabled);
void enableActions();
void copy_to_clipboard(const QString &filename, const QString &name, const char *mimeType = nullptr);
void errtxtBar_clear();
void errtxtBar_set(bool isError);
void errtxtBar_set();
void automatic_info_set();
QLineEdit *get_seg_textbox(int seg_no);
QComboBox *get_seg_eci(int seg_no);