general: use explicit float consts rather than calced ones

manual: remove extra tags from "manual.txt" and clean up table
  captions
This commit is contained in:
gitlost 2024-01-09 18:38:21 +00:00
parent f3a982c1dd
commit cf04ac15b0
21 changed files with 174 additions and 136 deletions

View file

@ -1,7 +1,7 @@
/* 2of5.c - Handles Code 2 of 5 barcodes */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -213,7 +213,7 @@ static int c25_inter_common(struct zint_symbol *symbol, unsigned char source[],
(P = character pairs, N = wide/narrow ratio = 3)
width = (P(4N + 6) + N + 6)X = (length / 2) * 18 + 9 */
/* Taking min X = 0.330mm from Annex D.3.1 (application specification) */
const float min_height_min = stripf(5.0f / 0.33f);
const float min_height_min = 15.151515f; /* 5.0 / 0.33 */
float min_height = stripf((18.0f * (length / 2) + 9.0f) * 0.15f);
if (min_height < min_height_min) {
min_height = min_height_min;
@ -276,7 +276,9 @@ INTERNAL int itf14(struct zint_symbol *symbol, unsigned char source[], int lengt
/* GS1 General Specifications 21.0.1 5.12.3.2 table 2, including footnote (**): (note bind/box additional
to symbol->height), same as GS1-128: "in case of further space constraints"
height 5.8mm / 1.016mm (X max) ~ 5.7; default 31.75mm / 0.495mm ~ 64.14 */
error_number = set_height(symbol, stripf(5.8f / 1.016f), stripf(31.75f / 0.495f), 0.0f, 0 /*no_errtxt*/);
const float min_height = 5.70866156f; /* 5.8 / 1.016 */
const float default_height = 64.1414108f; /* 31.75 / 0.495 */
error_number = set_height(symbol, min_height, default_height, 0.0f, 0 /*no_errtxt*/);
} else {
(void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/);
}

View file

@ -1,7 +1,7 @@
/* bc412.c - Handles IBM BC412 (SEMI T1-95) symbology */
/*
libzint - the open source barcode library
Copyright (C) 2022 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2022-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -134,11 +134,14 @@ INTERNAL int bc412(struct zint_symbol *symbol, unsigned char source[], int lengt
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* SEMI T1-95 Table 1 "Module" (Character) Height 2mm ± 0.025mm, using Module Spacing 0.12mm ± 0.025mm as
X-dimension */
error_number = set_height(symbol, stripf(1.975f / 0.145f), stripf(2.0f / 0.12f), stripf(2.025f / 0.095f),
0 /*no_errtxt*/);
const float min_height = 13.6206894f; /* 1.975 / 0.145 */
const float default_height = 16.666666f; /* 2.0 / 0.12 */
const float max_height = 21.3157902f; /* 2.025 / 0.095 */
error_number = set_height(symbol, min_height, default_height, max_height, 0 /*no_errtxt*/);
} else {
/* Using compliant height as default as no backwards compatibility to consider */
(void) set_height(symbol, 0.0f, stripf(2.0f / 0.12f), 0.0f, 1 /*no_errtxt*/);
const float default_height = 16.666666f; /* 2.0 / 0.12 */
(void) set_height(symbol, 0.0f, default_height, 0.0f, 1 /*no_errtxt*/);
}
return error_number;

View file

@ -1,7 +1,7 @@
/* code.c - Handles Code 11, 39, 39+, 93, PZN, Channel and VIN */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -327,8 +327,9 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng
/* MIL-STD-1189 Rev. B Section 5.2
Min height 0.25" / 0.04" (X max) = 6.25
Default height 0.625" (average of 0.375" - 0.875") / 0.01375" (average of 0.0075" - 0.02") ~ 45.45 */
error_number = set_height(symbol, 6.25f, stripf(0.625f / 0.01375f), stripf(0.875f / 0.0075f),
0 /*no_errtxt*/);
const float default_height = 45.4545441f; /* 0.625 / 0.01375 */
const float max_height = 116.666664f; /* 0.875 / 0.0075 */
error_number = set_height(symbol, 6.25f, default_height, max_height, 0 /*no_errtxt*/);
} else if (symbol->symbology == BARCODE_CODE39 || symbol->symbology == BARCODE_EXCODE39
|| symbol->symbology == BARCODE_HIBC_39) {
/* ISO/IEC 16388:2007 4.4 (e) recommended min height 5.0mm or 15% of width excluding quiet zones;
@ -429,7 +430,9 @@ INTERNAL int pzn(struct zint_symbol *symbol, unsigned char source[], int length)
"normal" X 0.25mm (0.187mm - 0.45mm), height 8mm - 20mm for 0.25mm X, 10mm mentioned so use that
as default, 10mm / 0.25mm = 40 */
if (error_number < ZINT_ERROR) {
error_number = set_height(symbol, stripf(8.0f / 0.45f), 40.0f, stripf(20.0f / 0.187f), 0 /*no_errtxt*/);
const float min_height = 17.7777786f; /* 8.0 / 0.45 */
const float max_height = 106.951874f; /* 20.0 / 0.187 */
error_number = set_height(symbol, min_height, 40.0f, max_height, 0 /*no_errtxt*/);
}
} else {
if (error_number < ZINT_ERROR) {
@ -588,7 +591,7 @@ INTERNAL int code93(struct zint_symbol *symbol, unsigned char source[], int leng
/* ANSI/AIM BC5-1995 Section 2.6 minimum height 0.2" or 15% of symbol length, whichever is greater
no max X given so for min height use symbol length = (9 * (C + 4) + 1) * X + 2 * Q = symbol->width + 20;
use 40 as default height based on figures in spec */
float min_height = stripf((symbol->width + 20) * 0.15f);
const float min_height = stripf((symbol->width + 20) * 0.15f);
error_number = set_height(symbol, min_height, min_height > 40.0f ? min_height : 40.0f, 0.0f, 0 /*no_errtxt*/);
} else {
(void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/);

View file

@ -1,7 +1,7 @@
/* code128.c - Handles Code 128 and derivatives */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Bugfixes thanks to Christian Sakowski and BogDan Vatra
Redistribution and use in source and binary forms, with or without
@ -989,8 +989,8 @@ INTERNAL int gs1_128_cc(struct zint_symbol *symbol, unsigned char source[], int
/* GS1 General Specifications 21.0.1 5.12.3.2 table 2, including footnote (**):
same as ITF-14: "in case of further space constraints" height 5.8mm / 1.016mm (X max) ~ 5.7;
default 31.75mm / 0.495mm ~ 64.14 */
const float min_height = stripf(5.8f / 1.016f);
const float default_height = stripf(31.75f / 0.495f);
const float min_height = 5.70866156f; /* 5.8 / 1.016 */
const float default_height = 64.1414108f; /* 31.75 / 0.495 */
if (symbol->symbology == BARCODE_GS1_128_CC) {
/* Pass back via temporary linear structure */
symbol->height = symbol->height ? min_height : default_height;
@ -1153,9 +1153,11 @@ INTERNAL int dpd(struct zint_symbol *symbol, unsigned char source[], int length)
/* DPD Parcel Label Specification Version 2.4.1 (19.01.2021) Section 4.6.1.2
25mm / 0.4mm (X max) = 62.5 min, 25mm / 0.375 (X) ~ 66.66 default */
if (relabel) { /* If relabel then half-size */
error_number = set_height(symbol, 31.25f, stripf(12.5f / 0.375f), 0.0f, 0 /*no_errtxt*/);
const float default_height = 33.3333321f; /* 12.5 / 0.375 */
error_number = set_height(symbol, 31.25f, default_height, 0.0f, 0 /*no_errtxt*/);
} else {
error_number = set_height(symbol, 62.5f, stripf(25.0f / 0.375f), 0.0f, 0 /*no_errtxt*/);
const float default_height = 66.6666641f; /* 25.0 / 0.375 */
error_number = set_height(symbol, 62.5f, default_height, 0.0f, 0 /*no_errtxt*/);
}
} else {
(void) set_height(symbol, 0.0f, relabel ? 25.0f : 50.0f, 0.0f, 1 /*no_errtxt*/);
@ -1299,7 +1301,7 @@ INTERNAL int upu_s10(struct zint_symbol *symbol, unsigned char source[], int len
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* Universal Postal Union S10 Section 8, using max X 0.51mm & minimum height 12.5mm or 15% of width */
const float min_height_min = stripf(12.5f / 0.51f);
const float min_height_min = 24.5098038f; /* 12.5 / 0.51 */
float min_height = stripf(symbol->width * 0.15f);
if (min_height < min_height_min) {
min_height = min_height_min;

View file

@ -1,7 +1,7 @@
/* emf.c - Support for Microsoft Enhanced Metafile Format */
/*
libzint - the open source barcode library
Copyright (C) 2016-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2016-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -43,7 +43,7 @@
#include "emf.h"
/* Multiply truncating to 3 decimal places (avoids rounding differences on various platforms) */
#define mul3dpf(m, arg) stripf(roundf((m) * (arg) * 1000.0f) / 1000.0f)
#define emf_mul3dpf(m, arg) stripf(roundf((m) * (arg) * 1000.0f) / 1000.0f)
static int emf_count_rectangles(const struct zint_symbol *symbol) {
int rectangles = 0;
@ -479,7 +479,7 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) {
causes various different rendering issues for LibreOffice Draw and Inkscape, so using following hack */
if (previous_diameter != circ->diameter + circ->width) { /* Drawing MaxiCode bullseye using overlayed discs */
previous_diameter = circ->diameter + circ->width;
radius = mul3dpf(0.5f, previous_diameter);
radius = emf_mul3dpf(0.5f, previous_diameter);
}
circle[this_circle].type = 0x0000002a; /* EMR_ELLIPSE */
circle[this_circle].size = 24;
@ -518,9 +518,9 @@ INTERNAL int emf_plot(struct zint_symbol *symbol, int rotate_angle) {
if (previous_diameter != hex->diameter) {
previous_diameter = hex->diameter;
radius = mul3dpf(0.5f, previous_diameter);
half_radius = mul3dpf(0.25f, previous_diameter);
half_sqrt3_radius = mul3dpf(0.43301270189221932338f, previous_diameter);
radius = emf_mul3dpf(0.5f, previous_diameter);
half_radius = emf_mul3dpf(0.25f, previous_diameter);
half_sqrt3_radius = emf_mul3dpf(0.43301270189221932338f, previous_diameter);
}
/* Note rotation done via world transform */

View file

@ -1,7 +1,7 @@
/* imail.c - Handles Intelligent Mail (aka OneCode) for USPS */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -437,10 +437,12 @@ INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int
Tracker 0.048" (average of 0.039" - 0.057")
Ascender/descender 0.0965" (average of 0.082" - 0.111") less T = 0.0485"
*/
symbol->row_height[0] = stripf(0.0485f * 43); /* 2.0855 */
symbol->row_height[1] = stripf(0.048f * 43); /* 2.064 */
const float min_height = 4.875f; /* 0.125 * 39 */
const float max_height = 7.75500011f; /* 0.165 * 47 */
symbol->row_height[0] = 2.0855f; /* 0.0485 * 43 */
symbol->row_height[1] = 2.06399989f; /* 0.048 * 43 */
/* Note using max X for minimum and min X for maximum */
error_number = daft_set_height(symbol, stripf(0.125f * 39) /*4.875*/, stripf(0.165f * 47) /*7.755*/);
error_number = daft_set_height(symbol, min_height, max_height);
} else {
symbol->row_height[0] = 3.0f;
symbol->row_height[1] = 2.0f;

View file

@ -1,7 +1,7 @@
/* library.c - external functions of libzint */
/*
libzint - the open source barcode library
Copyright (C) 2009-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -68,7 +68,7 @@ static void set_symbol_defaults(struct zint_symbol *symbol) {
symbol->show_hrt = 1; /* Show human readable text */
symbol->input_mode = DATA_MODE;
symbol->eci = 0; /* Default 0 uses ECI 3 */
symbol->dot_size = 4.0f / 5.0f;
symbol->dot_size = 0.8f; /* 0.4 / 0.5 */
symbol->text_gap = 1.0f;
symbol->guard_descent = 5.0f;
symbol->warn_level = WARN_DEFAULT;

View file

@ -1,7 +1,7 @@
/* mailmark.c - Royal Mail 4-state and 2D Mailmark barcodes */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -497,10 +497,12 @@ INTERNAL int mailmark_4s(struct zint_symbol *symbol, unsigned char source[], int
Using recommended 1.9mm and 1.3mm heights for Ascender/Descenders and Trackers resp. as defaults
Min height 4.22mm * 39 (max pitch) / 25.4mm ~ 6.47, max height 5.84mm * 47 (min pitch) / 25.4mm ~ 10.8
*/
symbol->row_height[0] = stripf((1.9f * 42.3f) / 25.4f); /* ~3.16 */
symbol->row_height[1] = stripf((1.3f * 42.3f) / 25.4f); /* ~2.16 */
const float min_height = 6.47952747f; /* (4.22 * 39) / 25.4 */
const float max_height = 10.8062992f; /* (5.84 * 47) / 25.4 */
symbol->row_height[0] = 3.16417313f; /* (1.9 * 42.3) / 25.4 */
symbol->row_height[1] = 2.16496062f; /* (1.3 * 42.3) / 25.4 */
/* Note using max X for minimum and min X for maximum */
error_number = daft_set_height(symbol, stripf((4.22f * 39) / 25.4f), stripf((5.84f * 47) / 25.4f));
error_number = daft_set_height(symbol, min_height, max_height);
} else {
symbol->row_height[0] = 4.0f;
symbol->row_height[1] = 2.0f;

View file

@ -1,7 +1,7 @@
/* medical.c - Handles 1 track and 2 track pharmacode and Codabar */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -275,7 +275,7 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len
narrow/wide ratio as 2 and I = X) width = ((2 * N + 5) * C + (N 1) * (D + 2)) * X + I * (C 1) + 2Q
= ((4 + 5) * C + (D + 2) + C - 1 + 2 * 10) * X = (10 * C + D + 21) * X
Length (C) includes start/stop chars */
const float min_height_min = stripf(5.0f / 0.43f);
const float min_height_min = 11.6279068f; /* 5.0 / 0.43 */
float min_height = stripf((10.0f * ((add_checksum ? length + 1 : length) + 2.0f) + d_chars + 21.0f) * 0.15f);
if (min_height < min_height_min) {
min_height = min_height_min;

View file

@ -1,7 +1,7 @@
/* output.c - Common routines for raster/vector
libzint - the open source barcode library
Copyright (C) 2020-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2020-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -504,8 +504,8 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
/* 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);
*right = 3.18471336f; /* 0.125 / 0.03925 */
*left = 5.29299355f; /* 0.20775 / 0.03925 */
done = 1;
break;
case BARCODE_PHARMA:
@ -561,13 +561,13 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
/* 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);
*top = *bottom = 3.33333325f; /* 2.0 / 0.6 */
done = 1;
break;
case BARCODE_RM4SCC:
/* Royal Mail Know How User's Manual Appendix C: using CBC, same as MAILMARK_4S, 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 */
*left = *right = *top = *bottom = 3.07086611f; /* (2.0 * 39.0) / 25.4 */
done = 1;
break;
case BARCODE_DATAMATRIX:
@ -578,7 +578,7 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
break;
case BARCODE_JAPANPOST:
/* 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);
*left = *right = *top = *bottom = 3.33333325f; /* 2.0 / 0.6 */
done = 1;
break;
@ -591,8 +591,8 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
case BARCODE_USPS_IMAIL:
/* 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 */
*left = *right = 4.875f; /* 0.125 * 39.0 */
*top = *bottom = 1.01400006f; /* 0.026 * 39.0 */
done = 1;
break;
@ -604,7 +604,7 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
case BARCODE_KIX:
/* Handleiding KIX code brochure - same as RM4SCC/MAILMARK_4S */
*left = *right = *top = *bottom = (float) ((2.0 * 39.0) / 25.4); /* ~ 3.07 */
*left = *right = *top = *bottom = 3.07086611f; /* (2.0 * 39.0) / 25.4 */
done = 1;
break;
case BARCODE_AZTEC:
@ -630,7 +630,7 @@ static int out_quiet_zones(const struct zint_symbol *symbol, const int hide_text
case BARCODE_MAILMARK_4S:
/* 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 */
*left = *right = *top = *bottom = 3.07086611f; /* (2.0 * 39.0) / 25.4 */
done = 1;
break;
case BARCODE_UPU_S10:

View file

@ -99,18 +99,18 @@ static int usps_set_height(struct zint_symbol *symbol, const int no_errtxt) {
*/
/* CEPNet e Código Bidimensional Datamatrix 2D (26/05/2021) 3.3.2 Arquitetura das barras - same as POSTNET */
int error_number = 0;
float h_ratio; /* Half ratio */
/* No legacy for CEPNet as new */
if ((symbol->output_options & COMPLIANT_HEIGHT) || symbol->symbology == BARCODE_CEPNET) {
symbol->row_height[0] = stripf(0.075f * 43); /* 3.225 */
symbol->row_height[1] = stripf(0.05f * 43); /* 2.15 */
symbol->row_height[0] = 3.2249999f; /* 0.075 * 43 */
symbol->row_height[1] = 2.1500001f; /* 0.05 * 43 */
} else {
symbol->row_height[0] = 6.0f;
symbol->row_height[1] = 6.0f;
}
if (symbol->height) {
h_ratio = symbol->row_height[1] / (symbol->row_height[0] + symbol->row_height[1]); /* 0.4 */
/* Half ratio */
const float h_ratio = symbol->row_height[1] / (symbol->row_height[0] + symbol->row_height[1]); /* 0.4 */
symbol->row_height[1] = stripf(symbol->height * h_ratio);
if (symbol->row_height[1] < 0.5f) { /* Absolute minimum */
symbol->row_height[1] = 0.5f;
@ -369,8 +369,10 @@ INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length)
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* USPS Domestic Mail Manual (USPS DMM 300) Jan 8, 2006 (updated 2011) 708.9.3
X 0.03125" (1/32) +- 0.008" so X max 0.03925", height 0.625" (5/8) +- 0.125" (1/8) */
error_number = set_height(symbol, stripf(0.5f / 0.03925f), 20.0f /*0.625 / 0.03125*/,
stripf(0.75f / 0.02415f), 0 /*no_errtxt*/);
const float min_height = 12.7388535f; /* 0.5 / 0.03925 */
const float default_height = 20.0f; /* 0.625 / 0.03125 */
const float max_height = 31.0559006f; /* 0.75 / 0.02415 */
error_number = set_height(symbol, min_height, default_height, max_height, 0 /*no_errtxt*/);
} else {
(void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/);
}
@ -382,10 +384,11 @@ INTERNAL int fim(struct zint_symbol *symbol, unsigned char source[], int length)
/* Used by auspost.c also */
INTERNAL int daft_set_height(struct zint_symbol *symbol, const float min_height, const float max_height) {
int error_number = 0;
float t_ratio; /* Tracker ratio */
if (symbol->height) {
t_ratio = stripf(symbol->row_height[1] / stripf(symbol->row_height[0] * 2 + symbol->row_height[1]));
/* Tracker ratio */
const float t_ratio = stripf(symbol->row_height[1] / stripf(symbol->row_height[0] * 2
+ symbol->row_height[1]));
symbol->row_height[1] = stripf(symbol->height * t_ratio);
if (symbol->row_height[1] < 0.5f) { /* Absolute minimum */
symbol->row_height[1] = 0.5f;
@ -487,10 +490,12 @@ INTERNAL int rm4scc(struct zint_symbol *symbol, unsigned char source[], int leng
Bar pitch and min/maxes same as Mailmark, so using recommendations from
Royal Mail Mailmark Barcode Definition Document (15 Sept 2015) Section 3.5.1
*/
symbol->row_height[0] = stripf((1.9f * 42.3f) / 25.4f); /* ~3.16 */
symbol->row_height[1] = stripf((1.3f * 42.3f) / 25.4f); /* ~2.16 */
const float min_height = 6.47952747f; /* (4.22 * 39) / 25.4 */
const float max_height = 10.8062992f; /* (5.84 * 47) / 25.4 */
symbol->row_height[0] = 3.16417313f; /* (1.9 * 42.3) / 25.4 */
symbol->row_height[1] = 2.16496062f; /* (1.3 * 42.3) / 25.4 */
/* Note using max X for minimum and min X for maximum */
error_number = daft_set_height(symbol, stripf((4.22f * 39) / 25.4f), stripf((5.84f * 47) / 25.4f));
error_number = daft_set_height(symbol, min_height, max_height);
} else {
symbol->row_height[0] = 3.0f;
symbol->row_height[1] = 2.0f;
@ -543,10 +548,12 @@ INTERNAL int kix(struct zint_symbol *symbol, unsigned char source[], int length)
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* Dimensions same as RM4SCC */
symbol->row_height[0] = stripf((1.9f * 42.3f) / 25.4f); /* ~3.16 */
symbol->row_height[1] = stripf((1.3f * 42.3f) / 25.4f); /* ~2.16 */
const float min_height = 6.47952747f; /* (4.22 * 39) / 25.4 */
const float max_height = 10.8062992f; /* (5.84 * 47) / 25.4 */
symbol->row_height[0] = 3.16417313f; /* (1.9 * 42.3) / 25.4 */
symbol->row_height[1] = 2.16496062f; /* (1.3 * 42.3) / 25.4 */
/* Note using max X for minimum and min X for maximum */
error_number = daft_set_height(symbol, stripf((4.22f * 39) / 25.4f), stripf((5.84f * 47) / 25.4f));
error_number = daft_set_height(symbol, min_height, max_height);
} else {
symbol->row_height[0] = 3.0f;
symbol->row_height[1] = 2.0f;
@ -737,9 +744,11 @@ INTERNAL int japanpost(struct zint_symbol *symbol, unsigned char source[], int l
X 0.6mm (0.5mm - 0.7mm)
Tracker height 1.2mm (1.05mm - 1.35mm) / 0.6mm = 2,
Ascender/descender = 1.2mm (Full 3.6mm (3.4mm - 3.6mm, max preferred) less T divided by 2) / 0.6mm = 2 */
const float min_height = 4.85714293f; /* 3.4 / 0.7 */
const float max_height = 7.19999981f; /* 3.6 / 0.5 */
symbol->row_height[0] = 2.0f;
symbol->row_height[1] = 2.0f;
error_number = daft_set_height(symbol, stripf(3.4f / 0.7f) /*~4.857*/, stripf(3.6f / 0.5f) /*7.2*/);
error_number = daft_set_height(symbol, min_height, max_height);
} else {
symbol->row_height[0] = 3.0f;
symbol->row_height[1] = 2.0f;

View file

@ -1,7 +1,7 @@
/* raster.c - Handles output to raster files */
/*
libzint - the open source barcode library
Copyright (C) 2009-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -825,8 +825,10 @@ static int plot_raster_maxicode(struct zint_symbol *symbol, const int rotate_ang
}
if (error_number == 0) {
/* Check whether size is compliant */
const float min_ratio = 0.92993629f; /* 24.82 / 26.69 */
const float max_ratio = 1.177984f; /* 27.93 / 23.71 */
const float size_ratio = (float) hex_image_width / hex_image_height;
if (size_ratio < 24.82f / 26.69f || size_ratio > 27.93f / 23.71f) {
if (size_ratio < min_ratio || size_ratio > max_ratio) {
strcpy(symbol->errtxt, "663: Size not within the minimum/maximum ranges");
error_number = ZINT_WARN_NONCOMPLIANT;
}

View file

@ -1,5 +1,15 @@
/* gen_corpora.c - write out initial fuzz data for zint, allowing for how `set_symbol()` in "fuzz.h" uses first X
bytes to set various `zint_symbol` members (namely `input_mode`, `option_1`, `option_2`, `eci`, `option_3`) */
/*
From "backend/tests/fuzz" directory:
rm -rf fuzz_data_corpus fuzz_gs1_corpus
rm -f fuzz_data_seed_corpus.zip fuzz_gs1_seed_corpus.zip
gcc gen_corpora.c -o gen_corpora -lzint -fsanitize=address
./gen_corpora
zip -j fuzz_data_seed_corpus.zip fuzz_data_corpus/*
zip -j fuzz_gs1_seed_corpus.zip fuzz_gs1_corpus/*
*/
/*
libzint - the open source barcode library
Copyright (C) 2024 Robin Stuart <rstuart114@gmail.com>

View file

@ -1,6 +1,6 @@
/*
libzint - the open source barcode library
Copyright (C) 2019-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2019-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -682,7 +682,7 @@ static void test_buffer_vector(const testCtx *const p_ctx) {
/*128*/ { BARCODE_UPNQR, "1234567890AB", "", 77, 77, 77, 154, 154 },
/*129*/ { BARCODE_ULTRA, "1234567890", "", 13, 13, 18, 36, 26 },
/*130*/ { BARCODE_RMQR, "12345", "", 11, 11, 27, 54, 22 },
/*131*/ { BARCODE_BC412, "1234567", "", 16.666668, 1, 102, 204, 49.613335 },
/*131*/ { BARCODE_BC412, "1234567", "", 16.666666, 1, 102, 204, 49.613335 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -2012,8 +2012,8 @@ static void test_quiet_zones(const testCtx *const p_ctx) {
/*292*/ { BARCODE_ULTRA, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 13, 13, 15, 34, 30, 2, 2, 30, 2 },
/*293*/ { BARCODE_RMQR, -1, -1, -1, -1, "1234", "", 0, 11, 11, 27, 54, 22, 0, 0, 14, 2 },
/*294*/ { BARCODE_RMQR, BARCODE_QUIET_ZONES, -1, -1, -1, "1234", "", 0, 11, 11, 27, 62, 30, 4, 4, 14, 2 },
/*295*/ { BARCODE_BC412, -1, -1, -1, -1, "1234567", "", 0, 16.666668, 1, 102, 204, 49.613335, 0, 0, 2, 33.333336 },
/*296*/ { BARCODE_BC412, BARCODE_QUIET_ZONES, -1, -1, -1, "1234567", "", 0, 16.666668, 1, 102, 244, 49.613335, 20, 0, 2, 33.333336 },
/*295*/ { BARCODE_BC412, -1, -1, -1, -1, "1234567", "", 0, 16.666666, 1, 102, 204, 49.613335, 0, 0, 2, 33.333336 },
/*296*/ { BARCODE_BC412, BARCODE_QUIET_ZONES, -1, -1, -1, "1234567", "", 0, 16.666666, 1, 102, 244, 49.613335, 20, 0, 2, 33.333336 },
};
int data_size = ARRAY_SIZE(data);
int i, length, ret;
@ -2590,8 +2590,8 @@ static void test_height(const testCtx *const p_ctx) {
/*316*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 4.8, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 4.8000002, 3, 129, 258, 9.6000004, "" },
/*317*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 4.9, "12345678901234567890", "", 0, 4.9000001, 3, 129, 258, 9.8000002, "" },
/*318*/ { BARCODE_USPS_IMAIL, -1, 7.7, "12345678901234567890", "", 0, 7.6999998, 3, 129, 258, 15.4, "" },
/*319*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 7.7, "12345678901234567890", "", 0, 7.7000003, 3, 129, 258, 15.400001, "" },
/*320*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 7.8, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 7.7999997, 3, 129, 258, 15.599999, "" },
/*319*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 7.7, "12345678901234567890", "", 0, 7.69999981, 3, 129, 258, 15.3999996, "" },
/*320*/ { BARCODE_USPS_IMAIL, COMPLIANT_HEIGHT, 7.8, "12345678901234567890", "", ZINT_WARN_NONCOMPLIANT, 7.80000019, 3, 129, 258, 15.6000004, "" },
/*321*/ { BARCODE_PLESSEY, -1, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "" },
/*322*/ { BARCODE_PLESSEY, COMPLIANT_HEIGHT, 1, "1234567890", "", 0, 1, 1, 227, 454, 2, "TODO: Find doc" },
/*323*/ { BARCODE_PLESSEY, -1, 4, "1234567890", "", 0, 4, 1, 227, 454, 8, "" },

View file

@ -1,7 +1,7 @@
/* upcean.c - Handles UPC, EAN and ISBN */
/*
libzint - the open source barcode library
Copyright (C) 2008-2022 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -135,7 +135,7 @@ static int upca_cc(struct zint_symbol *symbol, const unsigned char source[], int
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* BS EN 797:1996 4.5.1 Nominal dimensions 22.85mm / 0.33mm (X) ~ 69.24,
same as minimum GS1 General Specifications 21.0.1 5.12.3.1 */
const float height = stripf(22.85f / 0.33f);
const float height = 69.242424f; /* 22.85 / 0.33 */
if (symbol->symbology == BARCODE_UPCA_CC) {
symbol->height = height; /* Pass back min row == default height */
} else {
@ -307,7 +307,7 @@ static int upce_cc(struct zint_symbol *symbol, unsigned char source[], int lengt
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* BS EN 797:1996 4.5.1 Nominal dimensions 22.85mm / 0.33mm (X) ~ 69.24,
same as minimum GS1 General Specifications 21.0.1 5.12.3.1 */
const float height = stripf(22.85f / 0.33f);
const float height = 69.242424f; /* 22.85 / 0.33 */
if (symbol->symbology == BARCODE_UPCE_CC) {
symbol->height = height; /* Pass back min row == default height */
} else {
@ -443,7 +443,7 @@ static int ean13_cc(struct zint_symbol *symbol, const unsigned char source[], in
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* BS EN 797:1996 4.5.1 Nominal dimensions 22.85mm / 0.33mm (X) ~ 69.24,
same as minimum GS1 General Specifications 21.0.1 5.12.3.1 */
const float height = stripf(22.85f / 0.33f);
const float height = 69.242424f; /* 22.85 / 0.33 */
if (symbol->symbology == BARCODE_EANX_CC) {
symbol->height = height; /* Pass back min row == default height */
} else {
@ -492,7 +492,7 @@ static int ean8_cc(struct zint_symbol *symbol, const unsigned char source[], int
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* BS EN 797:1996 4.5.1 Nominal dimensions 18.23mm / 0.33mm (X) ~ 55.24,
same as minimum GS1 General Specifications 21.0.1 5.12.3.1 */
const float height = stripf(18.23f / 0.33f);
const float height = 55.242424f; /* 18.23 / 0.33 */
if (symbol->symbology == BARCODE_EANX_CC) {
symbol->height = height; /* Pass back min row == default height */
} else {
@ -817,7 +817,7 @@ INTERNAL int eanx_cc(struct zint_symbol *symbol, unsigned char source[], int src
ustrcpy(symbol->text, first_part);
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* 21.9mm from GS1 General Specifications 5.2.6.6, Figure 5.2.6.6-6 */
const float height = stripf(21.9f / 0.33f); /* 21.9mm / 0.33mm ~ 66.36 */
const float height = 66.3636398f; /* 21.9 / 0.33 */
error_number = set_height(symbol, height, height, 0.0f, 0 /*no_errtxt*/);
} else {
(void) set_height(symbol, 0.0f, 50.0f, 0.0f, 1 /*no_errtxt*/);

View file

@ -1,5 +1,5 @@
/***************************************************************************
* Copyright (C) 2021-2023 by Robin Stuart <rstuart114@gmail.com> *
* Copyright (C) 2021-2024 by Robin Stuart <rstuart114@gmail.com> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *

View file

@ -167,11 +167,14 @@ $(OUT_TXT) : $(SOURCE) $(SOURCE_MAN_PAGE) $(INCLUDES_TXT) Makefile
-V $(MAIN_FONT) -V $(MONO_FONT) -V $(CJK_FONT) \
$(TXT_OPTS) \
-o $(OUT_TXT)
# Indent Man Page sections in TOC, remove trailing spaces and echoed image tags
# Indent Man Page sections in TOC, remove trailing spaces, echoed image tags, tbl: hashes
# & clean up Table captions
sed -i \
-e 's/^\(- [A-Z][A-Z ]*\)$$/ \1/' \
-e 's/ *$$//' \
-e '/^\[.*\]$$/{N;N;s/\[\(.*\)\]\n\n\1/[\1]/;p;d}' \
-e 's/ *{#tbl:[^}]*}//' \
-e 's/: Table\xC2\xA0: \([^:]*\):/Table : \1/' \
$(OUT_TXT)
# Wrap
sed -i '/.\{81\}/{s/.\{80\}/&\n/}' $(OUT_TXT)

View file

@ -2,8 +2,8 @@ For generation of "docs/manual.pdf" and "docs/manual.txt" from "manual.pmd" usin
On Ubuntu/Debian (tested on Ubuntu 22.04)
wget https://github.com/jgm/pandoc/releases/download/3.1.11/pandoc-3.1.11-1-amd64.deb
sudo dpkg -i pandoc-3.1.11-1-amd64.deb
wget https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-1-amd64.deb
sudo dpkg -i pandoc-3.1.11.1-1-amd64.deb
sudo apt install python3-pip
pip install pandoc-tablenos --user
export PATH=~/.local/bin:"$PATH"
@ -18,9 +18,9 @@ On Ubuntu/Debian (tested on Ubuntu 22.04)
On Fedora (tested on Fedora Linux 38 (Workstation Edition))
wget https://github.com/jgm/pandoc/releases/download/3.1.11/pandoc-3.1.11-linux-amd64.tar.gz
tar xf pandoc-3.1.11-linux-amd64.tar.gz
sudo mv -i pandoc-3.1.11/bin/pandoc /usr/local/bin
wget https://github.com/jgm/pandoc/releases/download/3.1.11.1/pandoc-3.1.11.1-linux-amd64.tar.gz
tar xf pandoc-3.1.11.1-linux-amd64.tar.gz
sudo mv -i pandoc-3.1.11.1/bin/pandoc /usr/local/bin
sudo dnf install python3-pip
pip install pandoc-tablenos --user
export PATH=~/.local/bin:"$PATH"

View file

@ -593,7 +593,7 @@ meanings as given below:
* Insert leading asterisks
Any other character Interpreted literally
: Table : Sequence Format Characters:
Table : Sequence Format Characters
Once youre happy with the Sequence Data, click the "Export..." button to bring
up the Export Dialog, discussed next.
@ -717,7 +717,7 @@ sequences are shown in the table below.
is hexadecimal (000000-10FFFF)
----------------------------------------------------------------------------
: Table : Escape Sequences:
Table : Escape Sequences
(Special escape sequences are available for Code 128 only to manually switch
Code Sets - see 6.1.10.1 Standard Code 128 (ISO 15417) for details.)
@ -761,7 +761,7 @@ The currently supported output file formats are shown in the following table.
tif Tagged Image File Format
txt Text file (see 4.19 Other Options)
: Table : Output File Formats:
Table : Output File Formats
The filename can contain directories and sub-directories also, which will be
created if they dont already exist:
@ -999,7 +999,7 @@ underscores are optional.
146 BARCODE_BC412 IBM BC412 (SEMI T1-95)
------------------------------------------------------------------------------
: Table : Barcode Types (Symbologies):
Table : Barcode Types (Symbologies)
4.4 Adjusting Height
@ -1206,7 +1206,7 @@ To summarize the more intricate details:
Yes EMF 40 0.1 N/A
-------------------------------------------------------------------
: Table : Scaling Multipliers and Minima:
Table : Scaling Multipliers and Minima
4.9.1 Scaling by X-dimension and Resolution
@ -1325,7 +1325,7 @@ Latin-2 (ISO/IEC 8859-2 plus ASCII).
UPNQR Latin-2 N/A
All others ASCII N/A
: Table : Default Character Sets:
Table : Default Character Sets
If Zint encounters characters which can not be encoded using the default
character encoding then it will take advantage of the ECI (Extended Channel
@ -1375,7 +1375,7 @@ data. The symbologies that support ECI are
DotCode MicroPDF417 Ultracode
------------- -------------- -----------
: Table : ECI-Aware Symbologies:
Table : ECI-Aware Symbologies
Be aware that not all barcode readers support ECI mode, so this can sometimes
lead to unreadable barcodes. If you are using characters beyond those supported
@ -1422,7 +1422,7 @@ formatted. Zint automatically translates the data into the target encoding.
170 ISO/IEC 646 Invariant[6]
899 8-bit binary data
: Table : ECI Codes:
Table : ECI Codes
An ECI value of 0 does not encode any ECI information in the code symbol (unless
the data contains non-default character set characters). In this case, the
@ -1525,7 +1525,7 @@ characters in the output filename as shown in the table below:
@ Insert a number or * (or + on Windows)
Any other Insert literally
: Table : Batch Filename Formatting:
Table : Batch Filename Formatting
For instance
@ -1541,7 +1541,7 @@ The following table shows some examples to clarify this method:
-o my~~~bar.eps "my001bar.eps", "my002bar.eps", "my003bar.eps"
-o t#es~t~.png "t es0t1.png", "t es0t2.png", "t es0t3.png"
: Table : Batch Filename Examples:
Table : Batch Filename Examples
The special characters can span directories also, which is useful when creating
a large number of barcodes:
@ -1551,7 +1551,7 @@ a large number of barcodes:
-o dir~/file~~~.svg "dir0/file001.svg", "dir0/file002.svg", …
, "dir0/file999.svg", "dir1/file000.svg", …
: Table : Batch Directory Examples:
Table : Batch Directory Examples
For an alternative method of naming output files see the --mirror option in 4.14
Automatic Filenames below.
@ -2204,7 +2204,7 @@ the nature of the error. The errors generated by Zint are:
ZINT_WARN_HRT_TRUNCATED occurs.
------------------------------------------------------------------------------
: Table : API Warning and Error Return Values:
Table : API Warning and Error Return Values
To catch errors use an integer variable as shown in the code below:
@ -2562,7 +2562,7 @@ see which are set.
defined?
------------------------------------------------------------------------------
: Table : API Capability Flags:
Table : API Capability Flags
For example:
@ -2869,7 +2869,7 @@ below:
5 Modulo-11 (NCR)
6 Modulo-11 (NCR) & Modulo-10
: Table : MSI Plessey Check Digit Options:
Table : MSI Plessey Check Digit Options
To not show the check digit or digits in the Human Readable Text, add 10 to the
--vers value. For example --vers=12 (API option_2 = 12) will add two hidden
@ -3114,7 +3114,7 @@ and is of the form:
-----------------------------------------------------------------------
: Table : DPD Input Fields:
Table : DPD Input Fields
A warning will be generated if the Service Code, the Destination Country Code,
or the last 10 characters of the Tracking Number are non-numeric.
@ -3230,7 +3230,7 @@ the table below:
7 000000 576688
8 0000000 7742862
: Table : Channel Value Ranges:
Table : Channel Value Ranges
6.1.14 BC412 (SEMI T1-95)
@ -3463,7 +3463,7 @@ encoding methods. Valid values are shown below.
Expanded Stacked component
----------------------------------------------------------------------------
: Table : GS1 Composite Symbology Values:
Table : GS1 Composite Symbology Values
The data to be encoded in the linear component of a composite symbol should be
entered into a primary string with the data for the 2D component being entered
@ -3600,7 +3600,7 @@ shown in the following table.
23 99999999999999999999999 67-bar 62 N
---------------------------------------------------------------
: Table : Australia Post Input Formats:
Table : Australia Post Input Formats
6.5.1.2 Reply Paid Barcode
@ -3660,7 +3660,8 @@ the following table.
----------------------------------------------------------------------------
: Table : Royal Mail 4-State Mailmark Input Fields:
Table : Royal Mail 4-State Mailmark Input Fields
The 6 Destination+DPS (Destination Post Code plus Delivery Point Suffix)
patterns are:
@ -3670,7 +3671,8 @@ patterns are:
FFNFNLLNL FNNLLNLSS FNNNLLNLS
----------- ----------- -----------
: Table : Royal Mail Mailmark Destination+DPS Patterns:
Table : Royal Mail Mailmark Destination+DPS Patterns
where 'F' stands for full alphabetic (A-Z), 'L' for limited alphabetic (A-Z less
'CIKMOV'), 'N' for numeric (0-9), and 'S' for space.
@ -3757,7 +3759,7 @@ standards have now been removed from Zint.
9 26 x 26 19 88 x 88 29 16 x 36
10 32 x 32 20 96 x 96 30 16 x 48
: Table : Data Matrix Sizes:
Table : Data Matrix Sizes
The largest version 24 (144 x 144) can encode 3116 digits, around 2335
alphanumeric characters, or 1555 bytes of data.
@ -3781,7 +3783,7 @@ the following values as before:
38 12 x 88 47 26 x 48
39 16 x 64 48 26 x 64
: Table : DMRE Sizes:
Table : DMRE Sizes
DMRE symbol sizes may be activated in automatic size mode using the option
--dmre (API option_3 = DM_DMRE).
@ -3828,7 +3830,7 @@ section, as summarized below.
Reserved 6 Spaces
Customer Data 6, 45 or 29 Anything (Latin-1)
: Table : Royal Mail 2D Mailmark Input Fields:
Table : Royal Mail 2D Mailmark Input Fields
The 6 Destination+DPS (Destination Post Code plus Delivery Point Suffix)
patterns are the same as for the 4-state - see Table
@ -3841,7 +3843,7 @@ i.e.
FFNFNLL FNNLLSS FNNNLLS
--------- --------- ---------
: Table : Royal Mail 2D Mailmark RTS Patterns:
Table : Royal Mail 2D Mailmark RTS Patterns
where 'F' is full alphabetic (A-Z), 'L' limited alphabetic (A-Z less 'CIKMOV'),
'N' numeric (0-9), and 'S' space.
@ -3855,7 +3857,7 @@ optional customer data:
Type 9 32 x 32 45 characters 10
Type 29 16 x 48 29 characters 30
: Table : Royal Mail 2D Mailmark Sizes:
Table : Royal Mail 2D Mailmark Sizes
Zint will automatically select a size based on the amount of customer data, or
it can be specified using the --vers option (API option_2), which takes the Zint
@ -3882,7 +3884,7 @@ option_1) as shown in the following table.
3 Q Approx 55% of symbol Approx 25%
4 H Approx 65% of symbol Approx 30%
: Table : QR Code ECC Levels:
Table : QR Code ECC Levels
The size of the symbol can be specified by setting the --vers option (API
option_2) to the QR Code version required (1-40). The size of symbol generated
@ -3905,7 +3907,7 @@ is shown in the table below.
13 69 x 69 27 125 x 125
14 73 x 73 28 129 x 129
: Table : QR Code Sizes:
Table : QR Code Sizes
The maximum capacity of a QR Code symbol (version 40) is 7089 numeric digits,
4296 alphanumeric characters or 2953 bytes of data. QR Code symbols can also be
@ -3963,7 +3965,7 @@ that versions M1 and M2 have restrictions on what characters can be encoded.
4 M4 17 x 17 Latin-1 and Shift JIS
------------------------------------------------------------------
: Table : Micro QR Code Sizes:
Table : Micro QR Code Sizes
Version M4 can encode up to 35 digits, 21 alphanumerics, 15 bytes or 9 Kanji
characters.
@ -3983,7 +3985,7 @@ not available for any version, and ECC level Q is only available for version M4:
3 Q Approx 55% of symbol Approx 25% M4
----------------------------------------------------------------------
: Table : Micro QR ECC Levels:
Table : Micro QR ECC Levels
The defaults for symbol size and ECC level depend on the input and whether
either of them is specified.
@ -4014,7 +4016,7 @@ valid for this type of symbol.
2 M Approx 37% of symbol Approx 15%
4 H Approx 65% of symbol Approx 30%
: Table : rMQR ECC Levels:
Table : rMQR ECC Levels
The preferred symbol sizes can be selected using the --vers option (API
option_2) as shown in the table below. Input values between 33 and 38 fix the
@ -4062,7 +4064,7 @@ height of the symbol while allowing Zint to determine the minimum symbol width.
19 R13x59 13 x 59 38 R17xW 17 x automatic width
------------------------------------------------------------------------------
: Table : rMQR Sizes:
Table : rMQR Sizes
The largest version R17x139 (32) can encode up to 361 digits, 219 alphanumerics,
150 bytes, or 92 Kanji characters.
@ -4113,7 +4115,7 @@ message required by Zint is given in the following table.
10 - 12 Three-digit country code according to ISO 3166-1.
13 - 15 Three-digit service code. This depends on your parcel courier.
: Table : MaxiCode Structured Carrier Message Format:
Table : MaxiCode Structured Carrier Message Format
The primary message can be set at the command prompt using the --primary switch
(API primary). The secondary message uses the normal data entry method. For
@ -4168,7 +4170,7 @@ Example maximum data lengths are given in the table below:
6 93 138 50
------------------------------------------------------------------------
: Table : MaxiCode Data Length Maxima:
Table : MaxiCode Data Length Maxima
* - secondary only
@ -4212,7 +4214,7 @@ a smaller bullseye pattern at the centre of the symbol.
11 45 x 45 23 95 x 95 35 147 x 147
12 49 x 49 24 101 x 101 36 151 x 151
: Table : Aztec Code Sizes:
Table : Aztec Code Sizes
Note that in symbols which have a specified size the amount of error correction
is dependent on the length of the data input and Zint will allow error
@ -4228,7 +4230,7 @@ the --secure option (API option_1) to a value from the following table.
3 >36% + 3 codewords
4 >50% + 3 codewords
: Table : Aztec Code Error Correction Modes:
Table : Aztec Code Error Correction Modes
It is not possible to select both symbol size and error correction capacity for
the same symbol. If both options are selected then the error correction capacity
@ -4288,7 +4290,7 @@ and variable-width versions (versions S and T). These can be selected by using
10 T width x 16 90 55
--------------------------------------------------------------
: Table : Code One Sizes:
Table : Code One Sizes
Version S symbols can only encode numeric data. The width of version S and
version T symbols is determined by the length of the input data.
@ -4326,7 +4328,7 @@ using the --secure option (API option_1), according to the following tables.
6 78 x 78 13 162 x 162
7 90 x 90
: Table : Grid Matrix Sizes:
Table : Grid Matrix Sizes
Mode Error Correction Capacity
------ ---------------------------
@ -4336,7 +4338,7 @@ using the --secure option (API option_1), according to the following tables.
4 Approximately 40%
5 Approximately 50%
: Table : Grid Matrix Error Correction Modes:
Table : Grid Matrix Error Correction Modes
Non-ASCII data density may be maximized by using the --fullmultibyte switch (API
option_3 = ZINT_FULL_MULTIBYTE), but check that your barcode reader supports
@ -4414,7 +4416,7 @@ to a value between 1 and 84 according to the following table.
27 75 x 75 55 131 x 131 83 187 x 187
28 77 x 77 56 133 x 133 84 189 x 189
: Table : Han Xin Sizes:
Table : Han Xin Sizes
The largest version (84) can encode 7827 digits, 4350 ASCII characters, up to
2175 Chinese characters, or 3261 bytes, making it the most capacious of all the
@ -4431,7 +4433,7 @@ following table.
3 Approx 23%
4 Approx 30%
: Table : Han Xin Error Correction Modes:
Table : Han Xin Error Correction Modes
Non-ASCII data density may be maximized by using the --fullmultibyte switch (API
option_3 = ZINT_FULL_MULTIBYTE), but check that your barcode reader supports
@ -4461,7 +4463,7 @@ modes are supported. The amount of error correction can be set using the
5 EC4 Approx 25%
6 EC5 Approx 33%
: Table : Ultracode Error Correction Values:
Table : Ultracode Error Correction Values
Zint does not currently implement data compression by default, but this can be
initiated through the API by setting
@ -4505,7 +4507,7 @@ generated using the characters A-E as shown in the table below.
D Used for Information Based Indicia (IBI) postage.
E Used for customized mail with a USPS Intelligent Mail barcode.
: Table : Valid FIM Characters:
Table : Valid FIM Characters
6.7.2 Flattermarken
@ -4695,7 +4697,7 @@ reproduced here for reference.
E SO RS . > N ^ n ~
F SI US / ? O _ o DEL
: Table : ASCII:
Table : ASCII
A.2 Latin Alphabet No. 1 (ISO/IEC 8859-1)
@ -4724,7 +4726,7 @@ defined.
E ® ¾ Î Þ î þ
F ¯ ¿ Ï ß ï ÿ
: Table : ISO/IEC 8859-1:
Table : ISO/IEC 8859-1
Annex B. Qt Backend QZint

View file

@ -1,4 +1,4 @@
.\" Automatically generated by Pandoc 3.1.11
.\" Automatically generated by Pandoc 3.1.11.1
.\"
.TH "ZINT" "1" "January 2024" "Version 2.13.0.9" ""
.SH NAME

View file

@ -1,7 +1,7 @@
/* main.c - Command line handling routines for Zint */
/*
libzint - the open source barcode library
Copyright (C) 2008-2023 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2008-2024 Robin Stuart <rstuart114@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -27,7 +27,7 @@
#ifndef _MSC_VER
# include <getopt.h>
# ifdef __NetBSD__ /* `getopt_long_only()` not available */
# if defined(__NetBSD__) && !defined(getopt_long_only) /* `getopt_long_only()` not available */
# define getopt_long_only getopt_long
# endif
# include <zint.h>
@ -1817,13 +1817,11 @@ int main(int argc, char **argv) {
return do_exit(ZINT_ERROR_INVALID_OPTION);
}
switch (val) {
case 90: rotate_angle = 90;
break;
case 180: rotate_angle = 180;
break;
case 270: rotate_angle = 270;
break;
case 0: rotate_angle = 0;
case 0:
case 90:
case 180:
case 270:
rotate_angle = val;
break;
default:
fprintf(stderr,