Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EAN13 standardized label broken #10

Open
teicher opened this issue Jul 7, 2021 · 2 comments
Open

EAN13 standardized label broken #10

teicher opened this issue Jul 7, 2021 · 2 comments

Comments

@teicher
Copy link

teicher commented Jul 7, 2021

When creating a EAN13 with standardized label something is broken with the computation of the white boxes and the font heights. Especially is looks like setFont() is never called internally in this code flow and defaults to something

        Barcode b = new Barcode();
        b.setIncludeLabel(true);
        b.setLabelFont(new Font("Monospace", Font.PLAIN, 25));
        // EAN13 "standardized label tries to separate the digits and blank out the lower bounds of two
        // blocks in the EAN, to look like what we find on some products. however it fails to adjust the font
        // size and looks awful
        b.setStandardizeLabel(true); //change to false and it looks ok, but not "standardized"
        BufferedImage img = (BufferedImage) b.encode(Barcode.TYPE.EAN13, val);

Bildschirmfoto 2021-07-07 um 17 44 10
Bildschirmfoto 2021-07-07 um 17 45 06

version: 'com.pnuema.java:barcode:1.10'

@teicher
Copy link
Author

teicher commented Jul 7, 2021

updated my comment above. sorry for the empty commit.
BTW as the Image is a BufferedImage anyway, that could be the return type of encode(), allowing to work with it with ImageIO and stuff. (or RenderedImage if you prefer an interface)

@barnhill
Copy link
Owner

I did notice this myself while rewriting the drawing in the .NET version of this lib. The labels are a huge pain and should be rewritten. I would love to see a pull request to help with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants