diff --git a/backend/codablock.c b/backend/codablock.c index 8a7d548a..46a7d7b6 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -699,13 +699,13 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) { columns = ((int)floor(sqrt(1.0*dataLength))+5); if (columns > 64) columns = 64; - #ifdef _DEBUG - printf("Auto column count for %d characters:%d\n",dataLength,columns); - #endif + #ifdef _DEBUG + printf("Auto column count for %d characters:%d\n",dataLength,columns); + #endif } } - /* There are 5 Codewords for Organisation Start(2),row(1),CheckSum,Stop */ - useColumns = columns - 5; + /* There are 5 Codewords for Organisation Start(2),row(1),CheckSum,Stop */ + useColumns = columns - 5; if ( rows > 0 ) { /* row count given */ Error=Rows2Columns(T,data,dataLength,&rows,&useColumns,pSet,&fillings); @@ -984,6 +984,7 @@ int codablock(struct zint_symbol *symbol, unsigned char source[], int length) { } expand(symbol, dest); } + set_minimum_height(symbol, 8); if (!(symbol->output_options & BARCODE_BIND)) { symbol->output_options += BARCODE_BIND; diff --git a/backend/common.c b/backend/common.c index 5cd39a64..ad597a5f 100644 --- a/backend/common.c +++ b/backend/common.c @@ -286,10 +286,12 @@ void set_minimum_height(struct zint_symbol *symbol, int min_height) { } } - if (((symbol->height - fixed_height) / zero_count) < min_height) { - for (i = 0; i < symbol->rows; i++) { - if (symbol->row_height[i] == 0) { - symbol->row_height[i] = min_height; + if (zero_count > 0) { + if (((symbol->height - fixed_height) / zero_count) < min_height) { + for (i = 0; i < symbol->rows; i++) { + if (symbol->row_height[i] == 0) { + symbol->row_height[i] = min_height; + } } } } diff --git a/backend/library.c b/backend/library.c index 420f0b4e..401c089c 100644 --- a/backend/library.c +++ b/backend/library.c @@ -50,7 +50,7 @@ struct zint_symbol *ZBarcode_Create() { memset(symbol, 0, sizeof (*symbol)); symbol->symbology = BARCODE_CODE128; - symbol->height = 0; + symbol->height = 50; symbol->whitespace_width = 0; symbol->border_width = 0; symbol->output_options = 0;