mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-14 23:24:39 -04:00
Change height and row_height array to floats; DAFT tracker ratio
This commit is contained in:
parent
22a6c583af
commit
c693482aa1
63 changed files with 2708 additions and 1418 deletions
244
backend/output.c
244
backend/output.c
|
@ -30,8 +30,10 @@
|
|||
*/
|
||||
/* vim: set ts=4 sw=4 et : */
|
||||
|
||||
#include <math.h>
|
||||
#include "common.h"
|
||||
#include "output.h"
|
||||
#include "font.h"
|
||||
|
||||
#define SSET "0123456789ABCDEF"
|
||||
|
||||
|
@ -67,36 +69,34 @@ INTERNAL int output_check_colour_options(struct zint_symbol *symbol) {
|
|||
}
|
||||
|
||||
/* Return minimum quiet zones for each symbology */
|
||||
static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *top, int *bottom) {
|
||||
static int quiet_zones(struct zint_symbol *symbol, float *left, float *right, float *top, float *bottom) {
|
||||
int done = 0;
|
||||
|
||||
*left = *right = *top = *bottom = 0;
|
||||
*left = *right = *top = *bottom = 0.0f;
|
||||
|
||||
/* These always have quiet zones set (previously used whitespace_width) */
|
||||
switch (symbol->symbology) {
|
||||
case BARCODE_CODE16K:
|
||||
/* BS EN 12323:2005 Section 4.5 (c) */
|
||||
*left = 10;
|
||||
*right = 1;
|
||||
*left = 10.0f;
|
||||
*right = 1.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_CODE49:
|
||||
/* ANSI/AIM BC6-2000 Section 2.4 */
|
||||
*left = 10;
|
||||
*right = 1;
|
||||
*left = 10.0f;
|
||||
*right = 1.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_CODABLOCKF:
|
||||
case BARCODE_HIBC_BLOCKF:
|
||||
/* AIM ISS-X-24 Section 4.6.1 */
|
||||
*left = 10;
|
||||
*right = 10;
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_ITF14:
|
||||
/* GS1 General Specifications 21.0.1 Section 5.3.2.2 */
|
||||
*left = 10;
|
||||
*right = 10;
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_EANX:
|
||||
|
@ -106,22 +106,21 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
/* GS1 General Specifications 21.0.1 Section 5.2.3.4 */
|
||||
switch (ustrlen(symbol->text)) {
|
||||
case 13: /* EAN-13 */
|
||||
*left = 11;
|
||||
*right = 7;
|
||||
*left = 11.0f;
|
||||
*right = 7.0f;
|
||||
break;
|
||||
case 16: /* EAN-13/ISBN + 2 digit addon */
|
||||
case 19: /* EAN-13/ISBN + 5 digit addon */
|
||||
*left = 11;
|
||||
*right = 5;
|
||||
*left = 11.0f;
|
||||
*right = 5.0f;
|
||||
break;
|
||||
case 5: /* EAN-5 addon */
|
||||
case 2: /* EAN-2 addon */
|
||||
*left = 7;
|
||||
*right = 5;
|
||||
*left = 7.0f;
|
||||
*right = 5.0f;
|
||||
break;
|
||||
default: /* EAN-8 (+/- 2/5 digit addon) */
|
||||
*left = 7;
|
||||
*right = 7;
|
||||
*left = *right = 7.0f;
|
||||
break;
|
||||
}
|
||||
done = 1;
|
||||
|
@ -130,11 +129,11 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
case BARCODE_UPCA_CHK:
|
||||
case BARCODE_UPCA_CC:
|
||||
/* GS1 General Specifications 21.0.1 Section 5.2.3.4 */
|
||||
*left = 9;
|
||||
*left = 9.0f;
|
||||
if (ustrlen(symbol->text) > 12) { /* UPC-A + addon */
|
||||
*right = 5;
|
||||
*right = 5.0f;
|
||||
} else {
|
||||
*right = 9;
|
||||
*right = 9.0f;
|
||||
}
|
||||
done = 1;
|
||||
break;
|
||||
|
@ -142,11 +141,11 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
case BARCODE_UPCE_CHK:
|
||||
case BARCODE_UPCE_CC:
|
||||
/* GS1 General Specifications 21.0.1 Section 5.2.3.4 */
|
||||
*left = 9;
|
||||
*left = 9.0f;
|
||||
if (ustrlen(symbol->text) > 8) { /* UPC-E + addon */
|
||||
*right = 5;
|
||||
*right = 5.0f;
|
||||
} else {
|
||||
*right = 7;
|
||||
*right = 7.0f;
|
||||
}
|
||||
done = 1;
|
||||
break;
|
||||
|
@ -167,15 +166,22 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
|
||||
switch (symbol->symbology) {
|
||||
case BARCODE_CODE11:
|
||||
/* TODO */
|
||||
/* No known standard. Following ITF-14, set to 10X */
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_C25STANDARD:
|
||||
case BARCODE_C25INTER:
|
||||
/* ISO/IEC 16390:2007 Section 4.4 10X */
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_C25STANDARD:
|
||||
case BARCODE_C25IATA:
|
||||
case BARCODE_C25LOGIC:
|
||||
case BARCODE_C25IND:
|
||||
*left = *right = 10; // Probably this TODO: check
|
||||
/* No known standards. Following C25INTER, set to 10X */
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
|
@ -187,19 +193,19 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
case BARCODE_HIBC_39:
|
||||
case BARCODE_CODE32:
|
||||
/* ISO/IEC 16388:2007 Section 4.4 (d) */
|
||||
*left = *right = 10;
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_GS1_128: /* GS1-128 */
|
||||
case BARCODE_GS1_128_CC:
|
||||
case BARCODE_EAN14:
|
||||
/* GS1 General Specifications 21.0.1 Section 5.4.4.2 */
|
||||
*left = *right = 10;
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_CODABAR:
|
||||
/* BS EN 798:1995 Section 4.4.1 (d) */
|
||||
*left = *right = 10;
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_CODE128:
|
||||
|
@ -207,17 +213,20 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
case BARCODE_HIBC_128:
|
||||
case BARCODE_NVE18:
|
||||
/* ISO/IEC 15417:2007 4.4.2 */
|
||||
*left = *right = 10;
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_DPLEIT:
|
||||
case BARCODE_DPIDENT:
|
||||
/* Using CODE39 values TODO: Find doc */
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_DPLEIT:
|
||||
case BARCODE_DPIDENT:
|
||||
/* TODO */
|
||||
break;
|
||||
|
||||
case BARCODE_CODE93:
|
||||
/* TODO */
|
||||
/* ANSI/AIM BC5-1995 Section 2.4 */
|
||||
*left = *right = 10.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_FLAT:
|
||||
|
@ -231,7 +240,6 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
case BARCODE_DBAR_OMNSTK: /* GS1 DataBar Stacked Omnidirectional */
|
||||
case BARCODE_DBAR_EXPSTK: /* GS1 Databar Expanded Stacked */
|
||||
/* GS1 General Specifications 21.0.1 Section 5.5.1.1 - Quiet Zones: None required */
|
||||
*left = *right = 0;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_DBAR_OMN_CC:
|
||||
|
@ -241,7 +249,7 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
case BARCODE_DBAR_OMNSTK_CC:
|
||||
case BARCODE_DBAR_EXPSTK_CC:
|
||||
/* GS1 General Specifications 21.0.1 Sections 5.11.2.1 (CC-A) & 5.11.2.2 (CC-B) */
|
||||
*left = *right = 1;
|
||||
*left = *right = 1.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
|
@ -252,9 +260,10 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
|
||||
case BARCODE_POSTNET:
|
||||
case BARCODE_PLANET:
|
||||
/* Archived DMM C840 (Dec 09, 2004) left/right 0.125" ~ 6X, top/bottom 0.04" ~ 2X */
|
||||
*left = *right = 6; // TODO: Proper inch to X calc
|
||||
*top = *bottom = 2; // TODO: Proper inch to X calc
|
||||
/* USPS DMM 300 2006 (2011) 5.7 Barcode in Address Block
|
||||
left/right 0.125" / 0.025" (X max) = 5, top/bottom 0.04" / 0.025" (X max) = 1.6 */
|
||||
*left = *right = 5.0f;
|
||||
*top = *bottom = 1.6f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
|
@ -263,72 +272,85 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
break;
|
||||
|
||||
case BARCODE_FIM:
|
||||
/* TODO */
|
||||
/* USPS DMM 300 2006 (2011) 708.9.3 (top/bottom zero)
|
||||
right 0.125" (min) / 0.03925" (X max) ~ 3.18, left 1.25" - 0.66725" (max width of barcode)
|
||||
- 0.375 (max right) = 0.20775" / 0.03925" (X max) ~ 5.29 */
|
||||
*right = (float) (0.125 / 0.03925);
|
||||
*left = (float) (0.20775 / 0.03925);
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_PHARMA:
|
||||
case BARCODE_PHARMA_TWO:
|
||||
/* TODO */
|
||||
/* Laetus Pharmacode Guide 2.2 from 6mm depending on context, 6mm / 1mm (Pharma Two X) = 6 */
|
||||
*left = *right = 6.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_PDF417:
|
||||
case BARCODE_PDF417COMP:
|
||||
case BARCODE_HIBC_PDF:
|
||||
/* ISO/IEC 15438:2015 Section 5.8.3 */
|
||||
*left = *right = *top = *bottom = 2;
|
||||
*left = *right = *top = *bottom = 2.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_MICROPDF417:
|
||||
case BARCODE_HIBC_MICPDF:
|
||||
/* ISO/IEC 24728:2006 Section 5.8.3 */
|
||||
*left = *right = *top = *bottom = 1;
|
||||
*left = *right = *top = *bottom = 1.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_MAXICODE:
|
||||
/* ISO/IEC 16023:2000 Section 4.11.5 */
|
||||
*left = *right = *top = *bottom = 1;
|
||||
*left = *right = *top = *bottom = 1.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_QRCODE:
|
||||
case BARCODE_UPNQR:
|
||||
case BARCODE_HIBC_QR:
|
||||
/* ISO/IEC 18004:2015 Section 9.1 */
|
||||
*left = *right = *top = *bottom = 4;
|
||||
*left = *right = *top = *bottom = 4.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_DPD:
|
||||
/* Specification DPD and primetime Parcel Despatch 4.0.2 Section 5.5.1 5mm / 0.4mm (X max) = 12.5 */
|
||||
*left = *right = 12.5f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_MICROQR:
|
||||
/* ISO/IEC 18004:2015 Section 9.1 */
|
||||
*left = *right = *top = *bottom = 2;
|
||||
*left = *right = *top = *bottom = 2.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_RMQR:
|
||||
/* ISO/IEC JTC1/SC31N000 Section 6.3.10 */
|
||||
*left = *right = *top = *bottom = 2;
|
||||
*left = *right = *top = *bottom = 2.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_AUSPOST:
|
||||
case BARCODE_AUSREPLY:
|
||||
case BARCODE_AUSROUTE:
|
||||
case BARCODE_AUSREDIRECT:
|
||||
/* Customer Barcode Technical Specifications (2012) left/right 6mm ~ 6X, top/bottom 2mm ~ 2X */
|
||||
*left = *right = 6; // TODO: Proper mm to X calc
|
||||
*top = *bottom = 2; // TODO: Proper mm to X calc
|
||||
/* Customer Barcode Technical Specifications (2012) left/right 6mm / 0.6mm = 10,
|
||||
top/bottom 2mm / 0.6mm ~ 3.33 (X max) */
|
||||
*left = *right = 10.0f;
|
||||
*top = *bottom = (float) (2.0 / 0.6);
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_RM4SCC:
|
||||
/* TODO */
|
||||
/* Royal Mail Know How User's Manual Appendix C: using CBC, same as MAILMARK, 2mm all round,
|
||||
use X max (25.4mm / 39) i.e. 20 bars per 25.4mm */
|
||||
*left = *right = *top = *bottom = (float) ((2.0 * 39.0) / 25.4); /* ~ 3.07 */
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_DATAMATRIX:
|
||||
case BARCODE_HIBC_DM:
|
||||
/* ISO/IEC 16022:2006 Section 7.1 */
|
||||
*left = *right = *top = *bottom = 1;
|
||||
*left = *right = *top = *bottom = 1.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_JAPANPOST:
|
||||
/* TODO */
|
||||
/* Japan Post Zip/Barcode Manual p.13 2mm all round, X 0.6mm, 2mm / 0.6mm ~ 3.33 */
|
||||
*left = *right = *top = *bottom = (float) (2.0 / 0.6);
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_KOREAPOST:
|
||||
|
@ -336,9 +358,10 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
break;
|
||||
|
||||
case BARCODE_USPS_IMAIL:
|
||||
/* USPS-B-3200 (2015) Section 2.3.2 left/right 0.125" ~ 6X, top/bottom 0.026" ~ 1X */
|
||||
*left = *right = 6; // TODO: Proper inch to X calc
|
||||
*top = *bottom = 1; // TODO: Proper inch to X calc
|
||||
/* USPS-B-3200 (2015) Section 2.3.2 left/right 0.125", top/bottom 0.026", use X max (1 / 39)
|
||||
i.e. 20 bars per inch */
|
||||
*left = *right = 0.125f * 39.0f; /* 4.875 */
|
||||
*top = *bottom = 0.026f * 39.0f; /* 1.014 */
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
|
@ -347,8 +370,8 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
break;
|
||||
|
||||
case BARCODE_KIX:
|
||||
/* Handleiding KIX code brochure left/right/top/bottom 2mm ~ 2X */
|
||||
*left = *right = *top = *bottom = 2; // TODO: Proper mm to X calc
|
||||
/* Handleiding KIX code brochure - same as RM4SCC/MAILMARK */
|
||||
*left = *right = *top = *bottom = (float) ((2.0 * 39.0) / 25.4); /* ~ 3.07 */
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_AZTEC:
|
||||
|
@ -357,32 +380,30 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
/* ISO/IEC 24778:2008 Section 4.1 (c) & Annex A.1 (Rune) - no quiet zone required */
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_DAFT:
|
||||
/* TODO */
|
||||
/* Generic so unlikely to be defined */
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_DOTCODE:
|
||||
/* ISS DotCode Rev. 4.0 Section 4.1 (3) (c) */
|
||||
*left = *right = *top = *bottom = 3;
|
||||
*left = *right = *top = *bottom = 3.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_HANXIN:
|
||||
/* ISO/IEC DIS 20830:2019 Section 4.2.8 (also Section 6.2) */
|
||||
*left = *right = *top = *bottom = 3;
|
||||
*left = *right = *top = *bottom = 3.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_MAILMARK:
|
||||
/* User Guide left/right/top/bottom 2mm ~ 2X */
|
||||
*left = *right = *top = *bottom = 2; // TODO: Proper mm to X calc
|
||||
/* Royal Mail Mailmark Barcode Definition Document Section 3.5.2, 2mm all round, use X max (25.4mm / 39)
|
||||
i.e. 20 bars per 25.4mm */
|
||||
*left = *right = *top = *bottom = (float) ((2.0 * 39.0) / 25.4); /* ~ 3.07 */
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
case BARCODE_CHANNEL:
|
||||
/* ANSI/AIM BC12-1998 Section 4.4 (c) */
|
||||
*left = 1;
|
||||
*right = 2;
|
||||
*left = 1.0f;
|
||||
*right = 2.0f;
|
||||
done = 1;
|
||||
break;
|
||||
|
||||
|
@ -392,12 +413,12 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
|
||||
case BARCODE_GRIDMATRIX:
|
||||
/* AIMD014 (v 1.63) Section 7.1 */
|
||||
*left = *right = *top = *bottom = 6;
|
||||
*left = *right = *top = *bottom = 6.0f;
|
||||
done = 1;
|
||||
break;
|
||||
case BARCODE_ULTRA:
|
||||
/* AIMD/TSC15032-43 (v 0.99c) Section 9.2 */
|
||||
*left = *right = *top = *bottom = 1;
|
||||
*left = *right = *top = *bottom = 1.0f;
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -406,8 +427,9 @@ static int quiet_zones(struct zint_symbol *symbol, int *left, int *right, int *t
|
|||
}
|
||||
|
||||
/* Set left (x), top (y), right and bottom offsets for whitespace */
|
||||
INTERNAL void output_set_whitespace_offsets(struct zint_symbol *symbol, int *xoffset, int *yoffset, int *roffset, int *boffset) {
|
||||
int qz_left, qz_right, qz_top, qz_bottom;
|
||||
INTERNAL void output_set_whitespace_offsets(struct zint_symbol *symbol, float *xoffset, float *yoffset,
|
||||
float *roffset, float *boffset) {
|
||||
float qz_left, qz_right, qz_top, qz_bottom;
|
||||
|
||||
quiet_zones(symbol, &qz_left, &qz_right, &qz_top, &qz_bottom);
|
||||
|
||||
|
@ -426,8 +448,10 @@ INTERNAL void output_set_whitespace_offsets(struct zint_symbol *symbol, int *xof
|
|||
}
|
||||
}
|
||||
|
||||
/* Set composite offset and main width excluding addon (for start of addon calc) and addon text, returning UPC/EAN type */
|
||||
INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width, int *p_comp_offset, unsigned char addon[6], int *p_addon_gap) {
|
||||
/* Set composite offset and main width excluding addon (for start of addon calc) and addon text, returning
|
||||
UPC/EAN type */
|
||||
INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width, int *p_comp_offset,
|
||||
unsigned char addon[6], int *p_addon_gap) {
|
||||
int main_width; /* Width of main linear symbol, excluding addon */
|
||||
int comp_offset; /* Whitespace offset (if any) of main linear symbol due to having composite */
|
||||
int upceanflag; /* UPC/EAN type flag */
|
||||
|
@ -447,7 +471,8 @@ INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width
|
|||
}
|
||||
addon[j] = '\0';
|
||||
if (latch) {
|
||||
if (symbol->symbology == BARCODE_UPCA || symbol->symbology == BARCODE_UPCA_CHK || symbol->symbology == BARCODE_UPCA_CC) {
|
||||
if (symbol->symbology == BARCODE_UPCA || symbol->symbology == BARCODE_UPCA_CHK
|
||||
|| symbol->symbology == BARCODE_UPCA_CC) {
|
||||
*p_addon_gap = symbol->option_2 >= 9 && symbol->option_2 <= 12 ? symbol->option_2 : 9;
|
||||
} else {
|
||||
*p_addon_gap = symbol->option_2 >= 7 && symbol->option_2 <= 12 ? symbol->option_2 : 7;
|
||||
|
@ -502,24 +527,50 @@ INTERNAL int output_process_upcean(struct zint_symbol *symbol, int *p_main_width
|
|||
return upceanflag;
|
||||
}
|
||||
|
||||
/* Calculate large bar height i.e. linear bars */
|
||||
INTERNAL float output_large_bar_height(struct zint_symbol *symbol) {
|
||||
int i, large_bar_count, preset_height;
|
||||
/* Calculate large bar height i.e. linear bars with zero row height that respond to the symbol height.
|
||||
If scaler `si` non-zero (raster), then large_bar_height if non-zero or else row heights will be rounded to nearest
|
||||
pixel and symbol height adjusted */
|
||||
INTERNAL float output_large_bar_height(struct zint_symbol *symbol, int si) {
|
||||
float fixed_height = 0.0f;
|
||||
int zero_count = 0;
|
||||
int round_rows = 0;
|
||||
int i;
|
||||
float large_bar_height;
|
||||
|
||||
large_bar_count = 0;
|
||||
preset_height = 0;
|
||||
for (i = 0; i < symbol->rows; i++) {
|
||||
preset_height += symbol->row_height[i];
|
||||
if (symbol->row_height[i] == 0) {
|
||||
large_bar_count++;
|
||||
if (symbol->row_height[i]) {
|
||||
fixed_height += symbol->row_height[i];
|
||||
if (!round_rows && si && symbol->row_height[i] * si != (int) (symbol->row_height[i] * si)) {
|
||||
round_rows = 1;
|
||||
}
|
||||
} else {
|
||||
zero_count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (large_bar_count) {
|
||||
large_bar_height = (float) (symbol->height - preset_height) / large_bar_count;
|
||||
if (zero_count) {
|
||||
large_bar_height = (symbol->height - fixed_height) / zero_count;
|
||||
if (large_bar_height <= 0.0f) { /* Shouldn't happen but protect against memory access violations */
|
||||
large_bar_height = 0.01f; /* Token positive value */
|
||||
symbol->height = large_bar_height * zero_count + fixed_height;
|
||||
}
|
||||
if (si && large_bar_height * si != (int) (large_bar_height * si)) {
|
||||
large_bar_height = (float) (round(large_bar_height * si) / si);
|
||||
symbol->height = large_bar_height * zero_count + fixed_height;
|
||||
}
|
||||
/* Note should never happen that have both zero_count and round_rows */
|
||||
} else {
|
||||
large_bar_height = 0.0f; /* Not used if large_bar_count zero */
|
||||
large_bar_height = 0.0f; /* Not used if zero_count zero */
|
||||
if (round_rows) {
|
||||
fixed_height = 0.0f;
|
||||
for (i = 0; i < symbol->rows; i++) {
|
||||
if (symbol->row_height[i] * si != (int) (symbol->row_height[i] * si)) {
|
||||
symbol->row_height[i] = (float) (round(symbol->row_height[i] * si) / si);
|
||||
}
|
||||
fixed_height += symbol->row_height[i];
|
||||
}
|
||||
symbol->height = fixed_height;
|
||||
}
|
||||
}
|
||||
|
||||
return large_bar_height;
|
||||
|
@ -527,7 +578,8 @@ INTERNAL float output_large_bar_height(struct zint_symbol *symbol) {
|
|||
|
||||
/* Split UPC/EAN add-on text into various constituents */
|
||||
INTERNAL void output_upcean_split_text(int upceanflag, unsigned char text[],
|
||||
unsigned char textpart1[5], unsigned char textpart2[7], unsigned char textpart3[7], unsigned char textpart4[2]) {
|
||||
unsigned char textpart1[5], unsigned char textpart2[7], unsigned char textpart3[7],
|
||||
unsigned char textpart4[2]) {
|
||||
int i;
|
||||
|
||||
if (upceanflag == 6) { /* UPC-E */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue