mirror of
https://git.code.sf.net/p/zint/code
synced 2025-12-18 02:17:06 +00:00
Remove bitmap_byte_length member from zint_symbol
(was only set on BMP output to length of BMP pixel array) EXCODE39: change to display check digit in HRT by default CODE39/EXCODE39/LOGMARS: new hidden check digit option (`option_2 = 2`) qr.c: suppress bogus gcc-13 warning (only appears on optimize) GUI: move some symbology-specific options into Data Tab so separate tab unnecessary (those with few options and no Composite/ECI), namely: all C25XXX, CODE39/EXCODE39/LOGMARS, MSI_PLESSEY, CODABAR, DAFT, DPD, MAILMARK_2D, ITF-14, PZN, UPNQR, CHANNEL, CODE93 and VIN, adjusting grp uis. change Data dialog button (ellipsis) QToolButton -> QPushButton & vice versa zap/clear/eye/swap/scale buttons QPushButton -> QToolButton for better mac compat (also makes sense); remove some mac hacks that no longer seem necessary; use folder icon for Export dialog directory button manual: document new Symbology-specific groupbox & CODE39/etc hidden check digit option; add annexes on Qt and Tcl backends; narrow some tables for better txt output; remove echoed image tags in txt (pandoc 3.1.5 regression?); add one-page HTML output to Makefile; also tex output (debug); add class attributes to images to aid HTML styling; various other fiddlings
This commit is contained in:
@@ -248,7 +248,7 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
|
||||
counter = 0;
|
||||
|
||||
if ((symbol->option_2 < 0) || (symbol->option_2 > 1)) {
|
||||
if ((symbol->option_2 < 0) || (symbol->option_2 > 2)) {
|
||||
symbol->option_2 = 0;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
counter += posns[i];
|
||||
}
|
||||
|
||||
if (symbol->option_2 == 1) {
|
||||
if (symbol->option_2 == 1 || symbol->option_2 == 2) { /* Visible or hidden check digit */
|
||||
|
||||
char check_digit;
|
||||
counter %= 43;
|
||||
@@ -294,8 +294,10 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
|
||||
check_digit = '_';
|
||||
}
|
||||
|
||||
localstr[0] = check_digit;
|
||||
localstr[1] = '\0';
|
||||
if (symbol->option_2 == 1) { /* Visible check digit */
|
||||
localstr[0] = check_digit;
|
||||
localstr[1] = '\0';
|
||||
}
|
||||
if (symbol->debug & ZINT_DEBUG_PRINT) printf("Check digit: %c\n", check_digit);
|
||||
}
|
||||
|
||||
@@ -442,6 +444,7 @@ INTERNAL int excode39(struct zint_symbol *symbol, unsigned char source[], int le
|
||||
|
||||
unsigned char buffer[85 * 2 + 1] = {0};
|
||||
unsigned char *b = buffer;
|
||||
unsigned char check_digit = '\0';
|
||||
int i;
|
||||
int error_number;
|
||||
|
||||
@@ -469,9 +472,22 @@ INTERNAL int excode39(struct zint_symbol *symbol, unsigned char source[], int le
|
||||
/* Then sends the buffer to the C39 function */
|
||||
error_number = code39(symbol, buffer, b - buffer);
|
||||
|
||||
/* Save visible check digit */
|
||||
if (symbol->option_2 == 1) {
|
||||
const int len = (int) ustrlen(symbol->text);
|
||||
if (len > 0) {
|
||||
check_digit = symbol->text[len - 1];
|
||||
}
|
||||
}
|
||||
|
||||
/* Copy over source to HRT, subbing space for unprintables */
|
||||
for (i = 0; i < length; i++)
|
||||
symbol->text[i] = source[i] >= ' ' && source[i] != 0x7F ? source[i] : ' ';
|
||||
symbol->text[length] = '\0'; /* Chops off check digit */
|
||||
|
||||
if (check_digit) {
|
||||
symbol->text[i++] = check_digit;
|
||||
}
|
||||
symbol->text[i] = '\0';
|
||||
|
||||
return error_number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user