- BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT: check for errors on writing

to output file; ZBarcode_Encode_File: check `fseek()` for errors
  (ticket #275)
- man page: fix Code 11 check digit info
- manual/man page: document octal escape; Code 128 subset/mode ->
  Code Set
This commit is contained in:
gitlost 2022-12-19 16:28:15 +00:00
parent a54bdc0299
commit 268fdd7fc2
18 changed files with 318 additions and 140 deletions

View File

@ -7,11 +7,14 @@ Version 2.12.0.9 (dev) not released yet
Changes Changes
------- -------
- None yet - BMP/EMF/EPS/GIF/PCX/PNG/SVG/TIF/TXT: check for errors on writing to output
file (ticket #275)
- manual/man page: document octal escape; Code 128 subset/mode -> Code Set
Bugs Bugs
---- ----
- CEPNET: fix no HRT (library: `has_hrt()`) - CEPNET: fix no HRT (library: `has_hrt()`)
- man page: fix Code 11 check digit info
Version 2.12.0 (2022-12-12) Version 2.12.0 (2022-12-12)

View File

@ -199,18 +199,35 @@ INTERNAL int bmp_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
bmp_file = stdout; bmp_file = stdout;
} else { } else {
if (!(bmp_file = out_fopen(symbol->outfile, "wb"))) { if (!(bmp_file = out_fopen(symbol->outfile, "wb"))) {
free(bitmap_file_start);
sprintf(symbol->errtxt, "601: Could not open output file (%d: %.30s)", errno, strerror(errno)); sprintf(symbol->errtxt, "601: Could not open output file (%d: %.30s)", errno, strerror(errno));
free(bitmap_file_start);
return ZINT_ERROR_FILE_ACCESS; return ZINT_ERROR_FILE_ACCESS;
} }
} }
fwrite(bitmap_file_start, file_header.file_size, 1, bmp_file); fwrite(bitmap_file_start, file_header.file_size, 1, bmp_file);
if (ferror(bmp_file)) {
sprintf(symbol->errtxt, "603: Incomplete write to output (%d: %.30s)", errno, strerror(errno));
free(bitmap_file_start);
if (!output_to_stdout) {
(void) fclose(bmp_file);
}
return ZINT_ERROR_FILE_WRITE;
}
if (output_to_stdout) { if (output_to_stdout) {
fflush(bmp_file); if (fflush(bmp_file) != 0) {
sprintf(symbol->errtxt, "604: Incomplete flush to output (%d: %.30s)", errno, strerror(errno));
free(bitmap_file_start);
return ZINT_ERROR_FILE_WRITE;
}
} else { } else {
fclose(bmp_file); if (fclose(bmp_file) != 0) {
sprintf(symbol->errtxt, "605: Failure on closing output file (%d: %.30s)", errno, strerror(errno));
free(bitmap_file_start);
return ZINT_ERROR_FILE_WRITE;
}
} }
free(bitmap_file_start); free(bitmap_file_start);

View File

@ -832,10 +832,24 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) {
fwrite(&emr_eof, sizeof(emr_eof_t), 1, emf_file); fwrite(&emr_eof, sizeof(emr_eof_t), 1, emf_file);
if (ferror(emf_file)) {
sprintf(symbol->errtxt, "644: Incomplete write to output (%d: %.30s)", errno, strerror(errno));
if (!output_to_stdout) {
(void) fclose(emf_file);
}
return ZINT_ERROR_FILE_WRITE;
}
if (output_to_stdout) { if (output_to_stdout) {
fflush(emf_file); if (fflush(emf_file) != 0) {
sprintf(symbol->errtxt, "940: Incomplete flush to output (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} else { } else {
fclose(emf_file); if (fclose(emf_file) != 0) {
sprintf(symbol->errtxt, "941: Failure on closing output file (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} }
return error_number; return error_number;
} }

View File

@ -584,7 +584,7 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
State.InLen = bitmapSize; State.InLen = bitmapSize;
if (!(State.pOut = (unsigned char *) malloc(lzoutbufSize))) { if (!(State.pOut = (unsigned char *) malloc(lzoutbufSize))) {
if (!output_to_stdout) { if (!output_to_stdout) {
fclose(gif_file); (void) fclose(gif_file);
} }
strcpy(symbol->errtxt, "614: Insufficient memory for LZW buffer"); strcpy(symbol->errtxt, "614: Insufficient memory for LZW buffer");
return ZINT_ERROR_MEMORY; return ZINT_ERROR_MEMORY;
@ -596,7 +596,7 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
if (byte_out <= 0) { if (byte_out <= 0) {
free(State.pOut); free(State.pOut);
if (!output_to_stdout) { if (!output_to_stdout) {
fclose(gif_file); (void) fclose(gif_file);
} }
strcpy(symbol->errtxt, "613: Insufficient memory for LZW buffer"); strcpy(symbol->errtxt, "613: Insufficient memory for LZW buffer");
return ZINT_ERROR_MEMORY; return ZINT_ERROR_MEMORY;
@ -606,10 +606,25 @@ INTERNAL int gif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
/* GIF terminator */ /* GIF terminator */
fputc('\x3b', gif_file); fputc('\x3b', gif_file);
if (ferror(gif_file)) {
sprintf(symbol->errtxt, "615: Incomplete write to output (%d: %.30s)", errno, strerror(errno));
if (!output_to_stdout) {
(void) fclose(gif_file);
}
return ZINT_ERROR_FILE_WRITE;
}
if (output_to_stdout) { if (output_to_stdout) {
fflush(gif_file); if (fflush(gif_file) != 0) {
sprintf(symbol->errtxt, "616: Incomplete flush to output (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} else { } else {
fclose(gif_file); if (fclose(gif_file) != 0) {
sprintf(symbol->errtxt, "617: Failure on closing output file (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} }
return 0; return 0;

View File

@ -249,11 +249,11 @@ INTERNAL int error_tag_test(struct zint_symbol *symbol, int error_number, const
static int dump_plot(struct zint_symbol *symbol) { static int dump_plot(struct zint_symbol *symbol) {
FILE *f; FILE *f;
int i, r; int i, r;
char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', static const char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
'9', 'A', 'B', 'C', 'D', 'E', 'F'};
int space = 0; int space = 0;
const int output_to_stdout = symbol->output_options & BARCODE_STDOUT;
if (symbol->output_options & BARCODE_STDOUT) { if (output_to_stdout) {
f = stdout; f = stdout;
} else { } else {
f = fopen(symbol->outfile, "w"); f = fopen(symbol->outfile, "w");
@ -295,10 +295,24 @@ static int dump_plot(struct zint_symbol *symbol) {
space = 0; space = 0;
} }
if (symbol->output_options & BARCODE_STDOUT) { if (ferror(f)) {
fflush(f); sprintf(symbol->errtxt, "790: Incomplete write to output (%d: %.30s)", errno, strerror(errno));
if (!output_to_stdout) {
(void) fclose(f);
}
return ZINT_ERROR_FILE_WRITE;
}
if (output_to_stdout) {
if (fflush(f) != 0) {
sprintf(symbol->errtxt, "791: Incomplete flush to output (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} else { } else {
fclose(f); if (fclose(f) != 0) {
sprintf(symbol->errtxt, "792: Failure on closing output file (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} }
return 0; return 0;
@ -1426,26 +1440,36 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) {
file_opened = 1; file_opened = 1;
/* Get file length */ /* Get file length */
fseek(file, 0, SEEK_END); if (fseek(file, 0, SEEK_END) != 0) {
sprintf(symbol->errtxt, "792: Unable to seek input file (%d: %.30s)", errno, strerror(errno));
(void) fclose(file);
return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL);
}
fileLen = ftell(file); fileLen = ftell(file);
fseek(file, 0, SEEK_SET);
/* On many Linux distros ftell() returns LONG_MAX not -1 on error */ /* On many Linux distros ftell() returns LONG_MAX not -1 on error */
if (fileLen <= 0 || fileLen == LONG_MAX) { if (fileLen <= 0 || fileLen == LONG_MAX) {
fclose(file); (void) fclose(file);
return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "235: Input file empty or unseekable"); return error_tag(symbol, ZINT_ERROR_INVALID_DATA, "235: Input file empty or unseekable");
} }
if (fileLen > ZINT_MAX_DATA_LEN) { if (fileLen > ZINT_MAX_DATA_LEN) {
fclose(file); (void) fclose(file);
return error_tag(symbol, ZINT_ERROR_TOO_LONG, "230: Input file too long"); return error_tag(symbol, ZINT_ERROR_TOO_LONG, "230: Input file too long");
} }
if (fseek(file, 0, SEEK_SET) != 0) {
sprintf(symbol->errtxt, "793: Unable to seek input file (%d: %.30s)", errno, strerror(errno));
(void) fclose(file);
return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL);
}
} }
/* Allocate memory */ /* Allocate memory */
buffer = (unsigned char *) malloc(fileLen); buffer = (unsigned char *) malloc(fileLen);
if (!buffer) { if (!buffer) {
if (file_opened) { if (file_opened) {
fclose(file); (void) fclose(file);
} }
return error_tag(symbol, ZINT_ERROR_MEMORY, "231: Insufficient memory for file read buffer"); return error_tag(symbol, ZINT_ERROR_MEMORY, "231: Insufficient memory for file read buffer");
} }
@ -1456,17 +1480,21 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, const char *filename) {
n = fread(buffer + nRead, 1, fileLen - nRead, file); n = fread(buffer + nRead, 1, fileLen - nRead, file);
if (ferror(file)) { if (ferror(file)) {
sprintf(symbol->errtxt, "241: Input file read error (%d: %.30s)", errno, strerror(errno)); sprintf(symbol->errtxt, "241: Input file read error (%d: %.30s)", errno, strerror(errno));
if (file_opened) {
fclose(file);
}
free(buffer); free(buffer);
if (file_opened) {
(void) fclose(file);
}
return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL); return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL);
} }
nRead += n; nRead += n;
} while (!feof(file) && (0 < n) && ((long) nRead < fileLen)); } while (!feof(file) && (0 < n) && ((long) nRead < fileLen));
if (file_opened) { if (file_opened) {
fclose(file); if (fclose(file) != 0) {
sprintf(symbol->errtxt, "794: Failure on closing input file (%d: %.30s)", errno, strerror(errno));
free(buffer);
return error_tag(symbol, ZINT_ERROR_INVALID_DATA, NULL);
}
} }
ret = ZBarcode_Encode(symbol, buffer, (int) nRead); ret = ZBarcode_Encode(symbol, buffer, (int) nRead);
free(buffer); free(buffer);

View File

@ -597,7 +597,8 @@ INTERNAL int mailmark_2d(struct zint_symbol *symbol, unsigned char source[], int
} }
if (!is_sane(RUBIDIUM_F, local_source, 45)) { if (!is_sane(RUBIDIUM_F, local_source, 45)) {
strcpy(symbol->errtxt, "866: Invalid character in data (alphanumerics and space only in first 45 characters)"); strcpy(symbol->errtxt,
"866: Invalid character in data (alphanumerics and space only in first 45 characters)");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }

View File

@ -207,10 +207,24 @@ INTERNAL int pcx_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
} }
} }
if (ferror(pcx_file)) {
sprintf(symbol->errtxt, "622: Incomplete write to output (%d: %.30s)", errno, strerror(errno));
if (!output_to_stdout) {
(void) fclose(pcx_file);
}
return ZINT_ERROR_FILE_WRITE;
}
if (output_to_stdout) { if (output_to_stdout) {
fflush(pcx_file); if (fflush(pcx_file) != 0) {
sprintf(symbol->errtxt, "623: Incomplete flush to output (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} else { } else {
fclose(pcx_file); if (fclose(pcx_file) != 0) {
sprintf(symbol->errtxt, "624: Failure on closing output file (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} }
return 0; return 0;

View File

@ -245,7 +245,7 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
if (!png_ptr) { if (!png_ptr) {
strcpy(symbol->errtxt, "633: Insufficient memory for PNG write structure buffer"); strcpy(symbol->errtxt, "633: Insufficient memory for PNG write structure buffer");
if (!output_to_stdout) { if (!output_to_stdout) {
fclose(outfile); (void) fclose(outfile);
} }
return ZINT_ERROR_MEMORY; return ZINT_ERROR_MEMORY;
} }
@ -255,7 +255,7 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
png_destroy_write_struct(&png_ptr, NULL); png_destroy_write_struct(&png_ptr, NULL);
strcpy(symbol->errtxt, "634: Insufficient memory for PNG info structure buffer"); strcpy(symbol->errtxt, "634: Insufficient memory for PNG info structure buffer");
if (!output_to_stdout) { if (!output_to_stdout) {
fclose(outfile); (void) fclose(outfile);
} }
return ZINT_ERROR_MEMORY; return ZINT_ERROR_MEMORY;
} }
@ -264,7 +264,7 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
if (setjmp(wpng_error.jmpbuf)) { if (setjmp(wpng_error.jmpbuf)) {
png_destroy_write_struct(&png_ptr, &info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);
if (!output_to_stdout) { if (!output_to_stdout) {
fclose(outfile); (void) fclose(outfile);
} }
return ZINT_ERROR_MEMORY; return ZINT_ERROR_MEMORY;
} }
@ -343,10 +343,24 @@ INTERNAL int png_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
/* make sure we have disengaged */ /* make sure we have disengaged */
png_destroy_write_struct(&png_ptr, &info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);
if (ferror(outfile)) {
sprintf(symbol->errtxt, "638: Incomplete write to output (%d: %.30s)", errno, strerror(errno));
if (!output_to_stdout) {
(void) fclose(outfile);
}
return ZINT_ERROR_FILE_WRITE;
}
if (output_to_stdout) { if (output_to_stdout) {
fflush(outfile); if (fflush(outfile) != 0) {
sprintf(symbol->errtxt, "639: Incomplete flush to output (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} else { } else {
fclose(outfile); if (fclose(outfile) != 0) {
sprintf(symbol->errtxt, "960: Failure on closing output file (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} }
return 0; return 0;

View File

@ -271,38 +271,38 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
} }
/* Start writing the header */ /* Start writing the header */
fprintf(feps, "%%!PS-Adobe-3.0 EPSF-3.0\n"); fputs("%!PS-Adobe-3.0 EPSF-3.0\n", feps);
if (ZINT_VERSION_BUILD) { if (ZINT_VERSION_BUILD) {
fprintf(feps, "%%%%Creator: Zint %d.%d.%d.%d\n", fprintf(feps, "%%%%Creator: Zint %d.%d.%d.%d\n",
ZINT_VERSION_MAJOR, ZINT_VERSION_MINOR, ZINT_VERSION_RELEASE, ZINT_VERSION_BUILD); ZINT_VERSION_MAJOR, ZINT_VERSION_MINOR, ZINT_VERSION_RELEASE, ZINT_VERSION_BUILD);
} else { } else {
fprintf(feps, "%%%%Creator: Zint %d.%d.%d\n", ZINT_VERSION_MAJOR, ZINT_VERSION_MINOR, ZINT_VERSION_RELEASE); fprintf(feps, "%%%%Creator: Zint %d.%d.%d\n", ZINT_VERSION_MAJOR, ZINT_VERSION_MINOR, ZINT_VERSION_RELEASE);
} }
fprintf(feps, "%%%%Title: Zint Generated Symbol\n"); fputs("%%Title: Zint Generated Symbol\n"
fprintf(feps, "%%%%Pages: 0\n"); "%%Pages: 0\n", feps);
fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n", fprintf(feps, "%%%%BoundingBox: 0 0 %d %d\n",
(int) ceilf(symbol->vector->width), (int) ceilf(symbol->vector->height)); (int) ceilf(symbol->vector->width), (int) ceilf(symbol->vector->height));
fprintf(feps, "%%%%EndComments\n"); fputs("%%EndComments\n", feps);
/* Definitions */ /* Definitions */
if (have_circles_without_width) { if (have_circles_without_width) {
/* Disc: x y radius TD */ /* Disc: x y radius TD */
fprintf(feps, "/TD { newpath 0 360 arc fill } bind def\n"); fputs("/TD { newpath 0 360 arc fill } bind def\n", feps);
} }
if (have_circles_with_width) { if (have_circles_with_width) {
/* Circle (ring): x y radius width TC (adapted from BWIPP renmaxicode.ps) */ /* Circle (ring): x y radius width TC (adapted from BWIPP renmaxicode.ps) */
fprintf(feps, "/TC { newpath 4 1 roll 3 copy 0 360 arc closepath 4 -1 roll add 360 0 arcn closepath fill }" fputs("/TC { newpath 4 1 roll 3 copy 0 360 arc closepath 4 -1 roll add 360 0 arcn closepath fill }"
" bind def\n"); " bind def\n", feps);
} }
if (symbol->vector->hexagons) { if (symbol->vector->hexagons) {
fprintf(feps, "/TH { 0 setlinewidth moveto lineto lineto lineto lineto lineto closepath fill } bind def\n"); fputs("/TH { 0 setlinewidth moveto lineto lineto lineto lineto lineto closepath fill } bind def\n", feps);
} }
fprintf(feps, "/TB { 2 copy } bind def\n"); fputs("/TB { 2 copy } bind def\n"
fprintf(feps, "/TR { newpath 4 1 roll exch moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto closepath fill }" "/TR { newpath 4 1 roll exch moveto 1 index 0 rlineto 0 exch rlineto neg 0 rlineto closepath fill }"
" bind def\n"); " bind def\n"
fprintf(feps, "/TE { pop pop } bind def\n"); "/TE { pop pop } bind def\n", feps);
fprintf(feps, "newpath\n"); fputs("newpath\n", feps);
/* Now the actual representation */ /* Now the actual representation */
@ -315,7 +315,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
} }
fprintf(feps, "%.2f 0.00 TB 0.00 %.2f TR\n", symbol->vector->height, symbol->vector->width); fprintf(feps, "%.2f 0.00 TB 0.00 %.2f TR\n", symbol->vector->height, symbol->vector->width);
fprintf(feps, "TE\n"); fputs("TE\n", feps);
} }
if (symbol->symbology != BARCODE_ULTRA) { if (symbol->symbology != BARCODE_ULTRA) {
@ -344,7 +344,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
} }
fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n", fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n",
rect->height, (symbol->vector->height - rect->y) - rect->height, rect->x, rect->width); rect->height, (symbol->vector->height - rect->y) - rect->height, rect->x, rect->width);
fprintf(feps, "TE\n"); fputs("TE\n", feps);
} }
rect = rect->next; rect = rect->next;
} }
@ -361,7 +361,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
} }
fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n", fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n",
rect->height, (symbol->vector->height - rect->y) - rect->height, rect->x, rect->width); rect->height, (symbol->vector->height - rect->y) - rect->height, rect->x, rect->width);
fprintf(feps, "TE\n"); fputs("TE\n", feps);
} }
rect = rect->next; rect = rect->next;
} }
@ -371,7 +371,7 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
while (rect) { while (rect) {
fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n", fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n",
rect->height, (symbol->vector->height - rect->y) - rect->height, rect->x, rect->width); rect->height, (symbol->vector->height - rect->y) - rect->height, rect->x, rect->width);
fprintf(feps, "TE\n"); fputs("TE\n", feps);
rect = rect->next; rect = rect->next;
} }
} }
@ -473,17 +473,17 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
if (iso_latin1) { if (iso_latin1) {
/* Change encoding to ISO 8859-1, see Postscript Language Reference Manual 2nd Edition Example 5.6 */ /* Change encoding to ISO 8859-1, see Postscript Language Reference Manual 2nd Edition Example 5.6 */
fprintf(feps, "/%s findfont\n", font); fprintf(feps, "/%s findfont\n", font);
fprintf(feps, "dup length dict begin\n"); fputs("dup length dict begin\n"
fprintf(feps, "{1 index /FID ne {def} {pop pop} ifelse} forall\n"); "{1 index /FID ne {def} {pop pop} ifelse} forall\n"
fprintf(feps, "/Encoding ISOLatin1Encoding def\n"); "/Encoding ISOLatin1Encoding def\n"
fprintf(feps, "currentdict\n"); "currentdict\n"
fprintf(feps, "end\n"); "end\n"
fprintf(feps, "/Helvetica-ISOLatin1 exch definefont pop\n"); "/Helvetica-ISOLatin1 exch definefont pop\n", feps);
font = "Helvetica-ISOLatin1"; font = "Helvetica-ISOLatin1";
} }
do { do {
ps_convert(string->text, ps_string); ps_convert(string->text, ps_string);
fprintf(feps, "matrix currentmatrix\n"); fputs("matrix currentmatrix\n", feps);
fprintf(feps, "/%s findfont\n", font); fprintf(feps, "/%s findfont\n", font);
fprintf(feps, "%.2f scalefont setfont\n", string->fsize); fprintf(feps, "%.2f scalefont setfont\n", string->fsize);
fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n", fprintf(feps, " 0 0 moveto %.2f %.2f translate 0.00 rotate 0 0 moveto\n",
@ -492,31 +492,45 @@ INTERNAL int ps_plot(struct zint_symbol *symbol) {
fprintf(feps, " (%s) stringwidth\n", ps_string); fprintf(feps, " (%s) stringwidth\n", ps_string);
} }
if (string->rotation != 0) { if (string->rotation != 0) {
fprintf(feps, "gsave\n"); fputs("gsave\n", feps);
fprintf(feps, "%d rotate\n", 360 - string->rotation); fprintf(feps, "%d rotate\n", 360 - string->rotation);
} }
if (string->halign == 0 || string->halign == 2) { if (string->halign == 0 || string->halign == 2) {
fprintf(feps, "pop\n"); fputs("pop\n", feps);
fprintf(feps, "%s 0 rmoveto\n", string->halign == 2 ? "neg" : "-2 div"); fprintf(feps, "%s 0 rmoveto\n", string->halign == 2 ? "neg" : "-2 div");
} }
fprintf(feps, " (%s) show\n", ps_string); fprintf(feps, " (%s) show\n", ps_string);
if (string->rotation != 0) { if (string->rotation != 0) {
fprintf(feps, "grestore\n"); fputs("grestore\n", feps);
} }
fprintf(feps, "setmatrix\n"); fputs("setmatrix\n", feps);
string = string->next; string = string->next;
} while (string); } while (string);
} }
if (output_to_stdout) {
fflush(feps);
} else {
fclose(feps);
}
if (locale) if (locale)
setlocale(LC_ALL, locale); setlocale(LC_ALL, locale);
if (ferror(feps)) {
sprintf(symbol->errtxt, "647: Incomplete write to output (%d: %.30s)", errno, strerror(errno));
if (!output_to_stdout) {
(void) fclose(feps);
}
return ZINT_ERROR_FILE_WRITE;
}
if (output_to_stdout) {
if (fflush(feps) != 0) {
sprintf(symbol->errtxt, "648: Incomplete flush to output (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} else {
if (fclose(feps) != 0) {
sprintf(symbol->errtxt, "649: Failure on closing output file (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
}
return error_number; return error_number;
} }

View File

@ -1013,7 +1013,7 @@ static int append_log(char log) {
file = fopen("zintlog.txt", "a+"); file = fopen("zintlog.txt", "a+");
fprintf(file, "%c", log); fprintf(file, "%c", log);
fclose(file); (void) fclose(file);
return 0; return 0;
} }
@ -1023,7 +1023,7 @@ static int write_log(char log[]) {
file = fopen("zintlog.txt", "a+"); file = fopen("zintlog.txt", "a+");
fprintf(file, log); /*writes*/ fprintf(file, log); /*writes*/
fprintf(file, "\r\n"); /*writes*/ fprintf(file, "\r\n"); /*writes*/
fclose(file); (void) fclose(file);
return 0; return 0;
} }
#endif #endif

View File

@ -136,6 +136,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
char colour_code[7]; char colour_code[7];
int len, html_len; int len, html_len;
const int output_to_stdout = symbol->output_options & BARCODE_STDOUT;
char *html_string; char *html_string;
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
@ -181,7 +182,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
strcpy(symbol->errtxt, "681: Vector header NULL"); strcpy(symbol->errtxt, "681: Vector header NULL");
return ZINT_ERROR_INVALID_DATA; return ZINT_ERROR_INVALID_DATA;
} }
if (symbol->output_options & BARCODE_STDOUT) { if (output_to_stdout) {
fsvg = stdout; fsvg = stdout;
} else { } else {
if (!(fsvg = out_fopen(symbol->outfile, "w"))) { if (!(fsvg = out_fopen(symbol->outfile, "w"))) {
@ -193,14 +194,14 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
locale = setlocale(LC_ALL, "C"); locale = setlocale(LC_ALL, "C");
/* Start writing the header */ /* Start writing the header */
fprintf(fsvg, "<?xml version=\"1.0\" standalone=\"no\"?>\n"); fputs("<?xml version=\"1.0\" standalone=\"no\"?>\n"
fprintf(fsvg, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n"); "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n"
fprintf(fsvg, " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n"); " \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n", fsvg);
fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n", fprintf(fsvg, "<svg width=\"%d\" height=\"%d\" version=\"1.1\"\n",
(int) ceilf(symbol->vector->width), (int) ceilf(symbol->vector->height)); (int) ceilf(symbol->vector->width), (int) ceilf(symbol->vector->height));
fprintf(fsvg, " xmlns=\"http://www.w3.org/2000/svg\">\n"); fputs(" xmlns=\"http://www.w3.org/2000/svg\">\n"
fprintf(fsvg, " <desc>Zint Generated Symbol\n"); " <desc>Zint Generated Symbol\n"
fprintf(fsvg, " </desc>\n"); " </desc>\n", fsvg);
fprintf(fsvg, "\n <g id=\"barcode\" fill=\"#%s\">\n", fgcolour_string); fprintf(fsvg, "\n <g id=\"barcode\" fill=\"#%s\">\n", fgcolour_string);
if (bg_alpha != 0) { if (bg_alpha != 0) {
@ -209,7 +210,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
if (bg_alpha != 0xff) { if (bg_alpha != 0xff) {
fprintf(fsvg, " opacity=\"%.3f\"", bg_alpha_opacity); fprintf(fsvg, " opacity=\"%.3f\"", bg_alpha_opacity);
} }
fprintf(fsvg, " />\n"); fputs(" />\n", fsvg);
} }
rect = symbol->vector->rectangles; rect = symbol->vector->rectangles;
@ -223,7 +224,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
if (fg_alpha != 0xff) { if (fg_alpha != 0xff) {
fprintf(fsvg, " opacity=\"%.3f\"", fg_alpha_opacity); fprintf(fsvg, " opacity=\"%.3f\"", fg_alpha_opacity);
} }
fprintf(fsvg, " />\n"); fputs(" />\n", fsvg);
rect = rect->next; rect = rect->next;
} }
@ -268,7 +269,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
if (fg_alpha != 0xff) { if (fg_alpha != 0xff) {
fprintf(fsvg, " opacity=\"%.3f\"", fg_alpha_opacity); fprintf(fsvg, " opacity=\"%.3f\"", fg_alpha_opacity);
} }
fprintf(fsvg, " />\n"); fputs(" />\n", fsvg);
hex = hex->next; hex = hex->next;
} }
@ -300,7 +301,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
fprintf(fsvg, " opacity=\"%.3f\"", fg_alpha_opacity); fprintf(fsvg, " opacity=\"%.3f\"", fg_alpha_opacity);
} }
} }
fprintf(fsvg, " />\n"); fputs(" />\n", fsvg);
circle = circle->next; circle = circle->next;
} }
@ -312,7 +313,7 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
fprintf(fsvg, " <text x=\"%.2f\" y=\"%.2f\" text-anchor=\"%s\"\n", string->x, string->y, halign); fprintf(fsvg, " <text x=\"%.2f\" y=\"%.2f\" text-anchor=\"%s\"\n", string->x, string->y, halign);
fprintf(fsvg, " font-family=\"%s\" font-size=\"%.1f\"", font_family, string->fsize); fprintf(fsvg, " font-family=\"%s\" font-size=\"%.1f\"", font_family, string->fsize);
if (bold) { if (bold) {
fprintf(fsvg, " font-weight=\"bold\""); fputs(" font-weight=\"bold\"", fsvg);
} }
if (fg_alpha != 0xff) { if (fg_alpha != 0xff) {
fprintf(fsvg, " opacity=\"%.3f\"", fg_alpha_opacity); fprintf(fsvg, " opacity=\"%.3f\"", fg_alpha_opacity);
@ -320,25 +321,39 @@ INTERNAL int svg_plot(struct zint_symbol *symbol) {
if (string->rotation != 0) { if (string->rotation != 0) {
fprintf(fsvg, " transform=\"rotate(%d,%.2f,%.2f)\"", string->rotation, string->x, string->y); fprintf(fsvg, " transform=\"rotate(%d,%.2f,%.2f)\"", string->rotation, string->x, string->y);
} }
fprintf(fsvg, " >\n"); fputs(" >\n", fsvg);
make_html_friendly(string->text, html_string); make_html_friendly(string->text, html_string);
fprintf(fsvg, " %s\n", html_string); fprintf(fsvg, " %s\n", html_string);
fprintf(fsvg, " </text>\n"); fputs(" </text>\n", fsvg);
string = string->next; string = string->next;
} }
fprintf(fsvg, " </g>\n"); fputs(" </g>\n"
fprintf(fsvg, "</svg>\n"); "</svg>\n", fsvg);
if (symbol->output_options & BARCODE_STDOUT) {
fflush(fsvg);
} else {
fclose(fsvg);
}
if (locale) if (locale)
setlocale(LC_ALL, locale); setlocale(LC_ALL, locale);
if (ferror(fsvg)) {
sprintf(symbol->errtxt, "682: Incomplete write to output (%d: %.30s)", errno, strerror(errno));
if (!output_to_stdout) {
(void) fclose(fsvg);
}
return ZINT_ERROR_FILE_WRITE;
}
if (output_to_stdout) {
if (fflush(fsvg) != 0) {
sprintf(symbol->errtxt, "683: Incomplete flush to output (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} else {
if (fclose(fsvg) != 0) {
sprintf(symbol->errtxt, "684: Failure on closing output file (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
}
return error_number; return error_number;
} }

View File

@ -398,7 +398,7 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
file_pos = ftell(tif_file); file_pos = ftell(tif_file);
if (!tif_lzw_encode(&lzw_state, tif_file, strip_buf, bytes_put)) { /* Only fails if can't malloc */ if (!tif_lzw_encode(&lzw_state, tif_file, strip_buf, bytes_put)) { /* Only fails if can't malloc */
tif_lzw_cleanup(&lzw_state); tif_lzw_cleanup(&lzw_state);
fclose(tif_file); /* Only use LZW if not STDOUT, so ok to close */ (void) fclose(tif_file); /* Only use LZW if not STDOUT, so ok to close */
strcpy(symbol->errtxt, "673: Failed to malloc LZW hash table"); strcpy(symbol->errtxt, "673: Failed to malloc LZW hash table");
return ZINT_ERROR_MEMORY; return ZINT_ERROR_MEMORY;
} }
@ -603,15 +603,29 @@ INTERNAL int tif_pixel_plot(struct zint_symbol *symbol, unsigned char *pixelbuf)
total_bytes_put += 6 * color_map_size; total_bytes_put += 6 * color_map_size;
} }
if (ferror(tif_file)) {
sprintf(symbol->errtxt, "679: Incomplete write to output (%d: %.30s)", errno, strerror(errno));
if (!output_to_stdout) {
(void) fclose(tif_file);
}
return ZINT_ERROR_FILE_WRITE;
}
if (output_to_stdout) { if (output_to_stdout) {
fflush(tif_file); if (fflush(tif_file) != 0) {
sprintf(symbol->errtxt, "980: Incomplete flush to output (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} else { } else {
if (ftell(tif_file) != total_bytes_put) { if (ftell(tif_file) != total_bytes_put) {
fclose(tif_file); (void) fclose(tif_file);
strcpy(symbol->errtxt, "674: Failed to write all output"); strcpy(symbol->errtxt, "674: Failed to write all output");
return ZINT_ERROR_FILE_WRITE; return ZINT_ERROR_FILE_WRITE;
} }
fclose(tif_file); if (fclose(tif_file) != 0) {
sprintf(symbol->errtxt, "981: Failure on closing output file (%d: %.30s)", errno, strerror(errno));
return ZINT_ERROR_FILE_WRITE;
}
} }
return 0; return 0;

View File

@ -42,31 +42,34 @@
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/* Vector elements - see vector header `zint_vector` below */
struct zint_vector_rect { struct zint_vector_rect {
float x, y, height, width; float x, y; /* Top left */
float height, width;
int colour; /* -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White */ int colour; /* -1 for foreground, 1-8 for Cyan, Blue, Magenta, Red, Yellow, Green, Black, White */
struct zint_vector_rect *next; /* Pointer to next rectangle */ struct zint_vector_rect *next; /* Pointer to next rectangle */
}; };
struct zint_vector_hexagon { struct zint_vector_hexagon {
float x, y, diameter; float x, y; /* Centre */
int rotation; /* 0, 90, 180, 270 degrees */ float diameter; /* Short (minimal) diameter (i.e. diameter of inscribed circle) */
int rotation; /* 0, 90, 180, 270 degrees, where 0 has apex at top, i.e. short diameter is horizontal */
struct zint_vector_hexagon *next; /* Pointer to next hexagon */ struct zint_vector_hexagon *next; /* Pointer to next hexagon */
}; };
struct zint_vector_string { struct zint_vector_string {
float x, y; /* x, y position relative to halign */ float x, y; /* Top with x relative to halign (i.e. centre, left, right) */
float fsize; /* Font size */ float fsize; /* Font size */
float width; /* Suggested string width, may be 0 if none recommended */ float width; /* Suggested string width, may be 0 if none recommended */
int length; /* Number of characters */ int length; /* Number of characters */
int rotation; /* 0, 90, 180, 270 degrees */ int rotation; /* 0, 90, 180, 270 degrees */
int halign; /* Horizontal alignment: 0 for centre, 1 for left, 2 for right (end) */ int halign; /* Horizontal alignment: 0 for centre, 1 for left, 2 for right (end) */
unsigned char *text; unsigned char *text; /* UTF-8, NUL-terminated */
struct zint_vector_string *next; /* Pointer to next string */ struct zint_vector_string *next; /* Pointer to next string */
}; };
struct zint_vector_circle { struct zint_vector_circle {
float x, y; float x, y; /* Centre */
float diameter; /* Circle diameter. Does not include width (if any) */ float diameter; /* Circle diameter. Does not include width (if any) */
float width; /* Width of circle perimeter (circumference). 0 for fill (disc) */ float width; /* Width of circle perimeter (circumference). 0 for fill (disc) */
int colour; /* Non-zero for draw with background colour (else draw with foreground colour) */ int colour; /* Non-zero for draw with background colour (else draw with foreground colour) */
@ -185,7 +188,7 @@ extern "C" {
#define BARCODE_PDF417TRUNC 56 /* Legacy */ #define BARCODE_PDF417TRUNC 56 /* Legacy */
#define BARCODE_MAXICODE 57 /* MaxiCode */ #define BARCODE_MAXICODE 57 /* MaxiCode */
#define BARCODE_QRCODE 58 /* QR Code */ #define BARCODE_QRCODE 58 /* QR Code */
#define BARCODE_CODE128AB 60 /* Code 128 (Suppress subset C) */ #define BARCODE_CODE128AB 60 /* Code 128 (Suppress Code Set C) */
#define BARCODE_CODE128B 60 /* Legacy */ #define BARCODE_CODE128B 60 /* Legacy */
#define BARCODE_AUSPOST 63 /* Australia Post Standard Customer */ #define BARCODE_AUSPOST 63 /* Australia Post Standard Customer */
#define BARCODE_AUSREPLY 66 /* Australia Post Reply Paid */ #define BARCODE_AUSREPLY 66 /* Australia Post Reply Paid */

View File

@ -492,15 +492,20 @@ Sequence Equivalent
`\\` 0x5C `\` Backslash `\\` 0x5C `\` Backslash
`\dNNN` NNN Any 8-bit character where NNN is decimal (0-255) `\dNNN` NNN Any 8-bit character where NNN is decimal
(000-255)
`\oNNN` 0oNNN Any 8-bit character where NNN is octal
(000-377)
`\xNN` 0xNN Any 8-bit character where NN is hexadecimal `\xNN` 0xNN Any 8-bit character where NN is hexadecimal
(00-FF)
`\uNNNN` Any 16-bit Unicode BMP[^2] character where `\uNNNN` Any 16-bit Unicode BMP[^2] character where
NNNN is hexadecimal NNNN is hexadecimal (0000-FFFF)
`\UNNNNNN` Any 21-bit Unicode character where NNNNNN `\UNNNNNN` Any 21-bit Unicode character where NNNNNN
is hexadecimal (maximum 0x10FFFF) is hexadecimal (000000-10FFFF)
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
Table: {#tbl:escape_sequences tag=": Escape Sequences"} Table: {#tbl:escape_sequences tag=": Escape Sequences"}
@ -593,7 +598,7 @@ Value
18 `BARCODE_CODABAR` Codabar 18 `BARCODE_CODABAR` Codabar
20 `BARCODE_CODE128` Code 128 (automatic subset switching) 20 `BARCODE_CODE128` Code 128 (automatic Code Set switching)
21 `BARCODE_DPLEIT` Deutsche Post Leitcode 21 `BARCODE_DPLEIT` Deutsche Post Leitcode
@ -648,7 +653,7 @@ Value
58 `BARCODE_QRCODE` QR Code 58 `BARCODE_QRCODE` QR Code
60 `BARCODE_CODE128AB` Code 128 (Suppress subset C) 60 `BARCODE_CODE128AB` Code 128 (Suppress Code Set C)
63 `BARCODE_AUSPOST` Australia Post Standard Customer 63 `BARCODE_AUSPOST` Australia Post Standard Customer
@ -2776,20 +2781,22 @@ pharmaceuticals. The symbology is able to encode whole numbers between 3 and
One of the most ubiquitous one-dimensional barcode symbologies, Code 128 was One of the most ubiquitous one-dimensional barcode symbologies, Code 128 was
developed in 1981 by Computer Identics. This symbology supports full ASCII text developed in 1981 by Computer Identics. This symbology supports full ASCII text
and uses a three-mode system to compress the data into a smaller symbol. Zint and uses a three-Code Set system to compress the data into a smaller symbol.
automatically switches between modes and adds a modulo-103 check digit. Code Zint automatically switches between Code Sets A, B and C and adds a modulo-103
128 is the default barcode symbology used by Zint. In addition Zint supports check digit.
the encoding of ISO/IEC 8859-1 (non-English) characters in Code 128 symbols. The
ISO/IEC 8859-1 character set is shown in Appendix [A.2 Latin Alphabet No. 1
(ISO/IEC 8859-1)].
#### 6.1.10.2 Code 128 Suppress Subset C (Subsets A and B only) Code 128 is the default barcode symbology used by Zint. In addition Zint
supports the encoding of ISO/IEC 8859-1 (non-English) characters in Code 128
symbols. The ISO/IEC 8859-1 character set is shown in Appendix [A.2 Latin
Alphabet No. 1 (ISO/IEC 8859-1)].
#### 6.1.10.2 Code 128 Suppress Code Set C (Code Sets A and B only)
![`zint -b CODE128AB -d "130170X178"`](images/code128ab.svg) ![`zint -b CODE128AB -d "130170X178"`](images/code128ab.svg)
It is sometimes advantageous to stop Code 128 from using subset mode C which It is sometimes advantageous to stop Code 128 from using Code Set C which
compresses numerical data. The `BARCODE_CODE128AB`[^10] variant (symbology 60) compresses numerical data. The `BARCODE_CODE128AB`[^10] variant (symbology 60)
suppresses mode C in favour of modes A and B. suppresses Code Set C in favour of Code Sets A and B.
[^10]: `BARCODE_CODE128AB` previously used the name `BARCODE_CODE128B`, which is [^10]: `BARCODE_CODE128AB` previously used the name `BARCODE_CODE128B`, which is
still recognised. still recognised.

View File

@ -106,7 +106,7 @@ December 2022
- 6.1.9 Pharmacode - 6.1.9 Pharmacode
- 6.1.10 Code 128 - 6.1.10 Code 128
- 6.1.10.1 Standard Code 128 (ISO 15417) - 6.1.10.1 Standard Code 128 (ISO 15417)
- 6.1.10.2 Code 128 Suppress Subset C (Subsets A and B only) - 6.1.10.2 Code 128 Suppress Code Set C (Code Sets A and B only)
- 6.1.10.3 GS1-128 - 6.1.10.3 GS1-128
- 6.1.10.4 EAN-14 - 6.1.10.4 EAN-14
- 6.1.10.5 NVE-18 (SSCC-18) - 6.1.10.5 NVE-18 (SSCC-18)
@ -646,15 +646,19 @@ sequences are shown in the table below.
\\ 0x5C \ Backslash \\ 0x5C \ Backslash
\dNNN NNN Any 8-bit character where NNN is decimal \dNNN NNN Any 8-bit character where NNN is decimal
(0-255) (000-255)
\oNNN 0oNNN Any 8-bit character where NNN is octal
(000-377)
\xNN 0xNN Any 8-bit character where NN is hexadecimal \xNN 0xNN Any 8-bit character where NN is hexadecimal
(00-FF)
\uNNNN Any 16-bit Unicode BMP[2] character where \uNNNN Any 16-bit Unicode BMP[2] character where
NNNN is hexadecimal NNNN is hexadecimal (0000-FFFF)
\UNNNNNN Any 21-bit Unicode character where NNNNNN \UNNNNNN Any 21-bit Unicode character where NNNNNN
is hexadecimal (maximum 0x10FFFF) is hexadecimal (000000-10FFFF)
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
: Table : Escape Sequences: : Table : Escape Sequences:
@ -731,7 +735,7 @@ underscores are optional.
18 BARCODE_CODABAR Codabar 18 BARCODE_CODABAR Codabar
20 BARCODE_CODE128 Code 128 (automatic subset switching) 20 BARCODE_CODE128 Code 128 (automatic Code Set switching)
21 BARCODE_DPLEIT Deutsche Post Leitcode 21 BARCODE_DPLEIT Deutsche Post Leitcode
@ -786,7 +790,7 @@ underscores are optional.
58 BARCODE_QRCODE QR Code 58 BARCODE_QRCODE QR Code
60 BARCODE_CODE128AB Code 128 (Suppress subset C) 60 BARCODE_CODE128AB Code 128 (Suppress Code Set C)
63 BARCODE_AUSPOST Australia Post Standard Customer 63 BARCODE_AUSPOST Australia Post Standard Customer
@ -2729,20 +2733,22 @@ pharmaceuticals. The symbology is able to encode whole numbers between 3 and
One of the most ubiquitous one-dimensional barcode symbologies, Code 128 was One of the most ubiquitous one-dimensional barcode symbologies, Code 128 was
developed in 1981 by Computer Identics. This symbology supports full ASCII text developed in 1981 by Computer Identics. This symbology supports full ASCII text
and uses a three-mode system to compress the data into a smaller symbol. Zint and uses a three-Code Set system to compress the data into a smaller symbol.
automatically switches between modes and adds a modulo-103 check digit. Code 128 Zint automatically switches between Code Sets A, B and C and adds a modulo-103
is the default barcode symbology used by Zint. In addition Zint supports the check digit.
encoding of ISO/IEC 8859-1 (non-English) characters in Code 128 symbols. The
ISO/IEC 8859-1 character set is shown in Appendix A.2 Latin Alphabet No. 1
(ISO/IEC 8859-1).
6.1.10.2 Code 128 Suppress Subset C (Subsets A and B only) Code 128 is the default barcode symbology used by Zint. In addition Zint
supports the encoding of ISO/IEC 8859-1 (non-English) characters in Code 128
symbols. The ISO/IEC 8859-1 character set is shown in Appendix A.2 Latin
Alphabet No. 1 (ISO/IEC 8859-1).
6.1.10.2 Code 128 Suppress Code Set C (Code Sets A and B only)
[zint -b CODE128AB -d "130170X178"] [zint -b CODE128AB -d "130170X178"]
It is sometimes advantageous to stop Code 128 from using subset mode C which It is sometimes advantageous to stop Code 128 from using Code Set C which
compresses numerical data. The BARCODE_CODE128AB[10] variant (symbology 60) compresses numerical data. The BARCODE_CODE128AB[10] variant (symbology 60)
suppresses mode C in favour of modes A and B. suppresses Code Set C in favour of Code Sets A and B.
6.1.10.3 GS1-128 6.1.10.3 GS1-128
@ -4497,8 +4503,10 @@ OPTIONS
\\ (0x5C) \ Backslash \\ (0x5C) \ Backslash
\dNNN (NNN) Any 8-bit character where NNN is \dNNN (NNN) Any 8-bit character where NNN is
decimal (000-255) decimal (000-255)
\oNNN (0oNNN) Any 8-bit character where NNN is
octal (000-377)
\xNN (0xNN) Any 8-bit character where NN is \xNN (0xNN) Any 8-bit character where NN is
hexadecimal hexadecimal (00-FF)
\uNNNN (U+NNNN) Any 16-bit Unicode BMP character \uNNNN (U+NNNN) Any 16-bit Unicode BMP character
where NNNN is hexadecimal where NNNN is hexadecimal
\UNNNNNN (U+NNNNNN) Any 21-bit Unicode character \UNNNNNN (U+NNNNNN) Any 21-bit Unicode character
@ -4749,8 +4757,10 @@ OPTIONS
C25LOGIC ditto C25LOGIC ditto
C25STANDARD ditto C25STANDARD ditto
Codabar 1 or 2 (add hidden or visible check digit) Codabar 1 or 2 (add hidden or visible check digit)
Code 11 0 or 1 (no or 1 visible check digit only) Code 11 0 to 2 (2 visible check digits to none)
(default is 2 visible check digits) 0 (default 2 visible check digits)
1 (1 visible check digit)
2 (no check digits)
Code 39 1 (add visible check digit) Code 39 1 (add visible check digit)
Code 93 1 (hide the default check characters) Code 93 1 (hide the default check characters)
EXCODE39 1 (add visible check digit) EXCODE39 1 (add visible check digit)

View File

@ -187,8 +187,10 @@ The escape sequences are:
\[rs]\[rs] (0x5C) \[rs] Backslash \[rs]\[rs] (0x5C) \[rs] Backslash
\[rs]dNNN (NNN) Any 8-bit character where NNN is \[rs]dNNN (NNN) Any 8-bit character where NNN is
decimal (000-255) decimal (000-255)
\[rs]oNNN (0oNNN) Any 8-bit character where NNN is
octal (000-377)
\[rs]xNN (0xNN) Any 8-bit character where NN is \[rs]xNN (0xNN) Any 8-bit character where NN is
hexadecimal hexadecimal (00-FF)
\[rs]uNNNN (U+NNNN) Any 16-bit Unicode BMP character \[rs]uNNNN (U+NNNN) Any 16-bit Unicode BMP character
where NNNN is hexadecimal where NNNN is hexadecimal
\[rs]UNNNNNN (U+NNNNNN) Any 21-bit Unicode character \[rs]UNNNNNN (U+NNNNNN) Any 21-bit Unicode character
@ -466,8 +468,10 @@ C25INTER ditto
C25LOGIC ditto C25LOGIC ditto
C25STANDARD ditto C25STANDARD ditto
Codabar 1 or 2 (add hidden or visible check digit) Codabar 1 or 2 (add hidden or visible check digit)
Code 11 0 or 1 (no or 1 visible check digit only) Code 11 0 to 2 (2 visible check digits to none)
(default is 2 visible check digits) 0 (default 2 visible check digits)
1 (1 visible check digit)
2 (no check digits)
Code 39 1 (add visible check digit) Code 39 1 (add visible check digit)
Code 93 1 (hide the default check characters) Code 93 1 (hide the default check characters)
EXCODE39 1 (add visible check digit) EXCODE39 1 (add visible check digit)

View File

@ -139,8 +139,10 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
\\ (0x5C) \ Backslash \\ (0x5C) \ Backslash
\dNNN (NNN) Any 8-bit character where NNN is \dNNN (NNN) Any 8-bit character where NNN is
decimal (000-255) decimal (000-255)
\oNNN (0oNNN) Any 8-bit character where NNN is
octal (000-377)
\xNN (0xNN) Any 8-bit character where NN is \xNN (0xNN) Any 8-bit character where NN is
hexadecimal hexadecimal (00-FF)
\uNNNN (U+NNNN) Any 16-bit Unicode BMP character \uNNNN (U+NNNN) Any 16-bit Unicode BMP character
where NNNN is hexadecimal where NNNN is hexadecimal
\UNNNNNN (U+NNNNNN) Any 21-bit Unicode character \UNNNNNN (U+NNNNNN) Any 21-bit Unicode character
@ -368,8 +370,10 @@ Paintbrush (`PCX`), Portable Network Format (`PNG`), Scalable Vector Graphic (`S
C25LOGIC ditto C25LOGIC ditto
C25STANDARD ditto C25STANDARD ditto
Codabar 1 or 2 (add hidden or visible check digit) Codabar 1 or 2 (add hidden or visible check digit)
Code 11 0 or 1 (no or 1 visible check digit only) Code 11 0 to 2 (2 visible check digits to none)
(default is 2 visible check digits) 0 (default 2 visible check digits)
1 (1 visible check digit)
2 (no check digits)
Code 39 1 (add visible check digit) Code 39 1 (add visible check digit)
Code 93 1 (hide the default check characters) Code 93 1 (hide the default check characters)
EXCODE39 1 (add visible check digit) EXCODE39 1 (add visible check digit)

View File

@ -1530,6 +1530,7 @@ or import from file</string>
&lt;tr&gt;&lt;td&gt;\R&amp;nbsp;&lt;/td&gt;&lt;td&gt;Record Separator (0x1E)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\R&amp;nbsp;&lt;/td&gt;&lt;td&gt;Record Separator (0x1E)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\\&amp;nbsp;&lt;/td&gt;&lt;td&gt;Backslash (0x5C)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\\&amp;nbsp;&lt;/td&gt;&lt;td&gt;Backslash (0x5C)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\dNNN&amp;nbsp;&lt;/td&gt;&lt;td&gt;8-bit character (N decimal)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\dNNN&amp;nbsp;&lt;/td&gt;&lt;td&gt;8-bit character (N decimal)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\oNNN&amp;nbsp;&lt;/td&gt;&lt;td&gt;8-bit character (N octal)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\xNN&amp;nbsp;&lt;/td&gt;&lt;td&gt;8-bit character (N hex)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\xNN&amp;nbsp;&lt;/td&gt;&lt;td&gt;8-bit character (N hex)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\uNNNN&amp;nbsp;&lt;/td&gt;&lt;td&gt;16-bit Unicode BMP (N hex)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\uNNNN&amp;nbsp;&lt;/td&gt;&lt;td&gt;16-bit Unicode BMP (N hex)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;\UNNNNNN&amp;nbsp;&lt;/td&gt;&lt;td&gt;21-bit Unicode (N hex)&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\UNNNNNN&amp;nbsp;&lt;/td&gt;&lt;td&gt;21-bit Unicode (N hex)&lt;/td&gt;&lt;/tr&gt;