mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Add -fullmultibyte to tcl frontend
This commit is contained in:
parent
22ba06a7cb
commit
2f99f0c4fd
@ -18,6 +18,9 @@ pack [::ttk::combobox .c -values [lsort [zint symbologies]] -state readonly] \
|
|||||||
pack [::ttk::entry .e] -side top -fill x -padx $padx -pady $pady
|
pack [::ttk::entry .e] -side top -fill x -padx $padx -pady $pady
|
||||||
.e insert end 12345
|
.e insert end 12345
|
||||||
bind .e <Return> Generate
|
bind .e <Return> Generate
|
||||||
|
pack [::ttk::entry .o] -side top -fill x -padx $padx -pady $pady
|
||||||
|
.o insert end "-bold 1"
|
||||||
|
bind .o <Return> Generate
|
||||||
pack [::ttk::button .b -text Generate -command Generate] -fill x -side top \
|
pack [::ttk::button .b -text Generate -command Generate] -fill x -side top \
|
||||||
-padx $padx -pady $pady
|
-padx $padx -pady $pady
|
||||||
proc Generate {} {
|
proc Generate {} {
|
||||||
@ -25,7 +28,7 @@ proc Generate {} {
|
|||||||
::zintimg configure -width 1 -height 1
|
::zintimg configure -width 1 -height 1
|
||||||
::zintimg blank
|
::zintimg blank
|
||||||
::zintimg configure -width 0 -height 0
|
::zintimg configure -width 0 -height 0
|
||||||
if {[catch {zint encode [.e get] ::zintimg -barcode [.c get]} e]} {
|
if {[catch {zint encode [.e get] ::zintimg -barcode [.c get] {*}[.o get]} e]} {
|
||||||
tk_messageBox -message $e -title "Zint error"
|
tk_messageBox -message $e -title "Zint error"
|
||||||
} else {
|
} else {
|
||||||
set w [image width ::zintimg]
|
set w [image width ::zintimg]
|
||||||
|
@ -68,7 +68,9 @@
|
|||||||
- Framework 2.7.0 update
|
- Framework 2.7.0 update
|
||||||
- Add symbology rmqr
|
- Add symbology rmqr
|
||||||
2020-02-01 2.7.1 HaO
|
2020-02-01 2.7.1 HaO
|
||||||
- Framework 2.7.1 update
|
- Framework 2.7.1 update
|
||||||
|
2020-04-06 HaO
|
||||||
|
- Added option -fullmultibyte
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
#if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
|
||||||
@ -400,7 +402,8 @@ static char help_message[] = "zint tcl(stub,obj) dll\n"
|
|||||||
" -dotty bool: use dots instead of boxes for matrix codes\n"
|
" -dotty bool: use dots instead of boxes for matrix codes\n"
|
||||||
" -dotsize number: radius ratio of dots from 0.01 to 1.0\n"
|
" -dotsize number: radius ratio of dots from 0.01 to 1.0\n"
|
||||||
" -scale double: Scale the image to this factor\n"
|
" -scale double: Scale the image to this factor\n"
|
||||||
" -format binary|unicode|gs1: input data format. Default:unicode\n"
|
" -format binary|unicode|gs1: input data format. Default:unicode\n"
|
||||||
|
" -fullmultibyte: allow multibyte compaction for xQR, HanXin, Gridmatrix\n"
|
||||||
" -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n"
|
" -gssep bool: for gs1, use gs as separator instead fnc1 (Datamatrix only)\n"
|
||||||
" -eci number: ECI to use\n"
|
" -eci number: ECI to use\n"
|
||||||
" -notext bool: no interpretation line\n"
|
" -notext bool: no interpretation line\n"
|
||||||
@ -559,7 +562,8 @@ static int Encode(Tcl_Interp *interp, int objc,
|
|||||||
int destY0 = 0;
|
int destY0 = 0;
|
||||||
int destWidth = 0;
|
int destWidth = 0;
|
||||||
int destHeight = 0;
|
int destHeight = 0;
|
||||||
int ECIIndex = 0;
|
int ECIIndex = 0;
|
||||||
|
int fFullMultiByte = 0;
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* >> Check if at least data and object is given and a pair number of */
|
/* >> Check if at least data and object is given and a pair number of */
|
||||||
/* >> options */
|
/* >> options */
|
||||||
@ -589,13 +593,13 @@ static int Encode(Tcl_Interp *interp, int objc,
|
|||||||
"-dmre", "-dotsize", "-dotty", "-eci", "-fg", "-format", "-gssep",
|
"-dmre", "-dotsize", "-dotty", "-eci", "-fg", "-format", "-gssep",
|
||||||
"-height", "-init", "-mode", "-notext", "-primary", "-rotate",
|
"-height", "-init", "-mode", "-notext", "-primary", "-rotate",
|
||||||
"-rows", "-scale", "-secure", "-smalltext", "-square", "-to",
|
"-rows", "-scale", "-secure", "-smalltext", "-square", "-to",
|
||||||
"-vers", "-whitesp", NULL};
|
"-vers", "-whitesp", "-fullmultibyte", NULL};
|
||||||
enum iOption {
|
enum iOption {
|
||||||
iBarcode, iBG, iBind, iBold, iBorder, iBox, iCols,
|
iBarcode, iBG, iBind, iBold, iBorder, iBox, iCols,
|
||||||
iDMRE, iDotSize, iDotty, iECI, iFG, iFormat, iGSSep, iHeight,
|
iDMRE, iDotSize, iDotty, iECI, iFG, iFormat, iGSSep, iHeight,
|
||||||
iInit, iMode, iNoText, iPrimary, iRotate, iRows,
|
iInit, iMode, iNoText, iPrimary, iRotate, iRows,
|
||||||
iScale, iSecure, iSmallText, iSquare, iTo, iVers,
|
iScale, iSecure, iSmallText, iSquare, iTo, iVers,
|
||||||
iWhiteSp
|
iWhiteSp, iFullMultiByte
|
||||||
};
|
};
|
||||||
int optionIndex;
|
int optionIndex;
|
||||||
int intValue;
|
int intValue;
|
||||||
@ -621,7 +625,8 @@ static int Encode(Tcl_Interp *interp, int objc,
|
|||||||
case iInit:
|
case iInit:
|
||||||
case iNoText:
|
case iNoText:
|
||||||
case iSmallText:
|
case iSmallText:
|
||||||
case iSquare:
|
case iSquare:
|
||||||
|
case iFullMultiByte:
|
||||||
/* >> Binary options */
|
/* >> Binary options */
|
||||||
if (TCL_OK != Tcl_GetBooleanFromObj(interp, objv[optionPos+1],
|
if (TCL_OK != Tcl_GetBooleanFromObj(interp, objv[optionPos+1],
|
||||||
&intValue))
|
&intValue))
|
||||||
@ -725,7 +730,10 @@ static int Encode(Tcl_Interp *interp, int objc,
|
|||||||
} else {
|
} else {
|
||||||
hSymbol->output_options &= ~GS1_GS_SEPARATOR;
|
hSymbol->output_options &= ~GS1_GS_SEPARATOR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case iFullMultiByte:
|
||||||
|
fFullMultiByte = intValue;
|
||||||
|
break;
|
||||||
case iECI:
|
case iECI:
|
||||||
if(Tcl_GetIndexFromObj(interp, objv[optionPos+1],
|
if(Tcl_GetIndexFromObj(interp, objv[optionPos+1],
|
||||||
(const char **) s_eci_list,"-eci", optionPos, &ECIIndex)
|
(const char **) s_eci_list,"-eci", optionPos, &ECIIndex)
|
||||||
@ -925,6 +933,23 @@ static int Encode(Tcl_Interp *interp, int objc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*------------------------------------------------------------------------*/
|
||||||
|
/* >>> Set fullmultibyte option if symbology matches*/
|
||||||
|
/* On wrong symbology, option is ignored (as does the zint program)*/
|
||||||
|
if (fFullMultiByte) {
|
||||||
|
switch (hSymbol->symbology) {
|
||||||
|
case BARCODE_QRCODE:
|
||||||
|
case BARCODE_MICROQR:
|
||||||
|
/*case BARCODE_HIBC_QR: Note character set restricted to ASCII subset*/
|
||||||
|
/*case BARCODE_UPNQR: Note does not use Kanji mode*/
|
||||||
|
case BARCODE_RMQR:
|
||||||
|
case BARCODE_HANXIN:
|
||||||
|
case BARCODE_GRIDMATRIX:
|
||||||
|
hSymbol->option_3 = ZINT_FULL_MULTIBYTE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
/* >>> Prepare input dstring and encode it to ECI encoding*/
|
/* >>> Prepare input dstring and encode it to ECI encoding*/
|
||||||
Tcl_DStringInit(& dsInput);
|
Tcl_DStringInit(& dsInput);
|
||||||
|
Loading…
Reference in New Issue
Block a user