Zint-Barcode-Generator-for-Delphi icon indicating copy to clipboard operation
Zint-Barcode-Generator-for-Delphi copied to clipboard

Bad height of Code128 and alike

Open zEnterHacker opened this issue 4 years ago • 9 comments

Hi, First of all thanks for this super port. I'm using the initial version with great joy. Now I'm testing version 25.02.2020:

Comparing the latest version of Zint for Delphi with the previous one I find that a lot Code128 or alike are not taking correct dimensions. They are cropped in height by some fixed factor. To illustrate please see below - screen dump taken form the supplied VCL demos. <----- Left shows version: 25.02.2020 Girocode-Generator EPC-QR: -----> Right shows initial version:

image The BoxModel does not seem to have changed - so I guess this is a small bug and happens for all 'simple' linestyled bar codes Code128 UPC .. etc?

Would be nice to have that fixed ;-)

Best regards zEn

zEnterHacker avatar Nov 12 '21 08:11 zEnterHacker

Which initial version you mean? Do you have a link? Thanks

landrix avatar Nov 12 '21 13:11 landrix

Hi landrix ,

Well difficult to say. I simply can't remember where I got hold of this - but fear not the original zip file is attached to this post - it was originally downloaded on 2020-01-15 (from somewhere ??)

Zint-Barcode-Generator-for-Delphi-master.zip

I can do a simple file compare, and yes there are some changes made with respect to a 'Height' container in the new version, but I'm afraid I cannot see exactly how to rework the source to have the same functionality as the old version (attached) and f.i. the DATA MATRIX code seems to work as usual. At the moment I have RAD Studio 10.3.3 & RAD Studio 11 - both shown the same behavior as indicated in my first post.

If You have further question - feel free to post back Best regards zEn

zEnterHacker avatar Nov 12 '21 14:11 zEnterHacker

Ok thanks, I will see

landrix avatar Nov 12 '21 15:11 landrix

Hi again,

I think it is this procedure that causes the problem (zint.pas): procedure check_row_heights(symbol : zint_symbol); It looks like codes without a pre-defined row_count (0) are forced to have 5 rows. This must be wrong because f.i. code128 becomes very narrow (1/5 in block height) and this will cause alignment problems for bar code readers. Skipping check_row_heights(symbol : zint_symbol) will cause normal height, but I guess the original C file includes this - and I'm not in a position to judge why. It is also not clear why 5 has been chosen as row_count when the row_count is undefined. It could be that the row_count needs to be set in . f.i. zint_code128.pas? - but the lack of comments makes it pretty hard to guess ;-)

Best regards zEn

zEnterHacker avatar Nov 15 '21 09:11 zEnterHacker

Any news on this issue? I guess I can't be the only one having this scaling problem.

Best regards zEn

zEnterHacker avatar May 12 '22 07:05 zEnterHacker

Hi, I have same problem. I'm using version from Commits on Apr 23, 2019 in my project. Generated barcode looks like this: image

Now I update Zint source to newest version and same code generate barcode like this: image

LukaszDemczuk avatar May 30 '22 07:05 LukaszDemczuk

I suppose the error is into function ZBarcode_Encode of zint.pas: old code:

  if error_number <= 5 then
    check_row_heights(symbol);

fixed code:

  if (error_number > 0) and (error_number <= 5) then
    check_row_heights(symbol);

Do you agree with this fix? Thank you and my compliments for the great job! Carlo

carloBarazzetta avatar Apr 29 '23 07:04 carloBarazzetta

Well difficult to say. I simply can't remember where I got hold of this - but fear not the original zip file is attached to this post - it was originally downloaded on 2020-01-15 (from somewhere ??)

Zint-Barcode-Generator-for-Delphi-master.zip

Both versions (initial and current) produce the same output for me. i don't have any scaling-problems. Delphi 11.3 and Surface Laptop with HighDPI 150%. So, whats different?

Screenshot 2023-04-29 094947

landrix avatar Apr 29 '23 07:04 landrix

I've made a new "clone", opened Zint-Barcode-Generator-for-Delphi\Demo\VCL\ZintTest.dproj with Delphi 11.3 Built, Run, Selected "Code 128..." this is my result: image Maybe you have some changes to your local folder: in the demo the imgResult component is Aligned alClient, as you can see in my screen-shot, but in your screen-shot it appears to be aligned to alNone... so we are using different source code.

carloBarazzetta avatar May 03 '23 12:05 carloBarazzetta