Various minor bugfixes

This commit is contained in:
hooper114 2010-05-16 21:58:18 +00:00
parent f3e8505fd4
commit 93d65a910c
9 changed files with 833 additions and 774 deletions

View File

@ -53,6 +53,7 @@ struct zint_symbol *ZBarcode_Create()
symbol->option_1 = -1; symbol->option_1 = -1;
symbol->option_2 = 0; symbol->option_2 = 0;
symbol->option_3 = 928; // PDF_MAX symbol->option_3 = 928; // PDF_MAX
symbol->show_hrt = 1; // Show human readable text
symbol->input_mode = DATA_MODE; symbol->input_mode = DATA_MODE;
strcpy(symbol->primary, ""); strcpy(symbol->primary, "");
for(i = 0; i < 178; i++) { for(i = 0; i < 178; i++) {
@ -82,6 +83,7 @@ void ZBarcode_Clear(struct zint_symbol *symbol)
symbol->errtxt[0] = '\0'; symbol->errtxt[0] = '\0';
if (symbol->bitmap != NULL) if (symbol->bitmap != NULL)
free(symbol->bitmap); free(symbol->bitmap);
symbol->bitmap = NULL;
symbol->bitmap_width = 0; symbol->bitmap_width = 0;
symbol->bitmap_height = 0; symbol->bitmap_height = 0;
} }

View File

@ -714,7 +714,11 @@ int png_plot(struct zint_symbol *symbol, int rotate_angle, int data_type)
unsigned char* local_text = (unsigned char*)_alloca(ustrlen(symbol->text) + 1); unsigned char* local_text = (unsigned char*)_alloca(ustrlen(symbol->text) + 1);
#endif #endif
if(symbol->show_hrt != 0) {
to_latin1(symbol->text, local_text); to_latin1(symbol->text, local_text);
} else {
local_text[0] = '\0';
}
textdone = 0; textdone = 0;
main_width = symbol->width; main_width = symbol->width;

View File

@ -44,6 +44,7 @@ int ps_plot(struct zint_symbol *symbol)
float addon_text_posn; float addon_text_posn;
float scaler = symbol->scale; float scaler = symbol->scale;
float default_text_posn; float default_text_posn;
int plot_text = 1;
row_height=0; row_height=0;
textdone = 0; textdone = 0;
@ -167,7 +168,10 @@ int ps_plot(struct zint_symbol *symbol)
} }
addon[r] = '\0'; addon[r] = '\0';
if(ustrlen(symbol->text) != 0) { if((symbol->show_hrt == 0) || (ustrlen(symbol->text) == 0)) {
plot_text = 0;
}
if(plot_text) {
textoffset = 9; textoffset = 9;
} else { } else {
textoffset = 0; textoffset = 0;
@ -327,6 +331,7 @@ int ps_plot(struct zint_symbol *symbol)
xoffset += comp_offset; xoffset += comp_offset;
if (plot_text) {
if ((((symbol->symbology == BARCODE_EANX) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_EANX_CC)) || if ((((symbol->symbology == BARCODE_EANX) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_EANX_CC)) ||
(symbol->symbology == BARCODE_ISBNX)) { (symbol->symbology == BARCODE_ISBNX)) {
/* guard bar extensions and text formatting for EAN8 and EAN13 */ /* guard bar extensions and text formatting for EAN8 and EAN13 */
@ -693,6 +698,7 @@ int ps_plot(struct zint_symbol *symbol)
} }
} }
} /* if (plot_text) */
xoffset -= comp_offset; xoffset -= comp_offset;
@ -743,7 +749,7 @@ int ps_plot(struct zint_symbol *symbol)
} }
/* Put the human readable text at the bottom */ /* Put the human readable text at the bottom */
if((textdone == 0) && (ustrlen(symbol->text) != 0)) { if(plot_text && (textdone == 0)) {
fprintf(feps, "TE\n"); fprintf(feps, "TE\n");
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink); fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
fprintf(feps, "matrix currentmatrix\n"); fprintf(feps, "matrix currentmatrix\n");

View File

@ -1077,7 +1077,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
char* general_field_type = (char*)_alloca(strlen(source)); char* general_field_type = (char*)_alloca(strlen(source));
#endif #endif
int remainder, d1, d2, value; int remainder, d1, d2, value;
char padstring[14]; char padstring[40];
read_posn=0; read_posn=0;
value=0; value=0;
@ -1643,19 +1643,34 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
} }
latch = general_rules(general_field, general_field_type); latch = general_rules(general_field, general_field_type);
if(debug) printf("General field type: %s\n", general_field_type);
last_mode = NUMERIC;
/* Set initial mode if not NUMERIC */
if(general_field_type[0] == ALPHA) {
concat(binary_string, "0000"); /* Alphanumeric latch */
last_mode = ALPHA;
}
if(general_field_type[0] == ISOIEC) {
concat(binary_string, "0000"); /* Alphanumeric latch */
concat(binary_string, "00100"); /* ISO/IEC 646 latch */
last_mode = ISOIEC;
}
i = 0; i = 0;
do { do {
if(debug) printf("Processing character %d ", i); if(debug) printf("Processing character %d ", i);
switch(general_field_type[i]) { switch(general_field_type[i]) {
case NUMERIC: case NUMERIC:
if(debug) printf("as NUMERIC\n"); if(debug) printf("as NUMERIC:");
if(i != 0) {
if((general_field_type[i - 1] != NUMERIC) && (general_field[i - 1] != '[')) { if(last_mode != NUMERIC) {
concat(binary_string, "000"); /* Numeric latch */ concat(binary_string, "000"); /* Numeric latch */
} if(debug) printf("<NUMERIC LATCH>\n");
} }
if(debug) printf(" %c%c > ", general_field[i], general_field[i + 1]);
if(general_field[i] != '[') { if(general_field[i] != '[') {
d1 = ctoi(general_field[i]); d1 = ctoi(general_field[i]);
} else { } else {
@ -1674,24 +1689,27 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
for(j = 0; j < 7; j++) { for(j = 0; j < 7; j++) {
if((value & mask) == 0x00) { if((value & mask) == 0x00) {
concat(binary_string, "0"); concat(binary_string, "0");
if(debug) printf("0");
} else { } else {
concat(binary_string, "1"); concat(binary_string, "1");
if(debug) printf("1");
} }
mask = mask >> 1; mask = mask >> 1;
} }
i += 2; i += 2;
if(debug) printf("\n");
last_mode = NUMERIC; last_mode = NUMERIC;
break; break;
case ALPHA: case ALPHA:
if(debug) printf("as ALPHA\n"); if(debug) printf("as ALPHA\n");
if(i != 0) { if(i != 0) {
if((general_field_type[i - 1] == NUMERIC) || (general_field[i - 1] == '[')) { if(last_mode == NUMERIC) {
concat(binary_string, "0000"); /* Alphanumeric latch */ concat(binary_string, "0000"); /* Alphanumeric latch */
} }
if(general_field_type[i - 1] == ISOIEC) { if(last_mode == ISOIEC) {
concat(binary_string, "00100"); /* ISO/IEC 646 latch */ concat(binary_string, "00100"); /* Alphanumeric latch */
} }
} }
@ -1725,7 +1743,8 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
} }
} }
if(general_field[i] == '[') concat(binary_string, "01111"); /* FNC1/Numeric latch */ last_mode = ALPHA;
if(general_field[i] == '[') { concat(binary_string, "01111"); last_mode = NUMERIC; } /* FNC1/Numeric latch */
if(general_field[i] == '*') concat(binary_string, "111010"); /* asterisk */ if(general_field[i] == '*') concat(binary_string, "111010"); /* asterisk */
if(general_field[i] == ',') concat(binary_string, "111011"); /* comma */ if(general_field[i] == ',') concat(binary_string, "111011"); /* comma */
if(general_field[i] == '-') concat(binary_string, "111100"); /* minus or hyphen */ if(general_field[i] == '-') concat(binary_string, "111100"); /* minus or hyphen */
@ -1733,17 +1752,16 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
if(general_field[i] == '/') concat(binary_string, "111110"); /* slash or solidus */ if(general_field[i] == '/') concat(binary_string, "111110"); /* slash or solidus */
i++; i++;
last_mode = ALPHA;
break; break;
case ISOIEC: case ISOIEC:
if(debug) printf("as ISOIEC\n"); if(debug) printf("as ISOIEC\n");
if(i != 0) { if(i != 0) {
if((general_field_type[i - 1] == NUMERIC) || (general_field[i - 1] == '[')) { if(last_mode == NUMERIC) {
concat(binary_string, "0000"); /* Alphanumeric latch */ concat(binary_string, "0000"); /* Alphanumeric latch */
concat(binary_string, "00100"); /* ISO/IEC 646 latch */ concat(binary_string, "00100"); /* ISO/IEC 646 latch */
} }
if(general_field_type[i - 1] == ALPHA) { if(last_mode == ALPHA) {
concat(binary_string, "00100"); /* ISO/IEC 646 latch */ concat(binary_string, "00100"); /* ISO/IEC 646 latch */
} }
} }
@ -1793,7 +1811,8 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
} }
} }
if(general_field[i] == '[') concat(binary_string, "01111"); /* FNC1/Numeric latch */ last_mode = ISOIEC;
if(general_field[i] == '[') { concat(binary_string, "01111"); last_mode = NUMERIC; } /* FNC1/Numeric latch */
if(general_field[i] == '!') concat(binary_string, "11101000"); /* exclamation mark */ if(general_field[i] == '!') concat(binary_string, "11101000"); /* exclamation mark */
if(general_field[i] == 34) concat(binary_string, "11101001"); /* quotation mark */ if(general_field[i] == 34) concat(binary_string, "11101001"); /* quotation mark */
if(general_field[i] == 37) concat(binary_string, "11101010"); /* percent sign */ if(general_field[i] == 37) concat(binary_string, "11101010"); /* percent sign */
@ -1817,20 +1836,21 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
if(general_field[i] == ' ') concat(binary_string, "11111100"); /* space */ if(general_field[i] == ' ') concat(binary_string, "11111100"); /* space */
i++; i++;
last_mode = ISOIEC;
break; break;
} }
} while (i + latch < strlen(general_field)); } while (i + latch < strlen(general_field));
if(debug) printf("Resultant binary = %s\n", binary_string); if(debug) printf("Resultant binary = %s\n", binary_string);
if(debug) printf("\tLength: %d\n", strlen(binary_string)); if(debug) printf("\tLength: %d\n", (int)strlen(binary_string));
remainder = strlen(binary_string) % 12; remainder = 12 - (strlen(binary_string) % 12);
if(remainder == 12) { remainder = 0; }
if(strlen(binary_string) < 36) { remainder = 36 - strlen(binary_string); } if(strlen(binary_string) < 36) { remainder = 36 - strlen(binary_string); }
if(latch == 1) { if(latch == 1) {
/* There is still one more numeric digit to encode */ /* There is still one more numeric digit to encode */
if(debug) printf("Adding extra (odd) numeric digit\n"); if(debug) printf("Adding extra (odd) numeric digit\n");
if(last_mode == NUMERIC) {
if((remainder >= 4) && (remainder <= 6)) { if((remainder >= 4) && (remainder <= 6)) {
value = ctoi(general_field[i]); value = ctoi(general_field[i]);
value++; value++;
@ -1860,11 +1880,25 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
mask = mask >> 1; mask = mask >> 1;
} }
} }
remainder = strlen(binary_string) % 12; } else {
value = general_field[i] - 43;
mask = 0x10;
for(j = 0; j < 5; j++) {
if((value & mask) == 0x00) {
concat(binary_string, "0");
} else {
concat(binary_string, "1");
}
mask = mask >> 1;
}
}
remainder = 12 - (strlen(binary_string) % 12);
if(remainder == 12) { remainder = 0; }
if(strlen(binary_string) < 36) { remainder = 36 - strlen(binary_string); } if(strlen(binary_string) < 36) { remainder = 36 - strlen(binary_string); }
last_mode = NUMERIC;
if(debug) printf("Resultant binary = %s\n", binary_string); if(debug) printf("Resultant binary = %s\n", binary_string);
if(debug) printf("\tLength: %d\n", strlen(binary_string)); if(debug) printf("\tLength: %d\n", (int)strlen(binary_string));
} }
if(strlen(binary_string) > 252) { if(strlen(binary_string) > 252) {
@ -1872,18 +1906,18 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
return ERROR_TOO_LONG; return ERROR_TOO_LONG;
} }
/* Now add padding to binary string */ /* Now add padding to binary string (7.2.5.5.4) */
if(strlen(general_field) != 0) { i = remainder;
if (last_mode == NUMERIC) { if((strlen(general_field) != 0) && (last_mode == NUMERIC)) {
strcpy(padstring, "000000100001"); strcpy(padstring, "0000");
i -= 4;
} else { } else {
strcpy(padstring, "001000010000"); strcpy(padstring, "");
} }
} else { for(;i > 0;i -= 5) {
strcpy(padstring, "001000010000"); concat(padstring, "00100");
} }
remainder = 12 - remainder;
if(remainder == 12) { remainder = 0; }
padstring[remainder] = '\0'; padstring[remainder] = '\0';
concat(binary_string, padstring); concat(binary_string, padstring);
@ -1904,7 +1938,7 @@ int rss_binary_string(struct zint_symbol *symbol, char source[], char binary_str
if(d2 == 0) { binary_string[7] = '0'; } else { binary_string[7] = '1'; } if(d2 == 0) { binary_string[7] = '0'; } else { binary_string[7] = '1'; }
} }
if(debug) printf("Resultant binary = %s\n", binary_string); if(debug) printf("Resultant binary = %s\n", binary_string);
if(debug) printf("\tLength: %d\n", strlen(binary_string)); if(debug) printf("\tLength: %d\n", (int)strlen(binary_string));
return 0; return 0;
} }

View File

@ -40,6 +40,7 @@ int svg_plot(struct zint_symbol *symbol)
float addon_text_posn; float addon_text_posn;
float scaler = symbol->scale; float scaler = symbol->scale;
float default_text_posn; float default_text_posn;
int plot_text = 1;
row_height=0; row_height=0;
textdone = 0; textdone = 0;
@ -163,7 +164,10 @@ int svg_plot(struct zint_symbol *symbol)
} }
addon[r] = '\0'; addon[r] = '\0';
if(ustrlen(symbol->text) != 0) { if((symbol->show_hrt == 0) || (ustrlen(symbol->text) != 0)) {
plot_text = 0;
}
if(plot_text) {
textoffset = 9; textoffset = 9;
} else { } else {
textoffset = 0; textoffset = 0;
@ -310,6 +314,7 @@ int svg_plot(struct zint_symbol *symbol)
xoffset += comp_offset; xoffset += comp_offset;
row_posn = (row_posn + large_bar_height) * scaler; row_posn = (row_posn + large_bar_height) * scaler;
if(plot_text) {
if ((((symbol->symbology == BARCODE_EANX) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_EANX_CC)) || if ((((symbol->symbology == BARCODE_EANX) && (symbol->rows == 1)) || (symbol->symbology == BARCODE_EANX_CC)) ||
(symbol->symbology == BARCODE_ISBNX)) { (symbol->symbology == BARCODE_ISBNX)) {
/* guard bar extensions and text formatting for EAN8 and EAN13 */ /* guard bar extensions and text formatting for EAN8 and EAN13 */
@ -556,6 +561,7 @@ int svg_plot(struct zint_symbol *symbol)
} }
} }
} /* if (plot_text) */
xoffset -= comp_offset; xoffset -= comp_offset;
@ -596,7 +602,7 @@ int svg_plot(struct zint_symbol *symbol)
} }
/* Put the human readable text at the bottom */ /* Put the human readable text at the bottom */
if((textdone == 0) && (ustrlen(symbol->text) != 0)) { if(plot_text && (textdone == 0)) {
textpos = symbol->width / 2.0; textpos = symbol->width / 2.0;
fprintf(fsvg, " <text x=\"%.2f\" y=\"%.2f\" text-anchor=\"middle\"\n", (textpos + xoffset) * scaler, default_text_posn); fprintf(fsvg, " <text x=\"%.2f\" y=\"%.2f\" text-anchor=\"middle\"\n", (textpos + xoffset) * scaler, default_text_posn);
fprintf(fsvg, " font-family=\"Helvetica\" font-size=\"%.1f\" fill=\"#%s\" >\n", 8.0 * scaler, symbol->fgcolour); fprintf(fsvg, " font-family=\"Helvetica\" font-size=\"%.1f\" fill=\"#%s\" >\n", 8.0 * scaler, symbol->fgcolour);

View File

@ -388,6 +388,7 @@ char isbn13_check(unsigned char source[]) /* For ISBN(13) only */
char isbn_check(unsigned char source[]) /* For ISBN(10) and SBN only */ char isbn_check(unsigned char source[]) /* For ISBN(10) and SBN only */
{ {
unsigned int i, weight, sum, check, h; unsigned int i, weight, sum, check, h;
char check_char;
sum = 0; sum = 0;
weight = 1; weight = 1;
@ -400,7 +401,9 @@ char isbn_check(unsigned char source[]) /* For ISBN(10) and SBN only */
} }
check = sum % 11; check = sum % 11;
return itoc(check); check_char = itoc(check);
if(check == 10) { check_char = 'X'; }
return check_char;
} }
int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len, char dest[]) /* Make an EAN-13 barcode from an SBN or ISBN */ int isbn(struct zint_symbol *symbol, unsigned char source[], const unsigned int src_len, char dest[]) /* Make an EAN-13 barcode from an SBN or ISBN */

View File

@ -38,6 +38,7 @@ struct zint_symbol {
int option_1; int option_1;
int option_2; int option_2;
int option_3; int option_3;
int show_hrt;
int input_mode; int input_mode;
unsigned char text[128]; unsigned char text[128];
int rows; int rows;

View File

@ -65,6 +65,11 @@ void QZint::encode()
m_zintSymbol->option_1=m_securityLevel; m_zintSymbol->option_1=m_securityLevel;
m_zintSymbol->input_mode = m_input_mode; m_zintSymbol->input_mode = m_input_mode;
m_zintSymbol->option_2=m_width; m_zintSymbol->option_2=m_width;
if(m_hidetext) {
m_zintSymbol->show_hrt = 0;
} else {
m_zintSymbol->show_hrt = 1;
}
if(m_symbol == BARCODE_PDF417) { if(m_symbol == BARCODE_PDF417) {
m_zintSymbol->option_3=m_pdf417CodeWords; m_zintSymbol->option_3=m_pdf417CodeWords;
} else { } else {
@ -76,9 +81,6 @@ void QZint::encode()
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*)bstr.data(), bstr.length()); int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*)bstr.data(), bstr.length());
if (error > WARN_INVALID_OPTION) if (error > WARN_INVALID_OPTION)
m_lastError=m_zintSymbol->errtxt; m_lastError=m_zintSymbol->errtxt;
if(m_hidetext) {
m_zintSymbol->text[0] = (unsigned char) '\0';
}
if (m_zintSymbol->symbology == BARCODE_MAXICODE) if (m_zintSymbol->symbology == BARCODE_MAXICODE)
m_zintSymbol->height = 33; m_zintSymbol->height = 33;
@ -259,6 +261,11 @@ bool QZint::save_to_file(QString filename)
m_zintSymbol->option_1=m_securityLevel; m_zintSymbol->option_1=m_securityLevel;
m_zintSymbol->input_mode = m_input_mode; m_zintSymbol->input_mode = m_input_mode;
m_zintSymbol->option_2=m_width; m_zintSymbol->option_2=m_width;
if(m_hidetext) {
m_zintSymbol->show_hrt = 0;
} else {
m_zintSymbol->show_hrt = 1;
}
if(m_symbol == BARCODE_PDF417) { if(m_symbol == BARCODE_PDF417) {
m_zintSymbol->option_3=m_pdf417CodeWords; m_zintSymbol->option_3=m_pdf417CodeWords;
} else { } else {
@ -277,9 +284,6 @@ bool QZint::save_to_file(QString filename)
int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*)bstr.data(), bstr.length()); int error = ZBarcode_Encode(m_zintSymbol, (unsigned char*)bstr.data(), bstr.length());
if (error > WARN_INVALID_OPTION) if (error > WARN_INVALID_OPTION)
m_lastError=m_zintSymbol->errtxt; m_lastError=m_zintSymbol->errtxt;
if(m_hidetext) {
m_zintSymbol->text[0] = (unsigned char) '\0';
}
error = ZBarcode_Print(m_zintSymbol, 0); error = ZBarcode_Print(m_zintSymbol, 0);
if (error > WARN_INVALID_OPTION) if (error > WARN_INVALID_OPTION)
m_lastError=m_zintSymbol->errtxt; m_lastError=m_zintSymbol->errtxt;
@ -573,6 +577,7 @@ void QZint::render(QPainter & painter, const QRectF & paintRect, AspectRatioMode
textdone = false; textdone = false;
if(m_hidetext == false) {
painter.setFont(fontSmall); painter.setFont(fontSmall);
if(((m_zintSymbol->symbology == BARCODE_EANX) || (m_zintSymbol->symbology == BARCODE_EANX_CC)) || if(((m_zintSymbol->symbology == BARCODE_EANX) || (m_zintSymbol->symbology == BARCODE_EANX_CC)) ||
(m_zintSymbol->symbology == BARCODE_ISBNX)) { (m_zintSymbol->symbology == BARCODE_ISBNX)) {
@ -689,8 +694,9 @@ void QZint::render(QPainter & painter, const QRectF & paintRect, AspectRatioMode
painter.setFont(fontSmall); painter.setFont(fontSmall);
textdone = true; textdone = true;
} }
} /* if (m_hidetext == false) */
if((caption.isEmpty() == false) && (textdone == false)) { if((m_hidetext == false) && (textdone == false)) {
/* Add text to any other symbol */ /* Add text to any other symbol */
painter.drawText(0, m_zintSymbol->height + yoffset, m_zintSymbol->width, 7, Qt::AlignCenter, caption); painter.drawText(0, m_zintSymbol->height + yoffset, m_zintSymbol->width, 7, Qt::AlignCenter, caption);
} }

View File

@ -95,6 +95,7 @@ void usage(void)
" --gs1 Treat input as GS1 data\n" " --gs1 Treat input as GS1 data\n"
" --binary Treat input as Binary data\n" " --binary Treat input as Binary data\n"
" --notext Remove human readable text\n" " --notext Remove human readable text\n"
" --square Force Data Matrix symbols to be square\n"
, ZINT_VERSION); , ZINT_VERSION);
} }
@ -120,14 +121,12 @@ int main(int argc, char **argv)
int error_number; int error_number;
int rotate_angle; int rotate_angle;
int generated; int generated;
int suppress_human_readable;
error_number = 0; error_number = 0;
rotate_angle = 0; rotate_angle = 0;
generated = 0; generated = 0;
my_symbol = ZBarcode_Create(); my_symbol = ZBarcode_Create();
my_symbol->input_mode = UNICODE_MODE; my_symbol->input_mode = UNICODE_MODE;
suppress_human_readable = 0;
if(argc == 1) { if(argc == 1) {
usage(); usage();
@ -166,6 +165,7 @@ int main(int argc, char **argv)
{"sjis", 0, 0, 0}, {"sjis", 0, 0, 0},
{"binary", 0, 0, 0}, {"binary", 0, 0, 0},
{"notext", 0, 0, 0}, {"notext", 0, 0, 0},
{"square", 0, 0, 0},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
c = getopt_long(argc, argv, "htb:w:d:o:i:rcmp", long_options, &option_index); c = getopt_long(argc, argv, "htb:w:d:o:i:rcmp", long_options, &option_index);
@ -210,7 +210,10 @@ int main(int argc, char **argv)
strncpy(my_symbol->bgcolour, optarg, 7); strncpy(my_symbol->bgcolour, optarg, 7);
} }
if(!strcmp(long_options[option_index].name, "notext")) { if(!strcmp(long_options[option_index].name, "notext")) {
suppress_human_readable = 1; my_symbol->show_hrt = 0;
}
if(!strcmp(long_options[option_index].name, "square")) {
my_symbol->option_3 = DM_SQUARE;
} }
if(!strcmp(long_options[option_index].name, "scale")) { if(!strcmp(long_options[option_index].name, "scale")) {
my_symbol->scale = (float)(atof(optarg)); my_symbol->scale = (float)(atof(optarg));
@ -331,9 +334,6 @@ int main(int argc, char **argv)
case 'd': /* we have some data! */ case 'd': /* we have some data! */
error_number = ZBarcode_Encode(my_symbol, (unsigned char*)optarg, strlen(optarg)); error_number = ZBarcode_Encode(my_symbol, (unsigned char*)optarg, strlen(optarg));
if(error_number == 0) { if(error_number == 0) {
if(suppress_human_readable) {
my_symbol->text[0] = (unsigned char)'\0';
}
error_number = ZBarcode_Print(my_symbol, rotate_angle); error_number = ZBarcode_Print(my_symbol, rotate_angle);
} }
generated = 1; generated = 1;
@ -347,9 +347,6 @@ int main(int argc, char **argv)
case 'i': /* Take data from file */ case 'i': /* Take data from file */
error_number = ZBarcode_Encode_File(my_symbol, optarg); error_number = ZBarcode_Encode_File(my_symbol, optarg);
if(error_number == 0) { if(error_number == 0) {
if(suppress_human_readable) {
my_symbol->text[0] = (unsigned char)'\0';
}
error_number = ZBarcode_Print(my_symbol, rotate_angle); error_number = ZBarcode_Print(my_symbol, rotate_angle);
} }
generated = 1; generated = 1;