landrix / Zint-Barcode-Generator-for-Delphi

Zint Barcode Generator for Delphi
Apache License 2.0
103 stars 32 forks source link

Bad height of Code128 and alike #26

Open zEnterHacker opened 2 years ago

zEnterHacker commented 2 years ago

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

landrix commented 2 years ago

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

zEnterHacker commented 2 years ago

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

landrix commented 2 years ago

Ok thanks, I will see

zEnterHacker commented 2 years ago

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 commented 2 years ago

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

Best regards zEn

LukaszDemczuk commented 2 years ago

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

carloBarazzetta commented 1 year ago

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

landrix commented 1 year ago

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

carloBarazzetta commented 1 year ago

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.