- API: add new zint_symbol dpmm field for output resolution (BMP/

EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
  with new option `--scalexdimdp` for CLI/Tcl & new API function
  `ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
  & `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
  following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
  `noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
  incl. new `QZintXdimDp` struct for passing around scale vars &
  use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
  output path using new function `out_fopen()` and use in BMP/EMF/
  EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
  documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
  re-loading settings without doing a sync no longer works);
  fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
  various default buttons; use new `takesGS1AIData()` to
  enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
  significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
  ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
  supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
  excludes
This commit is contained in:
gitlost 2022-12-02 21:39:01 +00:00
parent 6393813cff
commit c8033695d9
127 changed files with 4032 additions and 1248 deletions

View file

@ -14,7 +14,7 @@
# so you can encode the package version directly into the source files.
#-----------------------------------------------------------------------
AC_INIT([zint], [2.11.1])
AC_INIT([zint],[2.11.1])
#--------------------------------------------------------------------
# Call TEA_INIT as the first TEA_ macro to set up initial vars.
@ -224,4 +224,5 @@ case ${TK_DEFS} in
;;
esac
AC_OUTPUT([Makefile])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View file

@ -31,29 +31,29 @@ proc Generate {} {
if {[catch {zint encode [.e get] ::zintimg -barcode [.c get] {*}[.o get]} e]} {
tk_messageBox -message $e -title "Zint error"
} else {
set w [image width ::zintimg]
set h [image height ::zintimg]
set lw [winfo width .l]
set lh [winfo height .l]
set sx [expr {int(1.0 * $lw / $w)}]
set sy [expr {int(1.0 * $lh / $h)}]
if {$sy < $sx} {
set sx $sy
}
if {$sx <= 0} {
set sx [expr {1.1 * $lw / $w}]
set sy [expr {1.1 * $lh / $h}]
if {$sy < $sx} {
set sx $sy
}
}
::zintimg blank
::zintimg configure -width 1 -height 1
::zintimg blank
::zintimg configure -width 0 -height 0
catch {
zint encode [.e get] ::zintimg -barcode [.c get] -scale $sx {*}[.o get]
}
set w [image width ::zintimg]
set h [image height ::zintimg]
set lw [winfo width .l]
set lh [winfo height .l]
set sx [expr {int(1.0 * $lw / $w)}]
set sy [expr {int(1.0 * $lh / $h)}]
if {$sy < $sx} {
set sx $sy
}
if {$sx <= 0} {
set sx [expr {1.1 * $lw / $w}]
set sy [expr {1.1 * $lh / $h}]
if {$sy < $sx} {
set sx $sy
}
}
::zintimg blank
::zintimg configure -width 1 -height 1
::zintimg blank
::zintimg configure -width 0 -height 0
catch {
zint encode [.e get] ::zintimg -barcode [.c get] -scale $sx {*}[.o get]
}
}
}
pack [label .l -image ::zintimg -bg white] -side top -fill both -expand 1 \

View file

@ -28,6 +28,7 @@
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
/* SPDX-License-Identifier: BSD-3-Clause */
/*
History
@ -151,6 +152,11 @@
- Added BC412
2022-08-20 GL
- Added CEPNet
2022-11-10 GL
- Added -bindtop option
2022-12-02 GL
- Added -scalexdimdp option
- Renamed CODE128B to CODE128AB
*/
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
@ -258,7 +264,7 @@ static const char *s_code_list[] = {
"PDF417Compact",
"MaxiCode",
"QR",
"Code128B",
"Code128AB",
"AusPost",
"AusReply",
"AusRoute",
@ -358,7 +364,7 @@ static const int s_code_number[] = {
BARCODE_PDF417COMP,
BARCODE_MAXICODE,
BARCODE_QRCODE,
BARCODE_CODE128B,
BARCODE_CODE128AB,
BARCODE_AUSPOST,
BARCODE_AUSREPLY,
BARCODE_AUSROUTE,
@ -522,6 +528,7 @@ static const char help_message[] = "zint tcl(stub,obj) dll\n"
" -rotate angle: Image rotation by 0,90 or 270 degrees\n"
" -rows integer: Codablock F, PDF417: number of rows\n"
" -scale double: Scale the image to this factor\n"
" -scalexdimdp {xdim ?resolution?}: Scale with X-dimension mm, resolution dpmm\n"
" -scmvv integer: Prefix SCM with [)>\\R01\\Gvv (vv is integer) (MaxiCode)\n"
" -secure integer: EC Level (Aztec, GridMatrix, HanXin, PDF417, QR, UltraCode)\n"
" -segN {eci data}: Set the ECI & data content for segment N where N is 1 to 9\n"
@ -734,6 +741,8 @@ static int Encode(Tcl_Interp *interp, int objc,
Tcl_Obj *pSegDataObjs[10] = {0};
Tcl_DString segInputs[10];
struct zint_seg segs[10];
double xdim = 0.0;
double resolution = 0.0;
/*------------------------------------------------------------------------*/
/* >> Check if at least data and object is given and a pair number of */
/* >> options */
@ -765,7 +774,7 @@ static int Encode(Tcl_Interp *interp, int objc,
"-gs1nocheck", "-gs1parens", "-gssep", "-guarddescent",
"-height", "-heightperrow", "-init", "-mask", "-mode",
"-nobackground", "-noquietzones", "-notext", "-primary", "-quietzones",
"-reverse", "-rotate", "-rows", "-scale", "-scmvv", "-secure",
"-reverse", "-rotate", "-rows", "-scale", "-scalexdimdp", "-scmvv", "-secure",
"-seg1", "-seg2", "-seg3", "-seg4", "-seg5", "-seg6", "-seg7", "-seg8", "-seg9",
"-separator", "-smalltext", "-square", "-structapp",
"-to", "-vers", "-vwhitesp", "-werror", "-whitesp",
@ -777,7 +786,7 @@ static int Encode(Tcl_Interp *interp, int objc,
iGS1NoCheck, iGS1Parens, iGSSep, iGuardDescent,
iHeight, iHeightPerRow, iInit, iMask, iMode,
iNoBackground, iNoQuietZones, iNoText, iPrimary, iQuietZones,
iReverse, iRotate, iRows, iScale, iSCMvv, iSecure,
iReverse, iRotate, iRows, iScale, iScaleXdimDp, iSCMvv, iSecure,
iSeg1, iSeg2, iSeg3, iSeg4, iSeg5, iSeg6, iSeg7, iSeg8, iSeg9,
iSeparator, iSmallText, iSquare, iStructApp,
iTo, iVers, iVWhiteSp, iWError, iWhiteSp
@ -1100,6 +1109,42 @@ static int Encode(Tcl_Interp *interp, int objc,
my_symbol->scale = (float)doubleValue;
}
break;
case iScaleXdimDp:
/* >> Decode the -scalexdimdp parameter as list of xdim ?resolution? */
{
Tcl_Obj *poParam;
xdim = resolution = 0.0;
if (TCL_OK != Tcl_ListObjLength(interp,
objv[optionPos+1], &lStr))
{
fError = 1;
} else if ( ! ( lStr == 1 || lStr == 2 ) ) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj(
"option -scalexdimdp not a list of 1 or 2", -1));
fError = 1;
} else {
if (TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
0, &poParam)
|| TCL_OK != Tcl_GetDoubleFromObj(interp, poParam, &xdim)
|| xdim < 0.0)
{
fError = 1;
}
if (!fError && lStr == 2 && (
TCL_OK != Tcl_ListObjIndex(interp, objv[optionPos+1],
1, &poParam)
|| TCL_OK != Tcl_GetDoubleFromObj(interp, poParam, &resolution)
|| resolution < 0.0))
{
fError = 1;
}
if (!fError && resolution == 0.0) {
resolution = 12.0; /* Default 12 dpmm (~300 dpi) */
}
}
}
break;
case iBorder:
if (intValue < 0 || intValue > 1000) {
Tcl_SetObjResult(interp,
@ -1375,6 +1420,16 @@ static int Encode(Tcl_Interp *interp, int objc,
my_symbol->option_1 = rows;
}
}
if (resolution) {
float scale;
if (xdim == 0.0) {
xdim = ZBarcode_Default_Xdim(my_symbol->symbology);
}
scale = ZBarcode_Scale_From_XdimDp(my_symbol->symbology, (float)xdim, (float)resolution, NULL /*filetype*/);
if (scale > 0.0f) {
my_symbol->scale = scale;
}
}
/*------------------------------------------------------------------------*/
/* >>> Prepare input dstring and encode it to ECI encoding*/
Tcl_DStringInit(& dsInput);