Merge branch 'master' of ssh://git.code.sf.net/p/zint/code

This commit is contained in:
Robin Stuart 2016-08-28 16:39:13 +01:00
commit f0d8bb82dc
17 changed files with 487 additions and 396 deletions

View file

@ -7,7 +7,7 @@ find_package(PNG)
set(zint_COMMON_SRCS common.c library.c render.c large.c reedsol.c gs1.c eci.c)
set(zint_ONEDIM_SRCS code.c code128.c 2of5.c upcean.c telepen.c medical.c plessey.c rss.c)
set(zint_POSTAL_SRCS postal.c auspost.c imail.c)
set(zint_TWODIM_SRCS code16k.c dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c hanxin.c dotcode.c)
set(zint_TWODIM_SRCS code16k.c codablock.c dmatrix.c pdf417.c qr.c maxicode.c composite.c aztec.c code49.c code1.c gridmtx.c hanxin.c dotcode.c)
set(zint_OUTPUT_SRCS render.c ps.c svg.c bmp.c pcx.c gif.c png.c raster.c)
set(zint_SRCS ${zint_OUTPUT_SRCS} ${zint_COMMON_SRCS} ${zint_ONEDIM_SRCS} ${zint_POSTAL_SRCS} ${zint_TWODIM_SRCS})
@ -22,7 +22,9 @@ add_library(zint SHARED ${zint_SRCS})
set_target_properties(zint PROPERTIES SOVERSION "${ZINT_VERSION_MAJOR}.${ZINT_VERSION_MINOR}"
VERSION ${ZINT_VERSION})
target_link_libraries(zint ${PNG_LIBRARIES} )
if(PNG_FOUND)
target_link_libraries(zint ${PNG_LIBRARIES} )
endif(PNG_FOUND)
target_link_libraries(zint -lm)
install(TARGETS zint ${INSTALL_TARGETS_DEFAULT_ARGS} )

45
backend/codablock.c Normal file
View file

@ -0,0 +1,45 @@
/* codablock.c - Handles Codablock-F and Codablock-E */
/*
libzint - the open source barcode library
Copyright (C) 2016 Harald Oehlmann
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*/
#include <stdio.h>
#include "common.h"
int codablock(struct zint_symbol *symbol, unsigned char source[], int length) {
if (symbol->input_mode == GS1_MODE) {
printf("Encode GS1 data (Codablock-E?)\n");
} else {
printf("Encode in Codablock-F\n");
}
return ZINT_ERROR_INVALID_OPTION;
}

View file

@ -329,7 +329,9 @@ int code_49(struct zint_symbol *symbol, unsigned char source[], const int length
}
symbol->whitespace_width = 10;
symbol->output_options = BARCODE_BIND;
if (!(symbol->output_options & BARCODE_BIND)) {
symbol->output_options += BARCODE_BIND;
}
symbol->border_width = 2;
return 0;

View file

@ -302,7 +302,7 @@ int seventeen_ten(unsigned char source[], int position, int length) {
* returning the resulting number of codewords (Annex F.II.E)
*/
int ahead_c(unsigned char source[], int position, int length) {
int count = 0;
int count = 0;
int i;
for (i = position; (i < length) && datum_c(source, i, length); i += 2) {
@ -327,7 +327,7 @@ int try_c(unsigned char source[], int position, int length) {
/* Annex F.II.G */
int ahead_a(unsigned char source[], int position, int length) {
int count = 0;
int count = 0;
int i;
for (i = position; ((i < length) && datum_a(source, i, length))
@ -340,7 +340,7 @@ int ahead_a(unsigned char source[], int position, int length) {
/* Annex F.II.H */
int ahead_b(unsigned char source[], int position, int length) {
int count = 0;
int count = 0;
int i;
for (i = position; ((i < length) && datum_b(source, i, length))
@ -1050,8 +1050,8 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
unsigned char codeword_array[length * 3];
unsigned char masked_codeword_array[length * 3];
#else
char* dot_stream;
char* dot_array;
char* dot_stream;
char* dot_array;
unsigned char* codeword_array = (unsigned char *) _alloca(length * 3 * sizeof (unsigned char));
unsigned char* masked_codeword_array = (unsigned char *) _alloca(length * 3 * sizeof (unsigned char));
#endif /* _MSC_VER */
@ -1249,7 +1249,9 @@ int dotcode(struct zint_symbol *symbol, unsigned char source[], int length) {
symbol->row_height[k] = 1;
}
symbol->output_options += BARCODE_DOTTY_MODE;
if (!(symbol->output_options & BARCODE_DOTTY_MODE)) {
symbol->output_options += BARCODE_DOTTY_MODE;
}
return 0;
}

View file

@ -187,6 +187,7 @@ extern int code_one(struct zint_symbol *symbol, unsigned char source[], int leng
extern int grid_matrix(struct zint_symbol *symbol, const unsigned char source[], int length); /* Grid Matrix */
extern int han_xin(struct zint_symbol * symbol, const unsigned char source[], int length); /* Han Xin */
extern int dotcode(struct zint_symbol * symbol, const unsigned char source[], int length); /* DotCode */
extern int codablock(struct zint_symbol * symbol, const unsigned char source[], int length); /* Codablock */
extern int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */
extern int render_plot(struct zint_symbol *symbol, float width, float height); /* Plot to gLabels */
@ -217,7 +218,7 @@ int dump_plot(struct zint_symbol *symbol) {
char hex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
'9', 'A', 'B', 'C', 'D', 'E', 'F'};
int space = 0;
if (symbol->output_options & BARCODE_STDOUT) {
f = stdout;
} else {
@ -349,6 +350,9 @@ int hibc(struct zint_symbol *symbol, unsigned char source[], int length) {
case BARCODE_HIBC_AZTEC:
error_number = aztec(symbol, (unsigned char *) to_process, length);
break;
case BARCODE_HIBC_BLOCKF:
error_number = codablock(symbol, (unsigned char *) to_process, length);
break;
}
return error_number;
@ -380,6 +384,7 @@ static int gs1_compliant(const int symbology) {
case BARCODE_CODE49:
case BARCODE_QRCODE:
case BARCODE_DOTCODE:
case BARCODE_CODABLOCK:
result = 1;
break;
}
@ -508,6 +513,7 @@ int ZBarcode_ValidID(int symbol_id) {
case BARCODE_HIBC_PDF:
case BARCODE_HIBC_MICPDF:
case BARCODE_HIBC_AZTEC:
case BARCODE_HIBC_BLOCKF:
case BARCODE_AZRUNE:
case BARCODE_CODE32:
case BARCODE_EANX_CC:
@ -525,6 +531,7 @@ int ZBarcode_ValidID(int symbol_id) {
case BARCODE_GRIDMATRIX:
case BARCODE_HANXIN:
case BARCODE_DOTCODE:
case BARCODE_CODABLOCK:
result = 1;
break;
}
@ -563,13 +570,17 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
if (symbol->symbology == BARCODE_CODE16K) {
symbol->whitespace_width = 16;
symbol->border_width = 2;
symbol->output_options = BARCODE_BIND;
if (!(symbol->output_options & BARCODE_BIND)) {
symbol->output_options += BARCODE_BIND;
}
}
if (symbol->symbology == BARCODE_ITF14) {
symbol->whitespace_width = 20;
symbol->border_width = 8;
symbol->output_options = BARCODE_BOX;
if (!(symbol->output_options & BARCODE_BOX)) {
symbol->output_options += BARCODE_BOX;
}
}
switch (symbol->input_mode) {
@ -726,6 +737,8 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
break;
case BARCODE_HIBC_AZTEC: error_number = hibc(symbol, preprocessed, length);
break;
case BARCODE_HIBC_BLOCKF: error_number = hibc(symbol, preprocessed, length);
break;
case BARCODE_JAPANPOST: error_number = japan_post(symbol, preprocessed, length);
break;
case BARCODE_CODE49: error_number = code_49(symbol, preprocessed, length);
@ -748,6 +761,8 @@ static int reduced_charset(struct zint_symbol *symbol, const unsigned char *sour
break;
case BARCODE_DOTCODE: error_number = dotcode(symbol, preprocessed, length);
break;
case BARCODE_CODABLOCK: error_number = codablock(symbol, preprocessed, length);
break;
}
return error_number;
@ -770,7 +785,11 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
}
if (strcmp(symbol->outfile, "") == 0) {
#ifdef NO_PNG
strcpy(symbol->outfile, "out.gif");
#else
strcpy(symbol->outfile, "out.png");
#endif
}
#ifndef _MSC_VER
unsigned char local_source[length + 1];
@ -843,8 +862,8 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
symbol->symbology = BARCODE_AUSPOST;
}
if (symbol->symbology == 73) {
strcpy(symbol->errtxt, "Codablock E not supported");
error_number = ZINT_ERROR_INVALID_OPTION;
symbol->symbology = BARCODE_CODABLOCK;
symbol->input_mode = GS1_MODE;
}
if (symbol->symbology == 78) {
symbol->symbology = BARCODE_RSS14;
@ -905,10 +924,6 @@ int ZBarcode_Encode(struct zint_symbol *symbol, unsigned char *source, int lengt
symbol->symbology = BARCODE_CODE128;
error_number = ZINT_WARN_INVALID_OPTION;
}
if ((symbol->symbology == BARCODE_CODABLOCKF) || (symbol->symbology == BARCODE_HIBC_BLOCKF)) {
strcpy(symbol->errtxt, "Codablock F not supported");
error_number = ZINT_ERROR_INVALID_OPTION;
}
if (error_number > 4) {
error_tag(symbol->errtxt, error_number);
@ -1021,7 +1036,7 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
return ZINT_ERROR_INVALID_OPTION;
}
if (symbol->output_options &= BARCODE_DOTTY_MODE) {
if (symbol->output_options & BARCODE_DOTTY_MODE) {
if (!(is_matrix(symbol->symbology))) {
strcpy(symbol->errtxt, "Selected symbology cannot be rendered as dots");
return ZINT_ERROR_INVALID_OPTION;
@ -1078,6 +1093,11 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
return ZINT_ERROR_INVALID_OPTION;
}
if (error_number == ZINT_ERROR_INVALID_OPTION) {
/* If libpng is not installed */
strcpy(symbol->errtxt, "Unknown output format");
}
error_tag(symbol->errtxt, error_number);
return error_number;
}

View file

@ -35,10 +35,10 @@
#include <string.h>
#include "common.h"
#include "pcx.h" /* PCX header structure */
#include <math.h>
#ifdef _MSC_VER
#include <io.h>
#include <fcntl.h>
#include <math.h>
#ifdef _MSC_VER
#include <io.h>
#include <fcntl.h>
#endif
#define SSET "0123456789ABCDEF"
@ -49,11 +49,11 @@ int pcx_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
int row, column, i, colour;
int run_count;
FILE *pcx_file;
pcx_header_t header;
#ifdef _MSC_VER
char* rotated_bitmap;
unsigned char* rle_row;
#endif
pcx_header_t header;
#ifdef _MSC_VER
char* rotated_bitmap;
unsigned char* rle_row;
#endif
#ifndef _MSC_VER
char rotated_bitmap[image_height * image_width];
@ -180,7 +180,7 @@ int pcx_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
}
/* Open output file in binary mode */
if ((symbol->output_options & BARCODE_STDOUT) != 0) {
if (symbol->output_options & BARCODE_STDOUT) {
#ifdef _MSC_VER
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
strcpy(symbol->errtxt, "Can't open output file");

View file

@ -131,7 +131,7 @@ int png_pixel_plot(struct zint_symbol *symbol, int image_height, int image_width
bgblu = (16 * ctoi(symbol->bgcolour[4])) + ctoi(symbol->bgcolour[5]);
/* Open output file in binary mode */
if ((symbol->output_options & BARCODE_STDOUT) != 0) {
if (symbol->output_options & BARCODE_STDOUT) {
#ifdef _MSC_VER
if (-1 == _setmode(_fileno(stdout), _O_BINARY)) {
strcpy(symbol->errtxt, "Can't open output file");

View file

@ -99,7 +99,7 @@ int ps_plot(struct zint_symbol *symbol) {
}
}
if ((symbol->output_options & BARCODE_STDOUT) != 0) {
if (symbol->output_options & BARCODE_STDOUT) {
feps = stdout;
} else {
feps = fopen(symbol->outfile, "w");
@ -868,7 +868,7 @@ int ps_plot(struct zint_symbol *symbol) {
/* Do nothing! (It's already been done) */
break;
default:
if ((symbol->output_options & BARCODE_BIND) != 0) {
if (symbol->output_options & BARCODE_BIND) {
if ((symbol->rows > 1) && (is_stackable(symbol->symbology) == 1)) {
/* row binding */
fprintf(feps, "TE\n");
@ -882,7 +882,7 @@ int ps_plot(struct zint_symbol *symbol) {
}
}
}
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
fprintf(feps, "TE\n");
if ((symbol->output_options & CMYK_COLOUR) == 0) {
fprintf(feps, "%.2f %.2f %.2f setrgbcolor\n", red_ink, green_ink, blue_ink);
@ -892,7 +892,7 @@ int ps_plot(struct zint_symbol *symbol) {
fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n", symbol->border_width * scaler, textoffset * scaler, 0.0, (symbol->width + xoffset + xoffset) * scaler);
fprintf(feps, "%.2f %.2f TB %.2f %.2f TR\n", symbol->border_width * scaler, (textoffset + symbol->height + symbol->border_width) * scaler, 0.0, (symbol->width + xoffset + xoffset) * scaler);
}
if ((symbol->output_options & BARCODE_BOX) != 0) {
if (symbol->output_options & BARCODE_BOX) {
/* side bars */
fprintf(feps, "TE\n");
if ((symbol->output_options & CMYK_COLOUR) == 0) {

View file

@ -292,7 +292,7 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
image_height = 300 + (2 * yoffset * 2);
if (!(pixelbuf = (char *) malloc(image_width * image_height))) {
printf("Insifficient memory for pixel buffer");
printf("Insufficient memory for pixel buffer");
return ZINT_ERROR_ENCODING_PROBLEM;
} else {
for (i = 0; i < (image_width * image_height); i++) {
@ -319,13 +319,13 @@ int plot_raster_maxicode(struct zint_symbol *symbol, int rotate_angle, int data_
}
}
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
/* boundary bars */
draw_bar(pixelbuf, 0, image_width, 0, symbol->border_width * 2, image_width, image_height);
draw_bar(pixelbuf, 0, image_width, 300 + (symbol->border_width * 2), symbol->border_width * 2, image_width, image_height);
}
if ((symbol->output_options & BARCODE_BOX) != 0) {
if (symbol->output_options & BARCODE_BOX) {
/* side bars */
draw_bar(pixelbuf, 0, symbol->border_width * 2, 0, image_height, image_width, image_height);
draw_bar(pixelbuf, 300 + ((symbol->border_width + symbol->whitespace_width + symbol->whitespace_width) * 2), symbol->border_width * 2, 0, image_height, image_width, image_height);
@ -619,7 +619,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
}
}
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
default_text_posn = image_height - 17;
} else {
default_text_posn = image_height - 17 - symbol->border_width - symbol->border_width;
@ -867,7 +867,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
xoffset -= comp_offset;
/* Put boundary bars or box around symbol */
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
/* boundary bars */
draw_bar(pixelbuf, 0, (symbol->width + xoffset + xoffset) * 2, textoffset * 2, symbol->border_width * 2, image_width, image_height);
draw_bar(pixelbuf, 0, (symbol->width + xoffset + xoffset) * 2, (textoffset + symbol->height + symbol->border_width) * 2, symbol->border_width * 2, image_width, image_height);
@ -881,7 +881,7 @@ int plot_raster_default(struct zint_symbol *symbol, int rotate_angle, int data_t
}
}
if ((symbol->output_options & BARCODE_BOX) != 0) {
if (symbol->output_options & BARCODE_BOX) {
/* side bars */
draw_bar(pixelbuf, 0, symbol->border_width * 2, textoffset * 2, (symbol->height + (2 * symbol->border_width)) * 2, image_width, image_height);
draw_bar(pixelbuf, (symbol->width + xoffset + xoffset - symbol->border_width) * 2, symbol->border_width * 2, textoffset * 2, (symbol->height + (2 * symbol->border_width)) * 2, image_width, image_height);
@ -927,12 +927,11 @@ int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type) {
#ifdef NO_PNG
if (file_type == OUT_PNG_FILE) {
printf("libpng not found");
return ZINT_ERROR_INVALID_OPTION;
}
#endif /* NO_PNG */
if (symbol->output_options &= BARCODE_DOTTY_MODE) {
if (symbol->output_options & BARCODE_DOTTY_MODE) {
error = plot_raster_dotty(symbol, rotate_angle, file_type);
} else {
if (symbol->symbology == BARCODE_MAXICODE) {

View file

@ -248,7 +248,7 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
}
large_bar_height = (symbol->height - preset_height) / large_bar_count;
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
default_text_posn = (symbol->height + text_offset + symbol->border_width + symbol->border_width) * scaler;
} else {
default_text_posn = (symbol->height + text_offset + symbol->border_width) * scaler;
@ -643,13 +643,13 @@ int render_plot(struct zint_symbol *symbol, const float width, const float heigh
}
}
}
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
line = render_plot_create_line(0, 0, (symbol->width + xoffset + xoffset) * scaler, symbol->border_width * scaler);
render_plot_add_line(symbol, line, &last_line);
line = render_plot_create_line(0, (symbol->height + symbol->border_width) * scaler, (symbol->width + xoffset + xoffset) * scaler, symbol->border_width * scaler);
render_plot_add_line(symbol, line, &last_line);
}
if ((symbol->output_options & BARCODE_BOX) != 0) {
if (symbol->output_options & BARCODE_BOX) {
/* side bars */
line = render_plot_create_line(0, 0, symbol->border_width * scaler, (symbol->height + (2 * symbol->border_width)) * scaler);
render_plot_add_line(symbol, line, &last_line);

View file

@ -95,7 +95,7 @@ int svg_plot(struct zint_symbol *symbol) {
}
}
if ((symbol->output_options & BARCODE_STDOUT) != 0) {
if (symbol->output_options & BARCODE_STDOUT) {
fsvg = stdout;
} else {
fsvg = fopen(symbol->outfile, "w");
@ -230,7 +230,7 @@ int svg_plot(struct zint_symbol *symbol) {
fprintf(fsvg, " <rect x=\"0\" y=\"0\" width=\"%d\" height=\"%d\" fill=\"#%s\" />\n", (int)ceil((74.0F + xoffset + xoffset) * scaler), (int)ceil((72.0F + yoffset + yoffset) * scaler), symbol->bgcolour);
}
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
default_text_posn = (symbol->height + textoffset + symbol->border_width + symbol->border_width) * scaler;
} else {
default_text_posn = (symbol->height + textoffset + symbol->border_width) * scaler;
@ -242,11 +242,11 @@ int svg_plot(struct zint_symbol *symbol) {
textoffset = 0.0;
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", 0.0, 0.0, (74.0 + xoffset + xoffset) * scaler, symbol->border_width * scaler);
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", 0.0, (72.0 + symbol->border_width) * scaler, (74.0 + xoffset + xoffset) * scaler, symbol->border_width * scaler);
}
if ((symbol->output_options & BARCODE_BOX) != 0) {
if (symbol->output_options & BARCODE_BOX) {
/* side bars */
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", 0.0, 0.0, symbol->border_width * scaler, (72.0 + (2 * symbol->border_width)) * scaler);
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", (74.0 + xoffset + xoffset - symbol->border_width) * scaler, 0.0, symbol->border_width * scaler, (72.0 + (2 * symbol->border_width)) * scaler);
@ -307,7 +307,7 @@ int svg_plot(struct zint_symbol *symbol) {
}
row_posn += yoffset;
if ((symbol->output_options & BARCODE_DOTTY_MODE) != 0) {
if (symbol->output_options & BARCODE_DOTTY_MODE) {
/* Use (currently undocumented) dot mode - see SF ticket #29 */
for (i = 0; i < symbol->width; i++) {
if (module_is_set(symbol, this_row, i)) {
@ -609,7 +609,7 @@ int svg_plot(struct zint_symbol *symbol) {
/* Do nothing! (It's already been done) */
break;
default:
if ((symbol->output_options & BARCODE_BIND) != 0) {
if (symbol->output_options & BARCODE_BIND) {
if ((symbol->rows > 1) && (is_stackable(symbol->symbology) == 1)) {
/* row binding */
for (r = 1; r < symbol->rows; r++) {
@ -617,11 +617,11 @@ int svg_plot(struct zint_symbol *symbol) {
}
}
}
if (((symbol->output_options & BARCODE_BOX) != 0) || ((symbol->output_options & BARCODE_BIND) != 0)) {
if ((symbol->output_options & BARCODE_BOX) || (symbol->output_options & BARCODE_BIND)) {
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", 0.0, 0.0, (symbol->width + xoffset + xoffset) * scaler, symbol->border_width * scaler);
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", 0.0, (symbol->height + symbol->border_width) * scaler, (symbol->width + xoffset + xoffset) * scaler, symbol->border_width * scaler);
}
if ((symbol->output_options & BARCODE_BOX) != 0) {
if (symbol->output_options & BARCODE_BOX) {
/* side bars */
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", 0.0, 0.0, symbol->border_width * scaler, (symbol->height + (2 * symbol->border_width)) * scaler);
fprintf(fsvg, " <rect x=\"%.2f\" y=\"%.2f\" width=\"%.2f\" height=\"%.2f\" />\n", (symbol->width + xoffset + xoffset - symbol->border_width) * scaler, 0.0, symbol->border_width * scaler, (symbol->height + (2 * symbol->border_width)) * scaler);

View file

@ -143,7 +143,7 @@ extern "C" {
#define BARCODE_RM4SCC 70
#define BARCODE_DATAMATRIX 71
#define BARCODE_EAN14 72
#define BARCODE_CODABLOCKF 74
#define BARCODE_CODABLOCK 74
#define BARCODE_NVE18 75
#define BARCODE_JAPANPOST 76
#define BARCODE_KOREAPOST 77