Menu

#18 problem with text in headless mode

1.1
open
Swing/AWT (4)
5
2007-02-19
2007-02-19
No

Steps to reproduce: run the command below under X and in terminal:
java -jar barbecue-1.5-alpha3.jar -e code128 -b "0941919600001012004000001" -o test.png
Under X I have a text under barcode, in terminal mode - no. I've tried both 1.1 and 1.5-alpha3 versions.

Discussion

  • Sean Sullivan

    Sean Sullivan - 2007-03-25

    Logged In: YES
    user_id=156581
    Originator: NO

    What JVM are you using? Which version? Which OS? Which OS version?

     
  • Artem Astafyev

    Artem Astafyev - 2007-03-26

    Logged In: YES
    user_id=1016645
    Originator: YES

    JVM version: Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
    OS: ASPLinux 11 (Fedora 4 based)
    uname: Linux ws196.ltsp 2.6.18-1.2239.0.112aspsmp #1 SMP Tue Nov 14 21:02:14 EET 2006 i686 i686 i386 GNU/Linux
    X Windows rpm: xorg-x11-6.9.0-1.112.12asp

     
  • Sean Sullivan

    Sean Sullivan - 2007-03-26

    Logged In: YES
    user_id=156581
    Originator: NO

    add this to your command line: -Djava.awt.headless=true

     
  • Artem Astafyev

    Artem Astafyev - 2007-03-26

    Logged In: YES
    user_id=1016645
    Originator: YES

    With -Djava.awt.headless=true option both in terminal and in X there is no text under barcode.

     
  • Earwig

    Earwig - 2008-05-20

    Logged In: YES
    user_id=2092665
    Originator: NO

    I have the same trouble.

    Looking at the code, the main problems is in the Barcode.java and SizingOutput.java classes.

    The SizingOutput class gives the height calculation for the text: it does a hard assumption "if the font or fontmetrics are null returns 0 as text height".

    The Barcode class demand it's own size (all the Jcomponent size methods) to the "getActualSize()" method, which is a proxy to "calculateSize()".

    This last method is the problem, because it instantiate the SizingOutput class directly and these 2 methods are private, so i cannot override them to use another class to calculate Sizing.
    This is also the point where the "headless" property goes in action.

    I suggest to modify the "getActualSize()" and "calculateSize()" methods so they will get the "sizer class" from outside (maybe a public property, mantaining a default if not set), and to make them protected instead of private in order to make different calculation types.

     
  • Brill Pappin

    Brill Pappin - 2010-12-06

    Same problem here. Java 1.6 on Ubuntu 10.10

     

Log in to post a comment.

MongoDB Logo MongoDB