Add compliant height, using ZINT_COMPLIANT_HEIGHT flag for back-compatibility

Rename barcode funcs to same as BARCODE_XXX name
library: barcode funcs array for dispatch, used for ZBarcode_ValidID() also
general: change is_sane() comparison to nonzero from ZINT_ERROR_INVALID_OPTION
MAILMARK: fuller error messages
CODABAR: add option to show check character in HRT
zint.h: use 0xNNNN for OR-able defines
GUI: add guard descent height reset button, add Zint version to window title,
  static get_zint_version() method, use QStringLiteral (QSL shorthand),
  use SIGNAL(toggled()), add errtxt "popup" and status bar, add icons,
  add saveAs shortcut, add main menu, context menus and actions, add help,
  reset_view() -> reset_colours(), add copy to clipboard as EMF/GIF/PNG/TIF,
  lessen triggering of update_preview(), shorten names of getters/setters,
  simplify/shorten some update_preview() logic in switch,
  CODEONE disable structapp for Version S
qzint.cpp: add on_errored signal, add missing getters, add test
This commit is contained in:
gitlost 2021-10-09 00:13:39 +01:00
parent 206ae26d20
commit 72eac41c34
82 changed files with 5570 additions and 3774 deletions

View file

@ -244,7 +244,7 @@ static unsigned short USPS_MSB_Math_CRC11GenerateFrameCheckSequence(unsigned cha
INTERNAL int daft_set_height(struct zint_symbol *symbol, float min_height, float max_height);
INTERNAL int imail(struct zint_symbol *symbol, unsigned char source[], int length) {
INTERNAL int usps_imail(struct zint_symbol *symbol, unsigned char source[], int length) {
char data_pattern[200];
int error_number;
int i, j, read;
@ -434,22 +434,22 @@ INTERNAL int imail(struct zint_symbol *symbol, unsigned char source[], int lengt
read += 2;
}
#ifdef COMPLIANT_HEIGHTS
/* USPS-B-3200 Section 2.3.1
Using bar pitch as X (1" / 43) ~ 0.023" based on 22 bars + 21 spaces per inch (bar width 0.015" - 0.025"),
height 0.125" - 0.165"
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] = 0.0485f * 43; /* 2.0855 */
symbol->row_height[1] = 0.048f * 43; /* 2.064 */
/* Note using max X for minimum and min X for maximum */
error_number = daft_set_height(symbol, 0.125f * 39 /*4.875*/, 0.165f * 47 /*7.755*/);
#else
symbol->row_height[0] = 3.0f;
symbol->row_height[1] = 2.0f;
daft_set_height(symbol, 0.0f, 0.0f);
#endif
if (symbol->output_options & COMPLIANT_HEIGHT) {
/* USPS-B-3200 Section 2.3.1
Using bar pitch as X (1" / 43) ~ 0.023" based on 22 bars + 21 spaces per inch (bar width 0.015" - 0.025"),
height 0.125" - 0.165"
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 */
/* 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*/);
} else {
symbol->row_height[0] = 3.0f;
symbol->row_height[1] = 2.0f;
(void) daft_set_height(symbol, 0.0f, 0.0f);
}
symbol->rows = 3;
symbol->width = read - 1;
return error_number;