1
0
Fork 0
mirror of https://git.code.sf.net/p/zint/code synced 2025-06-01 23:58:27 -04:00

Change height and row_height array to floats; DAFT tracker ratio

This commit is contained in:
gitlost 2021-06-19 13:11:23 +01:00
parent 22a6c583af
commit c693482aa1
63 changed files with 2708 additions and 1418 deletions
backend

View file

@ -439,7 +439,8 @@ static void draw_string(unsigned char *pixbuf, const unsigned char input_string[
if (odd_si) {
x_incr += i * letter_width / 2;
}
draw_letter(pixbuf, input_string[i], string_left_hand + x_incr, yposn, textflags, image_width, image_height, si);
draw_letter(pixbuf, input_string[i], string_left_hand + x_incr, yposn, textflags, image_width, image_height,
si);
}
}
@ -649,7 +650,7 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang
int image_height, image_width;
unsigned char *pixelbuf;
int error_number;
int xoffset, yoffset, roffset, boffset;
float xoffset, yoffset, roffset, boffset;
float scaler = symbol->scale;
int xoffset_scaled, yoffset_scaled;
unsigned char *scaled_hexagon;
@ -715,7 +716,8 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang
for (column = 0; column < symbol->width - odd_row; column++) {
const int xposn = column * hex_width + xposn_offset;
if (module_is_set(symbol, row, column)) {
draw_hexagon(pixelbuf, image_width, image_height, scaled_hexagon, hex_width, hex_height, xposn, yposn);
draw_hexagon(pixelbuf, image_width, image_height, scaled_hexagon, hex_width, hex_height, xposn,
yposn);
}
}
}
@ -765,7 +767,8 @@ static void draw_bind_box(struct zint_symbol *symbol, unsigned char *pixelbuf, c
if (symbol->border_width > 0 && (symbol->output_options & (BARCODE_BOX | BARCODE_BIND))) {
const int bwidth = symbol->border_width * si;
const int ybind_bottom = (textoffset + symbol->whitespace_height) * si;
const int ybind_top = (textoffset + symbol->whitespace_height + symbol->height) * si + overspill_scaled + bwidth;
const int ybind_top = (textoffset + symbol->whitespace_height + symbol->height) * si + overspill_scaled
+ bwidth;
/* Horizontal boundary bars */
if ((symbol->output_options & BARCODE_BOX)
|| (symbol->symbology != BARCODE_CODABLOCKF && symbol->symbology != BARCODE_HIBC_BLOCKF)) {
@ -796,7 +799,7 @@ static int plot_raster_dotty(struct zint_symbol *symbol, const int rotate_angle,
int r, i;
int scale_width, scale_height;
int error_number = 0;
int xoffset, yoffset, roffset, boffset;
float xoffset, yoffset, roffset, boffset;
float dot_overspill;
float dotoffset;
float dotradius_scaled;
@ -850,7 +853,8 @@ static int plot_raster_dotty(struct zint_symbol *symbol, const int rotate_angle,
draw_bind_box(symbol, scaled_pixelbuf, xoffset, roffset, 0 /*textoffset*/, dot_overspill_scaled,
scale_width, scale_height, (int) floorf(scaler));
error_number = save_raster_image_to_file(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle, file_type);
error_number = save_raster_image_to_file(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle,
file_type);
if (rotate_angle || file_type != OUT_BUFFER || !(symbol->output_options & OUT_BUFFER_INTERMEDIATE)) {
free(scaled_pixelbuf);
}
@ -908,8 +912,8 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
unsigned char addon[6];
int addon_gap = 0;
float addon_text_posn = 0.0f;
int xoffset, yoffset, roffset, boffset;
int textoffset;
float xoffset, yoffset, roffset, boffset;
float textoffset;
int default_text_posn;
float row_height, row_posn;
int upceanflag = 0;
@ -919,13 +923,13 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
int hide_text;
int i, r;
int text_height; /* Font pixel size (so whole integers) */
int text_gap; /* Gap between barcode and text */
float text_gap; /* Gap between barcode and text */
int textflags = 0;
int guardoffset = 0;
int image_width, image_height;
unsigned char *pixelbuf;
int next_yposn;
float next_yposn;
int latch;
float scaler = symbol->scale;
int si;
@ -946,7 +950,7 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
si = 2;
}
large_bar_height = output_large_bar_height(symbol);
large_bar_height = output_large_bar_height(symbol, si /*Round to scale*/);
main_width = symbol->width;
@ -956,21 +960,22 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
output_set_whitespace_offsets(symbol, &xoffset, &yoffset, &roffset, &boffset);
hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0));
/* Note font sizes halved as in pixels */
if (upceanflag) {
textflags = UPCEAN_TEXT | (symbol->output_options & SMALL_TEXT); /* Bold not available for UPC/EAN */
text_height = (UPCEAN_FONT_HEIGHT + 1) / 2;
text_gap = 1;
text_gap = 1.0f;
} else {
textflags = symbol->output_options & (SMALL_TEXT | BOLD_TEXT);
text_height = textflags & SMALL_TEXT ? (SMALL_FONT_HEIGHT + 1) / 2 : (NORMAL_FONT_HEIGHT + 1) / 2;
text_gap = 1;
text_gap = 1.0f;
}
hide_text = ((!symbol->show_hrt) || (ustrlen(symbol->text) == 0));
if (hide_text) {
textoffset = upceanflag && upceanflag != 2 && upceanflag != 5 ? 5 : 0; /* Need 5X from bottom for guard bars */
/* Need 5X from bottom for guard bars */
textoffset = upceanflag && upceanflag != 2 && upceanflag != 5 ? 5 : 0;
} else {
if (upceanflag) {
textoffset = (text_height > 5 ? text_height : 5) + text_gap; /* Need at least 5X for guard bars */
@ -999,13 +1004,13 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
/* Plot the body of the symbol to the pixel buffer */
for (r = 0; r < symbol->rows; r++) {
int plot_yposn;
float plot_yposn;
float plot_height;
int this_row = symbol->rows - r - 1; /* invert r otherwise plots upside down */
row_posn += row_height;
plot_yposn = next_yposn;
row_height = symbol->row_height[this_row] ? symbol->row_height[this_row] : large_bar_height;
next_yposn = (int) (row_posn + row_height);
next_yposn = row_posn + row_height;
plot_height = next_yposn - plot_yposn;
plot_yposn *= si;
@ -1019,11 +1024,13 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
int block_width = 0;
do {
block_width++;
} while ((i + block_width < symbol->width) && module_colour_is_set(symbol, this_row, i + block_width) == module_fill);
} while ((i + block_width < symbol->width)
&& module_colour_is_set(symbol, this_row, i + block_width) == module_fill);
if (module_fill) {
/* a colour block */
draw_bar(pixelbuf, (i + xoffset) * si, block_width * si, plot_yposn, plot_height, image_width, image_height, ultra_colour[module_fill]);
draw_bar(pixelbuf, (i + xoffset) * si, block_width * si, plot_yposn, plot_height, image_width,
image_height, ultra_colour[module_fill]);
}
i += block_width;
@ -1034,7 +1041,8 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
int block_width = 0;
do {
block_width++;
} while ((i + block_width < symbol->width) && module_is_set(symbol, this_row, i + block_width) == module_fill);
} while ((i + block_width < symbol->width)
&& module_is_set(symbol, this_row, i + block_width) == module_fill);
if (upceanflag && (addon_latch == 0) && (r == 0) && (i > main_width)) {
plot_height = row_height - (text_height + text_gap) + 5.0f;
@ -1050,14 +1058,17 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
plot_height = 0.5f;
}
/* Need to invert composite position */
addon_text_posn = is_composite(symbol->symbology) ? image_height - (plot_yposn + plot_height + text_height + text_gap) * si : yoffset * si;
addon_text_posn = is_composite(symbol->symbology)
? image_height - (plot_yposn + plot_height + text_height + text_gap) * si
: yoffset * si;
plot_yposn *= si;
plot_height *= si;
addon_latch = 1;
}
if (module_fill) {
/* a bar */
draw_bar(pixelbuf, (i + xoffset) * si, block_width * si, plot_yposn, plot_height, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (i + xoffset) * si, block_width * si, plot_yposn, plot_height, image_width,
image_height, DEFAULT_INK);
}
i += block_width;
@ -1071,19 +1082,30 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
/* Guard bar extension */
if (upceanflag == 6) { /* UPC-E */
draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (50 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (50 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
} else if (upceanflag == 8) { /* EAN-8 */
draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (32 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (34 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (64 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (66 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (32 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (34 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (64 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (66 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
} else if (upceanflag == 12) { /* UPC-A */
latch = 1;
@ -1094,10 +1116,12 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
int block_width = 0;
do {
block_width++;
} while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_fill);
} while ((i + block_width < symbol->width)
&& module_is_set(symbol, symbol->rows - 1, i + block_width) == module_fill);
if (latch == 1) {
/* a bar */
draw_bar(pixelbuf, (i + xoffset - comp_offset) * si, block_width * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (i + xoffset - comp_offset) * si, block_width * si, guardoffset * si, 5 * si,
image_width, image_height, DEFAULT_INK);
latch = 0;
} else {
/* a space */
@ -1105,8 +1129,10 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
}
i += block_width;
} while (i < 11 + comp_offset);
draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
latch = 1;
i = 85 + comp_offset;
do {
@ -1114,10 +1140,12 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
int block_width = 0;
do {
block_width++;
} while ((i + block_width < symbol->width) && module_is_set(symbol, symbol->rows - 1, i + block_width) == module_fill);
} while ((i + block_width < symbol->width)
&& module_is_set(symbol, symbol->rows - 1, i + block_width) == module_fill);
if (latch == 1) {
/* a bar */
draw_bar(pixelbuf, (i + xoffset - comp_offset) * si, block_width * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (i + xoffset - comp_offset) * si, block_width * si, guardoffset * si, 5 * si,
image_width, image_height, DEFAULT_INK);
latch = 0;
} else {
/* a space */
@ -1127,12 +1155,18 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
} while (i < 96 + comp_offset);
} else if (upceanflag == 13) { /* EAN-13 */
draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (92 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (94 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height, DEFAULT_INK);
draw_bar(pixelbuf, (0 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (2 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (46 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (48 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (92 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
draw_bar(pixelbuf, (94 + xoffset) * si, 1 * si, guardoffset * si, 5 * si, image_width, image_height,
DEFAULT_INK);
}
}
@ -1140,96 +1174,121 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
if (upceanflag) {
/* Note font sizes halved as in pixels */
int upcea_width_adj = (UPCEAN_SMALL_FONT_WIDTH + 3) / 4; /* Halved again to get middle position that draw_string() expects */
/* Halved again to get middle position that draw_string() expects */
int upcea_width_adj = (UPCEAN_SMALL_FONT_WIDTH + 3) / 4;
int upcea_height_adj = (UPCEAN_FONT_HEIGHT - UPCEAN_SMALL_FONT_HEIGHT) * si / 2;
int ean_width_adj = (UPCEAN_FONT_WIDTH + 3) / 4; /* Halved again to get middle position that draw_string() expects */
/* Halved again to get middle position that draw_string() expects */
int ean_width_adj = (UPCEAN_FONT_WIDTH + 3) / 4;
output_upcean_split_text(upceanflag, symbol->text, textpart1, textpart2, textpart3, textpart4);
if (upceanflag == 6) { /* UPC-E */
textpos = (-(5 + upcea_width_adj) + xoffset) * si;
draw_string(pixelbuf, textpart1, textpos, default_text_posn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si);
draw_string(pixelbuf, textpart1, textpos, default_text_posn + upcea_height_adj,
textflags | SMALL_TEXT, image_width, image_height, si);
textpos = (24 + xoffset) * si;
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height,
si);
textpos = (51 + 3 + upcea_width_adj + xoffset) * si;
draw_string(pixelbuf, textpart3, textpos, default_text_posn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si);
draw_string(pixelbuf, textpart3, textpos, default_text_posn + upcea_height_adj,
textflags | SMALL_TEXT, image_width, image_height, si);
textdone = 1;
switch (ustrlen(addon)) {
case 2:
textpos = (61 + xoffset + addon_gap) * si;
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height,
si);
break;
case 5:
textpos = (75 + xoffset + addon_gap) * si;
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height,
si);
break;
}
} else if (upceanflag == 8) { /* EAN-8 */
textpos = (17 + xoffset) * si;
draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height,
si);
textpos = (50 + xoffset) * si;
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height,
si);
textdone = 1;
switch (ustrlen(addon)) {
case 2:
textpos = (77 + xoffset + addon_gap) * si;
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height,
si);
break;
case 5:
textpos = (91 + xoffset + addon_gap) * si;
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height,
si);
break;
}
} else if (upceanflag == 12) { /* UPC-A */
textpos = (-(5 + upcea_width_adj) + xoffset) * si;
draw_string(pixelbuf, textpart1, textpos, default_text_posn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si);
draw_string(pixelbuf, textpart1, textpos, default_text_posn + upcea_height_adj,
textflags | SMALL_TEXT, image_width, image_height, si);
textpos = (27 + xoffset) * si;
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height,
si);
textpos = (67 + xoffset) * si;
draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height,
si);
textpos = (95 + 5 + upcea_width_adj + xoffset) * si;
draw_string(pixelbuf, textpart4, textpos, default_text_posn + upcea_height_adj, textflags | SMALL_TEXT, image_width, image_height, si);
draw_string(pixelbuf, textpart4, textpos, default_text_posn + upcea_height_adj,
textflags | SMALL_TEXT, image_width, image_height, si);
textdone = 1;
switch (ustrlen(addon)) {
case 2:
textpos = (105 + xoffset + addon_gap) * si;
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height,
si);
break;
case 5:
textpos = (119 + xoffset + addon_gap) * si;
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height,
si);
break;
}
} else if (upceanflag == 13) { /* EAN-13 */
textpos = (-(5 + ean_width_adj) + xoffset) * si;
draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, textpart1, textpos, default_text_posn, textflags, image_width, image_height,
si);
textpos = (24 + xoffset) * si;
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, textpart2, textpos, default_text_posn, textflags, image_width, image_height,
si);
textpos = (71 + xoffset) * si;
draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, textpart3, textpos, default_text_posn, textflags, image_width, image_height,
si);
textdone = 1;
switch (ustrlen(addon)) {
case 2:
textpos = (105 + xoffset + addon_gap) * si;
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height,
si);
break;
case 5:
textpos = (119 + xoffset + addon_gap) * si;
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, addon, textpos, addon_text_posn, textflags, image_width, image_height,
si);
break;
}
}
}
if (!textdone) {
unsigned char local_text[sizeof(symbol->text)] = {0}; /* Suppress clang-analyzer-core.CallAndMessage warning */
/* Suppress clang-analyzer-core.CallAndMessage warning */
unsigned char local_text[sizeof(symbol->text)] = {0};
to_iso8859_1(symbol->text, local_text);
/* Put the human readable text at the bottom */
textpos = (main_width / 2 + xoffset) * si;
draw_string(pixelbuf, local_text, textpos, default_text_posn, textflags, image_width, image_height, si);
draw_string(pixelbuf, local_text, textpos, default_text_posn, textflags, image_width, image_height,
si);
}
}
@ -1247,14 +1306,16 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
for (r = 1; r < symbol->rows; r++) {
row_height = symbol->row_height[r - 1] ? symbol->row_height[r - 1] : large_bar_height;
draw_bar(pixelbuf, xoffset * si, symbol->width * si,
((r * row_height) + textoffset + yoffset - sep_height / 2) * si, sep_height * si, image_width, image_height, DEFAULT_INK);
((r * row_height) + textoffset + yoffset - sep_height / 2) * si, sep_height * si,
image_width, image_height, DEFAULT_INK);
}
} else {
for (r = 1; r < symbol->rows; r++) {
/* Avoid 11-module start and 13-module stop chars */
row_height = symbol->row_height[r - 1] ? symbol->row_height[r - 1] : large_bar_height;
draw_bar(pixelbuf, (xoffset + 11) * si, (symbol->width - 24) * si,
((r * row_height) + textoffset + yoffset - sep_height / 2) * si, sep_height * si, image_width, image_height, DEFAULT_INK);
((r * row_height) + textoffset + yoffset - sep_height / 2) * si, sep_height * si,
image_width, image_height, DEFAULT_INK);
}
}
}
@ -1282,13 +1343,15 @@ static int plot_raster_default(struct zint_symbol *symbol, const int rotate_angl
}
}
error_number = save_raster_image_to_file(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle, file_type);
error_number = save_raster_image_to_file(symbol, scale_height, scale_width, scaled_pixelbuf, rotate_angle,
file_type);
if (rotate_angle || file_type != OUT_BUFFER || !(symbol->output_options & OUT_BUFFER_INTERMEDIATE)) {
free(scaled_pixelbuf);
}
free(pixelbuf);
} else {
error_number = save_raster_image_to_file(symbol, image_height, image_width, pixelbuf, rotate_angle, file_type);
error_number = save_raster_image_to_file(symbol, image_height, image_width, pixelbuf, rotate_angle,
file_type);
if (rotate_angle || file_type != OUT_BUFFER || !(symbol->output_options & OUT_BUFFER_INTERMEDIATE)) {
free(pixelbuf);
}