Skip to content
G Bisconcini edited this page Jul 27, 2016 · 1 revision

What I have have done so far to fix the barbecue on linux problem related to not show text down the BARCODE is:

1- https://sourceforge.net/p/barbecue/discussion/266281/thread/786e8818/

Modified original /barbecue/src/java/net/sourceforge/barbecue/Barcode.java METHOD calculateSize TO THIS, like in post ->

private Dimension calculateSize() { Dimension d = new Dimension(); if(EnvironmentFactory.getEnvironment() instanceof HeadlessEnvironment) try {

            if(font == null)
            {
                d = draw(new SizingOutput(font, getForeground(), getBackground()), 0, 0, barWidth, barHeight);
            } else
            {
                java.awt.FontMetrics fontMetrics = getFontMetrics(font);
                d = draw(new SizingOutput(font, fontMetrics, getForeground(), getBackground()), 0, 0, barWidth, barHeight);
            }
        }
        catch(OutputException e)
        {
            e.printStackTrace();
        }
    else
        try
        {
            java.awt.FontMetrics fontMetrics = null;
            if(font != null)
                fontMetrics = getFontMetrics(font);
            d = draw(new SizingOutput(font, fontMetrics, getForeground(), getBackground()), 0, 0, barWidth, barHeight);
        }
        catch(OutputException e) { }
    return d;
}

2- https://sourceforge.net/p/barbecue/discussion/266281/thread/9ad47ca3/

and added this on same clas Barcode.java file:

    //this.font = EnvironmentFactory.getEnvironment().getDefaultFont();
    Font f=  new Font("Arial", Font.PLAIN, 18);
    this.font=f;

3- Also, I have downloaded the truetype fonts and installed on my Linux centos 7 OS. The font in question is ARIAL

Clone this wiki locally